//Cryptographic FunctionsfunctionLock_url ($txt,$key= ' Www.jb51.net '){ $chars= "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) ? 2 x$k; $j= ($nh+Strpos($chars,$txt[$i])+Ord($mdKey[$k+ +])%64; $tmp.=$chars[$j]; } return UrlEncode($ch.$tmp);}//decryption FunctionfunctionUnlock_url ($txt,$key= ' Www.jb51.net '){ $txt=UrlDecode($txt); $chars= "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) ? 0:$k; $j=Strpos($chars,$txt[$i])-$nh-Ord($mdKey[$k++]); while($j<0)$j+=64; $tmp.=$chars[$j]; } return Base64_decode($tmp);}
PHP Common Cryptographic decryption Function example