Non-Cryptographic ハッシュ リファレンス
高速 non-cryptographic ハッシュ 関数: FNV, MurmurHash, xxHash, CityHash 用 ハッシュ テーブル および checksums.
Common Functions
Non-cryptographic hashes prioritize speed and good distribution over adversarial resistance. They are used in hash tables, bloom filters, and data partitioning where inputs are not malicious. FNV is extremely simple and fast on short inputs. MurmurHash and xxHash offer excellent throughput on large data with good avalanche properties. CityHash was designed for string keys in hash tables at Google.
- FNV-1a
- Multiply-XOR, 32/64-bit, very simple
- MurmurHash3
- Non-cryptographic, 32/128-bit, good distribution
- xxHash64
- Extremely fast, 64-bit, SIMD accelerated
- CityHash64
- Google string hashing, 64/128-bit
hash tables general purpose bulk hashing string keys Avalanche Criterion
A good non-cryptographic hash satisfies the avalanche criterion: flipping one input bit flips approximately half the output bits. This ensures small input changes spread across the output, minimizing hash table collisions. Strict avalanche criterion requires this for all input bits and all output bits. Functions that fail avalanche cause clustering in hash tables and degraded lookup performance.
Security Warning
Non-cryptographic hashes must never be used for authentication, signatures, or any adversarial context. MurmurHash is vulnerable to hash flooding attacks that craft many inputs with the same hash to degrade hash table performance to quadratic time. Hash tables in security-sensitive contexts should use a keyed hash like SipHash to prevent such attacks. The speed advantage of non-cryptographic hashes is irrelevant when facing an adversary.