Electro-Mechanical Cipher Machines

0 Conversations

What is an Electro-Mechanical Cipher Machine?

One option for producing a very secure cipher is producing a very long pseudorandom key and using that to encrypt the message. The first serious attempt to do this electronically was developed in the United States and used to encrypt telegraph communications.

The Vernam Cipher

Telegraph machines operated on a pulse code known as the Baudot system. Vernam worked out that if a tape of random characters was passed in a loop through the machine at the same time then a message could be encrypted automatically and securely. In principle this is essentially similar to the Vigenère system. Vernam discovered that managing a loop of tape of thousands of characters in length was difficult so he invented an alternative way of making a very long pseudorandom sequence.

Instead of using one tape he used two, the two tapes were of different lengths, usually one was a single character longer than the other, mathematically it is important that the two lengths are relatively prime. Because the plaintext is enciphered first with one, then the other, the pseudorandom sequence doesn't repeat until both tapes are realigned.

If a single tape of 200 characters was used then the system would repeat every 200 characters, if a tape of 100 characters and a tape of 99 characters were used instead then the repeat would be every 9,900 characters.

The Statistics of the Vernam Cipher

  • Alphabets: 26
  • Blocklength: 1
  • Keyspace: Over one million in some variants

The Enigma Cipher

The Enigma machine is undoubtedly the most famous of the electro-mechanical pseudorandom sequence cipher machines, it is not one of the most successful. The success of Enigma as a cipher can be easily judged by the simple fact that it was broken.

The Enigma cipher was originally a commercial venture and was offered to the world's businesses, embassies and military as a product for sale, it was not well received, however until the publication of Winston Churchill's memoirs of the First World War. In the book, Churchill recounted the success of British cryptanalysts in breaking the German naval codes of the time. The German military immediately began to look for alternatives so that they would not face the same problem in the future.

The Enigma was produced in a large number of variants and a description of them all is beyond the scope of this article but the principle of operation was fairly simple.

Essentially Enigma was an electric typewriter which lit lights corresponding to letters rather than print to paper. Between pressing a key on the keyboard and seeing the light appear above, the cryptology happened.

The core of the system was a unit containing three or four discs. The discs were made of an insulating material and had twenty-six contacts on each side, connected across the disc by wires. The connections were different for each disc so that on one disc the 'E' contact on the left might connect to the 'J' contact on the right, in another disc the connection might be 'A' to 'J'.

The discs were removable and could be inserted in any order, adding to the complexity of the system. The operator would know the disc order from a book of the settings for the day. The operator would then use the book to find out the starting positions for each of the wheels and rotate them until the correct letters were displayed at the top. Using this setting the operator would encrypt three characters of his choice and send the result of that as the first part of his message. The discs were then rotated until they showed those three selected characters and the message could be encrypted.

Each time a key was pressed the rightmost disc would turn one space. When a notch on the disc reached a certain point, the next disc would turn and so on for the third and fourth discs. The path through the discs would radically change with each change in disc position, producing a very good pseudorandom sequence.

At the far end of the discs was a fixed disc with contacts on only one side called the reflector. This would take the output from the leftmost contact and pass it back into the leftmost rotor at a different location. The path would then flow all the way back through the maze of wiring to come out at the right end. Though this could be seen to increase the security of the system, it led to a serious weakness. A letter could never be encrypted as itself.1

In order to rectify this problem and in order to add extra keyspace, a plugboard was added to the front of the machine. Wires could be connected according to the daily settings in the book and the wires had the effect of swapping letters over, in other words if 'E' and 'F' were connected on the plugboard then whenever the output from the machine would light the 'E' light, the 'F' light would be lit instead.

As if this were not enough, there were other complications to make the cryptanalyst's job harder, nonetheless the cipher was cracked owing to some brilliance, some operator sloppiness and a number of espionage successes and captures of cryptologic material.

Breaking Enigma was to prove a multinational effort, though it didn't start out that way. It is fair to suggest that before the war neither Britain nor France showed any real inclination to invest the time and effort necessary to cryptanalyse such a machine. Poland, sandwiched unhappily between Nazi Germany and the Soviet Union, a nation they had been to war with recently, had every reason to make strenuous efforts to read the German traffic.

A French espionage coup had landed French intelligence with an extremely important source inside Germany, known variously as 'HE' and 'Ashé' the agent sold the French detailed operational documents and day settings for Enigma. The French thanked him politely but didn't know what to do with his information. After a meeting with Polish intelligence officers at which British and French organisations promised to share any information about German intentions, the French passed the unwanted documents to Poland.

The documents were used in a spectacular fashion by Polish mathematicians. The team leader used the information to set hs men on the right track but never revealed to them the documents he held, he felt that they must be able to break the code without the documents since an ongoing supply of day keys couldn't be guaranteed.

Astoundingly they broke Enigma using a device called a bombe, basically a model of an enigma which could test rotor settings, a wonderful achievement, but just before the German assault on Poland began, the Germans changed Enigma, making it much harder to break.

Now the Poles would have to rely on the documents of daily settings, but ironically, as often happens in these situations, it was also at that time that the flow of documents from Germany came to an abrupt end. 'Ashe' had been caught.

With German soldiers advancing rapidly throughout Poland the Polish codebreakers escaped as best they could, they met with British and French counterparts and finally admitted their progress. It was an astonishing moment, neither Britain nor France had made any progress at all. The British attempt had been abandoned when the team-leader calculated that there were too many unknowns to attempt a mathematical solution, the additional unknown being the order of the letters on the outside of each rotor. When he was presented with evidence that the Poles had determined this order for each rotor he demanded to be told at once what the order was. His Polish couterpart looked confused and began to recite 'A, B, C, D, E....'

