mcrypt_encrypt to openssl_encrypt, and OPENSSL_ZERO_PADDING problems

后端 未结 2 962
一向
一向 2020-11-27 07:39

I have this mcrypt_encrypt call, for a given $key, $message and $iv:

$string = mcrypt_encrypt(MCRYPT_3DES         


        
2条回答
  •  -上瘾入骨i
    2020-11-27 08:12

    mcrypt_encrypt uses zeroes to pad message to the block size. So you can add zeroes to the tail of your raw data, and then encrypt the block.

    Using OPENSSL_RAW_DATA|OPENSSL_ZERO_PADDING should work. If it doesn't, then you can remove padding from the decrypted data by yourself.

提交回复
热议问题