#hash #rng #random #wyhash

no-std wyhash

Rust implementation of the WyHash fast portable non-cryptographic hashing algorithm and random number generator

4 releases (2 breaking)

0.3.0 Jun 2, 2019
0.2.1 Mar 30, 2019
0.2.0 Mar 23, 2019
0.1.0 Mar 12, 2019

#354 in Algorithms

Download history 527/week @ 2019-12-15 302/week @ 2019-12-22 485/week @ 2019-12-29 589/week @ 2020-01-05 364/week @ 2020-01-12 620/week @ 2020-01-19 450/week @ 2020-01-26 552/week @ 2020-02-02 651/week @ 2020-02-09 382/week @ 2020-02-16 498/week @ 2020-02-23 564/week @ 2020-03-01 474/week @ 2020-03-08 439/week @ 2020-03-15 576/week @ 2020-03-22 509/week @ 2020-03-29

1,184 downloads per month
Used in boomphf

MIT/Apache

14KB
191 lines

wyhash fast portable non-cryptographic hashing algorithm

crates.io Docs Build Status Coverage Status Maintenance Intention

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).

Usage

extern crate wyhash;
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.

Support

For questions, issues, feature requests, and other changes, please file an issue in the github project.

License

Licensed under either of

at your option.

Contributing

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.

Dependencies

~51KB