Separate names with a comma.
Discussion in 'Website Development & Design' started by beingchinmay, Aug 17, 2015.
You can use functions: AES_ENCRYPT() and AES_DECRYPT() like:
You can use the following functions to encrypt and decrypt the information from MYSQL table.
1. AES_ENCRYPT ()
insert into UserInfo.login (id, username, password ) values (001, '12',AES_ENCRYPT ('AlanRon','98765'));
Select AES_DECRYPT(Userinfo.login.password, '98765') from login where id=001;
You will get output as : AlanRon
Duuh. They included that straight into MySQL? SQL engines does so much things these days that I start to see why it clashes so often with NoSQL.
Well, the thing is, with AES, I guess it is way more safer to encrypt with hexadecimal key, meaning the key can be any value, instead of binding it to the alphebetical values, which isn't 128 bytes even with a 128 character key. The official doc talks about UNHEX function to use hexadecimal instead of a typical string. But anyway, generally, any password should go through a process before being a key, instead of giving it straight to MySQL.