1.0.2 • Published 3 years ago

password-hashing-jp v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

password-hasing

A simple package to hash passwords and verify if the password and the hash match the

Installation

yarns add password-hashing-jp

Usage

import { validatePassword, hashPassword } from "password-hashing-jp"

const { hash, salt } = hashPassword("YOUR PASSWORD")
const isValid = validatePassword("YOUR PASSWORD", salt, hash) // Is the password valid?

Functions

Typedefs

validatePassword(inputPassword, salt, storedHash) ⇒ boolean

Given an input password a salt ans a hash Does the given password match with the hash?

Kind: global function
Returns: boolean - does hash(inputPassword + salt) === storedHash?

ParamType
inputPasswordstring
saltstring
storedHashstring

hashPassword(password) ⇒ HashAndSalt

Given a Password, hash it with salt, then return the hash and the salt

Kind: global function
Returns: HashAndSalt - object containing the hash and the salt

ParamType
passwordstring

HashAndSalt : Object

Kind: global typedef
Properties

NameTypeDescription
hashstringThe hash we got
saltstringThe salt used for hashing