Home >Backend Development >PHP Tutorial >moto defy me525 Example code for using MD5 function in PHP

moto defy me525 Example code for using MD5 function in PHP

WBOY
WBOYOriginal
2016-07-29 08:38:091051browse

Generally speaking, a website that provides member registration must collect user passwords. How to save user passwords is a problem. Of course we cannot store passwords in clear text in the database, because in this case, ordinary administrators can view the user password, which is obviously very dangerous for users.
So how to solve this problem? We can adopt this strategy.
    First, let’s introduce how to use the MD5 function in PHP:

Copy the code The code is as follows:


$pswd1=md5("cenusdesign");
echo $pswd1; ​ //Run results is: fc60ec37d1c08d5b0fb67a8cd934d5ba
$pswd2=md5("Cenusdesign");
echo $pswd2; //The running result is: 067577d9fc109c80538c81d6f02bd293
?& gt;


Obviously, after md5 encryption, the original "cenusdesign" was transformed into a group of 32 bit string, and if even a single letter case change occurs, this set of strings will change dramatically.
Cenus Design recommends that when registering a user, the password should first be converted to MD5, and then the encrypted database should be converted. When the user logs in, the password is first converted to MD5, and then compared with the set of MD5-encrypted strings in the database. In this way, the password comparison operation can be completed without knowing the user's exact password.
Author: Sunec
Original: Cenus Blog
All rights reserved. When reprinting, the author, original source and this statement must be indicated in the form of a link.

The above introduces the example code for using the MD5 function in moto defy me525 PHP, including the content of moto defy me525. I hope it will be helpful to friends who are interested in PHP tutorials.

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