Colin Cross | ec0a2e8 | 2010-06-11 14:21:37 -0700 | [diff] [blame] | 1 | /* $NetBSD: sha1.h,v 1.13 2005/12/26 18:41:36 perry Exp $ */ |
| 2 | |
| 3 | /* |
| 4 | * SHA-1 in C |
| 5 | * By Steve Reid <steve@edmweb.com> |
| 6 | * 100% Public Domain |
| 7 | */ |
| 8 | |
| 9 | #ifndef _SYS_SHA1_H_ |
| 10 | #define _SYS_SHA1_H_ |
| 11 | |
Colin Cross | ec0a2e8 | 2010-06-11 14:21:37 -0700 | [diff] [blame] | 12 | #include <sys/types.h> |
| 13 | #include <stdint.h> |
| 14 | |
Raphael Moll | 4605b3f | 2012-02-03 23:02:33 -0800 | [diff] [blame] | 15 | #ifdef USE_MINGW |
| 16 | typedef unsigned char u_char; |
| 17 | typedef unsigned int uint32_t; |
| 18 | typedef unsigned int u_int32_t; |
| 19 | typedef unsigned int u_int; |
| 20 | |
| 21 | #define __BEGIN_DECLS |
| 22 | #define __END_DECLS |
| 23 | #else |
| 24 | #include <sys/cdefs.h> |
| 25 | #endif |
| 26 | |
Colin Cross | ec0a2e8 | 2010-06-11 14:21:37 -0700 | [diff] [blame] | 27 | #define SHA1_DIGEST_LENGTH 20 |
| 28 | #define SHA1_DIGEST_STRING_LENGTH 41 |
| 29 | |
| 30 | typedef struct { |
| 31 | uint32_t state[5]; |
| 32 | uint32_t count[2]; |
| 33 | u_char buffer[64]; |
| 34 | } SHA1_CTX; |
| 35 | |
| 36 | __BEGIN_DECLS |
| 37 | void SHA1Transform(uint32_t[5], const u_char[64]); |
| 38 | void SHA1Init(SHA1_CTX *); |
| 39 | void SHA1Update(SHA1_CTX *, const u_char *, u_int); |
| 40 | void SHA1Final(u_char[SHA1_DIGEST_LENGTH], SHA1_CTX *); |
| 41 | __END_DECLS |
| 42 | |
| 43 | #endif /* _SYS_SHA1_H_ */ |