In previous posts, we saw how we might establish the length of the key used to encode a periodic cipher, such as Vigenère or Beaufort. I showed two methods, the Index of Coincidences and the Kasiski/Kerckhoff.

This is the cipher we're trying to solve:

VKMHG QFVMO IJOII OHNSN IZXSS CSZEA WWEXU LIOZB AGEKQ UHRDH IKHWE OBNSQ RVIES LISYK BIOVF IEWEO BQXIE UUIXK EKTUH NSZIB SWJIZ BSKFK YWSXS EIDSQ INTBD RKOZD QELUM AAAEV MIDMD GKJXR UKTUH TSBGI EQRVF XBAYG UBTCS XTBDR SLYKW AFHMM TYCKU JHBWV TUHRQ XYHWM IJBXS LSXUB BAYDI OFLPO XBULU OZAHE JOBDT ATOUT GLPKO FHNSO KBHMW XKTWX SX

The next step is to 'split' the ciphertext, and group together each of the letters which were encoded using the same key. Each group, being encoded with the same key, is effectively an ordered alphabet. In the case of a Vigenère it's just a Caesar shift. Whereas with Beaufort it will be a Caesar shift which follows Atbash, a reversal.

KeyPos=0: VFOSSWIEDERIOEEESJFSIKLEDUSRYSSFCWQISYPUJTPSWS KeyPos=1: KVINCWOKHOVSVOUKZIKENOUVGKBVGXLHKVXJXDOOOOKOXX KeyPos=2: MMIISEZQIBIYFBUTIZYITZMMKTGFUTYMUTYBUIXZBUOKK KeyPos=3: HOOZZXBUKNEKIQIUBBWDBDAIJUIXBBKMJUHXBOBADTFBT KeyPos=4: GIHXEUAHHSSBEXXHSSSSDQADXHEBTDWTHHWSBFUHTGHHW KeyPos=5: QJNSALGRWQLIWIKNWKXQREAMRTQACRAYBRMLALLEALNMX

I did a frequency count on the first group of letters, and compared this with English. Though at first glace this already looks to be a reasonable fit, as the cipher is known to be Beaufort it cannot be correct - as Beaufort 'reverses' the ciphertext. I.e. if the key is 'H' then 'B' will encode to 'G' and 'C' encodes to 'F'. As the plaintext letter moves 'up' the alphabet, the ciphertext moves 'down'.

Reflecting and sliding the graph we try to find the correct fit. Though it should be noted that the most predominant letter in the 'first key letter position' is NOT 'e'. This would give a wrong placement for the other letters, we should try to find a reasonable match for all letters.

Actually, this is a slight fib. What I *actually* did was to compare the letter frequencies between the letter frequencies for English, and then square all the differences between the two frequencies, adding up the totals. I repeated this (using a spreadsheet) for each different shift position, and I chose the one which had the lowest 'sum of the squares', i.e. the closest match. To find the best fit by sliding the graph about in this case would have been a bit tricky! Indeed, the encoded text freakishly gave a better fit!

It is done using graphical methods though, and once a reasonable match is found the first key letter can be worked out. In this case, the match gives 'W' (look at 'A', it encodes to 'W'. The letter 'A' is encoded *as the key* as I've described Beaufort.

I hope that you'll be able to find the remaining key letters and hence decode the message!