RC4 stream cipher
The RC4 Algorithm
we will describe the RC4 algorithm and give an overview .
Description of RC4
RC4 consists of two parts. The key scheduling phase will generate the initial permutation from a (random) key of length l bytes. Typically l will be in the range
between 5 and 64. The maximal key length is l = 256. The main part of the algorithm is a pseudo random generator that produces one byte output in each step.
The encryption will be an XOR of the pseudo random sequence with the message, as usual for stream ciphers.
For the analysis of RC4 it is convenient to replace the original algorithm that works on bytes (Z/256Z) by a generalization that works on Z/nZ for some n ? N. For n = 256 we obtain the original algorithm.
Algorithm 1 RC4 key scheduling
1: {initialization}
2: for i from 0 to n ? 1 do
3: S[i] := i
4: end for
5: j := 0
6: {generate a random permutation}
7: for i from 0 to n ? 1 do
8: j := (j + S[i] + K[i mod l]) mod n
9: Swap S[i] and S[j]
10: end for
Algorithm 2 RC4 pseudo random generator
1: {initialization}
2: i := 0
3: j := 0
4: {generate pseudo random sequence}
5: loop
6: i := (i + 1) mod n
7: j := (j + S[i]) mod n
8: Swap S[i] and S[j]
9: k := (S[i] + S[j]) mod n
10: print S[k]
11: end loop
We will call n successive outputs of the RC4 pseudo random generator a round, i.e. the first round will
produce the output bytes 1 to n, the second round
the bytes n + 1 to 2n and so on
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .