[erlang-questions] Warning: erlang:phash2 output

Martin Bjorklund <>
Wed May 6 21:08:46 CEST 2009


Hi,

Paulo Sérgio Almeida <> wrote:
> Hi all,
> 
> This is a warning to whoever is using erlang:phash2.
> 
> While considering the use of phash2 as a hash function (to use in a 
> bloom filter) as it is fast, I was horrified at its behaviour, specially 
> for atoms:

Actually, phash2 uses a great hash function (by Robert Jenkins), if
you know how to invoke it -- you need to call it with a binary to get
this algorithm.

1> erlang:phash2(<<"a">>).
112802447
2> erlang:phash2(<<"b">>).
17711093
3> erlang:phash2(<<"c">>).
52466273


/martin



More information about the erlang-questions mailing list