Salted password hashing with PBKDF2. (Adapted from http://crackstation.net/hashing-security.htm)

Usage no npm install needed!

<script type="module">
  import agarcianPasswordhash from 'https://cdn.skypack.dev/@agarcian/passwordhash';


Password Hash

A node.js module to hash passwords based on this article: https://crackstation.net/hashing-security.htm

This produces a password in the following format:

<hashing algorithm>:<number of iterations>:<hashed password>:<unique seed>

For example, the following is a hash for the password Florence123:



The article describes the algorithm to produce a secure hash for a password. Some of the main benefits is that each entry contains its own secure seed, so every record in the database should have a different seed for every password.


npm install @agarcian/passwordhash


var passwordhash = require('@agarcian/passwordhash');

var pwd  = 'my password';
var hash = passwordhash.createHash(pwd, function(err, hash) {
    passwordhash.validatePassword(pwd, hash, function(err, success) {
        console.log('The password hash was validated successfully:' + success ? 'yes' : 'no');

Output should be yes


npm test