sha512.h - sbase - suckless unix tools
(HTM) git clone git://git.suckless.org/sbase
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
sha512.h (618B)
---
1 /* public domain sha512 implementation based on fips180-3 */
2
3 struct 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
9 enum { SHA512_DIGEST_LENGTH = 64 };
10
11 /* reset state */
12 void sha512_init(void *ctx);
13 /* process message */
14 void 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 */
18 void sha512_sum(void *ctx, uint8_t md[SHA512_DIGEST_LENGTH]);