wangyi-fudan/wyhash
FreeThe FASTEST QUALITY hash function, random number generators (PRNG) and hash map.
About wangyi-fudan/wyhash
wyhash is a non-cryptographic hash function and pseudorandom number generator (wyrand) known for its speed and quality. It has passed major statistical tests: SMHasher for hashing, and BigCrush and PractRand for PRNG. wyhash is portable across 64-bit and 32-bit systems and big/little endian architectures, efficient especially for short keys, and uses a dynamic secret to mitigate hash collision attacks. It has been adopted as the default hashing algorithm in programming languages including Zig, V, Nim, and Go (since 1.17), and is deployed by Microsoft in Windows Terminal. However, wyhash has known limitations: it is not 64-bit collision resistant (about 62 bits) and wyrand fails PractRand on very long datasets (32TB). Multiple language bindings exist for C#, C++, Go, Java, Rust, Swift, and more.
Key Features
Pros & Cons
- Passes stringent quality tests (SMHasher, BigCrush, PractRand)
- Highly portable across CPU architectures and endianness
- Very fast, especially for short keys
- Simple and easy to integrate with minimal code
- Salted to prevent hash flooding attacks
- Widely adopted by major languages and organizations
- Not 64-bit collision resistant (approximately 62-bit collision resistance)
- Wyrand fails PractRand on very long datasets (32TB)
- Intended for non-cryptographic use only; not suitable for security-critical hashing
- May have undiscovered flaws (authors acknowledge limitations)