# crypto-bcrypt

> 注册密码加密，登录密码比对 / hash the password for sign in && hash password for sign up

Latest version **1.1.0** (published 2017-06-12) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2017-06-12 |
| First published | 2017-05-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jon |
| Maintainers | jon_shen |
| Keywords | crypto, bcrypt |

## Links

- npm: https://www.npmjs.com/package/crypto-bcrypt
- Repository: https://github.com/jerossh/crypto-bcrypt
- Homepage: https://github.com/jerossh/crypto-bcrypt#readme
- Issues: https://github.com/jerossh/crypto-bcrypt/issues
- npm.io page: https://npm.io/package/crypto-bcrypt

## 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.1.0 (latest) — 2017-06-12
- 1.0.2 — 2017-06-01
- 1.0.1 — 2017-05-26
- 1.0.0 — 2017-05-25
- 0.0.1 — 2017-05-18

## README

基于 crypto 模块开发的用户注册登录插件

# crypto-bctypt

hash the password  for sign in && hash password for sign up/ 注册密码加密，登录密码比对

## Installation

```bash
npm install crypto-bcrypt --save
```

## Usage 

sign up／ 注册

```js
genPaswd(user1.psw).then(hash => {
  // save the hash
}).catch(err => deal(err))

```

sign in  ／ 登录

```js
compare(hash, user1.psw).then( bool => {
  if (bool) {
    // just to sigin in}
  else {
    // may your pswd is wrong
  }
}).catch(err=> deal(err))

```


## param

genPaswd(pasw, salt, iterations, keylen, digest)

compare(hashedPsw, pasw, salt, iterations, keylen digest)

```js
// genPaswd(yourpassword, 'a password', 1000, 69, 'sha512')

// default
genPaswd(user1.pasw)
// default
compare(hash, user1.psw)


// custom 
const customSalt = 'custom'
genPaswd(user1.pasw, customSalt)
// compare need custom too
compare(hash, user1.psw, customSalt)

```

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