thali/NextGeneration/security/hkdf.js
function HKDF(hashAlg, salt, ikm) {
  if (!(this instanceof HKDF)) { return new HKDF(hashAlg, salt, ikm); }

  this.hashAlg = hashAlg;

  // create the hash alg to see if it exists and get its length
  var hash = crypto.createHash(this.hashAlg);
  this.hashLength = hash.digest().length;

  this.salt = salt || zeros(this.hashLength);
  this.ikm = ikm;

  // now we compute the PRK
  var hmac = crypto.createHmac(this.hashAlg, this.salt);
  hmac.update(this.ikm);
  this.prk = hmac.digest();
}
function HKDF(hashAlg, salt, ikm) {
  if (!(this instanceof HKDF)) { return new HKDF(hashAlg, salt, ikm); }

  this.hashAlg = hashAlg;

  // create the hash alg to see if it exists and get its length
  var hash = crypto.createHash(this.hashAlg);
  this.hashLength = hash.digest().length;

  this.salt = salt || zeros(this.hashLength);
  this.ikm = ikm;

  // now we compute the PRK
  var hmac = crypto.createHmac(this.hashAlg, this.salt);
  hmac.update(this.ikm);
  this.prk = hmac.digest();
}
function HKDF ( hashAlg , salt , ikm ) { if ( ! ( this instanceof HKDF ) ) { return new HKDF ( hashAlg , salt , ikm ) ; } this . hashAlg = hashAlg ; // create the hash alg to see if it exists and get its length var hash = crypto . createHash ( this . hashAlg ) ; this . hashLength = hash . digest ( ) . length ; this . salt = salt || zeros ( this . hashLength ) ; this . ikm = ikm ; // now we compute the PRK var hmac = crypto . createHmac ( this . hashAlg , this . salt ) ; hmac . update ( this . ikm ) ; this . prk = hmac . digest ( ) ; }
ikm is initial keying material
ikm is initial keying material