作者:caozhengweile_854 | 来源:互联网 | 2018-03-23 08:22
PHP加密解密类加强版
enkey=$key;
}
}
//设置密钥http://blog.ddian.cn
public function set_key($key){
$this->enkey=$key;
}
private function keyED($txt,$encrypt_key)
{
$encrypt_key = md5($encrypt_key);
$ctr=0;
$tmp = "";
for ($i=0;$ienkey;
}
srand((double)microtime()*1000000);
$encrypt_key = md5(rand(0,32000));
$ctr=0;
$tmp = "";
for ($i=0;$ikeyED($tmp,$key));
$r=str_replace('=',$this->rep_char,$r);
return $r;
}
//解密字符串
public function decrypt($txt,$key='')
{
$txt=str_replace($this->rep_char,'=',$txt);
$txt=base64_decode($txt);
if(!$key){
$key=$this->enkey;
}
$txt = $this->keyED($txt,$key);
$tmp = "";
for ($i=0;$i
以上就是PHP加密解密类加强版的内容,更多相关内容请关注PHP中文网(www.php1.cn)!