PHP code example of mukto90 / ncrypt

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

    

mukto90 / ncrypt example snippets






$ncrypt = new mukto90\Ncrypt;

$ncrypt->set_secret_key( '^&-my-key-&^' );  // optional, but STRONGLY recommended
$ncrypt->set_secret_iv( '#@)-my-iv-#*$' );  // optional, but STRONGLY recommended
$ncrypt->set_cipher( 'AES-256-CBC' );       // optional

$encrypted = $ncrypt->encrypt( 'Hello World!' ); // output: SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09

$decrypted = $ncrypt->decrypt( 'SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09' ); // output: Hello World!