PHP encryption and decryption enhanced version
Enkey = $ key ;}// set the 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 (); $ ctr = 0; $ tmp = ""; for ($ I = 0; $ I
KeyED ($ tmp, $ key); $ r = str_replace ('=', $ this-> rep_char, $ r); return $ r ;} // decrypt the 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
The above is the PHP encrypted/decrypted enhanced version. For more information, see PHP Chinese website (www.php1.cn )!