# How to decode a Playfair message with a partial key?

I've been given a Playfair ciphered message and a partial key, where a few key letters are missing:

• Corrupted key (? stands for a missing letter): ?ENVGQ?RKBDXACU?LIOW
• Ciphertext: LGOXMVYHIMISYSSQWMZX

I tried to solve this myself and got the plaintext WELCHOQLHNLRBHED, which is clearly wrong.

What methods can I use to decode this message?

• Hi, Auriwield, and welcome to Crypto Stack Exchange. Please note that your question, as asked, is borderline off-topic here, as we don't allow "Decode this for me!" questions. However, I've chosen to interpret and answer your question as "What methods can I use to solve a cipher like this?", with the specific ciphertext as just an example, which is on-topic here. – Ilmari Karonen Oct 9 '16 at 11:52

The quick and dirty way would be to write a computer program to try all the remaining possible key letters in the ? positions and print out the resulting plaintexts. Hopefully, one of them will stand out as being obviously correct. Remember that each letter can occur only once in a Playfair key, and that your key is already pretty long, so there aren't a lot of unused letters left in the alphabet for the unknown positions.

The slightly more clever method (which is probably what you're supposed to use) would be to first see if any of the ciphertext letter pairs can already be decoded without knowing the missing key letters (or any of the letters on the last row of the key matrix, since they obviously depend on the missing letters too). You can do this by hand (again, presumably the intended method, since that's the way you'll actually learn how a Playfair cipher works), or you can cheat and use any standard Playfair decoder tool and just try a couple of different variations of the key and see which letters of the plaintext change.

For example, here are the results of trying to decode the message (using this online decoder) with a few different choices of missing letters, out of the eight letters not already present in the key (F, H, M, P, S, T, Y and Z):

Ciphertext:              LG OX MV YH IM IS YS SQ WM ZX
Decoded with ??? = FHM:  WE LC OF SK LW LT TP PH OW SU
Decoded with ??? = PST:  WE LC YN MF AI LR HK QB IZ HU
Decoded with ??? = TYZ:  WE LC PN EL AI WM BH FB IS LD


You could try a few more choices, but what should be apparent here is that decoding the first two letter pairs clearly isn't affected by the missing key letters, and thus, that the plaintext begins with the letters WELC. Now, there aren't a lot of English words that begin with those letters — in fact, I can only think of a single really likely one.

Assuming that the plaintext begins with "Welcome", you can now rule out any choices of missing letters that would result in MV decrypting to anything other than OM. Even if that's not enough to solve the problem completely, you should at least be able to lock in some more plaintext letters, and so hopefully guess more words in the plaintext, and so get more known plaintext letter pairs, and so on.

In fact, if you consider the way the Playfair cipher works, knowing that OM encrypts to MV would immediately tell you something useful: namely, that the letters V, M and O must all appear in the same row or in the same column, and that they must be adjacent and in that specific order. In this case, looking at the key matrix:

? E N V G
Q ? R K B
D X A C U
? L I O W
? ? ? ? ?


this tells you that, for this plaintext / ciphertext pair to be correct, M would have to appear in the fourth column of the last row, below O and above V. (Remember that the rows and the columns wrap around.)

Unfortunately, using the standard Playfair key matrix setup, where any letters left over from the key are simply appended in alphabetical order, there is no way to get M in that position simply by filling in the ? marks in the key! So either:

1. my guess that the first plaintext word should be "welcome" is wrong,
2. the ciphertext contains an error (always possible, although hopefully rare in well designed crypto puzzles),
3. the key is actually longer than what we're given, and we're supposed to arbitrarily assign the remaining five letters for the last row too, or
4. there's something else funny going on, and this isn't a standard Playfair cipher after all.

If we assume #3 above, and start shuffling the letters in the last row, it is in fact possible to get a plaintext that begins with "welcome to" and where the rest looks at least vaguely like English (although not obviously enough so for me to declare it as clearly the correct solution without knowing where the puzzle came from and what other clues might be available). So, alas, I have not been able to definitively confirm that these steps will yields a correct solution to your puzzle. But at least they do illustrate the general method by which such problems can be attacked.