Robotran C Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
sha1.h
Go to the documentation of this file.
1 /*
2  * sha1.h
3  *
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.
8  *
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.
12  *
13  * Please read the file sha1.c for more information.
14  *
15  */
16 
17 #ifndef _SHA1_H_
18 #define _SHA1_H_
19 
20 #include <stdint.h>
21 /*
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
28  *
29  */
30 
31 #ifndef _SHA_enum_
32 #define _SHA_enum_
33 enum
34 {
36  shaNull, /* Null pointer parameter */
37  shaInputTooLong, /* input data too long */
38  shaStateError /* called Input after Result */
39 };
40 #endif
41 #define SHA1HashSize 20
42 
43 /*
44  * This structure will hold context information for the SHA-1
45  * hashing operation
46  */
47 typedef struct SHA1Context
48 {
49  uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
50 
51  uint32_t Length_Low; /* Message length in bits */
52  uint32_t Length_High; /* Message length in bits */
53 
54  /* Index into message block array */
55  int_least16_t Message_Block_Index;
56  uint8_t Message_Block[64]; /* 512-bit message blocks */
57 
58  int Computed; /* Is the digest computed? */
59  int Corrupted; /* Is the message digest corrupted? */
60 } SHA1Context;
61 
62 /*
63  * Function Prototypes
64  */
65 
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]);
72 
73 #endif
shaSuccess
@ shaSuccess
Definition: sha1.h:35
SHA1Context::Computed
int Computed
Definition: sha1.h:58
shaInputTooLong
@ shaInputTooLong
Definition: sha1.h:37
SHA1Input
int SHA1Input(SHA1Context *, const uint8_t *, unsigned int)
SHA1Reset
int SHA1Reset(SHA1Context *)
Definition: sha1.c:59
SHA1Context::Corrupted
int Corrupted
Definition: sha1.h:59
SHA1HashSize
#define SHA1HashSize
Definition: sha1.h:41
shaNull
@ shaNull
Definition: sha1.h:36
SHA1Context::Length_Low
uint32_t Length_Low
Definition: sha1.h:51
SHA1Context::Message_Block
uint8_t Message_Block[64]
Definition: sha1.h:56
shaStateError
@ shaStateError
Definition: sha1.h:38
SHA1Context::Intermediate_Hash
uint32_t Intermediate_Hash[SHA1HashSize/4]
Definition: sha1.h:49
SHA1Context::Message_Block_Index
int_least16_t Message_Block_Index
Definition: sha1.h:55
SHA1Context
Definition: sha1.h:47
SHA1Context::Length_High
uint32_t Length_High
Definition: sha1.h:52
SHA1Result
int SHA1Result(SHA1Context *, uint8_t Message_Digest[SHA1HashSize])
Definition: sha1.c:101