logo elektroda
logo elektroda
X
logo elektroda

How the Enigma electromechanical encryption machine worked – a description for electronics engineers

TechEkspert  14 1578 Cool? (+14)

TL;DR

  • The Enigma electromechanical cipher machine is explained as a rotor-based WWII encryption system for electronics engineers.
  • A keystroke travels through the plugboard, three stepping rotors, a reflector, then back through the rotors to light the ciphertext letter.
  • A three-rotor setup yields 26³ = 17,576 positions, and choosing and ordering 3 rotors from 5 raises the search to over a million combinations.
  • The plugboard dominates the key space, adding 150,738,274,937,250 combinations when 10 wires swap 20 letters.
  • Cracking succeeded through mathematical models, known plaintext, repeated message keys, and weak operator habits, not brute force alone.
AI summary based on the discussion. May contain errors.
Do have a look at this article if you’d like to find out how the German encryption machine worked Enigma or if you’d like to contribute to the content of this article with your comments. The Enigma can be described as a hardware-based, electromechanical cipher machine, which was also used during the Second World War. The operator would type the plaintext on the keyboard shown in the photograph below (the lower part of the Enigma, which resembles a typewriter). For each successive letter, the Enigma assigned a ciphertext letter by energising the light bulb beneath the window displaying the letter symbol (above the keyboard). During encryption, the operator would enter a letter on the keyboard and read the corresponding illuminated letter in the fields above the keyboard. Decryption involved typing the ciphertext on the keyboard, whilst the subsequent letters of the plaintext were illuminated by the bulbs. The sender’s and recipient’s Enigma machines had to be configured in exactly the same way (have the same initial state) for the ciphertext to be successfully converted into plaintext.

The design of the Enigma was developed over the years; in this article, we will use the version with three rotors and a cable connector as an example. In the ABW archives, you will find photographs of other cipher machines and the original Enigma I with three rotors.

Let’s try a thought experiment: would a brute-force attack on the Enigma be possible if we could travel back in time and take with us, for example, a Raspberry Pi 5?

Let’s look at a replica of the Enigma: at the top, three rotors and windows showing the initial configuration; below, illuminated letters beneath which the Enigma would activate the corresponding light bulb; at the bottom, a keyboard for entering letters, and at the very bottom, a cable switch.


A replica of the Enigma with three rotors.


Above the illuminated letters, three rotors are visible; each rotor was marked with 26 letters and could be set to one of 26 positions. The rotors played a very important role in the Enigma’s design. The contacts on the sides of the rotors were not connected ‘directly’; the positions of successive letters were shifted to different positions on the other side of the rotor, thereby substituting one letter for another. On one side of the rotor there are flat contacts and on the other spring-loaded pins; this ensures the flow of current through the connections formed between the rotors.


Enigma rotor, source: Wikipedia, author: Bob Lord, GNU



The Enigma rotor, source: Wikipedia, author: Bob Lord, GNU


The machine operated as follows:

START

letter key:
-press a key with a letter, e.g. ‘A’; an electrical signal is sent to the contact corresponding to the letter ‘A’ and is transmitted to the right-hand rotor

rotors:
-the right-hand rotor, like the others, has been set to the position we have chosen; furthermore, in this rotor, the order of connections between the contacts on the right does not correspond one-to-one with the order of connections to the contacts on the left
-Depending on the rotor’s position and internal connections, the signal from contact ‘A’ on the right-hand side of the right-hand rotor is routed to a contact in a position corresponding to a different letter, e.g. ‘B’ on the left-hand side of the rotor
- the signal from the ‘B’ position is routed to the central rotor and, depending on its position (and internal connections), is routed to a position associated with a different letter, e.g. ‘J’
- the signal from the ‘J’ position is routed to the left rotor and, depending on its position (and internal connections), is routed to a position associated with another letter, e.g. ‘Z’

reflector:
-the signal is sent to the so-called reflector, which redirects the signal to the position of another letter; for example, a signal arrives from the ‘Z’ position and is redirected via the ‘T’ position back to the left rotor

