]> git.cryptolib.org Git - avr-crypto-lib.git/blob - jh/jh_simple.h
optimizing norx32
[avr-crypto-lib.git] / jh / jh_simple.h
1 /* jh_simple.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 JH_SIMPLE_H_
21 #define JH_SIMPLE_H_
22
23 #include <stdint.h>
24
25 #define JH224_BLOCKSIZE 512
26 #define JH224_BLOCKSIZE_B ((JH224_BLOCKSIZE+7)/8)
27 #define JH256_BLOCKSIZE 512
28 #define JH256_BLOCKSIZE_B ((JH256_BLOCKSIZE+7)/8)
29 #define JH384_BLOCKSIZE 512
30 #define JH384_BLOCKSIZE_B ((JH284_BLOCKSIZE+7)/8)
31 #define JH512_BLOCKSIZE 512
32 #define JH512_BLOCKSIZE_B ((JH512_BLOCKSIZE+7)/8)
33
34 typedef struct {
35         uint8_t a[128];
36         uint32_t block_hashed;
37 } jh_ctx_t;
38
39
40 void jh_init(uint16_t hashlen_b, jh_ctx_t *ctx);
41 void jh_nextBlock(jh_ctx_t *ctx, void *block);
42 void jh_lastBlock(jh_ctx_t *ctx, void *block, uint16_t length_b);
43 void jh_ctx2hash(void *dest, uint16_t length_b, jh_ctx_t *ctx);
44
45 void jh224_init(jh_ctx_t *ctx);
46 void jh224_ctx2hash(void *dest, jh_ctx_t *ctx);
47
48 void jh256_init(jh_ctx_t *ctx);
49 void jh256_ctx2hash(void *dest, jh_ctx_t *ctx);
50
51 void jh384_init(jh_ctx_t *ctx);
52 void jh384_ctx2hash(void *dest, jh_ctx_t *ctx);
53
54 void jh512_init(jh_ctx_t *ctx);
55 void jh512_ctx2hash(void *dest, jh_ctx_t *ctx);
56
57
58 #endif /* JH_SIMPLE_H_ */