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

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

高洛峰
Release: 2023-03-03 18:30:01
Original
2069 people have browsed it

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加密
Copy after login

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


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template