RC4
RC4 is a stream cipher designed by Ron Rivest in 1987 — simple and fast, but with serious biases; it has been banned from TLS and other protocols.
Purpose
It provided padding-free, high-speed stream encryption and was once widely used in SSL/TLS and WEP, but was retired due to security flaws.
Mechanism
The KSA (key scheduling algorithm) permutes a 256-byte S-box with the key; the PRGA (pseudo-random generation algorithm) swaps two S-box entries per byte and emits one keystream byte, XORed with the plaintext. The first several keystream bytes show statistical biases.
Use cases
- Legacy WEP/WPA Wi-Fi encryption
- Old SSL/TLS (now disabled)
- Historical Office/PDF encryption
- Teaching example (stream-cipher flaws)
Examples
- Input
key="Secret", data="Hi"Outputciphertext byte streamInsecure; do not use in new systems
Common errors
- Using RC4 in new systems
- Use AES-GCM or ChaCha20-Poly1305
Related terms
AES
The Advanced Encryption Standard (AES) is the symmetric block cipher NIST standardized in 2001, supporting 128/192/256-bit keys, and is the de facto standard of modern encryption. GLOSSARY
ChaCha20
ChaCha20 is a stream cipher designed by Daniel Bernstein, built on ARX (add-rotate-XOR) operations, and is commonly paired with Poly1305 as an AEAD — a high-performance alternative to AES-GCM. GLOSSARY
Stream Cipher
A stream cipher encrypts byte by byte or bit by bit, XORing a keystream with the plaintext; it needs no padding and suits real-time and streaming data. GLOSSARY