← Cryptography guide

K059 / Hashes, MACs and key derivation

bcrypt

bcrypt password hashing · Survey date 2026-12-05

A password-hashing scheme called bcrypt, based on Blowfish.

CRYPTOGRAPHY LAB / K059

Cryptography Lab · bcrypt

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Toy educational example

bcrypt $2b$ (EksBlowfish, cost 4 or 5)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Open lab →

Definition and overview
A password-hashing scheme called bcrypt, based on Blowfish. Source document ↗
Classification and reversibility
One-way hash, not encryption; cannot be decrypted. Source document ↗
Key or secret requirements
No separate secret key; uses password as key to encrypt known text with salt. Source document ↗
Operating principle and structure
Repeated state expansion with salt/password, then ECB encrypts magic value 64 times. Source document ↗
Key size, block size and parameters
128-bit salt, variable cost/rounds, cited maximum password length 72. Source document ↗
Security strength and recommendation
Prefer Argon2/scrypt for new systems; bcrypt for legacy. Work factor as high as verification-server performance allows, at least 10. Source document ↗
Known attacks and vulnerabilities
Fixed small memory lowers parallel special-hardware cost; truncates input at 72 bytes. Source document ↗
Standards and certification
Not NIST standard; source table indicates no RFC. Source document ↗
Typical uses
Password storage and login verification. Source document ↗
Implementations, libraries and tools
Libraries such as oslo provide hash/verify methods. Source document ↗
Decryption or decoding
No decryption or decoding; one-way. Source document ↗
Advantages
High security strength; adaptive work factor tunes computation cost. Source document ↗
Limitations and cautions
Inputs beyond 72 bytes truncated; cost is single-dimensional. Source document ↗
Distinguishing encryption, encoding and hashing
Claims of bcrypt decryption/decoding are confusion or fraud; hashing is not encryption. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

When user enters password, bcrypt applies random salt and cost, stores hash. At login rehash password using stored salt/cost and compare.

Procedure

Encryption/decryption reverses plaintext/ciphertext with a key; encoding/decoding changes and restores byte representation. bcrypt has no decryption; verify/compare candidate hash against stored hash.

Scenario

Use bcrypt for legacy account DB with cost at least 10 tuned to server. Migrate new services to Argon2id/scrypt and consider rehash upgrade on login.

Pitfalls and alternatives

Do not trust online bcrypt decryption tools. Specify byte-length limit because inputs over 72 bytes may truncate; excessive cost harms availability. Prefer Argon2id/scrypt for new systems.

References