}
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);
}
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
#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)