mcrypt_decrypt()错误更改键大小 [英] mcrypt_decrypt() error change key size
问题描述
mcrypt_decrypt():此算法不支持大小为15的密钥。只支持大小为16,24或32的按键
mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported
如何解决此问题?我的钥匙设置 - 不能改变它。
它必须是本地的更改,我认为我的本地PHP版本对于我加载的项目来说太高级了。
我如何解决这个问题?
How Can I fix this issue? my key is set - can not change it. It has to be a local change, I think my local PHP version is too advanced for the project I loaded. How can I fix this?
推荐答案
你是否更新到5.6?它说
Did you update to 5.6? It says
无效的钥匙和iv尺寸不再被接受。如果输入无效,mcrypt_decrypt()将抛出一个警告并返回FALSE。以前的键和IV用'\0'字节填充到下一个有效的大小。
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():此算法不支持大小为15的密钥。只支持大小为16,24或32的键
mcrypt_decrypt(): Key of size 15 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported
这意味着您需要用 \ 0
(这是以前的版本为你做的)
That means you need to pad your key with \0
(that's what previous versions were doing for you)
$key=$key."\0";
这篇关于mcrypt_decrypt()错误更改键大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!