MD5 encryption and md5 decryption
MD5 Encryption Method
MD5 is a secure hashing algorithm. Two different input plain texts do not obtain the same output value. Based on the output value, the original plain text cannot be obtained, that is, the process is irreversible; therefore, there is no ready-made Algorithm for decryption of MD5. We can only use the exhaustive method to scatter the plaintext that may appear with the MD5 algorithm, form a one-to-one ing table between the obtained hash value and the original data, and hash the value by comparing it with the MD5 algorithm used to crack the password in the table, find the original plaintext corresponding to the password to be cracked by matching the ing table.
For information systems or website systems, the MD5 algorithm is mainly used for encryption of user registration passwords. For encryption of common-strength passwords, the following three methods can be used for cracking:
(1) query the password online. Some online MD5 value query websites provide MD5 password value queries. After the MD5 password value is entered, if it exists in the database, the password value can be obtained quickly.
(2) Use an MD5 cracking tool. There are many specialized software for MD5 cracking on the network, which can be cracked by setting the dictionary.
(3) obtain or reset the user's password through social engineering.
Therefore, simple MD5 encryption cannot achieve absolute security, because common MD5 encryption has multiple brute-force cracking methods. Therefore, to ensure the security of information systems or websites, MD5 needs to be modified to enhance its security. This article aims to improve the MD5 encryption algorithm!
1 private String formatMD5String (String param) {2 try {3 MessageDigest digest = MessageDigest. getInstance ("MD5"); 4 // encrypt 5 byte [] miwen = digest. digest (param. getBytes (); 6 StringBuilder builder = new StringBuilder (); 7 for (byte B: miwen) {8 String hex = Integer. toHexString (B & 0xFF); 9 10 if (hex. length () = 1) {11 hex = 0 + hex; 12} 13 builder. append (hex); 14 System. out. println (hex); 15} 16 return builder. toString (); 17} catch (NoSuchAlgorithmException e) {18 e. printStackTrace (); 19} 20 return String. valueOf (param. hashCode (); 21}
View Code
Only one method is provided for reference!