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