class Eth::Key::Encrypter
def initialize(key, options = {})
(**options)
-
:block_size
(Integer
) -- for scrypt, defaults to 1 -
:parallelization
(Integer
) -- parallelization factor for scrypt, defaults to 8 -
:iv
(String
) -- 128-bit initialisation vector for the cipher -
:salt
(String
) -- passed to PBKDF -
:iterations
(String
) -- number of iterations for the hash function -
:id
(String
) -- uuid given to the secret key -
:kdf
(String
) -- key derivation function defaults to pbkdf2
Parameters:
-
options
(Hash
) -- the options to encrypt with -
key
(Eth::Key
) -- representing a secret key-pair used for encryption
def initialize(key, options = {}) @key = key @options = options # the key derivation functions default to pbkdf2 if no option is specified # however, if an option is given then it must be either pbkdf2 or scrypt if kdf != "scrypt" && kdf != "pbkdf2" raise EncrypterError, "Unsupported key derivation function: #{kdf}!" end end