pub trait Stream {
// Required method
fn xor_key_stream(
&mut self,
dst: &mut [u8],
src: &[u8],
) -> Result<(), StreamError>;
}Expand description
A Stream represents a stream cipher.
Required Methods§
Sourcefn xor_key_stream(
&mut self,
dst: &mut [u8],
src: &[u8],
) -> Result<(), StreamError>
fn xor_key_stream( &mut self, dst: &mut [u8], src: &[u8], ) -> Result<(), StreamError>
[xor_key_stream()] XORs each byte in the given slice with a byte from the
cipher’s key stream; dst and src must overlap entirely or not at all.
If dst.len() < src.len(), [xor_key_stream()] should panic. It is acceptable
to pass a dst bigger than src, and in that case, [xor_key_stream()] will
only update dst[..src.len()] and will not touch the rest of dst.
Multiple calls to [xor_key_stream()] behave as if the concatenation of
the src buffers was passed in a single run. That is, Stream
maintains state and does not reset at each [xor_key_stream()] call.