1. Overview of MD5 encryption
Message Digest Algorithm MD5 (Chinese known as Message Digest Algorithm 5th Edition) is a hash function widely used in the field of computer security to provide message integrity protection. The file number for this algorithm is RFC 1321 (R.Rivest, MIT Laboratory for Computer Science and RSA Data Security Inc., April 1992).
MD5 stands for Message-Digest Algorithm 5, which is used to ensure complete and consistent information transmission. It is one of the hash algorithms widely used by computers (also known as summary algorithm and hash algorithm), and mainstream programming languages generally have MD5 implementation. Computing data (such as Chinese characters) into another fixed-length value is the basic principle of the hash algorithm, and MD5 was predecessor MD2, MD3, and MD4. The MD5 algorithm has the following characteristics: 1. Compressibility: The length of the calculated MD5 value is fixed for any length of data. 2. Easy to calculate: It is easy to calculate the MD5 value from the original data. 3. Modification resistance: Any changes made to the original data, even if only 1 byte is modified, the MD5 value obtained will be very different. 4. Strong collision resistance: The original data and its MD5 value are known, and it is very difficult to find a data with the same MD5 value (i.e., fake data). The function of MD5 is to allow large amounts of information to be "compressed" into a confidential format (i.e., convert an arbitrary length byte string into a hexadecimal string of a certain length before signing the private key with digital signature software). In addition to MD5, the more famous ones include sha-1, RIPEMD and Haval.
MD5 is an asymmetric encryption algorithm (PS: symmetric encryption means that the password used for encryption and the password used for decryption are the same, and asymmetric means that the key used for encryption and decryption is different)
2. Java implements MD5 encryption and decryption
1. Maven introduces Apache's jar (not a Maven project, go to the next jar on the Internet to manually import)
2. MD5 use code
|