diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-11 14:59:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-11 14:59:29 +0100 |
commit | 63eb2e602070feb5536c08009e494cbab20ad921 (patch) | |
tree | 73e186d1e1ce4f7274efb6b15849bd1ab9e7b09a /src/libcryptobox | |
parent | 1cf6562bcc216a1182ab8e60c29253e2207c6cfa (diff) | |
download | rspamd-63eb2e602070feb5536c08009e494cbab20ad921.tar.gz rspamd-63eb2e602070feb5536c08009e494cbab20ad921.zip |
[Feature] Add and use mumhash for non-crypto hashing
Diffstat (limited to 'src/libcryptobox')
-rw-r--r-- | src/libcryptobox/cryptobox.c | 13 | ||||
-rw-r--r-- | src/libcryptobox/cryptobox.h | 3 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c index 8fb0a7d56..0617f8c21 100644 --- a/src/libcryptobox/cryptobox.c +++ b/src/libcryptobox/cryptobox.c @@ -32,6 +32,8 @@ #include "ottery.h" #include "printf.h" #include "xxhash.h" +#define MUM_TARGET_INDEPENDENT_HASH 1 /* For 32/64 bit equal hashes */ +#include "../../contrib/mumhash/mum.h" #ifdef HAVE_CPUID_H #include <cpuid.h> @@ -1457,11 +1459,8 @@ guint64 rspamd_cryptobox_fast_hash (const void *data, gsize len, guint64 seed) { -#if defined(__LP64__) || defined(_LP64) - return XXH64 (data, len, seed); -#else - return XXH32 (data, len, seed); -#endif + return rspamd_cryptobox_fast_hash_specific (RSPAMD_CRYPTOBOX_MUMHASH, + data, len, seed); } @@ -1475,7 +1474,9 @@ rspamd_cryptobox_fast_hash_specific ( case RSPAMD_CRYPTOBOX_XXHASH32: return XXH32 (data, len, seed); case RSPAMD_CRYPTOBOX_XXHASH64: - default: return XXH64 (data, len, seed); + case RSPAMD_CRYPTOBOX_MUMHASH: + default: + return mum_hash (data, len, seed); } } diff --git a/src/libcryptobox/cryptobox.h b/src/libcryptobox/cryptobox.h index 9bab560ee..18e66df60 100644 --- a/src/libcryptobox/cryptobox.h +++ b/src/libcryptobox/cryptobox.h @@ -356,7 +356,8 @@ guint64 rspamd_cryptobox_fast_hash (const void *data, enum rspamd_cryptobox_fast_hash_type { RSPAMD_CRYPTOBOX_XXHASH64 = 0, - RSPAMD_CRYPTOBOX_XXHASH32 + RSPAMD_CRYPTOBOX_XXHASH32, + RSPAMD_CRYPTOBOX_MUMHASH }; /** * Platform independent version |