]> git.cryptolib.org Git - avr-crypto-lib.git/blob - cubehash/cubehash.h
6f1834c3e34337de3ce109074fd1b32a43c984ed
[avr-crypto-lib.git] / cubehash / cubehash.h
1 /* cubehash.h */
2 /*
3  This file is part of the AVR-Crypto-Lib.
4  Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
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 CUBEHASH_H_
21 #define CUBEHASH_H_
22
23 #include <stdint.h>
24
25 #define CUBEHASH224_BLOCKSIZE 256
26 #define CUBEHASH224_BLOCKSIZE_B ((CUBEHASH224_BLOCKSIZE+7)/8)
27 #define CUBEHASH256_BLOCKSIZE 256
28 #define CUBEHASH256_BLOCKSIZE_B ((CUBEHASH256_BLOCKSIZE+7)/8)
29 #define CUBEHASH384_BLOCKSIZE 256
30 #define CUBEHASH384_BLOCKSIZE_B ((CUBEHASH284_BLOCKSIZE+7)/8)
31 #define CUBEHASH512_BLOCKSIZE 256
32 #define CUBEHASH512_BLOCKSIZE_B ((CUBEHASH512_BLOCKSIZE+7)/8)
33
34 typedef struct {
35     uint32_t a[32];
36     uint8_t rounds;
37     uint8_t blocksize_B;
38 } cubehash_ctx_t;
39
40 void cubehash_init(uint8_t r, uint8_t b, uint16_t h, cubehash_ctx_t *ctx);
41 void cubehash_nextBlock(cubehash_ctx_t *ctx, void *block);
42 void cubehash_lastBlock(cubehash_ctx_t *ctx, void *block, uint16_t length_b);
43 void cubehash_ctx2hash(void *dest, uint16_t length_b, cubehash_ctx_t *ctx);
44
45 void cubehash224_init(cubehash_ctx_t *ctx);
46 void cubehash224_ctx2hash(void *dest, cubehash_ctx_t *ctx);
47
48 void cubehash256_init(cubehash_ctx_t *ctx);
49 void cubehash256_ctx2hash(void *dest, cubehash_ctx_t *ctx);
50
51 void cubehash384_init(cubehash_ctx_t *ctx);
52 void cubehash384_ctx2hash(void *dest, cubehash_ctx_t *ctx);
53
54 void cubehash512_init(cubehash_ctx_t *ctx);
55 void cubehash512_ctx2hash(void *dest, cubehash_ctx_t *ctx);
56
57 #endif /* CUBEHASH_H_ */