Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
src/ | 25-Apr-2025 | - | 3,216 | 2,518 | ||
.cargo-checksum.json | D | 25-Apr-2025 | 1.2 KiB | 1 | 1 | |
Android.bp | D | 25-Apr-2025 | 1.5 KiB | 67 | 62 | |
Cargo.lock | D | 25-Apr-2025 | 5.9 KiB | 235 | 207 | |
Cargo.toml | D | 25-Apr-2025 | 1.6 KiB | 72 | 61 | |
LICENSE | D | 25-Apr-2025 | 1.1 KiB | 22 | 17 | |
LICENSE.txt | D | 25-Apr-2025 | 1.1 KiB | 22 | 17 | |
METADATA | D | 25-Apr-2025 | 399 | 18 | 17 | |
MODULE_LICENSE_MIT | D | 25-Apr-2025 | 0 | |||
README.md | D | 25-Apr-2025 | 3.9 KiB | 103 | 80 | |
TEST_MAPPING | D | 25-Apr-2025 | 77 | 8 | 7 | |
cargo_embargo.json | D | 25-Apr-2025 | 57 | 5 | 4 |
README.md
1 # TwoX-Hash 2 3 A Rust implementation of the [XXHash] algorithm. 4 5 [](https://travis-ci.org/shepmaster/twox-hash) [](https://crates.io/crates/twox-hash) 6 7 [Documentation](https://docs.rs/twox-hash/) 8 9 [XXHash]: https://github.com/Cyan4973/xxHash 10 11 ## Examples 12 13 ### With a fixed seed 14 15 ```rust 16 use std::hash::BuildHasherDefault; 17 use std::collections::HashMap; 18 use twox_hash::XxHash64; 19 20 let mut hash: HashMap<_, _, BuildHasherDefault<XxHash64>> = Default::default(); 21 hash.insert(42, "the answer"); 22 assert_eq!(hash.get(&42), Some(&"the answer")); 23 ``` 24 25 ### With a random seed 26 27 ```rust 28 use std::collections::HashMap; 29 use twox_hash::RandomXxHashBuilder64; 30 31 let mut hash: HashMap<_, _, RandomXxHashBuilder64> = Default::default(); 32 hash.insert(42, "the answer"); 33 assert_eq!(hash.get(&42), Some(&"the answer")); 34 ``` 35 36 ## Benchmarks 37 38 ### 64-bit 39 40 | Bytes | SipHasher (MB/s) | XXHash (MB/s) | Ratio | 41 |---------|------------------|---------------|-------| 42 | 1 | 52 | 38 | 73% | 43 | 4 | 210 | 148 | 70% | 44 | 16 | 615 | 615 | 100% | 45 | 32 | 914 | 1391 | 152% | 46 | 128 | 1347 | 3657 | 271% | 47 | 256 | 1414 | 5019 | 355% | 48 | 512 | 1546 | 6168 | 399% | 49 | 1024 | 1565 | 6206 | 397% | 50 | 1048576 | 1592 | 7564 | 475% | 51 52 | Bytes | [FnvHasher][fnv] (MB/s) | XXHash (MB/s) | Ratio | 53 |---------|-------------------------|---------------|-------| 54 | 1 | 1000 | 38 | 4% | 55 | 4 | 800 | 148 | 19% | 56 | 16 | 761 | 615 | 81% | 57 | 32 | 761 | 1391 | 183% | 58 | 128 | 727 | 3657 | 503% | 59 | 256 | 759 | 5019 | 661% | 60 | 512 | 745 | 6168 | 828% | 61 | 1024 | 741 | 6206 | 838% | 62 | 1048576 | 745 | 7564 | 1015% | 63 64 ### 32-bit 65 66 | Bytes | SipHasher (MB/s) | XXHash32 (MB/s) | Ratio | 67 |---------|------------------|-----------------|-------| 68 | 1 | 52 | 55 | 106% | 69 | 4 | 210 | 210 | 100% | 70 | 16 | 615 | 1230 | 200% | 71 | 32 | 914 | 1882 | 206% | 72 | 128 | 1347 | 3282 | 244% | 73 | 256 | 1414 | 3459 | 245% | 74 | 512 | 1546 | 3792 | 245% | 75 | 1024 | 1565 | 3938 | 252% | 76 | 1048576 | 1592 | 4127 | 259% | 77 78 | Bytes | [FnvHasher][fnv] (MB/s) | XXHash32 (MB/s) | Ratio | 79 |---------|-------------------------|-----------------|-------| 80 | 1 | 1000 | 55 | 6% | 81 | 4 | 800 | 210 | 26% | 82 | 16 | 761 | 1230 | 162% | 83 | 32 | 761 | 1882 | 247% | 84 | 128 | 727 | 3282 | 451% | 85 | 256 | 759 | 3459 | 456% | 86 | 512 | 745 | 3792 | 509% | 87 | 1024 | 741 | 3938 | 531% | 88 | 1048576 | 745 | 4127 | 554% | 89 90 91 [fnv]: https://github.com/servo/rust-fnv 92 93 ## Contributing 94 95 1. Fork it ( https://github.com/shepmaster/twox-hash/fork ) 96 2. Create your feature branch (`git checkout -b my-new-feature`) 97 3. Add a failing test. 98 4. Add code to pass the test. 99 5. Commit your changes (`git commit -am 'Add some feature'`) 100 6. Ensure tests pass. 101 7. Push to the branch (`git push origin my-new-feature`) 102 8. Create a new Pull Request 103