RC4 (Historical Stream Cipher)

A once-popular stream cipher now mostly used as a cautionary example.

Difficulty: Intermediate

How it works

  1. RC4 generates a keystream by repeatedly permuting a 256-byte state array using a key-dependent algorithm.
  2. Each step outputs one byte of the keystream. Encryption and decryption both use XOR: ciphertext = plaintext XOR keystream.
  3. Early designs reused keys and initialisation patterns, which made RC4 vulnerable to attacks that recover parts of the key from many ciphertexts.
  4. RC4 is now considered insecure in most settings and has been removed from modern versions of TLS and many other protocols.
  5. When studying RC4, focus on how small biases in a keystream can leak information and why careful design and analysis are essential.
Press Shift + Enter

What is it?

RC4 (Rivest Cipher 4) is a stream cipher designed by Ron Rivest in 1987. For decades, it was the most widely used software stream cipher in the world, heavily featured in protocols like WEP, WPA, and early TLS. It is famous for its extreme simplicity and speed, operating by generating a pseudorandom stream of bits (a keystream) that is XORed with the plaintext. However, severe cryptanalytic vulnerabilities were discovered in how it generates its keystream, leading to its strict deprecation across all secure modern systems.

Try it yourself

Can you decrypt this challenge?

VHVY GUVF ZRNGL (example ciphertext)

Where this shows up today

To provide an extremely fast software-based encryption algorithm that did not require complex hardware.