A Stream-Cipher allowing for speed in computing. Many vulnerabilities have been found, making RC4 very insecure.

Algorithm

  • A Permutation of all 256 possible bytes
  • Two 8-bit Index pointers and
  • KSA initializes
  • PRNG stream of bits generated by PRGA

Key Scheduling Algorithm (KSA)

  • is the permutation array
  • keylength is number of bytes in key
for i from 0 to 255
	S[i] := 1
endfor
j := 0
for i from 0 to 255
	j := (j + S[i] + key[i mod keylength]) mod 256
	swap values of S[i] and S[j]
endfor

Pseudo-Random Generation Algorithm (PRGA)

i := 0
j := 0
while GeneratingOutput:
	i := (i + 1) mod 256
	j := (j + S[i]) mod 256
	swap values of S[i] and S[j]
	t := (S[i] + S[j]) mod 256
	K := S[t]
	output K
endwhile