Posted By

kidmizere on 12/08/10


Tagged


Versions (?)

Adding and testing AES encrypted password field


 / Published in: MySQL
 

  1. ## Adding and testing AES encrypted password field
  2.  
  3. DROP TABLE IF EXISTS `testGKAES`;
  4.  
  5.  
  6. CREATE TABLE `testGKAES`(
  7. `uid` INT(15) NOT NULL AUTO_INCREMENT,
  8. `ufname` VARCHAR(15),
  9. `upassword` BLOB,
  10. PRIMARY KEY(`uid`)
  11. );
  12.  
  13. INSERT INTO testGKAES VALUES('1','user', AES_ENCRYPT('password', 'key') );
  14. INSERT INTO testGKAES VALUES('2','mere', AES_ENCRYPT('balloon', 'key') );
  15. INSERT INTO testGKAES VALUES('3','kurtasg', AES_ENCRYPT('zebra', 'key') );
  16.  
  17. SELECT * FROM testGKAES WHERE ufname='user' AND upassword=AES_ENCRYPT('password','key');
  18. SELECT * FROM testGKAES WHERE ufname='mere' AND upassword=AES_ENCRYPT('balloon','key');
  19. SELECT * FROM testGKAES WHERE ufname='kurtasg' AND upassword=AES_ENCRYPT('zebra','key');
  20.  
  21. SELECT AES_DECRYPT(upassword,'key') FROM testGKAES;

Report this snippet  

You need to login to post a comment.