The Double Playfair is an extension of the Playfair to use two separate keys and
to encipher each pair of letters twice. The German police made the mistake in late
1941 of switching from the rather strong Double Transposition cipher to the more
accessible Double Playfair, and for over a year Bletchley Park was able to use
these decrypts to gain intelligence in areas not covered by Enigma or other broken systems.

Like the Playfair, the Double Playfair cipher uses 5x5 squares. In this case
two keywords are chosen, and each square is filled in the same way as the Playfair.
For keywords HAMBURG and NEWYORK written in rows and a spiral, respectively,
we have the squares:

H A M B U N L I/J H G
R G C D E E M X V F
F I/J K L N W P Z U D
O P Q S T Y Q S T C
V W X Y Z O R K A B

Given the message "MY HOVERCRAFT IS FULL OF EELS," we begin by
choosing a period or number of letters (say, seven), then breaking the message into groups of seven
letters, with the second below the first, the fourth below the third, and so on.
If the last group is incomplete, break it into equal pieces. If it has an odd
number of letters, add an X to fill it out.

MYHOVER FULLO
CRAFTIS FEELS

We encipher each vertical pair. Find the first letter of each pair in the first
square and the second letter in the second square. The next step is to find the
letters at the opposite corners of the rectangle formed by the plaintext pair,
starting with the ciphertext letter in the second square. For the first pair
MC, the result of this step is GQ:

The second step is like the first: Encrypt GQ by finding G in the first square and
Q in the second; MP are at the opposite corners. Remember to take the first letter
of the ciphertext from the second key square, and the second letter of ciphertext
from the first key square. This completes the encryption of the pair MC.

The next plaintext pair, YR, is on the same row. In this case we take the letters to the left of each plaintext letter, again taking the first letter from the second key square and the second letter from the first key square, giving OX. The OX is then run through the same process, resulting in SR.

MYHOVER FULLO
CRAFTIS FEELS
MS
PR

There are no other special cases, and the result is: