summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sha1.c20
-rw-r--r--src/sha1.h8
2 files changed, 14 insertions, 14 deletions
diff --git a/src/sha1.c b/src/sha1.c
index 09e68fd..02557ff 100644
--- a/src/sha1.c
+++ b/src/sha1.c
@@ -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);
}
diff --git a/src/sha1.h b/src/sha1.h
index 96bb008..c8e9f68 100644
--- a/src/sha1.h
+++ b/src/sha1.h
@@ -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 */