This article introduces an example of the md5 function in php5 for the reference of beginners.
In PHP, it is necessary to encrypt the user password and store it. This requirement can be achieved by using the md5 function. Usage of MD5 function in PHP: <?php $pswd1=md5("cenusdesign"); echo $pswd1; //运行结果为:fc60ec37d1c08d5b0fb67a8cd934d5ba $pswd2=md5("Cenusdesign"); echo $pswd2; //运行结果为:067577d9fc109c80538c81d6f02bd293 ?> Copy after login After md5 encryption, the original "cenusdesign" is converted into a set of 32-bit strings. Moreover, even if the case of one letter changes, this set of strings will change dramatically. When doing the user registration process, it is recommended to first convert the password to MD5, and then convert the encrypted database. 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. This is indeed a lot more secure for passwords. |