This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

pw-hash

0.1.1 • Public • Published

pw-hash

Easy and secure password hashing with salt.

Build Status Test Coverage License: MIT

bitHound Code bitHound Overall Score bitHound Dependencies

Highlights

  • 100% tested.
  • No dependencies.
  • Uses a strong hash algorithm by default (sha256).
  • Appends a random string (salt) to each password before hashing it (for extra security).
  • JSDoc documentation for completion in editors like VS Code.

Installation

npm i pw-hash

Usage

const hash = require('pw-hash')
 
// hash a password:
const hashString = hash.create('example password')
 
 
// verify if a password matches
hash.verify('wrong password', hashString) // false
hash.verify('example password', hashString) // true

API

hash.create(password)

  • password <string> - A string containing the password.

Returns a string that can be stored in the database. It can be used with the verify method to check if a password matches.

hash.verify(password, hashString)

  • password <string> - A string containing the password.
  • hashString <string> - A string that was created with the .create() method.

This method verifies if the password is the same password that you passed to the .create() method. It Returns true if the password matches or false if it doesn't.

Package Sidebar

Install

npm i pw-hash

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • robojones