Skip to content

Commit

Permalink
feat: README
Browse files Browse the repository at this point in the history
  • Loading branch information
clphillips committed Jun 5, 2017
1 parent c5ad909 commit a64a7fb
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ php:
before_script:
- composer install --dev
script:
- ./vendor/bin/phpunit --coverage-text
- ./vendor/bin/phpunit
- ./vendor/bin/phpcs --extensions=php --report=summary --standard=PSR2 ./src ./tests
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# PhpAes

[![Build Status](https://travis-ci.org/phillipsdata/phpaes.svg?branch=master)](https://travis-ci.org/phillipsdata/phpaes)

FIPS-192 compliant AES cipher.

### Supported key lengths:
- 128 bits
- 192 bits
- 256 bits

### Support block modes:

- ECB: Electronic Code Book
- CBC: Cipher Block Chaining
- CFB: Cipher Feedback
- OFB: Output Feedback

### Supported padding schemes:

- null byte (0x00)


## Installation

Install via composer:

```sh
composer require phpaes/phpaes
```

## Basic Usage

```php
use PhpAes\Aes;

$aes = new Aes('abcdefgh01234567', 'CBC', '1234567890abcdef');

$y = $aes->encrypt('hello world!');
$x = $aes->decrypt($y);

echo base64_encode($y);
echo $x;
```
16 changes: 0 additions & 16 deletions README.txt

This file was deleted.

6 changes: 3 additions & 3 deletions src/Aes.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ public function decrypt($y)

switch ($this->mode) {
case 'ECB':
for ($i=0; $i<$ysize; $i+=16) {
for ($j=0; $j<16; $j++) {
if (($i+$j)<$ysize) {
for ($i = 0; $i < $ysize; $i += 16) {
for ($j = 0; $j < 16; $j++) {
if (($i+$j) < $ysize) {
$t[$j] = $y[$i+$j];
} else {
$t[$j] = chr(0);
Expand Down

0 comments on commit a64a7fb

Please sign in to comment.