CipherTools

Polybius Cipher

A Polybius square was devised by the ancient Greek historian Polybius as a way of replacing the many letters in an alphabet with just a few symbols. Polybius was thinking about the problem of how to communicate messages over a long distance by using burning torches. It was difficult to find a system of holding a torch in 24 different ways to signify the 24 different letters of ancient Greek. Whilst the torch could be spotted a long way away, the subtle difference between one of the 24 possible positions could not be detected at such a distance. If the 24 letters could somehow be replaced with a much smaller number of symbols, then the torch would only need to be held at this smaller number of positions, and it was obviously easier to find distinctive positions of this smaller number which could still be observed from far-off.

Polybius’ solution to this problem was to first write out the alphabet in a square:

1 2 3 4 5
1 A B C D E
2 F G H I/J K
3 L M N O P
4 Q R S T U
5 V W X Y Z

(This square obviously contains the English alphabet of 26 letters, rather than the ancient Greek one. Typically, the letter ‘J’ is treated as an ‘I’ when using the square.)

Each letter can now be replaced by its coordinates. So, to encipher the word “ANTS”:

  • 'A' >>> 11
  • 'N' >>> 11
  • 'T' >>> 11
  • 'S' >>> 11
  • 'ANTS' >>> 11334443

The Polybius square has reduced the variety of 25/26 letters down to a combination of just 5 different numbers, each of which could be represented by a torch held in a distinctive position, thus solving the communication-at-a-distance problem faced by the ancient Greeks.

By moving to a 6x6 square, we can add the 10 numbers for the price of only one more symbol in our coordinates:

1 2 3 4 5 6
1 A B C D E F
2 G H I J K L
3 M N O P Q R
4 S T U V W X
5 Y Z 0 1 2 3
6 4 5 6 7 8 9

Despite originally being developed to make communication clearer between two parties, it can easily be adapted to make communication more private. So, reverting to a 5x5 square, we could randomise the order of the letters to produce the following:

1 2 3 4 5
1 D M W S H
2 Z L E B O
3 N F R I/J Y
4 C V A P U
5 X K Q T G

If we now encode the word “ANTS”, we get:

  • 'A' >>> 43
  • 'N' >>> 31
  • 'T' >>> 54
  • 'S' >>> 14
  • 'ANTS' >>> 43315414

The symbols used for the row and column headings do not have to be numbers. They could be anything, even some of the same letters as used in the alphabet contained within the square:

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

The word ‘ANTS’ now becomes DCCAEDAD.

When a longer text is enciphered, the results can appear impressively confusing:

AEDEEADBBBAEAECAEADBEAAEDAEAEABEAEDEDCABEAAEEBBADDBECCAEDCACEAEABCAEDEEADDEBABEAECEBEAAEAAEAABABBBCCEAABABEAECEDEBEABBBECEAEDEDCABEAAEEBBADDBECCAEDCDDBEAEEAEBECEABCAEBBBECEEDBEEBBBCBEACAAEDEEAAADDABAAEDECDECADDACEAAEDEEABEEACBEAEBEABECEDDBECCBBEBAAABEBBBECEADBEAAEDAEAEABEBCEBEACEBBAEDCEBBBBECEBCEBEABADDBEAEDEEADADDCACEBBABAEDEEABCEBEABABBBEDDAABBCAABBCEAECDDEAABEACBDCCACBEAABAEDCCEEACBEACADCBCBBDBEAAEAEEAEBCEDDABCCEDDDABEABBBECEAEDCEBEDBEADBBABAEEAEBABDCAEDEEABCEBEACEBBAEDCEBEACBDCCACBEAABAEDCCEEACBEACADCBCDBEAAEAEEAEBEABAEAABDDCCDEAEBBBECEAEDEEAECBBBCBBECDDAEBAAEDCEBEDBEADBBABAEEAEBADDCEBECDDBECCAEDEEABCEBEABAAEDCEACBDCCACBEABBCCBBDDBEAEDCABEDEBCBDDCBEAABDDAADDCABBEBCABABBBEEADAECDDBCDEEAEBDDABECEBEABBAEEACEBBBECEAABBBADDBEDDAEDDBBCACABAABEDEBCBDDCBEABBAEAEEAAABCAEABAEDCECEBBBECACDDAEDBEDAEDCBEECEACBEDCABEEAEBBBDBDDCADDAEDDEAABDDBEDDAEBBEBEACEDDABECDCCBEAEBEACEABDCAEDEEAECDCCEEAAABBACEAEBABAEEBBAAEDCCEEACBEACADCBCAADCEBEAABDCBCDEDDABAEDDECBBAEEACEECDDBCDEEAEBABAEDCCCEDBBEBBBBEAEEAEAAEDEEAABEAECEDEBDDAEBADCADAEDEEADDEBAAEAABABBBCCEAABBEDCDADEDCDAEABDBBECAECABACEDCDAEACDEDDDEEAEDEDCABEAECDEEAEAACBABBBEAEAB

Features of a message encoded with a simple Polybius cipher

  • Unless more than one symbol has been used for each row and column heading, the overall length of the enciphered message will be an even number (two headings are needed to make the coordinate for each letter) and it will be twice as long as the original plaintext.
  • The ciphertext will only contain a limited number of unique symbols – possibly as few as 5, if a 5x5 square was used and if the row and column headings are identical.

Cipher Challenge competition    Leave feedback