Sign in through GitHub

Daniel Martin's Profile

GitHub User: etdsoft

Comments by Daniel Martin

Avatar

Use BCrypt::Password.create() instead of BCrypt::Engine and the library takes care of the salt for you:

ruby
def create(secret, options = { :cost => BCrypt::Engine::DEFAULT_COST })
  Password.new(BCrypt::Engine.hash_secret(secret, BCrypt::Engine.generate_salt(options[:cost]), options[:cost]))
end

http://bcrypt-ruby.rubyforge.org/classes/BCrypt/Password.html#M000007