+ README.md\n+ example.php\n + license
This commit is contained in:
18
lib.php
18
lib.php
@@ -1,12 +1,4 @@
|
||||
<?php
|
||||
|
||||
// The key to use in the encryption
|
||||
$key = "my Key";
|
||||
|
||||
// The string to encrypt, this can be any string.
|
||||
$string = "Super secret password we should store away safely";
|
||||
|
||||
|
||||
/**
|
||||
* @param string $data The data to be encrypted, this can only encrypt strings.
|
||||
* @param string $key The key to use to encrypt the data, this key should be generated using the openssl_random_pseudo_bytes
|
||||
@@ -85,12 +77,4 @@ function decryptData( string $data, string $key, string $cipherMethod = 'AES-256
|
||||
|
||||
// Return the data
|
||||
return $data;
|
||||
}
|
||||
|
||||
$encryptedData = encryptData($string, $key);
|
||||
|
||||
echo "Encrypted: " . $encryptedData;
|
||||
echo "\n";
|
||||
echo "Decrypted: " . decryptData($encryptedData, $key);
|
||||
echo "\n";
|
||||
echo "Peak Memory: " . memory_get_peak_usage() / 1024 . "Kb";
|
||||
}
|
||||
Reference in New Issue
Block a user