Algo/blake2b/blake2b.h

24 lines
606 B
C

#include <stddef.h>
#include <stdint.h>
enum blake2b_constant
{
BLAKE2B_BLOCKBYTES = 128,
BLAKE2B_OUTBYTES = 64,
BLAKE2B_KEYBYTES = 64,
BLAKE2B_SALTBYTES = 16,
BLAKE2B_PERSONALBYTES = 16
};
typedef struct {
uint8_t b[128]; // input buffer
uint64_t h[8]; // chained state
uint64_t t[2]; // total number of bytes
size_t c; // pointer for b[]
size_t outlen; // digest size
} blake2b_ctx;
void blake2b_update(blake2b_ctx *ctx, const void *in, size_t inlen);
int blake2b_init(blake2b_ctx *ctx, size_t outlen);
void blake2b_final(blake2b_ctx *ctx, void *out);