Debian Codegraph @

src/crypto/keccak.h

raw symbols SCIP
1 // keccak.h
2 // 19-Nov-11 Markku-Juhani O. Saarinen <[email protected]>
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 // SHA3 Algorithm context.
19 typedef struct KECCAK_CTX
20 {
21 // 1600 bits algorithm hashing state
22 uint64_t hash[25];
23 // 1088-bit buffer for leftovers, block size = 136 B for 256-bit keccak
24 uint64_t message[17];
25 // count of bytes in the message[] buffer
26 size_t rest;
27 } KECCAK_CTX;
28
29 // compute a keccak hash (md) of given byte length from "in"
30 void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen);
31
32 // update the state
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