A simple package to hash password and verify if the passwords match
yarn add validator-package
import { validatePassword, hashPassword } from "validator-package";
const { hash, salt } = hashPassword("YOUR PASSWORD");
const isValid = validatePassword("YOUR PASSWORD", salt, hash);
-
validatePassword(inputPassword, salt, storedHash) ⇒
boolean
-
Given an input password a salt and a hash Does the given password match with the hash?
-
hashPassword(password) ⇒
hashAndSalt
-
Given a password, hash it with a salt and return the hash and salt
-
hashAndSalt :
Object
Given an input password a salt and a hash Does the given password match with the hash?
Kind: global function
Param | Type |
---|---|
inputPassword | string |
salt | string |
storedHash | string |
hashPassword(password) ⇒ hashAndSalt
Given a password, hash it with a salt and return the hash and salt
Kind: global function
Returns: hashAndSalt
- Object containing hash and salt used
Param | Type |
---|---|
password | string |
Kind: global typedef Properties
Name | Type | Description |
---|---|---|
hash | string |
The hash |
salt | string |
The salt used for hashing |