lib/crypto.js
function deriveSecret(parent_secret, child_name, hash_algorithm) {
  if (!hash_algorithm) {
    hash_algorithm = 'sha512';
  }

  return crypto.createHmac(hash_algorithm, parent_secret).update(child_name).digest('hex');
}
function deriveSecret(parent_secret, child_name, hash_algorithm) {
  if (!hash_algorithm) {
    hash_algorithm = 'sha512';
  }

  return crypto.createHmac(hash_algorithm, parent_secret).update(child_name).digest('hex');
}
function deriveSecret ( parent_secret , child_name , hash_algorithm ) { if ( ! hash_algorithm ) { hash_algorithm = 'sha512' ; } return crypto . createHmac ( hash_algorithm , parent_secret ) . update ( child_name ) . digest ( 'hex' ) ; }
Derive a "child" secret from a "parent" one using HMAC.

@param {String} parent_secret
@param {String} child_name
@param {String} ['sha512'] hash_algorithm

@returns {String} Note that the number of bits depends on the hash algorithm used
Derive a child secret from a parent one using HMAC .