On 24 Jul 2006 02:24:52 -0700, "Maya" <kf****@gmail.comwrote:
>Hello all,
I'm using MD5 hashing in my application to give unique values to huge
list of items my application receives, originally every item's name was
difficult to use as an id for this item although its unique but because
it had certain characters and variable lengths I ended up using MD5
hashing of the name.
My question: is there a simpler way of doing hashing than MD5 which is
32bit but still guarantee uniqueness for almost 10 billion records?
Thank you.
Maya.
You don't say if you are using MD5 for security reasons. Both MD2 and
MD4 are broken in security, but they are both simpler and faster then
MD5.
There are a large number of non-cryptographic hashes around, FNV
(
http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash) and others, which
are much simpler and much faster but are not cryptographically secure.
If collision avoidance is important to you then you may need to do a
test to see how collision prone any possible replacement is. FNV has
a number of sizes, including 128 bit and 256 bit. The 256 bit size
should be collision free, even if the 128 bit hash fails the test.
To reiterate, MD2, MD4 and FNV are *not* cryptographically secure. If
security is involved you need to stick with MD5 or upgrade to SHA-1
or better.
rossum