| 1 | #ifndef SHA1_H |
| 2 | #define SHA1_H |
| 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 | |
| 12 | #if defined(__cplusplus) |
| 13 | extern "C" { |
| 14 | #endif |
| 15 | |
| 16 | typedef struct |
| 17 | { |
| 18 | uint32_t state[5]; |
| 19 | uint32_t count[2]; |
| 20 | unsigned char buffer[64]; |
| 21 | } SHA1_CTX; |
| 22 | |
| 23 | void SHA1Transform( |
| 24 | uint32_t state[5], |
| 25 | const unsigned char buffer[64] |
| 26 | ); |
| 27 | |
| 28 | void SHA1Init( |
| 29 | SHA1_CTX * context |
| 30 | ); |
| 31 | |
| 32 | void SHA1Update( |
| 33 | SHA1_CTX * context, |
| 34 | const unsigned char *data, |
| 35 | uint32_t len |
| 36 | ); |
| 37 | |
| 38 | void SHA1Final( |
| 39 | unsigned char digest[20], |
| 40 | SHA1_CTX * context |
| 41 | ); |
| 42 | |
| 43 | void SHA1( |
| 44 | char *hash_out, |
| 45 | const char *str, |
| 46 | uint32_t len); |
| 47 | |
| 48 | #if defined(__cplusplus) |
| 49 | } |
| 50 | #endif |
| 51 | |
| 52 | #endif /* SHA1_H */ |
| 53 | |