Php encryption/decryption class (including public key )? & Lt ;? PhpclassCrypt {protected $ key = ""; // public key privatefunctionkeyED ($ txt, $ encrypt_key) {$ encrypt php encryption and decryption class (including public key)
?
Key;} srand (double) microtime () * 1000000); $ encrypt_key = md5 (rand (); $ ctr = 0; $ tmp = ""; for ($ I = 0; $ I
KeyED ($ tmp, $ key);} public function decrypt ($ txt, $ key = "") {if (empty ($ key )) {$ key = $ this-> key;} $ txt = $ this-> keyED ($ txt, $ key); $ tmp = ""; for ($ I = 0; $ I
Key = $ key;} public function getKey () {return $ this-> key ;}}$ string = "http://www.52blogger.com"; $ crypt = new Crypt (); $ crypt-> setKey ("http://www.52blogger.com"); $ enc_text = $ crypt-> encrypt ($ string, $ crypt-> getKey ()); $ dec_text = $ crypt-> decrypt ($ enc_text, $ crypt-> getKey (); echo "before encryption: $ string
\ N "; echo" after Encryption: $ enc_text
\ N "; echo" after decryption: $ dec_text \ n ";?>