lib/daniel.rb
def key_for(params, id, length = 32)
        pset = {
          :iters => params.iterations,
          :salt => params.salt
        }
        @keys[pset] = { :master => master_key_for(params) } unless @keys[pset]
        return @keys[pset][id] if @keys[pset][id]
        @keys[pset][id] = hkdf_expand(@keys[pset][:master], "1:#{id}", length)
      end
# Generate a key of length bytes based on the iteration count, salt (if
# any), and the master secret.
#
# Uses PBKDF2-HMAC-SHA-256 to generate a master key, and then uses
# HKDF-Expand to produce the required number of bytes.
Generate a key of length bytes based on the iteration count, salt (if
any), and the master secret.

Uses PBKDF2-HMAC-SHA-256 to generate a master key, and then uses
HKDF-Expand to produce the required number of bytes.
Generate a key of length bytes based on the iteration count salt ( if any ) and the master secret . Uses PBKDF2 - HMAC - SHA - 256 to generate a master key and then uses HKDF - Expand to produce the required number of bytes .
def key_for(params, id, length = 32)
        pset = {
          :iters => params.iterations,
          :salt => params.salt
        }
        @keys[pset] = { :master => master_key_for(params) } unless @keys[pset]
        return @keys[pset][id] if @keys[pset][id]
        @keys[pset][id] = hkdf_expand(@keys[pset][:master], "1:#{id}", length)
      end
def key_for ( params , id , length = 32 ) pset = { :iters => params . iterations , :salt => params . salt } @keys [ pset ] = { :master => master_key_for ( params ) } unless @keys [ pset ] return @keys [ pset ] [ id ] if @keys [ pset ] [ id ] @keys [ pset ] [ id ] = hkdf_expand ( @keys [ pset ] [ :master ] , "1:#{id}" , length ) end
Generate a key of length bytes based on the iteration count, salt (if
any), and the master secret.
Generate a key of length bytes based on the iteration count salt ( if any ) and the master secret .
params
id
length