fn compute_normalized_hamming_distance(input: &[u8], keysize: usize) -> f32 {
    let chunks: Vec<&[u8]> = input.chunks(keysize).take(4).collect();
    let mut distance = 0f32;
    for i in 0..4 {
        for j in i..4 {
            distance += hamming_distance(chunks[i], chunks[j]).unwrap() as f32; // unwrap is ok
        }
    }

    distance / keysize as f32
}
// We use the first four blocks of `input` and sum the pairwise distances.
We use the first four blocks of `input` and sum the pairwise distances.
We use the first four blocks of ` input ` and sum the pairwise distances .
fn compute_normalized_hamming_distance(input: &[u8], keysize: usize) -> f32 {
    let chunks: Vec<&[u8]> = input.chunks(keysize).take(4).collect();
    let mut distance = 0f32;
    for i in 0..4 {
        for j in i..4 {
            distance += hamming_distance(chunks[i], chunks[j]).unwrap() as f32; // unwrap is ok
        }
    }
    distance / keysize as f32
}
fn compute_normalized_hamming_distance ( input : & [ u8 ] , keysize : usize ) -> f32 { let chunks : Vec < & [ u8 ] > = input . chunks ( keysize ) . take ( 4 ) . collect ( ) ; let mut distance = 0f32 ; for i in 0 .. 4 { for j in i .. 4 { distance += hamming_distance ( chunks [ i ] , chunks [ j ] ) . unwrap ( ) as f32 ; // unwrap is ok } } distance / keysize as f32 }
We use the first four blocks of `input` and sum the pairwise distances.
We use the first four blocks of ` input ` and sum the pairwise distances .
input
&[u8]
keysize
usize
input
&[u8]
keysize
usize