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.



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

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

.salt(stretches) ⇒ Object



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

def self.salt(stretches)
  ::BCrypt::Engine.generate_salt(stretches)
end