Enigma went through multiple revisions and each change bought a window of obscurity until the code was broken once again. Two things in particular were most important in enabling Enigma to be broken for the majority of the war. One was the astonishing heroism of ordinary soldiers and sailors, running into booby-trapped vessels, burning aircraft fuselages and sinking submarines to retrieve keys and other Enigma documents. Had they known how important their actions were to prove they would instantly defend their rash but vital bravery. But as each of them charged into danger none knew what the risk would gain.

The other factor that broke Enigma was Alan Turing. Turing was a brilliant mathematician whose unusual mind proved perfect for the mental gymnastics that is cryptanalysis. His greatest achievement during the war was the develoment of another kind of 'bombe' a totally different and far superior device to the Polish machine confusingly bearing the same name. Turing's bombes worked night and day breaking Enigma messages, his analysis of the cipher is still the standard reference work and his intuition avoided many red herrings.

Enigma Operating Procedures

There were a large number of variants of Enigma, some more secure than others. The toughest of them was the naval Enigma, codenamed Shark by the British.

These procedures are those used for Naval Enigma:

The operator would first set up the machine in accordance with the daily settings, wheels, wheel positions, and ring positions, plugboard connections and initial wheel setting.

The operator would then select a three-letter group (tri-gram), at random, from trigram book, for example LXZ. He would then encipher this on the Enigma with the wheels set to their initial settings, which might be ALC. The resulting three letter group, say QSD would be used as the wheel position setting, "message setting", for the individual message

The operator then turned the wheels to the message setting QSD and then enciphered his message.

The method for indicating the message settings to the receiving station was as follows:

In addition to the initial trigram LXZ, the operator picked out a second trigram at random, say BFA. These trigrams were then written down one above the other, after a random letter, selected by the operator was added to the beginning of one trigram and the end of the other. At this point, the two lines of letters would look something like this

C B F A

L X Z
B

Each vertical pair of letters in the group was then converted into the equivalent two letter group (bigram) using a bigram table held by each operator, thus the bigram for C/L would become R/E.

After each of the four sets of letters were converted, the two lines would look something like this

R V M K

E Y P W

The letters were then manipulated to appear in the following format:

R E V Y

M P K W

These groups were then transmitted, in clear, at the beginning and end of the enciphered message, the addressee would then, with the help of the same tables used by the transmitting operator, work out the message settings used in transmission, set his Enigma machine to the same wheel settings, type in the enciphered text and, because of the design of the machine, the plaintext would be displayed.

The Statistics of the Enigma Cipher

  • Alphabets: 25
  • Blocklength: 1
  • Keyspace: Up to 1050 in some variants

The Lorenz Cipher Machine

The German High Command during the Second World War needed a fast, reliable and unbreakable cipher for transmitting the highest priority and most secret messages between government departments and military headquarters. The obvious solution was to produce a Vernam machine, to encrypt telegraph messages.

Managing extremely long loops of paper tape was considered impractical and the risk of the tapes being damaged or weakening in damp conditions was severe. The Lorenz company was awarded a contract to produce the most powerful Pseudo-Random Number Generator (PRNG) in the world, this being theoretically able to act almost as securely as a one-time pad.

The Lorenz machine was designed to carry the most important messages of a nation at war and it needed to be very secure indeed. It worked on electro-mechanical principles, beginning with a starting position and rotating one or more of thirteen pinwheel-rotors as each character was encrypted. When British cryptanalysts started receiving more and more encrypted telegraphic messages they realised they were dealing with a new cipher machine and promptly gave it the codename Fish.

The design was elegant but subtly flawed, something the German operators and designers never noticed. The pseudo-random sequence actually had a partial repeat every 41 characters, permitting British Cryptanalysts to begin the arduous process of determining the mechanism and breaking the cipher.

Unfortunately one of the reasons the information carried by Lorenz was so important to the British was that it was current. This was the information upon which the German government and military commanders based their decisions. Sadly the process of breaking Lorenz took days, occasionaly weeks, and the information was usually hopelessly out of date by the time it could be distributed to the British intelligence community.

Clearly the process had to be accelerated. The method chosen was to remain secret for many years after the war but it stands as one of the most amazing technical achievements of the twentieth century. These quiet, unassuming, fellows designed and built the first electronic stored-program computer in the world, and then they built nine more of them and ran them in batches. The computer could be programmed to represent logically the physical complexity of the Lorenz machine, and it could break the world's most complex cipher in hours. It was called Colossus. One Colossus Mark I and nine Colossus Mark II machines were built, the Mark I later upgraded to Mark II. Each could process thousands of characters per second. In fact racing a Mark II Colossus against a Pentium 100Mhz desktop computer the Colossus is easily the winner. Of course there weren't any good business applications or games for Colossus, it had only one function, to break Lorenz.

Both the Enigma and Lorenz ciphers, the toughest axis systems by far, were broken at Bletchley Park, the wartime headquarters of the Governemnt Code and Cypher School. The GC&CS evolved after the war into GCHQ, Government Communications Headquarters. Two of the Colossus machines at Bletchley were moved to GCHQ Cheltenham at the end of the war.

The Statistics of the Lorenz Cipher

  • Alphabets: 26
  • Blocklength: 1
  • Keyspace: About 1.4x1018
1The reason for this weakness was actually a design decision, it meant that if the ciphertext was typed in then the plaintext would be output, the system was mathematically symmetrical.

Bookmark on your Personal Space


Conversations About This Entry

There are no Conversations for this Entry

Entry

A583959

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more