sha256.c File Reference

## Macros

#define | Ch(x, y, z) (z ^ (x & (y ^ z)))
#define | Maj(x, y, z) (((x | y) & z) | (x & y))
#define | S(x, n) RORc((x), (n))
#define | R(x, n) (((x)&0xFFFFFFFFUL) >> (n))
#define | Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
#define | Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25))
#define | Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3))
#define | Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
#define | RND(a, b, c, d, e, f, g, h, i, ki)

## Functions

static void | sha256_compress (sha256_context *md, const uint8_t *buf)
void | sha256_init (sha256_context *md)
void | sha256_process (sha256_context *md, const uint8_t *in, size_t inlen)
void | sha256_done (sha256_context *md, uint8_t *out)
void | sha256_hash (const uint8_t *data, size_t len, uint8_t *digest)

## Macro Definition Documentation

## Ch

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

## Maj

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

## S

#define S | ( |  | x,
|  |  | n
| ) |  | RORc((x), (n))

## R

#define R | ( |  | x,
|  |  | n
| ) |  | (((x)&0xFFFFFFFFUL) >> (n))

## Sigma0

#define Sigma0 | ( |  | x | ) | (S(x, 2) ^ S(x, 13) ^ S(x, 22))

## Sigma1

#define Sigma1 | ( |  | x | ) | (S(x, 6) ^ S(x, 11) ^ S(x, 25))

## Gamma0

#define Gamma0 | ( |  | x | ) | (S(x, 7) ^ S(x, 18) ^ R(x, 3))

## Gamma1

#define Gamma1 | ( |  | x | ) | (S(x, 17) ^ S(x, 19) ^ R(x, 10))

## RND

#define RND | ( |  | a,
|  |  | b,
|  |  | c,
|  |  | d,
|  |  | e,
|  |  | f,
|  |  | g,
|  |  | h,
|  |  | i,
|  |  | ki
| ) |  |

Value:
t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \
t1 = Sigma0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1;
Maj
#define Maj(x, y, z)
Definition: sha256.c:10
Sigma0
#define Sigma0(x)
Definition: sha256.c:13
Sigma1
#define Sigma1(x)
Definition: sha256.c:14
Ch
#define Ch(x, y, z)
Definition: sha256.c:9

## Function Documentation

## sha256_compress()

static void sha256_compress | ( | sha256_context * | md,
|  | const uint8_t * | buf
| ) |  |

static

## sha256_init()

void sha256_init | ( | sha256_context * | md | ) |

## sha256_process()

void sha256_process | ( | sha256_context * | md,
|  | const uint8_t * | in,
|  | size_t | inlen
| ) |  |

## sha256_done()

void sha256_done | ( | sha256_context * | md,
|  | uint8_t * | out
| ) |  |

## sha256_hash()

void sha256_hash | ( | const uint8_t * | data,
|  | size_t | len,
|  | uint8_t * | digest
| ) |  |