# hashed-password

> A simple TS package used for hashed password generation and verification

Latest version **1.1.0** (published 2022-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install hashed-password
pnpm add hashed-password
yarn add hashed-password
bun add hashed-password
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2022-05-08 |
| First published | 2021-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1016.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | sonalan |
| Maintainers | sonalan |

## Links

- npm: https://www.npmjs.com/package/hashed-password
- Repository: https://github.com/sonalan/hashed-password
- Homepage: https://github.com/sonalan/hashed-password#readme
- Issues: https://github.com/sonalan/hashed-password/issues
- npm.io page: https://npm.io/package/hashed-password

## Recent versions

- 1.1.0 (latest) — 2022-05-08
- 1.0.5 — 2022-01-04
- 1.0.4 — 2021-12-31
- 1.0.3 — 2021-12-31
- 1.0.2 — 2021-12-31
- 1.0.1 — 2021-12-29

## README

# Hashed Password

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

## Installation
```
yarn add hashed-password
```

## Ussage
```javascript 
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 : <a href="https://9f9yo.csb.app/">Demo Url</a>

React Sample: <a href="https://codesandbox.io/s/magical-cookies-9f9yo?">Code Sandbox</a>
 
## Functions

<dl>
<dt><a href="#validatePassword">validatePassword(inputPassword, salt, storedHash)</a> ⇒ <code>boolean</code></dt>
<dd><p>Given an input password a salt and an hash
Does the given password mathc with the hash</p>
</dd>
<dt><a href="#hashPassword">hashPassword(password)</a> ⇒ <code><a href="#HashAndSalt">HashAndSalt</a></code></dt>
<dd><p>Given a Password and hash it with a salt, then return the hash and the salt</p>
</dd>
<dt><a href="#randomPassword">randomPassword(length, options)</a> ⇒ <code>string</code></dt>
<dd><p>Returns a random password based on given params</p>
</dd>
</dl>

## Typedefs

<dl>
<dt><a href="#HashAndSalt">HashAndSalt</a> : <code>Object</code></dt>
<dd></dd>
</dl>

<a name="validatePassword"></a>

## validatePassword(inputPassword, salt, storedHash) ⇒ <code>boolean</code>
Given an input password a salt and an hash
Does the given password mathc with the hash

**Kind**: global function  
**Returns**: <code>boolean</code> - does hash(input Password + salt ) === storedHash?  

| Param | Type |
| --- | --- |
| inputPassword | <code>string</code> | 
| salt | <code>string</code> | 
| storedHash | <code>string</code> | 

<a name="hashPassword"></a>

## hashPassword(password) ⇒ [<code>HashAndSalt</code>](#HashAndSalt)
Given a Password and hash it with a salt, then return the hash and the salt

**Kind**: global function  
**Returns**: [<code>HashAndSalt</code>](#HashAndSalt) - object containing the hash and the salt usedP  

| Param | Type |
| --- | --- |
| password | <code>string</code> | 

<a name="randomPassword"></a>

## randomPassword(length, options) ⇒ <code>string</code>
Returns a random password based on given params

**Kind**: global function  

| Param | Type |
| --- | --- |
| length | <code>number</code> | 
| options | <code>passwordOptions</code> | 

<a name="HashAndSalt"></a>

## HashAndSalt : <code>Object</code>
**Kind**: global typedef  
**Properties**

| Name | Type | Description |
| --- | --- | --- |
| hash | <code>string</code> | The hash we got |
| salt | <code>string</code> | The salt used for hashing |

---
_Source: https://npm.io/package/hashed-password · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
