bf-cfb encrypt & decrypt online

Legacy

Encrypt or decrypt text with bf-cfb and a secret. Same result as PHP's openssl_encrypt, and nothing leaves your browser.

Shorter secrets are padded with zero bytes to 16 bytes. No IV, PHP uses zero bytes.
Runs in your browser
What the tool did

The bytes behind your result

Your code gives a different result? Almost always the key or the IV differ. Here you see exactly which bytes the tool used for the secret and text in the tool above: copy the key and IV in hex into your own code. Shown for the text hello world and the secret my secret until you type above.

Key · 16 bytes 9 from your secret, 7 zero bytes added
6d792073656372657400000000000000
6d792073656372657400000000000000
IV · 8 bytes none given, so zero bytes
0000000000000000
0000000000000000
Text in UTF-8 11 bytes, no padding needed
68656c6c6f20776f
726c64
Encrypted · 11 bytes
dc8bb6dcb4fe909a
11700e
dc8bb6dcb4fe909a11700e
As Base64 what the tool shows
3Iu23LT+kJoRcA4=

from your inputzero bytesciphertext

In short

What is bf-cfb?

Blowfish is a free block cipher by Bruce Schneier (1993) with keys from 32 to 448 bits. It is unbroken, but its 8-byte blocks are a problem for large data (Sweet32), and its author recommends newer ciphers. Blowfish-CFB uses a 128-bit key (16 rounds) in Cipher Feedback mode: the block cipher runs as a stream: no padding, the output is as long as the input.

LegacyBlowfish: Not broken in everyday use, but outdated. Use it to match old systems, not for new ones.

How your secret becomes the key

The default key length is 16 bytes (128 bits). Shorter secrets are padded with zero bytes to 16 bytes. Longer secrets are used in full, because Blowfish accepts variable key lengths.

Where you meet Blowfish
  • Older VPNs: BF-CBC was OpenVPN's long-time default cipher
  • bcrypt password hashes are built on its key schedule
  • Old file encryption tools
Honest answer

Is it safe to use?

The cipher: legacy

Blowfish. Not broken in everyday use, but outdated. Use it to match old systems, not for new ones.

This setup: for compatibility

The setup of this tool is made for compatibility with PHP's openssl_encrypt, not for protecting secrets: the IV is always zero, the secret is used as the key without a key derivation function, and nothing detects changes to the ciphertext.

For real secrets use an authenticated mode such as AES-256-GCM or ChaCha20-Poly1305 with a fresh random nonce for every message, and derive the key from a password with Argon2id, scrypt or PBKDF2. What is a key derivation function?

Cipher Feedback

How CFB mode works

CFB encrypts the previous ciphertext block (at first the IV) and XORs the result with the next 8 bytes of text. The block cipher only ever encrypts, it is used to make a keystream.

No padding is needed: the output has exactly as many bytes as the input. A wrong byte in the ciphertext garbles that byte and the next block when decrypting.

With the zero IV of this tool, the first block of CFB, OFB and CTR is the same, because all three start by encrypting the IV.

Use it in code

The same result in your code

Every snippet prints 3Iu23LT+kJoRcA4= for the text hello world and the secret my secret, the same as the tool. The key and IV are written out in hex, so you can see what the tool does with the secret. Your own key and IV are in What the tool did. All snippets are run against PHP before each release.

PHP
$key = hex2bin("6d792073656372657400000000000000"); // "my secret" padded with zero bytes to 16 bytes
$iv  = hex2bin("0000000000000000"); // no IV given: 8 zero bytes
echo openssl_encrypt("hello world", "bf-cfb", $key, 0, $iv);

Shortest form, same result: openssl_encrypt("hello world", "bf-cfb", "my secret"). PHP pads the secret itself but warns about the empty IV. On OpenSSL 3, PHP needs the legacy provider enabled in openssl.cnf.

Python
# pip install cryptography
import base64
from cryptography.hazmat.primitives.ciphers import Cipher, modes
from cryptography.hazmat.decrepit.ciphers import algorithms

key = bytes.fromhex("6d792073656372657400000000000000")  # "my secret" padded with zero bytes to 16 bytes
iv = bytes(8)  # no IV given: 8 zero bytes
data = "hello world".encode()
enc = Cipher(algorithms.Blowfish(key), modes.CFB(iv)).encryptor()
print(base64.b64encode(enc.update(data) + enc.finalize()).decode())

Python has no Blowfish in the standard library; the cryptography package keeps it in its "decrepit" module for old data.

Node.js
import { createCipheriv } from 'node:crypto';

const key = Buffer.from("6d792073656372657400000000000000", 'hex'); // "my secret" padded with zero bytes to 16 bytes
const iv = Buffer.alloc(8); // no IV given: 8 zero bytes
const c = createCipheriv("bf-cfb", key, iv);
console.log(Buffer.concat([c.update("hello world", 'utf8'), c.final()]).toString('base64'));

Run with node --openssl-legacy-provider: OpenSSL 3 hides this cipher by default.

Java
import javax.crypto.Cipher;
import javax.crypto.spec.*;
import java.util.Base64;
import java.util.HexFormat;

public class Encrypt {
  public static void main(String[] args) throws Exception {
    byte[] key = HexFormat.of().parseHex("6d792073656372657400000000000000"); // "my secret" padded with zero bytes to 16 bytes
    byte[] iv = new byte[8]; // no IV given: 8 zero bytes
    Cipher c = Cipher.getInstance("Blowfish/CFB/NoPadding");
    c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "Blowfish"), new IvParameterSpec(iv));
    System.out.println(Base64.getEncoder().encodeToString(c.doFinal("hello world".getBytes("UTF-8"))));
  }
}

