Hacking Secret Ciphers with Python

(Ann) #1

322 http://inventwithpython.com/hacking


Email questions to the author: [email protected]


PPQCAXQVEKGYBNKMAZUYBNGBALJONITSZMJYIMVRAGVOHTVRAUCTKSGDDWUOXITLA


ZUVAVVRAZCVKBQPIWPOU


PPQCAXQVEKGYBNKMAZUYBNGBALJONITSZMJYIMVRAGVOHTVRAUCTKSGDDWUOXITLA


ZUVAVVRAZCVKBQPIWPOU


PPQCAXQVEKGYBNKMAZUYBNGBALJONITSZMJYIMVRAGVOHTVRAUCTKSGDDWUOXITLA


ZUVAVVRAZCVKBQPIWPOU


After finding the repeated sequences, get a count of the spacing between the sequences. If we
count the number of letters between the start of each of these sequences, we find that:


 Between the first and second VRA sequences there are 8 letters.
 Between the second and third VRA sequences there are 24 letters.
 Between the first and third VRA sequences there are 32 letters.
 Between the first and second AZU there are 48 letters.
 Between the first and second YBN there are 8 letters.

Kasiski Examination, Step 2 – Get Factors of Spacings


So the spacings are 8, 8, 24, 32, and 48. Let’s find the factors of each of these numbers (not
including one):


 The factors of 8 are 2, 4, and 8.
 The factors of 24 are 2, 4, 6, 8, 12, and 24.
 The factors of 32 are 2, 4, 8, and 16.
 The factors of 48 are 2, 4, 6, 8, 12, 24, and 48.

So the spacings of 8, 8, 24, 32, and 48 expand to this list of factors: 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 8, 8,
8, 8, 12, 12, 16, 24, 24, and 48. If we do a count of these factors, we get this:


Table 21-1. Factor count from our “Ppqca xqvekg...” example.
Factor Count
2 Appears 4 times.
4 Appears 4 times.
6 Appears 2 times.
8 Appears 4 times.
12 Appears 2 times.
16 Appears 1 time.
24 Appears 2 times.
48 Appears 1 time.
Free download pdf