Hashes/Crypto

Bcrypt Hash + Verify

Hash passwords with bcrypt (random salt, adjustable cost) and verify a password against an existing bcrypt hash.


                    

Bcrypt is a deliberately slow password-hashing algorithm: unlike MD5 or SHA-256, it intentionally requires heavy computation so that brute-forcing passwords stays impractical even if a database of hashes leaks.

How to use it

Common uses

Things to keep in mind

Pick a cost factor that keeps hashing around 100-300ms on your target server — a balance between security and login-time load.

Bcrypt truncates passwords longer than 72 bytes — characters beyond that limit are ignored by the algorithm.

Article about this tool: Bcrypt: why passwords are hashed slowly, not quickly

Frequently asked questions

Why does bcrypt include a "cost" or "rounds" factor?

The cost factor controls how many times the hashing is repeated internally, so hashing gets exponentially slower as it increases. This lets you deliberately keep it slow enough to resist brute-force attacks even as hardware gets faster.

Why is the bcrypt hash always the same length regardless of my password?

Bcrypt outputs a fixed-length hash (typically 60 characters) that encodes the algorithm version, cost factor, salt, and hash together — the length doesn't depend on how long or short the original password was.

Does bcrypt need a separate salt field?

No. The salt is generated automatically and embedded directly in the output string, so you don't need to store or manage it separately — it's included whenever you verify a password against the hash.

Is there a limit on password length in bcrypt?

Yes, bcrypt only processes the first 72 bytes of a password — anything beyond that is silently dropped without warning. In practice this is rarely an issue, but it's worth remembering when working with very long passwords or non-ASCII characters, where one character can take up multiple bytes.

Why is bcrypt still recommended if Argon2 exists?

Bcrypt has been battle-tested for decades, is widely supported across every language and framework, and remains a perfectly solid choice. Argon2 is recommended as the priority pick for new systems due to its resistance to GPU/ASIC attacks, but bcrypt isn't considered unsafe — just less resistant to specialized hardware.

Articles: Hashes/Crypto

Hash Generator: how MD5, SHA-1, and SHA-256 differ from each other

Why MD5 is still used to verify file integrity, but not for passwords.

Checksum Verifier: how to check that a file isn't corrupted

Why a matching checksum confirms a file's integrity, but not who created it.

HMAC: how a keyed hash differs from a regular hash

Why a plain SHA-256 doesn't protect against message tampering, but HMAC does.

UUID: how identifiers that almost never repeat are generated

Why UUID v4 can be generated independently on millions of machines without collision risk.

Password Generator: what actually makes a password strong

Why a long dictionary-word password is stronger than a short one with symbols and digits.

AES: how symmetric encryption works

Why the same key both encrypts and decrypts data in AES, and how that differs from asymmetric encryption.

Argon2: why this algorithm won the password hashing competition

How Argon2 defends better against GPU-based attacks than older password hashing algorithms.

Scrypt: why the algorithm needs so much memory

Why scrypt deliberately demands a lot of memory to make cracking on ASIC devices harder.

TOTP: how one-time codes in authenticator apps work

Why the code in Google Authenticator works offline and syncs with the server only via time.

PBKDF2: the oldest key-stretching standard

Why the recommended PBKDF2 iteration count keeps growing every year.

X.509: what's inside an SSL certificate

What exactly the browser checks in a site's certificate before showing the green padlock.

PGP: how public-key and private-key encryption works

Why you can freely share a PGP public key but never the private one.