Cryptography Reference
In-Depth Information
Next, the key is combined with the key schedule:
j = 0;
for ( i = 0; i < 256; i++ )
{
j = ( j + S[ i ] + key[ i % key_len ] ) % 256;
tmp = S[ i ];
S[ i ] = S[ j ];
S[ j ] = tmp;
}
Given a key of “password” (0x70617373776f7264), for example, the fi rst few
computations are illustrated in Figure 2-15.
0
12345678...
0 1 2
113
114
115
...
p
a
s
s
wo
r
d
112
97
115
115
119
111
114
100
j
=
0
+
0
+
112
=
112
112
12345
...
0 10 3 4 5
9 0 1
p
a
s
s
wo
r
d
112
97
115
115
119
111
114
100
j = 112 + 1 + 97 = 210
112
210
2345
...
110
111
0
113
114
115
209
1
211
p
a
s
s
wo
r
d
112
97
115
115
119
111
114
100
j = 210 + 2 + 115 = 325 % 256 = 71
112
210
1345
...
Figure 2-15: RC4 key scheduling algorithm
Search WWH ::




Custom Search