function pbkdf2 (password, salt, iterations, keySize, hash) {
  const hasher = hashName[hash]
  if (!hasher) {
    throw new Error(`Hash '${hash}' is unknown or not supported`)
  }
  const dek = forgePbkdf2(
    password,
    salt,
    iterations,
    keySize,
    hasher)
  return forgeUtil.encode64(dek)
}
function pbkdf2 (password, salt, iterations, keySize, hash) {
  const hasher = hashName[hash]
  if (!hasher) {
    throw new Error(`Hash '${hash}' is unknown or not supported`)
  }
  const dek = forgePbkdf2(
    password,
    salt,
    iterations,
    keySize,
    hasher)
  return forgeUtil.encode64(dek)
}
function pbkdf2 ( password , salt , iterations , keySize , hash ) { const hasher = hashName [ hash ] if ( ! hasher ) { throw new Error ( ` ${ hash } ` ) } const dek = forgePbkdf2 ( password , salt , iterations , keySize , hasher ) return forgeUtil . encode64 ( dek ) }
Computes the Password-Based Key Derivation Function 2.

@param {string} password
@param {string} salt
@param {number} iterations
@param {number} keySize (in bytes)
@param {string} hash - The hash name ('sha1', 'sha2-512, ...)
@returns {string} - A new password
Computes the Password - Based Key Derivation Function 2 .