PHP code example of opqnext / xor-encryption

1. Go to this page and download the library: Download opqnext/xor-encryption library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

opqnext / xor-encryption example snippets




// 实例化类
$xor = new XorEncryption\XorEncryption();

// 要加密的字符串
$str = "opqnext";

// XOR加密
$secret = $xor->encode($str);
echo $secret."\n";

// XOR解密
$str = $xor->decode($secret);
echo $str."\n";



$key = "2fc2b4aaa8d087af4d6dc085f3316c0a";

// 实例化类
$xor = new XorEncryption\XorEncryption($key);

// 要加密的字符串
$str = "opqnext";

// XOR加密
$secret = $xor->encode($str);
echo $secret."\n";

// XOR解密
$str = $xor->decode($secret);
echo $str."\n";