PHP code example of daycry / encryption

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

    

daycry / encryption example snippets


$psr4 = [
    'Config'      => APPPATH . 'Config',
    APP_NAMESPACE => APPPATH,
    'App'         => APPPATH,
    'Daycry\Encryption' => APPPATH .'Libraries/encryption/src',
];

$encryption = new \Daycry\Encryption\Encryption();
$data = $encryption->encrypt( 'data' );
var_dump( $data );

$encryption = new \Daycry\Encryption\Encryption();
$data = $encryption->decrypt( 'data' );
var_dump( $data );


$encryption = new \Daycry\Encryption\Encryption();
$data = $encryption->setCipher( 'AES-256-CTR' )->encrypt( 'data' );
var_dump( $data );


$encryption = new \Daycry\Encryption\Encryption();
$encrypt = $obj->setCipher( 'AES-256-CTR' )->setKey( '%T3sT1nG$' )->encrypt( 'data', true );
var_dump( $data );


var_dump( openssl_get_cipher_methods() );


$result = \Daycry\Encryption\CryptoJsAes::encrypt( "Hello", "123456", true );

$textPlain = \Daycry\Encryption\CryptoJsAes::decrypt( $result );

$result = \Daycry\Encryption\CryptoJsAes::encrypt( "Hello", "123456", false );

$textPlain = \Daycry\Encryption\CryptoJsAes::decrypt( $result, "123456" );

./public/assets


cd vendor\daycry\encryption\
composer install
vendor\bin\phpunit