reverse passage through the rotors:
-the signal from the stationary reflector is directed to the rotors in reverse order: left-centre-right; for example, a signal from the ‘T’ position on the reflector appears at the ‘F’ position on the right-hand contacts of the right-hand rotor.

supplying power to the relevant bulb:
- the signal from position ‘F’ is sent to the bulb illuminating the letter ‘F’ (the input signal from the letter “A” does not activate the backlight for that letter, as pressing the key disconnects the bulb circuit for the input letter)

cable connector:
- on the front of the Enigma there is a switch which additionally swaps letters; for simplicity’s sake, we are analysing the case where no swap wires have been inserted; if, for example, a swap wire between ‘F’ and ‘T’ had been inserted, the result would be ‘T’.

The signal path was as follows:
letter from the keyboard → cable connector → letter position on the fixed contact → rotors →reflector → rotors in the opposite direction → fixed contact corresponding to the letter → cable connector → letter backlight

END


Cable connector at the front of the Enigma replica


What have we got?
With the machine set to specific configurations, the letter ‘A’ has been replaced by ‘F’; this looks like a simple monoalphabetic substitution cipher, but… this is not the case; the rotors rotate as each successive letter is entered, so each subsequent letter is substituted based on different relative positions of the rotors. We end up with a polyalphabetic cipher.

To put it simply, the rotors rotate in a similar way to an analogue odometer or the counter in an induction electricity meter. After a full rotation of the right-hand rotor, the centre rotor moves one position. After the centre rotor has completed a full rotation, the left rotor rotates by one position.. I am disregarding here the occasional double rotor jump and the rotor shift moments that differ from those in mechanical counters (the transition from 9 to 0), as well as the subsequent complications introduced by the Enigma’s designers. It is important to bear in mind the initial configuration of the rotor positions and the letter-swapping switch; this initial setting constitutes the key used by the machine. Each subsequent letter entered changes the rotor settings and, consequently, alters the way in which the letter typed on the keyboard is converted into the letter highlighted above.

The letter-swapping switch is used twice:
- it swaps the letter coming from the keyboard
- it swaps the letter coming from the rotors

The state of the letter-swapping switch does not change (unlike the state of the rotors) whilst subsequent letters are being entered.

The encryption and decryption procedures are the same. The Enigma always substitutes the entered letter with another.

The selection of rotors and their order is also part of the cipher key

We selected three rotors from a set of five, each of which had different internal connections that scrambled the letters.
The order in which the rotors are arranged in the Enigma is also part of the key (the machine’s initial setting)

To summarise, the initial state consists of:
- the selection of rotors
- the order in which the selected rotors are placed
- the initial position of the rotors
- the wires connected in the letter-swapping switchboard

How was the Enigma improved?
-Over time, a larger set of rotors was introduced.
-A fourth rotor, which remained stationary during encryption and had an adjustable initial position, was introduced (thinner reflectors were used, making it possible to accommodate the fourth rotor)
-Various versions of reflectors were introduced (different letter pair patterns)
-A reflector with configurable letter pairs was introduced
-A 40-position switch was introduced to replace the cable switch wiring
-Rotors with rings were introduced; setting these to one of 26 positions modified the rotational torque of the rotors and shifted the rotor wiring relative to the letter markers

A brute-force attack on the Enigma using a modern computer
Let’s imagine we’re travelling back in time and taking a Raspberry Pi 5, a smartphone or simply a modern laptop with us. The initial configuration consists of 3 rotors, each with 26 characters, giving 26×26×26. Three nested loops in Python plus an evaluation function, and we get the result faster than it would take to sink a U-boat :) as 26³ gives us a mere 17,576 combinations. After a moment, we realise that we also need to select 3 rotors from 5 and arrange them in any order – that is, 60 possible combinations. This gives us 60 × 26³, which amounts to over a million combinations, but it still takes a modern computer less time to calculate this than it would to shoot down a Messerschmitt ;)
Of course, we are greatly simplifying the estimate, but this illustrates the scale of the problem’s complexity. Simply testing all possible rotor settings would be very easy for a modern computer. The problem remains identifying which of the decrypted results or rotor settings is correct.

