代码演示如下:

方法一

<"12"); 
 return $decrypted; 
 }else{ 
 $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); 
 return $encrypted; 
 } 
} 
 
//加密:"z0JAx4qMwcF+db5TNbp/xwdUM84snRsXvvpXuaCa4Bk=" 
echo encryptDecrypt('password', 'Helloweba欢迎您',0); 
//解密:"Helloweba欢迎您" 
echo encryptDecrypt('password', 'z0JAx4qMwcF+db5TNbp/xwdUM84snRsXvvpXuaCa4Bk=',1); 
"htmlcode">
<"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 
 $nh = rand(0,64); 
 $ch = $chars[$nh]; 
 $mdKey = md5($key.$ch); 
 $mdKey = substr($mdKey,$nh%8, $nh%8+7); 
 $txt = base64_encode($txt); 
 $tmp = ''; 
 $i=0;$j=0;$k = 0; 
 for ($i=0; $i<strlen($txt); $i++) { 
 $k = $k == strlen($mdKey) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 
 $ch = $txt[0]; 
 $nh = strpos($chars,$ch); 
 $mdKey = md5($key.$ch); 
 $mdKey = substr($mdKey,$nh%8, $nh%8+7); 
 $txt = substr($txt,1); 
 $tmp = ''; 
 $i=0;$j=0; $k = 0; 
 for ($i=0; $i<strlen($txt); $i++) { 
 $k = $k == strlen($mdKey) "htmlcode">
<"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 
 $nh = rand(0,64); 
 $ch = $chars[$nh]; 
 $mdKey = md5($key.$ch); 
 $mdKey = substr($mdKey,$nh%8, $nh%8+7); 
 $txt = base64_encode($txt); 
 $tmp = ''; 
 $i=0;$j=0;$k = 0; 
 for ($i=0; $i<strlen($txt); $i++) { 
 $k = $k == strlen($mdKey) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 
 $ch = $txt[0]; 
 $nh = strpos($chars,$ch); 
 $mdKey = md5($key.$ch); 
 $mdKey = substr($mdKey,$nh%8, $nh%8+7); 
 $txt = substr($txt,1); 
 $tmp = ''; 
 $i=0;$j=0; $k = 0; 
 for ($i=0; $i<strlen($txt); $i++) { 
 $k = $k == strlen($mdKey) "htmlcode">
<"1"; 
$key = "testkey"; 
$encrypt = passport_encrypt($txt,$key); 
$decrypt = passport_decrypt($encrypt,$key); 
 
echo $encrypt."<br>"; 
echo $decrypt."<br>"; 
 
"htmlcode">
<"htmlcode">
<?php 
//函数encrypt($string,$operation,$key)中$string:需要加密解密的字符串;$operation:判断是加密还是解密,E表示加密,D表示解密;$key:密匙。 
function encrypt($string,$operation,$key=''){ 
 $key=md5($key); 
 $key_length=strlen($key); 
 $string=$operation=='D'?base64_decode($string):substr(md5($string.$key),0,8).$string; 
 $string_length=strlen($string); 
 $rndkey=$box=array(); 
 $result=''; 
 for($i=0;$i<=255;$i++){ 
 $rndkey[$i]=ord($key[$i%$key_length]); 
 $box[$i]=$i; 
 } 
 for($j=$i=0;$i<256;$i++){ 
 $j=($j+$box[$i]+$rndkey[$i])%256; 
 $tmp=$box[$i]; 
 $box[$i]=$box[$j]; 
 $box[$j]=$tmp; 
 } 
 for($a=$j=$i=0;$i<$string_length;$i++){ 
 $a=($a+1)%256; 
 $j=($j+$box[$a])%256; 
 $tmp=$box[$a]; 
 $box[$a]=$box[$j]; 
 $box[$j]=$tmp; 
 $result.=chr(ord($string[$i])^($box[($box[$a]+$box[$j])%256])); 
 } 
 if($operation=='D'){ 
 if(substr($result,0,8)==substr(md5(substr($result,8).$key),0,8)){ 
 return substr($result,8); 
 }else{ 
 return''; 
 } 
 }else{ 
 return str_replace('=','',base64_encode($result)); 
 } 
} 
 
$str = 'abc'; 
$key = 'www.helloweba.com'; 
$token = encrypt($str, 'E', $key); 
echo '加密:'.encrypt($str, 'E', $key); 
echo '解密:'.encrypt($str, 'D', $key); 

?>
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?