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:
<?php define ("str", "Mo Jian"); The result of ECHO ' MD5 encryption is: '. MD5 (str). ' <br> ';//md5 encryption echo ' Crypt encryption results in: '. Crypt (str,str). ' <br> ';//Crypt Encryption $base 64encode=base64_encode (str);//Base64_encode () encryption echo ' Base64_encode encryption result is: '. $ Base64Encode. ' <br> '; The result of Echo ' Base64_decode decryption is: '. Base64_decode ($base 64encode). ' <br> '; Base64_decode () decryption $urlencode =urlencode (str); UrlEncode () The result of encrypting echo ' UrlEncode encryption is: '. $urlencode. ' <br> '; The result of Echo ' UrlDecode decryption is: '. UrlDecode ($urlencode). ' <br> ';//urldecode () Decrypt?>
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