The crypt (const char *key, const char *salt) function is one of the C-language functions that returns a string that is encrypted using DES, Blowfish, or MD5. On different operating systems, this 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.
This article mainly for you in detail the PHP use Crypt () function to encrypt, with a certain reference value, interested in small partners can refer to
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 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
。