libxcks  0.1.0.1
sha224_256.cpp File Reference

Compute sha224 hash and sha256 hash. More...

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

Go to the source code of this file.

Macros

#define X(a)
 Helper function for SHA256's computing. More...
 
#define Cho(x, y, z)   (z ^ (x & (y ^ z))) /* (4.2) same as SHA-1's F1 */
 Helper function for SHA256's computing. More...
 
#define Maj(x, y, z)   ((x & y) | (z & (x|y))) /* (4.3) same as SHA-1's F3 */
 Helper function for SHA256's computing. More...
 
#define Sum0(x)   (ror ((x), 2) ^ ror ((x), 13) ^ ror ((x), 22)) /* (4.4) */
 Helper function for SHA256's computing. More...
 
#define Sum1(x)   (ror ((x), 6) ^ ror ((x), 11) ^ ror ((x), 25)) /* (4.5) */
 Helper function for SHA256's computing. More...
 
#define S0(x)   (ror ((x), 7) ^ ror ((x), 18) ^ ((x) >> 3)) /* (4.6) */
 Helper function for SHA256's computing. More...
 
#define S1(x)   (ror ((x), 17) ^ ror ((x), 19) ^ ((x) >> 10)) /* (4.7) */
 Helper function for SHA256's computing. More...
 
#define R(a, b, c, d, e, f, g, h, k, w)
 Helper function for SHA256's computing. More...
 

Detailed Description

Compute sha224 hash and sha256 hash.

Definition in file sha224_256.cpp.

Macro Definition Documentation

◆ Cho

#define Cho (   x,
  y,
 
)    (z ^ (x & (y ^ z))) /* (4.2) same as SHA-1's F1 */

Helper function for SHA256's computing.

Definition at line 189 of file sha224_256.cpp.

◆ Maj

#define Maj (   x,
  y,
 
)    ((x & y) | (z & (x|y))) /* (4.3) same as SHA-1's F3 */

Helper function for SHA256's computing.

Definition at line 190 of file sha224_256.cpp.

◆ R

#define R (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  k,
 
)
Value:
do \
{ \
t1 = (h) + Sum1((e)) + Cho((e),(f),(g)) + (k) + (w); \
t2 = Sum0((a)) + Maj((a),(b),(c)); \
h = g; \
g = f; \
f = e; \
e = d + t1; \
d = c; \
c = b; \
b = a; \
a = t1 + t2; \
} while (0)
#define Sum0(x)
Helper function for SHA256's computing.
Definition: sha224_256.cpp:191
#define Maj(x, y, z)
Helper function for SHA256's computing.
Definition: sha224_256.cpp:190
#define Sum1(x)
Helper function for SHA256's computing.
Definition: sha224_256.cpp:192
#define Cho(x, y, z)
Helper function for SHA256's computing.
Definition: sha224_256.cpp:189

Helper function for SHA256's computing.

Definition at line 195 of file sha224_256.cpp.

◆ S0

#define S0 (   x)    (ror ((x), 7) ^ ror ((x), 18) ^ ((x) >> 3)) /* (4.6) */

Helper function for SHA256's computing.

Definition at line 193 of file sha224_256.cpp.

◆ S1

#define S1 (   x)    (ror ((x), 17) ^ ror ((x), 19) ^ ((x) >> 10)) /* (4.7) */

Helper function for SHA256's computing.

Definition at line 194 of file sha224_256.cpp.

◆ Sum0

#define Sum0 (   x)    (ror ((x), 2) ^ ror ((x), 13) ^ ror ((x), 22)) /* (4.4) */

Helper function for SHA256's computing.

Definition at line 191 of file sha224_256.cpp.

◆ Sum1

#define Sum1 (   x)    (ror ((x), 6) ^ ror ((x), 11) ^ ror ((x), 25)) /* (4.5) */

Helper function for SHA256's computing.

Definition at line 192 of file sha224_256.cpp.

◆ X

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

Helper function for SHA256's computing.