-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathrjwhirlpool.h
34 lines (26 loc) · 969 Bytes
/
rjwhirlpool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* whirlpool.h */
#ifndef WHIRLPOOL_H
#define WHIRLPOOL_H
#include "ustd.h"
#ifdef __cplusplus
extern "C" {
#endif
#define whirlpool_block_size 64
/* algorithm context */
typedef struct whirlpool_ctx
{
uint64_t hash[8]; /* 512-bit algorithm internal hashing state */
unsigned char message[whirlpool_block_size]; /* 512-bit buffer to hash */
/* Note: original algorith uses 256-bit counter, allowing to hash up to
2^256 bits sized message. For optimization we use here 64-bit counter,
thus reducing maximal message size to 2^64 bits = 2 Exbibytes = 2^21 TiB) */
uint64_t length; /* number of processed bytes */
} whirlpool_ctx;
/* hash functions */
void rhash_whirlpool_init(whirlpool_ctx* ctx);
void rhash_whirlpool_update(whirlpool_ctx* ctx, const unsigned char* msg, size_t size);
void rhash_whirlpool_final(whirlpool_ctx* ctx, unsigned char* result);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* WHIRLPOOL_H */