Security
security
passwords
hashing
What is Bcrypt?
Definition
Bcrypt is a password hashing function designed to be slow on purpose. It incorporates a salt and a configurable cost factor that controls the number of iterations, making brute-force attacks exponentially harder as hardware improves.
Why It Matters
Bcrypt is the recommended algorithm for password storage. Unlike MD5 or SHA-256, it is deliberately slow — hashing one password takes ~100ms instead of microseconds. This makes large-scale brute-force attacks impractical while remaining fast enough for login verification.
Code Example
import bcrypt
hashed = bcrypt.hashpw(b'my_password', bcrypt.gensalt())
print(hashed) # $2b$12$...
Language: python