三个功能强大的php加密解密函数
1 //加密函数 2 function lock_url($txt,$key='www.fyunw.com') 3 { 4 $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 5 $nh = rand(0,64); 6 $ch = $chars[$nh]; 7 $mdKey = md5($key.$ch); 8 $mdKey = substr($mdKey,$nh%8, $nh%8+7); 9 $txt = base64_encode($txt); 10 $tmp = ''; 11 $i=0;$j=0;$k = 0; 12 for ($i=0; $i<strlen($txt); $i++) { 13 $k = $k == strlen($mdKey) ? 0 : $k; 14 $j = ($nh+strpos($chars,$txt[$i])+ord($mdKey[$k++]))%64; 15 $tmp .= $chars[$j]; 16 } 17 return urlencode($ch.$tmp); 18 } 19 //解密函数 20 function unlock_url($txt,$key='www.fyunw.com') 21 { 22 $txt = urldecode($txt); 23 $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-=+"; 24 $ch = $txt[0]; 25 $nh = strpos(

最低0.47元/天 解锁文章
6755

被折叠的 条评论
为什么被折叠?



