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

https://github.com/shetabit/aes

Encrypt and Decrypt data with AES algorithm
https://github.com/shetabit/aes

aes algorithm decrypt decryption encrypt encryption php

Last synced: about 2 months ago
JSON representation

Encrypt and Decrypt data with AES algorithm

Awesome Lists containing this project

README

        

# AES

[![Maintainability](https://api.codeclimate.com/v1/badges/73cc51ddaf4d700cecd1/maintainability)](https://codeclimate.com/github/shetabit/AES/maintainability)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/shetabit/AES/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/shetabit/AES/?branch=master)
[![StyleCI](https://github.styleci.io/repos/116474325/shield?branch=master)](https://github.styleci.io/repos/116474325)

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