A minimal backend API demonstrating secure password hashing and verification using bcrypt.
This project focuses on one concept only: password hashing lifecycle with configurable salt rounds.
- Node.js
- Express
- bcrypt
- zod (validation)
- Hash password with configurable salt rounds
- Verify password against bcrypt hash
- Analyze bcrypt hash (extract version and cost factor)
- Input validation using zod
- Clean layered project structure
- REST Client test file support
git clone <your-repo-url>
cd password-hash-api
npm installPORT=1198 BCRYPT_SALT_ROUNDS=12
npm run devGET /health
POST /hash
{ "password": "Hello@123", "rounds": 12 }
{ "hash": "$2b$12$...", "roundsUsed": 12 }
POST /verify
{ "password": "Hello@123", "hash": "$2b$12$..." }
{ "ok": true }
GET /analyze/:hash
{ "version": "2b", "rounds": 12 }
- How bcrypt embeds salt inside hash
- Cost factor awareness
- Safe salt round boundaries
- Clean separation of routes, controllers, utils
- Backend micro-service design pattern
- This is a single-purpose backend micro project.
- It intentionally avoids authentication systems, databases, or complex architecture to keep focus on password hashing mechanics.