Adding and testing AES encrypted password field


/ Published in: MySQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. ## Adding and testing AES encrypted password field
  2.  
  3. DROP TABLE IF EXISTS `testGKAES`;
  4.  
  5.  
  6. create table `testGKAES`(
  7. `ufname` varchar(15),
  8. `upassword` BLOB,
  9. );
  10.  
  11. INSERT INTO testGKAES VALUES('1','user', AES_ENCRYPT('password', 'key') );
  12. INSERT INTO testGKAES VALUES('2','mere', AES_ENCRYPT('balloon', 'key') );
  13. INSERT INTO testGKAES VALUES('3','kurtasg', AES_ENCRYPT('zebra', 'key') );
  14.  
  15. SELECT * FROM testGKAES WHERE ufname='user' AND upassword=AES_ENCRYPT('password','key');
  16. SELECT * FROM testGKAES WHERE ufname='mere' AND upassword=AES_ENCRYPT('balloon','key');
  17. SELECT * FROM testGKAES WHERE ufname='kurtasg' AND upassword=AES_ENCRYPT('zebra','key');
  18.  
  19. SELECT AES_DECRYPT(upassword,'key') FROM testGKAES;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.