Method: Ccrypto::Ruby::HKDFEngine#derive
- Defined in:
- lib/ccrypto/ruby/engines/hkdf_engine.rb
#derive(input, output = :binary) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ccrypto/ruby/engines/hkdf_engine.rb', line 20 def derive(input, output = :binary) digest = init_digest(@config.digest) @config.info = "" if @config.info.nil? res = OpenSSL::KDF.hkdf(input, salt: @config.salt, info: @config.info, length: @config.outBitLength/8, hash: digest) case output when :hex to_hex(res) when :b64 to_b64(res) else res end end |