1

Is it possible to hash password using triggers?

I was thinking something like:

CREATE TRIGGER `hash_password`
    AFTER INSERT ON `users` FOR EACH ROW
    BEGIN
        UPDATE users SET password = HASH(NEW.password)
    END

But how do I make it encrypted with bcrypt?

majidarif
  • 18,694
  • 16
  • 88
  • 133
  • possible duplicate of [How to use \`bcrypt\` algorithm within \`encrypt\` function in MySQL for verifying password?](http://stackoverflow.com/questions/20295778/how-to-use-bcrypt-algorithm-within-encrypt-function-in-mysql-for-verifying-p) – Alma Do Apr 10 '14 at 10:32
  • 1
    Don't encrypt passwords. You *must* hash them. Don't take this matter lightly. It has ***major*** legal significance. – user207421 Apr 10 '14 at 11:04
  • @EJP It was just a mis-understanding, I really meant hash, as I was asking about bcrypt. – majidarif Apr 10 '14 at 11:55

0 Answers0