2017 © Pedro Peláez
 

library php-mysql-aes-crypt

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

image

noprotocol/php-mysql-aes-crypt

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  • Monday, June 25, 2018
  • by bfanger
  • Repository
  • 4 Watchers
  • 7 Stars
  • 5,196 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 7 Versions
  • 17 % Grown

The README.md

PHP MySQL AES encrypt/decrypt

Encrypt/decrypt values in PHP which are compatible with MySQL's aes_encrypt() & aes_decrypt() functions. 1, (*1)

Build Status Scrutinizer Code Quality Code Coverage, (*2)

Change log, (*3)

Installation

With Composer

$ composer require noprotocol/php-mysql-aes-crypt
{
    "require": {
        "noprotocol/php-mysql-aes-crypt": "^2.0.0"
    }
}
<?php
require 'vendor/autoload.php';

use NoProtocol\Encryption\MySQL\AES\Crypter;

, (*4)

Without Composer

Please use Composer. If you need to install manually, download Crypter.php from the repository and save the file into your project path., (*5)

<?php
require 'path/to/Cryper.php';

use NoProtocol\Encryption\MySQL\AES\Crypter;

Usage

Create a new instance of the class with a string which will be used as the key for the crypting process. Run encrypt() or decrypt() to encrypt/decrypt your data., (*6)

<?php
use NoProtocol\Encryption\MySQL\AES\Crypter;

// create a new instance
$crypter = new Crypter('mykeystring');

// encrypt a piece of data
$encrypted = $crypter->encrypt('foobar');

// decrypt a piece of data
$decrypted = $crypter->decrypt($encrypted);

Using a different encryption method is possible too when so desired., (*7)

$crypter = new Crypter('mykeystring', 'AES-256-ECB');

NB: This is only tested for AES-128-ECB (default), AES-192-ECB and AES-256-ECB, (*8)

Benchmark

A benchmark is provided in /benchmarks/benchmarks.php. You can set the number of items to run by passing a number as an argument, e.g.:, (*9)

php benchmarks/benchmarks.php 20000, (*10)

to run 20000 items. If no number is given, it defaults to 10000 items., (*11)

You can also optionally set the desired encryption method for example:, (*12)

php benchmarks/benchmarks.php 20000 AES-256-ECB, (*13)

Testing

PHPunit test cases are provided in /tests., (*14)


1As outlined in http://www.smashingmagazine.com/2012/05/replicating-mysql-aes-encryption-methods-with-php/ , (*15)

The Versions

25/06 2018

dev-master

9999999-dev

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

25/06 2018

dev-scrutinizer-patch-2

dev-scrutinizer-patch-2

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

25/06 2018

v2.0.1

2.0.1.0

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

18/04 2018

dev-analysis-8LQYOk

dev-analysis-8LQYOk

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

18/04 2018

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

18/04 2018

v2.0.0

2.0.0.0

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer
by Renan Martins Pimentel

php mysql encryption aes decryption noprotocol

29/09 2016

v1.0.0

1.0.0.0

Encrypt/decrypt data in PHP to a format compatible with MySQL AES_ENCRYPT & AES_DECRYPT functions.

  Sources   Download

MIT

The Development Requires

by Govert Verschuur
by Anne Jan Brouwer

php mysql encryption aes decryption noprotocol