Strophe: sha512.c File Reference

Strophe 0.9 XMPP client library

Macros | Functions | Variables
sha512.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) ROR64c(x, n)
#define | R(x, n) (((x)&CONST64(0xFFFFFFFFFFFFFFFF)) >> ((uint64_t)n))
#define | Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39))
#define | Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41))
#define | Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7))
#define | Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6))
#define | RND(a, b, c, d, e, f, g, h, i)

## Functions
static void | sha512_compress (sha512_context *md, const uint8_t *buf)
void | sha512_init (sha512_context *md)
void | sha512_process (sha512_context *md, const uint8_t *in, size_t inlen)
void | sha512_done (sha512_context *md, uint8_t *out)
void | sha512_hash (const uint8_t *data, size_t len, uint8_t *digest)

## Variables
static const uint64_t | K [80]

## 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
| ) |  | ROR64c(x, n)

## ◆ R

#define R | ( |  | x,
|  |  | n
| ) |  | (((x)&CONST64(0xFFFFFFFFFFFFFFFF)) >> ((uint64_t)n))

## ◆ Sigma0

#define Sigma0 | ( |  | x | ) | (S(x, 28) ^ S(x, 34) ^ S(x, 39))

## ◆ Sigma1

#define Sigma1 | ( |  | x | ) | (S(x, 14) ^ S(x, 18) ^ S(x, 41))

## ◆ Gamma0

#define Gamma0 | ( |  | x | ) | (S(x, 1) ^ S(x, 8) ^ R(x, 7))

## ◆ Gamma1

#define Gamma1 | ( |  | x | ) | (S(x, 19) ^ S(x, 61) ^ R(x, 6))

## ◆ RND

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

Value:
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
t1 = Sigma0(a) + Maj(a, b, c); \
d += t0; \
h = t0 + t1;

## Function Documentation

## ◆ sha512_compress()

static void sha512_compress | ( | sha512_context * | md,
|  | const uint8_t * | buf
| ) |  |
| static

## ◆ sha512_init()

void sha512_init | ( | sha512_context * | md | ) |

## ◆ sha512_process()

void sha512_process | ( | sha512_context * | md,
|  | const uint8_t * | in,
|  | size_t | inlen
| ) |  |

## ◆ sha512_done()

void sha512_done | ( | sha512_context * | md,
|  | uint8_t * | out
| ) |  |

## ◆ sha512_hash()

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

## Variable Documentation

## ◆ K

const uint64_t K[80]
| static

Sigma0
#define Sigma0(x)
Definition: sha512.c:56
Maj
#define Maj(x, y, z)
Definition: sha512.c:53
Sigma1
#define Sigma1(x)
Definition: sha512.c:57
Ch
#define Ch(x, y, z)
Definition: sha512.c:52
K
static const uint64_t K[80]
Definition: sha512.c:9