5 ms·
TreeMap as a fallback for bucket and/or some king of random salt for hashes had to be introduced due to security issues (DoS) - I doubt anybody would remember a
by rieTohgh6 4y ago
TreeMap as a fallback for bucket and/or some king of random salt for hashes had to be introduced due to security issues (DoS) - I doubt anybody would remember about such stuff when making own hashmap implementation.
- eatonphil 4y agoAny links to learn more?
- formerly_proven 4y agoThe average performance of hashtables generally depends on collisions being rare, but if the hashed index is trivially derivable from the key, then an attacker can supply data where everything hashes to the same index, regressing performance to the point that it's a DoS attack. This is why cryptographically secure short-output hash functions like SipHash were developed.
- ddevault 4y agohttps://en.wikipedia.org/wiki/Collision_attack#Hash_flooding https://en.wikipedia.org/wiki/Collision_attack#Hash_flooding Note that this is only a problem when an attacker can influence your hash table usage, and can be mitigated with hashing functions like siphash. This is not necessary for the majority of hash tables in the wild.