Skip to main content

Crate lanehash

Crate lanehash 

Source
Expand description

lanehash: fast non-cryptographic 64/128-bit hashing, two functions with one API.

The crate root is lanehash itself, the default choice: chained NH-32 stripes (spec, 65 bytes and up) and a multiply-fold short path (short, 0–64 bytes), no instruction-set requirement, one definition reproduced bit-for-bit by the scalar reference and the SSE2, AVX2, AVX-512, NEON and wasm simd128 backends. The original AES-lane function lives in aes with the same shape of API; it is faster only in bulk on machines with VAES.

Public API: hash64, hash128, Keyed for many inputs under one seed, Stream for incremental hashing, and FixedState / RandomState for HashMap. The hidden modules are implementation detail, kept public for the reference tests and the benchmark harness.

Modules§

aes
The AES-lane function (SMHasher lanehash_aes64): AES lanes over 64 bytes (AES-NI / VAES / NEON at runtime, T-table software AES otherwise), a multiply-fold path below. spec is the definition; every backend equals it. Faster than the crate root only in bulk on machines with VAES.

Structs§

FixedState
BuildHasher with a fixed seed (deterministic maps).
Keyed
A seed with its secrets computed once, for hashing many inputs under one seed: Keyed::new(seed).hash64(b) == hash64(b, seed) without the seed multiply per call.
LaneHasher
RandomState
BuildHasher with a per-process random seed and a different accumulator start for every instance, so two maps do not share bucket order.
Stream

Functions§

hash64
64-bit lanehash of bytes under seed.
hash64_fixed
hash64 of an array: with the length a constant, the short classes inline without a call or a length branch. Same value as hash64(&key[..], seed).
hash128
128-bit lanehash of bytes under seed; its low half is hash64.
hash128_fixed
hash128 of an array, see hash64_fixed.