PHP implements encryption and decryption, and php implements encryption and decryption. PHP implements encryption and decryption, and php implements encryption and decryption. this example describes the encryption and decryption processing class implemented by PHP. For your reference, refer to the encryption and decryption processing class implemented by php * PHP and implemented by php.
This example describes the encryption and decryption processing class implemented by PHP. We will share this with you for your reference. The details are as follows:
<? Php/* = =================================== copyright agreement: = GPL (The gnu general public license Version 2, June 1991) = ---------------------------------------------------------- = File name: cls. sys_crypt.php = Abstract: php encryption and decryption processing Class = version: 1.0 = reference: passport function of Discuz forum = ---------------------------------------------------------- = last Update Date: ===================================================== =================================*/class SysCrypt {private $ crypt_key; // construct ($ crypt_key) {$ this-> crypt_key = $ crypt_key;} public function php_encrypt ($ txt) {srand (double) microtime () * 1000000); $ encrypt_key = md5 (rand (); $ ctr = 0; $ tmp = ''; for ($ I = 0; $ I
Crypt_key);} public function php_decrypt ($ txt) {$ txt = self ::__ key (base64_decode ($ txt), $ this-> crypt_key ); $ tmp = ''; for ($ I = 0; $ I <strlen ($ txt); $ I ++) {$ md5 = $ txt [$ I]; $ tmp. = $ txt [++ $ I] ^ $ md5;} return $ tmp;} private function _ key ($ txt, $ encrypt_key) {$ encrypt_key = md5 ($ encrypt_key); $ ctr = 0; $ tmp = ''; for ($ I = 0; $ I <strlen ($ txt ); $ I ++) {$ ctr = strlen ($ encrypt_key )? 0: $ ctr; $ tmp. = $ txt [$ I] ^ $ encrypt_key [$ ctr ++];} return $ tmp;} public function _ destruct () {$ this-> crypt_key = null ;}// run the code $ SC = new SysCrypt ('phpwms'); $ text = 'abc000000890000000990099hh '; // print ($ SC-> php_encrypt ($ text); // encrypt print ('
'); Print ($ SC-> php_decrypt ($ SC-> php_encrypt ($ text); // decrypt?>
If you are interested in encryption and decryption, refer to the online tools on this site:
Online password security detection
High-strength password generator
MD5 online encryption tool
Thunder, express, and tornado URL encryption/decryption tools