Lines Matching refs:state
57 * Initialize an RC4 state buffer using the supplied key,
61 rc4_init(struct rc4_state *const state, const u_char *key, int keylen)
66 /* Initialize state with identity permutation */
68 state->perm[i] = (u_char)i;
69 state->index1 = 0;
70 state->index2 = 0;
74 j += state->perm[i] + key[k];
75 swap_bytes(&state->perm[i], &state->perm[j]);
82 * Encrypt some data using the supplied RC4 state buffer.
88 rc4_crypt(struct rc4_state *const state,
97 state->index1++;
98 state->index2 += state->perm[state->index1];
101 swap_bytes(&state->perm[state->index1],
102 &state->perm[state->index2]);
105 j = state->perm[state->index1] + state->perm[state->index2];
106 outbuf[i] = inbuf[i] ^ state->perm[j];