PHP code example of jnativel / encryption

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

    

jnativel / encryption example snippets



yption = new jnativel\Encryption\Encryption();
$password = $encryption->generateKey(16, true, true, true);
var_dump($password);


erKey = "my-secret-key";
$encryption = new jnativel\Encryption\Encryption();
$password = $encryption->generateKey();
$str_encrypt = $encryption->encrypt($password, $masterKey);
$str_decrypt = $encryption->decrypt($str_encrypt, $masterKey);
var_dump($encryption->getMasterKey());
var_dump($str_encrypt);
var_dump($str_decrypt);


erKey = "my-secret-key";
$secret = "my-secret-string";
$encryption = new jnativel\Encryption\Encryption($masterKey);
$str_encrypt = $encryption->encrypt($secret);
$str_decrypt = $encryption->decrypt($str_encrypt);
var_dump($encryption->getMasterKey());
var_dump($str_encrypt);
var_dump($str_decrypt);