From 84793e0fe51a1ddd9b3c1be69f50a8251ceb92b7 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 8 Dec 2016 13:41:45 +0000 Subject: [Feature] Use t1ha instead of metrohash and xxhash32 --- src/libcryptobox/cryptobox.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index e8bd962b7..3098cd966 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -34,7 +34,7 @@ #include "xxhash.h" #define MUM_TARGET_INDEPENDENT_HASH 1 /* For 32/64 bit equal hashes */ #include "../../contrib/mumhash/mum.h" -#include "../../contrib/metrohash/metro.h" +#include "../../contrib/t1ha/t1ha.h" #ifdef HAVE_CPUID_H #include #endif @@ -1498,27 +1498,18 @@ static inline guint64 rspamd_cryptobox_fast_hash_machdep (const void *data, gsize len, guint64 seed) { - if (len >= 8 && len % 8 == 0) { - return mum_hash (data, len, seed); - } - else { #if defined(__LP64__) || defined(_LP64) - return metrohash64_1 (data, len, seed); + return t1ha (data, len, seed); +#else + return t1ha32 (data, len, seed); #endif - } - - return XXH32 (data, len, seed); } static inline guint64 rspamd_cryptobox_fast_hash_indep (const void *data, gsize len, guint64 seed) { - if (len >= 8 && len % 8 == 0) { - return mum_hash (data, len, seed); - } - - return metrohash64_1 (data, len, seed); + return t1ha (data, len, seed); } guint64 -- cgit v1.2.3