Fabcoin Core  0.16.2
P2P Digital Currency
Macros | Typedefs | Functions | Variables
sha.cpp File Reference
#include "pch.h"
#include "config.h"
#include "secblock.h"
#include "sha.h"
#include "misc.h"
#include "cpu.h"
Include dependency graph for sha.cpp:

Go to the source code of this file.

Macros

#define blk0(i)   (W[i] = data[i])
 
#define blk1(i)   (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
 
#define f1(x, y, z)   (z^(x&(y^z)))
 
#define f2(x, y, z)   (x^y^z)
 
#define f3(x, y, z)   ((x&y)|(z&(x|y)))
 
#define f4(x, y, z)   (x^y^z)
 
#define R0(v, w, x, y, z, i)   z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
 
#define R1(v, w, x, y, z, i)   z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);
 
#define R2(v, w, x, y, z, i)   z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30);
 
#define R3(v, w, x, y, z, i)   z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30);
 
#define R4(v, w, x, y, z, i)   z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30);
 
#define blk2(i)   (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
 
#define Ch(x, y, z)   (z^(x&(y^z)))
 
#define Maj(x, y, z)   (y^((x^y)&(y^z)))
 
#define a(i)   T[(0-i)&7]
 
#define b(i)   T[(1-i)&7]
 
#define c(i)   T[(2-i)&7]
 
#define d(i)   T[(3-i)&7]
 
#define e(i)   T[(4-i)&7]
 
#define f(i)   T[(5-i)&7]
 
#define g(i)   T[(6-i)&7]
 
#define h(i)   T[(7-i)&7]
 
#define R(i)
 
#define S0(x)   (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
 
#define S1(x)   (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
 
#define s0(x)   (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
 
#define s1(x)   (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
 
#define S0(x)   (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
 
#define S1(x)   (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
 
#define s0(x)   (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
 
#define s1(x)   (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
 
#define R(i)
 

Typedefs

typedef void(* pfnSHATransform) (word32 *state, const word32 *data)
 
typedef void(CRYPTOPP_FASTCALLpfnSHAHashBlocks) (word32 *state, const word32 *data, size_t length)
 

Functions

pfnSHATransform InitializeSHA1Transform ()
 
void SHA256_CXX_Transform (word32 *state, const word32 *data)
 
pfnSHATransform InitializeSHA256Transform ()
 
 CRYPTOPP_ALIGN_DATA (16) static const word64 SHA512_K[80] CRYPTOPP_SECTION_ALIGN16
 

Variables

const word32 SHA256_K [64]
 

Macro Definition Documentation

#define a (   i)    T[(0-i)&7]

Definition at line 729 of file sha.cpp.

#define b (   i)    T[(1-i)&7]

Definition at line 730 of file sha.cpp.

#define blk0 (   i)    (W[i] = data[i])

Definition at line 41 of file sha.cpp.

#define blk1 (   i)    (W[i&15] = rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))

Definition at line 42 of file sha.cpp.

#define blk2 (   i)    (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))

Definition at line 724 of file sha.cpp.

#define c (   i)    T[(2-i)&7]

Definition at line 731 of file sha.cpp.

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

Definition at line 726 of file sha.cpp.

#define d (   i)    T[(3-i)&7]

Definition at line 732 of file sha.cpp.

#define e (   i)    T[(4-i)&7]

Definition at line 733 of file sha.cpp.

#define f (   i)    T[(5-i)&7]

Definition at line 734 of file sha.cpp.

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

Definition at line 44 of file sha.cpp.

#define f2 (   x,
  y,
  z 
)    (x^y^z)

Definition at line 45 of file sha.cpp.

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

Definition at line 46 of file sha.cpp.

#define f4 (   x,
  y,
  z 
)    (x^y^z)

Definition at line 47 of file sha.cpp.

#define g (   i)    T[(6-i)&7]

Definition at line 735 of file sha.cpp.

#define h (   i)    T[(7-i)&7]

Definition at line 736 of file sha.cpp.

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

Definition at line 727 of file sha.cpp.

