master xplshn/aruu / shared / sha512.h
 1/* public domain sha512 implementation based on fips180-3 */
 2
 3struct sha512 {
 4	uint64_t len;     /* processed message length */
 5	uint64_t h[8];    /* hash state */
 6	uint8_t buf[128]; /* message block buffer */
 7};
 8
 9enum { SHA512_DIGEST_LENGTH = 64 };
10
11/* reset state */
12void sha512_init(void *ctx);
13/* process message */
14void sha512_update(void *ctx, const void *m, unsigned long len);
15/* get message digest */
16/* state is ruined after sum, keep a copy if multiple sum is needed */
17/* part of the message might be left in s, zero it if secrecy is needed */
18void sha512_sum(void *ctx, uint8_t md[SHA512_DIGEST_LENGTH]);