cryptography

Definition

Rivest Cipher 4

Rivest Cipher 4 (RC4) is a stream cipher developed by Ronald Rivest in 1984. It is nowadays considered broken.

State

The PRG state consists of:

  • a permutation of all 256 possible bytes
  • two indexes

State size: 2064 bits.

Key Size

Key size between 40 and 2048 bits, used to generate the initial permutation of bytes.

Keystream Generation

Byte i := 0, j := 0
while GeneratingOutput:
    i := (i + 1) % 256
    j := (j + S[i]) % 256
    swap S[i] and S[j]
    Byte t := (S[i] + S[j]) % 256
    Byte K := S[t]
    output K
endwhile

Security

Broken

RC4 is no longer secure. Statistical biases in its keystream output make it vulnerable to practical attacks.