Re: Hash Function problem
- From: websnarf@xxxxxxxxx
- Date: 1 Mar 2006 21:26:30 -0800
websn...@xxxxxxxxx wrote:
Hugo wrote:
- Which hash function do you suggest me to use ?
For 64 bits? I am not aware of a really good one taylored for 64 bits,
but obviously you can use SHA-2 (or even MD5 or SHA-1 if you don't
actually want security.) You might be able to modify other functions
like RC4.
Actually, if you are daring, you might try the following: Take a look
up Bob Jenkin's function:
http://burtleburtle.net/bob/hash/doobs.html
His inner loop uses a 96 bit internal state. While he only guarantees
avalanching (what he calls "no funnels") from the 32 bits in the c
variable, you could probably do something like running an additional
mix(a,b,c) round, then output (a^b)+c as the other 32 bits, then you
almost certainly retain the avalanching property (you might lose the
bit independence property -- but this is highly unlikely.) The reason
you don't want to just output c is that this would be the equivalent to
adding 12 '\0' characters to the end of your data which might give your
output too much deductive structure that might translate into a
weakness.
My own testing indicates that Bob Jenkin's hash function is basically
the second fastest (on AMD CPU architectures) good 32 bit hash function
that is known to me, so this solution would set a pretty high bar in
terms of performance (it will certainly outperform those cryptographic
based hash functions). Unfortunately, I don't think my function (the
"SuperFastHash" which I've measured to be the fastest known good 32 bit
hash function), or most other good 32 bit hash functions can be
similarly adapted as they typically only use a 32 bit state.
--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/
.
- Follow-Ups:
- Re: Hash Function problem
- From: bob_jenkins
- Re: Hash Function problem
- From: CBFalconer
- Re: Hash Function problem
- References:
- Hash Function problem
- From: Hugo
- Re: Hash Function problem
- From: websnarf
- Hash Function problem
- Prev by Date: Re: Best copying stable sort algorithm?
- Next by Date: Re: Digital Mars
- Previous by thread: Re: Hash Function problem
- Next by thread: Re: Hash Function problem
- Index(es):
Relevant Pages
|