diff --git a/File-Encryption.md b/File-Encryption.md new file mode 100644 index 0000000..9672cc4 --- /dev/null +++ b/File-Encryption.md @@ -0,0 +1,61 @@ +The following is the example-file.php which you can run and test yourself, you can change the first define paramenters for the input/outputs + +```php +setEncryptionBlocks(128); // This will take ~10 times more time, but will use half as much memory. +// Really the best value is the default one. + +$enc_start = round(microtime(true) * 1000); + +// Encrypt the file +$lib->encryptFile(INPUT_FILE, OUTPUT_FILE); + +$enc_end = round(microtime(true) * 1000) - $enc_start; +$dec_start = round(microtime(true) * 1000); + +// Decrypt the file as well +$lib->decryptFile(OUTPUT_FILE, DEC_OUTPUT_FILE); + +$dec_end = round(microtime(true) * 1000) - $dec_start; + +/** + * NOTE: You can also compress the output using gzip +*/ + +echo "\n\n"; +echo "Input File Size: " . round(filesize(INPUT_FILE) / 1024 / 1024, 2) . "Mb"; +echo "\n"; +echo "Output File Size: " . round(filesize(OUTPUT_FILE) / 1024 / 1024, 2) . "Mb"; +echo "\n"; +echo "Peak Memory: " . memory_get_peak_usage() / 1024 / 1024 . "Mb"; // Check the memory in Mb +echo "\n"; +echo "Encryption Time: $enc_end ms\n"; // 9700k = ~210ms ( 4Mb = 100ms ) +echo "Decryption Time: $dec_end ms\n"; +echo "\n"; +$errors = $lib->getErrors(); +echo "Errors: " . ( !empty($errors) ? "\n" . json_encode($errors, JSON_PRETTY_PRINT) : "No Errors!"); + +``` \ No newline at end of file