Sha256: 7719290e9a84801b3a255cc077ab0ef5ac44780b99d8470821c738a2b76dc50f

Contents?: true

Size: 871 Bytes

Versions: 10

Compression:

Stored size: 871 Bytes

Contents

require "digest/sha1"

module Devise
  module Encryptable
    module Encryptors
      # = 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 simulate the default behavior.
      class RestfulAuthenticationSha1 < Base

        # Generates a default password digest based on salt, pepper and the
        # incoming password.
        def self.digest(password, stretches, salt, pepper)
          digest = pepper
          stretches.times { digest = Digest::SHA1.hexdigest([digest, salt, password, pepper].flatten.join('--')) }
          digest
        end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
devise-encryptable-0.2.0 lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
devise-encryptable-0.1.2 lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-encryptable-0.1.1/lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
devise-encryptable-0.1.1 lib/devise/encryptable/encryptors/restful_authentication_sha1.rb
devise-encryptable-0.1.0 lib/devise/encryptable/encryptors/restful_authentication_sha1.rb