PHP Classes

PHP AES-128-CBC Encryption and Decryption: Encrypt and decrypt data using mcrypt

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 676 This week: 1All time: 4,792 This week: 47Up
Version License PHP version Categories
php-aes-128-cbc 1.0.0BSD License5PHP 5, Cryptography
Description 

Author

This class can encrypt and decrypt data using mcrypt.

It can encrypt data with a given key or generates a random key to encrypt the data using mcrypt. It also encodes the data before encrypting.

The class can also decrypt previously encrypted data with the class.

Picture of Name Removed
  Performance   Level  
Name: Name Removed <contact>
Classes: 4 packages by
Country: ???
Age: ???
All time rank: 2023
Week rank: 37 Up

Example

<?php

/****
****
*** @ PHP AES-128-CBC class
*** @ Developed by Takis Maletsas
****
****/

require "aes.class.php";

$aes = new AES;
$aes->setData("Hello world !");

$encrypted = $aes->encrypt();

//You can use setKey() and setIV() in the encryption process.
//If you don't, the class will produce random key and IV.
//You can get them with getKey() and getIV().

$aes->setKey($aes->getKey());
$aes->setIV($aes->getIV());
$aes->setData($encrypted);

$decrypted = $aes->decrypt();

echo
$encrypted . "<br/>" . $decrypted;

//Encrypted: hibcqPrxD0rv2E5b5/LzYQ==
//Decrypted: Hello world !

?>


  Files folder image Files (2)  
File Role Description
Plain text file aes.class.php Class Source
Accessible without login Plain text file example.php Example Example

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:676
This week:1
All time:4,792
This week:47Up
 User Ratings  
 
 All time
Utility:93%StarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:483