Home > php教程 > php手册 > 可解密的md6(think_encrypt和think_decrypt改良版)

可解密的md6(think_encrypt和think_decrypt改良版)

WBOY
Release: 2016-06-07 11:41:53
Original
2443 people have browsed it

一直想要md5那种加密等长,又能解密的对称加密解密方法,于是有了md6。
第一步,去OT扣来think_encrypt和think_decrypt函数。
第二步,打造自己的md6:function md6($str='',$de=false){<br>     $key=('yourkey');<br>     $char=('MDAwMDAwMDAwM');<br>     if($str!=''){ <br>         if($de){<br>             $str=$char.$str;<br>             $str=think_decrypt($str,$key);<br>         }else{<br>             $str=think_encrypt($str,$key);<br>             $str=str_replace($char, '',$str);<br>         }<br>     }<br>     return $str;<br> }用法举例:function test(){<br>   $str= '';<br>   for($i=1;$i     $str=md6($i);<br>     echo($str.'    |    '.md6($str,true).'<br>');<br>   }<br> }输出结果:IKKdXY | 1<br> IKgdXY | 2<br> IKwdXY | 3<br> IN6dXY | 4<br> IOKdXY | 5<br> IOgdXY | 6<br> IOwdXY | 7<br> IR6dXY | 8<br> ISKdXY | 9<br> IKNeXY | 10 <br> ...<br> <br> IKNebCzdqRv | 10000<br> IKNebCzdqhv | 10001<br> IKNebCzdqxv | 10002<br> IKNebCzdrBv | 10003<br> IKNebCzdrRv | 10004<br> IKNebCzdrhv | 10005<br> IKNebCzdrxv | 10006<br> IKNebCzdsZv | 10007<br> IKNebCzdspv | 10008<br> IKNebCzds5v | 10009<br> IKNebCzhqRv | 10010 <br> ...<br> <br> IKNfbGzhqSpgqh2cg | 11110000<br> IKNfbGzhqSpgqh6cg | 11110001<br> IKNfbGzhqSpgqh-cg | 11110002<br> IKNfbGzhqSpgqiCcg | 11110003<br> IKNfbGzhqSpgqiGcg | 11110004<br> IKNfbGzhqSpgqiKcg | 11110005<br> IKNfbGzhqSpgqiOcg | 11110006<br> IKNfbGzhqSpgqiYcg | 11110007<br> IKNfbGzhqSpgqiccg | 11110008<br> IKNfbGzhqSpgqigcg | 11110009<br> IKNfbGzhqSpgrh2cg | 11110010 4-6位数(数字和英文)加密后的密文长度为:11,
7-9位数(数字和英文)加密后的密文长度为:17,



在一定范围内加密出来的密文是等长的,有什么作用就自己去发挥吧,我只能帮到这里了!

AD:真正免费,域名+虚机+企业邮箱=0元

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template