fastrand
fastrand copied to clipboard
Alternative Hash (ex : highway, xxh3)
wyrng
has been shown to have some flaws within the randomness
(from official repo )
Both of them are not 64 bit collision resistant, but is about 62 bits (flyingmutant/Cyan4973/vigna) When test on longer dataset (32TB, 23 days), wyrand will fail practrand (vigna)
Would there be interest in implementing an alternative hash?
If there is interest, I think I might take a try in implementing it. I think possible candidates would be highwayhash or xxh3 The former has a bit stronger preliminary (but not full) cryptanalysis. But both pass smhasher without problems without known hash issues.
Both are known to be fast. I do want to add that all algorithms, including wyhash, has strong and weak points regarding speed depending on input length, output length, specific implementation (if SIMD which ISA?). So I think it would not be fair to judge speed without seeing the actual implementation here.
If there is interest I might proceed as follows. I shall assume that there is a desire here to keep it simple and not add another dependency
- abstract current implementation within the codebase and isolate it
- implement an alternate hash and then provide a way to select it, or maintain a branch
- provide benchmarks to compare the two.
I will accept a PR to change the RNG algorithm if the benchmarks show that it is faster. However I am against having more than one supported RNG algorithm, as that is out of scope for this crate and would be more in scope for something like rand
.