3 ms·
The author seems to have more depth in theory than in practice, unfortunately. The first function examined, and casually discarded (without attribution) is the
by ajross 19y ago
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.