Share a newly written PHP encryption and decryption function

Source: Internet
Author: User
After base64 encryption, the entire program is very simple. {code is decrypted {code...} and {code...} is encrypted in different or string encryption mode. complete code example: {code ~ It should be difficult to crack according to logic thinking. if others do not know your key, if they still feel insecure. So after I encrypt... base64, the difference or string encryption method

Encryption

function encode($str,$key){    $res = base64_encode($str);    $code = $res^$key;    return $code;}

Decryption

function decode($str,$key){    return base64_decode($str^$key);}

Complete Code example:

$str = '111021';$key = 'APPYJJ-PHONE-LAZY';function encode($str,$key){    $res = base64_encode($str);    $code = $res^$key;    return $code;}$str = encode($str,$key);print_r($str);echo "";function decode($str,$key){    return base64_decode($str^$key);}print_r(decode($str,$key));
  • The whole program is very simple ~ It should be difficult to crack according to logic thinking. when others do not know your key;

  • If you still feel insecure. So I will discuss it here. we suggest you continue to use the shift operation during encryption and decryption.

// During encryption; $ a = $ str> 4; // The opposite is true for decryption. $ a = $ str <4;

OK !~ Till now, the blogger has continued to work !~~

Base64-based unique or string encryption

Encryption

function encode($str,$key){    $res = base64_encode($str);    $code = $res^$key;    return $code;}

Decryption

function decode($str,$key){    return base64_decode($str^$key);}

Complete Code example:

$str = '111021';$key = 'APPYJJ-PHONE-LAZY';function encode($str,$key){    $res = base64_encode($str);    $code = $res^$key;    return $code;}$str = encode($str,$key);print_r($str);echo "";function decode($str,$key){    return base64_decode($str^$key);}print_r(decode($str,$key));
  • The whole program is very simple ~ It should be difficult to crack according to logic thinking. when others do not know your key;

  • If you still feel insecure. So I will discuss it here. we suggest you continue to use the shift operation during encryption and decryption.

// During encryption; $ a = $ str> 4; // The opposite is true for decryption. $ a = $ str <4;

For more information about a newly written PHP encryption/decryption function, please refer to the PHP Chinese website!

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.