From 37dc4df270b0080442a9e36f9ea13855db9253e6 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 22 Feb 2020 05:37:01 +0000 Subject: md5/sha256: Updated the functions to allow non-string data to be hashed --- tests/unit/unit1601.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'tests/unit/unit1601.c') diff --git a/tests/unit/unit1601.c b/tests/unit/unit1601.c index a6120e1c2..bf00bc7e9 100644 --- a/tests/unit/unit1601.c +++ b/tests/unit/unit1601.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2016, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -36,18 +36,20 @@ static void unit_stop(void) UNITTEST_START #ifndef CURL_DISABLE_CRYPTO_AUTH - unsigned char output[16]; + const char string1[] = "1"; + const char string2[] = "hello-you-fool"; + unsigned char output[MD5_DIGEST_LEN]; unsigned char *testp = output; - Curl_md5it(output, (const unsigned char *)"1"); -/* !checksrc! disable LONGLINE 2 */ - verify_memory(testp, - "\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f\x75\x84\x9b", 16); + Curl_md5it(output, (const unsigned char *) string1, strlen(string1)); - Curl_md5it(output, (const unsigned char *)"hello-you-fool"); + verify_memory(testp, "\xc4\xca\x42\x38\xa0\xb9\x23\x82\x0d\xcc\x50\x9a\x6f" + "\x75\x84\x9b", MD5_DIGEST_LEN); - verify_memory(testp, - "\x88\x67\x0b\x6d\x5d\x74\x2f\xad\xa5\xcd\xf9\xb6\x82\x87\x5f\x22", 16); + Curl_md5it(output, (const unsigned char *) string2, strlen(string2)); + + verify_memory(testp, "\x88\x67\x0b\x6d\x5d\x74\x2f\xad\xa5\xcd\xf9\xb6\x82" + "\x87\x5f\x22", MD5_DIGEST_LEN); #endif -- cgit v1.2.3