Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drupal-hash-v2

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drupal-hash-v2

JavaScript implementation of the hashing algorithm used in Drupal

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 24 Feb 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc