g1joshi/agent-skills/bcrypt
Claude Code and agent skill by g1joshi/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Expert bcrypt hashing assistance covering secure password hashing, salt rounds, and timing attack prevention. Use when hashing passwords, verifying credentials, or managing authentication state.
Install
npx vskill@latest install g1joshi/agent-skills/bcryptSKILL.md
The same SKILL.md was published earlier as g1joshi/agent-skills/bcrypt.
Bcrypt
Bcrypt is a password-hashing function designed to be slow, protecting against brute-force attacks. It incorporates a salt to protect against rainbow table attacks.
When to Use
- User Password Hashing: Hashing user passwords securely before storing them in database tables.
- Authentication Verification: Verifying incoming plaintext passwords against hashed records during login attempts.
- Legacy Credential Protection: Maintaining established authentication backends using the proven, battle-tested bcrypt algorithm.
- Adaptive Cost Factor Tuning: Adjusting computational work factors over time to counter advances in hardware cracking performance.
Quick Start
Core Concepts
The Modular Crypt Format ($2b$ Cost $ Salt + Hash)
Bcrypt outputs a standardized 60-character string encoding the algorithm revision, work factor, 128-bit salt, and 184-bit hash:
Salting & Adaptive Work Factor
Salting prevents rainbow table attacks; the cost factor dictates exponential computation time:
Constant-Time Password Verification
Prevents side-channel timing attacks by performing comparisons in constant time:
Common Patterns
Password Hashing and Constant-Time Verification
Problem: Storing plaintext or unsalted hashes allows rainbow table and timing-attack exploitation.
Solution: Hash with optimal cost factor (12-14 rounds) and verify asynchronously:
Best Practices
Do:
- Use a Work Factor of at least 12: Benchmark hashing time on production servers aiming for 250ms per hash.
- Re-Hash Passwords on Login: Check if legacy hashes have lower cost factors (
bcrypt.getRounds(hash) < 12) and upgrade them dynamically upon successful login. - Handle the 72-Byte Truncation Limit: Pre-hash passwords with SHA-256 before bcrypt if users are permitted to submit arbitrarily long passphrases.
- Offload Hashing from Event Loops: Always use asynchronous
bcrypt.hash()rather than blockingbcrypt.hashSync().
Don't:
- Use MD5, SHA-1, or plain SHA-256 for passwords: Fast general-purpose hashing functions allow billions of guesses per second on consumer GPUs.
- Generate salts manually without cryptographically secure random sources: Use
bcrypt.genSalt()which taps/dev/urandom. - Log or print plaintext passwords: Sanitize incoming request bodies in logging middleware before persisting access logs.
Troubleshooting
| Error | Cause | Solution | |
|---|---|---|---|
Illegal arguments: undefined, string | Plaintext password or hash passed as null/undefined to compare. | Validate that both arguments are non-empty strings before calling bcrypt.compare. | |
High CPU usage / slow responses | Salt rounds set too high (>15) blocking event loop. | Benchmark work factor; recommended value is 12 (approx ~250ms). | |
data and hash arguments required | Parameter ordering reversed in compare function. | Use bcrypt.compare(candidatePassword, storedHash). |
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/security/bcrypt/SKILL.md
Popularity
- Repository stars
- 15
- Repository forks
- 2
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 23 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Grok Build (Cursor)
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/g1joshi/agent-skills/bcrypt)