The irreversible cryptographic functions are: MD5 (), Crypt ()
MD5 () is used to calculate MD5. The syntax is: string MD5 (string str);
Crypt () encrypts the string with the UNIX standard cryptographic DES module. This is a one-way cryptographic function that cannot be decrypted. To compare strings, place the first two characters of the encrypted string in the salt parameter, and then the encrypted string. The syntax is: string crypt (String str, string [salt]);
Reversible encryption: Base64_encode (), UrlEncode () corresponding decryption function: Base64_decode (), UrlDecode ()
Base64_encode () encodes the string in MIME BASE64. This encoding allows Chinese text or pictures to be transferred smoothly on the network. The syntax is string Base64_encode (string data); Its decryption function is: string Base64_decode (string encoded_data); Will be returned as is
UrlEncode () encodes the string as a URL. For example, a space will become a plus sign. The syntax is: string UrlEncode (String str);
Its decryption function is: string UrlDecode (String str); Will be returned as is
See section Code:
Copy CodeThe code is as follows:
Define ("str", "Mo Jian");
The result of ECHO ' MD5 encryption is: '. MD5 (str). '
';//MD5 encryption
The result of Echo ' Crypt encryption is: '. Crypt (str,str). '
';//Crypt Encryption
$base 64encode=base64_encode (str);//Base64_encode () encryption
The result of Echo ' Base64_encode encryption is: '. $base 64encode. '
';
The result of Echo ' Base64_decode decryption is: '. Base64_decode ($base 64encode). '
'; Base64_decode () decryption
$urlencode =urlencode (str); UrlEncode () encryption
The result of Echo ' UrlEncode encryption is: '. $urlencode. '
';
The result of Echo ' UrlDecode decryption is: '. UrlDecode ($urlencode). '
';//urldecode () decryption
?>
The result of the output is:
The result of MD5 encryption is: EA796AF15C74E90FAEBA49576FA7984B
The result of crypt encryption is: Ink Ylczgttyxps
The result of Base64_encode encryption is: xku9ow==
The result of Base64_decode decryption is: Mo Jian
The result of UrlEncode encryption is:%C4%AB%BD%A3
The result of UrlDecode decryption is: Mo Jian
http://www.bkjia.com/PHPjc/325169.html www.bkjia.com true http://www.bkjia.com/PHPjc/325169.html techarticle the irreversible cryptographic functions are: MD5 (), Crypt () MD5 () to calculate MD5. The syntax is: string MD5 (string str); Crypt () encrypts the string with the UNIX standard cryptographic DES module. This is ...