2 * shs1 - new NIST Secure Hash Standard-1 (SHS1)
4 * Written 2 September 1992, Peter C. Gutmann.
6 * This file and been extensively modified by:
9 * http://www.isthe.com/chongo/
11 * chongo <was here> /\../\
13 * This code has been placed in the public domain. Please do not
14 * copyright this code.
16 * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
17 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
18 * CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
19 * NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
21 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
22 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
23 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 * This file is not covered under version 2.1 of the GNU LGPL.
33 #if !defined(__SHS1_H__)
37 /* SHS1_CHUNKSIZE must be a power of 2 - fixed value defined by the algorithm */
38 #define SHS1_CHUNKSIZE (1<<6)
39 #define SHS1_CHUNKWORDS (SHS1_CHUNKSIZE/sizeof(USB32))
41 /* SHS1_DIGESTSIZE is a the length of the digest as defined by the algorithm */
42 #define SHS1_DIGESTSIZE (20)
43 #define SHS1_DIGESTWORDS (SHS1_DIGESTSIZE/sizeof(USB32))
45 /* SHS1_LOW - where low 32 bits of 64 bit count is stored during final */
48 /* SHS1_HIGH - where high 32 bits of 64 bit count is stored during final */
52 * The structure for storing SHS1 info
54 * We will assume that bit count is a multiple of 8.
57 USB32 digest[SHS1_DIGESTWORDS]; /* message digest */
58 USB32 countLo; /* 64 bit count: bits 3-34 */
59 USB32 countHi; /* 64 bit count: bits 35-63 */
60 USB32 datalen; /* length of data in data */
61 USB32 data[SHS1_CHUNKWORDS]; /* SHS1 chunk buffer */
65 * SHS1COUNT(SHS1_INFO*, USB32) - update the 64 bit count in an SHS1_INFO
67 * We will count bytes and convert to bit count during the final
70 #define SHS1COUNT(shs1info, count) { \
72 tmp_countLo = (shs1info)->countLo; \
73 if (((shs1info)->countLo += (count)) < tmp_countLo) { \
74 (shs1info)->countHi++; \
79 #endif /* !__SHS1_H__ */