You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This crate supports initializing XxHash with a random seed. I was wondering when would this be used?
First, I imagined that a user could use the random seed for preventing denial-of-service attacks based on the hash-collisions in HashMap (i.e. why we use SipHash-1-3 for HashMap). However, that does not work, because XXHash does not prevent these attacks.
I don't know enough about hashes to be an authoritative source about them. Your best bet is to check with the actual hash authors. I just read code and make the test outputs line up :-).
The true answer is that I was following the pattern in the standard library (which, as you say, aims for HashDOS resistance). I never spent much time thinking about it. 😇
I already kind-of presumed that it was to mirror the stdlib. :)
However, I feel that this might be dangerous. In the stdlib, the randomized seeds are used for the purpose of preventing HashDoS attacks. Because the crate API mirrors the stdlib, it suggests that these functions could be used for the same purpose (i.e. to prevent HashDoS). But this will not work and might result in insecure usage of the API.
Might I suggest deprecating these functions? Or would you mind me adding a note in the docs urging the user that using random seeds doe not prevent HashDoS attacks?
dsprenkels
changed the title
[question] What is the purpose of RandomXxHashBuilder64
[question] What is the purpose of RandomXxHashBuilder64?
Oct 15, 2020
This crate supports initializing
XxHash
with a random seed. I was wondering when would this be used?First, I imagined that a user could use the random seed for preventing denial-of-service attacks based on the hash-collisions in
HashMap
(i.e. why we use SipHash-1-3 forHashMap
). However, that does not work, because XXHash does not prevent these attacks.So I was wondering: what is the use case for
RandomXxHashBuilder{32,64}
? Why not just useXxHash{32,64}::with_seed
with some unique constant?The text was updated successfully, but these errors were encountered: