2018年5月23日 星期三

bcrypt, devise, and rails secret_key_base

devise 用 secret_key_base 當作產生 token 的依據
devise 用 bcrypt hashify password 然後儲存
rails 的 has_secure_password 也是用 bcrypt 實現


bcrypt() is a hashing algorithm designed by Niels Provos and David Mazières of the OpenBSD Project.


題外話,如果要改 secret_key_base ,那 devise 裡的token, 包含confirmation, reset_password 都會 invalid 需要重新生成。

https://github.com/codahale/bcrypt-ruby
https://coderwall.com/p/sjegjq/use-bcrypt-for-passwords

沒有留言:

張貼留言