After World War I a German engineer named Arthur Scherbiusdeveloped an ingenious electro-mechanical device called The Enigma Machine that was used to send coded messages. These devices were used commercially and by the German military. Rotors were used that could change the code every day. In 1932 a group of code breakers in Poland figured out how to decode Enigma Machine messages, but in 1938 the Germans made the device more complicated, which defeated the Poles techniques. The problem was that to break the code (which changed on a daily basis) you had to try 150,000,000,000,000 combinations. There was no way to do this in a reasonable time.
A WW II Enigma Machine
Bletchley Park
During WW II the British set up a code-breaking group at a country house at Bletchley Park in Buckinghamshire, North of London, to address the problem. Alan Turing, a brilliant mathematician from Cambridge University, who was part of the group, built what was essentially the first modern computer to try all the combinations very rapidly.
As a result the British often were able to decode intercepted German Morse code messages soon after they were sent. However, they could only act on the messages a fraction of the time because they were afraid the Germans would figure out that their code system had been broken. Being able to intercept German military messages was instrumental in causing the collapse of Germany and saved innumerable lives.
The machine Alan Turing built
This has been dramatized in the movie, The Imitation Game (2014), starring Benedict Cumberbatch as Alan Turing.