blake2s.h (796B)
1 /* ISC license. */ 2 3 #ifndef SKALIBS_BLAKE2S_H 4 #define SKALIBS_BLAKE2S_H 5 6 #include <stddef.h> 7 #include <stdint.h> 8 9 typedef struct blake2s_ctx_s blake2s_ctx, *blake2s_ctx_ref ; 10 struct blake2s_ctx_s 11 { 12 size_t buflen ; 13 size_t outlen ; 14 uint32_t h[8] ; 15 uint32_t t[2] ; 16 uint32_t f[2] ; 17 char buf[64] ; 18 } ; 19 20 #define BLAKE2S_INIT(len) { \ 21 .buflen = 0, \ 22 .outlen = len, \ 23 .h = { 0x6A09E667UL ^ (0x01010000 | len), 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL, 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL }, \ 24 .t = { 0, 0 }, \ 25 .f = { 0, 0 }, \ 26 .buf = { 0 } } 27 28 extern void blake2s_init (blake2s_ctx *, size_t) ; /* outlen <= 32 */ 29 extern void blake2s_update (blake2s_ctx *, char const *, size_t) ; 30 extern void blake2s_final (blake2s_ctx *, char *) ; /* outlen chars */ 31 32 #endif