]>
Commit | Line | Data |
---|---|---|
faeb1b64 KZ |
1 | /* |
2 | * No copyright is claimed. This code is in the public domain; do with | |
3 | * it what you wish. | |
4 | */ | |
3bd55be7 KZ |
5 | #ifndef UTIL_LINUX_SHA1_H |
6 | #define UTIL_LINUX_SHA1_H | |
00476268 PP |
7 | |
8 | /* | |
9 | SHA-1 in C | |
10 | By Steve Reid <steve@edmweb.com> | |
11 | 100% Public Domain | |
12 | */ | |
13 | ||
14 | #include "stdint.h" | |
15 | ||
3bd55be7 | 16 | #define UL_SHA1LENGTH 20 |
00476268 PP |
17 | |
18 | typedef struct | |
19 | { | |
3bd55be7 KZ |
20 | uint32_t state[5]; |
21 | uint32_t count[2]; | |
22 | unsigned char buffer[64]; | |
23 | } UL_SHA1_CTX; | |
24 | ||
25 | void ul_SHA1Transform(uint32_t state[5], const unsigned char buffer[64]); | |
26 | void ul_SHA1Init(UL_SHA1_CTX *context); | |
27 | void ul_SHA1Update(UL_SHA1_CTX *context, const unsigned char *data, uint32_t len); | |
28 | void ul_SHA1Final(unsigned char digest[UL_SHA1LENGTH], UL_SHA1_CTX *context); | |
29 | void ul_SHA1(char *hash_out, const char *str, unsigned len); | |
30 | ||
31 | #endif /* UTIL_LINUX_SHA1_H */ |