#密文入库
#INSERT INTO `aaa`(`phone`, `name`,`phone1`, `name1`) VALUES (HEX(AES_ENCRYPT('18888888889','SecretKey')), HEX(AES_ENCRYPT('测试2','SecretKey')),'18888888889','测试3');
#模糊搜索姓名
#SELECT * FROM aaa WHERE AES_DECRYPT( UNHEX( name ), 'SecretKey' ) LIKE '%平3%';
#模糊搜索手机号
#SELECT * FROM aaa WHERE AES_DECRYPT( UNHEX( phone ), 'SecretKey' ) LIKE '%18%';
#经过php加密姓名和手机号
# name:1b75a32613a8a0207d645c3c34d0212c
# phone:8f768b86cdc4833e01ae527baae8c07d
SELECT * FROM aaa WHERE name LIKE '%1b75a32613a8a0207d645c3c34d0212c%';
php 加解密方法
echo bin2hex(base64_decode(openssl_encrypt('测试1','aes-128-ecb', 'SecretKey')));
echo "\r\n";
echo bin2hex(base64_decode(openssl_encrypt('13301063753','aes-128-ecb', 'SecretKey')));
echo "\r\n";
echo openssl_decrypt(base64_encode(hex2bin('1B75A32613A8A0207D645C3C34D0212C')), 'aes-128-ecb', 'SecretKey');
echo "\r\n";
echo openssl_decrypt(base64_encode(hex2bin('8F768B86CDC4833E01AE527BAAE8C07D')), 'aes-128-ecb', 'SecretKey');
die;
mysql 模糊搜索默认不区分大小写, 所有加密出来不用转大写就可以用