kevy-hash
A non-cryptographic hash (FxHasher + fmix64) for single-trust-domain
keyspaces — pure Rust, zero dependencies.
FxHasher is FxHash's mixing function followed by an fmix64 finalizer (the
finalizer from MurmurHash3). The combination gets avalanche on the low bits
that FxHash alone misses, while staying 3.7–7× faster than std::collections's
SipHash on short keys.
Part of kevy — kevy is a single-process server with no untrusted clients within a shard, so DoS-resistant SipHash is unnecessary overhead.
use FxHasher;
use Hasher;
let mut h = default;
h.write;
let hash: u64 = h.finish;
For drop-in HashMap use, the crate provides a BuildHasher + ready-made
type aliases:
use ;
let mut m: = default;
m.insert;
// equivalent, more explicit:
use HashMap;
let mut m2: = default;
m2.insert;
For callers that don't need the Hasher state machine, the KevyHash
trait gives a stateless one-shot:
use KevyHash;
let h: u64 = b"hello".kevy_hash;
Trust model
⚠️ FxHasher is not DoS-resistant. Do not feed it adversary-controlled
keys without rate-limiting or per-shard isolation first. For kevy this is
fine — one shard = one trust domain.
License
MIT OR Apache-2.0