1 /* $OpenBSD: sha1.h,v 1.24 2012/12/05 23:19:57 deraadt Exp $ */
5 * By Steve Reid <steve@edmweb.com>
15 #define SHA1_BLOCK_LENGTH 64
16 #define SHA1_DIGEST_LENGTH 20
17 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
23 typedef struct _SHA1_CTX
{
26 uint8_t buffer
[SHA1_BLOCK_LENGTH
];
29 void SHA1Init(SHA1_CTX
*);
30 void SHA1Pad(SHA1_CTX
*);
31 void SHA1Transform(uint32_t [5], const uint8_t [SHA1_BLOCK_LENGTH
]);
32 void SHA1Update(SHA1_CTX
*, const uint8_t *, size_t);
33 void SHA1Final(uint8_t [SHA1_DIGEST_LENGTH
], SHA1_CTX
*);
35 #define HTONDIGEST(x) do { \
40 x[4] = htonl(x[4]); } while (0)
42 #define NTOHDIGEST(x) do { \
47 x[4] = ntohl(x[4]); } while (0)