<?php
/****
****
*** @ PHP AES-128-CBC class
*** @ Developed by Takis Maletsas
****
****/
require "aes.class.php";
$aes = new AES;
$aes->setData("Hello world !");
$encrypted = $aes->encrypt();
//You can use setKey() and setIV() in the encryption process.
//If you don't, the class will produce random key and IV.
//You can get them with getKey() and getIV().
$aes->setKey($aes->getKey());
$aes->setIV($aes->getIV());
$aes->setData($encrypted);
$decrypted = $aes->decrypt();
echo $encrypted . "<br/>" . $decrypted;
//Encrypted: hibcqPrxD0rv2E5b5/LzYQ==
//Decrypted: Hello world !
?>
|