1 | /* |
---|
2 | --------------------------------------------------------------------------- |
---|
3 | Copyright (c) 2002, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK. |
---|
4 | All rights reserved. |
---|
5 | |
---|
6 | LICENSE TERMS |
---|
7 | |
---|
8 | The free distribution and use of this software in both source and binary |
---|
9 | form is allowed (with or without changes) provided that: |
---|
10 | |
---|
11 | 1. distributions of this source code include the above copyright |
---|
12 | notice, this list of conditions and the following disclaimer; |
---|
13 | |
---|
14 | 2. distributions in binary form include the above copyright |
---|
15 | notice, this list of conditions and the following disclaimer |
---|
16 | in the documentation and/or other associated materials; |
---|
17 | |
---|
18 | 3. the copyright holder's name is not used to endorse products |
---|
19 | built using this software without specific written permission. |
---|
20 | |
---|
21 | ALTERNATIVELY, provided that this notice is retained in full, this product |
---|
22 | may be distributed under the terms of the GNU General Public License (GPL), |
---|
23 | in which case the provisions of the GPL apply INSTEAD OF those given above. |
---|
24 | |
---|
25 | DISCLAIMER |
---|
26 | |
---|
27 | This software is provided 'as is' with no explicit or implied warranties |
---|
28 | in respect of its properties, including, but not limited to, correctness |
---|
29 | and/or fitness for purpose. |
---|
30 | --------------------------------------------------------------------------- |
---|
31 | Issue Date: 30/11/2002 |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef _SHA1_H |
---|
35 | #define _SHA1_H |
---|
36 | |
---|
37 | |
---|
38 | typedef unsigned int sha1_32t; |
---|
39 | |
---|
40 | |
---|
41 | #if defined(__cplusplus) |
---|
42 | extern "C" |
---|
43 | { |
---|
44 | #endif |
---|
45 | |
---|
46 | #define SHA1_BLOCK_SIZE 64 |
---|
47 | #define SHA1_DIGEST_SIZE 20 |
---|
48 | #define SHA2_GOOD 0 |
---|
49 | #define SHA2_BAD 1 |
---|
50 | |
---|
51 | /* type to hold the SHA256 context */ |
---|
52 | |
---|
53 | typedef struct |
---|
54 | { sha1_32t count[2]; |
---|
55 | sha1_32t hash[5]; |
---|
56 | sha1_32t wbuf[16]; |
---|
57 | } sha1_ctx; |
---|
58 | |
---|
59 | void sha1_compile(sha1_ctx ctx[1]); |
---|
60 | |
---|
61 | void sha1_begin(sha1_ctx ctx[1]); |
---|
62 | void sha1_hash(const unsigned char data[], unsigned int len, sha1_ctx ctx[1]); |
---|
63 | void sha1_end(unsigned char hval[], sha1_ctx ctx[1]); |
---|
64 | void sha1(unsigned char hval[], const unsigned char data[], unsigned int len); |
---|
65 | |
---|
66 | #if defined(__cplusplus) |
---|
67 | } |
---|
68 | #endif |
---|
69 | |
---|
70 | #endif // _SHA1_H |
---|