Blowfish
Schneier's 1993 64-bit Feistel cipher with key-dependent S-boxes
Old but not broken. Kept for interoperability; root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.
About Blowfish
Blowfish is a block cipher. It uses a 4–56-byte key and an 8-byte (64-bit) block. Its registry entry cites Schneier 1993. It is also known as blowfish-ecb. NextSSL lists it in the legacy tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).
Overview
Blowfish is a 64-bit block cipher designed by Bruce Schneier in 1993 as a free alternative to DES. It accepts keys from 32 to 448 bits and was widely adopted in the 1990s; its key schedule lives on in the bcrypt password hash.
Blowfish is a 16-round Feistel network. Its F-function splits a 32-bit half into four bytes, looks each up in one of four 256-entry S-boxes, and combines them with additions and XOR. The S-boxes and an 18-entry P-array are initialised from the digits of pi and then repeatedly encrypted under the key, so the key schedule is slow, equivalent to encrypting about 4 KB of data.
That expensive key setup is a drawback for frequent rekeying but was turned into a feature in bcrypt's Eksblowfish. Blowfish was placed in the public domain and was widely used in early SSH, VPN and file-encryption software. It is still found in older embedded systems and archives that need to be decrypted. Its 64-bit block means that no more than a few gigabytes should be encrypted under a single key, since block collisions become likely around 2^32 blocks.
History
1993–2016Blowfish published by Bruce Schneier as a free alternative to DES
bcrypt builds its password hash on Blowfish's key schedule
Sweet32 shows the risk of 64-bit block ciphers in long sessions
Security notes
No practical key-recovery attack on full Blowfish is known, but its 64-bit block makes it vulnerable to birthday-bound attacks such as Sweet32 when large amounts of data are encrypted under one key. Some weak keys produce weak S-boxes. Schneier himself recommends Twofish or AES instead.
Typical uses
Sizes
| Field | Bytes | Meaning |
|---|---|---|
| key | 4 – 56 | Secret key |
| block | 8 | Block |
Use it
from nextssl_demo import NextSSL
root = NextSSL(root=True) # tier 'legacy' is reachable from the root API only
block = root.call("blockcipher_encrypt", "blowfish", None, key, plaintext_block)[0]
nextssl_root_blockcipher_encrypt("blowfish", NULL, key, block, out); /* exactly one block */
use nextssl_core::Params;
use nextssl_registry::{self as reg, Policy};
let alg = reg::new_blockcipher_in(reg::all(), Policy::Any, "blowfish", &Params::new())?;
let out = alg.encrypt_block(&key, &block)?;
Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.
Similar names
Looking for something else?More block ciphers
All 84Frequently asked questions
What is Blowfish?
Blowfish is a block cipher in the Blowfish family. Blowfish is a 64-bit block cipher designed by Bruce Schneier in 1993 as a free alternative to DES. It is also known as blowfish-ecb.
What are the Blowfish sizes?
In NextSSL, Blowfish uses: key 4 to 56 bytes, block 8 bytes.
Who designed Blowfish and when?
Blowfish belongs to the Blowfish family, first published in 1993 by Bruce Schneier.
Which standards define Blowfish?
Blowfish is referenced by Schneier 1993.
Is Blowfish safe to use?
Blowfish is in the legacy tier. Old but not broken. Kept for interoperability; root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).