PHP,最简单的双向加密 [英] PHP, Simplest Two Way Encryption
问题描述
在常见的PHP安装中进行双向加密的最简单的方法是什么?
What is the simplest way of doing two way encryption in common PHP installs?
我需要能够使用字符串密钥加密数据,密钥在另一端解密。
I need to be able to encrypt data with a string key, and use the same key to decrypt on the other end.
安全性不像代码的可移植性那么大,所以我想能够保持事情尽可能简单。目前,我使用的RC4实现,但如果我可以找到一些本机支持我想我可以保存很多不必要的代码。
The security isn't as big of a concern as the portability of the code, so I'd like to be able to keep things as simple as possible. Currently, I am using an RC4 implementation, but if I can find something natively supported I figure I can save a lot of unnecessary code.
感谢任何帮助。 p>
Thanks for any help.
推荐答案
已编辑:
使用 openssl_encrypt()& openssl_decrypt()
As Scott says, Mcrypt is not a good idea as it has not been updated since 2007.
甚至有一个要从PHP中移除Mcrypt的RFC - https://wiki.php.net/rfc/mcrypt-viking-funeral
There is even an RFC to remove Mcrypt from PHP - https://wiki.php.net/rfc/mcrypt-viking-funeral
这篇关于PHP,最简单的双向加密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!