Stream Cipher

A stream cipher is a type of symmetric encryption that encrypts data one bit or byte at a time, rather than breaking data into large chunks (blocks). It functions by combining the plain text message with a random string of bits.

  • The cipher takes a secret key and an initialization vector (IV) to generate an infinite, non-repeating sequence of bits known as the pseudo-random key-stream.
  • The encryption process () combines the plain text () with this generated key-stream () using the XOR operation to produce the cipher text ().
  • Key Characteristics
    • No Padding Necessary: Because the cipher encrypts the message bit-by-bit (or byte-by-byte), the encrypted output is the exact same length as the input. Unlike block ciphers, the message does not need to be padded to fit a specific block size.
    • High Performance: Stream ciphers are generally fast and computationally efficient. They generate the key-stream independently of the message, making them ideal for real-time streaming (video/voice) and encrypting small messages on hardware with limited resources.
  • Examples
    • RC4: Once the most popular stream cipher (used in WEP and early SSL), it is now considered insecure and has been largely deprecated.
    • ChaCha (specifically ChaCha20): A modern, high-speed, and secure cipher widely used today (e.g., in Google’s TLS connections and VPN protocols like WireGuard).

Relevant Note(s): Block Cipher