PHP implementation of enhanced encryption and decryption class instances, enhanced version of encryption and decryption _php tutorial

Source: Internet
Author: User

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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.