+ Started implementing the file encryption

+ File encryption
This commit is contained in:
2021-02-28 13:34:12 +02:00
parent e2e770dcfe
commit a5923c43e4
3 changed files with 200 additions and 70 deletions

26
example-file.php Normal file
View File

@@ -0,0 +1,26 @@
<?php
require("./lib.php");
/**
* This is a simple example of how to encrypt files with the library
* The following code will read the file in chunks instead of loading
* the whole thing in memory, trying to keep the "Peak Memory Usage"
* as low as possible.
*/
define("INPUT_FILE", "./example.php");
define("OUTPUT_FILE", "./example.enc.php");
define("DEC_OUTPUT_FILE", "./example.dec.php");
// Initialize the class
$lib = new kpcrypt();
// Encrypt the file
$lib->encryptFile(INPUT_FILE, OUTPUT_FILE);
// Decrypt the file as well
$lib->encryptFile(OUTPUT_FILE, DEC_OUTPUT_FILE);
echo "Errors: \n";
print_r($lib->getErrors())