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

https://github.com/matheusjohannaraujo/simple-aes-256

Simple AES 256 is a PHP class designed to simplify encryption and decryption using AES-256 in CBC or GCM modes.
https://github.com/matheusjohannaraujo/simple-aes-256

aes aes-256 aes-cbc aes-encryption aes-gcm aes256 php php-library php7 php8

Last synced: 5 months ago
JSON representation

Simple AES 256 is a PHP class designed to simplify encryption and decryption using AES-256 in CBC or GCM modes.

Awesome Lists containing this project

README

          

# [Simple AES 256](https://github.com/matheusjohannaraujo/simple-aes-256)

**SimpleAES256** is a PHP class designed to simplify encryption and decryption using AES-256 in CBC or GCM modes.

## πŸ“¦ Installation

You can install the library via [Packagist/Composer](https://packagist.org/packages/mjohann/simple-aes-256):

```bash
composer require mjohann/simple-aes-256
```

## βš™οΈ Requirements

- PHP 8.0 or higher

## πŸš€ Features

- Supported AES 256 CBC and AES 256 GCM:
- `encrypt`
- `decrypt`
- `key`
- `tag`

## πŸ§ͺ Usage Example

### Example AES 256 CBC
```php
encrypt_cbc($text);
$decrypt = $aes->decrypt_cbc($encrypt);

echo "Simple AES 256 CBC", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL, PHP_EOL;
```

### Example AES 256 GCM

```php
encrypt_gcm($text);
$tag = $aes->get_tag();
$decrypt = $aes->decrypt_gcm($encrypt, $tag);

echo "Simple AES 256 GCM", PHP_EOL;
echo "Text: ", $text, PHP_EOL;
echo "Encrypt: ", $encrypt, PHP_EOL;
echo "Tag: ", $tag, PHP_EOL, PHP_EOL;
echo "Decrypt: ", $decrypt, PHP_EOL;
```

For more examples, see the [`example/script.php`](example/script.php) file in the repository.

## πŸ“ Project Structure

```
simple-aes-256/
β”œβ”€β”€ src/
β”‚ └── SimpleAES256.php
β”‚ └── Facades/
β”‚ └── SimpleAES256.php
β”œβ”€β”€ example/
β”‚ └── script.php
β”œβ”€β”€ composer.json
β”œβ”€β”€ .gitignore
β”œβ”€β”€ LICENSE
└── README.md
```

## πŸ“„ License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.

## πŸ‘¨β€πŸ’» Author

Developed by [Matheus Johann AraΓΊjo](https://github.com/matheusjohannaraujo) – Pernambuco, Brazil.