

Hash functions: theoretical basics, mixing, and evaluations of algorithms - nreece
http://bretm.home.comcast.net/~bretm/hash/

======
ajross
The author seems to have more depth in theory than in practice, unfortunately.
The first function examined, and casually discarded (without attribution) is
the Dan Bernstein djb2 function. This is a very popular function, largely
because of its extreme simplicity ("multiply by 33 and add/xor in the next
byte") and comparative robustness (it's _VERY_ strong for a one-line
algorithm).

Neither of these benefits seem to be of interest, though, so he drops this one
on the floor and he then trots off to examine a bunch of 20-30 line monsters.
Which is interesting enough, but not terribly useful to someone who actually
wants to implement, y'know, a real-world hash table.

djb2 happens to be a favorite of mine, it's a great thing to keep in your head
for when you need a nice robust mixing function. If you really have
requirements that go beyond what it can provide, you're probably better off
just using a cryptographic hash than trying to internalize the stuff in this
article. Given that digest hashes are the strongest algorithms available
anyway, _all_ the advice here is just carefully disguised premature
optimization, IMHO.

------
ovi256
Great page layout and graphic design! Peeking at the CSS, I notice that the
main div is called "paper" and that the offset lengths are measured in
centimeters and millimeters. I find that intriguing and unusual. Was the
layout created with a WYSIWYG editor? Or is it due to the designer's
preferences?

------
ardit33
I think every programmer needs to know how Hash Function, and Hashpams/Tables
work from the inside-out.

It gives you a great insight on why certain techniques are used, and it is a
classical CS problem.

If you can write a simple but solid implementation of a hash function, and a
hash map, you are ahead of most developers out there. A lot of developers use
them everyday, but don't have the faintest idea on how they work.

------
michael_dorfman
Excellent article, with a nice degree of depth. I'd like to see more by this
author.

------
carterschonwald
Umm, hash functions ARE NOT used for crypto, one way functions are, and they
are not hash functions.

~~~
sah
The phrase "hash functions" refers to a general category that includes
"cryptographic hash functions" (which are hopefully one-way) as a special
case.

