# bcrypt-sd

> this is simple lib for string to hash and compare string and hash

Latest version **1.0.2** (published 2023-08-03) · ISC license · 0 weekly downloads

## Install

```sh
npm install bcrypt-sd
pnpm add bcrypt-sd
yarn add bcrypt-sd
bun add bcrypt-sd
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-08-03 |
| First published | 2023-08-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Inzamam Malik |
| Maintainers | shehza-d |
| Keywords | bcrypt, hash, salt, bcrypt, nodejs |

## Links

- npm: https://www.npmjs.com/package/bcrypt-sd
- Repository: https://github.com/mInzamamMalik/Bcrypt-inzi
- Homepage: https://github.com/mInzamamMalik/Bcrypt-inzi#readme
- Issues: https://github.com/mInzamamMalik/Bcrypt-inzi/issues
- npm.io page: https://npm.io/package/bcrypt-sd

## Dependencies (1)

- [bcrypt](https://npm.io/package/bcrypt.md) ^5.1.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2023-08-03
- 1.0.1 — 2023-08-03
- 1.0.0 — 2023-08-03

## README

[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]

[npm-downloads-image]: https://badgen.net/npm/dy/bcrypt-inzi
[npm-url]: https://npmjs.org/package/bcrypt-inzi
[npm-version-image]: https://badgen.net/npm/v/bcrypt-inzi

# What is Bcrypt

bcrypt is a password hashing function designed by Niels Provos and David Mazières, based on the Blowfish cipher

it is ideal for convert password into hash when saving in database, Besides incorporating a salt to protect against **Rainbow table attacks**, bcrypt is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to **brute-force search attacks** even with increasing computation power.

## Installation

```bash
npm i bcrypt-inzi
```

## ES6 Usage

```js
import { stringToHash, varifyHash, validateHash } from "bcrypt-inzi";

stringToHash("pakistan").then((string) => {
  console.log("hash: ", string);
});

varifyHash(
  "pakistan",
  "$2a$10$W3/bbpG0rexRwKBabxbp7efehubSnxDLM7OCEj0MEPAac98EUa9mW"
)
  .then((result) => {
    if (result) {
      console.log("matched");
    } else {
      console.log("not matched");
    }
  })
  .catch((e) => {
    console.log("error: ", e);
  });

validateHash(
  "$2a$10$W3/bbpG0rexRwKBabxbp7efehubSnxDLM7OCEj0MEPAac98EUa9mW"
).then((result) => {
  if (result) {
    console.log("hash is valid");
  } else {
    console.log("hash is invalid");
  }
});
```

## ES5 Usage:

```js
var bcrypt = require("bcrypt-inzi");

bcrypt.stringToHash("pakistan").then((string) => {
  console.log("hash: ", string);
});

bcrypt
  .varifyHash(
    "pakistan",
    "$2a$10$W3/bbpG0rexRwKBabxbp7efehubSnxDLM7OCEj0MEPAac98EUa9mW"
  )
  .then((result) => {
    if (result) {
      console.log("matched");
    } else {
      console.log("not matched");
    }
  })
  .catch((e) => {
    console.log("error: ", e);
  });

bcrypt
  .validateHash("$2a$10$W3/bbpG0rexRwKBabxbp7efehubSnxDLM7OCEj0MEPAac98EUa9mW")
  .then((result) => {
    if (result) {
      console.log("hash is valid");
    } else {
      console.log("hash is invalid");
    }
  });
```

<br>
M.Inzamam Malik,<br>
malikasinger@gmail.com

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