mcrypt_decrypt() error change key size

后端 未结 8 1666
慢半拍i
慢半拍i 2020-12-06 05:17

mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported

How Can I fix this issue? my

8条回答
  •  孤街浪徒
    2020-12-06 05:52

    Did you update to 5.6? It says

    Invalid key and iv sizes are no longer accepted. mcrypt_decrypt() will now throw a warning and return FALSE if the inputs are invalid. Previously keys and IVs were padded with '\0' bytes to the next valid size.

    Reference

    Read the last line of that quote, and there you will find your solution :)

    mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported

    That means you need to pad your key with \0 (that's what previous versions were doing for you)

    $key=$key."\0";
    

提交回复
热议问题