问题
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)
回答1:
The Pigeonhole Principle explains why what you ask is impossible regarding uniqueness.
回答2:
You need the openssl library. It has implementations of the standard crypto hashes for this purpose.
回答3:
nss provides a number of hash and cryptographic algorithms and has a more liberal license than OpenSSL.
来源:https://stackoverflow.com/questions/2444057/unique-hash-of-string