class Authlogic::CryptoProviders::MD5::V2
A poor choice. There are known attacks against this algorithm.
Attributes
join_token[RW]
stretches[W]
Public Class Methods
encrypt(*tokens)
click to toggle source
Turns your raw password into a MD5
hash.
# File lib/authlogic/crypto_providers/md5/v2.rb, line 20 def encrypt(*tokens) digest = tokens.flatten.join(join_token) stretches.times { digest = Digest::MD5.digest(digest) } digest.unpack1("H*") 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/md5/v2.rb, line 28 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/md5/v2.rb, line 14 def stretches @stretches ||= 1 end