Class: Authlogic::CryptoProviders::Sha512
- Inherits:
-
Object
- Object
- Authlogic::CryptoProviders::Sha512
- Defined in:
- lib/authlogic/crypto_providers/sha512.rb
Overview
Sha512
Uses the Sha512 hash algorithm to encrypt passwords.
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 Sha512 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
28 29 30 |
# File 'lib/authlogic/crypto_providers/sha512.rb', line 28 def join_token @join_token end |
+ (Object) stretches
The number of times to loop through the encryption. This is twenty because that is what restful_authentication defaults to.
31 32 33 |
# File 'lib/authlogic/crypto_providers/sha512.rb', line 31 def stretches @stretches ||= 20 end |
Class Method Details
+ (Object) encrypt(*tokens)
Turns your raw password into a Sha512 hash.
37 38 39 40 41 |
# File 'lib/authlogic/crypto_providers/sha512.rb', line 37 def encrypt(*tokens) digest = tokens.flatten.join(join_token) stretches.times { digest = Digest::SHA512.hexdigest(digest) } digest end |
+ (Boolean) matches?(crypted, *tokens)
Does the crypted password match the tokens? Uses the same tokens that were used to encrypt.
44 45 46 |
# File 'lib/authlogic/crypto_providers/sha512.rb', line 44 def matches?(crypted, *tokens) encrypt(*tokens) == crypted end |