Home > Backend Development > PHP Tutorial > php encryption and decryption

php encryption and decryption

WBOY
Release: 2016-07-29 09:15:30
Original
1526 people have browsed it

Chinese character encryption and decryption, in order to solve the problem of Chinese characters being lost during transmission

<code><span>$urlstr</span> = urlencode(<span>"我是codekissyoung"</span>);
<span>echo</span>  urldecode(<span>$urlstr</span>);</code>
Copy after login

Irreversible encryption md5 hash value, sha1 hash value

<code><span>echo</span>  md5(<span>"hehexiix23"</span>);
<span>echo</span> crypt(<span>$some_string</span>,<span>'keyvalue'</span>);
<span>$str</span> = <span>'apple'</span>;
<span>if</span> (sha1(<span>$str</span>) === <span>'d0be2dc421be4fcd0172e5afceea3970e2f3d940'</span>) {
    <span>echo</span><span>"Would you like a green or red apple?"</span>;
}</code>
Copy after login

Reversible encryption

<code>base64_encode(<span>$string</span>);
base64_decode(<span>$string</span>);
convert_uudecode(<span>$str</span>);
convert_uuencode(<span>$str</span>);</code>
Copy after login

Copyright statement: Knowledge comes from the people, Use it for the people! Reprinting is welcome. Please attach a link to this article at the beginning. The article will be updated from time to time!

The above introduces PHP encryption and decryption, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template