applets.

Spy Messages

← All apps

About Spy Messages

A cipher hides what a message says. These tricks hide something else: that there is a message at all. The Greek word for it is steganography, covered writing. A letter full of random letters gets read by every censor in the building; a dull letter about the weather goes through. Each tab is one way of hiding, and most show how it gets found.

GRILLE: an ordinary page of print and a card with holes cut in it. Lay the card on in the right place and the letters showing through the holes spell the hidden message; anywhere else they spell nothing. Drag the card about, or use the arrow keys. Pick another page, paste your own, or type a message and CUT A CARD: the page finds the letters in reading order, spread as evenly over the page as it can, and cuts a hole over each. A card cut for one page is useless on any other.

NULL CIPHER: a message hidden in the letters of an innocent one. Pick a cable and a way of reading it; the letters that way are marked in red. In YOUR OWN, type a message and the page writes a cable whose first (or second) letters spell it; click a word to swap it for another that fits.

INVISIBLE INK: a typed letter with a message written between the lines in an ink that dries clear. Lemon juice shows when warmed: press and hold over the paper to warm that spot over the candle, but hold too long and the paper scorches and takes the writing with it. A sympathetic stain needs its own developer, brushed on; heat does nothing to it. CENSOR'S STRIPES brushes developer across the sheet in stripes, as wartime censors did to test letters. Then try WRITE YOUR OWN.

IN A PICTURE: every colour in a digital photo is three numbers from 0 to 255, one each for red, green and blue. Change the last bit of each and no colour moves by more than 1 in 255: nobody can see that, but each colour number now carries one bit of a message. The photo opens carrying the whole of Conan Doyle's A Scandal in Bohemia, about 48,000 characters, in a third of its colour numbers. BIT PLANE shows one bit of every pixel: with R, G or B picked, that colour's bit as black (0) or white (1); with ALL, the three bits at once as one of eight colours (red where only the red bit is 1, yellow for red and green, white for all three, black for none). The lowest plane of an ordinary photo should look like fine noise. TEST IT runs the chi-squared attack on the picture. SEND AS JPEG squeezes it the way most websites and phones would, then tries to read it back. SAVE PNG keeps it intact; OPEN A PICTURE reads one of yours (it is never sent anywhere). Pictures up to 4 million pixels are read at full size, never resized; a picture with see-through parts is laid on white first, so only fully opaque pictures read back exactly.

IN PLAIN TEXT: INVISIBLE CHARACTERS hides a message in characters that take no space on screen, which often survive copying and pasting as plain text, depending on the program; TWO TYPEFACES is Francis Bacon's way, which needs the two styles of letter kept, on screen, in formatted text or in print; CHECK A TEXT shows hidden or odd characters in text you paste. Nothing you type or paste on this page is sent anywhere, stored or put in a link.

THE STORY

The Greek historian Herodotus tells of Histiaeus, held at the Persian court around 500 BC, who shaved the head of his most trusted slave, marked a message on his scalp, waited for the hair to grow back and sent him to Miletus with the words: shave my head and look. And of Demaratus, who warned Sparta of the coming Persian invasion by writing on the wood of a wax writing tablet and covering it with fresh wax, so the tablet seemed blank.

The Italian mathematician Girolamo Cardano described the card grille in 1550: write the secret through the holes, lift the card, then fill in an innocent letter around it. Cardinal Richelieu is often said to have used one; the story is told in many books, but it is hard to trace to a source from his time. Francis Bacon published his two-typeface cipher in 1623, in De Augmentis Scientiarum, saying he had thought of it as a young man in Paris. Each letter becomes five a's and b's, and a printer sets the a letters of an innocent text in one typeface and the b letters in another.

In the American War of Independence, George Washington's spies in New York, the Culper Ring, wrote between the lines of ordinary letters in a "sympathetic stain" made by the physician James Jay, John Jay's brother. It stayed invisible until brushed with a second liquid, its developer; Washington's letters to Jay call it "medicine", and supplies were always short. Lemon juice, milk and other kitchen inks show with heat instead, because they weaken the paper so the written lines scorch brown first.

The two First World War cables in the NULL CIPHER tab are commonly reproduced examples, retold in many books on codes as one message hidden two ways, the second as quoted in David Kahn's The Codebreakers. The form they sit on is a reconstruction: its layout is an illustration, not part of the record. Either way they say PERSHING SAILS FROM NY JUNE I (the I for a 1). General Pershing, sent to command the American army in France, actually sailed from New York in secret on 28 May 1917. Censors in both world wars knew the trick, so a cable that read oddly was likely to be held up or reworded. Wartime censors tested suspect letters for secret ink with heat, ultraviolet light and stripes of chemical developers brushed across the page.

In the Second World War German agents used microdots: a page photographed down to a dot about a millimetre across and stuck on a letter as a full stop. J. Edgar Hoover of the FBI called them "the enemy's masterpiece of espionage", the title of his article in Reader's Digest in April 1946. Knitting appears in many wartime stories, of patterns that hid messages and women who recorded passing trains in their stitches; the stories are hard to pin down, but the American Office of Censorship is reported to have stopped people posting knitting patterns abroad in case they hid codes.

