Expand description
Murmur
, a suite of non-cryptographic hash functions that was used for hash-based lookups.
by Austin Appleby (aappleby (AT) gmail)
https://sites.google.com/site/murmurhash/
Extremely simple - compiles down to ~52 instructions on x86.
Excellent distribution - Passes chi-squared tests for practically all keysets & bucket sizes.
Excellent avalanche behavior - Maximum bias is under 0.5%.
Excellent collision resistance - Passes Bob Jenkin’s frog.c torture-test. No collisions possible for 4-byte keys, no small (1- to 7-bit) differentials.
Excellent performance - measured on an Intel Core 2 Duo @ 2.4 ghz
OneAtATime
- 354.163715 mb/secFNV
- 443.668038 mb/secSuperFastHash
- 985.335173 mb/seclookup3
- 988.080652 mb/secMurmurHash
1.0 - 1363.293480 mb/secMurmurHash
2.0 - 2056.885653 mb/sec
§Example
use std::hash::{Hash, Hasher};
use fasthash::{murmur, MurmurHasher, FastHasher};
fn hash<T: Hash>(t: &T) -> u64 {
let mut s: MurmurHasher = MurmurHasher::new();
t.hash(&mut s);
s.finish()
}
let h = murmur::hash32(b"hello world\xff");
assert_eq!(h, hash(&"hello world") as u32);
Structs§
- Hash32
MurmurHash
32-bit hash functions- Hash32
Aligned MurmurHash
32-bit aligned hash functions- Hasher32
- An implementation of
std::hash::Hasher
. - Hasher32
Aligned - An implementation of
std::hash::Hasher
.
Functions§
- hash32
MurmurHash
32-bit hash functions for a byte array.- hash32_
aligned MurmurHash
32-bit aligned hash functions for a byte array.- hash32_
aligned_ with_ seed MurmurHash
32-bit aligned hash function for a byte array. For convenience, a 32-bit seed is also hashed into the result.- hash32_
with_ seed MurmurHash
32-bit hash function for a byte array. For convenience, a 32-bit seed is also hashed into the result.