Function xor_utils::avg_normalized_hamming_distance [] [src]

pub fn avg_normalized_hamming_distance(
    input: &Vec<u8>,
    max_keysize: usize
) -> HashMap<usize, f32>

Calculates the average normalized hamming distance for the given input bytes

The average normalized hamming distance is calculated by

  1. Pick a keysize s
  2. Take 2 chunks each of size s
  3. Calculate the hamming distance between these 2 chunks
  4. Normalize the hamming distance by dividing by s
  5. Repeat 1-4 until there are no more chunks left
  6. Calculate the mean average of the normalized hamming distances calculated from the above.

Returns a HashMap that maps keysize to average normalized hamming distance for that keysize.