Platform Tools Release 35.0.1 (11580240)
Snap for 11541002 from 01df6281ef679fef9e58b0205d89a4d037771a4b to sdk-release

Change-Id: Ie0516887ddbeaad591ba8c830c9f573ecb216849
tree: f03b88ba6ad211300a53bdbffdb51d2ce53a818e
  1. .github/
  2. src/
  3. .cargo_vcs_info.json
  4. .gitignore
  5. Android.bp
  6. Cargo.toml
  7. Cargo.toml.orig
  8. cargo_embargo.json
  9. LICENSE.txt
  10. METADATA
  11. MODULE_LICENSE_MIT
  12. OWNERS
  13. README.md
README.md

TwoX-Hash

A Rust implementation of the XXHash algorithm.

Build Status Current Version

Documentation

Examples

With a fixed seed

use std::hash::BuildHasherDefault;
use std::collections::HashMap;
use twox_hash::XxHash64;

let mut hash: HashMap<_, _, BuildHasherDefault<XxHash64>> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

With a random seed

use std::collections::HashMap;
use twox_hash::RandomXxHashBuilder64;

let mut hash: HashMap<_, _, RandomXxHashBuilder64> = Default::default();
hash.insert(42, "the answer");
assert_eq!(hash.get(&42), Some(&"the answer"));

Benchmarks

64-bit

BytesSipHasher (MB/s)XXHash (MB/s)Ratio
1523873%
421014870%
16615615100%
329141391152%
12813473657271%
25614145019355%
51215466168399%
102415656206397%
104857615927564475%
BytesFnvHasher (MB/s)XXHash (MB/s)Ratio
11000384%
480014819%
1676161581%
327611391183%
1287273657503%
2567595019661%
5127456168828%
10247416206838%
104857674575641015%

32-bit

BytesSipHasher (MB/s)XXHash32 (MB/s)Ratio
15255106%
4210210100%
166151230200%
329141882206%
12813473282244%
25614143459245%
51215463792245%
102415653938252%
104857615924127259%
BytesFnvHasher (MB/s)XXHash32 (MB/s)Ratio
11000556%
480021026%
167611230162%
327611882247%
1287273282451%
2567593459456%
5127453792509%
10247413938531%
10485767454127554%

Contributing

  1. Fork it ( https://github.com/shepmaster/twox-hash/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add a failing test.
  4. Add code to pass the test.
  5. Commit your changes (git commit -am 'Add some feature')
  6. Ensure tests pass.
  7. Push to the branch (git push origin my-new-feature)
  8. Create a new Pull Request