PHP implementation of enhanced encryption and decryption class instances, enhanced version of encryption and decryption
The example of this paper describes the PHP implementation of the enhanced encryption decryption class. Share to everyone for your reference. Specific as follows:
<?phpclass ender{private $enkey;//encryption decryption with the key private $rep _char= ' # '; Replace the = in the encrypted base64 string, because = is forbidden in some cases,//this can be replaced with an allowable character. The construction parameter is the key public function __construct ($key = ") {if (! $key) {$this->enkey= $key; }}//Set 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; $i
Enkey; } srand (Double) microtime () *1000000); $encrypt _key = MD5 (rand (0,32000)); $ctr = 0; $tmp = ""; for ($i =0; $i
KeyED ($tmp, $key)); $r =str_replace (' = ', $this->rep_char, $r); return $r; }//Decrypt the string 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
Hopefully this article will help you with your PHP programming.
http://www.bkjia.com/phpjc/1039209.html www.bkjia.com true Span id= "Isbasedonurl" itemprop= "Isbasedonurl" >http://www.bkjia.com/phpjc/1039209.html techarticle php implementation of the enhanced encryption and decryption class instances, enhanced version encryption decryption The example of this paper describes the PHP implementation of the enhanced encryption decryption class. Share to everyone for your reference. As follows: Phpclass E ...