From 4948d74e45994304e3dda764f6616c7f6988c493 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 24 Apr 2026 12:30:44 -0400 Subject: [PATCH] fix comments about hash mixer constant --- src/core/Hash_impl_.ml | 8 +++----- src/core/hash_stubs.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/core/Hash_impl_.ml b/src/core/Hash_impl_.ml index 1bc8d8d2..19ece7cb 100644 --- a/src/core/Hash_impl_.ml +++ b/src/core/Hash_impl_.ml @@ -2,13 +2,11 @@ (** Internal hash implementation. - Combiner: [state ^= chunk; state ^= state >> 32; state *= 0xd6e8feb86659fd93] + Combiner: [state ^= chunk; state ^= state >> 32; state *= 0xc6a4a7935bd1e995] Finalizer: fmix64 (Murmur3). - Multiplicative constant 0xd6e8feb86659fd93 (rrmxmx family, Pelle Evensen, 2018): - https://mostlymangling.blogspot.com/2018/07/on-mixing-functions-in-fast-hashing.html - Also evaluated in Chris Wellons' hash-prospector: - https://github.com/skeeto/hash-prospector + Multiplicative constant 0xc6a4a7935bd1e995 (MurmurHash2, Austin Appleby): + https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp fmix64 constants (Murmur3, Austin Appleby): https://github.com/aappleby/smhasher diff --git a/src/core/hash_stubs.c b/src/core/hash_stubs.c index c0d217a3..ca42181b 100644 --- a/src/core/hash_stubs.c +++ b/src/core/hash_stubs.c @@ -1,13 +1,11 @@ /* This file is free software, part of containers. See file "license" for more details. */ /* Hash implementation: xorshift+multiply combiner with fmix64 finalizer. - Combiner: state ^= chunk; state ^= state >> 32; state *= 0xd6e8feb86659fd93 + Combiner: state ^= chunk; state ^= state >> 32; state *= 0xc6a4a7935bd1e995 Finalizer (fmix64, Murmur3): three rounds of xorshift-multiply. - Multiplicative constant 0xd6e8feb86659fd93 (rrmxmx family, Pelle Evensen, 2018): - https://mostlymangling.blogspot.com/2018/07/on-mixing-functions-in-fast-hashing.html - Also evaluated in Chris Wellons' hash-prospector: - https://github.com/skeeto/hash-prospector + Multiplicative constant 0xc6a4a7935bd1e995 (MurmurHash2, Austin Appleby): + https://github.com/aappleby/smhasher/blob/master/src/MurmurHash2.cpp fmix64 constants 0xff51afd7ed558ccd / 0xc4ceb9fe1a85ec53 (Murmur3, Austin Appleby): https://github.com/aappleby/smhasher