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