Home  >  Article  >  Backend Development  >  PHP implements MD5 encryption 16 bits (not the default 32 bits)

PHP implements MD5 encryption 16 bits (not the default 32 bits)

高洛峰
高洛峰Original
2016-12-21 09:24:422035browse

Today I made a php link to a mssql database. The fields in the tables in the database are encrypted using MD516. However, the default MD5 in PHP is 32 bits, which makes it impossible for the login program to use md5 encryption to match the fields in the table. Many people were confused about this when searching online. Later, I found a solution and it was correct, so I recorded it. Come down

Use the substr function to intercept:

substr(md5("admin"),8,16); // 16位MD5加密 
md5("admin"); // 32位MD5加密

For more PHP-enabled MD5 encryption 16-bit (not the default 32-bit) related articles, please pay attention to the PHP Chinese website!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn