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
- Pick a keysize s
- Take 2 chunks each of size s
- Calculate the hamming distance between these 2 chunks
- Normalize the hamming distance by dividing by s
- Repeat 1-4 until there are no more chunks left
- 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.