PHP encryption and decryption type (including public key)

Source: Internet
Author: User
Tags crypt
PHP Cryptographic decryption Class (with public key)

?

   Key } srand (Double) microtime () *1000000); $encrypt _key = MD5 (rand (0,32000)); $ctr = 0; $tmp = ""; for ($i =0; $i
   
    
     KeyED ($tmp, $key);  The 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";?>
  • 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.