PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Name Removed   PHP AES-128-CBC Encryption and Decryption   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: PHP AES-128-CBC Encryption and Decryption
Encrypt and decrypt data using mcrypt
Author: By
Last change: Made the source code more clear.
Date: 5 years ago
Size: 624 bytes


Class file image Download

*** @ 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().


$decrypted = $aes->decrypt();

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

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