Fourth edition of the N&O column / Spooks newsletter

(Date: Tue, 28 Jul 1998 05:30:15 GMT)

Morse Stations | XPH | Voice stations | Enigma Message | Crypto Codes | Logs
Index | NS NL Home


Crypto Codes

by Torbjorn Andersson

Table of contents

Introduction

Codes are a special kind of cryptosystem, closely related to substitution ciphers. Whereas in a cipher, the individual letters -or sometimes groups of letters of a fixed length- are substituted for other cryptosymbols, the codesystems operate on whole words and/or phrases, substituting these for codegroups. Usually these codegroups are of a fixed lenght and entirely made up of letters only, or figures only.

Codesystems require the use of codebooks, or -in the case of a very small code- codecharts, listing the cleartext words and phrases together with the allotted codegroups. Since there exists quite a few words in any language, all words can't be listed in an average codebook, so commonly there also are found codegroups representing the letters of the alphabet, syllables, numbers, punctuation marks, grammatical terms and so on, in the book.

Ordered codes

In an ordered code, the cleartext entries are listed alphabetically and the codegroups are allotted to these entries in numerical order - in case the codegroups consists of figures - or in alphabetical order - in case the codegroups consists of letters. A small sample part of the beginning of one such code might look something like this:

Cleartext Codegroup Cleartext Codegroup
A 00001 address 00051
-ab- 00002 addressee 00052
abandon 00003 adjacent 00053
abide 00004 adjust 00054
able 00005 adjutant 00055
... ... ... ...

Both encoding and decoding are easily done with the same book, since both cleartext and codegroups follow in their normal order. Unfortunately this also greatly helps the enemy trying to break the code, so to counter this unordered codes was invented.

Unordered codes

In an unordered code, the codegroups are allotted to the cleartext in random fashion. If the code is a big one (i.e. not a small chart), one needs two books or lists. In one the cleartext is listed in alphabetic order together with the codegroups in their mixed order. In the other the codegroups are listed in order with the cleartext in mixed order.

A small sample will make things clearer:

Encoding section Decoding section


Cleartext Codegroup Codegroup Cleartext
... ... ... ...
Stop 7404 3729 Strong
Stopped 4017 3730 A
Storm 2809 3731 Was
Strength 3318 3732 Does not
Strike 5056 3733 Will be
Strong 3729 3734 And
Succeed 0047 3735 Unit
Success 6395 3736 Enemy
... ... ... ...

Unordered codes can pose a difficult problem for the enemy cryptanalyst, especially if the intercepted material is small. The problem facing the legitimate users is that the codebook usually see heavy use - thus providing the enemy with a lot of traffic, since it is no small thing replacing the code with a new edition. The countermeasure to this, is to use superencipherment.

Superencipherment

Superencipherment of a code can be achieved in a number of way and service to hide the actual codegroups from the enemy cryptanalyst. The most common way to do this if the codegroups consists of figures, is to use an additive.

