Hi, I want to create a unique hash (16 chars long) of an arbitrary length String. Is there a good library that implements MD5 or SHA-1 for C++ with which I can achieve this? (and possibly an example of how to use it)
+4
A:
The Pigeonhole Principle explains why what you ask is impossible regarding uniqueness.
Ben S
2010-03-14 22:34:26
how does MD5 work, because it hashes arbitrary length strings to 32-digit hex values
Aly
2010-03-14 23:37:25
Yes, but if you run enough strings through MD5 you'll end up with two different strings which have the same hash: http://www.google.com/search?q=md5+collision
Ben S
2010-03-14 23:56:59
+1
A:
You need the openssl library. It has implementations of the standard crypto hashes for this purpose.
bmargulies
2010-03-14 23:41:10
+1
A:
nss provides a number of hash and cryptographic algorithms and has a more liberal license than OpenSSL.
Ignacio Vazquez-Abrams
2010-03-14 23:49:18