tags:

views:

430

answers:

3

I have a list of (64-bit) addresses that represent a stack frame, and I want to hash these to a single 64-bit number to help identify those that have been seen before. There are at most 128 addresses.

My current algorithm calculates the hash by iterating through the list, xor'ing each address into the hash and rotating the hash by 11 bits per cycle.

Any better suggestions?

+3  A: 

There are a couple of nice integer hash functions here, for both 32 and 64 bit: http://www.concentric.net/~Ttwang/tech/inthash.htm

Also there's some written on it here: http://burtleburtle.net/bob/hash/evahash.html

Filip Ekberg
+4  A: 

You might consider some sort of CRC.

Perhaps a CRC64.

EvilTeach
CRC should not be used as a hash, it has very bad collision behaviour.
martinus
A: 

If performance isn't a problem you could try a cryptographic hash - truncate to how many bytes you want.

orip