23 for (i = 0; i < 256; i++)
25 for (key_idx = 0, i = j = 0; i < 256; i++)
27 j = (j +
s[i] + key[key_idx]) & 255;
29 if (++key_idx >= size)
49 *
buf++ ^=
s[(
s[i] +
s[j]) & 255];
void arc4_init(struct arc4 *arc4, const void *key_, size_t size)
void arc4_crypt(struct arc4 *arc4, void *buf_, size_t size)
tests/arc4.h
static void swap_byte(uint8_t *a, uint8_t *b)
Swap bytes.
static char buf[BUF_SIZE]
static uint8_t s[256]
RC4-based pseudo-random number generator (PRNG).
Alleged RC4 algorithm encryption state.