Optimized bcrypt in plain JavaScript with zero dependencies, with TypeScript support. Compatible to 'bcrypt'.. Use when: From GitHub via jsDelivr:<br />; Callback<`T`>: `(err: Error | null, result?: T) => void`<br />; ProgressCallback: `(percentage: number) => void`<br />. NOT for: runtime application logic; package management (use npm/yarn).
Install
npx skillscat add yusenthebot/skills-pack/bcryptjs Install via the SkillsCat registry.
SKILL.md
bcryptjs
Overview
Optimized bcrypt in plain JavaScript with zero dependencies, with TypeScript support. Compatible to 'bcrypt'.. Compatible to the C++ bcrypt binding on Node.js and also working in the browser.
Installation
npm install bcryptjsCore API / Usage
$> npm install bcryptjsimport bcrypt from "bcryptjs";Common Patterns
Pattern 1
const salt = bcrypt.genSaltSync(10);
const hash = bcrypt.hashSync("B4c0/\/", salt);
// Store hash in your password DBPattern 2
// Load hash from your password DB
bcrypt.compareSync("B4c0/\/", hash); // true
bcrypt.compareSync("not_bacon", hash); // falsePattern 3
const hash = bcrypt.hashSync("bacon", 10);Configuration
See the official documentation for configuration options and advanced settings.
Tips & Gotchas
- Includes built-in TypeScript type definitions.
- Works in both Node.js and browser environments.