Top-tier WWII German ciphers × the GPU on your desk
EnigmaBenchmark runs a brute-force attack on some of WWII's most famous German cipher machines using four different compute paths, side by side, in one window:
Parallel.ForEachVector256<int> + GatherVector256The point isn't to "show off benchmark numbers." It's to take one computation with real historical weight and run it on four different hardware options so you can see, in concrete terms:
The same SkSL shader finishes in 0.2 s on the GPU while the single-threaded C# version takes 11 s.
That's the physical reason AprNes's CRT filter lives on the GPU.
16 January 1917: German Foreign Secretary Arthur Zimmermann cables ambassador Heinrich von Eckardt in Mexico City. If the US enters the war, Germany will back a Mexican attack in exchange for the return of Texas, New Mexico, and Arizona. It's the single biggest intelligence swing of the war.
A few thousand words × multiple code-group variants = keyspace well past 10400 — totally unenumerable. The only reason it broke is that Room 40 had years of accumulated German diplomatic traffic, and patient matching of recurring fragments ("AN SEINER EXZELLENZ", "ZIMMERMANN" signatures) reconstructed the codebook piece by piece. This was a victory of intelligence gathering and patience, not of compute.
A simplified ~70-word pseudo-0075 codebook; Zimmermann-style messages are encoded to 4-digit code groups. The cracker mimics Room 40's method: given a handful of previously-broken intercepts as crib material, it performs a single-threaded linear-pass word-by-code alignment to recover dictionary entries, then applies those entries to the target message. Typical runtime: milliseconds, 70–90 % decode ratio.
Keyspace = ∞ (the codebook itself is the key) · Cracker path = crib-based dictionary recovery
This card exists to underline one cold fact: no matter how strong the algorithm, once the key carrier (codebook, settings sheet, Kenngruppenbuch) is leaked or reconstructable, the system collapses. The same logic held at Bletchley — the captured U-boat Wetterkurzschlüssel was worth more than any Bombe Turing ever built.
Designed in March 1918 by Oberstleutnant Fritz Nebel for Germany's Spring Offensive. A two-stage cipher, theoretically very strong — until Captain Georges Painvin of the French Bureau du Chiffre broke the first message on 2 June 1918, changing the course of the war.
A two-stage cipher ought to be hard — but German operators were sloppy and repeatedly sent similar messages on the same day under the same keyword (official cables loved to open with "An das Hauptquartier…"). Painvin ran what he called a "superimposition attack": aligning depths of equal length, using statistics on the formulaic prefixes to peel off the transposition column order, then reverse-engineering the Polybius grid. Three brutal weeks of work cost him 15 kg.
"Munitionierung beschleunigen Punkt soweit nicht eingesehen auch bei Tag"
— Speed up the ammunition shipment. Continue even in daylight.
This decrypt let France predict the German main axis between Montdidier and Compiègne and rush reserves to close the gap. The Spring Offensive stalled. History calls it the Radiogram of Victory.
The benchmark assumes the Polybius grid is known (Painvin had to recover that too — a harder, separate attack) and brute-forces the transposition column order. A keyword of length 8 → 40,320 permutations, solved in seconds on a single thread. Candidates are scored by 26-letter index of coincidence.
Keyspace = K! = 8! = 40,320 permutations · Score = standard 26-bucket IC
By modern standards this is trivial — but in 1918 it was the first documented case of a field cipher machine being broken by pure statistical analysis. Painvin's technique — reverse-engineer a permutation from recurring patterns — is the same path Rejewski, Tutte, and Beurling would walk one generation later.
This benchmark picks three of the ciphers Germany was most proud of, the Allies found most painful, and which were declassified only decades after the war. Each has its own legend and tragedy.
The standard three-rotor Wehrmacht Enigma. Army, navy, air force, high command, foreign office, intelligence — the nervous system of the entire Third Reich ran on this iron box. German High Command's faith in Enigma was close to religious: they never believed it was broken, not even after they'd lost.
| Rotors (Walzen) | I / II / III / IV / V (five-rotor Wehrmacht set) |
| Rotor order (Walzenlage) | pick 3 from 5 = 5×4×3 = 60 combinations |
| Reflector (Umkehrwalze) | UKW-B or UKW-C |
| Ring settings (Ringstellung) | A–Z per rotor, 26³ total |
| Grundstellung (start positions) | A–Z per rotor, 26³ total |
| Plugboard (Steckerbrett) | 10 letter swap pairs |
| Mechanical quirk | Double-step anomaly — when the middle rotor hits its notch, the middle and left rotor both step simultaneously |
Full space: 60 × 26³ × 26³ × 150,738,274,937,250 (plugboard) ≈
1.58 × 10²⁰. The plugboard part can't be separated by IC scoring, so
the historical Rejewski / Turing attacks bypass it — as does this benchmark.
The benchmark assumes the plugboard is known (simulating a crib-based attack or the effect of Turing's Bombe), and only brute-forces wheel order × grundstellung. That defines the four scopes:
| Scope | Search | Keyspace |
|---|---|---|
| Quick | wheel × 26³ | 1,054,560 |
| Normal | + right ring | 27,418,560 |
| Hard | + middle ring | 712,882,560 |
| Extreme | + left ring (full wheel × pos³ × ring³) | 18,534,946,560 |
1 February 1942: the Kriegsmarine upgrades its U-boat comms to the four-rotor M4. Bletchley Park goes completely blind for ten straight months, unable to read a single U-boat order. Those ten months are called the "Second Happy Time" — German wolfpacks shredded Allied supply lines across the North Atlantic.
Historians estimate that during those 10 months about 600 Allied merchant ships carrying 3.5 million tons of supplies went to the bottom. Had M4 held, Britain could have been starved into negotiating peace by 1943.
October 1942: HMS Petard intercepts U-559 in the Mediterranean. Able Seaman Colin Grazier and Lieutenant Tony Fasson swim into the already-sinking boat and retrieve the Wetterkurzschlüssel (weather short-signal codebook). Both men went down with the submarine.
Using that codebook Bletchley reopens M4 on 13 December 1942. From that day the Atlantic campaign tipped the other way.
Enigma is tactical. Lorenz is strategic — direct links between Hitler, OKW, OKH, and the army-group commanders on the front. A single Lorenz decrypt was worth a hundred Enigma messages.
Lorenz SZ42 (Schlüsselzusatz, "cipher attachment") is not a character-substitution machine like Enigma — it's a teleprinter stream cipher:
Z[i] = P[i] ⊕ χ[i] ⊕ ψ[i]; keystream period ≈ 1.6 × 10¹⁹Full keyspace (including all pin patterns) ≈ 2501
Pure brute force is mathematically impossible. Bletchley didn't break Lorenz with compute — they broke it with two acts of statistical genius:
Lorenz wasn't broken in one shot. Tutte decomposed the attack into three stages, each targeting a different part of the structure:
Stage 1 — χ-wheel recovery. This is precisely what Colossus existed to do — Tommy Flowers designed it to sweep those 22 M candidates in under an hour. Our GPU shader finishes in a couple of seconds.
χ keyspace = 41 × 31 × 29 × 26 × 23 ≈ 22,041,682 combinations
To focus on hardware comparison, the scenario uses the simplified form Z = P ⊕ χ
(ψ = 0). Full SZ42b encryption would collapse the effective brute-force keyspace to ~900
χ₁×χ₂ pairs once Δ-statistics take over — that would defeat the benchmark's purpose. The
Δ-signal Colossus saw at Stage 1 is structurally the same one our shader sees; the difference
is that ψ/μ handling is kicked down the pipeline to humans in Stages 2 and 3.
The shader, for each key candidate, scores the first 180 ciphertext characters with a simplified dottage — counting how often the decrypted byte matches SPACE (Baudot 4) or E (Baudot 1). These two characters together are about 29 % of German teleprinter text versus 6.25 % random, giving a 10σ+ signal. GPU pre-filter + CPU full-text 32-bucket IC re-rank guarantees the true key surfaces out of noise.
The final member of the T52 family — and the only variant that was never operationally broken during the war. Used by the Luftwaffe and Kriegsmarine for strategic-level teleprinter traffic between air-fleet HQs, U-boat command posts, and fixed garrisons. Sitting between Enigma (tactical) and Lorenz (ubiquitous strategic) — a mid-tier strategic workhorse that's less famous than either but mathematically the most complex of the three.
Full start-position space = 47·53·59·61·64·65·67·69·71·73 ≈ 8.94 × 10¹⁷ · Daily keyspace ≈ 10²⁴ (pin patterns + switch map + starts + KTF)
Sweden's Arne Beurling broke T52a in two weeks in May 1940 with nothing but paper and pencil, and for the next three years Swedish FRA read virtually every German teleprinter transmission relayed through Sweden — 500,000 intercepts, 350,000 decrypts. When Germany upgraded to T52e mid-1943 and enabled KTF, Swedish decrypts dropped to zero overnight.
Two structural changes mattered:
Bletchley Park picked up T52 traffic on a Sicily → Libya link (codenamed "Sturgeon") around the same time, worked by Michael Crum's section. Discipline-slip depths gave them occasional entries, never anywhere near the regularity of Enigma or Tunny. The Luftwaffe had a fatal habit of re-transmitting Sturgeon messages on weaker Enigma links, so Bletchley usually read the Enigma copy and left T52 alone — no comprehensive wartime traffic analysis of T52e was ever completed.
Full 10²⁴ brute force is infeasible. Following Bletchley's Testery pattern: assume pin patterns, switch map, and 6 of 10 wheel start positions are known (via depths, cribs, or side-channel recovery), brute-force the remaining four wheels (W7, W8, W9, W10 — pin counts 67 × 69 × 71 × 73).
Reduced search space = 67 × 69 × 71 × 73 = 23,951,289 ≈ 24 M candidates
Comparable scale to Lorenz chi-only's 22 M. Timings: Scalar ~9 min, Parallel ~1 min, SIMD slightly faster, GPU shader ~1 s. All four backends pass the full 24 M search and recover the true key.
Per-character work in T52e: 10 pin reads + 10 H/SR XORs + 32-entry permutation lookup + 10 M-magnet AND/NOT + 10 conditional wheel increments — roughly 10× the per-character cost of Lorenz chi-only's 5 XORs. The SIMD backend uses Vector128 lane-parallel (4 candidates per SIMD batch): SR computation done via 20 Vector128.Xor ops (replaces the scalar SR-LUT, since vector XOR is nearly free in SIMD while gather is expensive); Fig9 permutation kept as a 5×32 LUT with 5 software gathers; M-magnet and Vernam entirely Vector128 logic; wheel stepping via compare-equal-zero masks for conditional increment. Same code runs on x86 (emitted as SSE2/AVX2) and ARM64 (emitted as NEON) thanks to the cross-platform Vector128 API.
Full T52e specifications were never fully declassified. Our implementation is based on
Donald W. Davies' 1982 NPL internal technical memorandum (examined two surviving machines at
Munich and the Science Museum London). The Git repo's docs/research-t52e/
directory holds the complete reverse-engineering corpus, Davies' original PDF, and our own
EN / ZH technical reports:
The Imitation Game handed nearly all the credit for WWII cryptanalysis to Alan Turing. The real story is much more complex: three independent attack chains, four countries, more than a decade, and hundreds of mathematicians, engineers, and women operators — together they tore open German systems that Berlin thought were "forever secure." Here are the people the movies and most books miss.
French artillery captain, École Polytechnique mining engineer by training, amateur cryptographer by inclination. Called into the Bureau du Chiffre in 1914 and never looked back.
When the German Spring Offensive of June 1918 refreshed the ADFGVX Polybius grid and keyword, the French cryptographic section was instantly blind. Painvin locked himself in a Paris office for three weeks, brute-stacked two same-day same-keyword depth telegrams, and grid-by-grid reverse-engineered both the keyword order and the Polybius itself. His 2 June "Radiogram of Victory" exposed the German main axis between Montdidier and Compiègne.
When he emerged he had lost 15 kg, his hair had gone grey, and his body was broken. He later said: "those were the worst days of my life; I kept going on willpower alone, against a stack of paper." He turned down the offer to stay in intelligence, became CEO of Compagnie des Compteurs (boilers), and lived to 93. France made him a Grand Officer of the Légion d'Honneur in 1973; the US NSA publicly acknowledged his work in 1978 — 60 years after ADFGVX fell.
Director of Naval Intelligence (NID), the political muscle behind Room 40. He blinked compulsively (hence the nickname) and was a political operator of rare skill. When the Zimmermann Telegram landed in his inbox in 1917, Hall faced a dilemma: handing it straight to the US would reveal that Britain was tapping US transatlantic cables. He invented the "stolen from a Mexican telegraph office" cover story, letting the US believe the intelligence had reached them via a lucky third-party theft — and thereby protected Room 40's source.
Hall's political savvy mattered as much as Room 40's technical capacity. His persuasion memo to US Ambassador Walter Page is still studied in intelligence-history courses.
Room 40's two Zimmermann Telegram decoders. De Grey came from publishing (Heinemann); Montgomery was a Presbyterian minister and Christian theology scholar. Neither was a conventional military intelligence officer — both built up the 0075 codebook word by word from accumulated German diplomatic intercepts.
On the morning of 17 January 1917 they were staring at a partial decrypt. When the words "MEXIKO", "TEXAS", and "ARIZONA" appeared in clear, de Grey rushed to Hall: "Do you want to bring America into the war?" — one of the most consequential single sentences in the history of diplomatic decryption.
Neither man was publicly acknowledged for 30 years. Montgomery died in 1930 with his family unaware of what he had done in the war; de Grey stayed at GCHQ and retired in 1951.
Warsaw University maths graduate, recruited at 22 into the Polish cipher bureau, Biuro Szyfrów. In December 1932 he did what every cryptographer in Europe had failed to do: he broke Enigma. Not by exhaustion — by permutation-group theory. From the cyclic structure of the daily indicator (what he called the "characteristic") he reverse- engineered the entire internal wiring of the machine.
It was a mathematical achievement with no precedent. French intelligence, via the German traitor Hans-Thilo Schmidt through Capt. Gustave Bertrand, had provided operator manuals describing Enigma's external operation — Rejewski had to deduce the internal wiring from the statistics of noisy indicators. He was 27.
In 1938 Rejewski, Henryk Zygalski, and Jerzy Różycki built the "Bomba kryptologiczna" — an electromechanical Enigma-breaker that predated the British Bombe by two full years.
On 25–26 July 1939, at a secret meeting in the Pyry forest south of Warsaw, the Poles handed over everything — the theory, the Bomba blueprints, copies of the Enigma machine itself — to British and French intelligence. Germany invaded two months later. The entire Bletchley Park Enigma effort rests on Polish foundations.
During the war Rejewski fled to France, Spain, Portugal, and finally Britain — where he was parked in a Polish signals unit doing routine work. Bletchley never invited him in — the British feared the security risk of Allied personnel. After the war he returned to Poland and worked quietly as an insurance-company accountant under Communist rule, not speaking publicly about his war work until 1967. Britain did not officially acknowledge the Polish contribution until 1976. Rejewski died in Warsaw in 1980, never receiving the recognition he was owed.
Rejewski's colleague. Invented the "clock method" for identifying the Enigma right rotor from the indicator. On 9 January 1942 the liner Lamoricière carrying him vanished in the Mediterranean. He was 32 — the only member of the pre-war Polish cryptologic trio who didn't live to see the war end.
Inventor of the "Zygalski sheets" — perforated cardboard overlays that, stacked, geometrically eliminated impossible rotor combinations. He stayed in Britain after the war and taught mathematics; no British government ever officially thanked him.
Chief cryptanalyst at Hut 8, King's College fellow. His most important contribution was restructuring Rejewski's Bomba logic into the British Bombe — and adding the "crib attack" (guess that the plaintext contains common words like "wetter" or "eins") — which compressed break times from weeks to hours.
When M4 Shark appeared in 1942 Turing, Joan Clarke, and Hugh Alexander reopened the U-boat traffic. After the war he designed ACE (one of the earliest stored-program computers) and wrote the foundational papers of modern computing and artificial intelligence. In 1952 he was convicted of gross indecency (the law against homosexuality at the time), sentenced to chemical castration, and took his own life with cyanide in 1954. He was 41.
In 2009 PM Gordon Brown issued a public apology; in 2013 the Queen pardoned him; in 2019 his portrait went on the £50 note. All of it decades too late.
Head of Hut 6, Cambridge mathematician. Turing's original Bombe tested only one stecker-pair hypothesis at a time; Welchman added the "diagonal board" — a 26×26 electrical grid that let the Bombe test many plugboard contradictions at once, speeding it up by a factor of 10+. Without the diagonal board the Bombe would never have been fast enough for wartime use.
Welchman also designed Bletchley's overall workflow organisation. After the war he went to MIT; his 1982 book The Hut Six Story was denounced by the Anglo-American intelligence community as a breach of secrecy, his US security clearance was revoked, and he died a disappointed man.
GC&CS veteran from the WWI generation, a German Navy code-breaker back in 1917. At Bletchley he ran "the Cottage", a small group that specialised in non-commercial Enigma variants. The Cottage broke the Italian naval Enigma (March 1940) and the Abwehr Enigma (December 1941).
The Italian decrypt from March 1941 let the Royal Navy ambush and destroy the Italian Mediterranean fleet at Cape Matapan — the first major Allied Ultra victory.
Knox suffered lymphoma for much of his life and died in February 1943. He refused to go to hospital at the end — he wanted to keep breaking codes. His mostly-female team (Mavis Lever, Margaret Rock) were called "Dilly's fillies" at the time; in fact they were Cambridge- educated linguists of the first rank.
Cottage team member, recruited into Bletchley at 19. In 1941 she personally broke the key Italian naval Enigma message — an operator test transmission that consisted of a long string of the letter L, exposing Enigma's structural weakness that a letter can never encipher to itself. That decrypt triggered Cape Matapan.
She also broke Abwehr Enigma traffic and, in the run-up to D-Day, Spanish Abwehr messages — confirming "the Germans still believe the landings will hit Calais", the critical validation signal for Operation Fortitude (the Normandy deception). After the war she became a distinguished historian of English gardens.
Hut 8 mathematician and Turing's closest working partner. The two were briefly engaged in 1941; Turing broke off the engagement after admitting his sexual orientation. Clarke independently optimised "Banburismus" — the core statistical-depth technique used against U-boat traffic. M4 Shark was broken mainly thanks to her rendering the original procedure into something that could be run at scale.
Because she was a woman, Clarke was paid far less than her male colleagues and was forced to hold the job title "linguist" rather than "cryptanalyst" — at the time the institutional position was that "women don't do cryptanalysis." After the war she married GCHQ colleague Jock Murray and spent her entire career in British intelligence.
Bletchley's formally-titled Chief Cryptographer. On 30 August 1941 two Lorenz messages were accidentally sent with the same key (a depth). Tiltman manually recovered the entire 4,000-character keystream from that depth — but had no knowledge of the machine's internal structure, only the keystream itself.
Tiltman's 4,000-character keystream landed on the desk of a young mathematician named Tutte. Over the next three months Tutte, armed with nothing but pencil, graph paper, and statistical instinct, reverse-engineered the complete internal structure of Lorenz SZ40 — the wiring of all 12 pinwheels, the stepping logic, the full keystream formula. He never saw the machine once.
It is arguably the purest reasoning-based cryptographic achievement of the 20th century, putting Tutte alongside Rejewski and Beurling as the three people who broke complete cipher machines by statistical inference alone. After the war Tutte took a professorship at the University of Waterloo and founded major parts of graph theory (matroid theory). British authorities only formally acknowledged his Lorenz work in 2002.
Cambridge topologist, and Alan Turing's PhD supervisor. In 1942 he set up the "Newmanry" section at Bletchley, tasked with mechanising Tutte's statistical attack. His team designed the "Heath Robinson" — a paper-tape optical-reading machine that ran χ-wheel differential statistics. It worked, barely; tape sync problems and burn-outs were constant.
The movies have never told this man's story properly. Flowers came from the Post Office Research Station at Dollis Hill — an engineer who fixed telephone exchanges, with no university degree, very much not "the Cambridge set" that Bletchley had been built from. He looked at Newman's Heath Robinson and decided "this is wrong, it should be fully electronic" — and proposed replacing it.
The Bletchley committee turned him down: "a 1500-valve machine would burn out before warm-up." Flowers paid for it himself, with his own savings, and led a small team of GPO engineers working secretly after-hours at Dollis Hill to build it. By December 1943 he had Colossus Mark I running. In February 1944 Colossus ran Tutte's attack for real — recovering in hours what had previously taken weeks.
Ten Colossi were eventually built. On the night of 5 June 1944, before issuing the final D-Day go-order, Eisenhower personally read a Colossus decrypt confirming that Hitler was moving Panzergruppe West toward Normandy — proof the German high command still expected the main landings at Calais. Only then did he give the order to proceed on 6 June.
After the war Churchill ordered every Colossus destroyed, the blueprints burned. Flowers could not even discuss the machine he had built. He stayed at the GPO building electronic exchanges, unsung, for decades. British authorities only publicly acknowledged Colossus as the world's first programmable electronic computer in 2000 — two years before ENIAC by date, and decades ahead in architecture — but by then Flowers was 95 and had dementia. He died two years later.
Uppsala University professor of mathematics, a world-class figure in analysis and harmonic analysis. In May 1940, after Germany occupied Norway and Denmark, teleprinter traffic relayed through Sweden suddenly went encrypted — Sweden's FRA (national signals intelligence agency) was intercepting messages encoded by the Siemens & Halske T52a "Sturgeon".
FRA brought Beurling in. He was locked in a room for two weeks with paper, pencils, and a stack of intercepts. Two weeks later he walked out with the complete internal structure of T52 — the XOR network of all 10 pinwheels, the stepping logic, even the reverse-engineered key-setting-switch wiring. He had never seen the machine and had no technical documentation — he reconstructed the whole machine from pure statistical properties of the ciphertext.
It is one of the most insane achievements in the history of cryptanalysis. When Bletchley heard about it they half-refused to believe it. Beurling never publicly discussed his method. His famous line:
"A magician doesn't reveal his tricks."
Over the next three years (1940–1943) Sweden read essentially every German teleprinter transmission passing through its territory — the traffic between Berlin and Oslo, Helsinki, Stockholm. 500,000 messages intercepted, 350,000 decrypted — comparable in scale to Bletchley's total Enigma output across multiple years. In mid-1943 Germany upgraded to T52e with KTF (plaintext-dependent stepping); Swedish decrypts dropped to zero. Beurling later moved to the Institute for Advanced Study in Princeton; his war work was only gradually declassified in the 1980s.
Bletchley Park's lead analyst against Sturgeon. In the summer of 1942 British intercept stations first picked up T52 on the Sicily → Libya link (codenamed "Sturgeon") and the Aegean → Sicily link ("Mackerel"). Operator discipline was poor — same keys reused across multiple messages, producing depths — and Crum's group broke into T52d/e through those depths.
The attack never reached the regularity of the Enigma or Tunny efforts: T52 was genuinely too complex, and the Luftwaffe had a fatal habit of retransmitting Sturgeon messages on weaker Enigma links — Bletchley could simply read the Enigma copy and skip the T52 attack entirely. After the war Crum joined GCHQ and helped design the SAVILLE cipher algorithm — still classified in both Britain and the US today.
German Foreign Office code-bureau clerk, codename "Asche". Between 1931 and 1938, heavily in debt and living beyond his means, he sold Enigma operator manuals, daily key sheets, and military-model wiring details to French intelligence — Captain Gustave Bertrand — who relayed them to Rejewski in Warsaw. Without Schmidt's "daily-key format" leak, Rejewski's permutation-group attack would have had no entry point.
In March 1943 the Gestapo identified Schmidt and arrested him. He took poison in prison shortly after. His betrayal is arguably the true starting point of Allied signals-intelligence dominance — but his motive was money, not anti-fascism, and history has judged him complicated.
Captain in the French Deuxième Bureau, personally handling Schmidt throughout the 1930s. By 1938 he had grasped that France alone could not break Enigma, and took the unilateral decision to pass everything Schmidt had provided to the Poles — the move that unlocked Enigma. His 1973 memoir Enigma ou la plus grande énigme de la guerre 1939–1945 was the first public disclosure of Bletchley's Polish origins, three years before British declassification caught up.
At peak, Bletchley employed over 10,000 people — about 75 % women: WRNS (naval), WAAFs (air force), and women recruited from Oxford and Cambridge. They operated the Bombes and Colossi, worked night shifts, proofread intercepts, ran traffic analysis.
Joan Clarke, Mavis Batey, Margaret Rock, Jane Fawcett (whose decrypt led the Royal Navy to catch and sink the Bismarck), Ruth Briggs, Pamela Rose… most of them could never tell spouses, parents, or children what they had done in the war. As Britain's Public Record Office began declassifying in the 1990s, many families learned only after a mother or grandmother had died that she had broken Enigma.
From 8 May 1945 onward, every single person listed above had to shut up. The Official Secrets Act kept Bletchley classified until 1974 — Churchill's personal order: "Never ever, EVER, speak of this." After the war British security services quietly monitored ex-Bletchley staff for any signs of indiscretion.
The movie picked Turing because his ending was the most dramatic. But Turing himself would be the first to tell you: Rejewski is the one who actually started all this. Tutte's pure-paper break of Lorenz was harder than anything I did on Enigma. Beurling breaking T52 in two weeks alone has never been matched by anyone. Flowers's Colossus is where the modern computer begins.
One brute-force problem, four implementations. The algorithm is the same — only the hardware-mapping differs:
Single C# thread, plain loops, no optimisation. This is "how fast does C# actually go" as your imagination would answer it.
Parallel.ForEach fans out the outer wheel-order × ring loop across the thread
pool. A 16-core CPU gets close-to-linear 7–9× speedup.
Vector256<int> processes 8 grundstellung lanes per instruction; the rotor
table is read via Avx2.GatherVector256. About 3–4× faster than Parallel.
Enigma rewritten as a Skia runtime-effect shader. One pixel = one full key trial. The
D3D11/OpenGL context is acquired through Avalonia's ISkiaSharpApiLease. This
is exactly the same shader pipeline AprNes's CRT filter uses.
Under Avalonia's GUI we get a real GRContext through
ISkiaSharpApiLease, and the shader runs directly on the GPU
(D3D11 / OpenGL). Deployment complexity is an order of magnitude lower than CUDA or Metal,
yet the compute throughput is in the same order of magnitude.
| Backend | Time | K keys/s | Speedup |
|---|---|---|---|
| Scalar (single-thread) | 11.06 s | 95 | 1.00× |
| Parallel (16 cores) | 1.59 s | 662 | 6.94× |
| SIMD + Parallel | 0.51 s | 2,059 | 21.59× |
| SkSL GPU (OpenGL) | 0.25 s | ~4,200 | 44× |
| Backend | Time | K keys/s | Speedup |
|---|---|---|---|
| Scalar M4 (single-thread) | 14.81 s | 71 | 1.00× |
| Scalar M4 Parallel (16 cores) | 1.94 s | 544 | 7.64× |
| SIMD M4 + Parallel | 0.58 s | 1,818 | 25.52× |
| SkSL M4 GPU (OpenGL) | 0.044 s | 24,005 | 337× |
M4 has one extra shader step per character (the Greek rotor pass); CAP dropped from 96 to 80 to stay inside Skia's program-size budget. And 80-character IC gets noisy across a 1 M-key search, so the GPU shader returns the top-256 candidates, and the CPU re-ranks them on the full ciphertext — GPU pre-filter, CPU final decision.
| Backend | Time | K keys/s | Note |
|---|---|---|---|
| Scalar Lorenz (single-thread) | 90 s+ | — | 90 s timeout; full 22 M keyspace doesn't fit a single core |
| Scalar Lorenz Parallel (16 cores) | ~20–40 s | 500K+ | All cores brute force |
| SIMD Lorenz + Parallel | ~1–3 s | 8M+ | Precompute χ2⊕χ3⊕χ4⊕χ5 stream; inner loop reduces to one Vector256 XOR |
| SkSL Lorenz GPU (OpenGL) | ~0.5–2 s | 10M+ | 23 render passes + CPU top-512 rerank |
The Lorenz shader uses a minimal SPACE+E hit-count scorer (SkSL forbids bitwise ops, so per-bit
XOR is simulated with a+b−2ab; 32-bucket IC wouldn't fit inside the program-size
limit). That scorer has 10σ+ signal on German Baudot text, so truth is always in the top-K;
the CPU then re-ranks with full 32-bucket IC. This is structurally what Colossus did — χ stage
by statistics, ψ and μ left for later.
Test rig: Windows 11 / .NET 10 / 16-core CPU / consumer GPU. Numbers vary noticeably with hardware but the relative-speedup story holds.
| Task | 1940s | Now (this benchmark) |
|---|---|---|
| Break one Enigma M3 key | One Turing Bombe: 15–20 min; Bletchley had 200 at peak | 0.25 s |
| Break one Enigma M4 (Shark) key | Feb–Dec 1942: Bletchley completely blind for 10 months (U-559 codebook retrieved at the cost of two lives); after that Bombe ~15 min | 0.044 s |
| Recover one Lorenz χ-wheel alignment | One Colossus Mark II: ~1 hour; 10 Colossi built in total | ~1–2 s |
| Personnel | ~10,000 people working in secret for 5 years | you press Start |
| Hardware | electromechanical Bombes + vacuum-tube Colossi | one consumer GPU |
On the surface this is a cross-domain stress test of the AprNes CRT shader pipeline — we wanted to see whether the same SkSL / SIMD / Scalar stack produces a comparable relative- speed profile under a completely different workload (cipher brute-force). Answer: yes.
But the real motivation is more emotional. These machines were the nervous system of the Third Reich's war machine. They were the secret 10,000 people kept at the cost of their whole youth. They are the reason the modern computer was invented in the first place. Putting them against one GPU today and watching it finish in a blink isn't just "hardware got better" —
It's a vertigo of compressed time. What took tens of thousands of people, several years, a secret town, and purpose-built machines to make "barely possible" — your gaming GPU now processes while you sip a coffee. Standing on their shoulders isn't a metaphor. It's literal.
The moment "0.25 s" sits next to "1942–1945" in the same line is the whole reason this project exists.
cd EnigmaBenchmarkAvalonia
dotnet build -c Release
bin\Release\net10.0\EnigmaBenchmarkAvalonia.exe
Once the window opens:
GRContext can only be acquired from the Avalonia render thread, and must be
returned there. It cannot cross threads.ICustomDrawOperation.Render
(~0.25 s); the UI is briefly frozen during that window.TaskCompletionSource, which
must be constructed with RunContinuationsAsynchronously —
otherwise the await continuation runs on the render thread and any subsequent UI update
throws a cross-thread exception.
Rotor wiring data: Crypto Museum,
Dirk Rijmenants' Cipher Machines.
Lorenz structure: Bletchley Park General Report on Tunny (1945, declassified 2000).
Historical events cross-checked against David Kahn's The Codebreakers,
F.H. Hinsley's British Intelligence in the Second World War, and the Bletchley Park
official archive.
This project is a companion to the
AprNes NES emulator, demonstrating that its
CRT shader pipeline generalises well beyond graphics workloads.
"We also have sound, incontestable proof of the truth of our observations... I only add
that the work I have accomplished was of great importance for the future conduct of the war.
If I have helped, I may say I have done my bit." — Marian Rejewski, 1942