class Authlogic::CryptoProviders::Sha1
A poor choice. There are known attacks against this algorithm.
Attributes
join_token[W]
stretches[W]
Public Class Methods
encrypt(*tokens)
click to toggle source
Turns your raw password into a Sha1
hash.
# File lib/authlogic/crypto_providers/sha1.rb, line 25 def encrypt(*tokens) tokens = tokens.flatten digest = tokens.shift stretches.times do digest = Digest::SHA1.hexdigest([digest, *tokens].join(join_token)) end digest end
join_token()
click to toggle source
# File lib/authlogic/crypto_providers/sha1.rb, line 13 def join_token @join_token ||= "--" end
matches?(crypted, *tokens)
click to toggle source
Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
# File lib/authlogic/crypto_providers/sha1.rb, line 36 def matches?(crypted, *tokens) encrypt(*tokens) == crypted end
stretches()
click to toggle source
The number of times to loop through the encryption.
# File lib/authlogic/crypto_providers/sha1.rb, line 19 def stretches @stretches ||= 10 end