Skip to content
Agents tracked: 440 Downloads (7d): 202M down 19.5% GitHub stars: 10.4M Releases (7d): 607 Agent status: 1 with issuesSince last limit reset: Claude 28d · Codex 0d Updated Oct 21, 2026

bcryptjs Examples You Can Edit and Run

5 small bcryptjs examples written by AgentGid from the official docs, one feature each. Every one runs in your browser: change the code and see the result at once, or describe a change and let AI rewrite it. The screenshots are taken from the same code by our server, which also checks that each example starts without errors.

bcryptjs: usage and stats 193 AI-built projects use it

Try them all in one place

import bcrypt from 'bcryptjs'

const password = 'correct horse battery staple'

// 1. Generate a salt (10 rounds) and hash the password
const salt = await bcrypt.genSalt(10)
const hash = await bcrypt.hash(password, salt)

console.log('Password:   ', password)
console.log('Salt:       ', salt)
console.log('Hash:       ', hash)
console.log('Hash length:', hash.length)

// 2. Later, check login attempts against the stored hash
const attempts = ['correct horse battery staple', 'Tr0ub4dor&3', 'Correct horse battery staple']
for (const guess of attempts) {
  const ok = await bcrypt.compare(guess, hash)
  console.log(`compare("${guess}") ->`, ok)
}
Ctrl/⌘ + Enter runs

Free for signed-in members, with a daily limit. Describe the change in plain words; the new code runs only in your browser.

Change the password or the guess and run again; the salt and hash are different on every run. Code written by AgentGid [1]. How it works, with a screenshot →

Checked Oct 12, 2026: each example starts without errors in Chromium with bcryptjs 3.0.3. Needs WebGL.

Sources

  1. bcryptjs README (GitHub)

Explanations written by AgentGid from the official docs; the numbers in brackets point here. The code marked "written by AgentGid" is ours and free to copy.

Building something with bcryptjs? Ask AgentGid →