Skip to content

Commit 26a39d3

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 459c96a + 42c63fa commit 26a39d3

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

README.md

+52-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
11
# php_encryption
2-
It allows you to encrypt your texts and then decrypt the encrypted data.
2+
It allows you to encrypt your texts and then decrypt the encrypted data. **In order to use this class, you must have openssl extension on your PHP server.**
3+
4+
For some methods you can use, visit: https://www.php.net/manual/en/function.openssl-get-cipher-methods.php
5+
6+
## **Configuration**
7+
The class must be configured in order to run.
8+
9+
###### **Configuration Example**
10+
```php
11+
$Security = new php_encryption([
12+
'method' => 'AES-128-CBC', // Encryption method
13+
'key' => 'SuperKey', // Key
14+
'secret' => 'SuperSecret' // Secret Key
15+
]);
16+
```
17+
**IMPORTANT: The texts that you have encrypted with the Key and Secret keys you have determined can only be decrypted with these keys. You cannot decrypt the text you encrypt with a key other than the keys you used to encrypt it.**
18+
19+
## **Encrypt($data)**
20+
It allows you to encrypt a text.
21+
22+
###### **Encrypt() Example**
23+
```php
24+
$Security = new php_encryption([
25+
'method' => 'AES-128-CBC', // Encryption method
26+
'key' => 'SuperKey', // Key
27+
'secret' => 'SuperSecret' // Secret Key
28+
]);
29+
30+
$Encrypt = $Security->Encrypt('test');
31+
echo $Encrypt; // Encrypted Output: uqGYuVLjeAG7l0TQ50khFQ==
32+
```
33+
34+
## **Decrypt($data)**
35+
It allows you to decrypt the encrypted text.
36+
37+
###### **Configuration Example**
38+
```php
39+
$Security = new php_encryption([
40+
'method' => 'AES-128-CBC', // Encryption method
41+
'key' => 'SuperKey', // Key
42+
'secret' => 'SuperSecret' // Secret Key
43+
]);
44+
45+
// Encrypt
46+
$Encrypt = $Security->Encrypt('test');
47+
echo $Encrypt; // Encrypted Output: uqGYuVLjeAG7l0TQ50khFQ==
48+
49+
// Decrypt
50+
$Decrypt = $Security->Decrypt($Encrypt);
51+
echo $Decrypt; // "uqGYuVLjeAG7l0TQ50khFQ==" decrypted data: test
52+
```
53+
**IMPORTANT: The texts that you have encrypted with the Key and Secret keys you have determined can only be decrypted with these keys. You cannot decrypt the text you encrypt with a key other than the keys you used to encrypt it.**

0 commit comments

Comments
 (0)