]>
Commit | Line | Data |
---|---|---|
1160f6c9 AC |
1 | /* |
2 | * Based on the SHA-1 C implementation by Steve Reid <steve@edmweb.com> | |
3 | * 100% Public Domain | |
4 | */ | |
5 | ||
6 | #ifndef SHA1_H | |
7 | #define SHA1_H | |
8 | ||
9 | #include <stddef.h> | |
10 | #include <stdint.h> | |
11 | ||
12 | #define SHA1_BLOCK_LENGTH 64 | |
13 | #define SHA1_DIGEST_LENGTH 20 | |
14 | ||
15 | typedef struct { | |
16 | uint32_t state[5]; | |
17 | uint64_t count; | |
18 | uint8_t buffer[SHA1_BLOCK_LENGTH]; | |
19 | } SHA1; | |
20 | ||
21 | void sha1_init(SHA1 *sha1); | |
22 | void sha1_update(SHA1 *sha1, const uint8_t *data, size_t length); | |
23 | void sha1_final(SHA1 *sha1, uint8_t digest[SHA1_DIGEST_LENGTH]); | |
24 | ||
25 | #endif // SHA1_H |