I am trying to use the mycrypt php library to decrypt the following:
Key: aaaaaaaabbbbbbbbccccccccdddddddd
Data: b5057bbc04b842a96144a0f617f2820e
Expected Result: Test123123
The data is encrypted with 3DES with the mode ECB. The code I'm currently working with decrypts the hex value to "e2119b734b5050e3" which translates to "â›sKPPã". I have tried using open ssl which is returning "False".
The code is as follows:
(PHP Version 5.3.3)
$key = 'aaaaaaaabbbbbbbbccccccccdddddddd';
$key = pack('H*',$key);
// DATA
$data = 'b5057bbc04b842a96144a0f617f2820e';
$data = pack('H'.strlen($key),$data);
// DECRYPT MCRYPT
$data = rtrim(mcrypt_decrypt(MCRYPT_3DES, $key, $data, MCRYPT_MODE_ECB), "\0");
$decryptedHex = unpack('H*',$data);
// DECRYPT OPEN SSL (RETURNS FALSE)
$result = openssl_decrypt($data,'des-ede3', $key);
// ECHO
echo $decryptedHex[1];