Class: Auth::Encryptors::Sha512
- Inherits:
-
Object
- Object
- Auth::Encryptors::Sha512
- Defined in:
- lib/auth/encryptors/sha512.rb
Class Attribute Summary collapse
- .stretches ⇒ Object
-
.token_delimeter ⇒ Object
Returns the value of attribute token_delimeter.
Class Method Summary collapse
Class Attribute Details
.stretches ⇒ Object
6 7 8 |
# File 'lib/auth/encryptors/sha512.rb', line 6 def stretches @stretches ||= 20 end |
.token_delimeter ⇒ Object
Returns the value of attribute token_delimeter.
3 4 5 |
# File 'lib/auth/encryptors/sha512.rb', line 3 def token_delimeter @token_delimeter end |
Class Method Details
.encrypt(*what) ⇒ Object
10 11 12 13 14 |
# File 'lib/auth/encryptors/sha512.rb', line 10 def encrypt(*what) digest = what.flatten.join(token_delimeter) stretches.times { digest = Digest::SHA512.hexdigest(digest) } digest end |
.matches?(encrypted_copy, *what) ⇒ Boolean
16 17 18 |
# File 'lib/auth/encryptors/sha512.rb', line 16 def matches?(encrypted_copy, *what) encrypt(*what) == encrypted_copy end |