Education and codebreaking 
Born in Streatham, South London, Twinn was the son of a senior General Post Office official. After attending Manchester Grammar School and Dulwich College, he graduated in mathematics at Brasenose College, Oxford. He won a scholarship to pursue postgraduate studies in Physics.
Twinn joined GC&CS—Britain's codebreaking service—in early 1939, recruited after seeing an advertisement, working first in London before moving to Bletchley Park. He worked with Dilly Knox and Alan Turing on German Enigma ciphers. In early 1942, he became the head of the Abwehr Enigma section.
Twinn was the first British cryptographer to read a German military Enigma message, having obtained vital information from Polish cryptanalysts in July 1939. Twinn stated that, "It was a trifling exercise, but I repeat for the umpteenth time, no credit to me."
The World War II Story 
He was in the middle of a postgraduate scholarship studying Physics when he saw an advertisement for a job with the government. "I was a bit unsettled," he remembered. "I'd finished my university degree and I didn't quite know what to do." The advertisement indicated that they were looking for mathematicians, but was unclear about what else was involved.
In that unsettled period after the Munich Agreement, international relations between the major European powers were tense and getting tenser.
" They offered me this job at the princely salary of, I think, £275 a year," he said, "which sounded all right to me, and I was taken along on the first day to be introduced to Dilly Knox." He began as an assistant to Alfred Dilwyn (“Dilly”) Knox, who headed a team of codebreakers at GC&CS.
An eccentric but brilliant character, Dilly Knox was the first British codebreaker to work on the Enigma cipher. Like most GC&CS experts, he was a classicist. But, as war loomed, GC&CS began employing mathematicians, as well as chess players and crossword experts. Twinn was in fact the first mathematician to join the team.
Knox believed in throwing his new recruits in at the deep end. He gave Twinn a mere five minutes’ training before telling him to go and get on with it.
The Enigma machine dated back to 1919, when Hugo Alexander Koch, a Dutchman, patented an invention that he called a secret writing machine. A little later, Arthur Scherbius, an engineer, was experimenting with this and similar machines and became enthusiastic about encryption machines that used rotors. He recommended them to Siegfried Turkel, the director of the Institute of Criminology in Vienna, who also became interested in them.
In the meantime, Koch had set up a company with the hope of selling his encryption machine for commercial use. But industry was not interested. However, in 1926 the German Navy looked at the Koch machine. Senior officers were impressed with it and ordered a large number. The purchase of the device — called Enigma — was kept strictly secret.
The Enigma machine was a very complicated instrument. It had a keyboard, like the ones used on a typewriter, containing all the letters of the alphabet. Each of the 26 letters was connected electrically to one of three rotors, each provided with a ring. Each ring also held the 26 letters of the alphabet. Further electrical connections led from the rotors to 26 illuminated letters.
When an operator, enciphering a message, pressed a key, an electric current passed through the machine and the rotors turned mechanically, but not in unison. Every time a key was pushed, the first rotor would rotate one letter. This happened 26 times until the first rotor had made a complete revolution. Then the second rotor would start to rotate. And so on.
When a key was pressed, a light came on behind the cipher text letter, always different from the original letter in the plain text. The illuminated letters made up the coded message.
The system worked in reverse. The person decoding a cipher message would use an Enigma with identical settings. When he pressed the cipher text letter, the letter in the original plain text message lit up. The illuminated letters made up the original message.
To make the codes more difficult to break, each of the rotors could be taken out and replaced in a different order. Also, the rings on the rotors could be put in a different order each day — for example, on one day the first rotor could be set at B, the next day at F, and so on. The military version of Enigma was provided with a plug board, like an old telephone switchboard. This allowed an extra switching of the letters, both before they entered the rotors and after leaving them. The plug board had 26 holes. Connections were made with wires and plugs. With three rotors and, say, six pairs of letters connected with the plug board, there would be 105,456 different combinations of the alphabet.
In December 1938 the Germans added additional rotors (up to six) and the number of combinations increased dramatically. The Germans believed that messages sent on their most sophisticated Enigma machines were so well coded that they could not be decoded. But Twinn and his colleagues proved them wrong.
In July 1939 GC&CS moved from London to Bletchley Park. The mansion in the park was used by the staff, but many other buildings had to be constructed to accommodate the large number of people who worked for GC&CS during the war. These temporary buildings were known as the “huts”.
About 10,000 people worked at Bletchley. The core group was the small number of cryptanalysts trying to crack the Enigma machine; at the beginning, this group consisted of no more than ten people, with Knox and Twinn in charge.
The British codebreakers had been working on the commercial version of Enigma, the easier of the two to break, during the 1920s and 1930s, and they had made much progress in breaking the military version. But Twinn and his colleagues were stymied because they could not work out the order in which the Enigma keys were wired up.
In July 1939, a month or so before the war started, Knox and some others travelled to Poland. Polish cryptologists, some of whom were brilliant, handed over to their British colleagues key information about Enigma, including replica machines.
The British discovered that Enigma machines were wired alphabetically: A to the first contact, B to the second, and so on. This was the order given in the diagram attached to the patent application. But Twinn and his colleagues thought it such an obvious thing to do that nobody considered it worth trying.
In early 1940 Twinn made the first break into Enigma. This could have been done much earlier if only they had tried the alphabetical system detailed in the patent application.
The ability to read German encoded military messages was of inestimable help to the Allies in winning the war. It was achieved largely because of the efforts of Twinn, Knox, Alan Turing (who later became the father of artificial intelligence) and others at Bletchley Park. Turing, a brilliant mathematician, developed a machine called the “bombe”, which speeded up the deciphering process by trial and error — a crucial development for the codebreakers.
Twinn worked with Turing on breaking the German Naval Enigma. Their success helped allied convoys to avoid German U-boats. Knox worked on the German Army (Abwehr) codes, a task that Twinn took over when Knox became ill. This operation was crucial in the Allied campaign to deceive the Germans about their plans to invade Normandy in June 1944. The work of GC&CS, however, remained one of Britain’s best-kept secrets until 1974, nearly 30 years after the end of the war.
Post-war career 
Twinn's carried on government work after the war in a number of departments, including, in the late 1960s, as Director of Hovercraft in the Ministry for Technology. Later he became Secretary of the Royal Aircraft Establishment in Farnborough. In the early 1970s, he was the second secretary of the Natural Environment Research Council.
Twinn became interested in entomology, gaining his doctorate from the University of London in the jumping mechanism of click beetles. He co-authored A Provisional Atlas of the Longhorn Beetle (Coleoptera Cerambycidae) (1999), a study of the distribution of a number of beetle species.
Twinn had an interest in music and played the clarinet and viola. Twinn married Rosamund Case, whom he had met at Bletchley Park through his interest in music, in 1944; they had a son and three daughters.
- Peter F. G. Twinn and P. T. Harding, "Provisional atlas of the longhorn beetles (Coleoptera, Cerambycidae) of Britain", Huntingdon: Biological Records Centre, 1999. ISBN 1-870393-43-0