| 1 | /* $NetBSD: sha1.h,v 1.15 2016/07/01 16:43:16 christos 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 | |
| 12 | #include <sys/cdefs.h> |
| 13 | #include <sys/types.h> |
| 14 | |
| 15 | #define SHA1_DIGEST_LENGTH 20 |
| 16 | #define SHA1_DIGEST_STRING_LENGTH 41 |
| 17 | #define SHA1_BLOCK_LENGTH 64 |
| 18 | |
| 19 | typedef struct { |
| 20 | uint32_t state[5]; |
| 21 | uint32_t count[2]; |
| 22 | uint8_t buffer[SHA1_BLOCK_LENGTH]; |
| 23 | } SHA1_CTX; |
| 24 | |
| 25 | __BEGIN_DECLS |
| 26 | void SHA1Transform(uint32_t[5], const uint8_t[64]); |
| 27 | void SHA1Init(SHA1_CTX *); |
| 28 | void SHA1Update(SHA1_CTX *, const uint8_t *, unsigned int); |
| 29 | void SHA1Final(uint8_t[SHA1_DIGEST_LENGTH], SHA1_CTX *); |
| 30 | #ifndef _KERNEL |
| 31 | char *SHA1End(SHA1_CTX *, char *); |
| 32 | char *SHA1FileChunk(const char *, char *, off_t, off_t); |
| 33 | char *SHA1File(const char *, char *); |
| 34 | char *SHA1Data(const uint8_t *, size_t, char *); |
| 35 | #endif /* _KERNEL */ |
| 36 | __END_DECLS |
| 37 | |
| 38 | #endif /* _SYS_SHA1_H_ */ |
| 39 | |