Class: Zena::CryptoProvider::Initial
- Inherits:
-
Object
- Object
- Zena::CryptoProvider::Initial
- Defined in:
- lib/zena/crypto_provider/initial.rb
Class Method Summary collapse
Class Method Details
.encrypt(*tokens) ⇒ Object
4 5 6 7 |
# File 'lib/zena/crypto_provider/initial.rb', line 4 def self.encrypt(*tokens) # encrypt password (old bad method: SHA1, no stretching, no per-password salt) Digest::SHA1.hexdigest((tokens.flatten.shift || '') + PASSWORD_SALT) end |
.matches?(crypted_password, *tokens) ⇒ Boolean
9 10 11 12 |
# File 'lib/zena/crypto_provider/initial.rb', line 9 def self.matches?(crypted_password, *tokens) # return true if the tokens match the crypted_password encrypt(*tokens) == crypted_password end |