diff options
author | Steve Holme <steve_holme@hotmail.com> | 2020-02-22 05:37:01 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2020-02-23 07:50:33 +0000 |
commit | 37dc4df270b0080442a9e36f9ea13855db9253e6 (patch) | |
tree | 7799e625b9b2ff19c83d5b06bb40a62579abe5ab /lib/sha256.c | |
parent | 4959be810be3340aaa7a1efca4aba7e670d5e8b7 (diff) | |
download | curl-37dc4df270b0080442a9e36f9ea13855db9253e6.tar.gz |
md5/sha256: Updated the functions to allow non-string data to be hashed
Diffstat (limited to 'lib/sha256.c')
-rw-r--r-- | lib/sha256.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/sha256.c b/lib/sha256.c index 5127a9edd..656f9894a 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -259,12 +259,13 @@ static int SHA256_Final(unsigned char *out, /* * @unittest: 1610 */ -void Curl_sha256it(unsigned char *outbuffer, /* 32 unsigned chars */ - const unsigned char *input) +void Curl_sha256it(unsigned char *outbuffer, const unsigned char *input, + const size_t len) { SHA256_CTX ctx; + SHA256_Init(&ctx); - SHA256_Update(&ctx, input, curlx_uztoui(strlen((char *)input))); + SHA256_Update(&ctx, input, curlx_uztoui(len)); SHA256_Final(outbuffer, &ctx); } |