pub struct Rc4KeyState { /* private fields */ }Expand description
A reusable RC4 key state. The state is advanced as data is transformed, so a
single Rc4KeyState represents one continuous cipher stream.
Implementations§
Source§impl Rc4KeyState
impl Rc4KeyState
Sourcepub fn new(key: &[u8]) -> Self
pub fn new(key: &[u8]) -> Self
Creates a new key state by scheduling the given key bytes.
§Panics
Panics if key is empty or longer than 256 bytes (the RC4 key-state length).
Sourcepub fn key_state(&self) -> &[u8; 256]
pub fn key_state(&self) -> &[u8; 256]
Returns the current internal key state bytes (for inspection/testing).
Sourcepub fn transform(&mut self, input: &[u8], output: &mut [u8])
pub fn transform(&mut self, input: &[u8], output: &mut [u8])
Transforms input into output using (and advancing) this key state.
RC4 is symmetric, so the same operation both encrypts and decrypts.
§Panics
Panics if output is shorter than input.
Sourcepub fn transform_in_place(&mut self, buffer: &mut [u8])
pub fn transform_in_place(&mut self, buffer: &mut [u8])
Transforms buffer in place.
Trait Implementations§
Source§impl Clone for Rc4KeyState
impl Clone for Rc4KeyState
Source§fn clone(&self) -> Rc4KeyState
fn clone(&self) -> Rc4KeyState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Rc4KeyState
impl RefUnwindSafe for Rc4KeyState
impl Send for Rc4KeyState
impl Sync for Rc4KeyState
impl Unpin for Rc4KeyState
impl UnsafeUnpin for Rc4KeyState
impl UnwindSafe for Rc4KeyState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more