On the Subject of the Playfair CM

A machine that knows no bounds when it comes to ciphers.

Create a key using the keyword on screen 1 and the Boolean Expression on screen A. Make sure to replace any Js with Is. Rearrange the key into a 5×5 matrix.

If there is a number on screen B, take out the letter at that position in the encrypted word. Set aside this letter to be put back in at a later step. Split the encrypted word into pairs of letters. Depending on which instruction is required, apply it to each pair of letters.

If the Submit Button is white, follow the instructions under Encrypt Instructions. Otherwise follow the instructions under Decrypt Instructions.

Encrypt Instructions

  • If the 2 letters are the same, the encrypted pair is two of the letter diametrically opposite in the matrix.
  • Otherwise, if the letters appear on the same row of your matrix, replace them with the letters to their immediate right respectively, wrapping around to the left side of the row.
  • Otherwise, if the letters appear on the same column of your matrix, replace them with the letters immediately below them respectively, wrapping to the top row of the matrix.
  • Otherwise, replace each of them with the letter on the same row but in the column of the other letter in the original pair.

Decrypt Instructions

  • If the 2 letters are the same, the encrypted pair is two of the letter diametrically opposite in the matrix.
  • Otherwise, if the letters appear on the same row of your matrix, replace them with the letters to their immediate left respectively, wrapping around to the right side of the row.
  • Otherwise, if the letters appear on the same column of your matrix, replace them with the letters immediately above them respectively, wrapping to the bottom row of the matrix.
  • Otherwise, replace each of them with the letter on the same row but in the column of the other letter in the original pair.

Finally, if you took out a letter, insert that letter back into position equal to the number on screen B. If any of the letters on screen 2 match at the same position as any of the letters of your encrypted word, replace that letter with a J. You should now have an decrypted word.

Example 1

Encrypted Word: ADNSPHOS
Screen 2: BBDXNOUO
Key: BCDEFGHIKMNOPQRSTUVWXZALY
Using Encrypt Rules

BCDEF
GHIKM
NOPQR
STUVW
XZALY

AD → DI
NS → SX
PH → OI
OS → NT
DISXOINT + BBDXNOUO → DISJOINT
Decrypted Word: DISJOINT

Example 2

Encrypted Word: ZDPCHAE
Screen 2: INGSHOA
Key: ABCDEGHIKLMNPQRUVWXYZSOFT
Using Encrypt Rules

ABCDE
GHIKL
MNPQR
UVWXY
ZSOFT

ZDPCHAE + 4 → ZDPHAE
ZD → FA
PH → NI
AE → ED
FANIED + 4 + C → FANCIED
FANCIED + INGSHOA → FANCIED
Decrypted Word: FANCIED