[openssl-dev] use SIPhash for OPENSSL_LH_strhash?
Benjamin Kaduk
bkaduk at akamai.com
Tue Jan 10 17:48:32 UTC 2017
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20170110/4384c41e/attachment.html>
More information about the openssl-dev
mailing list