hash_length = (hash) => {
  switch (hash) {
    case 'sha256': return 32
    case 'sha512': return 64
    case 'sha224': return 28
    case 'sha384': return 48
    case 'sha3-256': return 32
    case 'sha3-512': return 64
    case 'sha3-224': return 28
    case 'sha3-384': return 48
    case 'blake2s256': return 32
    case 'blake2b512': return 64
    case 'sha1': return 20
    case 'md5': return 16
    default: {
      let len = g_digestLenCache[hash]

      if (len === undefined) {
        len = createHash(hash).digest().length
        g_digestLenCache[hash] = len
      }

      return len
    }
  }
}
Get expected hash length.

@func
@alias hkdf.hash_length
@param {string} hash - Hash algorithm
@returns {integer} hash digest byte length

@note Values are hardcoded with fallback for unknown algorithms.