intrd/php-mcrypt256cbc

PHP - Secure Encryption & Decryption Made Easy with PHP, MCrypt, Rijndael-256, and CBC

1.0.x-dev 2016-05-19 14:21 UTC

This package is not auto-updated.

Last update: 2024-04-13 16:34:49 UTC


README

PHP - Secure Encryption & Decryption Made Easy with PHP, MCrypt, Rijndael-256, and CBC
Package intrd/php-mcrypt256cbc
Version 1.0
Tags php, encryption, mcrypt, 256bits, cbc, rijndael
Project URL http://github.com/intrd/php-mcrypt256cbc
Author intrd (Danilo Salles) - http://dann.com.br
Author Originally developed by Joshhartman - http://www.warpconduit.net/2013/04/14/highly-secure-data-encryption-decryption-made-easy-with-php-mcrypt-rijndael-256-and-cbc/
Copyright (CC-BY-SA-4.0) 2016, intrd
License Creative Commons Attribution-ShareAlike 4.0
Dependencies • php >=5.3.0

System & Composer installation

$ sudo apt-get update & apt-get upgrade
$ sudo apt-get install curl php-curl php-cli php-mcrypt
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Usage sample

Assuming your project are running over Composer PSR-4 defaults, simply Require it on your composer.json

"require": {
    "intrd/php-mcrypt256cbc": ">=1.0.x-dev <dev-master"
}

And run..

$ composer install -o #to install
$ composer update -o #to update

Always use -o to rebuild autoload.

Now Composer Autoload will instance the class and you are able to use by this way..

require __DIR__ . '/vendor/autoload.php';
use php\mcrypt256cbc as cry;

if (!defined('ENCRYPTION_KEY')) define('ENCRYPTION_KEY', "12345677378111147486847454344411"); //set your private key

$test="yeah it works!";
$text=cry::mc_encrypt($text,ENCRYPTION_KEY); //encrypt $text using defined privatekey
echo $text; //show encrypted text

$text=cry::mc_decrypt($text,ENCRYPTION_KEY); //decrypt $text using defined privatekey
echo $text; //show plaintext