PHP code example of rasalas / easycrypt

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

    

rasalas / easycrypt example snippets



// import
as\Tools\EasyCrypt('supersecurepassphrase', 'saltandpepper');

// test data
$data = ['user_id'=>'12','firstname'=>'John', 'lastname'=>'Doe'];

// encrypt
$crypt = $ez->encrypt($data);
 
// decrypt
$decrypted = $ez->decrypt($crypt);

// print the array in a human readable format
echo '<pre>' . json_encode($decrypted, JSON_PRETTY_PRINT) . '</pre>';

// encrypt
$crypt = $ez->encrypt($data, URL_SAFE);
 
// decrypt
$decrypted = $ez->decrypt($crypt, URL_SAFE);