Polybius square is a monoalphabetic substitution cipher.
Polybius cipher (or Polybius square) works by replacing each letter by the coordinates of its position in a grid (often a square).
- Read: What is a cipher.
A brief history of Polybius checkerboard:
It’s named after a Greek historian Polybius who lived around 200 and 125 BC. It fractionates plaintext characters to represent them in a smaller set of symbols.
- Read: Complete list of ciphers.
Are you interested in finding out more about ciphers and codes?
The Codebreakers – The Story of Secret Writing book by David Kahn is what I would start with.
How to design a Polybius square
In this guide I will be using the English alphabet:
Normally you create a 5 by 5 square but my alphabet has 26 characters, so in order to have the right number of characters I merge letter “i” and “j” to one letter.
For extra security, you can include the digits 0-9 to the alphabetic characters to have a total of 36 characters. In this case, you can make a 6 by 6 Polybius square.
- Read: Caesar Cipher.
Note that a Polybius square you create can differ depending on the number of characters in your alphabet.
Steps to follow:
- Create a 5 by 5 square grid or a 6 by 6 if you have decided to use 0-9 digits.
- If you have decided to go with 5 by 5, then you need to merge the letter “i” and “j” else if 6 by 6 no need to remove any characters.
- Write each letter of the alphabet in your grid, at the intersection of a row and column.
How to encrypt using Polybius square
To encode your message simply look at the coordinates of the letter in the Polybius square.
Here is an example:
Plaintext: Polybius square cipher is awesome.
This is the square I will be using for this encryption:
So for my first letter “p”, the coordinates are (3, 5), where 3 is on X-axis and the 5 is on the Y axis.
After I repeat this process for the entire plaintext I get:
Ciphertext: 3534315412244543 434145114215 132435231542 2443 11521543343215
Try out the following example, using the English alphabet and merging letter “i” and “j”.
Plaintext: Learning ciphers is fun.
How to decrypt Polybius square cipher
To decode this cipher is equally easy, simply generate the square used during the encryption process. You need to know a few things: the alphabet used, the keyword used if any, and the characters placement used.
Then simply replace each pair of digits in the ciphertext with the corresponding letter on the Polybius square.
Decrypt this example:
Ciphertext: 134254354434224211352354 2443 442315 43132415331315 3421 52422444243322 113314 1242151125243322 1334141543
Here are 5 techniques and methods you can use to improve the security of a Polybius cipher:
- Use a keyword while constructing your Polybius square.
- You can reverse the letters of the alphabet or shifting the alphabet to increase complexity.
- Read the coordinates down first then across, in this case, both the sender and recipient should do the same.
- You could alternate between the two methods of reading the coordinates, this will make it a kind of polyalphabetic cipher and also less prone to frequency analysis attacks.
- You can also use a different alphabet, maybe including digits 0-9 and other punctuation to make it complex to decode easily.
Here is a tool to decrypt/encrypt Polybius automatically.
Are you interested in learning how to break codes?
The Elementary Cryptanalysis – A Mathematical Approach book by Abraham Sinkov is what I would recommend.
Polybius cipher is not secure even when using a keyword, this is because it’s a monoalphabetic substitution cipher. And each letter of the plaintext is represented by a similar pair of numbers every time, so making it prone to frequency analysis attacks.
Note that the Polybius square was not used as a cipher, but to help in telegraphy. Five different colored flags each representing digits 1-5 were used to signal message across a long distance effectively.
Two flags could be held at a time. You can think of this as a morse code which is much easier to understand.
Which part of Polybius square cipher did you not understand?
Let me know by leaving a comment below.