?
中国广东省深圳市宝安区龙华镇溪山美地
518109
+86?13113668890
+86?755?29812080
<netkiller@msn.com>
$Id: book.xml 659 2013-08-09 10:01:31Z netkiller $
Copyright ? 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Netkiller. All rights reserved.
版权声明
转载请与作者联系,转载时请务必标明文章原始出处和作者信息及本声明。
|
|
$Date: 2013-08-09 18:01:31 +0800 (Fri, 09 Aug 2013) $
?
?
?
?
简单用法
mysql> select AES_ENCRYPT(‘helloworld‘,‘key‘); +---------------------------------+ | AES_ENCRYPT(‘helloworld‘,‘key‘) | +---------------------------------+ | | +---------------------------------+ 1 row in set (0.00 sec) mysql> select AES_DECRYPT(AES_ENCRYPT(‘helloworld‘,‘key‘),‘key‘); +----------------------------------------------------+ | AES_DECRYPT(AES_ENCRYPT(‘helloworld‘,‘key‘),‘key‘) | +----------------------------------------------------+ | helloworld | +----------------------------------------------------+ 1 row in set (0.00 sec) mysql>
加密数据入库
CREATE TABLE `encryption` ( `mobile` VARBINARY(16) NOT NULL, `key` VARCHAR(32) NOT NULL ) ENGINE=InnoDB; INSERT INTO encryption(`mobile`,`key`)VALUES( AES_ENCRYPT(‘13691851789‘,md5(‘13691851789‘)), md5(‘13691851789‘)) select AES_DECRYPT(mobile,`key`), length(mobile) from encryption;
?
?
?
原文:http://netkiller-github-com.iteye.com/blog/2162569