Skip to content

Instantly share code, notes, and snippets.

@takahashilabo
Last active April 17, 2019 06:15
Show Gist options
  • Save takahashilabo/a96110677c4fab6c96c5a2e39313c273 to your computer and use it in GitHub Desktop.
Save takahashilabo/a96110677c4fab6c96c5a2e39313c273 to your computer and use it in GitHub Desktop.
login with bcrypt-ruby
require 'bcrypt'
#signup
signup_password = BCrypt::Password.create("my password")
p signup_password
p signup_password.class
to_db = signup_password.to_s
p to_db
p to_db.class
#login
login_password = BCrypt::Password.new(to_db)
p login_password
p login_password.class
if login_password == "my password"
p "logged in!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment