[Hash function Ipv4]

Gleb Kurtsou gleb.kurtsou at gmail.com
Sun Jun 3 12:43:50 UTC 2012


On (02/06/2012 20:14), enrico d'urso wrote:
> 
> Hi,
> I'm looking for an Hash function for Ipv4 addresses.
> 
> What are good ones?

Have you tried good general purpose hash functions like murmur3 or
cityhash?

Another option is to use "hash" function that is bijection on integers
and exploit this fact in data structure, e.g. by using hash array mapped
trie or another prefix tree.

The easiest way to build such function is Feistel network on top of
general purpose hash function as round function. Li and Ri will be most
and less significant 16 bits of ipv4 address accordingly. At least 3
Fiestel rounds required. Play with function to achieve better
performance/distribution.

https://en.wikipedia.org/wiki/Feistel_cipher

Reduced round and block size RC5 also looks very attractive, but it's
patented :(

Thanks,
Gleb.


More information about the freebsd-hackers mailing list