That leaves us with the switch.
We’ll take the case where 10 wires were used, covering 20 letters; 6 letters remain unmodified. So we select 10 letters to be swapped and, for each one, choose the letter we’ll swap it for. For example, by connecting F to T with a wire, we swap those two letters. And here’s the surprise: this inconspicuous (indeed, rather hopeless-looking) switch on the front of the Enigma adds over 150 quadrillion (150,738,274,937,250) combinations!

A brute-force attack doesn’t make much sense… but a fast computer in the hands of cryptographers cracking the Enigma code would have significantly sped up their work.

How was the Enigma cipher broken?

It is worth mentioning the factors and errors that made cracking the cipher easier:
-operators chose weak initial rotor settings, e.g. AAA, ABC, etc.
-messages often featured identical formats, e.g. ‘TO’, ‘WEATHER’, which provided a known, predictable plaintext
- the message key was transmitted twice; for example, ‘ABCABC’ was convenient for operators as a self-verifying message, but it significantly facilitated the analysis of ciphertexts
- Enigma never encrypted a letter into the same letter (e.g. ‘A’–‘A’), which reduced the complexity space and resulted from the use of the reflector

A known or predictable plaintext made it easier to test ideas for attacks on ciphertexts. Transmitting a repeated sequence of initial settings for the rotors was a mistake; this allowed cryptanalysts to make fixed assumptions whilst attempting to recover the rotor positions. From the operator’s point of view, when they received a message key, e.g. UWE as the sequence UWEUWE, this served as verification that the message had been received correctly and that they had carried out the decryption correctly. For cryptanalysts, this was a sign that they had found a potentially correct initial setting for the rotors.

Without cryptanalysis, innovative solutions and ingenious ideas, breaking the Enigma cipher would not have been possible.
Polish cryptologists Marian Rejewski , Henryk Zygalski , Jerzy Różycki to cracking the Enigma cipher took a highly innovative approach. By working on a mathematical model of the Enigma, it was possible to identify weaknesses in the cipher and ways of reducing the complexity of the operations. For example, when determining the initial position of the rotors (whose state changed with each successive letter), it was initially worth ignoring the cable connector settings. The cable connector settings remained constant during the encryption process, so it was possible to work with a symbolic description and ultimately work out the switch settings to arrive at the plaintext. This is a completely different approach to a brute-force attack, where the cable connector introduced a vast number of combinations to be checked. Rejewski viewed the Enigma as a composition of permutations introduced by:
- the selector
- three rotors
- the reflector
- three inverse permutations of the rotors
- the selector again
Moreover, the rotors undergo cyclic permutations whilst transforming successive letters.

Polish mathematicians developed their own tools to speed up code-breaking, e.g. Zygalski’s sheets can be regarded as preliminary calculations which accelerated further repetitive In practical terms, they functioned as a mechanical logic filter that allowed light to pass through at specific points. Electromechanical cyclometer a dedicated device to assist in the creation of a catalogue of characteristic curves. Electromechanical cryptographic bomb was a concept for the mechanical/automatic search for rotor settings; one could say it was a specialised mechanical accelerator for manual calculations. The cryptographic bomb operated under strictly defined conditions; it was only in later years that programmable and more flexible devices were developed, designed to break ciphers other than Enigma, e.g. Colossus .

The German designers of the Enigma feared most the interception of an actual cipher machine; however, the Enigma cipher was eventually broken using a mathematical model and intercepted radio transmissions. Nowadays, in cryptography, even a complete understanding of how a cipher works cannot compromise it; a secret key and a strong cipher are designed to ensure the confidentiality of our data. Over the years, stream ciphers, block ciphers and asymmetric cryptography (using public and private keys) have emerged. Cryptographic hash functions are a key component of mechanisms that ensure the integrity of transmitted information and enable its authenticity to be verified.

