The history of cryptography is almost as old as that of human language. It is known that the ancient Egyptians, Chinese, Indians or Greeks used more or less sophisticated methods of encrypting messages, as shown by some documentary examples that have survived.
Generally associated with the military field, the need to send messages also produced the development of artefacts for this purpose, such as the scytale used by Spartan ephors. It consisted of two rods of similar thickness, one for the transmitter and one for the receiver, on which a leather ribbon was wound where the message was written. Only by wrapping the tape around a stick of similar thickness could the message be read.
There are even testimonies of the use of steganography (the concealment of the existence of the message), as detailed by Herodotus:
These manifold alarms had already caused him to contemplate raising a rebellion, when the man with the marked head came from Susa, bringing him instructions on the part of Histiaeus to revolt from the king. For Histiaeus, when he was anxious to give Aristagoras orders to revolt, could find but one safe way, as the roads were guarded, of making his wishes known; which was by taking the trustiest of his slaves, shaving all the hair from off his head, and then pricking letters upon the skin, and waiting till the hair grew again. Thus accordingly he did; and as soon as ever the hair was grown, he despatched the man to Miletus, giving him no other message than this- “When thou art come to Miletus, bid Aristagoras shave thy head, and look thereon.” Now the marks on the head, as I have already mentioned, were a command to revolt. All this Histiaeus did because it irked him greatly to be kept at Susa, and because he had strong hopes that, if troubles broke out, he would be sent down to the coast to quell them, whereas, if Miletus made no movement, he did not see a chance of his ever again returning thither (Herodotus, History V-XXXV)
But when need dictated rapid communication of messages or warnings, there were not many options. The most instantaneous methods were smoke signals and fire. When we say smoke signals many will inevitably think of Indians in westerns and movies, but the method was already used in places like China or Greece millennia ago. And it is still in use today (i.e. the electing of popes).
But there was a problem, smoke and fire signals could only transmit pre-arranged messages by transmitter and receiver (i.e. both must know in advance both the signals and their meaning). If an improvised message was needed to be sent, there was no way to do so, because the receiver would not be able to decipher it.
For the service should have been performed by signals previously determined upon, and as facts are indefinite, most of them defied communication by fire-signals. To take the case I just mentioned, it was possible for those who had agreed on this to convey information that a fleet had arrived at Oreus, Peparethus, or Chalcis, but when it came to some of the citizens having been guilty of treachery or a massacre having taken place in the town, or anything of the kind, things that often happen, but cannot all be foreseen — and it is chiefly unexpected occurrences which require instant consideration and help — all such matters defied communication by fire-signal. For it was quite impossible to have a preconcerted code for things which there was no means of foretelling (Polybius, Histories X-43,7)
We know Greeks had solved this problem thanks to the invention of Cleoxenus and Democleitus, of whom we hardly know nothing else that they were historians and lived in the III century B.C., Cleoxenus having written a lost History of the Persians. Polybius mentions them as inventors of a telegraphic communication system that relied on smoke or fire signals for transmitting letters from the Greek alphabet.
Polybius say that he himself had improved it and, although he does not say it explicitly, it is highly probable that he conceived such an improvement during the siege of Numancia, which he witnessed.
The most recent method, devised by Cleoxenus and Democleitus and perfected by myself, is quite definite and capable of dispatching with accuracy every kind of urgent messages, but in practice it requires care and exact attention. It is as follows: We take the alphabet and divide it into five parts, each consisting of five letters. There is one letter less in the last division, but this makes no practical difference. Each of the two parties who are about signal to each other must now get ready five tablets and write one division of the alphabet on each tablet (Polybius, Histories X-45,6)
The method consists in encoding letters of the alphabet with numerical coordinates of a grid. Each letter is therefore represented by two digits according to its position on the vertical and horizontal axes. Something really simple that anyone who has played Battleship will be familiar with. But at that time it was something new and possibly revolutionary.
The improvement made by the Greek historian around 134 B.C., which led to the system being known today as Polibian Square, focuses on regulating the use of torches to transmit letters.
These torches having been lowered the dispatcher of the message will now raise the first set of torches on the left side indicating which tablet is to be consulted, i.e. one torch if it is the first, two if it is the second, and so on. 12 Next he will raise the second set on the right on the same principle to indicate what letter of the tablet the receiver should write down (Polybius, Histories X-45,9)
In this way it was possible to transmit any message, no matter how improvised or urgent it might be, and not only pre-arranged and agreed upon warnings. That if, once its use was generalized, anyone could decipher the messages knowing the method, which in time would lead to the development of cryptography itself. But that’s another story. The important thing is that for the first time humans were able to transmit at a distance and in an immediate way any type of improvised message.
This device enables any news to be definitely conveyed. Many torches, of course, are required, as the signal for each letter is a double one. But if all is properly prepared for the purpose, what is required can be done whichever system we follow. Those engaged in the work must have had proper practice, so that when it comes to putting it in action they may communicate with each other without the possibility of a mistake (Polybius, Histories X-45,10)
So it is not unreasonable to think that in the Roman army there would be soldiers specialized in such tasks. In any case, the Polybius Square, combined with a method of encryption, would be widely used by all kinds of military and subversive organizations, including none other than the KGB.
Sources: Historias – Libro X (Polibio) / El gran diccionario histórico (Louis Moreri) / A History of Ancient Geography (Henry Fanshawe Tozer) / Darwin Among the Machines (George Dyson) / Implementation and Applications of DSL Technology (Philip Golden et al.) / Wikipedia.