The British had been hugely successful at breaking German codes in the First World War. The Germans were determined not to let that happen again. This time they had Enigma, a code machine that produced messages that could not be decrypted. Or so the Germans believed.
The navy Germany had at the outbreak of the Second World War was only a small fraction of what the Allies had arrayed against it. But the Fall of France and the entry of Italy into the war changed things dramatically and created opportunities at sea that Germany had never had in the last war.
In 1940, the British government was in the frustrating position of funding research on a number of promising projects that would be valuable to the war effort, but with the Battle of Britain in full swing, British factories had to turn out fighter planes as fast as they could. There was no room for development of experimental new technologies, so the British turned to the United States