Class: Devise::Encryptable::Encryptors::Aes256
- Inherits:
-
Base
- Object
- Base
- Devise::Encryptable::Encryptors::Aes256
- Defined in:
- lib/devise/encryptable/encryptors/aes256.rb
Class Method Summary collapse
- .compare(encrypted_password, password, pepper) ⇒ Object
- .decrypt(encrypted_password, pepper) ⇒ Object
- .digest(password, _stretches, salt, pepper) ⇒ Object
- .salt(_stretches) ⇒ Object
Class Method Details
.compare(encrypted_password, password, pepper) ⇒ Object
25 26 27 28 29 |
# File 'lib/devise/encryptable/encryptors/aes256.rb', line 25 def compare(encrypted_password, password, pepper) return false if encrypted_password.blank? decrypt(encrypted_password, pepper) == password end |
.decrypt(encrypted_password, pepper) ⇒ Object
21 22 23 |
# File 'lib/devise/encryptable/encryptors/aes256.rb', line 21 def decrypt(encrypted_password, pepper) ::AES.decrypt(encrypted_password, pepper) end |
.digest(password, _stretches, salt, pepper) ⇒ Object
11 12 13 14 15 |
# File 'lib/devise/encryptable/encryptors/aes256.rb', line 11 def digest(password, _stretches, salt, pepper) ::AES.encrypt(password, pepper, { iv: salt }) if password rescue StandardError nil end |
.salt(_stretches) ⇒ Object
17 18 19 |
# File 'lib/devise/encryptable/encryptors/aes256.rb', line 17 def salt(_stretches) ::AES.iv(:base_64) end |