PHP错误:mcrypt_encrypt():IV参数的长度必须与blocksize相同
我得到错误mcrypt_encrypt():IV参数必须与第二行的blocksize一样长PHP错误:mcrypt_encrypt():IV参数的长度必须与blocksize相同,php,mcrypt,Php,Mcrypt,我得到错误mcrypt_encrypt():IV参数必须与第二行的blocksize一样长 $data = "Currency=GBP&SuccessURL=test&FailureURL=test&VendorEMail=test&SendEMail=1&eMailMessage=&Amount=&Description=&CustomerName=test test&CustomerEMail=test&
$data = "Currency=GBP&SuccessURL=test&FailureURL=test&VendorEMail=test&SendEMail=1&eMailMessage=&Amount=&Description=&CustomerName=test test&CustomerEMail=test&BillingSurname=test&BillingFirstnames=test&BillingAddress1=test&BillingAddress2=test&BillingCity=test&BillingPostCode=test&BillingCountry=test&BillingPhone=test&DeliverySurname=test&DeliveryFirstnames=test&DeliveryAddress1=test&DeliveryAddress2=test&DeliveryCity=test&DeliveryPostCode=test&DeliveryCountry=test\u0003\u0003\u0003";
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, 'test', $data, MCRYPT_MODE_CBC, 'test');
IV参数不是我认为的mcrypt_encrypt()的第四个参数。它实际上是最后一个参数,第五个参数。
此处指定为iv 对于这个实例,$data的blocksize是16,因此mcrypt_encrypt()中的最后一个参数需要16个字符长
blocksize是数据字符串应可整除的数字,否则需要填充数据字符串的最后一部分,使其可整除 在我的例子中,它也给出了相同的错误。我之前使用的是实际密码。但当我使用加密密码时,它起作用了。在sagepay.php第54行中,受保护的$encryptPassword=”“。在这里,我使用了我在测试帐户中获得的加密密码。现在它开始工作了。
这可能会有所帮助。
谢谢加密密码意味着如何加密密码?您可以详细说明吗?您不需要加密密码。你会得到它与你的acc.thanx你是对的。。。我拿到密码了。你能分享一下你的邮箱号码吗。catchsajal24seven@gmail.com