+ Added time to encrypt to the example.php
This commit is contained in:
parent
752dfd0c23
commit
2645ce64fa
12
example.php
12
example.php
|
@ -20,12 +20,20 @@ $kpc = new kpcrypt($config['key']);
|
||||||
|
|
||||||
echo "Key: " . $kpc->getKey() . " \n";
|
echo "Key: " . $kpc->getKey() . " \n";
|
||||||
|
|
||||||
|
$enc_start = round(microtime(true) * 1000);
|
||||||
|
|
||||||
// Echo out the results
|
// Echo out the results
|
||||||
$encryptedData = $kpc->encryptData($config['input'], 'AES-256-CBC', TRUE);
|
$encryptedData = $kpc->encryptData($config['input'], 'AES-256-CBC', TRUE);
|
||||||
|
|
||||||
|
$enc_end = round(microtime(true) * 1000) - $enc_start;
|
||||||
|
|
||||||
|
$dec_start = round(microtime(true) * 1000);
|
||||||
echo "Encrypted: " . limitStringSize($encryptedData);
|
echo "Encrypted: " . limitStringSize($encryptedData);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "Decrypted: " . limitStringSize($kpc->decryptData($encryptedData));
|
echo "Decrypted: " . limitStringSize($kpc->decryptData($encryptedData));
|
||||||
|
|
||||||
|
$dec_end = round(microtime(true) * 1000) - $dec_start;
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo "Peak Memory: " . memory_get_peak_usage() / 1024 / 1024 . "Mb"; // Check the memory in kb
|
echo "Peak Memory: " . memory_get_peak_usage() / 1024 / 1024 . "Mb"; // Check the memory in kb
|
||||||
echo "\n\n";
|
echo "\n\n";
|
||||||
|
@ -37,5 +45,9 @@ $outputSize = strlen($encryptedData); // Bytes
|
||||||
// Echo out sizing information
|
// Echo out sizing information
|
||||||
echo "Sizeof input: " . strlen($config['input']) . "\n"; // Bytes
|
echo "Sizeof input: " . strlen($config['input']) . "\n"; // Bytes
|
||||||
echo "Sizeof output:" . strlen($encryptedData) . "\n"; // Bytes
|
echo "Sizeof output:" . strlen($encryptedData) . "\n"; // Bytes
|
||||||
|
echo "\n";
|
||||||
|
echo "Encryption Time: $enc_end ms\n"; // 9700k = ~210ms
|
||||||
|
echo "\n";
|
||||||
|
echo "Decryption Time: $dec_end ms\n";
|
||||||
|
|
||||||
echo "\n";
|
echo "\n";
|
Reference in New Issue