Stream ciphers are symmetric encryption algorithms that encrypt data one bit or byte at a time using a keystream generated by a pseudorandom bit generator (PRBG). They are efficient and well-suited for high-speed or resource-constrained environments, but their security relies heavily on the properties of the keystream.
Idea: as noted, the one-time pad is a perfect secracy (semantically secure against ciphertext-only attacks by an adversary with infinite computational resources. However, it needs a key as long as the message. So what if we generate a long key from a short key?
A PRBG expands a short, random seed into a long pseudorandom output called a keystream. This keystream is XORed with the plaintext in a manner similar to a one-time pad, but is generated deterministically.
A pseudorandom bit generator (PRBG) is a deterministic algorithm that takes as input a short random seed, and outputs a longer pseudorandom sequence, also known as a keystream
Early stream ciphers used a single key as input. This meant one key produced one keystream, and reusing the key for multiple messages was insecure.
Modern designs include an Initialization Vector (IV) alongside the key, allowing the same key to produce many different keystreams. The IV is public and transmitted with ciphertext.
LFSRs are simple, fast hardware-friendly components used in many stream ciphers. They use a recurrence relation to generate sequences from an initial state vector.
Example recurrence: st+6 = st+5 ⊕ st+4 ⊕ st+1 ⊕ st
However, LFSRs have low linear complexity and are predictable, and hence a deterministic PRBG produces a periodic sequence.
Attack on small period: If the period of the keystream is less than the length of a ciphertext, then at least two secions of the message were encrypted using the same portion of the keystream. By XORing these two sections, the keystream cancels out and one obtains the XOR of the plaintext strings. It is then possible to attack such a sum by exploiting the redundancy of the plaintext.
A single LFSR on its own is not good.
Knowing the output leads to knowing the intermediate state so one can predict all future sequence.
Typically there are three ways of using LFSRs:
A stream cipher used in GSM mobile telephony. It combines three LFSRs irregularly clocked based on a majority rule.
x18 ⊕ y21 ⊕ z22
Vulnerabilities: A5/1 was reverse-engineered and cracked with precomputation attacks using rainbow tables and GPU hardware.
Designed by Ron Rivest (1987). Widely adopted in SSL/TLS and WEP. Simple and fast but now deprecated.
i
and j
S[i]+S[j]
as the keystream byteFlaws: Biased outputs in early bytes, exploitable with millions of packets. RC4 is officially deprecated as of the 2010s.
Modern stream ciphers by Daniel J. Bernstein. Salsa20 (2005), ChaCha (2008).
Characteristics: Fast in software, strong resistance to cryptanalysis, used in TLS, SSH, QUIC, IPsec
WEP used RC4 with a 24-bit IV and a shared key. It aimed to provide confidentiality, integrity, and access control—but failed.
The Fluhrer-Mantin-Shamir attack (2001) shows how key recovery is possible with 5 million packets. Used widely in tools like aircrack-ng.
Stream ciphers are efficient and powerful but require careful design and implementation. Legacy systems like WEP have shown that weak key handling and poor initialization can completely undermine security.
Modern alternatives like ChaCha20 and AES-CTR are recommended today.