Sha256: cd293b8c415ef79cd583e67bb495dd2f26cd14b3a92198b5606c85d75fd17040

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require "digest/sha2"

module Authlogic
  # = Sha512 Crypto Provider
  #
  # The acts_as_authentic method allows you to pass a :crypto_provider option. This allows you to use any type of encryption you like. Just create a class with a class level encrypt and decrypt method.
  # The password will be passed as the single parameter to each of these methods so you can do your magic.
  #
  # If you are encrypting via a hash just don't include a decrypt method, since hashes can't be decrypted. Authlogic will notice this adjust accordingly.
  class Sha512CryptoProvider
    STRETCHES = 20
    def self.encrypt(pass)
      digest = pass
      STRETCHES.times { digest = Digest::SHA512.hexdigest(digest) }
      digest
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authlogic-0.10.4 lib/authlogic/sha512_crypto_provider.rb
authlogic-1.0.0 lib/authlogic/sha512_crypto_provider.rb