27 lines
646 B
PHP
27 lines
646 B
PHP
|
<?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())
|