Quick Start
Non-Cryptographic Hashes
Fast hashes for hash tables, checksums, and data structures.Wyhash
Default hash function, extremely fast:- Speed: ~25 GB/s
- Output: 64-bit
- Collision resistance: Excellent
- Use for: Hash tables, general purpose
CityHash
Google’s CityHash family:- Speed: ~20 GB/s
- Output: 32-bit or 64-bit
- Use for: Hash tables, databases
xxHash
Extremely fast hash with excellent distribution:- Speed: xxHash3 ~30 GB/s, others ~15 GB/s
- Output: 32-bit or 64-bit
- Collision resistance: Excellent
- Use for: Checksums, hash tables, caching
Murmur Hash
Popular hash used in many databases:- Speed: ~5 GB/s
- Output: 32-bit or 64-bit
- Use for: Hash tables, Bloom filters
CRC32
Cyclic redundancy check, hardware accelerated:- Speed: ~10 GB/s (hardware accelerated)
- Output: 32-bit
- Use for: Data integrity, checksums
Adler-32
Simpler checksum algorithm:- Speed: ~15 GB/s
- Output: 32-bit
- Use for: Checksums (faster but less reliable than CRC32)
Input Types
All hash functions accept multiple input types:Strings
TypedArrays
ArrayBuffer
Blob
Cryptographic Hashes
For security-sensitive applications, use cryptographic hash functions:SHA-256
SHA-512
Other SHA Variants
MD4 and MD5
⚠️ Warning: MD4 and MD5 are cryptographically broken. Only use for legacy compatibility.Performance Comparison
Throughput Benchmark
Common Use Cases
Hash Table Keys
File Integrity
Content Addressing
Deduplication
Cache Keys
Password Hashing
⚠️ Warning: Use proper password hashing like bcrypt or Argon2. Never use fast hashes for passwords.Seeds and Determinism
All hash functions support seeds for deterministic results:Reproducible Builds
Hash Quality
Collision Resistance
Test hash distribution:Avalanche Effect
Small input changes should produce large hash changes:Best Practices
-
Choose the right hash for your use case
- Hash tables:
wyhash,xxHash3 - Checksums:
crc32,xxHash64 - Security:
SHA256,SHA512 - Legacy:
MD5(only if required)
- Hash tables:
-
Use seeds for reproducibility
-
Consider hash size
-
Benchmark for your data
Platform Differences
Hardware Acceleration
- x86_64: CRC32, SHA use CPU instructions
- ARM64: CRC32, SHA use NEON instructions
- Other: Software fallback