ihash
A cross-platform non-cryptographic hash library built on the AES round function, with extendable output and addressable stream-cipher support.
Benchmarked on 4 x86_64 and aarch64 hosts, full-length slice and HashMap combined throughput both rank first among 16 tested algorithms, and all 32 / 64 / 128 / 256-bit variants pass all 20 statistical quality test suites of smhasher3 with zero failures (non-cryptographic use; no cryptographic collision-resistance guarantee is provided).
General-purpose non-cryptographic hashing commonly faces three categories of engineering trade-offs:
- Implementations that only pursue hash-table speed do not guarantee cross-architecture result consistency.
- Vector algorithms relying on in-page out-of-bounds reads are prone to triggering memory boundary-check warnings.
- Implementations targeting hardware instruction sets only cannot compile under WebAssembly or in environments without AES extensions.
ihash provides 32/64/128/256-bit prefix-consistent digests, arbitrary-length streaming key streams, and an 8-byte hash-table state, with boundary-safe reads at all lengths.
Outputs are bit-identical across x86_64, x86, aarch64, the built-in scalar T-table fallback (soft.rs), and pure CPU software vector (fearless_simd); supports #![no_std] and C ABI export.
- Performance Benchmark
- Usage
- Interface
- Feature Flags
- Extendable Output and Addressable Stream
- Selection Comparison
- Hash Quality
- Design Principles
- Performance Benchmark Details
Performance Benchmark
The following summarizes cross-platform geometric-mean performance across 4 benchmarked hosts (Apple M2 Max, Intel Xeon Platinum 8269CY, AMD EPYC, ARM Neoverse-N1); see smhasher3 for the full 16-algorithm ranking and failure list.
Per-platform tier details and charts are available in Performance Benchmark Details at the end of the document.
Comparison libraries include gxhash (v4, gxhash4), lanehash (AES variant lh_aes and pure-arithmetic variant lanehash64), foldhash (foldhash_fast and foldhash_quality), rapidhash, xxhash-rust (xxh3), ahash, rustc-hash (fxhash), and the standard library std.
Cross-host geometric-mean throughput for slice scenarios (unit: GiB/s, higher is faster):
| Algorithm | Short slice 4..=128 B | Long slice 256 B..=256 KiB | Random short slice | Geometric mean |
|---|---|---|---|---|
| ihash | 7.44 | 45.99 | 4.96 | 19.84 |
| gxhash4 | 6.35 | 42.78 | 4.29 | 17.74 |
| foldhash_fast | 5.92 | 15.91 | 3.87 | 10.07 |
| lh_aes | 2.36 | 31.48 | 2.05 | 9.53 |
| lanehash64 | 3.08 | 23.33 | 2.29 | 9.17 |
| xxh3 | 4.23 | 15.29 | 2.53 | 8.45 |
| ahash | 4.14 | 8.39 | 3.15 | 6.06 |
HashMap multi-key-type cross-host geometric-mean throughput (10,000 keys, including 32..=59 B URLs, unit Mop/s, higher is faster):
| Hasher | u64 R/W | Short string R/W | URL R/W | Total geometric mean |
|---|---|---|---|---|
| ihash | 129.3 | 28.1 | 16.3 | 38.9 |
| foldhash_fast | 136.5 | 24.8 | 14.4 | 36.5 |
| fxhash | 138.6 | 23.8 | 14.6 | 36.4 |
| foldhash_quality | 116.2 | 23.8 | 14.5 | 34.2 |
| rapidhash | 115.8 | 22.4 | 13.4 | 32.6 |
| ahash | 117.5 | 21.7 | 13.4 | 32.5 |
| gxhash4 | 109.7 | 22.3 | 13.5 | 32.1 |
| std | 58.8 | 18.4 | 11.0 | 22.9 |
Quality and scenario notes:
gxhash4fails 4SMHasher3test suites (Zeroes,SeedZeroes,SeedBlockLen,SeedBlockOffset).fxhashandfoldhash_fastomit or simplify the avalanche finalization to accelerate short-key reads/writes and failSMHasher3tests; see smhasher3 for the complete failure details.- All 32 / 64 / 128 / 256-bit variants of
ihashpass all 20 test suites with zero failures; see Hash Quality for details.
Usage
Full example code: examples/basic.rs, run command:
use Hasher;
use cpu;
use ;
Build Configuration
It is recommended to enable hardware AES and base SIMD features in .cargo/config.toml at the project or workspace root:
[]
= ["-C", "target-feature=+aes,+sse2"]
[]
= ["-C", "target-feature=+aes,+neon"]
Why is it necessary to enable?
- Rust compiles to the lowest common instruction baseline by default; without
+aes, hardware AES must be dispatched through a runtime function-pointer table, and the compiler cannot inline it intoHashMapprobe loops or<= 128 Bshort-key call sites. - Once enabled,
0..=128 Binputs can be directly inlined as native AES instructions across crate boundaries; withstdenabled,x86_64automatically upgrades> 128 Binputs at runtime toAVX + AES,AVX2 + VAES, orAVX-512F + VAES. - Hardware availability:
x86_64from Intel Westmere (2010), AMD Bulldozer (2011) and later, as well as mainstream server and desktop/mobileaarch64processors, all ship with native hardware AES. - Environments without hardware AES: omitting
rustflagsautomatically falls back to the built-in scalar T-table;RISC-VandWebAssemblyrequire no extra configuration. For pure CPU software-vector acceleration, enable thecpufeature and callihash::cpu.
Interface
Seedless Default Interface
hash32(data: &[u8]) -> u32hash64(data: &[u8]) -> u64hash128(data: &[u8]) -> u128hash256(data: &[u8]) -> [u8; 32]hash_xof(data: &[u8], out: &mut [u8])Stream:Stream::new(data),Stream::from_root(root),root(),position(),seek(pos),fill(out),xor_keystream(buf); implementsstd::io::Readwhenstdis enabledIHasher:new(),finish_u128(), implementscore::hash::HasherIBuildHasher:new(),default()(per-thread random independent seed understd; seed0fallback underno_std)HashMap<K, V>,HashSet<T>,HashMapExt,HashSetExt(available whenstdis enabled; supportnew()andwith_capacity(cap))
Explicit Seed Module
When a fixed u64 seed is supplied, call the corresponding functions under ihash::seed:
seed::hash32(data, seed),seed::hash64(data, seed),seed::hash128(data, seed),seed::hash256(data, seed)seed::hash_xof(data, seed, out)seed::stream(data, seed),seed::keystream(seed)(derived fromhash256(&[], seed))seed::hasher(seed),seed::build_hasher(seed),seed::hash_map(seed),seed::hash_set(seed)(the latter two requirestd)
Pure Software Fallback and C Interface
ihash::cpu(requires thecpufeature): mirrors all root-module functions,Stream,IHasher,IBuildHasher,HashMap/HashSet(requiresstd; shares root-moduleHashMapExt/HashSetExt), and thecpu::seedsubmodule. Provides*_with_level,with_level, andfrom_root_with_levelentry points that accept a specifiedfearless_simd::Levelfor free functions,Stream,IHasher,IBuildHasher, and seeded collection constructors.ihash::c(requires thecfeature): exports C ABI symbols consistent with the header fileinclude/ihash.h(ihash_hash32,ihash_hash64,ihash_hash128,ihash_hash128_out,ihash_hash256,ihash_hash_xof,ihash_xor_stream, and corresponding*_seedentry points). Build a static library withcargo rustc -p ihash --release --features c --crate-type staticlib.
Feature Flags
std(enabled by default): enablesHashMap/HashSet, runtime instruction-set dispatch,std::io::Read, and per-thread random hash-table seeds. When disabled, the crate operates in a#![no_std]environment.cpu: Enables theihash::cpupure-software AES + SIMD fallback implementation.c: Exports the stable C ABI symbols fromihash::c.
Extendable Output and Addressable Stream
Prefix Consistency and Random Access
Traditional hashes return fixed-length integers; obtaining more pseudorandom bytes typically requires re-hashing with a salt. ihash extends the output to an arbitrary-length byte stream:
- Bit-exact prefixes: the first 4, 8, 16, and 32 bytes of
hash32,hash64,hash128, andhash256are bit-identical to the corresponding prefixes ofhash_xofandStreamoutput. Multiple bit-width digests of the same input can be extracted in one pass without re-hashing. - Constant-time seeking:
Stream::seek(pos)computes the keystream at any byte offset or performs in-place XOR decryption directly by block number, without sequentially generating preceding bytes.
Use Cases
- Deriving multiple parameter sets from a single digest: compute
hash256once or read fromhash_xof, then split out multiple index sets, weight tables, or initialization vectors for Bloom filters. - Sharded stream obfuscation and concurrent reads: multiple threads share the same 256-bit root,
seekto their respective offsets, and executexor_keystreamin parallel. - Deterministic stress testing and corpus generation: stream GB-scale reproducible pseudorandom payloads via
Stream, eliminating the need to pre-allocate entire memory blocks.
Stream targets high-speed non-cryptographic stream obfuscation; use a standard cryptographic suite when cryptographic confidentiality and attack resistance are required.
Selection Comparison
Beyond throughput, selection should also evaluate output bit-width, cross-platform consistency, memory-safety bounds, and struct size.
Output Bit Width and Streaming Extension
| Algorithm | Output bit width | Extended output | Output stream random access |
|---|---|---|---|
| ihash | 32 / 64 / 128 / 256 | Supported | Supported |
| gxhash | 32 / 64 / 128 | Not supported | Not supported |
| lanehash | 64 / 128 | Not supported | Not supported |
| xxh3 | 64 / 128 | Not supported | Not supported |
| foldhash | 64 | Not supported | Not supported |
| ahash | 64 | Not supported | Not supported |
| fxhash | 32 / 64 | Not supported | Not supported |
32 / 64-bit widths suit in-memory hash tables and shard modulo; use 128 / 256-bit for persistent content addressing, content chunk deduplication, or billion-scale object caches.
ihash prunes upper-half rounds via compile-time const generics, incurring zero extra round overhead for short-digest calls.
Cross-Platform Consistency and Runtime Environment
| Algorithm | Cross-platform consistency | Hardware AES absence fallback | #![no_std] |
|---|---|---|---|
| ihash | Hardware / software / scalar | Supported | Supported |
| gxhash | Consistent within the same major hardware version | Compile failure | Supported |
| lanehash | Cross-platform consistent | Supported | Supported |
| xxh3 | Cross-platform consistent | Supported | Supported |
| foldhash | Not guaranteed | Supported | Supported |
| ahash | Not guaranteed | Supported | Supported |
| fxhash | Not guaranteed | Supported | Supported |
foldhash, ahash, and fxhash target single-process in-memory hash tables and do not guarantee cross-architecture digest equality; persistent index verification and cross-end cache sharding require cross-platform bit-exact consistency.
Zero Out-of-Bounds Reads and Memory Safety Boundaries
| Algorithm | Zero out-of-bounds reads | Short-input tail handling |
|---|---|---|
| ihash | Supported | Exact boundary load |
| gxhash | Not supported | In-page out-of-bounds reads |
| lanehash | Supported | Segmented exact reads |
| xxh3 | Supported | Segmented exact reads |
| foldhash | Supported | Segmented exact reads |
| ahash | Supported | Segmented exact reads |
| fxhash | Supported | Segmented exact reads |
Some SIMD algorithms perform full-block out-of-bounds reads followed by masking even when input is under 16 bytes, easily triggering AddressSanitizer, Valgrind, Miri, or ARM MTE checker warnings.
ihash reads only within slice boundaries at all lengths: 0..=16 B uses exact byte-level assembly; 17..=128 B uses overlapping head/tail reads combined with multi-lane mixing to eliminate correlations (see Tiered Absorption).
State Size and Hash Table Overhead
The following shows struct sizes for streaming hashers and table-seed state of each library on 64-bit targets (unit: bytes; ahash streaming state is 32 bytes under soft fallback, 48 bytes with x86_64 hardware AES; xxh3 with a custom seed/key raises the constructor and streaming state to 216 and 576 bytes respectively):
| Algorithm | Streaming state size | Table seed state size |
|---|---|---|
| ihash | 8 | 8 |
| gxhash | 16 | 16 |
| lanehash | 48 | 24 |
| xxh3 | 384 | 0 |
| foldhash | 48 | 8 |
| ahash | 32 | 32 |
| fxhash | 8 | 0 |
| std | 72 | 16 |
Both IBuildHasher and IHasher occupy only 8 bytes, reducing metadata memory footprint when maintaining large numbers of small tables, and the hot path can reside in a single 64-bit general-purpose register.
Hash Quality
Against the full 20-suite quality battery of pure-Rust smhasher3, all 4 output bit widths pass with zero failures (covering Sanity, Avalanche, BIC, Sparse with 512-bit 22,370,049 sparse keys, Permutation, Cyclic, TwoBytes, PerlinNoise, Bitflip, Seed*, and BadSeeds):
| Algorithm | Bit width | Suites passed | Sub-items passed | Failures |
|---|---|---|---|---|
| ihash32 | 32 | 20 / 20 | 188 / 188 | 0 |
| ihash64 | 64 | 20 / 20 | 189 / 189 | 0 |
| ihash128 | 128 | 20 / 20 | 189 / 189 | 0 |
| ihash256 | 256 | 20 / 20 | 187 / 187 | 0 |
Design Principles
ihash combines gxhash's single-instruction AES round-function diffusion, lanehash's multi-lane parallel striding, and foldhash's single-register state folding, ensuring every 16 bytes of input undergo at least one full AES state transformation.
At compile time, all round constants and 16-lane initial keys are generated from a fixed master seed via SplitMix64 and packed into a 64-byte-aligned read-only constant table TBL; for the seedless fast path, TBL pre-expands sv0 = F(fin_li[6]) and pre-XORed keys lane_sv0_li[i] = lane_li[i] ^ sv0, eliminating per-call seed expansion.
In what follows, F(x) = MixColumns(ShiftRows(SubBytes(x))) denotes a full unkeyed AES round, FL(x) = ShiftRows(SubBytes(x)) denotes the final AES round without MixColumns, + denotes wrapping vector addition across two 64-bit lanes (u64x2::wrapping_add), and the four-lane broadcast length key is denoted lk = [len32; 4] (for > 2048 B, the high 32 bits are folded into (len as u32) ^ ((len >> 32) as u32)).
Tiered Absorption
| Length tier | Parallel lanes | Absorption & mixing structure |
|---|---|---|
0..=16 B |
1 | 16 B full-block load; 8..=15 B dual 8B head/tail; 4..=7 B dual 4B head/tail; 1..=3 B sample [0, len >> 1, len - 1]; 0 B zero vector; with seed: expand sv = F([seed, seed] ^ c), compute u = F(F(b ^ sv) ^ lk), feedforward output lo = F(u) + u |
17..=32 B |
2 | Two-lane parallel absorption of 16B head/tail yields a = F(b0 ^ k0) and c = F(b1 ^ k1); lane 0 mixes in lk through one round of F before merging with lane 1: u = F(F(a ^ lk) ^ c), feedforward output lo = F(u) + u |
33..=64 B |
4 | Four-lane parallel absorption of 32B head/tail ([ptr, ptr+16, end-32, end-16]) yields l_i = F(b_i ^ key_i), entering the 4-lane asymmetric finalizer |
65..=128 B |
4 | First round: four-lane absorption of the leading 64B head[0..4]; second round: lane i absorbs one round of F using symmetric slots tail[i ^ 2] + head[i ^ 2] (tail = end - 64), eliminating sparse-key and overlapping-byte differential cancellation with zero extra AES rounds |
129..=512 B |
4 | 129..=192 B uses a 3-stripe fast path; remaining lengths absorb in 64B stripes alternating forward order and half-width slot swap i ^ 2, with tail handling at end - 128 and end - 64 before merging |
513..=2048 B |
8 | 128B stride with 64B alternating half-group absorption; tail at end - 128 performs 32B slot swap i ^ 2; merges to 4 lanes via p_i = F(A_i) ^ A_{i+4} (A_i is the post-absorption state of each lane) |
> 2048 B |
16 | 256B stripes alternating cross-group (lo/hi half-group swap) and forward-order absorption, always reading in ascending address order; x86 / x86_64 prefetch L1 cache 768–1152 B ahead for > 32 KiB; tail at end - 256 performs group-swap absorption then two-level folding (m_i = F(A_i) ^ A_{i+8}, then p_i = F(m_i) ^ m_{i+4}) to 4 lanes |
Asymmetric Finalization and High-Half Derivation
The 4-lane state [l0, l1, l2, l3] enters the asymmetric finalizer to eliminate isomorphic-column linear cancellation and truncation distinguishers:
- Lane 0 executes the no-MixColumns final round and XORs with lane 2:
q0 = FL(l0 ^ lk) ^ l2(aarch64uses a singleaeseto skipaesmc;x86uses a singleaesenclast). - Lane 1 passes through one round of
F, performs 64-bit vector addition with lane 3, then byte-interleaves the high and low halves:q1 = zip_u8(F(l1) + l3), breaking column alignment and XOR cancellation. - Merges the two branches through an arithmetic Davies-Meyer feedforward to output the low 128 bits:
s = F(q0) ^ q1,u = F(s),lo = F(u) + u.
The 256-bit high half hi is enabled on demand via the compile-time const generic const HI: bool (zero compile-time overhead pruning for hash32 / hash64 / hash128). It is derived from lo, mixed state mix (q1 for 4-lane finalization, sv for 0..=16 B, lane-1 output c for 17..=32 B), length key lk, and finalization constants through 3 chained AES rounds: hi = F(F(F(lo ^ (mix ^ c1)) ^ lk) ^ c2).
Extended Output and Stream Cipher
hash_xof and Stream use the 32 bytes of hash256 output as the root node root:
- Offsets
0..32directly copy or XOR the correspondingrootslice, guaranteeing bit-exact prefix consistency withhash32/hash64/hash128/hash256. - From byte 32 onward, a 4-round simplified AES-CTR runs in 16-byte blocks: block number
blk = (pos - 32) / 16constructs the counter(blk, blk.wrapping_mul(M_CTR)); four round keys are derived fromrootand stream constants:rk0 = root[0..16],rk1 = root[16..32],rk2 = rk0 ^ STREAM_KEY_LI,rk3 = rk1 ^ STREAM_FIN_LI; after 3 rounds ofFand 1 round ofFL, the output is finalized with XORrk0. - The hardware path computes in parallel with 8-lane 128-bit (NEON / AES-NI) or 4-lane wide vectors (
VAES256processes 8 blocks at a time,VAES512processes 16), directly supporting arbitrary offset jumps.
Hardware Adaptation and Software Fallback
- Dual-semantic AES fusion: at compile time,
AesModedistinguishesPreXor(aarch64nativeaese + aesmcmacro fusion and scalar T-table) fromPostXor(x86/x86_64nativeaesenc/aesenclast) XOR fusion ordering; the hot loop introduces no extra XOR instructions. - Static inlining and runtime dispatch: under
std, dispatches as needed toAVX-512F + VAES,AVX2 + VAES,AVX + AES,SSE2 + AES,ARMv8 AES + NEON, or scalar T-table; onx86/x86_64with+aes,+sse2enabled at compile time,0..=128 Bis inlined directly while> 128 Bstill auto-upgrades to wider backends via runtime probing. - Pure software vector (ihash::cpu):
<= 128 Buses a 64-byte-aligned 4×1 KiB scalar T-table (soft.rs);> 128 Band>= 64 Bstreaming output use fearless_simd zero-platform conditional-compile dispatch—wide-byte lookup backends (NEONTBL4, AVX-512, WASM) use 64B-chunked full S-box tables, AVX2 / SSE4.2 useGF((2^4)^2)composite-domain tower lookup; when hardware byte shuffling is unavailable, automatically falls back to scalar T-table with bit-exact results.
Hash Table State and Seed Isolation
IHasher compresses streaming state into a single 8-byte u64: fixed-length integers and 0..=64 B slice writes take a 64×64→128-bit folding-multiplication fast path; > 64 B slice writes fall back to the main AES 64-bit path (the 128-bit output finish_u128 performs one more folding multiplication on state to produce the high 64 bits).
With std enabled, IBuildHasher::default() performs lock-free golden-ratio stepping from a thread-local RandomState-initialized seed slot and derives per-table independent seeds via folding, defending against cross-key / cross-table hash flooding while maintaining the 8-byte state footprint (see adversarial.rs for the contrast test).
Performance Benchmark Details
The following lists throughput line charts, short/long slice comparisons, HashMap throughput, multi-bit-width averages, and cross-platform consistency for each of the 4 measured hosts.
The complete 16-algorithm ranking, all 13-tier details, and per-algorithm failure lists are included in smhasher3.
Apple M2 Max
macOS, aarch64, 12 cores, compiled with +neon,+aes,+sha2 enabled; measured to support ARMv8 AES + NEON.
Short-slice throughput (4..=128 B, in GiB/s):
| Algorithm | 4 B | 8 B | 16 B | 32 B | 64 B | 128 B | Random short slice | Short-key avg |
|---|---|---|---|---|---|---|---|---|
| ihash | 3.43 | 6.93 | 15.80 | 25.38 | 35.27 | 49.71 | 13.72 | 15.99 |
| gxhash4 | 3.29 | 6.75 | 14.48 | 20.02 | 32.17 | 44.51 | 8.40 | 14.48 |
| lh_aes | 1.07 | 2.12 | 4.49 | 8.41 | 9.95 | 24.64 | 4.51 | 5.26 |
| lanehash64 | 1.77 | 3.34 | 7.13 | 12.09 | 16.67 | 14.56 | 5.15 | 7.06 |
| foldhash_fast | 4.02 | 9.53 | 20.27 | 13.92 | 22.45 | 31.37 | 8.21 | 14.03 |
| xxh3 | 2.48 | 4.81 | 9.50 | 12.47 | 15.25 | 16.83 | 5.25 | 8.45 |
| ahash | 2.92 | 5.95 | 11.77 | 16.30 | 19.05 | 20.97 | 7.16 | 10.49 |
Long-slice throughput (256 B..=256 KiB, in GiB/s):
| Algorithm | 256 B | 512 B | 1 KiB | 4 KiB | 16 KiB | 64 KiB | 256 KiB | Long-key avg | Full-length avg |
|---|---|---|---|---|---|---|---|---|---|
| ihash | 57.64 | 76.17 | 87.51 | 102.41 | 120.01 | 127.63 | 78.46 | 89.85 | 40.50 |
| gxhash4 | 63.52 | 77.72 | 91.41 | 107.46 | 122.35 | 124.06 | 79.09 | 92.56 | 39.32 |
| lh_aes | 39.23 | 39.06 | 55.41 | 71.64 | 82.51 | 87.27 | 79.61 | 61.91 | 19.83 |
| lanehash64 | 18.91 | 20.47 | 25.29 | 41.21 | 49.10 | 51.09 | 50.02 | 33.82 | 16.42 |
| foldhash_fast | 32.79 | 35.87 | 39.16 | 41.46 | 41.48 | 42.37 | 38.98 | 38.74 | 24.24 |
| xxh3 | 25.84 | 29.96 | 34.16 | 36.05 | 34.09 | 34.44 | 32.82 | 32.31 | 17.39 |
| ahash | 20.53 | 20.27 | 17.66 | 17.27 | 16.36 | 16.38 | 15.51 | 17.62 | 13.87 |
HashMap multi-key-type read/write throughput (in Mop/s):
| Hasher | u64 write | u64 read | Short string write | Short string read | URL write | URL read | Geometric mean |
|---|---|---|---|---|---|---|---|
| ihash | 248.7 | 468.8 | 56.1 | 153.9 | 44.1 | 114.4 | 131.1 |
| gxhash4 | 226.4 | 468.7 | 42.0 | 145.8 | 34.9 | 123.4 | 118.7 |
| foldhash_fast | 267.3 | 525.2 | 53.4 | 170.7 | 46.9 | 116.4 | 138.3 |
| foldhash_quality | 239.3 | 441.2 | 48.9 | 156.3 | 41.8 | 118.2 | 125.9 |
| rapidhash | 258.1 | 442.0 | 47.3 | 147.1 | 46.9 | 101.9 | 124.9 |
| ahash | 260.6 | 459.8 | 48.4 | 134.4 | 48.3 | 95.8 | 123.8 |
| fxhash | 261.2 | 606.1 | 50.5 | 158.3 | 42.6 | 115.9 | 135.7 |
| std | 118.0 | 145.2 | 53.0 | 81.5 | 29.8 | 47.2 | 68.6 |
Multi-width, extended output, and pure-software fallback geometric means (in GiB/s):
| hash32 | hash64 | hash128 | hash256 | hash_xof | Stream | cpu fallback | lanehash64 |
|---|---|---|---|---|---|---|---|
| 67.45 | 65.92 | 65.76 | 66.99 | 20.11 | 21.93 | 2.84 | 15.27 |
Intel Xeon Platinum 8269CY
Linux, x86_64, 4 cores, compiled with +sse2,+aes enabled; measured to support AVX-512F + AVX2 + AES-NI.
Short-slice throughput (4..=128 B, in GiB/s):
| Algorithm | 4 B | 8 B | 16 B | 32 B | 64 B | 128 B | Random short slice | Short-key avg |
|---|---|---|---|---|---|---|---|---|
| ihash | 1.23 | 2.65 | 5.57 | 8.59 | 13.24 | 19.14 | 3.58 | 5.83 |
| gxhash4 | 1.16 | 2.23 | 5.15 | 7.97 | 12.80 | 14.82 | 3.40 | 5.22 |
| lh_aes | 0.43 | 0.85 | 1.65 | 3.19 | 4.39 | 11.30 | 1.79 | 2.14 |
| lanehash64 | 0.59 | 1.18 | 2.13 | 4.79 | 6.53 | 6.24 | 1.84 | 2.57 |
| foldhash_fast | 1.53 | 3.53 | 6.35 | 4.82 | 7.32 | 12.00 | 3.52 | 4.94 |
| xxh3 | 0.86 | 1.64 | 3.33 | 6.02 | 8.36 | 10.20 | 2.33 | 3.66 |
| ahash | 0.75 | 2.19 | 3.75 | 7.63 | 6.95 | 5.04 | 2.42 | 3.44 |
Long-slice throughput (256 B..=256 KiB, in GiB/s):
| Algorithm | 256 B | 512 B | 1 KiB | 4 KiB | 16 KiB | 64 KiB | 256 KiB | Long-key avg | Full-length avg |
|---|---|---|---|---|---|---|---|---|---|
| ihash | 20.55 | 30.25 | 32.54 | 34.82 | 36.65 | 37.74 | 39.44 | 32.52 | 14.71 |
| gxhash4 | 21.56 | 29.55 | 30.38 | 33.83 | 34.89 | 34.97 | 39.07 | 31.57 | 13.76 |
| lh_aes | 15.31 | 18.07 | 24.88 | 30.49 | 33.19 | 36.40 | 38.52 | 26.74 | 8.33 |
| lanehash64 | 8.37 | 17.08 | 29.20 | 54.25 | 57.55 | 56.68 | 59.72 | 33.16 | 10.19 |
| foldhash_fast | 11.78 | 14.04 | 17.62 | 19.16 | 16.80 | 16.86 | 17.29 | 16.04 | 9.31 |
| xxh3 | 9.27 | 11.64 | 13.76 | 14.38 | 13.07 | 14.07 | 13.92 | 12.74 | 7.17 |
| ahash | 5.99 | 6.55 | 6.88 | 7.04 | 6.81 | 6.89 | 7.25 | 6.76 | 4.95 |
HashMap multi-key-type read/write throughput (in Mop/s):
| Hasher | u64 write | u64 read | Short string write | Short string read | URL write | URL read | Geometric mean |
|---|---|---|---|---|---|---|---|
| ihash | 51.0 | 172.7 | 14.1 | 35.0 | 12.3 | 11.2 | 29.0 |
| gxhash4 | 43.4 | 126.2 | 12.6 | 31.5 | 10.4 | 9.6 | 24.6 |
| foldhash_fast | 51.1 | 174.3 | 13.9 | 34.2 | 12.5 | 11.4 | 29.0 |
| foldhash_quality | 48.5 | 149.1 | 13.5 | 31.7 | 11.7 | 10.8 | 27.0 |
| rapidhash | 48.8 | 149.3 | 13.4 | 31.1 | 11.1 | 10.5 | 26.6 |
| ahash | 48.5 | 149.3 | 13.2 | 30.3 | 10.4 | 9.7 | 25.8 |
| fxhash | 53.3 | 193.2 | 14.0 | 32.9 | 12.1 | 10.9 | 29.3 |
| std | 33.2 | 59.6 | 12.0 | 21.2 | 9.9 | 10.1 | 19.2 |
Multi-width, extended output, and pure-software fallback geometric means (in GiB/s):
| hash32 | hash64 | hash128 | hash256 | hash_xof | Stream | cpu fallback | lanehash64 |
|---|---|---|---|---|---|---|---|
| 24.29 | 25.02 | 25.18 | 23.20 | 6.69 | 9.21 | 1.38 | 10.67 |
AMD EPYC
Linux, x86_64, 8 cores, compiled with +sse2,+aes enabled; measured to support AVX2 + AES-NI.
Short-slice throughput (4..=128 B, in GiB/s):
| Algorithm | 4 B | 8 B | 16 B | 32 B | 64 B | 128 B | Random short slice | Short-key avg |
|---|---|---|---|---|---|---|---|---|
| ihash | 0.78 | 2.90 | 4.80 | 7.65 | 12.20 | 18.92 | 3.67 | 5.17 |
| gxhash4 | 0.78 | 0.77 | 4.53 | 5.86 | 7.63 | 15.36 | 3.70 | 3.51 |
| lh_aes | 0.30 | 0.59 | 1.59 | 2.80 | 2.62 | 9.65 | 1.42 | 1.64 |
| lanehash64 | 0.44 | 1.03 | 2.33 | 3.34 | 2.83 | 6.24 | 1.62 | 1.99 |
| foldhash_fast | 0.94 | 4.06 | 7.86 | 3.94 | 7.72 | 13.06 | 2.78 | 4.78 |
| xxh3 | 0.83 | 0.91 | 3.89 | 5.69 | 8.32 | 10.28 | 1.67 | 3.35 |
| ahash | 1.09 | 1.30 | 3.89 | 8.16 | 7.08 | 5.07 | 2.37 | 3.43 |
Long-slice throughput (256 B..=256 KiB, in GiB/s):
| Algorithm | 256 B | 512 B | 1 KiB | 4 KiB | 16 KiB | 64 KiB | 256 KiB | Long-key avg | Full-length avg |
|---|---|---|---|---|---|---|---|---|---|
| ihash | 24.84 | 30.82 | 46.93 | 42.27 | 61.13 | 62.40 | 45.97 | 42.88 | 16.15 |
| gxhash4 | 22.31 | 28.79 | 37.85 | 29.38 | 38.41 | 36.62 | 38.80 | 32.58 | 11.66 |
| lh_aes | 14.95 | 18.02 | 27.32 | 28.43 | 33.05 | 28.71 | 36.87 | 25.66 | 7.22 |
| lanehash64 | 9.47 | 7.78 | 17.63 | 30.58 | 40.08 | 42.60 | 39.58 | 22.23 | 7.30 |
| foldhash_fast | 14.41 | 13.11 | 17.67 | 17.43 | 20.22 | 18.02 | 17.94 | 16.82 | 9.41 |
| xxh3 | 7.44 | 9.41 | 7.83 | 11.68 | 12.99 | 11.72 | 13.76 | 10.43 | 6.18 |
| ahash | 6.49 | 6.36 | 6.24 | 7.10 | 7.33 | 7.47 | 7.61 | 6.92 | 5.00 |
HashMap multi-key-type read/write throughput (in Mop/s):
| Hasher | u64 Write | u64 Lookup | Short String Write | Short String Lookup | URL Write | URL Lookup | Geometric Mean |
|---|---|---|---|---|---|---|---|
| ihash | 60.7 | 140.6 | 18.0 | 30.3 | 14.5 | 11.9 | 30.5 |
| gxhash4 | 51.5 | 117.8 | 15.1 | 23.2 | 11.5 | 11.2 | 25.5 |
| foldhash_fast | 66.7 | 169.3 | 17.3 | 29.7 | 12.1 | 10.4 | 30.0 |
| foldhash_quality | 58.5 | 130.7 | 15.6 | 26.7 | 12.4 | 11.1 | 27.5 |
| rapidhash | 56.1 | 120.1 | 14.4 | 24.3 | 10.1 | 10.0 | 24.9 |
| ahash | 58.0 | 126.4 | 14.2 | 23.0 | 10.3 | 9.9 | 25.0 |
| fxhash | 54.5 | 151.0 | 15.1 | 26.6 | 11.8 | 11.0 | 27.5 |
| std | 30.8 | 49.6 | 12.8 | 18.1 | 9.9 | 8.7 | 17.7 |
Multi-width, extended output, and pure-software fallback geometric means (in GiB/s):
| hash32 | hash64 | hash128 | hash256 | hash_xof | Stream | cpu fallback | lanehash64 |
|---|---|---|---|---|---|---|---|
| 28.55 | 29.39 | 28.94 | 27.67 | 6.95 | 8.42 | 1.33 | 8.08 |
ARM Neoverse-N1
Linux, aarch64, 6 cores, compiled with +neon,+aes, verified support for ARMv8 AES + NEON.
Short-slice throughput (4..=128 B, in GiB/s):
| Algorithm | 4 B | 8 B | 16 B | 32 B | 64 B | 128 B | Random Short Slice | Short Key Average |
|---|---|---|---|---|---|---|---|---|
| ihash | 1.26 | 2.99 | 6.96 | 11.04 | 13.87 | 16.64 | 3.37 | 6.37 |
| gxhash4 | 1.50 | 2.97 | 6.80 | 10.19 | 11.77 | 14.41 | 3.21 | 6.11 |
| lh_aes | 0.37 | 0.77 | 1.56 | 1.78 | 3.28 | 9.04 | 1.55 | 1.69 |
| lanehash64 | 0.68 | 1.34 | 2.71 | 4.19 | 5.02 | 4.67 | 1.78 | 2.49 |
| foldhash_fast | 1.58 | 3.11 | 6.31 | 3.14 | 4.20 | 6.30 | 2.78 | 3.70 |
| xxh3 | 0.99 | 1.98 | 3.48 | 4.39 | 5.17 | 5.70 | 2.00 | 3.10 |
| ahash | 0.63 | 1.30 | 2.59 | 3.67 | 4.65 | 5.06 | 2.40 | 2.38 |
Long-slice throughput (256 B..=256 KiB, in GiB/s):
| Algorithm | 256 B | 512 B | 1 KiB | 4 KiB | 16 KiB | 64 KiB | 256 KiB | Long Key Average | Full-Range Average |
|---|---|---|---|---|---|---|---|---|---|
| ihash | 23.81 | 31.05 | 33.73 | 39.88 | 42.85 | 42.07 | 41.22 | 35.70 | 16.11 |
| gxhash4 | 23.31 | 30.00 | 33.25 | 38.92 | 42.58 | 42.45 | 40.86 | 35.19 | 15.69 |
| lh_aes | 13.36 | 14.88 | 21.50 | 26.90 | 31.11 | 31.54 | 31.27 | 23.12 | 6.91 |
| lanehash64 | 5.83 | 6.78 | 8.61 | 15.42 | 19.20 | 19.98 | 16.67 | 11.89 | 5.78 |
| foldhash_fast | 6.26 | 5.92 | 6.30 | 6.30 | 6.30 | 6.28 | 5.56 | 6.13 | 4.85 |
| xxh3 | 9.15 | 11.51 | 13.49 | 14.25 | 14.59 | 14.74 | 12.47 | 12.73 | 6.63 |
| ahash | 5.74 | 6.03 | 6.17 | 6.22 | 6.21 | 6.23 | 5.54 | 6.02 | 3.92 |
HashMap multi-key-type read/write throughput (in Mop/s):
| Hasher | u64 Write | u64 Lookup | Short String Write | Short String Lookup | URL Write | URL Lookup | Geometric Mean |
|---|---|---|---|---|---|---|---|
| ihash | 50.5 | 176.1 | 9.2 | 18.3 | 5.3 | 7.7 | 19.8 |
| gxhash4 | 43.7 | 136.2 | 7.2 | 10.0 | 4.8 | 4.1 | 14.3 |
| foldhash_fast | 50.5 | 169.5 | 6.6 | 9.8 | 4.7 | 4.0 | 14.8 |
| foldhash_quality | 42.9 | 133.0 | 7.7 | 9.9 | 5.3 | 4.4 | 14.7 |
| rapidhash | 43.4 | 133.5 | 6.9 | 9.0 | 4.9 | 3.7 | 13.7 |
| ahash | 43.5 | 130.9 | 6.4 | 9.2 | 5.3 | 4.2 | 14.0 |
| fxhash | 53.2 | 191.3 | 7.1 | 9.9 | 5.6 | 4.4 | 16.1 |
| std | 38.5 | 71.6 | 6.4 | 8.2 | 4.5 | 3.8 | 11.7 |
Multi-width, extended output, and pure-software fallback geometric means (in GiB/s):
| hash32 | hash64 | hash128 | hash256 | hash_xof | Stream | cpu fallback | lanehash64 |
|---|---|---|---|---|---|---|---|
| 26.74 | 26.86 | 26.27 | 25.55 | 6.02 | 7.32 | 1.29 | 5.71 |
Cross-platform consistency
Before timing begins, each host runs a self-check over every byte length from 0..=1100 B as well as 4 KiB, 16 KiB, and 64 KiB (1,104 length tiers × 3 seed groups = 3,312 input sets in total).
The local hardware-accelerated path has been verified bit-for-bit against the ihash::cpu pure-software path, and all outputs across hash32, hash64, hash128, hash256, hash_xof, and Stream are identical on 4 hosts with different architectures.