1.0.1 • Published 9 years ago

nh-cryptohash v1.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

node-cryptohash

A super simple library to create password hmac-sha1 hashes using the Node.js crypto module.

var hasher = require('nh-cryptohash')

set options hasher.options = {

  • salt_length: int, (default 64)
  • iterations: int, (default 1000)
  • hash_length: int, (default 64)

}

Object createHash(password String, salt String)
returns { hashedPassword: string, salt: string }

The salt is randomly generated using pseudoRandomBytes if none is given.

Boolean verifyHash(password, salt, pWhash)

password can be the password to check (for example read from input field)
salt is the salt used to initially hash the password (for example stored in db)
pWhash is the stored hash of the initial password (for example stored in db)

Then returns true or false