Assume we have a hash table using the function
h(x) = x mod 32. h(x) = x mod 33. Also assume it dynamically resizes by doubling the amount of buckets and rehashing. If I was able to provide inputs for the hash table it would be really easy to flood with colliding entries to slow lookups to O(n).
However, say we were to xor each input with a random pepper before hashing. If the input is ever longer than the pepper we just generate more random pepper dynamically.
If this hash function is used on some server somewhere and people have the ability to supply it with entries, is it (relatively) safe from algorithmic complexity attacks? Is it vulnerable to any special attacks that don't work on SipHash?
More broadly speaking, how are keyed hash functions better than hash randomization for deterring hash flooding complexity attacks?
Edit: As pointed out by bmm6o, it turns out that h(x) = x mod 32 has no scrambling properties whatsoever when used in conjunction with xor, which partially answers my question. Other modulos that are not a power of two still work but the extent of the scrambling is unclear.
h(x) = x mod 32is the hash function? Is that still the function in the pepper paragraph and the one after? $\endgroup$
h(x) = x mod 32and xoring in pepper seem specifically chosen to not combine effectively. Do you see that two inputs that collide without the pepper still collide with the pepper? $\endgroup$