Fabcoin Core  0.16.2
P2P Digital Currency
Macros | Functions
sha256.c File Reference
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include "sysendian.h"
#include "sha256.h"
Include dependency graph for sha256.c:

Go to the source code of this file.

Macros

#define Ch(x, y, z)   ((x & (y ^ z)) ^ z)
 
#define Maj(x, y, z)   ((x & (y | z)) | (y & z))
 
#define SHR(x, n)   (x >> n)
 
#define ROTR(x, n)   ((x >> n) | (x << (32 - n)))
 
#define S0(x)   (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
 
#define S1(x)   (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
 
#define s0(x)   (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))
 
#define s1(x)   (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))
 
#define RND(a, b, c, d, e, f, g, h, k)
 
#define RNDr(S, W, i, k)
 

Functions

void libscrypt_SHA256_Init (SHA256_CTX *ctx)
 
void libscrypt_SHA256_Update (SHA256_CTX *ctx, const void *in, size_t len)
 
void libscrypt_SHA256_Final (unsigned char digest[32], SHA256_CTX *ctx)
 
void libscrypt_HMAC_SHA256_Init (HMAC_SHA256_CTX *ctx, const void *_K, size_t Klen)
 
void libscrypt_HMAC_SHA256_Update (HMAC_SHA256_CTX *ctx, const void *in, size_t len)
 
void libscrypt_HMAC_SHA256_Final (unsigned char digest[32], HMAC_SHA256_CTX *ctx)
 
void libscrypt_PBKDF2_SHA256 (const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen)
 PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and write the output to buf. More...
 

Macro Definition Documentation

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

Definition at line 63 of file sha256.c.

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

Definition at line 64 of file sha256.c.

#define RND (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)
Value:
t0 = h + S1(e) + Ch(e, f, g) + k; \
t1 = S0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1;
#define h(i)
Definition: sha.cpp:736
#define Ch(x, y, z)
Definition: sha256.c:63
#define g(i)
Definition: sha.cpp:735
#define S0(x)
Definition: sha256.c:67
#define c(i)
#define S1(x)
Definition: sha256.c:68
#define a(i)
#define t1
#define b(i, j)
#define f(x)
Definition: gost.cpp:57
#define Maj(x, y, z)
Definition: sha256.c:64
#define e(i)
Definition: sha.cpp:733
#define d(i)
Definition: sha.cpp:732

Definition at line 73 of file sha256.c.

#define RNDr (   S,
  W,
  i,
 
)
Value:
RND(S[(64 - i) % 8], S[(65 - i) % 8], \
S[(66 - i) % 8], S[(67 - i) % 8], \
S[(68 - i) % 8], S[(69 - i) % 8], \
S[(70 - i) % 8], S[(71 - i) % 8], \
W[i] + k)
#define S(a)
Definition: mars.cpp:50
#define RND(a, b, c, d, e, f, g, h, k)
Definition: sha256.c:73

Definition at line 80 of file sha256.c.

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

Definition at line 66 of file sha256.c.

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

Definition at line 67 of file sha256.c.

#define s0 (   x)    (ROTR(x, 7) ^ ROTR(x, 18) ^ SHR(x, 3))

Definition at line 69 of file sha256.c.

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

Definition at line 68 of file sha256.c.

#define s1 (   x)    (ROTR(x, 17) ^ ROTR(x, 19) ^ SHR(x, 10))

Definition at line 70 of file sha256.c.

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

Definition at line 65 of file sha256.c.

Function Documentation

void libscrypt_HMAC_SHA256_Final ( unsigned char  digest[32],
HMAC_SHA256_CTX ctx 
)

Definition at line 339 of file sha256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void libscrypt_HMAC_SHA256_Init ( HMAC_SHA256_CTX ctx,
const void *  _K,
size_t  Klen 
)

Definition at line 294 of file sha256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void libscrypt_HMAC_SHA256_Update ( HMAC_SHA256_CTX ctx,
const void *  in,
size_t  len 
)

Definition at line 330 of file sha256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void libscrypt_PBKDF2_SHA256 ( const uint8_t *  passwd,
size_t  passwdlen,
const uint8_t *  salt,
size_t  saltlen,
uint64_t  c,
uint8_t *  buf,
size_t  dkLen 
)

PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and write the output to buf.

The value dkLen must be at most 32 * (2^32 - 1).

Definition at line 362 of file sha256.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void libscrypt_SHA256_Final ( unsigned char  digest[32],
SHA256_CTX ctx 
)

Definition at line 279 of file sha256.c.

Here is the caller graph for this function:

void libscrypt_SHA256_Init ( SHA256_CTX ctx)

Definition at line 214 of file sha256.c.

Here is the caller graph for this function:

void libscrypt_SHA256_Update ( SHA256_CTX ctx,
const void *  in,
size_t  len 
)

Definition at line 233 of file sha256.c.

Here is the call graph for this function:

Here is the caller graph for this function: