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