Vergleichen block ciphers and stream ciphers
Block ciphers verschlüsseln fixed-Größe blocks mit padding; stream ciphers verschlüsseln Byte-durch-Byte. Understand der trade-offs in speed, padding, und Fehler propagation.
- 1
Block ciphers (AES, Blowfish) encrypt fixed-size blocks (128 bits for AES, 64 bits for Blowfish). They require padding for non-aligned input and a mode of operation (CBC, CTR, GCM). Stream ciphers (RC4, ChaCha20) generate a keystream and XOR — no padding, ciphertext equals plaintext length.
- 2 AES-Verschlüsseler →
Verschlüsseln data with AES (block cipher). Note the ciphertext is padded to a multiple of the block size (16 bytes for AES). This padding must be removed on decryption.
- 3 RC4-Verschlüsseler →
Verschlüsseln the same data with RC4 (stream cipher). The ciphertext is exactly the same length as the input — no padding. This is the defining property of stream ciphers.
- 4 Blowfish-Verschlüsseler →
Verschlüsseln with Blowfish to compare a 64-bit block cipher. The block size is smaller (8 bytes), so padding granularity differs from AES.
- 5
Key insight: AES in CTR or GCM mode effectively becomes a stream cipher — it generates a keystream from counter blocks and XORs with plaintext. Modern practice rarely uses raw block cipher modes; AES-GCM (authenticated stream-like mode) is the standard.
Häufige Fragen
- Which is faster?
- It depends on hardware. AES with AES-NI hardware acceleration is very fast. On devices without it, ChaCha20 (stream) is faster. Raw speed is rarely the deciding factor — security and authentication matter more.
- Do stream ciphers need padding?
- No. Stream ciphers process one byte at a time, so the ciphertext is always the same length as the plaintext. This is an advantage for variable-length data and streaming protocols.