PHP code:
$key = '111111111111111111111111'; //length: 24
$iv = "\0\0\0\0\0\0\0\0"; //8 bytes
$data = mcrypt_encrypt(MCRYPT_TRIPLEDES, $key, "SECRET", MCRYPT_MODE_CBC, $iv);
base64_encode($data);
// Result: ZGF0YQ==
Python code (using m2crypto):
cipher = Cipher(alg='des_ede3_ecb', key="111111111111111111111111", op=encrypt, iv='\0'*8)
ciphertext = cipher.update("SECRET")
ciphertext += cipher.final()
base64.b64encode(ciphertext)
# Result: LhBqW6pGRoQ=
Python code (using pyDes):
k = pyDes.triple_des('111111111111111111111111', mode=pyDes.CBC, IV=b'\0'*8, pad=None, padmode=pyDes.PAD_PKCS5)
d = k.encrypt("SECRET")
base64.b64encode(d)
# Result: LhBqW6pGRoQ=
So Python gets the same result for different library, but PHP not ;/ Anybody see here any bug?
Thank you!