PHP7.1 mcrypt替代 [英] PHP7.1 mcrypt alternative
本文介绍了PHP7.1 mcrypt替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已弃用的字符串编码/解码功能:
$ key:secret key
$ str:string
$ encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,md5($ key ),$ str,MCRYPT_MODE_CBC,md5(md5($ key))));
$ decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256,md5($ key)),base64_decode($ str),MCRYPT_MODE_CBC,md5(md5($ key))),\0);
你能否提出一些选择?
解决方案
您应该使用 openssl_encrypt 代替。请问!
Mcrypt function has been deprecated as of PHP 7.1.0.
My deprecated string encode / decode functions:
$key: secret key
$str: string
$encoded = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $str, MCRYPT_MODE_CBC, md5(md5($key))));
$decoded = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($str), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
Can you suggest some alternatives?
解决方案
You should use openssl_encrypt instead. Regards!
这篇关于PHP7.1 mcrypt替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文