Messages Digest 5 (Message digest algorithm) is a hash function widely used in the field of computer security to provide integrity protection for messages.
MD5 's role is to allow bulk information to be "compressed" into a confidential format before signing a private key with a digital signature software, which is to transform an arbitrary-length byte string into a long hexadecimal string.
Features of the MD5 algorithm:
1. compressibility: Any length of data, the calculated length of the MD5 value is fixed.
2. Easy to calculate: It is easy to calculate the MD5 value from the original data.
3. Anti-modification: Make any changes to the original data, even if only one byte is modified, the resulting MD5 value will be greatly different.
4. Strong anti-collision: known raw data and its MD5 value, it is very difficult to find a data with the same value (that is, forged data).
1 Private Static stringMd5digest (stringinput)2 {3 stringresult ="";4 if(Input. Length >0)5 {6 byte[] Original =Encoding.Default.GetBytes (input);7MD5 S1 =MD5. Create ();8 byte[] Change =S1.computehash (original);9result = bitconverter.tostring (change). Replace ("-",string. Empty);Ten } One returnresult; A}
MD5 Message Digest algorithm