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