The irreversible cryptographic functions are: MD5 (), Crypt ()
MD5 () is used to compute MD5. Syntax is: string MD5 (string str);
Crypt () encrypts the string with the standard UNIX encryption 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's parameters, and then compare the encrypted string. Syntax is: string crypt (String str, string [salt]);
Reversible encryption is: Base64_encode (), UrlEncode () corresponding to the decryption function: Base64_decode (), UrlDecode ()
Base64_encode () encodes the string in MIME BASE64. This encoding allows Chinese characters or images to be transmitted smoothly on the network. Syntax is string Base64_encode (string data); Its decryption function is: string Base64_decode (string encoded_data); will return to the original
UrlEncode () encodes the string as a URL. For example, a space will become a plus sign. Syntax is: string UrlEncode (String str);
Its decryption function is: string UrlDecode (String str); will return to the original
Read paragraph code:
Copy Code code as follows:
<?php
Define ("str", "Mo Jian");
The result of the Echo ' MD5 encryption is: '. MD5 (str). ' <br> ';//MD5 encryption
The result of the Echo ' Crypt encryption is: '. Crypt (str,str). ' <br>/Crypt Encryption
$base 64encode=base64_encode (str);//Base64_encode () encryption
The result of the Echo ' Base64_encode encryption is: '. $base 64encode. ' <br> ';
The result of the Echo ' Base64_decode decryption is: '. Base64_decode ($base 64encode). ' <br> '; Base64_decode () decryption
$urlencode =urlencode (str); UrlEncode () encryption
The result of the Echo ' UrlEncode encryption is: '. $urlencode. ' <br> ';
The result of the Echo ' UrlDecode decryption is: '. UrlDecode ($urlencode). ' <br> ';//urldecode () decryption
?>
The results of the output are:
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