#random #hasher #hash

no-std wyhash

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

8 releases (4 breaking)

0.5.0 Dec 17, 2020
0.4.2 Nov 7, 2020
0.4.1 Jun 28, 2020
0.3.0 Jun 2, 2019
0.1.0 Mar 12, 2019

#219 in Algorithms

Download history 16524/week @ 2024-07-22 16235/week @ 2024-07-29 14800/week @ 2024-08-05 15342/week @ 2024-08-12 16141/week @ 2024-08-19 17818/week @ 2024-08-26 13744/week @ 2024-09-02 15714/week @ 2024-09-09 13911/week @ 2024-09-16 14036/week @ 2024-09-23 13591/week @ 2024-09-30 13267/week @ 2024-10-07 12474/week @ 2024-10-14 15660/week @ 2024-10-21 12625/week @ 2024-10-28 14627/week @ 2024-11-04

55,754 downloads per month
Used in 51 crates (29 directly)

MIT/Apache

14KB
191 lines

wyhash fast portable non-cryptographic hashing algorithm

crates.io Docs Build Status Coverage Status

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

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.

Minimum Supported Rust Version (MSRV)

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.

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

~47KB