liugx

比如数据表中有一个手机号码字段是敏感字段,不想明文存储,可以是用MySQL的自带的函数处理

Table 12.17 Encryption Functions

Name Description
AES_DECRYPT() Decrypt using AES
AES_ENCRYPT() Encrypt using AES
UNHEX() Return a string containing hex representation of a number
HEX() Hexadecimal representation of decimal or string value

利用thinkPHP5.0中简单和MySQL交互

 

 

 

 

这样后续系统中就 可以 使用加密后的字段, 明文字段过渡完后可以删除

 

SQL 语句实现如下:

select AES_DECRYPT(UNHEX(encrypt_mobile),\'WO_SHI_YAN_ZHI\') as username from dd_user where username = \'15800000001\';


UPDATE `dd_user` SET `encrypt_mobile`= HEX(AES_ENCRYPT(\'15800000001\',\'WO_SHI_YAN_ZHI\')) WHERE `user_id` = 675509;

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2021-12-12
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2022-01-07
猜你喜欢
  • 2021-12-05
  • 2021-12-15
  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案