Generate secure password hashes using Bcrypt, a password-hashing function designed for security.
Create a secure hash from a password
Check if a password matches a Bcrypt hash
Bcrypt is a password-hashing function designed by Niels Provos and David Mazières, based on the Blowfish cipher. It is specifically designed for password hashing, incorporating a salt to protect against rainbow table attacks and adaptive cost to remain resistant to brute-force attacks as computing power increases.
A Bcrypt hash typically looks like this:
$2b$12$LJ3m5ZlpLMqKVN8a49jnXe9orx9HnKrSJ0zF0d4qXJQGYQTEXqOXu
This format contains:
$2b$
- The hash algorithm identifier (2b for Bcrypt)12$
- The cost factor (12 rounds in this example)LJ3m5ZlpLMqKVN8a49jnXe
- The 22-character salt (base64 encoded)9orx9HnKrSJ0zF0d4qXJQGYQTEXqOXu
- The 31-character hash (base64 encoded)Cost Factor | Iterations (2^cost) | Typical Use Case |
---|---|---|
10 | 1,024 | Minimum recommended for production |
12 | 4,096 | Recommended for most applications |
14 | 16,384 | High-security applications |