lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 08 Jul 2011 11:06:59 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	johnwheffner@...il.com
Cc:	mj@....cz, netdev@...r.kernel.org
Subject: Re: ipv4: Simplify ARP hash function.

From: John Heffner <johnwheffner@...il.com>
Date: Fri, 8 Jul 2011 14:03:45 -0400

> On Fri, Jul 8, 2011 at 1:47 PM, David Miller <davem@...emloft.net> wrote:
>> From: Martin Mares <mj@....cz>
>> Date: Fri, 8 Jul 2011 19:40:55 +0200
>>
>>> The hash function is linear, so it can be reduced to:
>>>
>>>       a = key ^ dev->ifindex
>>>       return (a >> 8) ^ (a >> 16) ^ (a >> 24)                         // (1)
>>>            ^ (hash_rnd >> 8) ^ (hash_rnd >> 16) ^ (hash_rnd >> 24)    // (2)
>>
>> Is this really the same?  The inclusion of a full 32-bit xor
>> with hash_rnd before folding was intentional, so that the
>> final folding occurs on a completely "random" value.
> 
> Martin's reduction looks exactly correct to me.

Ok, there was also an unintended bug in my original patch,
I lost the bottom 8 bits in the fold, the hash function
should instead be:

+static inline u32 arp_hashfn(u32 key, const struct net_device *dev, u32 hash_rnd)
+{
+	u32 val = key ^ dev->ifindex ^ hash_rnd;
+
+	return val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24);
+}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists