Skip to content

Instantly share code, notes, and snippets.

@cowboycoded
Created April 11, 2011 18:24
Show Gist options
  • Save cowboycoded/913997 to your computer and use it in GitHub Desktop.
Save cowboycoded/913997 to your computer and use it in GitHub Desktop.
LOCK_PATH = File.dirname(__FILE__) + "/lock"
require "#{LOCK_PATH}/engine.rb"
require "bcrypt"
module Lock
def self.passwords_match?(password)
begin
hashed_combo = IO.read("#{Rails.root}/config/lock_password")
rescue
return false
end
salt = hashed_combo[0,29]
hashed_combo==BCrypt::Engine.hash_secret(password, salt)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment