2.1.0 • Published 3 years ago
drupal-hash-v2 v2.1.0
Drupal Hash v2
This is a port of the Drupal 7 password hashing algorithms
Usage
npm install drupal-hash-v2yarn add drupal-hash-v2Check existing password
const drupalHash = require('drupal-hash-v2');
const clearPassword = 'superpassword';
const passwordHash = '$S$DODRFsy.GX2iSkl2zJ4fsrGRt2S0FOWu0JSA3BqAmSayESbcY3w9';
const isValid = drupalHash.checkPassword(clearPassword, passwordHash);
// returns true or falseHash new password
const drupalHash = require('drupal-hash-v2');
const newPassword = 'superpassword';
const passwordHash = drupalHash.hashPassword(newPassword);
// returns something like '$S$DODRFsy.GX2iSkl2zJ4fsrGRt2S0FOWu0JSA3BqAmSayESbcY3w9'Check if an old password needs updated
const drupalHash = require('drupal-hash-v2');
const passwordHash = '$P$DxTIL/YfZCdJtFYNh1Ef9ERbMBkuQ91';
const needsHash = drupalHash.needsNewHash(passwordHash);
// return true or falseTesting
yarn install
yarn testCredits
This package is an updated version of drupal-hash originally created by wegolook