libxcks  0.1.0.1
sha384_512.cpp File Reference

Compute sha384 hash and sha512 hash. More...

#include <cstring>
#include "sha384_512.hpp"
Include dependency graph for sha384_512.cpp:

Go to the source code of this file.

Macros

#define X(a)
 Helper function for SHA512's computing. More...
 
#define ROTR(x, n)   (((x)>>(n)) | ((x)<<(64-(n))))
 Helper function for SHA512's computing. More...
 
#define Ch(x, y, z)   (((x) & (y)) ^ ((~(x)) & (z)))
 Helper function for SHA512's computing. More...
 
#define Maj(x, y, z)   (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
 Helper function for SHA512's computing. More...
 
#define Sum0(x)   (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))
 Helper function for SHA512's computing. More...
 
#define Sum1(x)   (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))
 Helper function for SHA512's computing. More...
 
#define S0(x)   (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))
 Helper function for SHA512's computing. More...
 
#define S1(x)   (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))
 Helper function for SHA512's computing. More...
 

Detailed Description

Compute sha384 hash and sha512 hash.

Definition in file sha384_512.cpp.

Macro Definition Documentation

◆ Ch

#define Ch (   x,
  y,
 
)    (((x) & (y)) ^ ((~(x)) & (z)))

Helper function for SHA512's computing.

◆ Maj

#define Maj (   x,
  y,
 
)    (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))

Helper function for SHA512's computing.

◆ ROTR

#define ROTR (   x,
 
)    (((x)>>(n)) | ((x)<<(64-(n))))

Helper function for SHA512's computing.

◆ S0

#define S0 (   x)    (ROTR((x),1) ^ ROTR((x),8) ^ ((x)>>7))

Helper function for SHA512's computing.

◆ S1

#define S1 (   x)    (ROTR((x),19) ^ ROTR((x),61) ^ ((x)>>6))

Helper function for SHA512's computing.

◆ Sum0

#define Sum0 (   x)    (ROTR((x),28) ^ ROTR((x),34) ^ ROTR((x),39))

Helper function for SHA512's computing.

◆ Sum1

#define Sum1 (   x)    (ROTR((x),14) ^ ROTR((x),18) ^ ROTR((x),41))

Helper function for SHA512's computing.

◆ X

#define X (   a)
Value:
do { *p++ = h##a >> 56; *p++ = h##a >> 48; \
*p++ = h##a >> 40; *p++ = h##a >> 32; \
*p++ = h##a >> 24; *p++ = h##a >> 16; \
*p++ = h##a >> 8; *p++ = h##a; } while (0)

Helper function for SHA512's computing.