Hello All.
Alex:
As the article in Dah_cn's link tries to point out (in MS doc-ese ) not only is the GetHashCode() method one-way (as all hash algorithms are), but it is also one-sided. It only guarantees that the hash will be the same if the inputs are the same, not the converse.
If you need a hash that guarantees that the hash is the same for identical inputs, AND that the hash is unique for distinct inputs, then what you need is a cryptographic hash.
MDC (Message Detection Code) hash algorithms are used to ensure data integrity. An example would be the .NET MD5 implementation, MD5CryptoServiceProvider. Look here for more information (Alas, also in MS doc-ese).
HTH.
|