使用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:

  1. Use the crypt() php function and pass the result to the SQL statement
  2. Use the MySql encryption functions

Which one should i choose and why?

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.