Monday, October 14, 2013

Code 6 : Polybius Square

Polybius Square

A Polybius Square is a table that allows someone to translate letters into numbers. To give a small level of encryption, this table can be randomized and shared with the recipient. In order to fit the 26 letters of the alphabet into the 25 spots created by the table, the letters i and j are usually combined.
To encipher a message you replace each letter with the row and column in which it appears. For example, D would be replaced with 14.
To decipher a message you find the letter that intersects the specified row and column.
Plaintext: This is a secret message
Ciphertext: 44232443  2443  11  431513421544  32154343112215 


The Polybius Square is an ancient Greek invention, discovered by a scholar named Polybius. For the Greek alphabet of 24 letters, it consisted of a 5 by 5 grid where each square of the grid was filled by a single letter. In the English Alphabet of 26 letters, we have one too many letters. To get round this we combine two letters, traditionally "i" and "j". It is also possible to combine other pairs, such as "v" and "u". Another alternative to the Polybius Square for english is to include the digits 0-9, so we have 36 characters.
The standard Polybius Square for English
The extended Polybius Square for English including the digits 0-9
With the Square, we replace each letter with the two numbers that represent its position in the grid. We can choose whether we go across then down, or vice versa, as long as we keep it the same the whole way through. We shall go across first, so "h" is "32" in the standard table.
This encyrption is standard, and so far has no key, and thus is easily broken. We need to introduce the idea of a key to the Polybius Square to make it more secure (Kerckhoffs's Principle). This is done in a very simple way. We reorder the alphabet in the same way as we did for the Mixed Alphabet Cipher before we put it in the grid. That is, we use the letters of the keyword first, ignoring any repeat So using a keyword of polybius we get the mixed square below. 
The Mixed Square generated using the keyword polybius
The encryption process using a Polybius Square is fairly straightforward. First we have to generate the Mixed Square, using a keyword as above (or another rule such as reversing the alphabet, or shifting the alphabet). Once the Mixed Square is generated, we replace each letter with the "coordinates" of the letter within the grid, reading across first and then down.
As an example, we shall encrypt the plaintext "nice and simple" with the keyword example
First we make the Mixed Square using the keyword. We start by filling in the squares in the grid with the letters of the keyword, ignoring repetitions, and then continue with the rest of the alphabet.
The Mixed Square using keyword example
With the Square complete, we simply find each plaintext letter in the grid, and replace it with its coordinates. So "n" becomes "53", "i" becomes "33", "c" becomes "32" and so on. Continuing like this we get the ciphertext "53333211 315342 443341511211".
Decrytion is really easy too. We again make up the Mixed Square using the keyword, and then use the pairs of numbers to locate the plaintext letter in the grid, remembering the 
We shall decrypt the message "42342115532354 23423241 23454224113123" using the keyword polybius.
First we must generate the Mixed Square in exactly the same way as we did before.
The Mixed Square using keyword polybius
Now we look at pairs of letters in turn. So "42" represents "a", "34" is the plaintext letter "n" and "21" is "o". Continuing in this way we get the plaintext message "another easy example".


Post a Comment

Note: Only a member of this blog may post a comment.