Class: Devise::Encryptors::RestfulAuthenticationSha1

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

Overview

RestfulAuthenticationSha1

Simulates Restful Authentication’s default encryption mechanism. Warning: it uses Devise’s pepper to port the concept of REST_AUTH_SITE_KEY Warning: it uses Devise’s stretches configuration to port the concept of REST_AUTH_DIGEST_STRETCHES. Should be set to 10 in the initializer to silumate the default behavior.

Class Method Summary collapse

Class Method Details

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

Gererates a default password digest based on salt, pepper and the incoming password.



21
22
23
24
25
# File 'lib/devise/encryptors/restful_authentication_sha1.rb', line 21

def self.digest(password, stretches, salt, pepper)
  digest = pepper
  stretches.times { digest = Digest::SHA1.hexdigest([digest, salt, password, pepper].flatten.join('--')) }
  digest
end