Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Created October 24, 2013 11:51
Show Gist options
  • Save tkuchiki/7135871 to your computer and use it in GitHub Desktop.
Save tkuchiki/7135871 to your computer and use it in GitHub Desktop.
bcrypt password hashing
#!/usr/bin/ruby
# gem install bcrypt-ruby
require "bcrypt"
# 1.9.3 or later
require "io/console"
print "Enter password: "
password = STDIN.noecho(&:gets)
# versions eariler later than 1.9.3
# gem install highline
#require "highline/import"
#password = ask("Enter password: ") { |q| q.echo = false }
print "\n"
print BCrypt::Password.create(password) + "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment