Class: Authlogic::CryptoProviders::MD5
- Inherits:
-
Object
- Object
- Authlogic::CryptoProviders::MD5
- Defined in:
- lib/authlogic/crypto_providers/md5.rb
Overview
This class was made for the users transitioning from md5 based systems. I highly discourage using this crypto provider as it superbly inferior to your other options.
Please use any other provider offered by Authlogic.
Class Attribute Summary (collapse)
-
+ (Object) join_token
Returns the value of attribute join_token.
-
+ (Object) stretches
The number of times to loop through the encryption.
Class Method Summary (collapse)
-
+ (Object) encrypt(*tokens)
Turns your raw password into a MD5 hash.
-
+ (Boolean) matches?(crypted, *tokens)
Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
Class Attribute Details
+ (Object) join_token
Returns the value of attribute join_token
12 13 14 |
# File 'lib/authlogic/crypto_providers/md5.rb', line 12 def join_token @join_token end |
+ (Object) stretches
The number of times to loop through the encryption.
15 16 17 |
# File 'lib/authlogic/crypto_providers/md5.rb', line 15 def stretches @stretches ||= 1 end |
Class Method Details
+ (Object) encrypt(*tokens)
Turns your raw password into a MD5 hash.
21 22 23 24 25 |
# File 'lib/authlogic/crypto_providers/md5.rb', line 21 def encrypt(*tokens) digest = tokens.flatten.join(join_token) stretches.times { digest = Digest::MD5.hexdigest(digest) } digest end |
+ (Boolean) matches?(crypted, *tokens)
Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
28 29 30 |
# File 'lib/authlogic/crypto_providers/md5.rb', line 28 def matches?(crypted, *tokens) encrypt(*tokens) == crypted end |