亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

一段php加密解密的代碼

 更新時(shí)間:2007年07月16日 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)文章

  • PHP基于MySQL數(shù)據(jù)庫(kù)實(shí)現(xiàn)對(duì)象持久層的方法

    PHP基于MySQL數(shù)據(jù)庫(kù)實(shí)現(xiàn)對(duì)象持久層的方法

    這篇文章主要介紹了PHP基于MySQL數(shù)據(jù)庫(kù)實(shí)現(xiàn)對(duì)象持久層的方法,實(shí)例分析了php實(shí)現(xiàn)持久層的相關(guān)技巧,需要的朋友可以參考下
    2015-06-06
  • php連接oracle數(shù)據(jù)庫(kù)的方法(測(cè)試成功)

    php連接oracle數(shù)據(jù)庫(kù)的方法(測(cè)試成功)

    這篇文章主要介紹了php連接oracle數(shù)據(jù)庫(kù)的方法,簡(jiǎn)單分析了php連接Oracle數(shù)據(jù)庫(kù)的常見方法與具體操作技巧,并對(duì)可能出現(xiàn)的問題進(jìn)行了總結(jié)分析,需要的朋友可以參考下
    2016-05-05
  • 詳談php ip2long 出現(xiàn)負(fù)數(shù)的原因及解決方法

    詳談php ip2long 出現(xiàn)負(fù)數(shù)的原因及解決方法

    下面小編就為大家?guī)硪黄斦刾hp ip2long 出現(xiàn)負(fù)數(shù)的原因及解決方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-04-04
  • PHP簡(jiǎn)單實(shí)現(xiàn)多維數(shù)組合并與排序功能示例

    PHP簡(jiǎn)單實(shí)現(xiàn)多維數(shù)組合并與排序功能示例

    這篇文章主要介紹了PHP簡(jiǎn)單實(shí)現(xiàn)多維數(shù)組合并與排序功能,涉及php數(shù)組合并、排序等相關(guān)操作及array_merge、array_multisort等函數(shù)使用技巧,需要的朋友可以參考下
    2017-09-09
  • PHP基于遞歸算法解決兔子生兔子問題

    PHP基于遞歸算法解決兔子生兔子問題

    這篇文章主要介紹了PHP基于遞歸算法解決兔子生兔子問題,結(jié)合實(shí)例形式分析了兔子生兔子問題的php面試題采用循環(huán)與遞歸兩種思路的解決方法,需要的朋友可以參考下
    2018-05-05
  • 最新評(píng)論