aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-17 16:11:12 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-17 16:11:12 +0100
commit940ac5134d8d0a296b30ef880223a29da91299eb (patch)
treeaabf106a909efb2cb26f8f1fa05a4404990df4dc /src
parent0f38bb097e151109c163f9b56db824f39788097e (diff)
downloadrspamd-940ac5134d8d0a296b30ef880223a29da91299eb.tar.gz
rspamd-940ac5134d8d0a296b30ef880223a29da91299eb.zip
Adopt xxhash invocation.
Diffstat (limited to 'src')
-rw-r--r--src/libutil/bloom.c2
-rw-r--r--src/libutil/fuzzy.c11
-rw-r--r--src/libutil/uthash_strcase.h7
3 files changed, 11 insertions, 9 deletions
diff --git a/src/libutil/bloom.c b/src/libutil/bloom.c
index 044cdaa10..c3e8b4c8e 100644
--- a/src/libutil/bloom.c
+++ b/src/libutil/bloom.c
@@ -116,7 +116,7 @@ rspamd_bloom_add (rspamd_bloom_filter_t * bloom, const gchar *s)
}
len = strlen (s);
for (n = 0; n < bloom->nfuncs; ++n) {
- v = XXH32 (s, len, bloom->seeds[n]) % bloom->asize;
+ v = XXH64 (s, len, bloom->seeds[n]) % bloom->asize;
INCBIT (bloom->a, v, t);
}
diff --git a/src/libutil/fuzzy.c b/src/libutil/fuzzy.c
index a15be12e2..218065b77 100644
--- a/src/libutil/fuzzy.c
+++ b/src/libutil/fuzzy.c
@@ -524,13 +524,14 @@ guint
rspamd_fuzzy_hash (gconstpointer key)
{
rspamd_fuzzy_t *fh = (rspamd_fuzzy_t *)key;
- void *st;
+ XXH64_state_t xxh;
- st = XXH32_init (0xdeadbeef);
- XXH32_update (st, &fh->block_size, sizeof (fh->block_size));
- XXH32_update (st, fh->hash_pipe, rspamd_fuzzy_len (fh));
+ XXH64_reset (&xxh, rspamd_hash_seed ());
- return XXH32_digest (st);
+ XXH64_update (&xxh, &fh->block_size, sizeof (fh->block_size));
+ XXH64_update (&xxh, fh->hash_pipe, rspamd_fuzzy_len (fh));
+
+ return XXH64_digest (&xxh);
}
gboolean
diff --git a/src/libutil/uthash_strcase.h b/src/libutil/uthash_strcase.h
index 4e28f3110..55fae4d7e 100644
--- a/src/libutil/uthash_strcase.h
+++ b/src/libutil/uthash_strcase.h
@@ -36,13 +36,14 @@
#define HASH_KEYCMP(a,b,len) memcmp(a,b,len)
#else
#define HASH_FUNCTION(key,keylen,num_bkts,hashv,bkt) do {\
- void *xxh = XXH32_init(0xdead); \
+ XXH32_state_t xxh; \
+ XXH32_reset(&xxh, 0xdead); \
unsigned char *p = (unsigned char *)key, t; \
for (unsigned int i = 0; i < keylen; i ++) { \
t = g_ascii_tolower(p[i]); \
- XXH32_update(xxh, &t, 1); \
+ XXH32_update(&xxh, &t, 1); \
} \
- hashv = XXH32_digest(xxh); \
+ hashv = XXH32_digest(&xxh); \
bkt = (hashv) & (num_bkts-1); \
} while (0)
#define HASH_KEYCMP(a,b,len) strncasecmp(a,b,len)