承接 noprotocol/php-mysql-aes-crypt 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

noprotocol/php-mysql-aes-crypt

最新稳定版本:v2.0.2

Composer 安装命令:

composer require noprotocol/php-mysql-aes-crypt

包简介

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

README 文档

README

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

Build Status Scrutinizer Code Quality Code Coverage

Change log

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;

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.

<?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.

<?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.

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

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

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.:

php benchmarks/benchmarks.php 20000

to run 20000 items. If no number is given, it defaults to 10000 items.

You can also optionally set the desired encryption method for example:

php benchmarks/benchmarks.php 20000 AES-256-ECB

Testing

PHPunit test cases are provided in /tests.

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

统计信息

  • 总下载量: 83.35k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 24
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 23
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-29