-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenssl_example.php
More file actions
executable file
·47 lines (39 loc) · 1.36 KB
/
openssl_example.php
File metadata and controls
executable file
·47 lines (39 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/*
* Copyright (c) 2025 Bloxtor (http://bloxtor.com) and Joao Pinto (http://jplpinto.com)
*
* Multi-licensed: BSD 3-Clause | Apache 2.0 | GNU LGPL v3 | HLNC License (http://bloxtor.com/LICENSE_HLNC.md)
* Choose one license that best fits your needs.
*
* Original PHP Encryption Lib Repo: https://github.com/a19836/php-encryption-lib/
* Original Bloxtor Repo: https://github.com/a19836/bloxtor
*
* YOU ARE NOT AUTHORIZED TO MODIFY OR REMOVE ANY PART OF THIS NOTICE!
*/
#shell:$ php openssl_example.php
include __DIR__ . "/OpenSSLCipherHandler.php";
echo "<pre>";
$salt = "some string here. whatever you want!!!";
$text = "some message to be encrypted";
echo "\n**** SIMPLE TEXT TO ENCRYPT ****";
$cipher_text = OpenSSLCipherHandler::encryptText($text, $salt);
$decrypted_text = OpenSSLCipherHandler::decryptText($cipher_text, $salt);
echo "
salt: $salt
text: $text
cipher_text: $cipher_text
decrypted_text: $decrypted_text
";
echo "\n**** ARRAY TO ENCRYPT ****";
$var = array(
"text1" => "some message 1 to be encrypted",
"text2" => "some text 2 to be encrypted",
);
$cipher_var = OpenSSLCipherHandler::encryptVariable($var, $salt);
$decrypted_var = OpenSSLCipherHandler::decryptVariable($cipher_var, $salt);
echo "\nsalt: $salt";
echo "\nvar:";print_r($var);
echo "\ncipher_var:";print_r($cipher_var);
echo "\ndecrypted_var:";print_r($decrypted_var);
echo "</pre>";
?>