Saltar al contenido
uencoder

Non-Cryptographic Hash Referencia

Rápido non-cryptographic hash funciones: FNV, MurmurHash, xxHash, CityHash para hash tablas y 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
hash tables
MurmurHash3
Non-cryptographic, 32/128-bit, good distribution
general purpose
xxHash64
Extremely fast, 64-bit, SIMD accelerated
bulk hashing
CityHash64
Google string hashing, 64/128-bit
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.

Herramientas relacionadas

参考链接