diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sha1.c | 20 | ||||
-rw-r--r-- | src/sha1.h | 8 |
2 files changed, 14 insertions, 14 deletions
@@ -197,12 +197,12 @@ void SHA1Init( void SHA1Update( SHA1_CTX * context, const unsigned char *data, - uint32_t len + size_t len ) { - uint32_t i; + size_t i; - uint32_t j; + size_t j; j = context->count[0]; if ((context->count[0] += len << 3) < j) @@ -279,16 +279,16 @@ void SHA1Final( } void SHA1( - char *hash_out, - const char *str, - int len) + const unsigned char *str, + size_t len, + unsigned char *hash_out +) { SHA1_CTX ctx; - unsigned int ii; + size_t ii; SHA1Init(&ctx); for (ii=0; ii<len; ii+=1) - SHA1Update(&ctx, (const unsigned char*)str + ii, 1); - SHA1Final((unsigned char *)hash_out, &ctx); - hash_out[20] = '\0'; + SHA1Update(&ctx, str + ii, 1); + SHA1Final(hash_out, &ctx); } @@ -28,7 +28,7 @@ void SHA1Init( void SHA1Update( SHA1_CTX * context, const unsigned char *data, - uint32_t len + size_t len ); void SHA1Final( @@ -37,8 +37,8 @@ void SHA1Final( ); void SHA1( - char *hash_out, - const char *str, - int len); + const unsigned char *str, + size_t len, + unsigned char *hash_out); #endif /* SHA1_H */ |