The additive is a - usually very long - series of figures listed as groups in a table or book of its own. The user starts somewhere in this series, and allots a group from the additive to each group of his coded message, and adds them together (almost as in Gronsfeld's cipher) modulo 10, the sums being the cryptogram to be sent. The receiver, which must have the same additive series and knowledge of where the sender started to pick out groups, subtracts these modulo 10 from the received cryptogram, to get the naked codetext.

Modulo 10 addition/subtraction may puzzle some of you reading this, so here is a quick explanation: When adding two single numbers, modulo 10, one simply only keep the last figure of the sum, if the sum is greater than nine, and forget everything you learned in school about carry. When subtracting modulo 10, you automatically add 10 to the first number if the result otherwise would be negative. (N.B. This is the practical explanation, which probably won't please the mathematicians out there, but they hardly need modulo arithmetic explained, so I hope they skip this part.)

I'll give an example of the use of the additive superencipherment method using this additive key:

81855 06392 93111 72993 95106 30217 25634 33084 01669 17442 95745 76799 13525 85433 66391 63054 24755 51069 06037 50362 10815 30580 71285 74122 53029 05471 80545 55717 85607 56281

The basic code is ordered and the text Enemy force moving east towards your sector is first coded like this:

enemy force move -ing east towards your sector
25348 31800 55362 43915 25724 94039 99151 78673

Starting with the first group of the additive and proceeding from left to right when reading the rest of the groups off, and then adding them modulo 10 to the above code text will give the following result:

enemy force move -ing east towards your sector
25348 31800 55362 43915 25724 94039 99151 78673
81855 06392 93111 72993 95106 30217 25634 33084
+ + + + + + + +
06193 37192 48473 15808 10820 24246 14785 01657

Together with the final cryptogram in the last row, it is necessary to also communicate where in the additive to start. This information is usually hidden in the cryptogram as a special group.

Another superencipherment system sometimes used, involves a substitution chart. In a German WWI-code using an ordered code with three-figure codegroups, the first two digits of every such group was superenciphered with a 10 by 10-cells chart, called Geheimklappe ("Secret flap"). Different charts were used by different divisions, and they also changed from time to time. One such Geheimklappe looked like this:

Encoding Decoding
0123456789 0123456789
0 2460735625 0 8216704913
3805858492 7260334996
1 2735270460 1 4298766934
0739102038 8014685731
2 1406447724 2 1120578540
1919719422 0480210698
3 3731730586 3 3531709773
2698509105 5402553792
4 6148057612 4 1224689202
1931663208 7592665411
5 8528382955 5 5306854501
5048147057 1793285963
6 0995614818 6 0441038862
3163864957 2078798943
7 9270931393 7 1784233102
7514544738 5216741146
8 2759184066 8 3498559656
6242335067 8365500937
9 8193948190 9 5687976799
6286962747 7138842024

When encrypting, the first figure of a codegroup is used as a row-index to the leftmost table, and the second is used as a column-index. These two figures are substituted for the ones found at the intersection in the encoding table, and the third figure of the original codegroup is appended as it is. To decode a received codegroup, one uses the right-most table in the same way, since it is the inverse of the encoding table.

The codegroup 153 meaning Gegner geht zurück (=Enemy is retreating) will be superenciphered as 703 using the above keychart.

A similar superencipherment system was used by the Soviet Baltic Navy during World War II. The Soviet codegroups were four figures long and these were split up into pairs and then superenciphered with a chart and recombined into four-figure groups prior to transmission. The Soviet Baltic Navy four-figure-code was successfully attacked and read by the Swedish signal intelligence organization during WWII, probably due to the fact that the basic codebook was ordered and saw heavy use.

Code charts

In military situations small code charts are often used as low-level tactical cryptosystem, e.g. complete words are substituted by codes, or if the vocabulary that has to be used is too large, a syllabary square can be used. There are - of course - many possible constructions, but one sometimes found in cryptographic literature looks like this:

1 2 3 4 5 6 7 8 9 0

1 A 1 AL AN AND AR ARE AS AT ATE
2 ATI B 2 BE C 3 CA CE CO COM
3 D 4 DA DE E 5 EA ED EN ENT
4 ER ERE ERS ES EST F 6 G 7 H
5 8 HAS HE I 9 IN ING ION IS IT
6 IVE J 0 K L LA LE M ME N
7 ND NE NT O OF ON OR OU P Q
8 R RA RE RED RES RI RO S SE SH
9 ST STO T TE TED TER TH THE THI THR
0 TI TO U V VE W WE X Y Z

Normally, a two-figure system will double the length of the text (since two figures have to be used to encrypt every individual letter of the plaintext), but in a syllabary system - if it is carefully constructed, like the above one - the resulting cryptogram is in most cases shorter. In the above chart clusters of up to three letters will be encrypted by single two-figure codegroups, and if we encrypt the sample text ''Train with ammunition has arrived'',it will look like this:

t r i w i h a m m u n i io has ar ri ve d
a n t t n
9 8 5 0 5 4 1 6 6 0 6 5 58 52 16 86 05 31
3 2 6 6 0 0 1 8 8 3 0 0

Teletype

Growing use of the telegraph caused several automatic transmission systems to be invented in the late 19th century. One such system was invented by the Frenchman E. Baudot in 1874. His system - still in use today - uses two radio frequencies when operating on shortwave to represent two elements, usually called zero and one nowadays, which, when combined into groups of five, gives 32 combinations which are used in the following way to represent letters, figures, punctuation and control codes:

combination letter figure
11000 A -
10011 B ?
01110 C :
10010 D who are you?
10000 E 3
10110 F ÂŽ (national use)
01011 G ÂŽ (national use)
00101 H ™ (national use)
01100 I 8
11010 J bell
11110 K (
01001 L )
00111 M .
00110 N ,
00011 O 9
01101 P 0
11101 Q 1
01010 R 4
10100 S '
00001 T 5
11100 U 7
01111 V =
11001 W 2
10111 X /
10101 Y 6
10001 Z +
00010 carriage return
01000 line feed
11111 letter shift
11011 figure shift
00100 space
00000 unperforated tape

Since 32 combinations isn't enough to represent both letters and figures, two shifts are used. When switching between these shifts the combinations letter shift and figure shift are used. (The combinations F, G and H on the figure shift are not used in international traffic, but are reserved for national use. The letters given above show how these combinations are used for national Swedish teletype traffic.)

It is not assured your computer can correctly display these.

Teletype cryptosystems

The zeros and ones of the teletype code lends themselves well to encryption and several systems for encrypting teletype traffic have been invented. A few will be described below.

U.S. WWI system

During WWI, heavy military traffic between France and the U.S. caused the American Signal Corps to conduct a series of experiments aimed at automatically encrypting teletype transmissions since it was feared that the enemy might be in a position to intercept messages passing through the trans-Atlantic cables. Together with engineers from the American Telephone and Telegraph Company a machine was constructed, which was able to automatically encrypt or decrypt the 32 teletype symbols. The machine used two loops of tape containing arbitrary teletype symbols as key. One keytape contained 999 symbols, and the other 1000. For every teletype symbol to be encrypted, the two key- tapes stepped forward one step. At two reading positions - one for each keytape - the five bits of the current baudotsymbols of each tape were combined to form a new symbol of five bits in the following way:

Two of the same symbols, two zeros or two ones, combined to yield a one; whereas, two different symbols, a one and a zero, combined to yield a zero. Thus, if the first keytape had the baudotsymbol representing the letter A, and the second keytape had the symbol representing Z, these would combine like this:

tape 1 - "A": 1 1 0 0 0
tape 2 - "Z": 1 0 0 0 1

new "F": 1 0 1 1 0

The new symbol - F, in this case - were likewise combined with the symbol representing the cleartext - or cryptotext, since the operation is reciprocal - to form the cryptosymbol.

Originally, the AT&T engineers wanted to use only one keytape, which should be destroyed as it was used. This system is known today as a one-time-tape (more commonly: one-time-pad) and is absolutely impossible in theory to break when used correctly. The military saw the immense logistic problem of manufacturing and distributing such tapes, and therefore the less secure method using two keytape loops came to be the one used.

See also Newsletter 5.

Morse Stations | XPH | Voice stations | Enigma Message | Crypto Codes | Logs
Index | NS NL Home

---