Sha256: da7be58ff53c2bbfdc3a19c763dc3265dd33e574b2512a9408ce886018f24f4a
Contents?: true
Size: 502 Bytes
Versions: 2
Compression:
Stored size: 502 Bytes
Contents
# frozen_string_literal: true require 'bcrypt' module Kingsman module Encryptor def self.digest(password) stretches = 12 ::BCrypt::Password.create(password, cost: stretches).to_s end def self.compare(hashed_password, password) return false if hashed_password.blank? bcrypt = ::BCrypt::Password.new(hashed_password) password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt) Kingsman.secure_compare(password, hashed_password) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kingsman-0.1.1 | lib/kingsman/encryptor.rb |
kingsman-0.1.0 | lib/kingsman/encryptor.rb |