Class Authlogic::CryptoProviders::SCrypt
In: lib/authlogic/crypto_providers/scrypt.rb
Parent: Object

SCrypt is the default provider for Authlogic. It is the only choice in the adaptive hash family that accounts for hardware based attacks by compensating with memory bound as well as cpu bound computational constraints. It offers the same guarantees as BCrypt in the way of one-way, unique and slow.

Decided SCrypt is for you? Just install the scrypt gem:

  gem install scrypt

Tell acts_as_authentic to use it:

  acts_as_authentic do |c|
    c.crypto_provider = Authlogic::CryptoProviders::SCrypt
  end

Methods

Constants

DEFAULTS = { :key_len => 32, :salt_size => 8, :max_time => 0.2, :max_mem => 1024 * 1024, :max_memfrac => 0.5 }

Attributes

key_len  [W] 
max_mem  [W] 
max_memfrac  [W] 
max_time  [W] 
salt_size  [W] 

Public Class methods

Creates an SCrypt hash for the password passed.

Key length - length in bytes of generated key, from 16 to 512.

Does the hash match the tokens? Uses the same tokens that were used to encrypt.

Max memory - maximum memory usage. The minimum is always 1MB

Max memory fraction - maximum memory out of all available. Always greater than zero and <= 0.5.

Max time - maximum time spent in computation

Salt size - size in bytes of random salt, from 8 to 32

[Validate]