Sha256: f6dd3852b339f83f73d21af2ae58dbb04f9ad5ddf59127c1dfeea865a289431e

Contents?: true

Size: 919 Bytes

Versions: 20

Compression:

Stored size: 919 Bytes

Contents

require "digest/sha1"

module Devise
  # Implements a way of adding different encryptions.
  # The class should implement a self.digest method that taks the following params:
  #   - password
  #   - stretches: the number of times the encryption will be applied
  #   - salt: the password salt as defined by devise
  #   - pepper: Devise config option
  #
  module Encryptors
    # = ClearanceSha1
    # Simulates Clearance'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
    class ClearanceSha1
      
      # Gererates a default password digest based on salt, pepper and the
      # incoming password.
      def self.digest(password, stretches, salt, pepper)
        Digest::SHA1.hexdigest("--#{salt}--#{password}--")
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
devise-0.8.0 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.5 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.4 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.3 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.2 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.1 lib/devise/encryptors/clearance_sha1.rb
devise-0.7.0 lib/devise/encryptors/clearance_sha1.rb
devise-0.6.3 lib/devise/encryptors/clearance_sha1.rb
devise-0.6.2 lib/devise/encryptors/clearance_sha1.rb
devise-0.6.1 lib/devise/encryptors/clearance_sha1.rb
devise-0.6.0 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.6 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.5 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.4 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.3 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.2 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.1 lib/devise/encryptors/clearance_sha1.rb
devise-0.5.0 lib/devise/encryptors/clearance_sha1.rb
shingara-devise-0.4.3.1 lib/devise/encryptors/clearance_sha1.rb
shingara-devise-0.4.3 lib/devise/encryptors/clearance_sha1.rb