diff options
author | David Robillard <d@drobilla.net> | 2019-10-18 13:33:38 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-10-18 14:48:31 +0200 |
commit | 7c80def6c18674804cbbc607de5e1acf459d5d78 (patch) | |
tree | b784533aec455fb559a0ee473ed61cae1db9d3c4 | |
parent | ba62633916ea41421d2ea5b29396455f00c0372c (diff) | |
download | zix-7c80def6c18674804cbbc607de5e1acf459d5d78.tar.gz zix-7c80def6c18674804cbbc607de5e1acf459d5d78.tar.bz2 zix-7c80def6c18674804cbbc607de5e1acf459d5d78.zip |
Use digest in hash test
-rw-r--r-- | test/hash_test.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/test/hash_test.c b/test/hash_test.c index a3aee53..874bdff 100644 --- a/test/hash_test.c +++ b/test/hash_test.c @@ -17,6 +17,7 @@ #include "test_malloc.h" #include "zix/common.h" +#include "zix/digest.h" #include "zix/hash.h" #include <stdarg.h> @@ -72,13 +73,9 @@ check(void* value, void* user_data) static uint32_t string_ptr_hash(const void* value) { - // Trusty old DJB hash - const char* str = *(const char*const*)value; - unsigned h = 5381; - for (const char* s = str; *s != '\0'; ++s) { - h = (h << 5) + h + *s; // h = h * 33 + c - } - return h; + const char* const str = *(const char* const*)value; + + return zix_digest_add(zix_digest_start(), str, strlen(str)); } static bool |