INNER CODE UNIT · Rust

consume

tlsnotary/tlsn · crates/components/cipher/src/lib.rs:133

    pub fn consume(&mut self, len: usize) -> Result<Self, CipherError> {
        let block_count = len.div_ceil(self.block_size());

        if block_count > self.blocks.len() {
            return Err(CipherError::new("insufficient keystream"));
        }

        let blocks = self.blocks.split_off(self.blocks.len() - block_count);

        Ok(Self { blocks })
    }

    /// Applies the keystream to the provided input.
    ///
    /// # Arguments
    ///
    /// * `vm` - Virtual machine.
    /// * `input` - Input data.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…