Copy codeThe Code is as follows:
<? Php
Echo substr (md5 ("admin"), 8, 16); // 16-bit MD5 Encryption
Echo "Echo md5 ("admin"); // 32-bit MD5 Encryption
?>
The 16-bit MD5 encryption is achieved by intercepting characters using the substr function ....
I don't want to study it in depth. I need to put my mental power in other key areas ~~
Today, I made a php link to the mssql database. The fields in the table in the database are encrypted using MD5 sixteen. However, the MD5 value in php is 32 bits by default. As a result, the login program cannot use md5 encryption to match the fields in the Table. Many people may find this problem on the Internet and find a solution, if it is correct, record it.
Use the substr function to intercept:
Substr (md5 ("admin"), 8, 16); // 16-bit MD5 Encryption
Md5 ("admin"); // 32-bit MD5 Encryption
The results of the script home test are as follows:
We compare the results of several md5 values in asp.
Appendix: If you encounter an MD5 encrypted file and do not know the password, replace this set of encrypted data in the database.
Admin --- 16-bit encryption --- 7a57a5a743894a0e
Admin --- 32-bit encryption --- 21232f297a57a5a743894a0e4a801fc3
Admin --- 40-bit encryption --- 7a57a5a743894a0e4a801fc343894a0e4a801fc3
Substr (md5 ("admin"), 8, 16); // The 16-bit MD5 encryption is the 16 characters starting from 8th characters. Therefore, you do not need to consider the uniqueness issue. It is correct. Some people on the Internet say that php5 supports
Copy codeThe Code is as follows:
Echo md5 ("admin", true); // return 16 bits, but this is only available in PHP5.
The output result is garbled. If you have any good code, share it.