Java 17 or newer (HexFormat). Java's PKCS5Padding is the same as PKCS#7.

Command line
printf '%s' 'hello world' | openssl enc -bf-cfb -K 6d792073656372657400000000000000 -iv 0000000000000000 -provider legacy -provider default -a -A

printf instead of echo: echo adds a line break, which changes the result. -K and -iv take hex; with -k or -pass, openssl derives a different key from a password. openssl enc uses at most 16 bytes of -K, so secrets longer than that give a different result here.

Common mistakes

Why your bf-cfb result doesn't match

You hashed the secret first

Many tutorials turn a password into a key with SHA-256 or MD5. This tool doesn't: it uses the bytes of your secret directly and pads them with zero bytes. Copy the key in hex from What the tool did and use it as the raw key.

Your code uses a random IV

With a random IV the result changes every time. The tool uses no IV, which in PHP means zero bytes. Use a zero IV of the right length to get the same result, and keep the random IV for real data.

Hex instead of Base64

The tool shows the raw ciphertext bytes as Base64. Many libraries return hex or raw bytes. Convert before comparing, or compare with the hex blocks in What the tool did.

Same start as CFB, OFB and CTR

With a zero IV, CFB, OFB and CTR all begin by encrypting the IV, so the first block of output is identical in all three. They only differ from the second block on.

Output is as long as the input

This mode needs no padding: 11 bytes in, 11 bytes out. If your library adds PKCS#7 padding or expects whole blocks, it is configured for CBC or ECB.

Spaces and line breaks

Like the old site, the tool trims spaces and line breaks at the start and end of the text and the secret, and sends line breaks as CRLF (\r\n), as a browser form does. echo "text" | in a shell adds a line break at the end.

"unsupported" in OpenSSL 3

OpenSSL 3 moved this cipher to the legacy provider. Node.js, PHP, Python and the openssl command line built on OpenSSL 3 report it as unsupported until the legacy provider is loaded (node --openssl-legacy-provider, openssl enc -provider legacy -provider default).

openssl enc with -k or -pass

Given a password, the openssl command line derives key and IV from it with a random salt (EVP_BytesToKey or PBKDF2), and the output starts with U2FsdGVkX1 ("Salted__"). That is a different format. Pass the key and IV in hex with -K and -iv instead, as in the code example.

Which cipher was it?

Encrypted something here years ago?

Paste the Base64 result and the secret. Your browser tries all 174 ciphers of this site and shows those that give readable text. Useful if you don't remember the cipher, or to check whether your ciphertext really is bf-cfb.

Nothing is sent anywhere. Wrong secrets give no readable text.
Compare

Every Blowfish variant, same input

The text The quick brown fox jumps over the lazy dog (43 bytes) with the secret my secret in all 6 Blowfish ciphers. The last column lists names that give the same result: aliases, and modes that agree for this input. Highlighted: the same start as bf-cfb. Watch how CBC and ECB share the first block, and CFB, OFB and CTR the first 8 bytes. Type a text and a secret in the tool above to use yours.

CipherResult (Base64)Same as
bf LegacyV/XUSJQinpEWrrlHgxAhmGUxY/KeXiCG38w83UwnzjzT7KanXfSjl1pVNm5UaPxFbf-cbc, blowfish
bf-cbc LegacyV/XUSJQinpEWrrlHgxAhmGUxY/KeXiCG38w83UwnzjzT7KanXfSjl1pVNm5UaPxFbf, blowfish
bf-cfb Legacy4Ia/kKqrjpbHJS2yptO/GetsekxACXp2GomNsdH0UDxOyox5sun3ANIIHg==
bf-ecb LegacyV/XUSJQinpEGchb45YFG3pihRr2T5jqiencAHvzGpSN/xOTkDX6QiDIx2aI9g2Gk
bf-ofb Legacy4Ia/kKqrjpbgx2l6cPSxPRlRcese3eN4JjIfkdZyAERsQ1TcRxRwG6IALw==
blowfish LegacyV/XUSJQinpEWrrlHgxAhmGUxY/KeXiCG38w83UwnzjzT7KanXfSjl1pVNm5UaPxFbf, bf-cbc
Test values

bf-cfb test values

Results for common test strings with the secret my secret (UTF-8, no line break, zero IV), exactly as the tool and PHP's openssl_encrypt give them. Use them to check your own implementation.

Textbf-cfb (Base64)
empty string
a1Q==
hello world3Iu23LT+kJoRcA4=
0123456789abcdefhN/og+/r0cJ+jqnnADankw==
The quick brown fox jumps over the lazy dog4Ia/kKqrjpbHJS2yptO/GetsekxACXp2GomNsdH0UDxOyox5sun3ANIIHg==
FAQ

Questions about bf-cfb

Can bf-cfb be decrypted without the secret?

No. Without the secret there is no shortcut. A short or common secret can be guessed, though, because the tool uses it directly as the key.

Why does my bf-cfb code give a different result?

Almost always because of the key or the IV: the tool pads your secret with zero bytes instead of hashing it and uses a zero IV. Also check Base64 vs hex, padding, and spaces or line breaks the tool trims.

Why is the bf-cfb output shorter than with CBC?

CFB mode needs no padding: the ciphertext has exactly as many bytes as the text, while CBC rounds up to whole blocks.

Is Blowfish secure?

Blowfish is outdated. It is not broken in everyday use, but its 8-byte blocks make it unsafe for large amounts of data (Sweet32) and modern ciphers like AES are better. Use it only for compatibility.

How long should my secret be?

At least 16 bytes, the default key length; longer secrets are used in full. For real security a random key is better than a typed word.

Good to know

Before you rely on it

Searches the list of pages on this site. What you type stays in your browser.