Output Feedback Mode

Explore the cryptographic block cipher mode that turns block ciphers into stream ciphers

How OFB Mode Works

IV
Initialization Vector
→
Block Cipher
→
K1
Output Keystream
⊕
m1
Message Block
→
C1
Ciphertext
K1
Previous Keystream Output
→
Block Cipher
→
K2
Output Keystream
⊕
m2
Message Block
→
C2
Ciphertext
K2
Previous Keystream Output
→
Block Cipher
→
K3
Output Keystream
⊕
m3
Message Block
→
C3
Ciphertext

The output of the block cipher is XORed with plaintext and fed back as input for the next block

Interactive OFB Demo

1
2
3
4
Click "Encrypt with OFB" to see the encryption process step by step

Key Characteristics

🔄 Stream Cipher Behavior

OFB mode converts block ciphers into stream ciphers, allowing encryption of data streams of arbitrary length without padding.

⚡ No Error Propagation

Unlike CBC mode, a single bit error in ciphertext only affects the corresponding bit in plaintext during decryption.

🔒 Synchronous Operation

Both encryption and decryption use the same keystream, making OFB suitable for real-time communications.

🎯 Identical Encryption/Decryption

The same process is used for both encryption and decryption, simplifying implementation.

⚠️ IV Requirements

Requires a unique IV for each encryption session to prevent keystream reuse attacks.

🔐 Semantic Security

When used with a secure block cipher and unique IVs, OFB provides semantic security.

Advantages vs Disadvantages

✅ Advantages

  • No error propagation
  • Stream cipher functionality
  • Parallel keystream generation
  • Same algorithm for encryption/decryption
  • Suitable for real-time applications

❌ Disadvantages

  • Vulnerable to bit-flipping attacks
  • Requires unique IVs always
  • Keystream reuse vulnerabilities
  • Sequential processing required
  • Not suitable for random access