From 32b50bfdcb2af7a06d8a8691023759c630d435f1 Mon Sep 17 00:00:00 2001 From: Willem Thiart Date: Sun, 21 Sep 2014 12:30:39 +0900 Subject: [PATCH] ADDED SHA1 function --- sha1.c | 15 +++++++++++++++ sha1.h | 21 +++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sha1.c b/sha1.c index 8367c4d..c2bf174 100644 --- a/sha1.c +++ b/sha1.c @@ -279,3 +279,18 @@ void SHA1Final( memset(&finalcount, '\0', sizeof(finalcount)); } +void SHA1( + char *hash_out, + const char *str, + int len) +{ + SHA1_CTX ctx; + unsigned int ii; + + SHA1Init(&ctx); + for (ii=0; ii -100% Public Domain -*/ + SHA-1 in C + By Steve Reid + 100% Public Domain + */ typedef struct { @@ -17,21 +17,26 @@ typedef struct void SHA1Transform( uint32_t state[5], const unsigned char buffer[64] -); + ); void SHA1Init( SHA1_CTX * context -); + ); void SHA1Update( SHA1_CTX * context, const unsigned char *data, uint32_t len -); + ); void SHA1Final( unsigned char digest[20], SHA1_CTX * context -); + ); + +void SHA1( + char *hash_out, + const char *str, + int len); #endif /* SHA1_H */