5 * This is the header file for code which implements the Secure
6 * Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
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.c for more information.
15 * Full Copyright Statement
17 * Copyright (C) The Internet Society (2001). All Rights Reserved.
19 * This document and translations of it may be copied and furnished to
20 * others, and derivative works that comment on or otherwise explain it
21 * or assist in its implementation may be prepared, copied, published
22 * and distributed, in whole or in part, without restriction of any
23 * kind, provided that the above copyright notice and this paragraph are
24 * included on all such copies and derivative works. However, this
25 * document itself may not be modified in any way, such as by removing
26 * the copyright notice or references to the Internet Society or other
27 * Internet organizations, except as needed for the purpose of
28 * developing Internet standards in which case the procedures for
29 * copyrights defined in the Internet Standards process must be
30 * followed, or as required to translate it into languages other than
33 * The limited permissions granted above are perpetual and will not be
34 * revoked by the Internet Society or its successors or assigns.
36 * This document and the information contained herein is provided on an
37 * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
38 * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
39 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
40 * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
41 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
45 * Funding for the RFC Editor function is currently provided by the
56 * If you do not have the ISO standard stdint.h header file, then you
57 * must typdef the following:
59 * uint32_t unsigned 32 bit integer
60 * uint8_t unsigned 8 bit integer (i.e., unsigned char)
61 * int32_t integer of 32 bits
70 shaNull, /* Null pointer parameter */
71 shaInputTooLong, /* input data too long */
72 shaStateError /* called Input after Result */
75 #define SHA1HashSize 20
78 * This structure will hold context information for the SHA-1
81 typedef struct SHA1Context
83 uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
85 uint32_t Length_Low; /* Message length in bits */
86 uint32_t Length_High; /* Message length in bits */
88 /* Index into message block array */
89 int32_t Message_Block_Index;
90 uint8_t Message_Block[64]; /* 512-bit message blocks */
92 int Computed; /* Is the digest computed? */
93 int Corrupted; /* Is the message digest corrupted? */
100 int SHA1Init(SHA1Context *);
101 int SHA1Update(SHA1Context *,
104 int SHA1Final(SHA1Context *,
105 uint8_t Message_Digest[SHA1HashSize]);