MurmurHash3 is a non-cryptographic hash function suitable for general hash-based lookup.
This crate supports one-shot or progressive hashing of any primitive or custom type (which implements the Hash
trait) on Big- and Small-Endian systems.
Module documentation with examples.
Add this to your Cargo.toml
:
[dependencies]
murmur3 = { git = "https://github.com/schnupperboy/murmur3.git" }
and this to your crate root:
extern crate murmur3;
Here's a simple example that calculates a 32 bit MurmurHash3:
extern crate murmur3;
use std::hash::{Hash, Hasher};
use murmur3::Murmur3Hasher;
let data = 1234;
let mut hasher = Murmur3Hasher::new(0); // Seeded with 0
data.hash(&mut hasher);
let hash = hasher.finish();
For details especially on how to use for str
and [T]
data see the documentation.
murmur3
is distributed under the terms of MIT license. See LICENSE.md for details.