Blowfish encryption: how it works and is it still secure?
How the Blowfish cipher works, why its 64-bit block rules it out for bulk encryption, why bcrypt still depends on it, and when to migrate to AES.
By MD-5 Updated 6 min read
Blowfish is a fast, unpatented block cipher from 1993 that has never been practically broken, yet it’s no longer recommended for new encryption. The reason is its 64-bit block size, not any weakness in its design. It also lives on somewhere most developers use every day: the bcrypt password hash.
This guide covers how Blowfish works, what the research says about it, where it still appears, and when to move to AES.
Why Blowfish was created
Bruce Schneier presented Blowfish at the Fast Software Encryption workshop in Cambridge in December 1993. DES was visibly running out of road with its 56-bit key, and the alternatives were patented (IDEA), trade secrets (RC4 at the time) or hampered by US export rules. Schneier’s aim was a cipher that was:
- fast in software on the 32-bit CPUs of the day,
- able to take keys long enough to make brute force irrelevant,
- free: no patent, no license, no royalties.
That combination is why it spread quickly. For years it was the strongest cipher a developer could drop into a project without a lawyer.
How it works
- Block size: 64 bits.
- Key size: 32 to 448 bits. The low end reflects 1990s export limits and should never be used today.
- Structure: a 16-round Feistel network. Each round’s function splits 32 bits into four bytes, looks each up in one of four S-boxes, and combines the results with addition and XOR. It needs nothing but ordinary CPU instructions.
The expensive key schedule
Blowfish’s subkeys are large: an 18-entry P-array and four S-boxes of 256 entries, all 32 bits wide, about 4 KB in total. Every entry starts as a digit of pi (a “nothing up my sleeve” constant anyone can verify). The key is XORed into the P-array, then the cipher repeatedly encrypts a running block with the tables built so far, overwriting entries two at a time until all are replaced. That takes 521 runs of the encryption routine for a single key.
This cuts both ways. For bulk data under one long-lived key, it’s a one-off cost. For protocols that rekey often, it’s slow. And for an attacker, every guessed key costs a full setup, which makes brute force far more expensive than the key length alone suggests. That property became Blowfish’s most lasting contribution, as the bcrypt section below explains.
What the cryptanalysis found
No practical attack on full 16-round Blowfish has been published. The notable results are limited:
- Weak keys (Vaudenay, 1996). Some keys produce duplicate entries in the S-boxes, and for those keys attacks on reduced-round versions (up to 8 rounds) become possible. These keys are vanishingly rare among random keys, and the attacks don’t extend to 16 rounds.
- Reduced-round attacks (Rijmen, 1997, and later work). Attacks on 4 rounds. Attacking fractions of the rounds is how cryptographers measure a design’s safety margin, not evidence of a break.
So the common claim that “Blowfish has been cracked” is wrong. But Blowfish is limited, and the limit is structural.
The 64-bit block problem
With a 64-bit block, the birthday bound says you should expect two identical ciphertext blocks after about 2^32 blocks, roughly 32 GB under one key. In CBC mode that repeat leaks the XOR of two plaintext blocks. A 448-bit key doesn’t help at all.
This became practical in 2016. The Sweet32 research (opens in a new tab) by Bhargavan and Leurent attacked OpenVPN, which then used Blowfish in CBC mode by default, and recovered a secret from 705 GB of traffic captured in 18.6 hours. OpenVPN moved to AES-GCM, and later versions no longer negotiate Blowfish by default. The same research broke 3DES in HTTPS; see the Triple DES guide.
The rule that follows: if a single key will protect more than a few gigabytes, or a connection stays open long enough to carry that much, Blowfish is the wrong cipher regardless of key length.
Where Blowfish is still used
bcrypt: the use that matters
In 1999 Niels Provos and David Mazières published bcrypt (opens in a new tab), a password hash built on a modified Blowfish key schedule (“EksBlowfish”). It takes Blowfish’s slow key setup and repeats it 2^cost times, where the cost factor is tunable. Checking one password stays fast enough for a login; testing billions of guesses becomes very slow. As hardware gets faster, you raise the cost.
bcrypt is still an accepted choice. The OWASP Password Storage Cheat Sheet (opens in a new tab) recommends Argon2id first, then scrypt, and bcrypt with a work factor of 10 or more for systems where those aren’t available. Two things to know if you use it:
- The 72-byte limit. bcrypt only uses the first 72 bytes of input. Longer passphrases are silently truncated, and so are schemes that prepend a long pepper or another hash before calling it.
- The block size doesn’t matter here. bcrypt uses Blowfish’s key schedule for hashing, not the cipher for bulk encryption, so Sweet32 doesn’t apply.
Password storage is checked in every web application penetration test where the tester can see how credentials are handled: unsalted fast hashes such as MD5 or SHA-1 are a common finding; bcrypt at a sensible cost is not.
Legacy systems
- SSH: Blowfish was an early SSH cipher option. OpenSSH dropped it from its defaults and removed it entirely in version 7.6 (2017).
- VPNs: older OpenVPN deployments can still negotiate BF-CBC for compatibility.
- File encryption tools: some archive and file-encryption tools still offer Blowfish. That’s a reasonable fit for single files well under the 32 GB limit, but there is no reason to choose it over AES today.
Schneier himself has recommended Twofish over Blowfish for new work for many years; see the Twofish guide.
Blowfish compared
| Blowfish | Twofish | AES | |
|---|---|---|---|
| Year | 1993 | 1998 | 2001 |
| Block | 64 bits | 128 bits | 128 bits |
| Key | 32 to 448 bits | 128, 192, 256 bits | 128, 192, 256 bits |
| Hardware support in CPUs | No | No | Yes |
| Standardized by NIST | No | No (AES finalist) | Yes |
| Best use today | bcrypt; legacy | Cascades, niche tools | Default for all new encryption |
If you’ve inherited Blowfish
It isn’t an emergency, but it is a migration:
- Cap the data per key well below 32 GB and rekey on a schedule for long-lived connections.
- Authenticate the ciphertext. Blowfish gives confidentiality only. Use encrypt-then-MAC from a library, and verify before decrypting.
- Tag ciphertext with an algorithm identifier if the format doesn’t already record it, so a gradual migration can tell old records from new.
- Run a dual-read period: decrypt both formats, write only AES-GCM, and migrate records as they’re touched.
- Watch for 64-bit assumptions in code: 8-byte padding, IV lengths and buffer sizes break silently against a 128-bit block.
- Verify before deleting the originals and retiring old keys.
- Leave bcrypt hashes alone. You can’t re-hash a password you don’t have. If you move to Argon2id, upgrade each hash the next time that user logs in.
Sources
- B. Schneier, Description of a new variable-length key, 64-bit block cipher (Blowfish) (opens in a new tab), Fast Software Encryption, 1993.
- S. Vaudenay, On the weak keys of Blowfish, Fast Software Encryption, 1996.
- N. Provos, D. Mazières, A future-adaptable password scheme (opens in a new tab), USENIX Annual Technical Conference, 1999.
- K. Bhargavan, G. Leurent, On the practical (in-)security of 64-bit block ciphers (Sweet32) (opens in a new tab), ACM CCS 2016.
- OWASP, Password Storage Cheat Sheet (opens in a new tab).
Published by
MD-5 · Certified cybersecurity services
Articles are researched and written in-house and link to their primary sources (standards, advisories, papers and public datasets) so you can check every claim. Spotted an error? Email contact@md-5.com and we’ll correct it.