Skip to content

Password hashing and verification for Node using the built-in crypto.pbkdf2 (HMAC-SHA1).

Notifications You must be signed in to change notification settings

mpeak/pbkdf2-hasher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pbkdf2-hasher

Password hashing and verification for Node using the built-in crypto.pbkdf2 (HMAC-SHA1).

The number of iterations is fixed to 10,000. The salt is a randomly-generated 160-bit value. Both the salt and password hash are represented in base64 so the combined hash can be stored as a string and easily saved (e.g. to a database).

Installation

$ npm install pbkdf2-hasher

Usage

Both generating and verifying the hash take an async callback, because PBKDF2 is meant to take a significant time to process.

Generating a hash

var hasher = require('pbkdf2-hasher');
hasher.generate('mypassword', function(err, hash) {
    // `hash` has the format "algorithm$iterations$salt$hash".
});

Verifying a hash

var hasher = require('pbkdf2-hasher');
hasher.verify('mypassword', 'myhash', function(err, verified) {
    // `verified` is true or false.
});

About

Password hashing and verification for Node using the built-in crypto.pbkdf2 (HMAC-SHA1).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published