1.1.0 • Published 2 years ago

hashed-password v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Hashed Password

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

Installation

yarn add hashed-password

Ussage

import { validatePassword, hashPassword, randomPassword } from "hashed-password"

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

const isValid = validatePassword("YOUR PASSWORD", salt, hash); 

const securePass = randomPassword(10,{numbers: false, symbols: false})
 

Demo

Demo : Demo Url

React Sample: Code Sandbox

Functions

Typedefs

validatePassword(inputPassword, salt, storedHash) ⇒ boolean

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

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

ParamType
inputPasswordstring
saltstring
storedHashstring

hashPassword(password) ⇒ HashAndSalt

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

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

ParamType
passwordstring

randomPassword(length, options) ⇒ string

Returns a random password based on given params

Kind: global function

ParamType
lengthnumber
optionspasswordOptions

HashAndSalt : Object

Kind: global typedef
Properties

NameTypeDescription
hashstringThe hash we got
saltstringThe salt used for hashing
1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago