Php uses character variable encryption when registering, logging on, or passing url parameters. The following is a brief introduction: the irreversible encryption function of the php built-in encryption function is: md5 (), crypt ()
Md5 () is used to calculate MD5. Syntax: string md5 (string str );
Crypt () encrypts the string with the standard DES module of UNIX. This is a one-way encryption function and cannot be decrypted. To compare the string, place the first two characters of the encrypted string in the salt parameter, and then compare the encrypted string. Syntax: string crypt (string str, string [salt]);
Reversible encryption: corresponding decryption functions of base64_encode () and urlencode (): base64_decode () and urldecode ()
Base64_encode () encodes the string with MIME BASE64. This encoding method enables smooth transmission of Chinese text or images over the network. The syntax is string base64_encode (string data); its decryption function is: string base64_decode (string encoded_data); returns the original
Urlencode () encodes the string into a URL. For example, a space is changed to a plus sign. Syntax: string urlencode (string str );
Its decryption function is: string urldecode (string str); returns the original
The output result is:
The md5 encryption result is: ea796af15c74e90faeba49576fa7984b.
The encrypted result of crypt is: moylczgttyxps.
Base64_encode: xKu9ow =
Base64_decode: the decrypted result is: Mo Jian
Urlencode encrypted result: % C4 % AB % BD % A3
After urldecode is decrypted, the result is: Mo Jian.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.