Here is a post similar to the one above, except this works for AES256
256 bit key and 128 bit block size... just make sure the $key variable is at least 48 characters long
---- PERL ---
my $key = '12345678901234567890123456789012345678901234567890';
my $CC = '4007000000027';
# You need Crypt::Rijndael installed for this to work
use Crypt::CBC;
my $cipher = Crypt::CBC->new( {'key' => substr($key,0,32),
'cipher'=> 'Rijndael',
'iv' => substr($key,32,16),
'regenerate_key' => 0,
'padding' => 'null',
'prepend_iv' => 0
});
my $encrypted = $cipher->encrypt($CC);
print "encrypted : ".$encrypted."\n";
print "decrypted : ".$cipher->decrypt($encrypted)."\n";
--- PHP ---
$key = '123456789012345678901234567890123456789012345678901234567890';
$CC = '4007000000027';
$encrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128,substr($key,0,32) ,$CC,MCRYPT_ENCRYPT,substr($key,32,16));
$decrypted = mcrypt_cbc(MCRYPT_RIJNDAEL_128,substr($key,0,32) ,$encrypted,MCRYPT_DECRYPT,substr($key,32,16));
echo "encrypted : ".bin2hex($encrypted);