<?php
$encryption_key="adfgjderuspmwzwt";
$encryptedText = "02eftQAHQKejcfMJYbm06GD21HqFCj55uhAMLqbdGEONSHWLVMn1dIchgEFCNZvCSW7oPM44qyqQ";
$key="adfgjderuspmwzwt";
$data = "02eftQAHQKejcfMJYbm06GD21HqFCj55uhAMLqbdGEONSHWLVMn1dIchgEFCNZvCSW7oPM44qyqQ";
/*$encryptionMethod = "AES-256-CBC";
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($encryptionMethod));
$encrypted = $encryptedText . ':' . $iv;
$parts = explode(':', $encrypted);
$decrypted = openssl_decrypt($parts[0], $encryptionMethod, $encryption_key, 0, $parts[1]);
echo "Decrypted: $decrypted\n";*/
/*function decrypt($data, $key)
{
$decode = base64_decode($data);
return mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$decode,"MCRYPT_MODE_CBC","\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
}
decrypt($data, $key);*/
print("-- Start --<br />");
include("AES.class.php");
$z = $_POST['adfgjderuspmwzwt'];
$data = $_POST['plaintext'];
$mode = $_POST['CBC'];
$iv = $_POST['1234567890abcdef'];
$aes = new AES($z, $mode, $iv);
$starte = microtime(true);
$encrypted = $aes->encrypt($data);
$ende = microtime(true);
print "Execution time to encrypt: " . ($ende - $starte) . " seconds<br />";
print "Cipher-Text: " . $encrypted . "<br />";
print "Hex: " . bin2hex($encrypted) . "<br />";
print "Base 64: " . base64_encode($encrypted) . "<br /><br />";
$startd = microtime(true);
$decrypted = $aes->decrypt($encryptedText);
$endd = microtime(true);
print "Execution time to decrypt: " . ($endd - $startd) . " seconds<br />";
print "Decrypted-Text: " . stripslashes($decrypted);
print "<br />-- End --<br />";
preferences:
41.69 ms | 407 KiB | 5 Q