Class: Devise::Encryptors::Bcrypt

Inherits:
Base
  • Object
show all
Defined in:
lib/devise/encryptors/bcrypt.rb

Overview

BCrypt

Uses the BCrypt hash algorithm to encrypt passwords.

Class Method Summary collapse

Class Method Details

.digest(password, stretches, salt, pepper) ⇒ Object

Gererates a default password digest based on stretches, salt, pepper and the incoming password. We don’t strech it ourselves since BCrypt does so internally.



11
12
13
# File 'lib/devise/encryptors/bcrypt.rb', line 11

def self.digest(password, stretches, salt, pepper)
  ::BCrypt::Engine.hash_secret([password, pepper].join, salt, stretches)
end

.saltObject



15
16
17
# File 'lib/devise/encryptors/bcrypt.rb', line 15

def self.salt
  ::BCrypt::Engine.generate_salt
end