rust-lang / hashbrown

Rust port of Google's SwissTable hash map
https://rust-lang.github.io/hashbrown
Apache License 2.0
2.39k stars 276 forks source link

ahash shouldn't be the default Hasher #473

Open jedisct1 opened 11 months ago

jedisct1 commented 11 months ago

See https://github.com/tkaitchuck/aHash/issues/163

It's also currently completely broken on ARM: https://github.com/tkaitchuck/aHash/issues/166

Amanieu commented 11 months ago

Hashbrown specifically doesn't make any guarantees about hash function security. The only reason we don't use FxHash by default is because it gives poor results if the input values are all multiples of the same value (e.g. all multiples of 4).

jestarray commented 10 months ago

Curious, what is the best hasher if one only cares about perf?

thomcc commented 10 months ago

It's an unanswerable question. You can make an arbitrarily fast hasher by reducing the quality of the output. For example, only hash the first 16 bytes of input strings, or even just return a constant value. Both of those are legal Hasher implementations.