|
|
1.1.1.2 root 1: /*
2: ---------------------------------------------------------------------------
3: Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
4:
5: LICENSE TERMS
6:
1.1.1.4 root 7: The free distribution and use of this software is allowed (with or without
8: changes) provided that:
1.1.1.2 root 9:
1.1.1.4 root 10: 1. source code distributions include the above copyright notice, this
11: list of conditions and the following disclaimer;
1.1.1.2 root 12:
1.1.1.4 root 13: 2. binary distributions include the above copyright notice, this list
14: of conditions and the following disclaimer in their documentation;
15:
16: 3. the name of the copyright holder is not used to endorse products
17: built using this software without specific written permission.
1.1.1.2 root 18:
19: DISCLAIMER
20:
21: This software is provided 'as is' with no explicit or implied warranties
22: in respect of its properties, including, but not limited to, correctness
23: and/or fitness for purpose.
24: ---------------------------------------------------------------------------
25: Issue Date: 26/08/2003
26: */
27:
28: #ifndef _SHA1_H
29: #define _SHA1_H
30:
31: #include <limits.h>
1.1.1.5 ! root 32: #include "Common/Tcdefs.h"
1.1.1.2 root 33:
34: #define SHA1_BLOCK_SIZE 64
35: #define SHA1_DIGEST_SIZE 20
36:
37: #if defined(__cplusplus)
38: extern "C"
39: {
40: #endif
41:
42: /* define an unsigned 32-bit type */
43:
44: #if defined(_MSC_VER)
45: typedef unsigned __int32 sha1_32t;
46: #elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
47: typedef unsigned __int32 sha1_32t;
48: #elif defined(UINT_MAX) && UINT_MAX == 0xffffffff
49: typedef unsigned int sha1_32t;
50: #else
51: # error Please define sha1_32t as an unsigned 32 bit type in sha1.h
52: #endif
53:
54: /* type to hold the SHA256 context */
55:
56: typedef struct
57: { sha1_32t count[2];
58: sha1_32t hash[5];
59: sha1_32t wbuf[16];
60: } sha1_ctx;
61:
62: /* Note that these prototypes are the same for both bit and */
63: /* byte oriented implementations. However the length fields */
64: /* are in bytes or bits as appropriate for the version used */
65: /* and bit sequences are input as arrays of bytes in which */
66: /* bit sequences run from the most to the least significant */
67: /* end of each byte */
68:
69: void sha1_compile(sha1_ctx ctx[1]);
70:
1.1.1.3 root 71: void sha1_begin(sha1_ctx ctx[1]);
72: void sha1_hash(const unsigned char data[], unsigned __int32 len, sha1_ctx ctx[1]);
73: void sha1_end(unsigned char hval[], sha1_ctx ctx[1]);
74: void sha1(unsigned char hval[], const unsigned char data[], unsigned __int32 len);
1.1.1.2 root 75:
76: #if defined(__cplusplus)
77: }
78: #endif
79:
80: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.