Code
Under construction
Welcome to my secret pages!
Steganography
The word steganography is used to denote hiding the existence of a message. It is formed from the greek steganos (covered) and graphein (writing).
In ancient China messages were written on fine silk that was squeezed into a small ball and waxed, then swallowed.
Invisible inks, that can only be seen when heated, were known as early as the first century AD. Urine can be used as an invisible ink (but preferably not on food!), and can be revealed by heating.
Herodotus wrote that the in the 5th century exiled Greek Demaratus warned Greece that Xerxes was planning to attack by writing a message on the wood of some folding wax tablets, then covering the message over with wax.
Herodotus also told us that Histaiaeus wrote a message on the shaved head of a messenger. Once the hair had regrown, the messenger could travel freely as he was not carrying anything suspicious. He shaved his head at the other end to reveal the message.
Giovanni Porta of Italy in the 15th century hid a message in a hard boiled egg by writing on the shell with a special ink that passed through the shell and left the message on the surface of the egg inside.
During the second world war microdots were used to disguise messages as full stops on ordinary-looking correspondence.
These days messages are hidden in pictures distributed over the internet, in full view. The message is encoded by manipulating the code of the images, changing colours of individual pixels in a way that is not visible to the naked eye.
Once the existence of the message is discovered, however, its meaning is revealed. Steganography is therefore often combined with cryptography.
Cryptography
Cryptography comes from the greek word kryptos (hidden). It means to hide the meaning of a message, rather than its existence. The sender agrees in advance with the recipient how the message is to be scrambled, or encrypted, and the recipient then unscrambles when the message is received. Even if the enemy intercepts the message, they cannot automatically understand it.
There are two kinds of cryptography; substitution and transposition.
Substitution
There are two levels of substitution. Code replaces a word or phrase with a word, number or symbol, while cipher is produced by replacing individual letters of a word or phrase.
The Kama-Sutra in the 4th century AD advised women to learn the art of secret writing to hide details of their liaisons. Mary Queen of Scots wrote correspondence in cipher. This was intercepted by Walsingham, Queen Elizabeth's Principal Secretary and Spymaster. It was decrypted and provided evidence against Mary which led to her execution. The moral of this tale is that you should not rely completely on cryptography
One form of substitution is to randomly pair letters of the alphabet, and each time one appears in the message, replace it with it's pair. For example:
A and T, B and U, C and M, E and Z, F and O, G and X, H and K, I and Y, J and V, L and Q, N and S, P and R, W and D
Using this code, WHEN SHALL WE THREE MEET AGAIN IN THUNDER LIGHTNING OR IN RAIN would be replaced by DKZS NHTQQ DZ AKPZZ CZZA TXTYS YS AKBSWZP QYXKASYSX FP YS PTYS
Julius Caesar used one form of substitution cipher where he simply replaced Roman letters with Greek letters.
Caesar Shift
Caesar also replaced each letter by the letter 3 places further down in the alphabet. This cipher is called the Caesar shift cipher after him.
| Plain alphabet: | abcdefghijklmnopqrstuvwxyz |
| Cipher alphabet: | DEFGHIJKLMNOPQRSTUVWXYZABC |
For example,
| Plain alphabet: | when shall we three meet again in thunder lightning or in rain |
| Cipher alphabet: | ZKHQ VKDOO ZH WKUHH PHHW DJDLQ LQ WJXQGHU OLJKWQLQJ RU LQ UDLQ |
The total number of possible ciphers is over 400,000,000,000,000,000,000,000,000. Each distinct cipher comprises an algorithm (e.g. replace one letter from athe plain alphabet by a letter in the cipher alphabet), and a key (e.g. shift 3). Many algorithms are well known, so it is important to keep the key a closely guarded secret between the sender and the recipient, and that there must be a large number of possible keys (the Caesar shift has only 25 possibilities).
Keyphrases
One way of keeping the key safe is to commit it to memory. This is made easier by starting it off with a keyword. Say, for example, I chose the keyword WILLIAM SHAKESPEARE. First I would strip off duplicate letters, spaces, etc. This would leave me with WILAMSHKEPR. I would then add the remainder of the alphabet, starting where the keyword ended (the next unused letter after R is T), to produce the following cipher alphabet:
| Plain alphabet: | abcdefghijklmnopqrstuvwxyz |
| Cipher alphabet: | WILAMSHKEPRTUVXYZBCDFGJNOQ |
Atbash
The Hebrews used a substition cipher called atbash in the Old Testament, replacing the first letter of their alphabet by the last, the second by the second last, and so on. The equivalent in English would be as follows:
| Plain alphabet: | abcdefghijklmnopqrstuvwxyz |
| Cipher alphabet: | ZYXWVUTSRQPONMLKJIHGFEDCBA |
Transposition
Transposition means re-arranging the letters of a message, as with an anagram. In theory, the longer the message, the more ways of arranging the letters there are, so the harder it is for the enemy to decode the message. For a 2-letter message, there would be two ways of arranging those letters, for example ok or ko. Mathematically the number of choices is 2 x 1 = 2, as there is a choice of 2 for the first position, then for each of those two choices, there is a choice of only one for the second position. For a 3-letter message there is a choice of three for the first letter, then a choice of two for the second letter, and a choice of only one for the third, giving 3 x 2 x 1 = 6 choices. For example, abc, acb, bac, bca, cab, cba. Similarly, for a message of 4 letters there are 4 x 3 x 2 x 1 = 16 ways of arranging them (abcd, abdc, acbd, acdb, adbc, adcb, bacd, badc, bcad, bcda, bdac, bdca, cabd, cadb, cbad, cbda, cdab, cdba, dabc, dacb, dbac, dbca, dcab, dcba). However, if the message is scrambled at random, not only can the enemy not unscramble it, but nor can the intended recipient! It is therefore necessary to agree a system in advance with the recipient. There are many systems, for example:
Scytale
The Spartans used a wooden staff called a scytale for transcription in the 5th century BC. A leather strip (such as a belt) was wrapped spirally around the scytale, the message was written in lines across the strips. The leather strip was unwound and taken by the messenger to the recipient, who wrapped the strip around his or her own scytale, which had to have the same diameter (agreed in advance) to reveal the message.
Rail fence transposition
In 2-line rail fence transposition, alternate letters of the message are written on different lines, then the second line is tacked on to the first, as in the following example:
Message to be transposed: WHEN SHALL WE THREE MEET AGAIN IN THUNDER LIGHTNING OR IN RAIN
W E S A L E H E M E A A N N H N E L G T I G R N A N
H N H L W T R E E T G I I T U D R I H N N O I R I
Transposed message: WESALEHEMEAANNHNELGTIGRNANHNHLWTREETGIITUDRIHNNOIRI
Similarly, three lines are used for 3-line rail fence transposition:
W N A W H E E G N T N R G N G I A
H S L E R M T A I H D L H I O N I
E H L T E E A I N U E I T N R R N
Transposed message: WNAWHEEGNTNRGNGIAHSLERMTAIHDLHIONIEHLTEEAINUEITNRRN
Adjacent letter transposition
In this case, adjacent letters of the message are transposed.
HWNEHSLAWLTERHEEEMTEGAIAINTNUHDNREILHGNTNIOGIRRNIAN
Carry on coding!
If you enjoy these kinds of codes, try One Across's cryptograms.
Dkm vmnd ywhm ec lboydwvwtocec axd kdut.
