Saltar al contenido
uencoder

Comparar block ciphers and stream ciphers

Bloque ciphers cifrar fixed-tamaño blocks con padding; stream ciphers cifrar byte-por-byte. Understand el trade-offs en speed, padding, y error propagation.

  1. 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. 2
    Cifrador AES →

    Cifrar 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. 3
    Cifrador RC4 →

    Cifrar 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. 4
    Cifrador Blowfish →

    Cifrar with Blowfish to compare a 64-bit block cipher. The block size is smaller (8 bytes), so padding granularity differs from AES.

  5. 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.

Preguntas frecuentes

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.

Flujos que resuelven esta tarea

Herramientas relacionadas