Class: KStor::Crypto::KDFParams

Inherits:
ArmoredHash show all
Defined in:
lib/kstor/crypto/keys.rb

Overview

KDF parameters.

Class Method Summary collapse

Instance Method Summary collapse

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



85
86
87
88
89
90
# File 'lib/kstor/crypto/keys.rb', line 85

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_hashObject



92
93
94
95
96
97
98
99
# File 'lib/kstor/crypto/keys.rb', line 92

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