npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-django-hashers

v1.1.6

Published

All password hashing algorithms for Django implemented in javascript for nodejs projects.

Downloads

217

Readme

hashers

All password hashing algorithms for Django implemented in javascript for nodejs projects.

Supported Algorithms

  1. PBKDF2PasswordHasher
  2. PBKDF2SHA1PasswordHasher
  3. BCryptSHA256PasswordHasher
  4. BCryptPasswordHasher
  5. SHA1PasswordHasher
  6. MD5PasswordHasher
  7. UnsaltedSHA1PasswordHasher
  8. UnsaltedMD5PasswordHasher
  9. Argon2PasswordHasher

Usage

A simple example just verifying and creating Django compatible passwords:

const hashers = require('node-django-hashers');

const h = new hashers.PBKDF2PasswordHasher();
h.encode("password").then(console.log); // prints the hashed password

You can also get a hashed password, identify the hashing algorithm, and verify the password. The below example is for Argon2PasswordHasher, a similar approach to the above code sample can be used for all the other algorithms.

const hashers = require('node-django-hashers');

// Hashed password from Django
const hash_password = "argon2$argon2i$v=19$m=512,t=2,p=2$ZGIzQXZXdjlaMjRK$2ecZ6JAld41sKwh9Q8KEyQ";

const hash_name = hashers.identifyHasher(hash_password);
const hash_algorithm = hashers.getHasher(hash_name);
hash_algorithm.verify("password", hash_password).then(console.log); // prints true
hash_algorithm.verify("wrong_password", hash_password).then(console.log); // prints false

A good practice is to verify if the password is using the default algorithm, and update the password if necessary on the database. Every hashing algorithm has an algorithm name. You can pass it in and check if updates are required:

const hashers = require('node-django-hashers');

const hash_password = "286755fad04869ca523320acce0dc6a4"; // "password" in md5
const mustUpdate = hashers.mustUpdateHashedPassword(hash_password, "pbkdf2_sha256");
// mustUpdate is true since we do not want MD5 hash passwords, pbkdf2_sha256 is the default

const hash_algorithm = hashers.getHasher("pbkdf2_sha256");
// update the users password in the database by re encoding the password here

Installation

npm install node-django-hashers