Class: KStor::Crypto::KDFParams
- Inherits:
-
ArmoredHash
- Object
- ArmoredValue
- ArmoredHash
- KStor::Crypto::KDFParams
- Defined in:
- lib/kstor/crypto/keys.rb
Overview
KDF parameters.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Create new Key Derivation Function parameters from a Ruby Hash.
Instance Method Summary collapse
-
#to_hash ⇒ Object
Convert back to a Ruby Hash.
Methods inherited from ArmoredHash
Methods inherited from ArmoredValue
from_binary, #initialize, #to_ascii, #to_binary
Constructor Details
This class inherits a constructor from KStor::Crypto::ArmoredValue
Class Method Details
.from_hash(hash) ⇒ Object
Create new Key Derivation Function parameters from a Ruby Hash.
Hash parameter must have keys for “salt”,“ opslimit” and “memlimit”.
50 51 52 53 54 55 |
# File 'lib/kstor/crypto/keys.rb', line 50 def self.from_hash(hash) hash['salt'] = ASCIIArmor.encode(hash['salt']) hash['opslimit'] = hash['opslimit'].to_s hash['memlimit'] = hash['memlimit'].to_s super(hash) end |
Instance Method Details
#to_hash ⇒ Object
Convert back to a Ruby Hash.
58 59 60 61 62 63 64 65 |
# File 'lib/kstor/crypto/keys.rb', line 58 def to_hash hash = super hash['salt'] = ASCIIArmor.decode(hash['salt']) hash['opslimit'] = hash['opslimit'].to_sym hash['memlimit'] = hash['memlimit'].to_sym hash end |