hash-password

0.1.1 • Public • Published

hash-password

A tiny library to hash and salt passwords.

Usage

// make a generator passing options is optional
const pw = password({
  algorithm: 'sha512',
  encoding: 'hex',
  saltLength: 16
});

// create a password hash object from a raw text password
const hashed = pw.generate('aaa');
console.log(hashed); // -> { hash: abcdefghijklmnopqusrtuvwxyz1234567890, salt: 1234567890123456 }

// check if raw text password matches hashed password
console.log(pw.validate('aaa', hashed)); // -> true
console.log(pw.validate('bbb', hashed)); // -> false

Readme

Keywords

none

Package Sidebar

Install

npm i hash-password

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

5.6 kB

Total Files

9

Last publish

Collaborators

  • jazzbrown1