Lines Matching defs:state
54 * Initialize an RC4 state buffer using the supplied key,
58 rc4_init(struct rc4_state *const state, const u_char *key, int keylen)
63 /* Initialize state with identity permutation */
65 state->perm[i] = (u_char)i;
66 state->index1 = 0;
67 state->index2 = 0;
71 j += state->perm[i] + key[i % keylen];
72 swap_bytes(&state->perm[i], &state->perm[j]);
77 * Encrypt some data using the supplied RC4 state buffer.
83 rc4_crypt(struct rc4_state *const state,
92 state->index1++;
93 state->index2 += state->perm[state->index1];
96 swap_bytes(&state->perm[state->index1],
97 &state->perm[state->index2]);
100 j = state->perm[state->index1] + state->perm[state->index2];
101 outbuf[i] = inbuf[i] ^ state->perm[j];