K004 / Symmetric ciphers (block and stream)
Blowfish
A symmetric block cipher designed by Bruce Schneier in 1993.
CRYPTOGRAPHY LAB / K004
Cryptography Lab · Blowfish
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.
Blowfish (16 rounds)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- A symmetric block cipher designed by Bruce Schneier in 1993. Source document ↗
- Classification and reversibility
- A symmetric block cipher; decryption is possible with the correct key. Source document ↗
- Key or secret requirements
- Requires a secret symmetric key with a variable length of 32–448 bits. Source document ↗
- Operating principle and structure
- A 16-round Feistel network. Source document ↗
- Key size, block size and parameters
- 64-bit block, 32–448-bit key and 16-round Feistel structure. Source document ↗
- Security strength and recommendation
- The 64-bit block size makes it vulnerable to Sweet32; it is not FIPS-approved and is a legacy cipher not recommended for new use. Source document ↗
- Known attacks and vulnerabilities
- Sweet32 (2016), a birthday attack, risks information leakage with large data volumes; no full key-recovery attack against the cipher itself has been disclosed. Source document ↗
- Standards and certification
- Not FIPS-approved and on non-approved lists; not a NIST/FIPS-approved block cipher. Source document ↗
- Typical uses
- Legacy uses include replacing DES/IDEA and encryption on 32-bit microprocessors and in software. Source document ↗
- Implementations, libraries and tools
- Implementation libraries include egoroof-blowfish for browsers and Node.js. Source document ↗
- Decryption or decoding
- Recover plaintext using the same key, mode, padding and IV settings through a decryption API (such as decryptECB). Source document ↗
- Advantages
- Fast in software and available without patents; variable keys and intended as an alternative to DES/IDEA. Source document ↗
- Limitations and cautions
- 64-bit blocks create Sweet32 risk for large data volumes; Twofish is recommended for files over 4 GB. Note the lack of FIPS approval. Source document ↗
- Distinguishing encryption, encoding and hashing
- Blowfish is symmetric block encryption and must be distinguished from encoding such as Base64/Hex and hashing. Source document ↗
Practical examples
Example
Prepare plaintext bytes and a secret symmetric key, select a suitable mode, IV and padding, and produce ciphertext using the block cipher. Only the same key and mode, IV and padding information can recover the plaintext.
Procedure
Encryption: prepare bytes, choose key/mode/IV/padding, encrypt and store ciphertext and metadata. Decryption: supply ciphertext and the same key/mode/IV/padding, decrypt and check plaintext. Encoding/decoding such as Base64 and Hex changes representation without a key and is distinct from encryption.
Scenario
To read Blowfish-encrypted legacy data, confirm the existing key, mode, IV and padding and decrypt it. Migrate new storage and transmission to modern AEAD; avoid new uses except small compatibility needs.
Pitfalls and alternatives
Beware ECB, IV reuse, hardcoded keys, large data volumes with 64-bit blocks and lack of FIPS approval. Replace it in new designs with modern AEAD such as AES-GCM or ChaCha20-Poly1305; do not confuse encryption, encoding and hashing.
References
- Blowfish (cipher) ↗
- blowfish(3) - OpenBSD manual pages ↗
- Blowfish - PyCryptodome ↗
- Description of a New Variable-Length Key, 64-Bit Block Cipher (Blowfish) - Schneier on Security ↗
- MASTG-TEST-0221: Broken Symmetric Encryption Algorithms - OWASP Mobile Application Security ↗
- Blowfish and Twofish: Schneier's Pre-AES Designs | QNSQY ↗
- Blowfish (cipher) — Edgepedia ↗
- README.md ↗
- blowfish - Dart API docs ↗