Skip to main content

StreamCipher

Trait StreamCipher 

Source
pub trait StreamCipher {
    // Required method
    fn fill(&mut self, buf: &mut [u8]);

    // Provided method
    fn apply_keystream(&mut self, buf: &mut [u8]) { ... }
}
Expand description

Common interface for stream ciphers.

Stream ciphers encrypt and decrypt by XORing keystream bytes into a mutable buffer. The same operation is used in both directions.

Required Methods§

Source

fn fill(&mut self, buf: &mut [u8])

XOR keystream bytes into buf in place.

Provided Methods§

Source

fn apply_keystream(&mut self, buf: &mut [u8])

Alias for Self::fill for callers that prefer this terminology.

Implementors§