Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 1.29 KB

README.md

File metadata and controls

48 lines (37 loc) · 1.29 KB

pbkdf2 Build Status

NOTE: Password_hash and salt is a hex string.

Information

Package
Description Hash password and compare with PBKDF2, use sha1, sha256, sha512, etc.
Node Version >= 0.11.11

Install

npm install pbkdf2

Usage

var pbkdf2 = require('pbkdf2');
var p = 'password';
var s = pbkdf2.generateSaltSync(32);
var pwd = pbkdf2.hashSync(p, s, 1, 20, 'sha256');
var bool = pbkdf2.compareSync(pwd, p, s, 1, 20, 'sha256');

API

  • hash(password, salt, iterations, keylen, algorithm, callback(error, password_hash))
  • hashSync(password, salt, iterations, keylen, algorithm), return password_hash
  • generateSalt(callback(error, salt), saltlen)
  • generateSaltSync(saltlen), return salt
  • compare(password_hash, password, salt, iterations, keylen, algorithm, callback(error, bool))
  • compareSync(password_hash, password, salt, iterations, keylen, algorithm), return bool

Bitdeli Badge