I have this code:
$original = 'zner5';
$new = mcrypt_decrypt( MCRYPT_3DES, 'keyCodeEncryption', 'C¹`Û‡”fa', 'ecb');
if( $original == $new)
{
echo "$original == $new";
}
else
{
echo "$original != $new";
}
It outputs 'zner5 != zner5'. Why?
I seem to remember hitting this issue myself some time ago, and if I recall correctly, mcrypt_decrypt() might give you a binary string with extra zero bytes on the end, so try this:
$new = trim(mcrypt_decrypt(...));