What is bcrypt?
Bcrypt is a password-hashing algorithm designed to be slow, which makes brute-force attacks expensive. Each hash includes a random salt and a cost factor, so the same password produces a different hash every time. It is a solid, widely used choice for storing passwords.
The cost factor
The cost (rounds) sets how much work each hash takes — each step up roughly doubles the time. Higher is more secure but slower. A value of 10–12 is common for web apps; raise it as hardware improves.
Example
A bcrypt hash looks like $2a$10$N9qo8uLOickgx2ZMRZoMy…. The $2a$ is the version, 10 is the cost, and the rest contains the salt and hash.
Note: This runs locally for learning and testing. For production, hash passwords on your server, never in the browser, and never send plaintext passwords to third parties.