Key derivation using known parameters of playfair Is it possible to derive the key, for a playfair cipher, if both the message and cipher text are known?
There are two issues to be aware of.
Firstly if the message and cipher text are short, or lack variation in the usage of letters, there may not be enough information to recover a complete Playfair square,
Secondly, rotating all the rows or all the columns of a Playfair square gives an alternative square that encrypts in the same manner. Thus squares come in families of 25. If the “key” is a word or phrase, it is usually straightforward to recover the key used by the system. If the key is a “random” arrangement of 25 letters, then the precise key cannot be distinguished from the other 24 without more information.
If you're asking about the process for recovering the square given matched plain and cipher, this can be done manually and is relatively straightforward. Consider a common letter such as &quot;E&quot; and select all digraphs involving this letter. There are only 5 letters that can replace our chosen letter: the four with which it shares a row and the one directly beneath it. Suppose then we find that we find &quot;E&quot; can be encoded only as one of &quot;ADFLX&quot;, now choose a common one of these an examine digraphs. For example we might find that &quot;A&quot; can only be encoded as &quot;BEFLX&quot;, we can now conclude that one row contains the letters &quot;AEFLX&quot; and that &quot;D&quot; and &quot;B&quot; lie directly below &quot;A&quot; and &quot;E&quot; respectively. Now consider the letters apart from &quot;ADFLX&quot; that appear in digraphs with &quot;E&quot;, within those digraphs these letters can only be encoded as either a letter that lies in the same column as &quot;E&quot;, or a letter directly to the right. The ones encrypted to the right will share a column with &quot;E&quot; and &quot;E&quot; will be encoded to the same letter for each of these. These rules should allow you to reconstruct rows and columns of the square. The order of the rows and columns can only be inferred from encryptions of digraphs that share a row/column.