aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcryptobox')
-rw-r--r--src/libcryptobox/cryptobox.c13
-rw-r--r--src/libcryptobox/cryptobox.h3
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