apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: svn commit: r1236642 - in /apr/apr/trunk: tables/apr_hash.c test/testhash.c
Date Sat, 28 Jan 2012 10:37:15 GMT
On 28.01.2012 00:54, Bojan Smojver wrote:
> ------- Original message -------
>> +    hash = ht->seed ^ ht->hash_func(key, &klen);
> Actually, when I think about this, it will probably be inefective. If
> two keys produce the same hash, the xor-ed value against the seed will
> most certainly be the same as well. So, this won't actually do
> anything to stop the attack, except change which bucket attack picks.
> So, we probably do need to seed the hash function instead.

Seeding the hash function is essentially the same as not using a simple
XOR to do the randomization. Which is why my original suggestion said
randomize_hash(), not XOR.

Seeding the hash function is effectively the same as using the hash
function's output to seed the randomizer, right? So what remains is to
pick a good randomizer, which XOR is not. There's still no no need to
change the hash_func_t signature.

What randomizer you pick really depends on how secure you want to be.
You can use XOR (which you note is useless), or rerun the result + seed
through the built-in hash function (which is probably a bit better), or
run both through a secure hash algorithm (which sounds like overkill).

-- Brane

View raw message