Sha256: ebf98d4375554fa88d3eb3cca486088130be716afcc71b7b5374baa6a0f9e03c

Contents?: true

Size: 630 Bytes

Versions: 9

Compression:

Stored size: 630 Bytes

Contents

require "digest/sha1"

module Authlogic
  module CryptoProviders
    # = Sha1
    #
    # Uses the Sha1 hash algorithm to encrypt passwords. This class is useful if you are migrating from restful_authentication. This uses the
    # exact same excryption algorithm with 10 stretches, just like restful_authentication.
    class Sha1
      class << self
        def stretches
          @stretches ||= 10
        end
        attr_writer :stretches
        
        def encrypt(pass)
          digest = pass
          stretches.times { digest = Digest::SHA1.hexdigest(digest) }
          digest
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
authlogic-1.3.0 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.3.1 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.1.0 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.1.1 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.1.2 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.2.0 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.2.1 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.2.2 lib/authlogic/crypto_providers/sha1.rb
authlogic-1.3.2 lib/authlogic/crypto_providers/sha1.rb