The crypt () function returns a string that is encrypted using the DES, Blowfish, or MD5 algorithms.
On different operating systems, the function behaves differently, and some operating systems support more than one type of algorithm. At installation time, PHP checks what algorithms are available and what algorithms are used.
The specific algorithm relies on the format and length of the salt parameter. Salt makes encryption more secure by increasing the number of strings that are generated by specific strings that use a particular encryption method.
This article is mainly for the detailed introduction of PHP using the crypt () function to encrypt
One, the code
<?php $str = ' Apply crypt () function for one-way encryption! '; Declares the string variable $str echo ' before encrypting the value of $str: '. $str; $crypttostr = Crypt ($STR); The value of the $STR encryption Echo ' <p> encryption $str after the variable is: '. $crypttostr; Output the encrypted variable?
Ii. Results of operation
Parameters do not have a salt, each encryption results in a different cipher.
The $STR value before encryption is: Apply the crypt () function for one-way encryption!
The value of $str after encryption is: $1$re4.gg4. $D. yd00xx0fffifp6krkgn0
Third, the Code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
Iv. Results of operation