An open API service indexing awesome lists of open source software.

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

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}
";
```