INNER CODE UNIT · Rust

to_vector

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

    pub fn to_vector(
        &self,
        vm: &mut dyn Vm<Binary>,
        len: usize,
    ) -> Result<Vector<U8>, CipherError> {
        if len == 0 {
            return Err(CipherError::new("length must be greater than 0"));
        } else if self.blocks.is_empty() {
            return Err(CipherError::new("no keystream material available"));
        }

        let block_count = len.div_ceil(self.block_size());
        if block_count != self.blocks.len() {
            return Err(CipherError::new("length does not match keystream length"));
        }

        let mut keystream =
            flatten_blocks(vm, self.blocks.iter().map(|block| block.output.to_raw()))?;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…