index.js
function which(hashstr) {
  if (typeof hashstr !== 'string' || hashstr === '') {
    throw new TypeError('The hashstr param must be an non-empty string.');
  }
  const fields = hashstr.split('$');

  if (fields.length < 3 || fields[0] !== '') {
    throw new TypeError(
      'The hashstr param provided is not in a supported format.'
    );
  }
  const idf = fields[1];

  if (queue.length === 0) {
    throw new Error('No algorithm installed.');
  }

  for (const name of queue) {
    if (funcs[name].identifiers().indexOf(idf) === -1) continue;
    return name;
  }
  return null;
}
function which(hashstr) {
  if (typeof hashstr !== 'string' || hashstr === '') {
    throw new TypeError('The hashstr param must be an non-empty string.');
  }
  const fields = hashstr.split('$');

  if (fields.length < 3 || fields[0] !== '') {
    throw new TypeError(
      'The hashstr param provided is not in a supported format.'
    );
  }
  const idf = fields[1];

  if (queue.length === 0) {
    throw new Error('No algorithm installed.');
  }

  for (const name of queue) {
    if (funcs[name].identifiers().indexOf(idf) === -1) continue;
    return name;
  }
  return null;
}
function which ( hashstr ) { if ( typeof hashstr !== 'string' || hashstr === '' ) { throw new TypeError ( 'The hashstr param must be an non-empty string.' ) ; } const fields = hashstr . split ( '$' ) ; if ( fields . length < 3 || fields [ 0 ] !== '' ) { throw new TypeError ( 'The hashstr param provided is not in a supported format.' ) ; } const idf = fields [ 1 ] ; if ( queue . length === 0 ) { throw new Error ( 'No algorithm installed.' ) ; } for ( const name of queue ) { if ( funcs [ name ] . identifiers ( ) . indexOf ( idf ) === - 1 ) continue ; return name ; } return null ; }
Returns the name of the algorithm that has generated the hash string.
@public
@param {string} hashstr Secure hash string generated from this package.
@return {string|null} The name of password hashing algorithm.
Returns the name of the algorithm that has generated the hash string .