測試資料:
INSERT INTO `test` (`user`, `pswd`) VALUES ('test', 'ABcd+1234');
一般常見做法
SELECT `user` FROM `test` WHERE `user`='test' and `pswd`=sha1('ABcd+1234')
較安全做法,但是會增加DB CPU的功耗!
SELECT `user` FROM `test` WHERE `user`='test' and sha1(CONCAT(`pswd`,9999))=sha1(CONCAT(sha1('ABcd+1234'),9999))
文章短網址: https://slanla.com/__kbgpcr