[openssl-dev] use SIPhash for OPENSSL_LH_strhash?

Richard Levitte levitte at openssl.org
Tue Jan 10 18:31:22 UTC 2017



Benjamin Kaduk <bkaduk at akamai.com> skrev: (10 januari 2017 18:48:32 CET)
>On 01/09/2017 10:05 PM, Salz, Rich wrote:
>>
>> Should we move to using SIPHash for the default string hashing
>> function in OpenSSL?  It’s now in the kernel
>> https://lkml.org/lkml/2017/1/9/619
>>
><https://urldefense.proofpoint.com/v2/url?u=https-3A__lkml.org_lkml_2017_1_9_619&d=DwMFAg&c=96ZbZZcaMF4w0F4jpN6LZg&r=sssDLkeEEBWNIXmTsdpw8TZ3tAJx-Job4p1unc7rOhM&m=pP5nqGH-O2jy9bgGMmoCbXCc1O46ngqbhe5RSSkFBe8&s=pUULb5vMnjiMFb0kcqwJSHvwKh1G0vQZXwDDYnXNCA8&e=>
>>
>> Overview at https://131002.net/siphash/
>>
><https://urldefense.proofpoint.com/v2/url?u=https-3A__131002.net_siphash_&d=DwMFAg&c=96ZbZZcaMF4w0F4jpN6LZg&r=sssDLkeEEBWNIXmTsdpw8TZ3tAJx-Job4p1unc7rOhM&m=pP5nqGH-O2jy9bgGMmoCbXCc1O46ngqbhe5RSSkFBe8&s=7y76cbQkDMaUqyjBZmNMndmATnk9tUPu8I8JxeD1bKE&e=>
>>
>>
>
>Instead of this?
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>/*-
>    unsigned char b[16];
>    MD5(c,strlen(c),b);
>    return(b[0]|(b[1]<<8)|(b[2]<<16)|(b[3]<<24));
>*/
>
>    n = 0x100;
>    while (*c) {
>        v = n | (*c);
>        n += 0x100;
>        r = (int)((v >> 2) ^ v) & 0x0f;
>        ret = (ret << r) | (ret >> (32 - r));
>        ret &= 0xFFFFFFFFL;
>        ret ^= v * v;
>        c++;
>    }
>    return ((ret >> 16) ^ ret);
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>Heck, yes!
>
>-Ben

I fail to see what that would give us. OPENSSL_LH_strhash() is used to get a reasonable index for LHASH entries. Also SIPhash gives at least 64 bits results, do we really expect to see large enough hash tables to warrant that? 

Cheers 
Richard 
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the openssl-dev mailing list