aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/cryptobox.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-11 14:59:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-05-11 14:59:29 +0100
commit63eb2e602070feb5536c08009e494cbab20ad921 (patch)
tree73e186d1e1ce4f7274efb6b15849bd1ab9e7b09a /src/libcryptobox/cryptobox.c
parent1cf6562bcc216a1182ab8e60c29253e2207c6cfa (diff)
downloadrspamd-63eb2e602070feb5536c08009e494cbab20ad921.tar.gz
rspamd-63eb2e602070feb5536c08009e494cbab20ad921.zip
[Feature] Add and use mumhash for non-crypto hashing
Diffstat (limited to 'src/libcryptobox/cryptobox.c')
-rw-r--r--src/libcryptobox/cryptobox.c13
1 files changed, 7 insertions, 6 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);
}
}