pub struct XorCipher { /* private fields */ }Expand description
Trivial XOR-stream cipher used as a mock. The “key schedule” is a single running byte derived by XOR-folding the supplied key; each input byte is XORed with that running byte. This is not secure cryptography — it exists only to exercise the full cipher FFI surface without pulling in a real cipher library.
Implementations§
Trait Implementations§
Source§impl CipherPlugin for XorCipher
impl CipherPlugin for XorCipher
Source§fn create_with_key(
_algorithm: &str,
key: &[u8],
iv: &[u8],
_opts: Option<OptionView<'_>>,
) -> PluginResult<Self>
fn create_with_key( _algorithm: &str, key: &[u8], iv: &[u8], _opts: Option<OptionView<'_>>, ) -> PluginResult<Self>
Construct a new cipher instance for the named algorithm with the
given key and IV. Either
key or iv may be empty when the
algorithm does not require them.Source§fn block_size(&self) -> u32
fn block_size(&self) -> u32
Block size in bytes for this instance.
Source§fn update(&mut self, input: &[u8], output: &mut [u8]) -> PluginResult<usize>
fn update(&mut self, input: &[u8], output: &mut [u8]) -> PluginResult<usize>
Process
input and write as many output bytes as fit into
output. Returns the number of bytes written. The caller
guarantees output.len() is large enough to hold one block of
ciphertext per block of input.Source§fn finalize(&mut self, _output: &mut [u8]) -> PluginResult<usize>
fn finalize(&mut self, _output: &mut [u8]) -> PluginResult<usize>
Flush any buffered output (e.g. the final partial block after
padding) into
output. Returns the number of bytes written.Source§fn reset(&mut self) -> PluginResult<()>
fn reset(&mut self) -> PluginResult<()>
Reset to the initial state (post-
create).Auto Trait Implementations§
impl Freeze for XorCipher
impl RefUnwindSafe for XorCipher
impl Send for XorCipher
impl Sync for XorCipher
impl Unpin for XorCipher
impl UnsafeUnpin for XorCipher
impl UnwindSafe for XorCipher
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