I'm using phpseclib for doing the Triple DES Encryption.
This is what I have for encryption.
<?php
use phpseclib\Crypt\TripleDES;
class Foo
{
public function encrypt()
{
$encryptMe = new TripleDES();
$encryptMe->setKey(md5('cEvu4MHkqz7mQgeqmB6mQEXi'));
$encryptMe->setIV('jvz8bUAx');
$encryptMe->paddable = false;
$cipherText = $encryptMe->encrypt("{phrase:'user123',time:'9/11/2017 02:27:19 PM',username:'user1'}");
return rawurlencode(base64_encode($cipherText));
// result : Uru1%2BUpN7oelxj7ngPkkPoK%2FoIw8SoizR8fbDVX4Wicxi8DvY4kcau1fsUVAkNf1oLVr1g4RG0yD2LyL%2FNU7zDWv4cGxVQ%2FL
}
}
It works but it's not having the same result of my C# code here: http://rextester.com/KNJGP9315
// C# result : Hq3BJmupqU6KuvJQ3aoPvQfopOoAaD0RGoFCIDj6U9uIR%2BJloaS2X7klHSfwhptEuoEz5iPeRNbJnwZmOfM1Aw%3D%3D
EDIT:
My C# Triple DES setting is as follows:
Mode = CBC
Padding = Zeros
I think I missed some setting or something. Any help will do!
update your php
setKey()
line to:and the result is: