functions for getting hamming distances of many keylengths