]> git.cryptolib.org Git - avr-crypto-lib.git/blob - sha1.h
4f54d88a08d9ebb9bc66b10d87c2500fc40af8bb
[avr-crypto-lib.git] / sha1.h
1 /**
2  * \file        sha1.c
3  * \author      Daniel Otte
4  * \date        08.10.2006
5  * \par License:
6  * GPL
7  * \brief SHA-1 declaration.
8  * 
9  */
10  
11 #ifndef SHA1_H_
12 #define SHA1_H_
13
14 #include <stdint.h>
15
16
17 #define SHA1_HASH_BITS  160
18 #define SHA1_BLOCK_BITS 512
19
20 /**
21  * \brief SHA-1 context type
22  * 
23  */
24 typedef struct {
25         uint32_t h[5];
26         uint64_t length;
27 } sha1_ctx_t;
28
29 typedef uint8_t sha1_hash_t[SHA1_HASH_BITS/8];
30
31 void sha1_init(sha1_ctx_t *state);
32
33 void sha1_nextBlock (sha1_ctx_t *state, void* block);
34 void sha1_lastBlock (sha1_ctx_t *state, void* block, uint16_t length);
35
36 void sha1_ctx2hash (sha1_hash_t *dest, sha1_ctx_t *state);
37 void sha1 (sha1_hash_t *dest, void* msg, uint32_t length);
38 //uint32_t change_endian32(uint32_t x);
39
40
41
42
43 #endif /*SHA1_H_*/