最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

一段php加密解密的代碼

 更新時(shí)間:2006年10月09日 00:00:00   作者:  
<?php  
$key = "This is supposed to be a secret key !!!";  

function keyED($txt,$encrypt_key)  
{  
$encrypt_key = md5($encrypt_key);  
$ctr=0;  
$tmp = "";  
for ($i=0;$i<strlen($txt);$i++)  
{  
if ($ctr==strlen($encrypt_key)) $ctr=0;  
$tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);  
$ctr++;  
}  
return $tmp;  
}  

function encrypt($txt,$key)  
{  
srand((double)microtime()*1000000);  
$encrypt_key = md5(rand(0,32000));  
$ctr=0;  
$tmp = "";  
for ($i=0;$i<strlen($txt);$i++)  
{  
if ($ctr==strlen($encrypt_key)) $ctr=0;  
$tmp.= substr($encrypt_key,$ctr,1) .  
(substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));  
$ctr++;  
}  
return keyED($tmp,$key);  
}  

function decrypt($txt,$key)  
{  
$txt = keyED($txt,$key);  
$tmp = "";  
for ($i=0;$i<strlen($txt);$i++)  
{  
$md5 = substr($txt,$i,1);  
$i++;  
$tmp.= (substr($txt,$i,1) ^ $md5);  
}  
return $tmp;  
}  

$string = "Hello World !!!";  

// encrypt $string, and store it in $enc_text  
$enc_text = encrypt($string,$key);  

// decrypt the encrypted text $enc_text, and store it in $dec_text  
$dec_text = decrypt($enc_text,$key);  

print "Original text : $string <Br>\n";  
print "Encrypted text : $enc_text <Br>\n";  
print "Decrypted text : $dec_text <Br>\n";  
?>  

相關(guān)文章

最新評(píng)論

阿尔山市| 辰溪县| 苍溪县| 清远市| 镇安县| 金昌市| 黄冈市| 平和县| 荃湾区| 崇州市| 铅山县| 壶关县| 聂拉木县| 会同县| 大化| 崇阳县| 淳安县| 自贡市| 腾冲县| 大安市| 象山县| 三原县| 建阳市| 绍兴市| 柘荣县| 望城县| 雷山县| 隆子县| 靖远县| 旌德县| 永修县| 黄石市| 湘阴县| 仙游县| 松原市| 报价| 石河子市| 弥勒县| 黑水县| 普格县| 泰宁县|