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
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-02-01 20:58:25 UTC
README
PHP - Secure Encryption & Decryption Made Easy with PHP, MCrypt, Rijndael-256, and CBCSystem & 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