Why is mcrypt_encrypt() putting binary characters at the end of my string?

前端 未结 4 1932
有刺的猬
有刺的猬 2020-12-06 18:33

Here is a PHP demo script that encrypts and decrypts data:



        
4条回答
  •  情歌与酒
    2020-12-06 18:59

    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.

    If you run $card_nbr_decrypted= rtrim($card_nbr_decrypted, "\0"); it should return the actual data.

提交回复
热议问题