From 9cb655becbdb58c7dfe9f6e72f8915149c1fce61 Mon Sep 17 00:00:00 2001 From: nirav Date: Sun, 29 Nov 2020 13:16:53 +0000 Subject: Initial commit --- test.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test.c (limited to 'test.c') diff --git a/test.c b/test.c new file mode 100644 index 0000000..6a8bcd7 --- /dev/null +++ b/test.c @@ -0,0 +1,36 @@ +#include +#include +#include +#include + +#include "hash.h" + +void test_pearson(const void *d, size_t len) +{ + unsigned char h = pearson(d, len); + uint64_t h64 = pearson_64(d, len); + printf("pearson: %02x\n", h); + printf("pearson_64: %016lx\n", h64); +} + +void test_fnv(const void *d, size_t len) +{ + uint64_t h = fnv1_64(d, len); + printf("fnv1_64: %016lx\n", h); + h = fnv1a_64(d, len); + printf("fnv1a_64: %016lx\n", h); +} + +int main(int argc, char **argv) +{ + const char *d; + size_t len; + if (argc < 2) { + fprintf(stderr, "usage: %s input\n", argv[0]); + exit(1); + } + d = argv[1]; + len = strlen(d); + test_pearson(d, len); + test_fnv(d, len); +} -- cgit v1.2.3