Here is a PHP demo script that encrypts and decrypts data:
$encryptionkey = \'h8y2p9d1\'; $card_nbr = \"1234\"; echo \"original card_nbr: $card_nbr &
The returned string is padded out to fill n * blocksize bytes using the null character \0 so that is why you are seeing the extra data.
n * blocksize
\0
If you run $card_nbr_decrypted= rtrim($card_nbr_decrypted, "\0"); it should return the actual data.
$card_nbr_decrypted= rtrim($card_nbr_decrypted, "\0");