|
|
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>
32:
33: #define SHA1_BLOCK_SIZE 64
34: #define SHA1_DIGEST_SIZE 20
35:
36: #if defined(__cplusplus)
37: extern "C"
38: {
39: #endif
40:
41: /* define an unsigned 32-bit type */
42:
43: #if defined(_MSC_VER)
44: typedef unsigned __int32 sha1_32t;
45: #elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
46: typedef unsigned __int32 sha1_32t;
47: #elif defined(UINT_MAX) && UINT_MAX == 0xffffffff
48: typedef unsigned int sha1_32t;
49: #else
50: # error Please define sha1_32t as an unsigned 32 bit type in sha1.h
51: #endif
52:
53: /* type to hold the SHA256 context */
54:
55: typedef struct
56: { sha1_32t count[2];
57: sha1_32t hash[5];
58: sha1_32t wbuf[16];
59: } sha1_ctx;
60:
61: /* Note that these prototypes are the same for both bit and */
62: /* byte oriented implementations. However the length fields */
63: /* are in bytes or bits as appropriate for the version used */
64: /* and bit sequences are input as arrays of bytes in which */
65: /* bit sequences run from the most to the least significant */
66: /* end of each byte */
67:
68: void sha1_compile(sha1_ctx ctx[1]);
69:
1.1.1.3 root 70: void sha1_begin(sha1_ctx ctx[1]);
71: void sha1_hash(const unsigned char data[], unsigned __int32 len, sha1_ctx ctx[1]);
72: void sha1_end(unsigned char hval[], sha1_ctx ctx[1]);
73: void sha1(unsigned char hval[], const unsigned char data[], unsigned __int32 len);
1.1.1.2 root 74:
75: #if defined(__cplusplus)
76: }
77: #endif
78:
79: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.