使用php crypt或Mysql加密函数进行字段加密? [关闭]
问题描述:
CodeIgniter application that needs to be able to encrypt/decrypt spefici fields and for specific records.
I am thinking of two posible ways to do this:
- Use the crypt() php function and pass the result to the SQL statement
- Use the MySql encryption functions
Which one should i choose and why?
CodeIgniter应用程序,需要能够加密/解密spefici字段和特定记录。 p>
我正在考虑两种可行的方法: p>
- 使用crypt()php函数并将结果传递给SQL语句 li >
- 使用MySql加密函数 li>
ol>
我应该选择哪一个?为什么? p> div>
答
Use the option that allows the best forward-compatibility.
If in the future you no longer use a MySQL Database your cryptography will become inoperable.
Almost all major program languages support some form of mcrypt that you will be able to port should you need to move the code away from php to something else.
Again, think forward compatibility as you develop your code.