Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for KEYSIZE in range(2,40):
- hamming_dist1 = hamming_distance(encodedstring[0:KEYSIZE],encodedstring[KEYSIZE:2*KEYSIZE])
- hamming_dist2 = hamming_distance(encodedstring[2*KEYSIZE:3*KEYSIZE],encodedstring[3*KEYSIZE:4*KEYSIZE])
- hamming_dist3 = hamming_distance(encodedstring[4*KEYSIZE:5*KEYSIZE],encodedstring[5*KEYSIZE:6*KEYSIZE])
- norm_hamming_distance = (hamming_dist1+hamming_dist2+hamming_dist3)/KEYSIZE
- if norm_hamming_distance <= min_norm_keysize:
- list_keysize.append(KEYSIZE)
- min_norm_keysize = norm_hamming_distance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement