summaryrefslogtreecommitdiff
path: root/lib/md5.c
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2020-02-22 05:37:01 +0000
committerSteve Holme <steve_holme@hotmail.com>2020-02-23 07:50:33 +0000
commit37dc4df270b0080442a9e36f9ea13855db9253e6 (patch)
tree7799e625b9b2ff19c83d5b06bb40a62579abe5ab /lib/md5.c
parent4959be810be3340aaa7a1efca4aba7e670d5e8b7 (diff)
downloadcurl-37dc4df270b0080442a9e36f9ea13855db9253e6.tar.gz
md5/sha256: Updated the functions to allow non-string data to be hashed
Diffstat (limited to 'lib/md5.c')
-rw-r--r--lib/md5.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/md5.c b/lib/md5.c
index 8741bd225..f6fdb48ac 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -513,12 +513,13 @@ const MD5_params Curl_DIGEST_MD5[] = {
/*
* @unittest: 1601
*/
-void Curl_md5it(unsigned char *outbuffer, /* 16 bytes */
- const unsigned char *input)
+void Curl_md5it(unsigned char *outbuffer, const unsigned char *input,
+ const size_t len)
{
MD5_CTX ctx;
+
MD5_Init(&ctx);
- MD5_Update(&ctx, input, curlx_uztoui(strlen((char *)input)));
+ MD5_Update(&ctx, input, curlx_uztoui(len));
MD5_Final(outbuffer, &ctx);
}