My personal blog. https://blog.airikr.me
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
599 B

<?php
// include 'src/class.ncrypt.php'; // un-comment this if needed
$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
// encrypt a plain text/string
$encrypted = $ncrypt->encrypt( 'Hello World!' ); // output: SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09
// decrypt an encrypted string to it's original plain text/string
$decrypted = $ncrypt->decrypt( 'SFpQVWk0WjFxdW5lSGFXaUdWUEx3Zz09' ); // output: Hello World!