Cryptography/Playfair cipher

The Playfair Cipher is one of several methods used to foil a simple frequency analysis. Instead of every letter having a substitute, every digraph has a substitute. This tends to level the frequency distribution somewhat.

The classic Playfair tableau consists of four alphabets, usually in a square arrangement, two plaintext and two ciphertext. In this example, keywords have been used to disorder the ciphertext alphabets. In use, two letters of the plaintext are located in the plaintext alphabets. Then reading across from the first letter to the column of the second letter, the first ciphertext character is found. Next, reading down from the first letter to the row of the second letter, the second ciphertext letter is found.

As an example, using tableau above, the digraph "TE" is enciphered as "uw", whereas the digraph "LE" is enciphered as "mk". This makes a frequency analysis difficult.

A second version of the Playfair cipher uses a single alphabet.

SECRT - Your secret keyword, share among you and your receiver KYWDP LAFIZ BXCQG HUMOK

If the letters of a digraph lie at the corners of a rectangle, then they are rotated clockwise round the rectangle, SW to CK, AT to EZ.

If they lie in the same column or row they are moved one down or across, EA to YX, RS to TE.

The square is treated as though it wraps round in both directions, ST to ES, DO to IR

Both versions of the Playfair cipher are of comparable strength.