Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Collection of Hash Functions

64 views
Skip to first unread message

schokochris

unread,
Apr 26, 2007, 4:13:22 AM4/26/07
to
Hello group!

I am looking for hash functions which produce 32 bit output values
from an arbitrary long byte input value. I want to run some tests on
them if they are good for my purpose. Actually collisions do not
matter only diffusion and distribution. I already collected following
hash functions (i know some of them are meant for string hashing but i
figured they might be good for my purpose too). Do you have any more
suggestions?

Cheers
Christian

from: http://www.burtleburtle.net/bob/hash/doobs.html
1. BOB lookup3.c
2. OATH One-at-a-Time Hash


http://bretm.home.comcast.net/hash/Hash.cs
3. SimpleHash
4. SBOX

http://www.call-with-current-continuation.org/eggs/hashes.html:
5. TWMX Thomas Wang's MIX hash function.
6. FNVHash Fowler/Noll/Vo 1 hash function.
7. FNVAHash Fowler/Noll/Vo 1a hash function.
8. PHSFHash Paul Hsieh's SuperFast hash function. S
9. RSHash Robert Sedgwick's "Algorithms in C" hash function.
10. JSHash A bitwise hash function written by Justin Sobel.
11. PJWHash Hash algorithm is based on work by Peter J. Weinberger of
AT&T Bell Labs.
12. ELFHash
13. BKDRHash This hash function comes from Brian Kernighan and Dennis
Ritchie's book "The C Programming Language".
14. SDBMHash
15. DJBHash An algorithm produced by Professor Daniel J. Bernstein
16. NDJBHash Now favored by Bernstein.
17. DEKHash An algorithm proposed by Donald E. Knuth in "The Art Of
Computer Programming, Volume 3", under the topic of sorting and search
chapter 6.4.
18. APHash Arash Partow's hash function. A hybrid rotative and
additive hash function algorithm based around four primes 3, 5, 7, and
11.
19. CRC32 The crc32 procedure wrapped as above. Ignores the seed when
0.
20. BRPHash A hash function by Bruno R. Preiss.
21. PYHash The Python String Object hash function.
22. ISPLHash The ISpell hash function.

http://www.fantasy-coders.de/projects/gh/html/x435.html

23. OCaml Dieser Algorithmus wird in der aktuellen Version (3.04) von
Objective Caml verwendet.
24. SML Dieser Algorithmus wird in der aktuellen Version (110.40) von
SML/NJ (Standard ML/New Jersey) verwendet.
25. STL Dieser Algorithmus wird/wurde (?) in der STL (Standard
Template Library) von C++ verwendet.
26. Java Dieser Algorithmus wird (?) in Java's SDK verwendet.

http://groups.google.de/group/comp.programming/browse_frm/thread/8c869836861a70ca/fde8b6e43f81c9c1?lnk=st&q=WAIS+project+hash+function&rnum=1&hl=de&

27. WAIS Thinking Machines WAIS project
28. ETH ETH Zürich
29. CCCP GCC cpp

robert...@yahoo.com

unread,
Apr 26, 2007, 11:29:12 PM4/26/07
to
> http://groups.google.de/group/comp.programming/browse_frm/thread/8c86...

>
> 27. WAIS Thinking Machines WAIS project
> 28. ETH ETH Zürich
> 29. CCCP GCC cpp


For good diffusion and distribution, any of the cryptographic hash
functions (truncated as necessary) will produce excellent results, at
some cost in CPU overhead. Give SHA-1 a try.

schokochris

unread,
Apr 30, 2007, 4:44:47 AM4/30/07
to
> For good diffusion and distribution, any of the cryptographic hash
> functions (truncated as necessary) will produce excellent results, at
> some cost in CPU overhead. Give SHA-1 a try.

Thanks. But I forgot to mention; the CPU load is very important and
therefore none of the cryptographic will do.

Logan Shaw

unread,
May 1, 2007, 1:08:26 AM5/1/07
to
schokochris wrote:
> I am looking for hash functions which produce 32 bit output values
> from an arbitrary long byte input value. I want to run some tests on
> them if they are good for my purpose. Actually collisions do not
> matter only diffusion and distribution.

Are the input bytes evenly distributed? If so, then simply XOR groups
of 4 bytes together. If you XOR evenly-distributed bytes, you will
get evenly-distributed bytes.

- Logan

user923005

unread,
May 1, 2007, 1:45:29 PM5/1/07
to
For a hash that needs to be updated when a single byte of the source
key changes, Zobrist hash is great.

Adler32 is a classic fast hash.

If you are going to make a hash library, then I suggest adding the
cryptographic hashes also. Either that or build an interface to an
existing system like Crypto++.

UMAC hash is 64 bits, but is surprisingly fast on 64 bit systems when
you have a large object to hash. With 64 bit CPUs going mainstream,
it is going to become more and more popular to use 64 bits for hash
creation.

There is a floating point hash by D. J. Bernstein that is supposed to
be pretty fash.


Ben Pfaff

unread,
May 1, 2007, 1:54:13 PM5/1/07
to
schokochris <schok...@gmx.de> writes:

> I am looking for hash functions which produce 32 bit output values
> from an arbitrary long byte input value. I want to run some tests on
> them if they are good for my purpose. Actually collisions do not
> matter only diffusion and distribution. I already collected following
> hash functions (i know some of them are meant for string hashing but i
> figured they might be good for my purpose too). Do you have any more
> suggestions?

MD4 is quite fast and undoubtedly satisfies your other
requirements.
--
"The road to hell is paved with convenient shortcuts."
--Peter da Silva

schokochris

unread,
May 1, 2007, 5:00:43 PM5/1/07
to
Thanks for your replies.
I will add your proposed functions to the collection. The input values
are supposely not evenly distributed but I may give the Xor a try as
well. Previous evaluations showed that cryptographic functuions are
just too slow. There is no privacy issues in this application and
therefore non-cryptographic functions should perform better.
Well I would appreciate if from time to time any new or not mentioned
hash function is posted here. It may serve as a good source for people
looking for non-cryptographic functions beyond myself.

Cheers Christian

0 new messages