Electroneum
Macros | Typedefs | Functions
sha512-blocks.c File Reference

Macros

#define SHR(x, c)   ((x) >> (c))
 
#define ROTR(x, c)   (((x) >> (c)) | ((x) << (64 - (c))))
 
#define Ch(x, y, z)   ((x & y) ^ (~x & z))
 
#define Maj(x, y, z)   ((x & y) ^ (x & z) ^ (y & z))
 
#define Sigma0(x)   (ROTR(x,28) ^ ROTR(x,34) ^ ROTR(x,39))
 
#define Sigma1(x)   (ROTR(x,14) ^ ROTR(x,18) ^ ROTR(x,41))
 
#define sigma0(x)   (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x,7))
 
#define sigma1(x)   (ROTR(x,19) ^ ROTR(x,61) ^ SHR(x,6))
 
#define M(w0, w14, w9, w1)   w0 = sigma1(w14) + w9 + sigma0(w1) + w0;
 
#define EXPAND
 
#define F(w, k)
 

Typedefs

typedef unsigned long long uint64
 

Functions

static uint64 load_bigendian (const unsigned char *x)
 
static void store_bigendian (unsigned char *x, uint64 u)
 
int crypto_hashblocks (unsigned char *statebytes, const unsigned char *in, unsigned long long inlen)
 

Macro Definition Documentation

◆ Ch

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

◆ EXPAND

#define EXPAND
Value:
M(w0 ,w14,w9 ,w1 ) \
M(w1 ,w15,w10,w2 ) \
M(w2 ,w0 ,w11,w3 ) \
M(w3 ,w1 ,w12,w4 ) \
M(w4 ,w2 ,w13,w5 ) \
M(w5 ,w3 ,w14,w6 ) \
M(w6 ,w4 ,w15,w7 ) \
M(w7 ,w5 ,w0 ,w8 ) \
M(w8 ,w6 ,w1 ,w9 ) \
M(w9 ,w7 ,w2 ,w10) \
M(w10,w8 ,w3 ,w11) \
M(w11,w9 ,w4 ,w12) \
M(w12,w10,w5 ,w13) \
M(w13,w11,w6 ,w14) \
M(w14,w12,w7 ,w15) \
M(w15,w13,w8 ,w0 )
#define w1(p)
Definition: aesb.c:107
#define w0(p)
Definition: aesb.c:106
#define w3(p)
Definition: aesb.c:109
#define w2(p)
Definition: aesb.c:108
#define M(w0, w14, w9, w1)
Definition: sha512-blocks.c:41

◆ F

#define F (   w,
 
)
Value:
T1 = h + Sigma1(e) + Ch(e,f,g) + k + w; \
T2 = Sigma0(a) + Maj(a,b,c); \
h = g; \
g = f; \
f = e; \
e = d + T1; \
d = c; \
c = b; \
b = a; \
a = T1 + T2;
string a
Definition: MakeCryptoOps.py:15
int b
Definition: base.py:1
Definition: d.py:1
#define Maj(x, y, z)
Definition: sha512-blocks.c:35
#define Sigma0(x)
Definition: sha512-blocks.c:36
#define Sigma1(x)
Definition: sha512-blocks.c:37
#define Ch(x, y, z)
Definition: sha512-blocks.c:34

◆ M

#define M (   w0,
  w14,
  w9,
  w1 
)    w0 = sigma1(w14) + w9 + sigma0(w1) + w0;

◆ Maj

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

◆ ROTR

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

◆ SHR

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

◆ Sigma0

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

◆ sigma0

#define sigma0 (   x)    (ROTR(x, 1) ^ ROTR(x, 8) ^ SHR(x,7))

◆ Sigma1

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

◆ sigma1

#define sigma1 (   x)    (ROTR(x,19) ^ ROTR(x,61) ^ SHR(x,6))

Typedef Documentation

◆ uint64

typedef unsigned long long uint64

Function Documentation

◆ crypto_hashblocks()

int crypto_hashblocks ( unsigned char *  statebytes,
const unsigned char *  in,
unsigned long long  inlen 
)

◆ load_bigendian()

static uint64 load_bigendian ( const unsigned char *  x)
static

◆ store_bigendian()

static void store_bigendian ( unsigned char *  x,
uint64  u 
)
static