Every few months another breach makes the news, and the announcement usually includes the same reassurance: the passwords were hashed. That word is doing a lot of work. A password hashed with MD5 and one hashed with bcrypt are both technically hashed, the way a screen door and a bank vault are both technically doors. If an attacker walks away with the password file, the algorithm decides whether they crack most of it over a weekend or give up on all but the weakest entries.

This guide compares the two on the one job that separates them: storing passwords. MD5 was designed to be fast, and for passwords, speed is the problem. bcrypt is slow on purpose, salted per password, and adjustable as computers improve. The Bcrypt Hash Generator lets you see the difference directly: hash the same password twice and watch the result change.

Contents

  • Quick answer
  • Why speed is a virtue everywhere else
  • The password guessing game is played offline
  • No salt means the work is done in advance
  • bcrypt's cost factor is a dial, not a fixed speed
  • How to compare the two, step by step
  • Worked example: one password, two algorithms
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

For passwords, use the slow, salted hash: bcrypt. MD5 computes its digest almost instantly and uses no salt, so an attacker who steals an MD5 password file can test guesses at enormous speed and look common passwords up in precomputed rainbow tables. bcrypt is deliberately slow, mixes a fresh random salt into every password, and has a cost factor that rises as hardware improves, so each guess stays expensive. MD5 keeps legitimate non-password jobs, like quick checksums; it is simply the wrong tool for passwords.

Why speed is a virtue everywhere else

Most hashing has nothing to do with passwords. You hash a file to fingerprint it: to confirm a download arrived intact, or spot that a document changed. For those jobs you want the hash computed as fast as possible, and MD5 was designed for exactly that speed.

MD5 is also deterministic, which a fingerprint has to be. The MD5 of the text abc is a fixed, published value:

900150983cd24fb0d6963f7d28e17f72

Anyone, anywhere, hashing abc with MD5 gets that string, every time. For passwords, both properties are gifts to the attacker: guesses cost almost nothing, and answers can be computed in advance.

The password guessing game is played offline

Guessing through a login form is slow, and servers can limit attempts. The real attack starts after a breach, when the attacker already has the file of hashed passwords and can work on their own hardware, at their own pace, with nobody watching.

Now count who pays for hashing. The defender hashes a password once per login; even a deliberately slow hash costs a fraction of a second. The attacker hashes every guess, and cracking a file means guesses in the billions, each paid for in full. With MD5, one hash costs almost nothing, so billions of guesses are affordable. A password hash is supposed to be cheap for the defender and ruinous for the attacker; speed destroys that asymmetry.

No salt means the work is done in advance

MD5 has a second problem: it uses no salt. A salt is random data mixed into each password before hashing, different for every password. Without one, the same password always produces the same hash, for every user, on every site.

That makes precomputation possible. A rainbow table pairs likely passwords with the hashes they produce, built in advance. Because MD5 is unsalted and deterministic, an attacker can look a stolen hash up instead of guessing it. The table is built once, reused against every MD5 file ever stolen, and common passwords fall almost instantly.

bcrypt salts every password with fresh randomness and stores the salt inside the resulting hash. Two users with the same password get different hashes, and a precomputed table is useless: it would have to be rebuilt for every single salt.

bcrypt's cost factor is a dial, not a fixed speed

bcrypt's slowness is adjustable. Its cost factor sets how much work one hash takes: cost 10 is the classic default, and cost 12 is four times slower than 10. Real applications tune the cost so one check takes roughly 250 milliseconds on their hardware, which commonly lands between 10 and 13. The dial matters because hardware improves: a cost that made guessing expensive five years ago can be raised as machines get faster. MD5 has no dial: it is as fast as it was designed to be, and it will only ever get cheaper to run.

How to compare the two, step by step

  1. Open the Bcrypt Hash Generator and enter a throwaway password, invented for the test, not one you use.
  2. Set the cost factor to 10, the classic default, and generate the hash.
  3. Generate again with the same password and cost. The new hash is completely different, because a fresh random salt was mixed in.
  4. Use the Verify section with the original password against either hash. Both match: verification extracts the stored salt and repeats the work.
  5. Compare that with the MD5 value above: abc hashes to the same string for everyone, always, which is why a lookup table works on it.

Worked example: one password, two algorithms

Hashing the phrase correct horse battery staple with bcrypt at cost 10 produced this result in one run:

$2b$10$jT61zASMuZO.BYMYrC8tVOrG4f70YI6WdfYJA2RvF4xQe9jYzcUa.

Run it again and the string differs, because the salt is fresh every time; both versions verify against the same password. No table can contain every possible salt, so a stolen hash cannot be looked up. The attacker must guess, and pay the cost-10 price for every attempt.

Set that beside the MD5 of abc from earlier: published, fixed, identical for the whole world. One algorithm hands the attacker a lookup; the other hands them a bill.

Limitations and honest tradeoffs

bcrypt truncates input at 72 bytes, so anything beyond that point in a password does not affect the hash. In the Ovatly tool the cost range is 4 to 12, with warnings at 11 and 12, while production systems commonly use 10 to 13. bcrypt is also not the newest option: Argon2id is the more recent alternative many systems now choose. None of that rescues MD5 for passwords: its problems go beyond speed, since forged collisions are practical, so it is not safe for security purposes in general, only where nobody is trying to fool the check.

Common mistakes

  • Storing passwords with MD5 because the output looks scrambled. Looks are not the test; the cost of guessing is.
  • Assuming irreversible means uncrackable. Reversal was never the attack. Guessing is, and MD5 makes it nearly free.
  • Believing the word "hashed" on a breach notice settles the question. The algorithm and the salt decide what a stolen file is worth.
  • Setting a bcrypt cost once and forgetting it. The dial exists to be turned as hardware improves; an old cost may no longer make guesses expensive.

FAQs

Why is a fast hash bad for passwords? The guessing happens on the attacker's own hardware, at the attacker's pace, after a hash file is stolen. A fast hash lets them test candidates in enormous numbers for almost nothing. The defender hashes one password per login, so a slow hash costs the defender a fraction of a second and the attacker that cost multiplied by billions of guesses.

What is a rainbow table? A precomputed table pairing likely passwords with the hashes they produce. Because MD5 is unsalted and deterministic, the same password always produces the same hash, so a stolen hash can be looked up instead of guessed. A fresh random salt per password defeats the table: it would have to be rebuilt for every salt.

Is MD5 useless now? No. MD5 keeps legitimate non-password uses, such as quick checksums that spot accidental changes in a file. What it cannot do is protect passwords or anything else where someone might deliberately forge a result, because forged MD5 collisions are practical and it is not safe for security purposes.

Can a bcrypt or MD5 hash be reversed? Neither is mathematically reversible. The only route back is guessing an input, hashing it, and comparing the result. That is precisely why the cost of a single guess matters so much: MD5 makes each guess nearly free, while bcrypt is built to make every guess expensive.

What cost factor should bcrypt use? Real applications tune the cost so one check takes roughly 250 milliseconds on their hardware, which commonly lands between 10 and 13. In the Ovatly tool the range is 4 to 12: 10 is the classic default, 12 is four times slower than 10, and warnings show at 11 and 12.

Conclusion

Speed is what MD5 was built for, and speed is what a password hash cannot afford. bcrypt is slow on purpose, salted per password, and adjustable as hardware improves, which is why it is the right shape for the job. Generate a few hashes in the Bcrypt Hash Generator to see it. Our companion guide covers the other half: how to verify a password against a bcrypt hash. For more in this series, see our Security and Privacy guides.

References