Download presentation
Presentation is loading. Please wait.
1
A toy example for RC4
2
A toy example for RC4. Initial state /* Initialization */
for i = 0 to 3 do S[i] = i; T[i] = K[i mod keylen]; S (state) 1 2 3 T for π=2
3
A toy example for RC4 /* Initial Permutation of S */ 1st update
j = 0; for π=0 to 3 do π= π+π π +π π πππ 4 ; Swap (π π ,π π ); For π=0, π=0 we get: π=0+0+2β‘2 πππ 4 : π π=0 =0, π π=2 =2 1st update For π=1, π=2 we get: π=2+1+2β‘1 πππ 4 : π π=1 =1, π π=1 = nd update For π=2, π=1 we get: π=1+0+2β‘3 πππ 4 : π π=2 =0, π π=3 =3 3rd update For π=3, π=3 we get: π=3+0+2β‘1 πππ 4 : π π=3 =0, π π=1 =1 4th update State πΊ (π=π) 2 1 3 State πΊ (π=π) 2 1 3 State πΊ (π=π) 2 1 3 State πΊ (π=π) 2 3 1
4
A toy example for RC4 /* Stream Generation */
i, j = 0; while (true) j = (j + S[i]) mod 4; i = (i + 1) mod 4; Swap (S[i], S[j]); t = (S[i] + S[j]) mod 4; k = S[t]; For π=0, π=0: π=0+2β‘2 πππ 4, π=1; π π=1 =0, π π=2 =3. Update, compute π‘=3 and output π 3 =1 For π=2, π=1: π=2+3β‘1 πππ 4, π=2; π π=2 =0, π π=1 =3. Update compute π‘=3, and output π 3 =1 For π=1, π=2: π=1+3β‘0 πππ 4, π=3; π π=3 =1, π π=0 =2. Update compute π‘=3, and output π 3 =2 State πΊ 2 3 1 State πΊ 2 3 1 State πΊ 1 3 2
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.