CODES & CIPHERS

By stuck_n_silence

55.6K 603 34

Compilation of codes, ciphers & some abbreviations to shorten the message before encrypting them. Learn the e... More

CONTENTS
A1Z26
Acrostic Cipher
ADFGX & ADFGVX Cipher
Affine Cipher
Atbash
Bacon's Cipher
Bifid Cipher
Binary Code
Book Codes
Caesar Cipher
Clock Cipher
Columnar Transposition Cipher
CW Abbreviations
Daedalus Cipher
Dancing Man/Men Code
Morse Code
Morse Code Abbreviations
Pigpen, Rosicrucian, & Templar Cipher
Porta Cipher
Rail Fence ( Zigzag ) Cipher
Rot13
Tap Code/Knock Code
The Pinprick Code
Trifid Cipher
Vigenère Cipher
Solfa Cipher

Playfair Cipher

1.5K 15 1
By stuck_n_silence

The Playfair cipher uses a 5 by 5 table containing a key word or phrase.
Memorization of the keyword and 4 simple rules was all that was required to create the 5 by 5 table and use the cipher.

To generate the key table

1. First, fill in the spaces in the table with the letters of the keyword (dropping any duplicate letters).

2.  Fill the remaining spaces with the rest of the letters of the alphabet in order (usually omitting "J" or "Q" to reduce the alphabet to fit; other versions put both "I" and "J" in the same space).

Note!

The key can be written in the top rows of the table, from left to right, or in some other pattern, such as a spiral beginning in the upper-left-hand corner and ending in the center.

The keyword together with the conventions for filling in the 5 by 5 table constitute the cipher key.

To encrypt a message, one would break the message into digrams (groups of 2 letters) such that, for example, "HelloWorld" becomes "HE LL OW OR LD", and map them out on the key table.

If needed, append an uncommon monogram to complete the final digram.

The two letters of the digram are considered as the opposite corners of a rectangle in the key table.

Note the relative position of the corners of this rectangle. Then apply the 4 rules, in order, to each pair of letters in the plaintext.
 

4 Rules

1. If both letters are the same (or only one letter is left), add an "X" after the first letter. Encrypt the new pair and continue. Some variants of Playfair use "Q" instead of "X", but any letter, itself uncommon as a repeated pair, will do.

2. If the letters appear on the same row of your table, replace them with the letters to their immediate right respectively (wrapping around to the left side of the row if a letter in the original pair was on the right side of the row).

3. If the letters appear on the same column of your table, replace them with the letters immediately below respectively (wrapping around to the top side of the column if a letter in the original pair was on the bottom side of the column).

4. If the letters are not on the same row or column, replace them with the letters on the same 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 encrypted pair is the one that lies on the same row as the first letter of the plaintext pair.

To decrypt, use the INVERSE (opposite) of the last 3 rules, and the 1st as-is (dropping any extra "X"s, or "Q"s that do not make sense in the final message when finished).

There are several minor variations of the original Playfair cipher. [6]

Example :

Using "playfair example" as the key (assuming that I and J are interchangeable), the table becomes (omitted letters in red):

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

Encrypting the message "Hide the gold in the tree stump" (note the null "X" used to separate the repeated "E"s) :

HI DE TH EG OL DI NT HE TR EX ES TU MP ^

1. The pair HI forms a rectangle, replace it with BM

2. The pair DE is in a column, replace it with OD

3. The pair TH forms a rectangle, replace it with ZB

4. The pair EG forms a rectangle, replace it with XD

5. The pair OL forms a rectangle, replace it with NA

6. The pair DI forms a rectangle, replace it with BE

7. The pair NT forms a rectangle, replace it with KU

8. The pair HE forms a rectangle, replace it with DM

9. The pair TR forms a rectangle, replace it with UI

10. The pair EX (X inserted to split EE) is in a row, replace it with XM

11. The pair ES forms a rectangle, replace it with MO

12. The pair TU is in a row, replace it with UV

13. The pair MP forms a rectangle, replace it with IF

BM OD ZB XD NA BE KU DM UI XM MO UV IF

Thus the message "Hide the gold in the tree stump" becomes "BMODZ BXDNA BEKUD MUIXM MOUVI F". (Breaks included for ease of reading the cipher text.)

DECODING

Follow these rules:

1. Split the ciphertext into pairs of letters.

2. Find each pair of letters on the grid. You always decode the first letter in the ciphertext first.

3. If the pair of letters form a rectangle, use the letters from the other corners of the rectangles.

4. Each letter is replaced with the letter from the opposite corner on the same row.

5. If the pair of letters are on the same row, replace each letter with the letter directly to its LEFT.

6. If the pair of letters are in the same column, replace each letter with the letter directly ABOVE it.
 

Credits to Wikipedia.com

Continue Reading

You'll Also Like

77 11 7
A compilation of my short stories, written in the context of school assignments, writing clubs or other. Enjoy!
25 0 12
A writing challenge compiled into a short story collection. Once a month, I pick a set of three words suggested by a reader to produce a story. These...
144 6 5
Collection of short stories. Some are for contests or story prompts.