* Fixed a bug in the library

* Fixed the example.php to work with the new OOP style
This commit is contained in:
2021-02-28 11:07:51 +02:00
parent 5ae3d8294b
commit e5f7264803
2 changed files with 13 additions and 6 deletions

View File

@@ -16,12 +16,16 @@ function limitStringSize($str, $amount = 20) {
return $str;
}
$kpc = new kpcrypt($config['key']);
echo "Key: " . $kpc->getKey() . " \n";
// Echo out the results
$encryptedData = encryptData($config['input'], $config['key'], 'AES-256-CBC', TRUE);
$encryptedData = $kpc->encryptData($config['input'], 'AES-256-CBC', TRUE);
echo "Encrypted: " . limitStringSize($encryptedData);
echo "\n";
echo "Decrypted: " . limitStringSize(decryptData($encryptedData, $config['key']));
echo "Decrypted: " . limitStringSize($kpc->decryptData($encryptedData));
echo "\n";
echo "Peak Memory: " . memory_get_peak_usage() / 1024 / 1024 . "Mb"; // Check the memory in kb
echo "\n\n";