Add phnxdeco with debian patch set (version 0.33-3).
[delutions.git] / tc / crypto / Sha1.h
blob90a42b03851c0cfa211a97b7b7b69376713e3291
1 /*
2 ---------------------------------------------------------------------------
3 Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved.
5 LICENSE TERMS
7 The free distribution and use of this software is allowed (with or without
8 changes) provided that:
10 1. source code distributions include the above copyright notice, this
11 list of conditions and the following disclaimer;
13 2. binary distributions include the above copyright notice, this list
14 of conditions and the following disclaimer in their documentation;
16 3. the name of the copyright holder is not used to endorse products
17 built using this software without specific written permission.
19 DISCLAIMER
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
28 #ifndef _SHA1_H
29 #define _SHA1_H
31 #include <limits.h>
33 #define SHA1_BLOCK_SIZE 64
34 #define SHA1_DIGEST_SIZE 20
36 #if defined(__cplusplus)
37 extern "C"
39 #endif
41 /* define an unsigned 32-bit type */
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
53 /* type to hold the SHA256 context */
55 typedef struct
56 { sha1_32t count[2];
57 sha1_32t hash[5];
58 sha1_32t wbuf[16];
59 } sha1_ctx;
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 */
68 void sha1_compile(sha1_ctx ctx[1]);
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);
75 #if defined(__cplusplus)
77 #endif
79 #endif