-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All HashMaps use the same default salt to hash keys #265
Comments
In order to allow users to specify custom salts, emptyWithSalt :: Int -> HashMap k v …to allow users to pass in a custom salt. |
@tibbe mentioned in an email:
To me it seems that custom salts might not make it impossible to artificially produce collisions, but they should make it quite a bit harder. Other implementations also do this. For example Rust's
|
The "randomly seeded" part here is important. There are really two things that go together:
|
Yes, the seed has to be unpredictable to an attacker, and the hash function itself (taking in the seed) has to be strong enough so the attacker can't just brute-force the unpredictability. So Hashable probably won't cut it, but also using SipHash itself with a predictable seed won't be sufficient either. What I wrote in another ticket:
|
Does this imply that enabling My impression was that susceptibility to HashDoS is a somewhat gradual affair where some attacks could already be prevented by just using an unpredictable seed. Is that wrong or possibly just a bad line of thought? |
Yes, the random seed is useless, from a security perspective, without a stronger hash function. It's still needed to chain hashes to e.g. hash a record. We currently use FNV1a for byte string and text I think. One could imagine having a A more random seed really doesn't help without a strong hash function. |
I currently see two main approaches for making the hash salt less predictable for an attacker:
For (1.) I see two big disadvantages:
Therefore (2.) currently seems more attractive to me. However, might (2.) be less secure than (1.)? How does leaking a salt work, and will (2.) be more prone to that than (1.)? |
The
Hashable
class that this package relies on has ahashWithSalt
method that can be used to hash values with a custom salt. Currently this package doesn't use it, relying on thehash
method instead, which uses a hard-coded default salt.This means that it is currently rather easy to artificially produce hash collisions that trigger the performance degration reported in #121.
The text was updated successfully, but these errors were encountered: