Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cHashSHA256.cpp File Reference
#include "pch.h"
#include "Hash/cHashSHA256.h"

Namespaces

 GrayLib
 

Macros

#define S2(x)   (cBits::Rotr<UINT32>(x, 2) ^ cBits::Rotr<UINT32>(x,13) ^ cBits::Rotr<UINT32>(x,22))
 
#define S3(x)   (cBits::Rotr<UINT32>(x, 6) ^ cBits::Rotr<UINT32>(x,11) ^ cBits::Rotr<UINT32>(x,25))
 
#define F0(x, y, z)   ((x & y) | (z & (x | y)))
 
#define F1(x, y, z)   (z ^ (x & (y ^ z)))
 
#define P(a, b, c, d, e, f, g, h, x, K)
 
#define SHR(x, n)   ((x) >> n)
 
#define S0(x)   (cBits::Rotr<UINT32>(x, 7) ^ cBits::Rotr<UINT32>(x,18) ^ SHR(x, 3))
 
#define S1(x)   (cBits::Rotr<UINT32>(x,17) ^ cBits::Rotr<UINT32>(x,19) ^ SHR(x,10))
 
#define R(t)   ( w[t] = S1(w[t - 2]) + w[t - 7] + S0(w[t - 15]) + w[t - 16] )
 

Detailed Description

FIPS-180-2 compliant SHA-256 implementation The SHA-256 Secure Hash Standard was published by NIST in 2002. http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf

Macro Definition Documentation

◆ F0

#define F0 (   x,
  y,
 
)    ((x & y) | (z & (x | y)))

◆ F1

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

◆ P

#define P (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
  x,
  K 
)
Value:
{ temp1 = h + S3(e) + F1(e,f,g) + K + x; temp2 = S2(a) + F0(a,b,c); \
d += temp1; h = temp1 + temp2; }
Using X files without the sources and the makefile How to use you just create a debug directory e g
Definition: Readme.txt:21
#define K
#define F1(x, y, z)
#define S2(x)
#define F0(x, y, z)
#define S3(x)

◆ R

#define R (   t)    ( w[t] = S1(w[t - 2]) + w[t - 7] + S0(w[t - 15]) + w[t - 16] )

◆ S0

#define S0 (   x)    (cBits::Rotr<UINT32>(x, 7) ^ cBits::Rotr<UINT32>(x,18) ^ SHR(x, 3))

◆ S1

#define S1 (   x)    (cBits::Rotr<UINT32>(x,17) ^ cBits::Rotr<UINT32>(x,19) ^ SHR(x,10))

◆ S2

#define S2 (   x)    (cBits::Rotr<UINT32>(x, 2) ^ cBits::Rotr<UINT32>(x,13) ^ cBits::Rotr<UINT32>(x,22))

◆ S3

#define S3 (   x)    (cBits::Rotr<UINT32>(x, 6) ^ cBits::Rotr<UINT32>(x,11) ^ cBits::Rotr<UINT32>(x,25))

◆ SHR

#define SHR (   x,
 
)    ((x) >> n)