PHP code example of zqhong / encrypter

1. Go to this page and download the library: Download zqhong/encrypter 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/ */

    

zqhong / encrypter example snippets




Zqhong\Encrypter\Encrypter;

$key = 'password';
$cipher = 'RC4-MD5';
$plainText = 'hello world';
$encrypter = new Encrypter($key, $cipher);

$payload = $encrypter->encryptString($plainText);
echo $payload . PHP_EOL;
echo $encrypter->decryptString($payload) . PHP_EOL;

// will output
//eyJpdiI6IiIsInZhbHVlIjoiMDIxR1dXcHg4K21yR2RBPSIsIm1hYyI6ImRhYzFjYWFjODg5ODA1MWFlMWE0OTZmYTNjMTlkYWIxNDExZjAzYzU2ZjlhM2FmMTY1ZWYwYjFkYTJiZjJkNjgifQ==
//hello world