Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Stream Cipher

Direct answer

A stream cipher encrypts data by combining it with a keystream generated from a key and nonce, such as ChaCha20. Reusing a key and nonce pair breaks security completely.

When to use this

Use this when stream ciphers are used and keystream reuse must be avoided.

First 30 seconds

1. Stream ciphers XOR plaintext with a keystream.

2. Keystream reuse is catastrophic.

3. Add authentication (AEAD).

4. RC4 is broken — disable.

5. ChaCha20 is the modern choice.

Operational verification

key + nonce → keystream ⊕ plaintext

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Using stream ciphers without a MAC — bits can be flipped without detection.
  • Generating nonces with a non-cryptographic random generator.
  • Resetting counters after reboot and reusing nonces.
Platform / version applicability
Cryptography, PKI and secrets
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCryptography, PKI and secrets
Scope / prerequisiteUse this when stream ciphers are used and keystream reuse must be avoided.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

1 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 The nonce reuse problem Narrow the fault

A stream cipher XORs plaintext with a keystream. Reusing the same key and nonce gives the same keystream, so C1 ⊕ C2 = P1 ⊕ P2 and both plaintexts can often be recovered. This broke WEP and RC4 in various protocols. Use random 96-bit nonces only with low message counts, or counters, or XChaCha20 with 192-bit random nonces.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Stream ciphers XOR data with a keystream.
  • Reusing a key and nonce pair breaks security completely.
  • Combine with a MAC or use an AEAD construction.
Key checks
  • Keystream reuse checks — never reuse key+nonce
  • Integrity added (Poly1305/HMAC) — authentication
  • RC4 usage — must be none
ReferenceWhy it matters1 section · depth on demand

Key point

A stream cipher XORs data with a keystream. If the same key and nonce are used twice, XORing the two ciphertexts removes the keystream and reveals both plaintexts. Use AEAD constructions (ChaCha20-Poly1305) and unique nonces.

ReferenceImportant terms & boundaries2 sections · depth on demand

Examples

CipherStatus
ChaCha20Recommended (with Poly1305)
AES-CTRBlock cipher used as a stream cipher; needs a MAC
Salsa20Secure, predecessor of ChaCha20
RC4Broken — banned in TLS (RFC 7465)

In depth

A stream cipher generates a pseudorandom keystream from a key and nonce and combines it with the plaintext (XOR). It encrypts data of any length without padding and is efficient for streaming data.

CipherStatus
ChaCha20Modern, secure (with Poly1305 for integrity)
AES-CTR / AES-GCMBlock cipher used as a stream cipher
RC4Broken — removed from TLS and WPA

The critical rule: never reuse a key/nonce pair. Reuse lets an attacker XOR two ciphertexts to cancel the keystream and recover plaintext — the flaw behind WEP's failure and some protocol vulnerabilities.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCryptography, PKI and secrets current

Authoritative/upstream documentation reviewed for bounded claims in Symmetric Cryptography → Stream Cipher. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://csrc.nist.gov/pubs/fips/197/final · confidence 94%
Confirmation

Confirm action

Continue?