drupal-hash

1.0.4 • Public • Published

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);
// returns true or false

Hash new password

var drupalHash = require('drupal-hash');
 
var newPassword = 'superpassword';
var passwordHash = drupalHash.hashPassword(newPassword);
// returns something like '$S$DODRFsy.GX2iSkl2zJ4fsrGRt2S0FOWu0JSA3BqAmSayESbcY3w9'

Check if an old password needs updated

var drupalHash = require('drupal-hash');
 
var passwordHash = '$P$DxTIL/YfZCdJtFYNh1Ef9ERbMBkuQ91';
var needsHash = drupalHash.needsNewHash(passwordHash);
// return true or false

Testing

npm install
npm test

Readme

Keywords

Package Sidebar

Install

npm i drupal-hash

Weekly Downloads

870

Version

1.0.4

License

none

Last publish

Collaborators

  • wegolookdev
  • mmcnees-wgl
  • joe.hayden
  • dhanarayappan
  • madhurprimus
  • ipshu
  • jfrench
  • trobeson
  • pat_rich
  • xsvc_integrations
  • devonlucey