INNER CODE UNIT · Rust
new
tlsnotary/tlsn · crates/components/cipher/src/lib.rs:119
pub fn new(blocks: &[CtrBlock<N, C, O>]) -> Self {
Self {
blocks: VecDeque::from_iter(blocks.iter().copied()),
}
}
/// Consumes keystream material.
///
/// Returns the consumed keystream material, leaving the remaining material
/// in place.
///
/// # Arguments
///
/// * `len` - Length of the keystream in bytes to return.
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() {