skarupke / flat_hash_map

A very fast hashtable
1.69k stars 186 forks source link

reinitialize hasher on growth #2

Open gnzlbg opened 7 years ago

gnzlbg commented 7 years ago

@skarupke would it be possible to reinitialize the hasher on growth? (e.g. by re-assigning a default constructing hasher to it?)

For state-less hashers, this would be a no-op.

But I think (worth checking) that this would allow an stateful hasher, with a dynamically initialized seed, to change seed after each growth. This would make exploiting the primes used to construct a malicious input sequence (which is already very hard) impractical without full access to the target memory.

Not that this hash table should have as an objective to be "DOS resistant" (and there are probably better hash tables for that), but it is always nice to give the user a choice. Comparing this one with a stateful hasher against secure-by-design hash-tables would make for another excellent blogpost of yours.