Cryptography/Other Substitution Cyphers
Subject classification: this is a mathematics resource. |
Subject classification: this is an information technology resource. |
Playfair Cipher
editPlayfair cipher consists of a table of 5x5 letters. The table have all of the 26 english letters. The arrangement and distribution of the letters in the table depends on the chosen key.
Creating the table
editLets have the word ENCRYPTION as a key.
Start with writing the key word in the table, each letter in a cell. If a letter appears more than once in the key word, it is only included once in the table.
The letters (I) and (J) were combined in a single cell, so we will have 24 cells for the rest of 24 letters.
After writing the key word to the table, fill the remaining cells alphabetically.
So far, you will get this table.
E N C R Y P T I/J O A B D F G H K L M Q S U V W X Z |
Note that the letter (N) from the key word was not repeated and the letters (I) and (J) are in the same cell.
Encryption
editLets have the following sentence as a plaintext: I will meet you.
- Start by cutting the plaintext into fixed size units, each containing two letters.
- While creating units, if you get a unit has the same letter, insert (X) between them and transfer the right letter to the next unit.
- If you have a single letter in the last unit, add (X).
You will get this:
iw il lm ex et yo ux |
Now we need to exchange each unit with its corresponding ciphered unit. To do that there is 3 rules:
- If the two letter in the same column,substitute each letter with the one below. If the letter was the last one in the column take the first letter in the same column (IW-->FC).
- If the two letter in the same row,substitute each letter with the one in the right. If the letter was the most right letter,take the first letter in the left from the same row(LM-->MQ).
- otherwise,Intersect the row of the first letter in the unit with the column of the second letter in the same unit, this will give the first letter. And intersect the column of the first letter in the unit with the row of the second letter in the same unit to get the seconde letter(IL-->TM).
The encrypted units will be this:
FC TM MQ RU NP RA VZ |
The ciphertext will be: FCTMMQRUNPRAVZ .
Decryption
editTo decrypt, start by cutting the ciphertext into units. Then use the table to get the plaintext using the same rules. However, there are some differences:
- If the two letter in the same column,substitute each letter with the one above. If the letter was the first one in the column take the last letter in the same column (FC-->I/Jw).
- If the two letter in the same row,substitute each letter with the one in the left. If the letter was the most left letter,take the first letter in the right from the same row(MQ-->LM).
- otherwise,Intersect the row of the first letter in the unit with the column of the second letter in the same unit, this will give the first letter. And intersect the column of the first letter in the unit with the row of the second letter in the same unit to get the seconde letter(TM-->I/JL).