Drupal Hash
This is a port of the Drupal 7 password hashing algorithms developed by WeGoLook.
For Node 6 support, use version 1.0.3 or higher.
Usage
Check existing password
var drupalHash = require('drupal-hash');
var clearPassword = 'superpassword';
var passwordHash = '$S$DODRFsy.GX2iSkl2zJ4fsrGRt2S0FOWu0JSA3BqAmSayESbcY3w9';
var isValid = drupalHash.checkPassword(clearPassword, passwordHash);
Hash new password
var drupalHash = require('drupal-hash');
var newPassword = 'superpassword';
var passwordHash = drupalHash.hashPassword(newPassword);
Check if an old password needs updated
var drupalHash = require('drupal-hash');
var passwordHash = '$P$DxTIL/YfZCdJtFYNh1Ef9ERbMBkuQ91';
var needsHash = drupalHash.needsNewHash(passwordHash);
Testing
npm install
npm test