+ Started implementing the file encryption
+ File encryption
This commit is contained in:
26
example-file.php
Normal file
26
example-file.php
Normal 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())
|
||||
Reference in New Issue
Block a user