At first, Coldfusion Encrypt:
<cfset message = '1447841550'>
<cfset key = 'Mk9m98IfEblmPfrpsawt7BmxObt98Jev'>
<cfset ciphertext = Encrypt(#message#, #key#, "desede", "base64")>
<cfoutput>#ciphertext#</cfoutput>
Then, PHP mcrypt:
$message = "1447841550";
$key = 'Mk9m98IfEblmPfrpsawt7BmxObt98Jev';
$key = base64_decode($key);
$bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0}
$iv = implode(array_map("chr", $bytes));
$ciphertext = mcrypt_encrypt(MCRYPT_3DES, $key, $message, MCRYPT_MODE_CBC, $iv);
echo base64_encode($ciphertext);
Problem.
In the same string, same algorithm and same encoding.
Still there is a little part of the output that not match.
Below is the real sample output.
// Coldfusion output.
n6lp0I1w5FwrP3yPw3s8bw==
^^^^^^^^^^
Same part
// PHP output.
n6lp0I1w5FxLQHskKMn4sw==
^^^^^^^^^^
Same part
Why Coldfusion make results different?
How I could make the same results in Coldfusion on condition that don't modify PHP code. PHP output is the correct output for me.
Is it possible to get the right result (PHP) with javascript? This solution is also good.
I'm frustrated.