What is Stream Cipher?
An encryption algorithm that encrypts data one bit or byte at a time using a continuous keystream, suitable for real-time encryption of streaming data.
Stream ciphers generate a pseudorandom keystream and XOR it with the plaintext to produce ciphertext.
How It Works
- A key and nonce (initialization vector) seed a pseudorandom generator
- The generator produces a continuous stream of random-looking bytes
- Each byte of plaintext is XORed with a byte of the keystream
- The same keystream is used to decrypt (XOR is its own inverse)
Common Stream Ciphers
- ChaCha20: Modern, fast, secure. Used in TLS, WireGuard, Signal.
- Salsa20: ChaCha20's predecessor. Still secure.
- RC4: Obsolete and broken. Was used in WEP, early TLS.
Advantages Over Block Ciphers
- No padding needed
- Natural for streaming data (voice, video)
- Can encrypt arbitrary-length data
Critical Rule
Never reuse a nonce with the same key. With stream ciphers, nonce reuse completely breaks the encryption — the XOR of two ciphertexts equals the XOR of the two plaintexts.
Related Terms
ChaCha20-Poly1305
A modern authenticated encryption algorithm that provides both confidentiality and integrity, widely used as an alternative to AES-GCM.
Symmetric Encryption
An encryption method where the same secret key is used for both encrypting and decrypting data. While fast and efficient, the challenge lies in securely sharing the key between parties.
Have more questions?
Use our guided flow to get the right next privacy step for Stream Cipher.
Open Guided Flow