Skip to content

crypto.rc4 #

A Cipher is an instance of RC4 using a particular key.

fn new_cipher #

@[direct_array_access]
fn new_cipher(key []u8) !&Cipher

new_cipher creates and returns a new Cipher. The key argument should be the RC4 key, at least 1 byte and at most 256 bytes.

fn (Cipher) free #

@[unsafe]
fn (mut c Cipher) free()

free the resources taken by the Cipher c

fn (Cipher) reset #

fn (mut c Cipher) reset()

reset zeros the key data and makes the Cipher unusable.good to com

Deprecated: Reset can't guarantee that the key will be entirely removed from the process's memory.

fn (Cipher) xor_key_stream #

@[direct_array_access]
fn (mut c Cipher) xor_key_stream(mut dst []u8, src []u8)

xor_key_stream sets dst to the result of XORing src with the key stream. Dst and src must overlap entirely or not at all.