What is Bcrypt?
Bcrypt A gem that provides a function for hashing passwords.
hash (#)
.Gemfile
# gem 'bcrypt', '~> 3.1.7'
↓ Remove the hash (#)
and execute ** bundle install **.
Gemfile
gem 'bcrypt', '~> 3.1.7'
-The has_secure_password
method can be used.
・ The authenticate
method can be used
Bcrypt::password.create("○○○○") Returns a hashed value of a character string (value in ○○○○).
:001:0> BCrypt::Password.create("foobar")
=> "$2a$12$W0qW0H5M2YRx2kyGdlBeMOS5cK11hbF8sT4.oKgWF6Aq43E6bjr0C"
Recommended Posts