From 2645ce64fa74481f00723b513f143bfa2ac3a99b Mon Sep 17 00:00:00 2001 From: Kato Twofold Date: Sun, 28 Feb 2021 13:56:50 +0200 Subject: [PATCH] + Added time to encrypt to the example.php --- example.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/example.php b/example.php index c6e8a26..321e717 100644 --- a/example.php +++ b/example.php @@ -20,12 +20,20 @@ $kpc = new kpcrypt($config['key']); echo "Key: " . $kpc->getKey() . " \n"; +$enc_start = round(microtime(true) * 1000); + // Echo out the results $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 "\n"; echo "Decrypted: " . limitStringSize($kpc->decryptData($encryptedData)); + +$dec_end = round(microtime(true) * 1000) - $dec_start; + echo "\n"; echo "Peak Memory: " . memory_get_peak_usage() / 1024 / 1024 . "Mb"; // Check the memory in kb echo "\n\n"; @@ -37,5 +45,9 @@ $outputSize = strlen($encryptedData); // Bytes // Echo out sizing information echo "Sizeof input: " . strlen($config['input']) . "\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"; \ No newline at end of file