class Authlogic::CryptoProviders::Sha1
This class was made for the users transitioning from restful_authentication. I highly discourage using this crypto provider as it is far inferior to your other options. Please use any other provider offered by Authlogic.
Attributes
join_token[W]
stretches[W]
Public Instance Methods
encrypt(*tokens)
click to toggle source
Turns your raw password into a Sha1 hash.
# File lib/authlogic/crypto_providers/sha1.rb, line 21 def encrypt(*tokens) tokens = tokens.flatten digest = tokens.shift stretches.times { digest = Digest::SHA1.hexdigest([digest, *tokens].join(join_token)) } digest end
join_token()
click to toggle source
# File lib/authlogic/crypto_providers/sha1.rb, line 9 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 29 def matches?(crypted, *tokens) encrypt(*tokens) == crypted end
stretches()
click to toggle source
The number of times to loop through the encryption. This is ten because that is what restful_authentication defaults to.
# File lib/authlogic/crypto_providers/sha1.rb, line 15 def stretches @stretches ||= 10 end