Crates.io | wyhash |
lib.rs | wyhash |
version | 0.5.0 |
source | src |
created_at | 2019-03-12 09:46:29.387149 |
updated_at | 2020-12-17 21:11:10.483271 |
description | Rust implementation of the WyHash fast portable non-cryptographic hashing algorithm and random number generator. |
homepage | https://github.com/eldruin/wyhash-rs |
repository | https://github.com/eldruin/wyhash-rs |
max_upload_size | |
id | 120260 |
size | 37,530 |
Rust implementation of the wyhash algorithm by Wang Yi.
The hashing algorithm passes SMHasher and the random number generator passes BigCrush and practrand. As of now it is the fastest algorithm in the SMHasher benchmark (faster than t1ha and XXH3). See here.
Furthermore, this algorithm is solid, simple, portable (does not need hardware support, can be
used in no_std
environments) and has no dependencies (except the traits from rand_core
).
The generated hashes are equal (see tests) as of the version stated here although the speed varies (PRs are welcome).
use wyhash::WyHash;
use std::hash::Hasher;
fn main() {
let mut hasher = WyHash::with_seed(3);
hasher.write(&[0, 1, 2]);
assert_eq!(0xcc24_2106_e707_6a48, hasher.finish());
}
See further examples of the hasher and RNG in the documentation.
For questions, issues, feature requests, and other changes, please file an issue in the github project.
This crate is guaranteed to compile on stable Rust 1.36.0 and up. It might compile with older versions but that may change in any new patch release.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.