Blowfish Encrypt & Decrypt Online | OpenSSL Compatible | Multiple Modes
Encryption How It Works
What Is Blowfish Encryption?
Blowfish is a symmetric-key block cipher designed by Bruce Schneier in 1993. It uses a variable-length key (32–448 bits) and a 64-bit block size. Blowfish was widely adopted in the 1990s and early 2000s as a fast, patent-free alternative to DES. Its successor, Twofish, was an AES finalist.
This tool provides Blowfish encryption and decryption using the crypto-js library. It supports two output formats: Standard (explicit key 4–56 bytes + 8-byte IV) and OpenSSL Compatible (passphrase with random salt, auto-detecting legacy MD5 and modern SHA-256 key derivation). Five cipher modes (CBC, CFB, OFB, CTR, ECB) and five padding schemes are available. All operations run locally in your browser.
When to Use Blowfish
- Legacy system compatibility — Decrypting data from older systems that use Blowfish
- OpenSSL interoperability — Working with systems using OpenSSL's "Salted__" Blowfish format
- Legacy Chinese systems — Older GBK/GB18030-encoded services that used Blowfish
- Educational purposes — Understanding the evolution of symmetric encryption
- When NOT to use — For all new encryption needs, use AES-256-GCM or ChaCha20-Poly1305 instead
Cipher Comparison
| Algorithm | Key Size | Block Size | Security | Status |
|---|---|---|---|---|
| Blowfish | 32–448-bit | 64-bit | Weak (Sweet32) | Legacy only |
| AES | 128/192/256-bit | 128-bit | Strong | Current standard |
Cipher Modes
| Mode | IV Required | Padding | Recommendation |
|---|---|---|---|
| CBC | Yes (8 bytes) | PKCS7 | Recommended for block data |
| CFB | Yes (8 bytes) | No (streaming) | Good for streaming data |
| OFB | Yes (8 bytes) | No (streaming) | Similar to CFB, error recovery differs |
| CTR | Yes (8 bytes) | No (streaming) | Parallelizable encryption |
| ECB | No | PKCS7 | Not recommended — reveals patterns |
Standards Compliance
- Blowfish — Designed by Bruce Schneier (1993), placed in the public domain
- OpenSSL — Compatible with OpenSSL
bf-cbc,bf-cfb, etc. commands - NIST — Blowfish is not a NIST-approved algorithm; use AES (FIPS 197) for new systems
- Sweet32 — CVE-2016-2183 documents birthday attacks on 64-bit block ciphers
Last updated:
Code Examples
Encrypt with Blowfish using well-audited libraries:
JavaScript — crypto-js (Browser)
// Blowfish-CBC encrypt with crypto-js
import CryptoJS from 'crypto-js';
const key = CryptoJS.lib.WordArray.random(16); // 128-bit key
const iv = CryptoJS.lib.WordArray.random(8); // 64-bit IV
const ct = CryptoJS.Blowfish.encrypt(
'secret message', key,
{ iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }
);
console.log('Ciphertext (Base64):', ct.toString()); Python — PyCryptodome
from Crypto.Cipher import Blowfish
import os
key = os.urandom(16) # 128-bit key
iv = os.urandom(8) # 64-bit IV
cipher = Blowfish.new(key, Blowfish.MODE_CBC, iv)
ct = cipher.encrypt(b'secret message!!') # 16 bytes (padded)
print('Ciphertext (hex):', ct.hex()) Go — golang.org/x/crypto/blowfish
import (
"crypto/cipher"
"golang.org/x/crypto/blowfish"
)
key := []byte("your-secret-key!!") // 16 bytes
iv := make([]byte, blowfish.BlockSize) // 8 bytes
block, _ := blowfish.NewCipher(key)
mode := cipher.NewCBCEncrypter(block, iv)
plaintext := []byte("secret message!!")
mode.CryptBlocks(plaintext, plaintext) Rust — blowfish crate
use blowfish::cipher::{BlockEncrypt, KeyInit};
use blowfish::Blowfish;
let key = b"your-secret-key!!"; // 16 bytes
let cipher = Blowfish::new_from_slice(key).unwrap();
// Use cipher for block-level encryption
// Combine with a mode (CBC, CTR) for full encryption Node.js — OpenSSL Compatible
const CryptoJS = require('crypto-js');
// OpenSSL-compatible passphrase encryption
const passphrase = 'my-secret-passphrase';
const encrypted = CryptoJS.Blowfish.encrypt(
'secret message', passphrase,
{ mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }
);
console.log('OpenSSL format:', encrypted.toString());
// Output starts with "U2FsdGVkX1" (Salted__) Common Pitfalls
Security Notes
Disclaimer
This tool is provided for educational and legacy compatibility purposes only. Blowfish is not recommended for new encryption projects. For production systems, use AES-256-GCM or ChaCha20-Poly1305. Always validate interoperability with your target platform and follow current cryptographic standards.
Further Reading
- Bruce Schneier — Blowfish: A Fast Variable-Key Block Cipher
- Sweet32: Birthday Attacks on 64-bit Block Ciphers
- NIST FIPS 197 — Advanced Encryption Standard (AES)
- OpenSSL enc command — symmetric cipher encryption
Related Concepts
- AES-256 Encryption — The modern replacement for Blowfish
- DES / 3DES Encryption — Another legacy cipher with similar deprecation status
- ChaCha20 Stream Cipher — Modern alternative designed by the same community
Related Tools
Need modern, secure encryption? Use AES Encrypt/Decrypt instead. For working with legacy DES data, see DES Encrypt/Decrypt. For modern stream cipher encryption, try the ChaCha20 Encrypt/Decrypt tool.
Frequently Asked Questions
What padding should I use?
PKCS7 is the modern default and unambiguously marks the end of the plaintext. Zero padding is common in old C implementations. ANSI X9.23 and ISO 10126 appear in specific legacy banking and financial systems. None means the plaintext is already a multiple of the 8-byte block size. Streaming modes (CFB/OFB/CTR) need no padding at all.
What key length does Blowfish need?
Blowfish accepts variable keys from 4 to 56 bytes (32–448 bits). Keys up to 448 bits were a selling point in 1993, when AES did not exist yet. Longer keys do not compensate for the 64-bit block weakness.
Can I decrypt ciphertext from other tools?
Yes. If the ciphertext starts with "U2FsdGVkX1" (Base64 for "Salted__"), it is OpenSSL format — select "OpenSSL Compatible", enter the passphrase, and the tool decrypts it, auto-detecting both legacy MD5 and modern SHA-256 key derivation. For non-OpenSSL ciphertext, select "Standard" and enter the exact key, IV, mode, and padding used for encryption.
Can it decrypt GBK-encoded Chinese data?
Yes. Legacy Chinese systems (older Java services, domestic software) usually stored text in GBK or GB18030 rather than UTF-8. Switch the Character Encoding selector on decrypt to GBK, GB2312, or GB18030 and the output decodes correctly. UTF-16LE (Windows software) is also supported. The encrypt side supports UTF-8, UTF-16LE, and Latin1 only — browsers cannot encode GBK, so paste the original bytes as hex if you need to reproduce GBK ciphertext.
Which cipher mode should I choose?
Use CBC for most cases — it is the most widely supported and recommended mode. Use CFB or OFB for streaming data where padding is undesirable. Use CTR for parallelizable encryption. Avoid ECB unless you are working with legacy data that requires it.
What character encoding should I select for decryption?
Most modern data uses UTF-8. Legacy Chinese systems typically use GBK or GB18030. Older Windows software may use UTF-16LE. Latin1 (ISO-8859-1) covers Western European languages. If the decrypted output looks garbled, try a different encoding — the correct one will produce readable text.
Privacy: This tool runs entirely in your browser — nothing is uploaded or stored. · Disclaimer: For educational purposes only. Not professional security advice.
More in Encryption
AES Encrypt/Decrypt
Encrypt and decrypt with AES-128/192/256 online. GCM, CTR, and OpenSSL-compatible CBC modes. Passphrase or raw key, custom IV.
ChaCha20 / Salsa20 Encrypt/Decrypt
Encrypt and decrypt with ChaCha20, XChaCha20, ChaCha20-Poly1305 (AEAD), or Salsa20 online. Passphrase mode with PBKDF2 key derivation.
RSA Encrypt / Decrypt
Encrypt and decrypt with RSA-OAEP online via Web Crypto API. Built-in key generator, PKCS#8/PKCS#1 conversion, SHA-256/384/512.
DES Encrypt/Decrypt
Encrypt and decrypt with DES or 3DES (Triple DES) online. CBC/ECB/CFB/OFB modes, PKCS7/NoPadding, OpenSSL compatible.
XOR Encrypt/Decrypt
Encrypt and decrypt with XOR cipher online. Text/Hex/Base64 formats, visual XOR table, brute-force key breaking, auto-solve.
JWE Encrypt / Decrypt
Encrypt and decrypt JWE (JSON Web Encryption) tokens online. RSA-OAEP, AES key wrap, PBES2 password-based key management, A128GCM/A256GCM.
PGP Encrypt / Decrypt
Encrypt, decrypt, sign, and verify with OpenPGP online. Public key and password modes, built-in key generator, GnuPG compatible.