php 5.6 mcrypt,mcrypt在Windows / IIS上的PHP 5.6中不起作用

让我们一块一块地看看你的代码. (主要是化妆品/空白变化.)

function Encrypt($text)

{

global $salt; // Why not make this a second parameter?

if($text != "") { // An unusual check,for sure

return trim( // base64_encode doesn't leave whitespace

base64_encode(

mcrypt_encrypt(

MCRYPT_RIJNDAEL_256,// This is a non-standard variant of the

// Rijndael cipher. You want to use the

// MCRYPT_RIJNDAEL_128 constant if you

// wanted to use AES here.

$salt,// This is a key,not a salt!

$text,// ECB mode is the worst mode to use for

// cryptography. Among other reasons,it

// doesn't even use the IV. Search for

// ECB penguins for an idea of why ECB

// mode is such a bad idea.

mcrypt_create_iv(

mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256,MCRYPT_RAND // You're using ECB mode so this is a waste

// anyway,but you should use

// MCRYPT_DEV_URANDOM instead of MCRYPT_RAND

)

)

)

);

}

return "";

}

我强烈建议您不要使用此功能.这不安全. Don’t use ECB mode.

此外,unauthenticated encryption is dangerous和libmcrypt is abandonware.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值