In general, a member to provide registration of the site must collect the user's password, how to save the user password is a problem. We certainly cannot store passwords in plaintext in the database, because in this way, the average administrator can see the user's password, which is obviously a very dangerous thing for the user.
How to solve this problem, we can take such a strategy.
First introduce the use of the MD5 function in PHP:
Copy the Code code as follows:
$PSWD 1=md5 ("cenusdesign");
echo $PSWD 1; The result of the operation is: FC60EC37D1C08D5B0FB67A8CD934D5BA
$PSWD 2=md5 ("cenusdesign");
echo $PSWD 2; The result of the operation is: 067577d9fc109c80538c81d6f02bd293
?>
Obviously, after MD5 encryption, the original "Cenusdesign" is transformed into a set of 32-bit strings, and even if the case of a letter changes, this set of strings will change dramatically.
Cenus Design recommends that when the user registers, the password is converted first through MD5, and then the encrypted database is converted. When the user logs on, the password is MD5 converted, and then compared with the set of MD5 encrypted strings in the database. This makes it possible to do a password-specific operation without knowing the user's exact password.
Author: Sunec
Original download: Cenus Blog
All rights reserved. The author and original source and this statement must be indicated in the form of a link in the reprint.
The above describes the Moto defy me525 php MD5 function Use instance code, including the Moto defy me525 aspect of the content, I hope that the PHP tutorial interested in a friend helpful.