Sha256: af14fa781f5dbdf9bada94430fd6c1e62ecc653f90426a9bdb1d4c1af64d07dd

Contents?: true

Size: 654 Bytes

Versions: 19

Compression:

Stored size: 654 Bytes

Contents

require "digest/sha2"

module Devise
  module Encryptors
    # = AuthlogicSha512
    # Simulates Authlogic's default encryption mechanism.
    # Warning: it uses Devise's stretches configuration to port Authlogic's one. Should be set to 20 in the initializer to simulate
    #  the default behavior.
    class AuthlogicSha512 < Base
      # Gererates a default password digest based on salt, pepper and the
      # incoming password.
      def self.digest(password, stretches, salt, pepper)
        digest = [password, salt].flatten.join('')
        stretches.times { digest = Digest::SHA512.hexdigest(digest) }
        digest
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.2.1/lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.9 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.8 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.7 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.5 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.3 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.2 lib/devise/encryptors/authlogic_sha512.rb
devise-1.4.1 lib/devise/encryptors/authlogic_sha512.rb
devise-1.3.4 lib/devise/encryptors/authlogic_sha512.rb
devise-1.3.3 lib/devise/encryptors/authlogic_sha512.rb
devise-1.3.2 lib/devise/encryptors/authlogic_sha512.rb
devise-1.3.1 lib/devise/encryptors/authlogic_sha512.rb
devise-1.3.0 lib/devise/encryptors/authlogic_sha512.rb
devise-1.2.1 lib/devise/encryptors/authlogic_sha512.rb
devise-1.2.0 lib/devise/encryptors/authlogic_sha512.rb
devise-jdguyot-1.2.rc3 lib/devise/encryptors/authlogic_sha512.rb
devise-1.2.rc2 lib/devise/encryptors/authlogic_sha512.rb
devise-jdguyot-1.2.rc2 lib/devise/encryptors/authlogic_sha512.rb
devise-jdguyot-1.2.rc lib/devise/encryptors/authlogic_sha512.rb