hashlib: don't xorshift in between upper and lower word

This commit is contained in:
Emil J. Tywoniak 2024-10-30 10:48:09 +01:00
parent 0e6f631b5e
commit 8f160c5ef7
1 changed files with 2 additions and 1 deletions

View File

@ -99,17 +99,18 @@ class Hasher {
[[nodiscard]]
static uint32_t mkhash(uint32_t a, uint32_t b) {
uint32_t hash = ((a << 5) + a) ^ b;
hash = mkhash_xorshift(fudge ^ hash);
return hash;
}
public:
void hash32(uint32_t i) {
state = mkhash(i, state);
state = mkhash_xorshift(fudge ^ state);
return;
}
void hash64(uint64_t i) {
state = mkhash((uint32_t)(i % (1ULL << 32ULL)), state);
state = mkhash((uint32_t)(i >> 32ULL), state);
state = mkhash_xorshift(fudge ^ state);
return;
}
[[nodiscard]]