#define R (   i)
Value:
h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA256_K[i+j]+(j?blk2(i):blk0(i));\
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
#define c(i)
Definition: sha.cpp:731
#define a(i)
Definition: sha.cpp:729
#define h(i)
Definition: sha.cpp:736
#define blk2(i)
Definition: sha.cpp:724
#define g(i)
Definition: sha.cpp:735
#define Ch(x, y, z)
Definition: sha.cpp:726
const word32 SHA256_K[64]
#define S1(x)
Definition: sha.cpp:743
#define Maj(x, y, z)
Definition: sha.cpp:727
#define blk0(i)
Definition: sha.cpp:41
#define e(i)
Definition: sha.cpp:733
#define f(i)
Definition: sha.cpp:734
#define S0(x)
Definition: sha.cpp:742
#define d(i)
Definition: sha.cpp:732
#define b(i)
Definition: sha.cpp:730

Definition at line 738 of file sha.cpp.

#define R (   i)
Value:
h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+SHA512_K[i+j]+(j?blk2(i):blk0(i));\
d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
#define c(i)
Definition: sha.cpp:731
#define a(i)
Definition: sha.cpp:729
#define h(i)
Definition: sha.cpp:736
#define blk2(i)
Definition: sha.cpp:724
#define g(i)
Definition: sha.cpp:735
#define Ch(x, y, z)
Definition: sha.cpp:726
#define S1(x)
Definition: sha.cpp:743
#define Maj(x, y, z)
Definition: sha.cpp:727
#define blk0(i)
Definition: sha.cpp:41
#define e(i)
Definition: sha.cpp:733
#define f(i)
Definition: sha.cpp:734
#define S0(x)
Definition: sha.cpp:742
#define d(i)
Definition: sha.cpp:732
#define b(i)
Definition: sha.cpp:730

Definition at line 738 of file sha.cpp.

#define R0 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f1(w,x,y)+blk0(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);

Definition at line 50 of file sha.cpp.

#define R1 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f1(w,x,y)+blk1(i)+0x5A827999+rotlFixed(v,5);w=rotlFixed(w,30);

Definition at line 51 of file sha.cpp.

#define R2 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f2(w,x,y)+blk1(i)+0x6ED9EBA1+rotlFixed(v,5);w=rotlFixed(w,30);

Definition at line 52 of file sha.cpp.

#define R3 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f3(w,x,y)+blk1(i)+0x8F1BBCDC+rotlFixed(v,5);w=rotlFixed(w,30);

Definition at line 53 of file sha.cpp.

#define R4 (   v,
  w,
  x,
  y,
  z,
 
)    z+=f4(w,x,y)+blk1(i)+0xCA62C1D6+rotlFixed(v,5);w=rotlFixed(w,30);

Definition at line 54 of file sha.cpp.

#define S0 (   x)    (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))

Definition at line 742 of file sha.cpp.

#define s0 (   x)    (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))

Definition at line 744 of file sha.cpp.

#define S0 (   x)    (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))

Definition at line 742 of file sha.cpp.

#define s0 (   x)    (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))

Definition at line 744 of file sha.cpp.

#define S1 (   x)    (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))

Definition at line 743 of file sha.cpp.

#define s1 (   x)    (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))

Definition at line 745 of file sha.cpp.

#define S1 (   x)    (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))

Definition at line 743 of file sha.cpp.

#define s1 (   x)    (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))

Definition at line 745 of file sha.cpp.

Typedef Documentation

typedef void(CRYPTOPP_FASTCALL * pfnSHAHashBlocks) (word32 *state, const word32 *data, size_t length)

Definition at line 35 of file sha.cpp.

typedef void(* pfnSHATransform) (word32 *state, const word32 *data)

Definition at line 34 of file sha.cpp.

Function Documentation

CRYPTOPP_ALIGN_DATA ( 16  ) const

Here is the caller graph for this function:

pfnSHATransform InitializeSHA1Transform ( )

Definition at line 296 of file sha.cpp.

Here is the caller graph for this function:

pfnSHATransform InitializeSHA256Transform ( )

Definition at line 1076 of file sha.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void SHA256_CXX_Transform ( word32 state,
const word32 data 
)

Definition at line 821 of file sha.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

const word32 SHA256_K[64]
Initial value:
= {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
}