BCrypt
This module provides BCrypt hashing support for deno and the web by providing simple bindings using bcrypt compiled to webassembly.
A non-wasm version is available at @blackberry/bcrypt@0.17.0/mod_polyfill.
Usage
import { hash } from "jsr:@blackberry/bcrypt@0.17.0"; const encoder = new TextEncoder(); const password = encoder.encode("very-cool-password"); const salt = encoder.encode("salty salt woo!!"); console.log(hash(password, salt)); // Should log: // $2b$12$a0DqbFiea0DqbA/1Z06fGOZcRMnat359MTbqezYI1qXvLuOL16Eve
Comparisons
Hashing (per iter):
| Cost | x/bcrypt | x/bcrypt_ffi | @blackberry/bcrypt | Relative speeds |
|---|---|---|---|---|
| 4 | 14.83ms | NA | 1.11ms | 1.00x/NA/13.35x |
| 6 | 18.62ms | NA | 4.27ms | 1.00x/NA/4.36x |
| 8 | 32.05ms | NA | 16.93ms | 1.00x/NA/1.89x |
| 10 | 84.84ms | NA | 67.94ms | 1.00x/NA/1.25x |
| 12 | 298.34ms | NA | 270.70ms | 1.00x/NA/1.10x |
| 13 | 568.96ms | NA | 540.74ms | 1.00x/NA/1.07x |
Verifying (per iter):
Will get to later
Maintainers
- Skyler Calaman (@skylercalaman)
Original bcrypt bindings by:
- Elias Sjögreen (@eliassjogreen)
Other
Contribution
Pull request, issues and feedback are very welcome. Code style is formatted with
deno fmt and commit messages are WERE written following
Conventional Commits spec.
The author of this library is not responsible enough to use them anymore.
License
Copyright 2021, Denosaurs. All rights reserved. MIT license. Copyright 2024, Skyler Calaman. All rights reserved. MIT license.
Add Package
deno add jsr:@blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";
Import directly with a jsr specifier
import * as bcrypt from "jsr:@blckbrry/bcrypt";
Add Package
pnpm i jsr:@blckbrry/bcrypt
pnpm dlx jsr add @blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";
Add Package
yarn add jsr:@blckbrry/bcrypt
yarn dlx jsr add @blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";
Add Package
vlt install jsr:@blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";
Add Package
npx jsr add @blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";
Add Package
bunx jsr add @blckbrry/bcrypt
Import symbol
import * as bcrypt from "@blckbrry/bcrypt";