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