#7 Playfair Cipher

2.4K 12 1
                                    

#Cryptography

LECTURE #7: PLAYFAIR CIPHER

[INTRODUCTION]
The playfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone, but was named after Lord Playfair who promoted the use of the cipher. The technique encrypts pairs of letters (digraphs), instead of single letters as in the simple substitution cipher. This is significantly harder to break since the frequency analysis used for simple substitution ciphers does not work with it.

[ALGORITHM]
The Playfair cipher uses a 5 by 5 table containing a keyword or phrase. To generate a table, one would first fill in the spaces of the table with the letters of the keywords (dropping any duplicate letters), then fill the remaining spaces with the rest of the letters of the alphabet in order (NOTE: to reduce the alphabet to fit in the 5 by 5 table, you can omit the letter “Q” or replace letter “J” with “I”).

[EXAMPLE]
Let’s create a table using WATSON as keyword.

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

(Replace “J” with “I”)
W A T S O
N B C D E
F G H I K
L M P Q R
U V X Y Z

[ENCRYPTION]
In order to encrypt using a Playfair cipher, one would break the message into two groups of letters. If there is a dangling letter at the end, we can add an “X”. Using the table above, let’s encrypt AVE FELLOW WELL MET -> AV EF EL LO WW EL LM ET. Noticing the location of the two letters in the table, we can apply the following rules, in order:

1.If both letters are the same, add an X between them. Encrypt the new pair, re-pair the remaining letters and continue.
>For example, in the case of letter pair WW EL, using the table above, the letter pair would now be WX WE LX. Letter pair WX would be encoded as TU; WE would be encoded as ON; LX would be encoded as MV.

2. If the letters appear on the same row on your table, replace them with the letters to their immediate right respectively, wrapping around to the left side of the row if necessary.
>For example, the letter pair LM would be encoded as MP.

3. If the letters appear on the same column of your table, replace them with the letters immediately below, wrapping around to the top if necessary.
>For example, using the table above, the letter pair AV would be encoded as BA.

4. If the letters are on different rows and columns, replace them with the letters on the row respectively but at the other pair of corners of the rectangle defined by the original pair. The order is important – the first letter of the pair should be replaced first.
> For example, using the table above, the letter pair EL would encoded as BR and the letter pair ET would be encoded as CO.

Then, the AV EF EL LO WW EL LM ET would be encrypted as BA NJ BR RA TU ON MV MP CO.

[DECRYPTION]
To decrypt, ignore the rule #1. In rules #2 and #3, shift up and left instead of down and right. Rule 4 remains the same. Once you are done, drop any extra “X’s” that don’t make sense in the final message and locate any missing Q’s or I’s that should be J’s.

[GAME]
Try to decrypt this. PM Swordcane for answers, don’t comment in the comment section!
KEY: WATSON
“BR HP FD TS BO MV RA CM JZ GW HC EZ OT BE CM JE BN TF HD JM CR SG DW KX OS CN CM CO KZ CM”

###

— LMJC🎩 —

[NOTE]
Check on the comment section for some photos

[NOTE]Check on the comment section for some photos

Oops! This image does not follow our content guidelines. To continue publishing, please remove it or upload a different image.
Codes And CiphersWhere stories live. Discover now