PHP - Triple Des 3DES CBC encrypt result not match

100 views Asked by At

I am trying to implement a 3DES encryption/decryption with CBC mode in PHP.

<?php
$plaintext = hex2bin('781723860c06c2264608f919887022120b795240cb7049b01c19b33e32804f0b');
$algorithm = "DES-EDE3-CBC";
$key = hex2bin('AB94FDECF2674FDFB9B391F85D7F76F2');

$ivHex = "00000000";
// encryption
$encrypted = openssl_encrypt($plaintext, $algorithm, $key,  OPENSSL_ZERO_PADDING, $ivHex);
echo bin2hex($encrypted);

//RESULT : 685677557a4663584634656156584b38316a766c59754b316f7837742f703274724d69556c3966384f75673d

Echo :685677557a4663584634656156584b38316a766c59754b316f7837742f703274724d69556c3966384f75673d

But it try it on web. Expected response is : 72C29C2371CC9BDB65B779B8E8D37B29ECC154AA56A8799FAE2F498F76ED92F2

enter image description here

fix my code Php to echo Expected response as website.

0

There are 0 answers