1.0.7 • Published 3 years ago

p4ssw0rd v1.0.7

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

p4ssw0rd

Build Status

Generates secure password hashes with SHA-256 and bcrypt. Supports TypeScript.

npm install p4ssw0rd
import * as p4ssw0rd from 'p4ssw0rd';
  • No password length limit
  • Output hash is always 60
  • Configurable bcrypt cost
  • Only one dependency!

Uses bcrypt.js to generate the bcrypt hash. For SHA-512 hash the Node.js Crypto Module is used.

Usage

Hash

const hash = p4ssw0rd.hash(password, options?);

Creates a hash from supplied password. Hash will always be 60 characters long.

Check

if (p4ssw0rd.check(password, hash, options?)) {
  // Passwords match
}

Validates the input password against a stored hash. Returns true if password is correct.

Simulate

p4ssw0rd.simulate();

Simulates validating a real hash. Usefull against timing attacks on login pages.

Options

{
  cost: 10, // The "cost" of bcrypt hash, default is 10
}

Contributing

  1. Clone the git repository
  2. npm install (Make sure NODE_ENV is not set to production)
  3. Make changes
  4. npm run build
  5. npm test

That's it!

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago