| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef KECCAK_H |
| 5 |
#define KECCAK_H |
| 6 |
|
| 7 |
#include <stdint.h> |
| 8 |
#include <string.h> |
| 9 |
|
| 10 |
#ifndef KECCAK_ROUNDS |
| 11 |
#define KECCAK_ROUNDS 24 |
| 12 |
#endif |
| 13 |
|
| 14 |
#ifndef ROTL64 |
| 15 |
#define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) |
| 16 |
#endif |
| 17 |
|
| 18 |
|
| 19 |
typedef struct KECCAK_CTX |
| 20 |
{ |
| 21 |
|
| 22 |
uint64_t hash[25]; |
| 23 |
|
| 24 |
uint64_t message[17]; |
| 25 |
|
| 26 |
size_t rest; |
| 27 |
} KECCAK_CTX; |
| 28 |
|
| 29 |
|
| 30 |
void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen); |
| 31 |
|
| 32 |
|
| 33 |
void keccakf(uint64_t st[25], int norounds); |
| 34 |
|
| 35 |
void keccak1600(const uint8_t *in, size_t inlen, uint8_t *md); |
| 36 |
|
| 37 |
void keccak_init(KECCAK_CTX * ctx); |
| 38 |
void keccak_update(KECCAK_CTX * ctx, const uint8_t *in, size_t inlen); |
| 39 |
void keccak_finish(KECCAK_CTX * ctx, uint8_t *md); |
| 40 |
#endif |