From 2bb3b2195e3ca0fcd64012b6df7535936a7bd8da Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Wed, 1 Aug 2018 10:45:08 +0300 Subject: [PATCH] lib: Remove murmurhash3 It is not used anywhere --- src/lib/Makefile.am | 3 - src/lib/murmurhash3.c | 342 ------------------------------------- src/lib/murmurhash3.h | 23 --- src/lib/test-lib.inc | 1 - src/lib/test-murmurhash3.c | 200 ---------------------- 5 files changed, 569 deletions(-) delete mode 100644 src/lib/murmurhash3.c delete mode 100644 src/lib/murmurhash3.h delete mode 100644 src/lib/test-murmurhash3.c diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index a874797126..d63a65cdb2 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -112,7 +112,6 @@ liblib_la_SOURCES = \ mmap-util.c \ module-dir.c \ mountpoint.c \ - murmurhash3.c \ net.c \ nfs-workarounds.c \ numpack.c \ @@ -264,7 +263,6 @@ headers = \ module-context.h \ module-dir.h \ mountpoint.h \ - murmurhash3.h \ net.h \ nfs-workarounds.h \ numpack.h \ @@ -378,7 +376,6 @@ test_lib_SOURCES = \ test-mempool.c \ test-mempool-allocfree.c \ test-mempool-alloconly.c \ - test-murmurhash3.c \ test-pkcs5.c \ test-net.c \ test-numpack.c \ diff --git a/src/lib/murmurhash3.c b/src/lib/murmurhash3.c deleted file mode 100644 index 6f6133bd5c..0000000000 --- a/src/lib/murmurhash3.c +++ /dev/null @@ -1,342 +0,0 @@ -/* MurmurHash3 was written by Austin Appleby, and is placed in the public - domain. The author hereby disclaims copyright to this source code. - - Note - The x86 and x64 versions do _not_ produce the same results, as the - algorithms are optimized for their respective platforms. You can still - compile and run any of them on any platform, but your performance with the - non-native version will be less than optimal. - - Adapted for Dovecot by Aki Tuomi 2017-11-27 -*/ - -#include "lib.h" -#include "murmurhash3.h" - -#define ROTL32(x,y) bits_rotl32(x,y) -#define ROTL64(x,y) bits_rotl64(x,y) - -#define BIG_CONSTANT(x) (x##LLU) - -//----------------------------------------------------------------------------- -// Block read - if your platform needs to do endian-swapping or can only -// handle aligned reads, do the conversion here - -static inline uint32_t getblock32(const uint32_t *p, int i) -{ - return le32_to_cpu(p[i]); -} - -//----------------------------------------------------------------------------- -// Finalization mix - force all bits of a hash block to avalanche - -static inline uint32_t fmix32(uint32_t h) -{ - h ^= h >> 16; - h *= 0x85ebca6b; - h ^= h >> 13; - h *= 0xc2b2ae35; - h ^= h >> 16; - - return h; -} - -//---------- - -void murmurhash3_32 (const void *key, size_t len, uint32_t seed, - unsigned char out[STATIC_ARRAY MURMURHASH3_32_RESULTBYTES]) -{ - const uint8_t *data = (const uint8_t *)key; - size_t nblocks = len / 4; - - uint32_t h1 = seed; - - uint32_t c1 = 0xcc9e2d51; - uint32_t c2 = 0x1b873593; - //---------- - // body - - const uint32_t *blocks = (const uint32_t *)data; - - for(size_t i = 0; i < nblocks; i++) - { - uint32_t k1 = getblock32(blocks,i); - - k1 *= c1; - k1 = ROTL32(k1,15); - k1 *= c2; - - h1 ^= k1; - h1 = ROTL32(h1,13); - h1 = h1*5+0xe6546b64; - } - - //---------- - // tail - - const uint8_t *tail = (const uint8_t *)(data + nblocks*4); - - uint32_t k1 = 0; - - switch(len & 3) - { - case 3: k1 ^= tail[2] << 16; - /* fall through */ - case 2: k1 ^= tail[1] << 8; - /* fall through */ - case 1: k1 ^= tail[0]; - k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; - }; - - //---------- - // finalization - - h1 ^= len; - - h1 = fmix32(h1); - - h1 = cpu32_to_be(h1); - - memcpy(out, &h1, sizeof(h1)); -} - -//----------------------------------------------------------------------------- - -#ifdef _LP64 - -static inline uint64_t getblock64(const uint64_t *p, int i) -{ - return le64_to_cpu(p[i]); -} - -static inline uint64_t fmix64(uint64_t k) -{ - k ^= k >> 33; - k *= BIG_CONSTANT(0xff51afd7ed558ccd); - k ^= k >> 33; - k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53); - k ^= k >> 33; - - return k; -} - -void murmurhash3_128(const void *key, size_t len, uint32_t seed, - unsigned char out[STATIC_ARRAY MURMURHASH3_128_RESULTBYTES]) -{ - const uint8_t *data = (const uint8_t *)key; - size_t nblocks = len / 16; - - uint64_t h1 = seed; - uint64_t h2 = seed; - - const uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5); - const uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f); - - //---------- - // body - - const uint64_t *blocks = (const uint64_t *)data; - - for(size_t i = 0; i < nblocks; i++) - { - uint64_t k1 = getblock64(blocks,i*2+0); - uint64_t k2 = getblock64(blocks,i*2+1); - - k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1; - - h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729; - - k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2; - - h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5; - } - - //---------- - // tail - - const uint8_t *tail = (const uint8_t *)(data + nblocks*16); - - uint64_t k1 = 0; - uint64_t k2 = 0; - - switch(len & 15) - { - case 15: k2 ^= ((uint64_t)tail[14]) << 48; - /* fall through */ - case 14: k2 ^= ((uint64_t)tail[13]) << 40; - /* fall through */ - case 13: k2 ^= ((uint64_t)tail[12]) << 32; - /* fall through */ - case 12: k2 ^= ((uint64_t)tail[11]) << 24; - /* fall through */ - case 11: k2 ^= ((uint64_t)tail[10]) << 16; - /* fall through */ - case 10: k2 ^= ((uint64_t)tail[ 9]) << 8; - /* fall through */ - case 9: k2 ^= ((uint64_t)tail[ 8]) << 0; - k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2; - /* fall through */ - - case 8: k1 ^= ((uint64_t)tail[ 7]) << 56; - /* fall through */ - case 7: k1 ^= ((uint64_t)tail[ 6]) << 48; - /* fall through */ - case 6: k1 ^= ((uint64_t)tail[ 5]) << 40; - /* fall through */ - case 5: k1 ^= ((uint64_t)tail[ 4]) << 32; - /* fall through */ - case 4: k1 ^= ((uint64_t)tail[ 3]) << 24; - /* fall through */ - case 3: k1 ^= ((uint64_t)tail[ 2]) << 16; - /* fall through */ - case 2: k1 ^= ((uint64_t)tail[ 1]) << 8; - /* fall through */ - case 1: k1 ^= ((uint64_t)tail[ 0]) << 0; - k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1; - }; - - //---------- - // finalization - - h1 ^= len; h2 ^= len; - - h1 += h2; - h2 += h1; - - h1 = fmix64(h1); - h2 = fmix64(h2); - - h1 += h2; - h2 += h1; - - h1 = cpu64_to_be(h1); - h2 = cpu64_to_be(h2); - - memcpy(out, &h1, sizeof(h1)); - memcpy(out+sizeof(h1), &h2, sizeof(h2)); -} - -#else - -void murmurhash3_128(const void *key, size_t len, uint32_t seed, - unsigned char out[STATIC_ARRAY MURMURHASH3_128_RESULTBYTES]) -{ - const uint8_t *data = (const uint8_t *)key; - size_t nblocks = len / 16; - - uint32_t h1 = seed; - uint32_t h2 = seed; - uint32_t h3 = seed; - uint32_t h4 = seed; - - uint32_t c1 = 0x239b961b; - uint32_t c2 = 0xab0e9789; - uint32_t c3 = 0x38b34ae5; - uint32_t c4 = 0xa1e38b93; - - //---------- - // body - - const uint32_t *blocks = (const uint32_t *)data; - - for(size_t i = 0 ; i < nblocks; i++) - { - uint32_t k1 = getblock32(blocks,i*4+0); - uint32_t k2 = getblock32(blocks,i*4+1); - uint32_t k3 = getblock32(blocks,i*4+2); - uint32_t k4 = getblock32(blocks,i*4+3); - - k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; - - h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b; - - k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2; - - h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747; - - k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3; - - h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35; - - k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4; - - h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17; - } - - //---------- - // tail - - const uint8_t *tail = (const uint8_t *)(data + nblocks*16); - - uint32_t k1 = 0; - uint32_t k2 = 0; - uint32_t k3 = 0; - uint32_t k4 = 0; - - switch(len & 15) - { - case 15: k4 ^= tail[14] << 16; - /* fall through */ - case 14: k4 ^= tail[13] << 8; - /* fall through */ - case 13: k4 ^= tail[12] << 0; - k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4; - /* fall through */ - - case 12: k3 ^= tail[11] << 24; - /* fall through */ - case 11: k3 ^= tail[10] << 16; - /* fall through */ - case 10: k3 ^= tail[ 9] << 8; - /* fall through */ - case 9: k3 ^= tail[ 8] << 0; - k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3; - /* fall through */ - - case 8: k2 ^= tail[ 7] << 24; - /* fall through */ - case 7: k2 ^= tail[ 6] << 16; - /* fall through */ - case 6: k2 ^= tail[ 5] << 8; - /* fall through */ - case 5: k2 ^= tail[ 4] << 0; - k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2; - /* fall through */ - - case 4: k1 ^= tail[ 3] << 24; - /* fall through */ - case 3: k1 ^= tail[ 2] << 16; - /* fall through */ - case 2: k1 ^= tail[ 1] << 8; - /* fall through */ - case 1: k1 ^= tail[ 0] << 0; - k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; - }; - - //---------- - // finalization - - h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len; - - h1 += h2; h1 += h3; h1 += h4; - h2 += h1; h3 += h1; h4 += h1; - - h1 = fmix32(h1); - h2 = fmix32(h2); - h3 = fmix32(h3); - h4 = fmix32(h4); - - h1 += h2; h1 += h3; h1 += h4; - h2 += h1; h3 += h1; h4 += h1; - - h1 = cpu32_to_be(h1); - h2 = cpu32_to_be(h2); - h3 = cpu32_to_be(h3); - h4 = cpu32_to_be(h4); - - memcpy(out, &h1, sizeof(h1)); - memcpy(out+sizeof(h1), &h2, sizeof(h2)); - memcpy(out+sizeof(h1)*2, &h3, sizeof(h3)); - memcpy(out+sizeof(h1)*3, &h4, sizeof(h4)); -} - -#endif diff --git a/src/lib/murmurhash3.h b/src/lib/murmurhash3.h deleted file mode 100644 index 4f838e2743..0000000000 --- a/src/lib/murmurhash3.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - MurmurHash3 was written by Austin Appleby, and is placed in the public - domain. The author hereby disclaims copyright to this source code. - - - Adapted for dovecot by Aki Tuomi 2017-11-27 -*/ -#ifndef MURMURHASH3_H -#define MURMURHASH3_H - -#define MURMURHASH3_32_RESULTBYTES (sizeof(uint32_t)) -#ifdef _LP64 -#define MURMURHASH3_128_RESULTBYTES (sizeof(uint64_t)*2) -#else -#define MURMURHASH3_128_RESULTBYTES (sizeof(uint32_t)*4) -#endif - -/* You should use random seed */ -void murmurhash3_32(const void * key, size_t len, uint32_t seed, - unsigned char out[STATIC_ARRAY MURMURHASH3_32_RESULTBYTES]); -void murmurhash3_128(const void * key, size_t len, uint32_t seed, - unsigned char out[STATIC_ARRAY MURMURHASH3_128_RESULTBYTES]); -#endif diff --git a/src/lib/test-lib.inc b/src/lib/test-lib.inc index 87680be629..f2b04f2ec3 100644 --- a/src/lib/test-lib.inc +++ b/src/lib/test-lib.inc @@ -56,7 +56,6 @@ TEST(test_mempool_alloconly) FATAL(fatal_mempool_alloconly) TEST(test_mempool_allocfree) FATAL(fatal_mempool_allocfree) -TEST(test_murmurhash3) TEST(test_net) TEST(test_numpack) TEST(test_ostream_buffer) diff --git a/src/lib/test-murmurhash3.c b/src/lib/test-murmurhash3.c deleted file mode 100644 index 4848fbd678..0000000000 --- a/src/lib/test-murmurhash3.c +++ /dev/null @@ -1,200 +0,0 @@ -/* Copyright (c) 2018 Dovecot authors, see the included COPYING file */ - -#include "test-lib.h" -#include "murmurhash3.h" - -struct murmur3_test_vectors { - const char *input; - size_t len; - uint32_t seed; - - /* murmurhash3_128() produces a different output on ILP32 and LP64 - systems (by design). Therefore, we must use different expected - results based on what system we're on. We define both all the - time, but use the below pre-processor magic to select which - version we'll use. */ - uint8_t result_ilp32[MURMURHASH3_128_RESULTBYTES]; /* fits all results */ - uint8_t result_lp64[MURMURHASH3_128_RESULTBYTES]; /* fits all results */ -#ifdef _LP64 -#define result result_lp64 -#else -#define result result_ilp32 -#endif -}; - -static void test_murmurhash3_algorithm(const char *name, - void (*func)(const void*,size_t,uint32_t,unsigned char[]), - size_t result_size, - const struct murmur3_test_vectors *vectors, - unsigned int tests) -{ - test_begin(t_strdup_printf("murmurhash3 (%s)", name)); - - for(unsigned int i = 0; i < tests; i++) { - unsigned char result[result_size]; - func(vectors[i].input, vectors[i].len, vectors[i].seed, result); - test_assert_idx(memcmp(result, vectors[i].result, sizeof(result)) == 0, i); - } - - test_end(); -} - -static void test_murmurhash3_32(void) -{ - /* murmurhash3_32() produces the same output on both ILP32 and LP64 - systems, so use the same expected outputs for both */ - struct murmur3_test_vectors vectors[] = { - { "", 0, 0, { 0, }, { 0, } }, - { "", 0, 0x1, - { 0x51, 0x4E, 0x28, 0xB7, }, - { 0x51, 0x4E, 0x28, 0xB7, } }, - { "", 0, 0xFFFFFFFF, - { 0x81, 0xF1, 0x6F, 0x39, }, - { 0x81, 0xF1, 0x6F, 0x39, } }, - { "\0\0\0\0", 4, 0, - { 0x23, 0x62, 0xF9, 0xDE, }, - { 0x23, 0x62, 0xF9, 0xDE, } }, - { "aaaa", 4, 0x9747b28c, - { 0x5A, 0x97, 0x80, 0x8A, }, - { 0x5A, 0x97, 0x80, 0x8A, } }, - { "aaa", 3, 0x9747b28c, - { 0x28, 0x3E, 0x01, 0x30, }, - { 0x28, 0x3E, 0x01, 0x30, } }, - { "aa", 2, 0x9747b28c, - { 0x5D, 0x21, 0x17, 0x26, }, - { 0x5D, 0x21, 0x17, 0x26, } }, - { "a", 1, 0x9747b28c, - { 0x7F, 0xA0, 0x9E, 0xA6, }, - { 0x7F, 0xA0, 0x9E, 0xA6, } }, - { "abcd", 4, 0x9747b28c, - { 0xF0, 0x47, 0x86, 0x27, }, - { 0xF0, 0x47, 0x86, 0x27, } }, - { "abc", 3, 0x9747b28c, - { 0xC8, 0x4A, 0x62, 0xDD, }, - { 0xC8, 0x4A, 0x62, 0xDD, } }, - { "ab", 2, 0x9747b28c, - { 0x74, 0x87, 0x55, 0x92, }, - { 0x74, 0x87, 0x55, 0x92, } }, - { "Hello, world!", 13, 0x9747b28c, - { 0x24, 0x88, 0x4C, 0xBA, }, - { 0x24, 0x88, 0x4C, 0xBA, } }, - { - "\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80", - 16, - 0x9747b28c, - { 0xD5, 0x80, 0x63, 0xC1, }, - { 0xD5, 0x80, 0x63, 0xC1, } - }, /* 8 U+03C0 (Greek Small Letter Pi) */ - { - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaa", - 256, - 0x9747b28c, - { 0x37, 0x40, 0x5B, 0xDC, }, - { 0x37, 0x40, 0x5B, 0xDC, } - }, - }; - - test_murmurhash3_algorithm("murmurhash3_32", murmurhash3_32, - MURMURHASH3_32_RESULTBYTES, - vectors, N_ELEMENTS(vectors)); -} - -static void test_murmurhash3_128(void) -{ - /* murmurhash3_128() produces a different output on ILP32 and LP64 - systems (by design). */ - struct murmur3_test_vectors vectors[] = { - { "", 0, 0x00000000, { 0, }, { 0, }}, - { "", 0, 0x00000001, - { 0x88, 0xc4, 0xad, 0xec, 0x54, 0xd2, 0x01, 0xb9, - 0x54, 0xd2, 0x01, 0xb9, 0x54, 0xd2, 0x01, 0xb9 }, - { 0x46, 0x10, 0xab, 0xe5, 0x6e, 0xff, 0x5c, 0xb5, - 0x51, 0x62, 0x2d, 0xaa, 0x78, 0xf8, 0x35, 0x83 }}, - { "", 0, 0xffffffff, - { 0x05, 0x1e, 0x08, 0xa9, 0x98, 0x9d, 0x49, 0xf7, - 0x98, 0x9d, 0x49, 0xf7, 0x98, 0x9d, 0x49, 0xf7 }, - { 0x6a, 0xf1, 0xdf, 0x4d, 0x9d, 0x3b, 0xc9, 0xec, - 0x85, 0x74, 0x21, 0x12, 0x1e, 0xe6, 0x44, 0x6b }}, - { "\0\0\0\0", 4, 0x00000000, - { 0xcc, 0x06, 0x6f, 0x1f, 0x9e, 0x51, 0x78, 0x40, - 0x9e, 0x51, 0x78, 0x40, 0x9e, 0x51, 0x78, 0x40 }, - { 0xcf, 0xa0, 0xf7, 0xdd, 0xd8, 0x4c, 0x76, 0xbc, - 0x58, 0x96, 0x23, 0x16, 0x1c, 0xf5, 0x26, 0xf1 }}, - { "aaaa", 4, 0x9747b28c, - { 0x36, 0x80, 0x4c, 0xef, 0x2a, 0x61, 0xc2, 0x24, - 0x2a, 0x61, 0xc2, 0x24, 0x2a, 0x61, 0xc2, 0x24 }, - { 0xb4, 0xe0, 0xa5, 0xf7, 0x5e, 0x64, 0x9b, 0xf0, - 0xa5, 0xd3, 0xe8, 0xe9, 0x03, 0x8c, 0x56, 0x9f }}, - { "aaa", 3, 0x9747b28c, - { 0x83, 0x83, 0x89, 0xbe, 0x9a, 0xad, 0x7f, 0x88, - 0x9a, 0xad, 0x7f, 0x88, 0x9a, 0xad, 0x7f, 0x88 }, - { 0x8e, 0xa5, 0xe3, 0x7a, 0xe4, 0xc7, 0x46, 0x6b, - 0xf9, 0x25, 0xbe, 0xf0, 0x35, 0xdc, 0x93, 0x1c }}, - { "aa", 2, 0x9747b28c, - { 0xdf, 0xbe, 0x4a, 0x86, 0x4a, 0x9c, 0x35, 0x0b, - 0x4a, 0x9c, 0x35, 0x0b, 0x4a, 0x9c, 0x35, 0x0b }, - { 0x12, 0xa6, 0x98, 0xa9, 0xbe, 0xe5, 0xbb, 0x1f, - 0xe9, 0x36, 0x30, 0xff, 0x5e, 0x26, 0x94, 0x01 }}, - { "a", 1, 0x9747b28c, - { 0x08, 0x4e, 0xf9, 0x44, 0x21, 0xa1, 0x18, 0x6e, - 0x21, 0xa1, 0x18, 0x6e, 0x21, 0xa1, 0x18, 0x6e }, - { 0x5c, 0xe8, 0xd8, 0x51, 0x2d, 0xb2, 0x5a, 0x1d, - 0x9e, 0x6d, 0xab, 0x0f, 0x92, 0x08, 0xf0, 0x04 }}, - { "abcd", 4, 0x9747b28c, - { 0x47, 0x95, 0xc5, 0x29, 0xce, 0xc1, 0x88, 0x5e, - 0xce, 0xc1, 0x88, 0x5e, 0xce, 0xc1, 0x88, 0x5e }, - { 0x49, 0xb4, 0x70, 0x9e, 0xac, 0x55, 0x37, 0x91, - 0x8a, 0x7e, 0x67, 0xe7, 0xe9, 0xd3, 0xa7, 0xbb }}, - { "abc", 3, 0x9747b28c, - { 0xd6, 0x35, 0x9e, 0xaf, 0x48, 0xfc, 0x3a, 0xc3, - 0x48, 0xfc, 0x3a, 0xc3, 0x48, 0xfc, 0x3a, 0xc3 }, - { 0x37, 0x43, 0x63, 0x0d, 0xbf, 0xc3, 0xce, 0xdc, - 0xcd, 0xe0, 0xa2, 0x34, 0x20, 0xb5, 0x04, 0xbf }}, - { "ab", 2, 0x9747b28c, - { 0x38, 0x37, 0xd7, 0x95, 0xc7, 0xfe, 0x58, 0x96, - 0xc7, 0xfe, 0x58, 0x96, 0xc7, 0xfe, 0x58, 0x96 }, - { 0x84, 0x34, 0xee, 0xad, 0x1a, 0x44, 0x28, 0x0b, - 0x7e, 0xb9, 0x33, 0xe7, 0x63, 0xce, 0x37, 0x2b }}, - { "Hello, world!", 13, 0x9747b28c, - { 0x75, 0x6d, 0x54, 0x60, 0xbb, 0x87, 0x22, 0x16, - 0xb7, 0xd4, 0x8b, 0x7c, 0x53, 0xc8, 0xc6, 0x36 }, - { 0xed, 0xc4, 0x85, 0xd6, 0x62, 0xa8, 0x39, 0x2e, - 0xf8, 0x5e, 0x7e, 0x76, 0x31, 0xd5, 0x76, 0xba }}, - { - "\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80\xcf\x80", - 16, - 0x9747b28c, - { 0xaf, 0x2a, 0xd3, 0x25, 0x3a, 0x74, 0xdf, 0x88, - 0x38, 0xcc, 0x75, 0x34, 0xf1, 0x97, 0xcc, 0x0d }, - { 0x96, 0xea, 0x5b, 0xd8, 0xc0, 0x36, 0x1a, 0x1f, - 0xf8, 0xb7, 0x2b, 0xd0, 0x09, 0x4b, 0xe1, 0x7b } - }, - { - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaa", - 256, - 0x9747b28c, - { 0xd3, 0xf2, 0xb7, 0xbb, 0xf6, 0x66, 0xc0, 0xcc, - 0xd4, 0xa4, 0x00, 0x60, 0x5e, 0xc8, 0xd3, 0x2a }, - { 0x07, 0xbd, 0x95, 0x7c, 0xa5, 0xde, 0xc1, 0xc4, - 0xc4, 0xd8, 0xbb, 0x8d, 0x1f, 0x6c, 0xee, 0x55 } - }, - }; - - test_murmurhash3_algorithm("murmurhash3_128", murmurhash3_128, - MURMURHASH3_128_RESULTBYTES, - vectors, N_ELEMENTS(vectors)); -} - -void test_murmurhash3(void) -{ - test_murmurhash3_32(); - test_murmurhash3_128(); -}