37 int keylen = key_bits >> 3;
40 for (i = 0; i < 256; i++)
44 for (j = 0, i = 0; i < 256; i++, j++) {
45 if (j == keylen) j = 0;
46 y += state[i] + key[j];
58 uint8_t sum = state[x] + state[y];
60 *dst++ = src ? *src++ ^ state[sum] : state[sum];
Memory handling functions.
Convenience header that includes libavutil's core.
void av_rc4_crypt(AVRC4 *r, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypts / decrypts using the RC4 algorithm.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
AVRC4 * av_rc4_alloc(void)
Allocate an AVRC4 context.
common internal and external API header
int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt)
Initializes an AVRC4 context.
#define FFSWAP(type, a, b)