Stream ciphers

RC4

Rivest's 1987 byte-oriented stream cipher, once ubiquitous and now prohibited in TLS

broken Root API only
Broken tier.

Practical attacks exist. Present for compatibility and research only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About RC4

RC4 is a stream cipher. It uses a 1–256-byte key. Its registry entry cites RFC 6229 and ARC4. It is also known as arc4 and arcfour. NextSSL lists it in the broken tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

Overview

RC4 is a stream cipher designed by Ron Rivest in 1987. It was used in WEP, WPA-TKIP, early TLS and many other systems because of its simplicity and speed, but statistical biases in its output have made it insecure.

RC4 maintains a 256-byte permutation S and two indices. The key-scheduling algorithm initialises S to the identity and swaps entries based on the key. The output generator then repeatedly increments one index, adds the indexed value to the other, swaps the two entries, and outputs the byte at the sum of the two values. No nonce is defined; protocols often concatenated an IV with the key, which proved fatal in WEP.

The algorithm was a trade secret until it was leaked in 1994, which is why it is also known as ARC4 or ARCFOUR. NextSSL includes RC4 for legacy interoperability; RFC 6229 provides test vectors. It is still found in old protocols. Its simplicity made it easy to implement in early hardware and software.

History

1987–2015
  1. RC4 designed by Ron Rivest

  2. RC4 source posted anonymously

  3. Fluhrer, Mantin and Shamir break WEP's use of RC4

  4. RC4 prohibited in TLS by RFC 7465

Security notes

RC4 is broken. Its early keystream bytes are biased, related-key weaknesses broke WEP within minutes, and plaintext-recovery attacks against TLS led RFC 7465 to prohibit RC4 in TLS in 2015. Do not use it for new data.

Typical uses

Decrypting legacy dataAnalysing WEP and old TLS traffic

Sizes

FieldBytesMeaning
key1 – 256Secret key
nonce0Nonce / IV

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'broken' is reachable from the root API only
ct = root.call("stream_apply", "rc4", None, key, nonce, b"secret")[0]   # same call decrypts

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is RC4?

RC4 is a stream cipher in the RC4 family. RC4 is a stream cipher designed by Ron Rivest in 1987. It is also known as arc4, arcfour.

What are the RC4 sizes?

In NextSSL, RC4 uses: key 1 to 256 bytes, nonce 0 bytes.

Who designed RC4 and when?

RC4 belongs to the RC4 family, first published in 1987 by Ron Rivest. Its origin: RFC 6229 (test vectors); RFC 7465 (prohibited in TLS).

Which standards define RC4?

RC4 is referenced by RFC 6229, ARC4.

Is RC4 safe to use?

RC4 is in the broken tier. Practical attacks exist. Present for compatibility and research only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).