pub fn uses_ecb(oracle: &dyn Oracle, prefix_chunks_count_limit: usize) -> Result<bool> {
    let input = vec![0; (prefix_chunks_count_limit + 2) * BLOCK_SIZE];
    let ciphertext = oracle.encrypt(&input)?;
    let blocks: Vec<&[u8]> = ciphertext
        .chunks(BLOCK_SIZE)
        .skip(prefix_chunks_count_limit)
        .take(2)
        .collect();
    Ok(blocks[0] == blocks[1])
}
// We need an upper bound on the number of prefix chunks that the oracle prepends to our input.
// I claim that it is impossible to detect ECB with just a single call to the oracle without this limit.
We need an upper bound on the number of prefix chunks that the oracle prepends to our input.
I claim that it is impossible to detect ECB with just a single call to the oracle without this limit.
We need an upper bound on the number of prefix chunks that the oracle prepends to our input . I claim that it is impossible to detect ECB with just a single call to the oracle without this limit .
pub fn uses_ecb(oracle: &dyn Oracle, prefix_chunks_count_limit: usize) -> Result<bool> {
    let input = vec![0; (prefix_chunks_count_limit + 2) * BLOCK_SIZE];
    let ciphertext = oracle.encrypt(&input)?;
    let blocks: Vec<&[u8]> = ciphertext
        .chunks(BLOCK_SIZE)
        .skip(prefix_chunks_count_limit)
        .take(2)
        .collect();
    Ok(blocks[0] == blocks[1])
}
pub fn uses_ecb ( oracle : & dyn Oracle , prefix_chunks_count_limit : usize ) -> Result < bool > { let input = vec ! [ 0 ( prefix_chunks_count_limit 2 ) BLOCK_SIZE ] ; let ciphertext = oracle . encrypt ( & input ) ? ; let blocks : Vec < & [ u8 ] > = ciphertext . chunks ( BLOCK_SIZE ) . skip ( prefix_chunks_count_limit ) . take ( 2 ) . collect ( ) ; Ok ( blocks [ 0 ] == blocks [ 1 ] ) }
We need an upper bound on the number of prefix chunks that the oracle prepends to our input.
We need an upper bound on the number of prefix chunks that the oracle prepends to our input .
oracle
&dyn Oracle
prefix_chunks_count_limit
usize
oracle
&dyn Oracle
prefix_chunks_count_limit
usize