-- 创建测试表
drop table if EXISTS t_passwd_2;
create table t_passwd_2(pass1 varchar(64));
-- 对身份证号加密
insert into t_passwd_2 values (hex(aes_encrypt('22230119771011001X', 'dsideal4r5t6y7u!@#')));
-- 数据库中存储的样子
select * from t_passwd_2;
-- 解密
select aes_decrypt(unhex(pass1), '***************') as pass1 from t_passwd_2;
转载于:https://www.cnblogs.com/littlehb/p/9042853.html