Sha256: 82c5782958b75fd358ab79255eb93972aeae7a0558a184430b4d5142b6c8082c
Contents?: true
Size: 675 Bytes
Versions: 24
Compression:
Stored size: 675 Bytes
Contents
# frozen_string_literal: true require 'bcrypt' module Devise module Encryptor def self.digest(klass, password) if klass.pepper.present? password = "#{password}#{klass.pepper}" end ::BCrypt::Password.create(password, cost: klass.stretches).to_s end def self.compare(klass, hashed_password, password) return false if hashed_password.blank? bcrypt = ::BCrypt::Password.new(hashed_password) if klass.pepper.present? password = "#{password}#{klass.pepper}" end password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt) Devise.secure_compare(password, hashed_password) end end end
Version data entries
24 entries across 23 versions & 4 rubygems