index.js
function needsRehash(hash, algo, options) {
  const info = getInfo(hash);

  if (info.algorithm !== (algo || DEFAULT_ALGO)) {
    return true;
  }

  const algoNeedsRehash = getAlgorithmFromId(info.id).needsRehash;
  const result = algoNeedsRehash && algoNeedsRehash(hash, info);
  if (typeof result === "boolean") {
    return result;
  }

  const expected = Object.assign(
    Object.create(null),
    globalOptions[info.algorithm],
    options
  );
  const actual = info.options;

  for (const prop in actual) {
    const value = actual[prop];
    if (typeof value === "number" && value < expected[prop]) {
      return true;
    }
  }

  return false;
}
function needsRehash(hash, algo, options) {
  const info = getInfo(hash);

  if (info.algorithm !== (algo || DEFAULT_ALGO)) {
    return true;
  }

  const algoNeedsRehash = getAlgorithmFromId(info.id).needsRehash;
  const result = algoNeedsRehash && algoNeedsRehash(hash, info);
  if (typeof result === "boolean") {
    return result;
  }

  const expected = Object.assign(
    Object.create(null),
    globalOptions[info.algorithm],
    options
  );
  const actual = info.options;

  for (const prop in actual) {
    const value = actual[prop];
    if (typeof value === "number" && value < expected[prop]) {
      return true;
    }
  }

  return false;
}
function needsRehash ( hash , algo , options ) { const info = getInfo ( hash ) ; if ( info . algorithm !== ( algo || DEFAULT_ALGO ) ) { return true ; } const algoNeedsRehash = getAlgorithmFromId ( info . id ) . needsRehash ; const result = algoNeedsRehash && algoNeedsRehash ( hash , info ) ; if ( typeof result === "boolean" ) { return result ; } const expected = Object . assign ( Object . create ( null ) , globalOptions [ info . algorithm ] , options ) ; const actual = info . options ; for ( const prop in actual ) { const value = actual [ prop ] ; if ( typeof value === "number" && value < expected [ prop ] ) { return true ; } } return false ; }
Checks whether the hash needs to be recomputed.

The hash should be recomputed if it does not use the given
algorithm and options.

@param {string} hash The hash to analyse.
@param {integer} algo The algorithm to use.
@param {options} options The options to use.

@return {boolean} Whether the hash needs to be recomputed.
Checks whether the hash needs to be recomputed .