Skip to content
/ pbkdf2 Public

A simple PBKDF2 wrapper with great defaults and a sensible interface

License

Notifications You must be signed in to change notification settings

astromo/pbkdf2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

PBKDF2

This library generates a formatted hash that you can store in your database as a single value.

The format is ALGORITHM:ITTERATIONS:SALT:DERIVED_KEY.

Usage

var PBKDF2 = require('painless-pbkdf2')

Create a password hash

var password = new PBKDF2()
password.create('test123', function(err, hash) {
  // hash: (sha256:64000:VImSI/1MUSFHuQzrbelyaKnjDcp7LoZwZRZmc8ErLq4=:708eb4b660fdb56b911abbdc26faae0aa195dbc84e46da23d48ae7630ef25808)
})

Validate a hash

var hash = 'sha256:64000:VImSI/1MUSFHuQzrbelyaKnjDcp7LoZwZRZmc8ErLq4=:708eb4b660fdb56b911abbdc26faae0aa195dbc84e46da23d48ae7630ef25808'
password = new PBKDF2(hash)

password.validate('test123', function (err, valid) {
  // valid: (true | false)
})

About

A simple PBKDF2 wrapper with great defaults and a sensible interface

Resources

License

Stars

Watchers

Forks

Packages

No packages published