Login   Register  
PHP Classes
elePHPant
Icontem

File: test3.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcin Wisniowski  >  AES Cipher  >  test3.php  >  Download  
File: test3.php
Role: Example script
Content type: text/plain
Description: AESCipher Example
Class: AES Cipher
Encrypt and decrypt data with AES in pure PHP
Author: By
Last change:
Date: 2008-05-11 08:32
Size: 814 bytes
 

Contents

Class file image Download
<?php
include_once('./AES.class.php');
include_once(
'./AESCipher.class.php');
$password 'My secret password';
$input 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
$Cipher = new AESCipher(AES::AES256); 
print(
'input:  '.$input.'<br />');
print(
'key:    '.$password.'<br />');
$start microtime(true);
$cryptext $Cipher->encrypt($input$password);
$end microtime(true);
print(
'AESCipher Class encryption time (256bit): '.(($end $start)*1000).'ms <br />');
print 
'cryptext: '.$cryptext.'<br />';
$start microtime(true);
$output $Cipher->decrypt($cryptext$password);
$end microtime(true);
print(
'AESCipher Class decryption time (256bit): '.(($end $start)*1000).'ms <br />');
print 
'message: '.$output.'<br />'

?>