password-hashing-entreprenerd

1.0.0 • Public • Published

password-hashing

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

Installation

yarn add password-hashing

## Usage

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

const { hash, salt } = hashPassword("YOUR PASSWORD")

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

Functions

validatePassword(inputPassword, salt, storedHash)boolean

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

hashPassword(password)HashAndSalt

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

Typedefs

HashAndSalt : Object

validatePassword(inputPassword, salt, storedHash) ⇒ boolean

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

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

Param Type
inputPassword string
salt string
storedHash string

hashPassword(password) ⇒ HashAndSalt

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

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

Param Type
password string

HashAndSalt : Object

Kind: global typedef
Properties

Name Type Description
hash string The hash we got
salt string The salt used to hash

/password-hashing-entreprenerd/

    Package Sidebar

    Install

    npm i password-hashing-entreprenerd

    Weekly Downloads

    1

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    1.03 MB

    Total Files

    49

    Last publish

    Collaborators

    • gallodasballo