include "keyring.m"; keyring := load Keyring Keyring->PATH; rc4setup: fn(seed: array of byte): ref RC4state; rc4: fn(state: ref RC4state, buf: array of byte, n: int); rc4skip: fn(state: ref RC4state, n: int); rc4back: fn(state: ref RC4state, n: int);
Rc4setup sets the initial seed, which can be any non-zero length, and returns a representation of the initial state of the algorithm, which is used in subsequent calls.
Rc4 runs the generator starting with the given state, and XORs the output of the generator with the first n bytes of buf, updating the state. Rc4 is symmetric and is used both to encrypt and decrypt. Rc4skip skips over bytes (eg, to account for lost transmissions); rc4back runs the generator backwards (eg, to account for retransmissions).
|KEYRING-RC4(2 )||Rev: Tue Mar 31 02:42:39 GMT 2015|