PHP md5

 The function of the PHP md5 function can break up the string and recalculate the md5 hash function, which belongs to the PHP string function. The string after the md5 scatter calculation is also called the md5 hash, which is usually used when users create passwords , First convert it to md5 hash, and then store it in the MySQL database to protect the password. Although the password cannot be completely uncracked, it is at least safer than directly storing the password string in the database to avoid passwords. The original string is displayed directly. If the system uses md5 to convert the password, the password entered by a netizen every time they log in must be converted by md5 and then compared with the password string in the database. The two match are correct.


PHP md5 basic syntax

md5( $string, $raw_output)


The first parameter of the syntax, $string, is the original string, which is the string to be converted with md5, which is required. The second parameter $raw_output is used to set the 16-character binary (the parameter value is TRUE) or 32-character hexadecimal format processing (default, parameter value is FALSE), non-required item, new function added only in PHP 5.0.0.

PHP md5 reference example
<?php
$new_string = "Welcome to Wibibi."; echo'Original
string:'.$new_string.'<br>';
echo'Conversion result:'.md5($new_string);
?>
The above output
Original string: Welcome to Wibibi.
Conversion result: ca9ef0a8e937d2ea5549523a4a0bab30
The conversion result is the appearance of the md5 hash. Different strings will be converted into different results. The result of the same string conversion will be the same every time. If you save the member password, save the string converted with md5, it will be better than using The original string filled in by the member came well.

Post a Comment

0 Comments