Method: Ccrypto::Ruby::PBKDF2Engine#initialize
- Defined in:
- lib/ccrypto/ruby/engines/pbkdf2_engine.rb
#initialize(conf, &block) ⇒ PBKDF2Engine
Returns a new instance of PBKDF2Engine.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ccrypto/ruby/engines/pbkdf2_engine.rb', line 10 def initialize(conf, &block) raise KDFEngineException, "PBKDF2 config is expected" if not conf.is_a?(Ccrypto::PBKDF2Config) raise KDFEngineException, "Output bit length (outBitLength) value is not given or not a positive value (#{conf.outBitLength})" if is_empty?(conf.outBitLength) or conf.outBitLength <= 0 @config = conf if is_empty?(@config.salt) @config.salt = SecureRandom.random_bytes(16) end end |