Cryptanalysis
Repetitions and periods
Also found as Kasiski examination · Kasiski method · key length analysis
Record positions before interpreting gaps
A repeated sequence is the same run of selected units appearing more than once. Decipher reports one-based start positions and the gap from each occurrence to the next. Overlapping occurrences count.
- Sequence
ABCABCABC- Positions
1, 4, 7- Gaps
3, 3
A repeated ciphertext group can occur because the same plaintext met the same key phase, but it can also occur by accident. Several gaps sharing a factor are more useful than one isolated repeat.Gaines, CryptanalysisMilitary Cryptanalysis, Part II
A candidate period is not necessarily the period
The Kasiski method takes factors of repetition gaps as period candidates. Multiples can work too: columns split at period 6 also respect a true period 3, but each column contains fewer units. A written key such as ABCABC has length 6 and fundamental period 3.Gaines, CryptanalysisMilitary Cryptanalysis, Part II
Split the text by phase
For candidate period m, phase r contains positions whose index has the same remainder r modulo m. Decipher's periodic columns use the Latin-letter stream in order, fold it to uppercase, and distribute it into the selected number of columns.
- Phase 1
ADG- Phase 2
BEH- Phase 3
CF
If the candidate fits a repeating-key substitution, each phase may behave more like a monoalphabetic sample. Check that idea with frequency evidence or a phase-by-phase statistic, while remembering that every phase is shorter than the whole text.