37 unsigned int ust1, ust2;
38 unsigned int keyindex;
39 unsigned int stateindex;
46 for (idx = 0; idx < 256; idx++)
47 pbyst[idx] = (
unsigned char)
idx;
50 for (idx = 0; idx < 256; idx++) {
52 stateindex = (stateindex + pbyKey[keyindex] + ust1) & 0xff;
53 ust2 = pbyst[stateindex];
54 pbyst[stateindex] = (
unsigned char)ust1;
55 pbyst[
idx] = (
unsigned char)ust2;
56 if (++keyindex >= cbKey_len)
65 unsigned int ustx, usty;
69 ux = (pRC4->
ux + 1) & 0xff;
71 uy = (ustx + pRC4->
uy) & 0xff;
75 pbyst[uy] = (
unsigned char)ustx;
76 pbyst[ux] = (
unsigned char)usty;
78 return pbyst[(ustx + usty) & 0xff];
82 unsigned char *pbySrc,
unsigned int cbData_len)
85 for (ii = 0; ii < cbData_len; ii++)
86 pbyDest[ii] = (
unsigned char)(pbySrc[ii] ^
rc4_byte(pRC4));