Socket
Socket
Sign inDemoInstall

drupal-hash-v2

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    drupal-hash-v2

JavaScript implementation of the hashing algorithm used in Drupal


Version published
Weekly downloads
67
decreased by-27.96%
Maintainers
1
Install size
14.1 kB
Created
Weekly downloads
 

Readme

Source

Drupal Hash v2

This is a port of the Drupal 7 password hashing algorithms

Usage

npm install drupal-hash-v2
yarn add drupal-hash-v2

Check 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 false

Hash 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 false

Testing

yarn install
yarn test

Credits

This package is an updated version of drupal-hash originally created by wegolook

Keywords

FAQs

Last updated on 24 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc