Sometimes, mathematical codes are a matter of life and death.
In the late 1920s, a new device for encryption, the process of disguising information, emerged from Germany.
The Enigma Machine.
Widely used by Nazi German forces during the Second World War, Enigma machines scrambled information sent between branches of the military.
World War II
This tactic meant that even if the Allied forces intercepted these messages, they could not make sense of them without special keys.
But how did they work?
The Enigma Code
When plain text was typed, it transformed into different encoded letters, or cipher text.
However, the machine's complex mechanics meant that each time a letter was pressed, its outcome would be different.
Understanding the math requires knowledge of permutations.
Permutation - an ordered combination
Military-issue machines had five interchangeable rotors to fit just three positions.
The number of permutations worked out as 5 times 4 times 3, equals 60 potential permutations.
Every rotor had 26 different starting positions, giving thousands of possibilities.
These rotors turn each other in over 600 different ways.
And each machine's plugboard, with 10 cables, could pair up letters in millions of combinations.
The combined result meant that Enigma machines could disguise messages in over 100 billion trillion permutations.
The system seemed invincible.
But code-breakers had some clues as to how the machines were programmed.
For example, communications frequently started or ended with the same conventional statements.
And because parts of messages were repeated but encoded differently each time, these repeated sequences could be compared.
Throughout the war up to 7000 British operators worked in shifts decoding seemingly unreadable sequences.
But with the coming together of math and mechanics, eventually the code was broken.
By 1940 a reliable system for cracking Enigma codes was established, helping the Allies shorten the war by two years, and sparing thousands of lives.