]> git.cryptolib.org Git - avr-crypto-lib.git/blob - keccak/keccak.h
fixing E-Mail-Address & Copyright
[avr-crypto-lib.git] / keccak / keccak.h
1 /* keccak.h */
2 /*
3     This file is part of the AVR-Crypto-Lib.
4     Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #ifndef KECCAK_H_
21 #define KECCAK_H_
22
23 #include <stdint.h>
24
25 #define KECCAK224_BLOCKSIZE 1152
26 #define KECCAK224_BLOCKSIZE_B (KECCAK224_BLOCKSIZE / 8)
27 #define KECCAK256_BLOCKSIZE 1088
28 #define KECCAK256_BLOCKSIZE_B (KECCAK256_BLOCKSIZE / 8)
29 #define KECCAK384_BLOCKSIZE  832
30 #define KECCAK384_BLOCKSIZE_B (KECCAK384_BLOCKSIZE / 8)
31 #define KECCAK512_BLOCKSIZE  576
32 #define KECCAK512_BLOCKSIZE_B (KECCAK512_BLOCKSIZE / 8)
33
34 typedef struct{
35         uint8_t a[200];
36         uint16_t r;
37         uint8_t  bs;
38 } keccak_ctx_t;
39
40
41 void keccak_init(uint16_t r, keccak_ctx_t *ctx);
42 void keccak224_init(keccak_ctx_t *ctx);
43 void keccak256_init(keccak_ctx_t *ctx);
44 void keccak384_init(keccak_ctx_t *ctx);
45 void keccak512_init(keccak_ctx_t *ctx);
46
47 void keccak_nextBlock(keccak_ctx_t *ctx, const void *block);
48 void keccak_lastBlock(keccak_ctx_t *ctx, const void *block, uint16_t length_b);
49
50 void keccak_ctx2hash(void *dest, uint16_t length_b, keccak_ctx_t *ctx);
51 void keccak224_ctx2hash(void *dest, keccak_ctx_t *ctx);
52 void keccak256_ctx2hash(void *dest, keccak_ctx_t *ctx);
53 void keccak384_ctx2hash(void *dest, keccak_ctx_t *ctx);
54 void keccak512_ctx2hash(void *dest, keccak_ctx_t *ctx);
55
56 #endif /* KECCAK_H_ */