On 2 May 1966 Jeremiah Denton, a US Navy pilot held prisoner in North Vietnam, was filmed for a propaganda interview by a Japanese television reporter. While he answered the questions he blinked T-O-R-T-U-R-E in Morse code, giving American intelligence direct confirmation that prisoners were being tortured. (Morse Code has the alphabet.)

Digital hiding works the same way with numbers. In 2010 the FBI's complaint against ten Russian agents in the United States, several of them living under assumed identities, said they hid encrypted text in pictures posted on public websites, using a program from Moscow. Invisible characters and tiny differences in spacing have been used to tell copies of a document apart, so a leaked copy says whose it was. And some colour printers hide a machine's serial number in faint yellow dots on every page: Printer Dots is that cousin of this page, steganography by a machine.

HOW IT WORKS

The grille: the page is set out line by line, and the holes are placed over the message's letters in reading order. To spread them evenly the page tries every possible choice at once (a short dynamic program): letter number k of n should sit near k/n of the way through the page, and it picks the choice with the smallest total squared distance from those places. Your own page and message stay in this tab.

The ink: the sheet keeps a temperature for each small patch. Holding the pointer over the paper warms the patches near it; they cool when it moves away. A patch that has been hot enough for long enough browns the lemon juice in it for good, and one that gets too hot scorches. The numbers are made up to feel right, not measured.

The picture: the message is turned into bytes (UTF-8, so any language works), a 32-bit length goes in front, and each bit replaces the lowest bit of one colour number: red, green, blue, then the next pixel. About half the colour numbers already had the right bit, so only about half change, each by 1. Scramble it first mixes the bytes with a stream of random numbers from the key, as real hiding programs encrypt before hiding; without it, English text leaves a pattern (the top bit of every plain English letter is 0), which the bit plane shows as stripes. Spread it with a key puts the bits in a shuffled order made from the key, instead of straight through. The key number never goes in a link.

The test is Andreas Westfeld and Andreas Pfitzmann's chi-squared attack of 1999. In an ordinary photo, pairs of neighbouring values such as 100 and 101 are rarely equally common. Overwriting the lowest bit with coin flips makes each pair even, because a 100 and a 101 differ only in that bit. The test counts the even values in each pair and asks how well they fit "exactly half": it reads the picture from the start, the way a simple hider writes, and plots the p-value of that even-pairs test, a pair-balance score, at each share of the picture read. It is not the chance that a message is there. Near 1 means the pairs are as even as replaced bits would make them; "Caught" on the page means the evidence is consistent with replaced bits, not proof. It catches scrambled messages written straight in, and shows how much of the picture they fill. The first few points rest on few pixels and wander, so the page only says "Caught" when the first two points (the first 1% and 2% of the picture) agree: a message filling less than about 2% of the picture can slip past that rule. Some clean pictures, especially ones with large flat or heavily processed areas, can also give false alarms. It misses a message that isn't scrambled (its bits aren't coin flips) and a small message spread at random; later tests catch more, and better hiding programs change bits in ways that keep the pairs uneven. Pairs that hold fewer than 10 colour numbers between them are left out, the usual rule of thumb for this kind of test.

JPEG keeps a picture small by cutting it into 8 by 8 blocks, turning each block into a sum of patterns and storing those patterns roughly. Decoded again, most colour numbers come out a little different, so the lowest bits are scrambled: SEND AS JPEG measures how many hidden bits came back different (for this photo at quality 90, a little over a quarter in Chrome), and one wrong bit in the length at the front is enough to lose the lot. That is why hidden data travels in PNG files, or is hidden in the JPEG's own numbers instead.

Invisible characters: each byte of the message becomes eight characters, a zero width space (U+200B) for 0 and a zero width non-joiner (U+200C) for 1, put after the first word. In English and other Latin-script text they change nothing you can see; in Arabic or Persian, the non-joiner changes how letters join. CHECK A TEXT lists every Unicode format character (the invisible kind, such as zero-width and direction marks), Hangul fillers and variation selectors, the unusual spaces it knows, and a list of common Cyrillic and Greek letters that look like Latin ones (another way to mark copies), and reads any message hidden this page's way. Other look-alikes and tricks can slip past it. Bacon's cipher uses his 24-letter alphabet (I and J share a code, as do U and V): A is aaaaa, B is aaaab and so on, five letters of the cover text for each letter of the secret. Fonts don't survive copying as plain text, so this one only works where the two styles are kept: on the screen, in formatted text or in print.

THE TEXTS

The Bible page is Ecclesiastes 3:1-8 in the King James Version. In the United Kingdom, Crown rights apply to the King James Version. Extracts from the Authorized Version of the Bible (The King James Bible), the rights in which are vested in the Crown, are reproduced by permission of the Crown's patentee, Cambridge University Press. A Scandal in Bohemia (1891) is out of copyright in the UK; the text is from Project Gutenberg. The cables are as commonly reproduced. The letter, the memo and the messages are this page's own.

WHAT IT LEAVES OUT

The invisible ink is a picture of the idea, not chemistry. The hiding programs used by real agents encrypt properly and hide in cleverer ways than one bit a colour; the scrambling here is a simple stream of random numbers, not real encryption. The photo was made for this page.

FURTHER WATCHING AND READING