https://github.com/hamog/aes
Encrypt and Decrypt data with AES algorithm
https://github.com/hamog/aes
aes aes-encryption decryption encryption initialization iv php vector
Last synced: 7 months ago
JSON representation
Encrypt and Decrypt data with AES algorithm
- Host: GitHub
- URL: https://github.com/hamog/aes
- Owner: hamog
- Created: 2018-01-06T10:34:31.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T10:26:20.000Z (almost 7 years ago)
- Last Synced: 2025-06-19T05:08:24.422Z (7 months ago)
- Topics: aes, aes-encryption, decryption, encryption, initialization, iv, php, vector
- Language: PHP
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AES
Encrypt and Decrypt data with AES algorithm with PHP
## Feature
* Set manually iv suitable for static inialization vector (IV)
* Set randomly iv (Recomended)
## Example (Static IV)
```PHP
require "AES.php";
$aes = new AES(
'WR7rLKlVvJdEAIzHUMpt4dcEKsXPinIU2KiWzm++bhg=',
'AES-256-CBC',
'NJ0oI9P1fytagUfPny3qTA=='
);
$plainText = "Please, encrypt me!";
$encrypted = $aes->encrypt($plainText);
echo "Encrypted : {$encrypted}
";
$decrypted = $aes->decrypt($encrypted);
echo "Decrypted : {$decrypted}
";
```
## Example (Dynamic IV)
```PHP
require "AES.php";
$aes = new AES(
'WR7rLKlVvJdEAIzHUMpt4dcEKsXPinIU2KiWzm++bhg=',
'AES-256-CBC'
);
$plainText = "Please, encrypt me!";
$encrypted = $aes->encrypt($plainText);
echo "Encrypted : {$encrypted}
";
$decrypted = $aes->decrypt($encrypted, true);
echo "Decrypted : {$decrypted}
";
```