Tool of Historic and Modern Espionage: Steganography

Taha Jamal
4 min readAug 11, 2023

--

Throughout history, we have been trying to find ways to hide information, but it has rarely been adequate in practice. This time I came across a rather interesting form of hiding data: Steganography. It can be understood as the practice of concealing data within another message or physical object. The word originates from the Greek word ‘steganographia’ which combines the words steganós, meaning “covered or concealed” and graphia, meaning “writing”. The advantage of using steganography is that it does not attract attention to the message.

One of the earliest examples of steganography can be found in Histories, where Herodotus (486–425 BC) tells how around 440 BC Histiæus shaved the head of his most trusted slave and tattooed it with a message that disappeared after the hair had regrown and was sent to Aristogoras in order to instigate a revolt against the Persians. Herodotus also wrote about how Demeratus, a Greek at the Persian court, warned Sparta of an imminent invasion by Xerxes. He removed the wax from a writing tablet, wrote the message on the wood underneath, and then covered it again with wax, making it seem like an empty wax tablet.

Aeneas Tacticus, one of the earliest Greek writers on the art of war, is credited with inventing a large number of techniques, including letters hidden in messengers’ soles or women’s ear-rings, text written on wood tablets and then whitewashed, notes carried by pigeons, and many more.

The first recorded use of the term steganography was in 1499 by Johannes Trithemuis in his work Steganographia, which was a book on cryptography and steganography disguised as a book on magic.

Bishop John Wilkins, a master at Trinity College, Cambridge, later devised the concept of coding messages in music and stringing knots to invisible inks.

Gaspar Schott’s mapping of alphabets to numbers

Gaspar Schott mapped the letters of the alphabet on musical notes to hide data. This “music” would never be pleasing to listen to if played, and to the untrained eye it would appear to be normal sheets of music when, in fact, it was an encoded message.

Microdots

Moving forward, during World War II, the Germans used microdots, a tiny miniaturized photograph, to communicate with agents, along with letters written using invisible ink and many other clever techniques.

Nowadays, these techniques seem moot, and we make use of digital objects to hide data. From a digital perspective, steganography can be divided into five main types:

  1. Text steganography involves hiding information in text files by employing methods such as changing the format of existing text, using context-free grammar to generate readable texts, or generating random character sequences.
  2. Video steganography is used to conceal data in digital video formats. It allows large amounts of data to be hidden within a moving stream of images and sounds.
  3. Network steganography is the technique of embedding information within network control protocols used in data transmission, such as TCP, UDP, ICMP, etc.
  4. Audio steganography involves embedding messages into an audio signal, which alters the binary signal of the audio file.
  5. Image steganography is used to hide information in image files. This is one of the most widely used forms of steganography, as it is easy to use and usually does not raise suspicion.

I came across image steganography through Computerphile, and going deeper, I found it really interesting. So I went deeper into the most basic form of steganography, which is Least Significant Bit steganography, which basically converts the image file into a binary format and changes the LSB of every pixel into a sequence of binary strings. To extract the message, the LSBs of every pixel can be found and converted to strings.

That was the gist, and now we shall go into further depth about it.

RGBA Channels

Every pixel in an image consists of 4 channels that are red, blue, green, and alpha, and to implement LSB steganography, the first step would be to convert the image into an array of these values. After obtaining the array, convert the message to be encoded into a binary string.

Then iterate through the RGBA channels and change the LSB of every value to the corresponding binary string of the message until the message is completed.

Below is the my implementation of it using Python and OpenCV library.

In order to decode the image, convert the image into an array of the 4 channels, extract the LSB of every channel, and create a binary string with it. Group 8–8 characters of the string to convert it into the message.

This technique can only be done using images with non-lossy compression and therefore does not support the JPEG image format.

And if you want to play around with images and send hidden messages to your friends, try out my application.

--

--

No responses yet