Blowfish Encrypt/Decrypt
Encrypt and decrypt text using the Blowfish cipher algorithm online. Supports ECB mode, PKCS#7 padding, Hex and Base64 output encoding.
About
Blowfish is a symmetric-key block cipher designed by Bruce Schneier in 1993. It operates on 64-bit blocks using a variable-length key from 4 to 56 bytes. The algorithm employs a 16-round Feistel network with key-dependent S-boxes. Its key schedule is deliberately expensive: it requires 521 iterations of the encryption routine to derive the 18-entry P-array and four 256-entry S-boxes. This cost is a feature, not a bug. It makes brute-force attacks on short keys computationally painful. Misconfiguring the key or confusing encoding formats (Hex vs. Base64) is the most common source of decryption failures. This tool uses ECB mode with PKCS#7 padding. ECB is deterministic: identical plaintext blocks produce identical ciphertext blocks. For sensitive data requiring semantic security, consider CBC or CTR modes. This implementation is suitable for educational use, data obfuscation, and compatibility testing against Blowfish reference vectors.
Formulas
Blowfish encrypts a 64-bit plaintext block x by splitting it into two 32-bit halves xL and xR, then applying 16 rounds of the Feistel function:
xL = xL ⊕ Pi
xR = F(xL) ⊕ xR
Swap xL, xR
After 16 rounds, undo the last swap, then apply the final subkeys:
xL = xL ⊕ P18
The Feistel function F splits a 32-bit input into four 8-bit quarters a, b, c, d and computes:
Where P1…P18 are the expanded subkeys, S1…S4 are the key-dependent S-boxes, and ⊕ denotes bitwise XOR. PKCS#7 padding appends n bytes of value n, where n = 8 − (len(plaintext) mod 8).
Reference Data
| Parameter | Specification |
|---|---|
| Algorithm | Blowfish (Schneier, 1993) |
| Cipher Type | Symmetric-key block cipher |
| Block Size | 64 bits (8 bytes) |
| Key Length | 32 - 448 bits (4 - 56 bytes) |
| Rounds | 16 (Feistel network) |
| P-array Size | 18 × 32-bit subkeys |
| S-box Count | 4 boxes × 256 entries |
| S-box Entry Size | 32 bits |
| Key Schedule Cost | 521 encryptions |
| Mode (this tool) | ECB (Electronic Codebook) |
| Padding (this tool) | PKCS#7 |
| Output Encoding | Hexadecimal or Base64 |
| Endianness | Big-endian |
| Year Published | 1993 |
| Patent Status | Unpatented, public domain |
| Successor | Twofish (AES finalist, 1998) |
| Common Uses | bcrypt password hashing, legacy VPNs, embedded systems |
| Known Weakness | 64-bit block → birthday attack at 232 blocks (~32 GB) |
| NIST Status | Not FIPS-approved (use AES for compliance) |
| Max Plaintext (this tool) | 100 KB |
Frequently Asked Questions
bf-ecb mode with -nopad disabled matches this tool's output. If OpenSSL uses its custom EVP key derivation (with salt and MD5), the effective key will differ from the passphrase, causing decryption failure.