All Projects → noprotocol → php-mysql-aes-crypt

noprotocol / php-mysql-aes-crypt

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

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-mysql-aes-crypt

Crypter
Crypter in Python 3 with advanced functionality, Bypass VM, Encrypt Source with AES & Base64 Encryption | Evil Code is executed by bruteforcing the decryption key, and then executing the decrypted evil code
Stars: ✭ 125 (+495.24%)
Mutual labels:  aes-encryption
aes-stream
A fast AES-PRF based secure random-number generator
Stars: ✭ 15 (-28.57%)
Mutual labels:  aes-128
cryptalk
HTML5/Node.js based, client side (E2EE) encrypted instant chat
Stars: ✭ 73 (+247.62%)
Mutual labels:  aes-encryption
Securedefaults
A lightweight wrapper over UserDefaults/NSUserDefaults with an additional layer of AES-256 encryption
Stars: ✭ 179 (+752.38%)
Mutual labels:  aes-encryption
stenc
SCSI Tape Encryption Manager - stenc (formerly on https://sourceforge.net/projects/stenc/)
Stars: ✭ 41 (+95.24%)
Mutual labels:  aes-128
mbedcrypto
a portable, small, easy to use and fast c++14 library for cryptography.
Stars: ✭ 38 (+80.95%)
Mutual labels:  aes-encryption
Hat.sh
encrypt and decrypt files in your browser. Fast, Secure client-side File Encryption and Decryption using the web crypto api
Stars: ✭ 886 (+4119.05%)
Mutual labels:  aes-encryption
Ransom
Various codes related to Ransomware Developement
Stars: ✭ 119 (+466.67%)
Mutual labels:  aes-encryption
Rijndael256
AES cryptographic library for .NET Framework and .NET Core
Stars: ✭ 33 (+57.14%)
Mutual labels:  aes-128
CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-14.29%)
Mutual labels:  aes-encryption
Aescipher Ios
AES encryption working between Objective-C and Java.
Stars: ✭ 198 (+842.86%)
Mutual labels:  aes-encryption
Armadillo
A shared preference implementation for confidential data in Android. Per default uses AES-GCM, BCrypt and HKDF as cryptographic primitives. Uses the concept of device fingerprinting combined with optional user provided passwords and strong password hashes.
Stars: ✭ 226 (+976.19%)
Mutual labels:  aes-encryption
SecureSnaps
Image Codec using Private-key cryptography
Stars: ✭ 13 (-38.1%)
Mutual labels:  aes-encryption
Cross Platform Aes
Simple cross-platform encryption and decryption using AES
Stars: ✭ 127 (+504.76%)
Mutual labels:  aes-encryption
aesCbc
aes-cbc加密解密
Stars: ✭ 68 (+223.81%)
Mutual labels:  aes-128
Cryptr
A simple shell utility for encrypting and decrypting files using OpenSSL.
Stars: ✭ 81 (+285.71%)
Mutual labels:  aes-encryption
img-cryptor
Image AES256 crypt-decrypt
Stars: ✭ 37 (+76.19%)
Mutual labels:  aes-encryption
Android-hls
最近公司产品需要,调研hls(m3u8) aes-128 解密播放 . 分析 51Cto, 慕课
Stars: ✭ 73 (+247.62%)
Mutual labels:  aes-128
pixcryption
📷 Pixel Safe Encryption - Now Cryptographically Secure 🔒
Stars: ✭ 56 (+166.67%)
Mutual labels:  aes-encryption
pagecrypt
Password Protected Single Page Applications and HTML files
Stars: ✭ 124 (+490.48%)
Mutual labels:  aes-encryption

PHP MySQL AES encrypt/decrypt

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/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].