So i've been working at this function and i'm not sure what's wrong.
I get encrypted data and key:
$key = 'aaaaaaaabbbbbbbbccccccccdddddddd';
$data = 'b5057bbc04b842a96144a0f617f2820e';
I've gone and converted them into binary:
$key = pack('H*',$key);
$data = pack('H*',$data);
And ran the decryption function:
echo bin2hex(mcrypt_decrypt(Mcrypt_3des, $key, $data, MCRYPT_MODE_ECB));
However what I get returned is this : e2119b734b5050e3fa8717ee17f3a548
But if I run the same decryption on http://tripledes.online-domain-tools.com/ or http://www.emvlab.org/descalc/?key=aaaaaaaabbbbbbbbccccccccdddddddd&iv=0000000000000000&input=b5057bbc04b842a96144a0f617f2820e&mode=ecb&action=Decrypt&output=54657374313233313233000000000000
It actually decrpyts to 54 65 73 74 31 32 33 31 32 33 00 00 00 00 00 00
which is actually Test123123
Any suggestions of what could be the problem?
EDIT:
I have tried switching to openssl_decrypt
However I keep getting a false returned.
Code:
$result = openssl_decrypt($data,'des-ede3', $key);
result = bool(false)
I was able to get it working using open SSLs decryption function:
$key = 'aaaaaaaabbbbbbbbccccccccdddddddd';
$key = pack('H*',$key);
// DATA
$data = 'b5057bbc04b842a96144a0f617f2820e';
$data = pack('H'.strlen($key),$data);
// DECRYPT OPEN SSL
$result = openssl_decrypt($data,'des-ede', $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING);