Add Tairon::Crypto::SHA1::hash method for convenient computing hash.
[tairon.git] / src / crypto-sha1 / rfc-sha1.h
blob592a7605dff420a3854cf3c46ad775ecc112ac0d
1 /*
2 * sha1.h
4 * Description:
5 * This is the header file for code which implements the Secure
6 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
7 * April 17, 1995.
9 * Many of the variable names in this code, especially the
10 * single character names, were used because those were the names
11 * used in the publication.
13 * Please read the file sha1.cpp for more information.
17 #ifndef _SHA1_H_
18 #define _SHA1_H_
20 #include <stdint.h>
22 * If you do not have the ISO standard stdint.h header file, then you
23 * must typdef the following:
24 * name meaning
25 * uint32_t unsigned 32 bit integer
26 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
27 * int_least16_t integer of >= 16 bits
31 #ifndef _SHA_enum_
32 #define _SHA_enum_
33 enum
35 shaSuccess = 0,
36 shaNull, /* Null pointer parameter */
37 shaInputTooLong, /* input data too long */
38 shaStateError /* called Input after Result */
40 #endif
41 #define SHA1HashSize 20
44 * This structure will hold context information for the SHA-1
45 * hashing operation
47 typedef struct SHA1Context
49 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
51 uint32_t Length_Low; /* Message length in bits */
52 uint32_t Length_High; /* Message length in bits */
54 /* Index into message block array */
55 int_least16_t Message_Block_Index;
56 uint8_t Message_Block[64]; /* 512-bit message blocks */
58 int Computed; /* Is the digest computed? */
59 int Corrupted; /* Is the message digest corrupted? */
60 } SHA1Context;
63 * Function Prototypes
66 int SHA1Reset( SHA1Context *);
67 int SHA1Input( SHA1Context *,
68 const uint8_t *,
69 unsigned int);
70 int SHA1Result( SHA1Context *,
71 uint8_t Message_Digest[SHA1HashSize]);
73 #endif