What do you think of the Enigma cipher machine?
On the one hand, it is a primitive electromechanical device; on the other hand, it incorporates many interesting ideas, though its designers made several mistakes and the operators also weakened the strength of the Enigma cipher. There was clearly a race between the Enigma’s designers and the mathematicians cracking the ciphers. I was very impressed by the way the team of cryptologists was put together and by their ingenious methods of cryptanalysis. The mathematical description of how the Enigma worked and the development of tools to speed up the process of breaking the ciphers were spot on.

How do you rate this look at the Enigma through the eyes of an electronics engineer?
I wonder whether there were opportunities to transition cryptological devices for breaking the Enigma cipher from electromechanical to vacuum tube technology?
In Poland, these were manufactured before the Second World War

On elektroda.pl you’ll find an electronic version of the Enigma cipher machine.


Enigma with four rotors, source: Wikipedia, author: Szymon Staniec, CC 4.0

About Author
TechEkspert
TechEkspert wrote 7299 posts with rating 5675 , helped 17 times. Been with us since 2014 year.

Comments

zgierzman 21 Jul 2026 13:45

You still need to specify a timeframe :-) A brute-force attack is possible, but it would probably take far too long on an RPi. A long time ago, I had the client for this project installed on my PC... [Read more]

_ACeK_ 21 Jul 2026 15:01

:smile: I’m probably really boring, constantly posting videos from YOU but it’s a goldmine of knowledge 😛 🤔 Here’s a bit about how to go about decoding :cunning: Btw on ... [Read more]

misiek1111 21 Jul 2026 17:43

What about backwards compatibility? Given that newer, revised versions were being developed, surely the new cipher couldn’t have been decrypted on an older version of the Enigma (?) [Read more]

TechEkspert 21 Jul 2026 20:02

I did not, in fact, specify a timeframe for the brute-force attack; however, without using the shortcuts provided by the cryptographers’ ideas, this timeframe was unacceptable :) Thank you for supplementing... [Read more]

gregor124 21 Jul 2026 20:55

There’s nothing quite like YouTube videos and gleaning ‘knowledge’ from them ;) What amused me most was that the navy used a different cipher, because the Enigma had four rotors and it needed to be... [Read more]

krzbor 25 Jul 2026 21:53

It sounds formidable, but in reality it is the most trivial substitution cipher, which can be broken using statistical methods. What’s more, this substitution remains constant throughout the day for all... [Read more]

modziul 26 Jul 2026 04:57

I don’t think it was quite that straightforward; without spies and those who supplied them with information, the course of the war might well have been different. Of course they knew it could be decrypted,... [Read more]

gregor124 26 Jul 2026 13:28

26^8 – as that was the number of combinations produced by 8 rotors – is still considerably fewer than could be achieved with the aid of a tumbler. In any case, with an Enigma without a selector, it was... [Read more]

_ACeK_ 26 Jul 2026 22:10

:smile: If not do you know these channels on YouTube here are some cool videos to watch – I recommend :twisted: You often come across people like: https://obrazki.elektroda.pl/8194731200_1785095865_bigthumb.jpg... [Read more]

gregor124 27 Jul 2026 11:21

Well, I don’t know – according to the figures, there were only between 400 and 500 of these Native American ‘cryptologists’ serving in the US Army, whilst 40,000 Enigma machines were produced. So, in... [Read more]

Pan.Kropa 27 Jul 2026 11:50

The way you write it, one might get the impression that cracking the Enigma code would have been a piece of cake for you. [Read more]

ken-wawa 27 Jul 2026 20:48

I’m not sure if it was just the scale… I’d say there were also certain design flaws (perhaps deliberate, to make the machine more user-friendly), but also… the arrival of the first computers on the scene.... [Read more]

gregor124 28 Jul 2026 11:40

And what exactly did the British come up with? Because when it came to cracking the Enigma, they used the ‘Bomba’, which was essentially a further development of the Polish ‘Bomba’ – even the name remained... [Read more]

%}