1 /*
2 * RC4 encryption/decryption/pseudo-random number generator
3 * Copyright (c) 2007 Reimar Doeffinger
4 *
5 * loosely based on LibTomCrypt by Tom St Denis
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
27
29 {
31 }
32
35 uint8_t y;
37 int keylen = key_bits >> 3;
38 if (key_bits & 7)
40 for (
i = 0;
i < 256;
i++)
42 y = 0;
43 // j is i % keylen
44 for (j = 0,
i = 0;
i < 256;
i++, j++) {
45 if (j == keylen) j = 0;
48 }
51 return 0;
52 }
53
55 uint8_t x =
r->x, y =
r->y;
57 while (count-- > 0) {
61 x++;
63 }
65 }