终结恩尼格玛:图灵、炸弹机与重塑二战进程的密码破译史诗 Veritasium 2026-09-21

终结恩尼格玛:图灵、炸弹机与重塑二战进程的密码破译史诗

关键字 cryptanalysis rotor-cipher electromechanical-computing permutation-theory information-security
7 节

机械重构与多表代换:恩尼格玛的运作原理与密钥爆炸

恩尼格玛密码机(Enigma: 二战时期纳粹德国使用的机电转子加密设备)并非纳粹首创,而是由德国发明家阿瑟·谢尔比乌斯(Arthur Scherbius)于1918年申请专利,最初用于商业银行与企业通信。艾伦·图灵的侄子德莫特·图灵爵士(Sir Dermot Turing)指出,当年波兰、英国和俄国都曾通过商业渠道购入该设备。与传统的凯撒密码(Caesar Cipher: 固定字符位移替换)或单表代换密码不同,恩尼格玛的核心优势在于多表代换——每一次敲击按键,机器内部的物理连接和替换规则都会实时改变,使得连续输入相同的字母会输出完全不同的密文。

从物理结构来看,恩尼格玛内部包含三个转子(Rotor: 内部布满交错电线的旋转编码盘)。每个转子两侧各有26个金属触点,分别对应26个英文字母。当电流从键盘流入第一转子时完成第一次替换,进入第二、第三转子后依次被置换,最后经由反射器(Reflector: 将电流折返并再次导回转子系统的内部组件)沿完全不同的电路路径反向穿回三个转子,最终点亮键盘上方灯板上的特定字母。更为关键的是其齿轮步进机制:每敲击一次按键,最右侧转子步进一格;当第一转子旋转26次到达特定缺口(Notch)时,驱动拨杆下落并推动第二转子步进一格;第二转子转满26圈后带动第三转子转动一格。三个转子的安装顺序有 $3 \times 2 \times 1 = 6$ 种排列,每个转子有26个初始起始位置(视窗设置 Window Setting),仅商用版的基础组合就超过10万种。

英文原文

This is the Enigma, the encryption machine used by the Nazis in World War two. I see that there is a sigil from the Nazi Party on this one, so it must be the real thing. Yes. This was actually used by the Germans in World War II. Someone actually asked me the other day, did Hitler use this machine? And I said, I don't know, but Benedict Cumberbatch and Keira Knightley did. Woah, no way! Could we try encrypting a word? Yeah. - I have just a word for us. You'd never guess what it is. - So that's our plaintext. That is our plaintext. So we need to press the keys. And look at the lamps that light up, which will give us our ciphertext. So the first one is V. We have a J. Okay. Then an E. - F - Then an R. We have an M. That is an L. Now for someone to decrypt this message they need to type this text into another Enigma machine. But not just any enigma. Their machine has to be set up in the exact same way as the one that encrypted the message. So we need to turn these rotors back to the initial setting. That means adjusting a series of rotors and wires to exactly one of trillions of possible combinations. If you get it right.... Finally, the L gives us: - Veritasium It worked. Yeah. The message appears, but if just a single setting is out of place, well, then the encryption remains unbroken. I can see how decrypting such a thing would get very complicated very quickly. This is exactly what the Nazis relied on. Hitler had come into power in Germany and the Nazi Party had taken over. Today we rule Germany. Tomorrow the world. By 1939, they were sending hundreds of encrypted messages across Europe every day. With the allies desperately trying to guess the Enigma settings. But even if they sometimes got lucky and cracked a message each day at midnight, the Germans would change the settings on all their Enigma machines, so none of it would help them read the next day's messages. That's why British intelligence assembled a team of the country's greatest minds: chess players, crossword fanatics and university academics including Alan Turing, along with hundreds of women from the Royal Navy. And bit by bit, they looked for flaws hidden deep within the machine. But they also searched for subtle mistakes made by German operators. At its peak, around 9000 men and women were executing the most secret code breaking operations in the world. Out of an unsuspecting mansion in the English countryside. This is a video about the incredible methods and machines that broke the enigma. Let's start with how the Enigma actually works. And I think the first thing you need to know about the Enigma is that it wasn't actually invented by the Nazis. It was patented in 1918 by a guy called Arthur Scherbius. He was a German inventor who wanted to encrypt messages for banks and businesses. Were Enigma machines readily available? Could you, like, buy one in Germany, or were they kept a secret anyways? This, by the way, is Sir Dermot Turing. He's Alan Turing's nephew. The company that was making Enigma machines was really trying to find a market for them, so you could definitely go out and buy them. And lots of countries did. So Poland bought one, the British bought one, the Russians bought one, you name it. And there's one thing in particular that made Enigma superior to other encryption methods. And you only need to play around with it for a bit to figure that out. I'm going to press the L key. And when I do that, you'll see that one of the lamps on the lamp board lights up. The Y. That means that the plaintext letter L has been encrypted as a Y. If I press the L again, what do you think might light up? Maybe the Y again? - Maybe the Y. So let's press it again and see what happens. And what has lit up there. Well that's an H not a Y. So it's not a Y. So it's changed. Okay, so with every key press the substitution is different. - Yes. This is what separates the enigma from the most famous encryption methods that came before, the Caesar cipher or simple substitution ciphers. These all encrypt according to a fixed rule. Enigma changes that rule with every single letter you type. And for the reason for that, we need to open the box even further and see what's happening inside. Yeah, that'd be great. Okay, so I'm going to open this up. Inside the Enigma there are three rotors. Each rotor has 26 metal contacts on either side, one for each letter of the alphabet. So when you slot them into the machine, current flows from one rotor to the next, the wiring between the contacts is totally scrambled. So for example, when you type a Y current flows down the Y wire to the first rotor, where it first gets switched to an H, and then in the second rotor, the H gets swapped to a B, and in the third rotor the B gets swapped to a q. Then a component called the reflector directs the current back through the rotors by a completely different path, ending up as a letter E. The current then goes up to the lamps above the keyboard and illuminates the letter E, indicating how the Y has been enciphered. I just want to say a big thanks to Jared Owen, who made the 3D model of the Enigma for his YouTube channel and has kindly let us use it here. So check out the link in the description for his original video. Now, the moment you type a letter into the Enigma, the rotor on the right rotates. And that's how a rotor encryption machine works, that it actually moves the rotor when you press the keys. So if you type the same letter again, it will follow a completely different path through the machine, which means you'll get a different letter each time you press the key. So here you can see the rotors in position. Yes. And when I press the key you can at the back see levers which push up against the rotors. Could you press the button? Oh, I see. There we go. There's actually three levers. And they are set to the right hand side of each rotor. So there's one for each rotor trying to push the three rotors around. But it's only the first rotor that turns every time you press a key. Right. Yeah. The second rotor will only turn when the first rotor reaches a certain position. There's a notch that's connected to the ring. That notch will allow the lever at the back to drop. And then connect with the ratchet on the next rotor along. So this rotor turns until the notch comes into the turnover position. When it does so that allows the second lever to drop in and engage with the ratchet on the second rotor, which will then allow the second rotor to turn. You'll see as the rotors turn the second rotor turned at the same time. So after 26 rotations of the first rotor, the second one turns once. - Yes. And then after 26 rotations of the second rotor, the third one turns once? - Yes. Absolutely. Yes. So the third one turns very very rarely. Yes. Okay.


军用级改造与接线板壁垒:布莱切利庄园面对的数学深渊

德国军方在采用恩尼格玛时对其进行了两项绝密升级,极大地扩展了密钥空间(Key Space: 密码体制中所有可能密钥的总数)。第一项升级是引入可调节的字母环(Ring Setting: 转子外圈刻度环),操作员通过拨动外圈卡扣改变字母刻度与转子内部固定走线之间的偏移量,同时改变相邻转子发生步进翻转的触发位置(增加了 $26^2$ 种状态)。第二项升级则是致命的接线板(Plugboard: 位于机器前端用于手动交换字母对的双向跳线插板)。接线板位于键盘与输入轮之间,若将字母 Q 插线连接到 R,敲击 Q 时进入转子的信号即变为 R;反之敲击 R 输出 Q,未插线的字母则直通。

在20世纪30年代末期,德军通常在接线板上交换6对字母,仅这6对跳线就会引入超过1000亿种组合;配合转子排序与视窗初相,整体密钥空间被暴增至 $7 \times 10^{18}$ 以上。德军各部队通过每月下发的每日密钥表(Key Sheets)统一配置每日默认参数。当英法情报部门在1930年代末意识到战争临近时,军情六处在伦敦与牛津、剑桥之间的布莱切利庄园(Bletchley Park)组建了代号 Station X 的破译基地,招募了包括数学家、国际象棋大师、字谜专家以及皇家海军女子勤务队(Wrens)在内的数百名人员。然而,德军不仅增加了硬件复杂度,还彻底重构了转子内部的接线规则。在缺乏军用转子物理接线图的情况下,传统的破译手段在数学上面临绝对的死胡同。

英文原文

The operator can slot the three rotors into the machine in any order. That's three times two times one equals six possible permutations. Then there's the starting position of each rotor, which is shown in the window before the operator starts typing. This is called the window setting. There are 26 numbers on each rotor, so that's 26 cubed possibilities. Multiply that by six possible rotor orders. And that's over 100,000 ways to set up this commercial Enigma machine. But what the Germans did was they not only bought them, but they said we're going to modify them. We're going to modify them in a way that nobody else knows what we've done. There were a few ways that they did this. So if I undo this clasp here, I can actually turn the ring round. And that changes the relationship between the letter that appears at the top and the fixed wiring of the rotor. I see. So rotating the ring does two things. First, it offsets the letters from the rotors internal wiring for example at first this rotor connects 1 to 4. So it changes A to D. But rotate the ring by one. And that same wire now connects 2 to 5. So it changes B to E instead. And second it changes the position where turnover occurs on the adjacent ring. But there was another vastly more complex upgrade. There is another part of the machine that we haven't looked at yet, and this was a part of the machine that was added by the German military. It's called the plug board. Each of the keys is connected by a wire to the plug board. So the plug board has a letter for each of the keys, because it means that you can substitute the letter, say the first one we have here, which is Q and that's plugged into R. The Q coming from the keyboard will go into the entry wheel into the first rotor as an R, but if there's nothing plugged in it will carry straight through. Now let's consider how this impacts the number of ways messages can be encrypted. This is also known as the key space. The revolvable rings change the position where the second two rings would turn over. So that's 26 squared possibilities. And then on the plug board, if you swapped just one pair of letters, that would introduce 325 more possibilities. But in the late 1930s, the Nazis typically swapped around six letters. And that's 100 billion possibilities. Overall that brings the grand total for the key space to over seven times ten to the power of 18. But as long as the machine is set up exactly how it was at the start of the encryption, you can type in the ciphertext and get out the original message intact. This is also called the plain text. If both machines are in the correct settings and I press an E, it will encode to a k going through the complicated set of wires. But if I press the K under the same settings, it'll go back to an E. So it's like a closed loop of electricity. So we have a k. Oh, it seems to be working! E. The way the Germans ensured that all enigmas on a particular network were set up in the same way was by sending out prearranged instructions for each day of the month. These were called the key sheets. So each morning when the operator sent their first message, they would reconfigure their machine to the new daily settings, and that would allow them to encrypt and decrypt messages to other Enigma operators. But what if you didn't have the key sheets? Well, then you would have to figure it out from scratch. By the end of the 1930s this problem had become urgent. As Nazi Germany grew more powerful, British intelligence could sense that war was becoming increasingly likely, and they knew that Enigma messages could reveal what German forces were planning, but only if the messages could be deciphered in time. So British intelligence assembled a secret workforce focused on doing just that. We're at Bletchley Park. This was Britain's most important codebreaking operation during World War Two. Bletchley was an unremarkable town, but it was situated conveniently between London and the country's two most prestigious universities, Oxford and Cambridge, which is where the British intelligence sought their new recruits. And alongside these academics, Bletchley Park also recruited women from the Royal Navy known as Wrens, and the whole operation was kept as secret as possible. To give you an idea of the secrecy, here is something that the code breakers at Bletchley Park had to follow. Some of the rules: do not talk at meals or in transport or traveling. Do not talk by your own fireside. Be careful even in your own hut. All in all, seems like a very secretive place to work. Together this group of around 150 people started trying to break the enigma. And here was their plan. First listening stations would intercept German radio messages and send them to Bletchley Park. Second, codebreakers would analyze the day's traffic, looking for patterns and weaknesses in the encryption. And third, they would use those clues to try and guess the settings, and then they would put those settings into their own enigmas, finally cracking the messages. But all this rested on one key component the British needed a working version of the Nazi Enigma machine to figure out the settings, but they didn't have one. See, on top of adding revolving rings and the plug board. The Nazis had made another upgrade. They had also changed the wiring inside each rotor. That meant the Nazi rotors scrambled the letters in a completely different way from the commercial Enigma, and without knowing the wiring of the Nazi rotors, it was impossible to determine the settings the Nazis were using each day. So the codebreakers were stuck. So it was completely hopeless. And that was the situation at the beginning of July 1939. They really hadn't made any progress at all.


波兰先驱与置换理论:双重指示符漏洞与逆向工程

早在英国陷入僵局前,波兰密码局(Biuro Szyfrów)就已取得了突破性进展。1931年,一名德国陆军密码处雇员向法国情报部门出售了操作手册和过期密钥表,法国随后将资料共享给波兰。波兰天才数学家马里安·雷耶夫斯基(Marian Rejewski)敏锐地捕捉到了德国通信协议中的致命漏洞:操作员在每日初次配置机器后,必须自行随机挑选3个字母作为当条电报的会话密钥(如 GEX);为防无线电信号干扰,操作员需将这3个字母用每日基准设置连续加密两次(如生成密文 ASDEIW 并发送),随后将视窗拨至 GEX 开始加密正文。

这种双重加密协议在第1与第4、第2与第5、第3与第6个字母之间建立了严格的数学映射。雷耶夫斯基运用置换理论(Permutation Theory: 研究有限集合元素排列变换规律的群论分支),在从未缴获任何一台军用恩尼格玛实物的情况下,纯粹依靠数学推导在1933年完整还原了军用转子的内部连线,并制造出名为炸弹机(Bomba: 波兰研发的由电动机驱动的联锁解码机)的早期机电破译机。然而在1939年入侵波兰前夕,纳粹将转子库从3个扩充至5个(5选3排列增加至60种),接线板跳线增至10对(组合达150万亿种),使总密钥空间暴增1.5万倍至超过 $10^{23}$。波兰在亡国前夕于1939年7月召开紧急秘密会议,将其研究成果、转子内部连线图及复刻机器无保留地移交给了英法盟友。

英文原文

But what the British and the Germans didn't know was that years earlier, another country had already launched a secret effort to break Enigma. In 1931, an employee at the German Armies cipher office made contact with French intelligence, offering to sell secrets about the Enigma in exchange for a handsome fee. He handed over operating procedures, sample messages, and even key sheets. Now, the French didn't know what to do with them, so they shared them with their Polish allies, and the Polish gave the sheets to their codebreaking team of mathematicians, who spotted a vulnerability. After an officer set up his enigma for the day. He had to choose three random letters before sending a message, for example GEX. Then he would transmit these three letters, encrypted on the day's default settings, and he'd do it twice, just in case of a bad signal. For example, the encrypted letters would come out as ASDEIW. After that, he would move his rotors such that these same three letters GEX would appear in his window up here. These were the so-called window settings. And finally he would be able to type out the rest of the message. Now the receiver would decipher the first six letters of the message, and they would get GEX GEX and they would know that they had to change their window settings to GEX at this point, and only then would they be able to decipher the rest of the message. So it was encrypted twice. - Right. Which was a security flaw, because if you encrypt something twice, you have a relationship created by the first letter of the key that's been chosen. And the fourth letter, the same letter has been encrypted because you're sending it twice. Okay. Just the three second letter and the fifth letter as well. Okay I see. And they had this brilliant guy called Marian Rejewski who essentially said, oh, I recognize this is a problem in permutation theory from when I was doing my undergraduate mathematics. This meant that by 1933, the Poles had reconstructed the wiring of the military version of Enigma, even though they'd never seen one, they never captured one. And so that meant they were able to reverse engineer and make replica Enigma machines, and then they could start working out what the settings problem was and how to how to solve that. So by the mid 1930s, the Poles were actually able to read German military Enigma traffic. But in 1939 the Nazis were getting ready to invade. So they upped their security again by first making two extra rotors. So now it was five to choose from, not three. And that's five times four times three. So 60 possible orders that increased the key space by a factor of ten. And on top of that they switched from using six plug board swaps to ten. That's around 150 trillion combinations from the plug board alone. So all in all, the key space had grown by a factor of 15,000 to over 100 sextillion. The Polish needed help, and by July 1939, they knew a German invasion was likely. So the Poles called an urgent meeting with British and French intelligence. They revealed everything they knew about the Enigma machine itself, the wiring, and they revealed everything they knew about the daily setup of the machine. Just over a month later, Poland was invaded. Their codebreakers fled and they had to leave behind the device they'd invented to break into Enigma messages called The Bomba. The Brits were now on their own. They were armed with the knowledge given to them by the poles, but now it was up to them to break the enigma.


人性惰性与协议缝隙:Cillies、赫里维尔线索与已知明文的局限

进入1940年后,德军意识到双重指示符的漏洞并修改了协议:操作员需明文发送3个随机字母(如 VER),将转子拨至 VER 后键入另外3个自选字母(称为指示符 Indicator,如 ITA)进行单次加密,随后将机器拨至解密出的 ITA 状态输入正文。理论上该流程极为严密,但在实际操作中,人类无法产生真正的随机性。操作员往往习惯使用女友名字(如 Cilla 缩写为 CIL,由此产生术语 Cillies)或常见地名(如明文发 BER 则指示符必为 LIN)。

与此同时,英国破译员约翰·赫里维尔(John Herivel)发现,德军操作员在每日凌晨按照密码表更换转子环设置后,在执行“随机旋转转子”这一规定时极度怠惰,通常仅将转子拨动一到两个齿位。这种习惯使得全网大量电报的起始字符在统计上呈现出围绕每日真实环设置的明显聚集,即著名的赫里维尔线索(Herivel Tip)。然而,仅凭人工推断操作员失误来穷举每天上百条电文的接线板和转子组合极其耗时(单个简单样本测试常需耗费数小时),面对纪律严明的高安全通信网络更是彻底失效。要实现常态化、工业级的实时情报破译,布莱切利庄园必须开发出能够针对物理机器漏洞进行自动化搜索的全新计算逻辑。

英文原文

Our producer has crafted an Enigma message, and I'm going to try and use all of the tips and tricks that the British knew about to try and crack this thing, see if I can get it right. FAO Gregor. Urgent decryption required. We're on it. Okay, so the first thing to look at is the top of the message. By the 1940s, the Germans quickly realized that encrypting three letters twice at the start of each message was a terrible security flaw. So they came up with a new system. After setting up the Enigma, the operator would now start each message with three random letters, for example VER, and they would send them completely unencrypted, naked over the air, and then they would set their own window settings to those three letters. So VER. With that the operator would pick another three random letters, say ITA. But this time they would type them through the Enigma. These three letters were called the indicator, and after this they would set their own window settings to the indicator so it reads ITA before finally typing through their actual message. Likewise, when a receiver got the message, they would know that the first three letters VER came through unencrypted and they would put them into their window settings and type out the next three letters in the message. They would get three decrypted letters out, ITA, and they would put those into their window settings next. And now they were finally ready to read the rest of the message. So a receiver is only able to decrypt the message if they could follow these two randomized checkpoints at the start of each message, which should have been a great security addition, except people are terrible at being random. People very rarely choose random letters. So, for instance, the German operator's girlfriend's name was one that was chosen quite a lot. So for instance, one common one is Cilla. Okay. - Which would be CIL. CIL. - Hence the term cillies. And it wasn't just girlfriends names either. So if the window setting you send in plaintext is BER, like you might be like, well, I wonder if they just chose Berlin. And so you would deduce, you just say I guess the indicator is probably LIN. Okay. So my message starts with Lon. So I'm guessing that the operator just chose London. So I know that CNG were encrypted from DON. Okay, so here's a universal simulator for the Enigma. And I can actually show you that if I put in the window settings on the rotors. LON, I know that if I type CNG, I'm supposed to get out DON for London, but for this to work, I need to guess the correct rotor order out of all of the rotors, and I need to get the correct ring settings and the plug board. So there's still a lot of guesswork to do for me to be able to get this right. Okay, so I'm now going to record some me actually trying this DON no, DON no. I'm, I'm struggling a bit. I won't lie, I am struggling a bit. But there was another way the laziness of the operators came through. It was spotted by a British codebreaker, John Herivel. He compared the messages from all over the network that came from many different operators, and he noticed something interesting. Those three letters the operators started their messages with appeared random, but they all seemed to be a very similar random. If you looked at just the first letter every operator chose across hundreds of messages. They weren't spread evenly across the alphabet. They centered around a specific location. Same for the second letter and same for the third. This happened because the operating procedure required the operators to shuffle the rotors from the default key sheet settings for the day, those ring settings. And as it turned out, a significant number of operators only shuffled their rotors by a position or two. It's sort of like how people lock their bikes and only move the rotors a small amount. Following the same logic, Harrisville concluded that the clustering of window settings around a particular set of three letters throughout the day actually revealed what the daily ring settings were, so this became known as the Herivel tip. So I know that the Herivel tip or the ring settings are MON, so I can convert them into, well, what that letter is in the alphabet. So M is the 13th, 15th is O, and then 14th is N. I don't know this by heart, I googled it. Now I know that if I type DON, I'm supposed to be getting CNG out. So now I've got to guess the rotor order for what rotors they were using today. And there were some hints, but besides that, it was basically just a lot of brute force. You just had to try them. Let's try one, two three. Don. No, no, not even close. 132 15 and 14 ZNG. Oh there we go. ZNG sounds pretty close to CNG that we're supposed to get. I think I've guessed the rotor order to be one, three and two. All that remains now is the plug board. So maybe a Z needs to become a C a Z and a C. DON. CNG! There we go. So if I was to change my window settings now to Don, that's that second step of randomization. ...THPKAKTQOG... okay this kind of looks like text. Looks like James. A D and an E. Haha, okay! Oh that took a while. There was a lot of plug board guesses, but I think I finally figured it out. It says James is a legend. James the producer. Okay, we got it. There we go. It took. How long did it take me? Pencils down, everyone. One hour straight. That's tough. But that was actually an easy example. Bletchley codebreakers would have been faced with figuring out multiple plug board swaps, and in a single message, it would be highly unlikely to use both the Herivel tip and the cillies, even with the operator errors to help them, codebreakers at Bletchley had to trawl through hundreds of messages each day just to get a clue of what the Enigma settings were. And doing this manually was a huge task. To make it even harder, some networks were much more secure and didn't have any of these human errors, making them far tougher to crack. So what Bletchley Park needed was an automated way to break these Enigma messages, and that came from exploiting flaws in the machine itself.


图灵的回路逻辑:已知明文攻击与接线板自消除电气闭环

进驻8号木屋(Hut 8)的艾伦·图灵(Alan Turing)确立了利用已知明文攻击(Known-Plaintext Attack: 基于推测部分对应明文和密文进行密码分析)的自动化破译路径。破译的关键切入点是纳粹前哨站每日定点发送的高度格式化电文(如每日清晨6点的比斯开湾天气预报 WETTERVORHERSAGEBISKAYA)。这种推测出的明文片段被称为猜想词(Crib: 密码分析中用于对照匹配的已知明文词汇)。利用恩尼格玛最根本的硬件缺陷——任何字母都绝对不会被加密为它自身(因为电流回路无法沿原线返回),图灵等人通过在密文上逐位滑动猜想词,只要出现任意重合字母即直接排除该位置,从而精准锚定明文在密文中的绝对对齐位置。

在确定明密文对应后,图灵构建了一种精妙的逻辑测试回路。假定在连续敲击下右侧转子逐位步进,明密文对会在特定位置形成闭合回路(例如位置6上 $R \leftrightarrow Y$,位置22上 $Y \leftrightarrow S$,位置9上 $S \leftrightarrow R$)。如果将三台处于对应转子相位的恩尼格玛串联,输入 $R$ 经过变换输出 $Y$、$S$ 最终应闭环变回 $R$。更具革命性的是图灵对接线板影响的化简:信号进出两台相邻串联机器时,前一台机器输出端的接线板与后一台输入端的接线板完全对称并相互抵消。因此,若外部接线板将 $R$ 替换为 $Z$,则三组裸转子系统内部也必须将 $Z$ 完美映射回 $Z$。图灵据此设计了电气测试网络:假设 $R$ 接线至 $Z$ 并通电,若该假设错误,电流会在电路网络中引发级联传导点亮多个导线,产生“单端同时连接多个字母”的逻辑矛盾从而瞬间排除该配置;若26根导线全部通电则说明当前转子位置完全不成立,机器自动步进至下一位置继续测试。

英文原文

You see, the weakest part of any encryption device is not the device itself. It's the human that's operating it. And kind of like the Enigma. Human error is also one of the biggest reasons why our information leaks onto the internet. You can make an account on the wrong website, or you give your phone number to the wrong company, and your data can end up in the hands of a data broker, who can then sell it on to scammers who can impersonate you online or target you with AI powered scams. But you can protect yourself against this with the help of today's sponsor, Incogni. Incogni contacts data brokers on your behalf, and then they request that those data brokers delete your information. I've been using Incogni since June 2025, and they've completed 143 requests on my behalf. And also it runs in the background. I don't need to do anything, so it constantly requests these removals. On their unlimited plan you also get your own personalized risk assessment each month, which means you get practical steps on how you can improve your online privacy. They also have an exposure scanner, which finds wherever your personal info shows up online, and they put it all in one place so that you can then choose what you want to take down with the help of Incognis human removal specialists. To get your data off the market today, you can go to Incogni.com/Veritasium and use the code Veritasium to get 60% off their annual plan. You can also click the link in the description or scan this QR code. So I want to thank incognito for sponsoring this part of the video. And now back to breaking the Enigma. So Bletchley Park needed to develop a way to automate the breaking of Enigma. And luckily for them, there was one man in particular who was uniquely qualified for the job. Alan Turing had already gained fame for his paper on a device that since became known as a Turing machine, so the British were quick to recruit him at Bletchley Park. When Turing arrived, he realized that if he could describe the process of breaking the Enigma as a sequence of some logical tests, then he could theoretically devise a machine that would do the job for him. So we're in hut eight, and this room is the one that apparently Alan Turing used as his office when he was put in charge of the naval Enigma problem. They've changed a tin tea mug to the radiator, which Alan Turing allegedly did. I think what happened was that people would take his mug away to wash it up, and then he couldn't find it when he wanted it. Can you tell me more about, like, what kind of a person he was? Really quite wicked sense of humor. Very irreverent and very interesting as well to to talk to if you were interested in the right kind of thing. So if you want to talk to him about a football game, then frankly, think again. But if you want to talk to him about the possibility to build a machine that might be able to play a game of chess, he’d have lots to say about that. To automatically break the enigma, Turing needed a logical test that a machine could perform some series of procedures, after which the machine would say, oh no, these are not the Enigma settings. They're wrong. You should try something else. Or yes, these could be the correct Enigma settings. Now you should try and decipher the message with them. The test that he ended up devising came from the fundamental flaw in the Enigma, and surprisingly, it exploited some of the most unimportant and mundane messages that the Nazis were sending. Certain German outposts sent very similar messages at the same time every day, and that would be a weather report. So, for example, if Bletchley Park intercepted a message every day at 6 a.m. from an operator in Biscay, the code breaker might reasonably guess that somewhere inside this message, there would be text that says weather report Biscay, or in German, WETTERVORGERSAGEBISKAYA. And there was a way to guess where that text was encrypted in the message. If I'm pressing an L, I can keep pressing the L on here, and the L on the lamp panel will never light up. You can't encrypt a key to become itself. No. Because the current can't flow back through the same wire, it has to go through a different wire. That means I can take this word and I can shift it over the enciphered text until I find a position where no letter is enciphered as itself. So if I start, for example, with W and Q aligned so that the two messages align at the start and I scanned through here, this S is enciphered as itself. So that isn't a possible solution. So I'm going to shift it one letter down and try again. Now I have a V enciphered as a V and an E enciphered as an E. So this doesn't work. So I'm going to shift another position. Oh no I have an R enciphered as an R. So that doesn't work either I'm going to shift it one more. That all looks good. So here we go. Bingo. Now there's no letter that is enciphered as itself. So my guess is that this part of the enciphered text says weather report Biscay. And this guess at what the enciphered text actually represents is called a crib. At Bletchley Park in hut eight they had what was called the cribbing room. This is Jonah Weinbaum. He wrote his thesis on how the enigma was broken. And the cribbing room, their job was to identify good, strong, consistent cribs, which consisted of either weather messages, patterns they had noticed across messages. The usage of slang or shorthand. After Turing was sure that he had a crib that reasonably guessed what the encrypted message stood for he started with his logical test. He assumed that at the start of each message, the window settings for the Enigma were ZZZ or 26, 26, 26, and that the second rotor hadn't turned in this part of the message. So as soon as the first letter is typed, the rightmost rotor turns to A or 1. At that position typing a W in the machine outputs an R, and that means that with the Enigma machine in this particular state, W is wired to R, and R is wired to W. As each letter is typed, the rightmost rotor moves one step forward, so when the window on the right reads two, E and W are wired together, at three, it's T and I, and so on. Now Turing notice that this encryption produced a kind of loop. For example, at position six, the Enigma machine maps R to Y, but at 22 it maps Y to S, and at nine it maps R to S. So Turing imagined taking a clone of the Enigma machine at each of these positions. Then the only difference between these machines is just the position of that rightmost rotor. It's either 6, 9, or 22. Now look what happens if you wire these three machines back to back, so that the output of Enigma 6 becomes the input of Enigma 22, and then the output of 22 becomes the input of nine. If Turing hit the letter R on the first machine, it would output a Y. Then the second machine would then transform that Y into an S, and the third machine would take that S back to an R, creating a perfect loop. R turns back into R. Now for this to happen, the settings on these three Enigma machines have to match the settings used to encrypt the original message, but if the settings don't match, for example, if the rotors used in the enigmas are different, then the test is extremely unlikely to produce a loop and R should turn into a different letter instead. This gave Turing the logical test he was after. Theoretically, he could create a machine that looks through all possible Enigma settings, such that when you offset the first rotor by 6, 22, and 9 an R is transformed back into itself. Now, out of millions of possible settings, there are multiple combinations that can transform an R back into itself at positions 6, 22, and 9. Turing's test could return hundreds of false positives, so he needed more logical constraints, which came in the form of more loops from that crib we saw earlier. Back in the message notice that R maps to W at position 1 and then W to E right after that, and then goes E to O at position 8, O to S, and then back to R, which completes the loop. Following this process, Turing built up an entire menu of these loops of logical constraints. But this whole test rests on the assumption that we've guessed the right rotor order. Remember that the Germans had five rotors to choose from, and they could slot any three of them into the machine in any order. That's 60 possible configurations. So Turing's machines had to run through this entire process again and again for each rotor order. And that still left one component unaccounted for, the plug board and the 150 trillion possible ways to hook it up. But even though this number is ridiculously large, Turing found a simple way to isolate the plug board's effects. Remember how a letter flows through the Enigma? First through the plug board, then through the rotors, then back out via the plug board again so we can break each enigma into three steps. If you type an R into the Enigma, it first gets transformed by the plug board to, for example, a Z and then that gets transformed by the rotors to a Q. Now this Q again gets transformed by the plug board to an X. So X is the letter that flows into the second enigma. But the plug board on the second enigma is set up in the same way. So it swaps that X back to a Q. So Q goes to X goes to Q. In other words, back to back plug boards cancel each other out. So we can actually simplify this long list of transformations to this. That means Turing could treat any series of Enigma machines as the plug board on the way in. Then the combined effect of all the rotors and then the plug board on the way out. But remember, with the correct settings, these three Enigma machines transformed an R back into an R, which means if the first plug board transformed an R to a Z on the way in, then the last plug board must have transformed a Z into an R on the way out. So the three rotors alone must also create a loop, transforming that same letter Z back into itself with no plug board needed at all. Much like the original loop through the three enigmas, Turing realized this formed the basis of a test, one that he could perform using a simple electrical circuit. He'd start with a guess, say that R is plugged to Z, and set that wire live. If the guess was correct, the three enigmas would transform that Z back to itself, leaving a single loop of live wires. If the guest was wrong, it's likely that Z would loop back to a different letter, and that letter would loop round to another and another. So current would keep looping around and around the circuit, setting multiple wires live. But that would mean that R was simultaneously plugged into multiple letters, which is impossible. This contradiction allowed him to rule out all these letters as a candidate for what R is connected to on the plug board, and if all 26 wires went live, he knew that there was no possible plug board configurations for that window setting, so his machine would move the rotors one step forward and start the test again. There were also cases where 25 wires could light up, leaving just one dark. Since those 25 possibilities had all been ruled out, that wire that didn't light up pointed to the only remaining candidate for are to be connected to on the plug board. This was Turing's stroke of genius, even though there were 150 trillion ways to configure the blackboard. Starting with this, one guess would allow his machine to rule out multiple possibilities or even reject incorrect settings entirely. The guests didn't even have to be correct for this to work. They did do this by hand. They did these contradictions, you know, on a piece of paper, following through what is implied. But Turing designed this machine so that it was instantaneous, like it was at the speed, not the speed of light. But the speed of electricity flowing in a wire.


炸弹机的工程实现与对角线板革命:消除假阳性的速度质变

在英国制表机公司工程师哈罗德·基恩(Harold Keen)的协助下,图灵将这一算法物理实现为炸弹机(The Bombe: 由英国研发用于自动破解恩尼格玛密钥的大型机电计算机),其首台原型机“胜利号”(Victory)于1940年3月交付。一台炸弹机等效集成了36台恩尼格玛逆向并行运行,遍历单套转子排列全部17,576种起始位置仅需约13分钟。然而,初代炸弹机存在严重的假阳性停机(False Stops)缺陷:由于猜想词构建的逻辑回路并不完备,机器频繁在内部自相矛盾的位置停机(例如同时推导出 $R$ 与 $X$ 和 $S$ 相连)。每一次停机都需要人工耗费约15分钟进行纸笔核验;若一次运行出现上百次停机,核验耗时将超过24小时,届时德军早已更换次日密钥。

剑桥数学家戈登·韦尔奇曼(Gordon Welchman)提出了挽救炸弹机的关键发明——对角线板(Diagonal Board: 利用接线板互易性建立的26×26双向电气矩阵)。韦尔奇曼洞察到接线板具备绝对的互易性(Reciprocity: 若 $R$ 连接至 $Y$,则 $Y$ 必然连接至 $R$)。对角线板在电气层面上将所有对称字母对相互铰接,使得任何一个推导出的假设或矛盾能够双向、雪崩式地瞬间在整个电路网络中蔓延。这一改造将假阳性停机率削减了90%以上(从上百次骤降至个位数),使炸弹机在1940年8月升级后真正具备了实战工程价值,为不列颠空战期间英国皇家空军合理调度最后预备队战机提供了无可争议的情报支撑。

英文原文

With the help of an engineer, Harold Keen, Turing brought his device to life. Based on some of the ideas that they got from the Polish Cipher Bureau just before the war started, Turing and his colleagues came up with this. He called it The Bomb, named in honor of the Polish Bomba, the device that the Polish mathematicians invented to break the earlier versions of Enigma. First prototype, arrived in March of 1940, which in itself is a pretty startling achievement, given the war only started in September 1939. Yeah. To get the civil service, to not only approve his design and then to get the finance to be able to build the thing. Absolutely astonishing. Anyway, this is essentially 36 Enigma machines working in parallel, working backwards. So you start with an assumption that you've made that a certain piece of ciphertext represents certain plaintext meaning. Give all that to the machine, let the machine go to work. And at the end of the process, the idea is you're going to derive the key of the day that the original Enigma operator was using to encipher that message, which means now you can read every message that that guy sent, not just the one that you're analyzing. And so when we run the machine, we're hoping for a condition when every enigma will find the answer it's been told to find all at the same exact instant. And when that happens, you've essentially solve this equation and the machine will stop and give you an answer. So what I'm going to do now is I'm going to run the machine. - Okay Let’s do it. It's going to be quite loud. Eventually you're going to get through all the combinations 26 times 26 times 26 17,500 or so. Yeah, it's going to take the machine about 13 minutes to go through all of those. Right? And at some point, we're hoping that the machine is going to find an answer that works. At which point it's going to come to a stop assuming the machine is actually working correctly. What are the chances that it is working correctly? About 90%. Okay, to be fair, that's good. It's better than my brain. -And mine. Okay, so what's going to happen? Machines found a solution. Okay, there we go. And if you look at these drums on the right hand end, that's where the solutions are indicated. These are called the indicator drums. It's the output from the machine. And if you look very closely you'll see a little pointer on each of those drums pointing to the letters D, K and X. So that's the machine saying I think DKX is an answer. Now I'm saying an answer, not the answer. The problem is that you might get multiple answers, because it's quite possible you'll find several solutions to the equation. And there is a flaw hiding in Turing's original test. Sometimes the machine would stop on what looked like a clean, valid loop, but in reality, that loop could be self-contradictory. It might imply, for example, that R was plugged into both X and S on the plug board at once, which is impossible. The machine had no way to catch this, and every time the bomb stopped and offered a solution, an operator would have to check it. So if there were 100 stops, each of which might have taken 15 minutes to check, that's more than 24 hours of work, by which point the Enigma settings would have already changed. The Bombe wasn't fast enough. By the time the first Bombe was operational, the Nazis were already occupying Austria and Czechoslovakia, and they had invaded Poland, killing hundreds of thousands in the process. Bletchley Park desperately needed a way to speed up The Bombe. Turing had managed expectations, so it came as no great shock. After that a mathematician called Gordon Welchman comes into the story. Welchman, another Cambridge mathematician, comes to Bletchley Park, working alongside Turing, and he comes up with a brilliant modification. Welchman realized that guessing R is plugged to Y is exactly the same as guessing that Y is plugged to R, so Welchman connected these two wires such that if one went live, they both would. He would do the same for S and Y and R and S, and this made it more likely that a guess at the plug board would set multiple wires live, so exactly the same input to the machine would rule out more potential plug board swaps, and therefore drastically reduce the number of false positives. Instead of the machine stopping and giving you 100 possible solutions to check out, you only get four. Which means that process was so much slicker. So welchman's improvement made the thing practical. Welchman's modification became known as the diagonal board, and Turing figured out that in many cases, the diagonal board could eliminate over 90% of false stops. This new version of The Bombe was ready in August 1940, but by now France had fallen along with Norway and Denmark. Britain was the last major power in Western Europe, and the Nazis had begun an aerial onslaught trying to bring Britain to its knees. We shall defend our island, whatever the cost. We shall fight on beaches. Hitler knows if we can stand up to him all Europe may be freed. During the Battle of Britain, when the question whether to commit the last reserve squadrons of fighters to the air battle over over Britain, the Air Force commander felt able to do that because the Enigma intelligence had reinforced his own perceptions about the balance of forces. And we all know that the outcome of that battle was a victory for the British and a strategic defeat for the Germans.


战争天平的倾斜与历史回响:大西洋战役、四转子危机与图灵的计算遗产

破译恩尼格玛情报(代号 Ultra)直接改变了二战格局。在北非战场,破译电文揭示了德军严重的燃料补给短缺,蒙哥马利将军据此发动阿拉曼战役取得转折性大胜。针对大西洋潜艇战中德国海军升级的四转子海军恩尼格玛(M4),图灵开发了基于贝叶斯统计概率的 班伯里分析法(Banburismus: 用于推断转子顺序与减少计算量的统计分析技术),并配合皇家海军的“园艺行动”(Gardening: 通过在特定海域空投水雷诱使德军报告扫雷坐标以获取已知明文)以及一线海军官兵冒死缴获的密码本彻底瓦解了 U 型潜艇群的“狼群战术”。到1943年,美军加入并制造了上百台炸弹机,盟军实现每日全网破译,据历史学家测算,这使二战至少提前两年结束,挽救了数百万人的生命。

然而,破译恩尼格玛只是现代计算历史的起点。1944年诺曼底登陆前夕,希特勒与德军最高统帅部通信所使用的并非恩尼格玛,而是基于5位博多码、由12个转子驱动的洛伦兹密码机(Lorenz SZ40/42)。其密钥空间高达 $10^{170}$(远超可观测宇宙中原子总数的平方)。为了攻克洛伦兹密码以验证诺曼底欺骗战役的效果,布莱切利庄园随后研制出人类历史上第一台可编程电子计算机巨人机(Colossus)。图灵战后投身于通用电子计算机的设计与早期程序设计,他与布莱切利庄园奠定的逻辑与算法架构,至今仍是现代计算科学与信息安全理论的核心基石。

英文原文

By the end of 1941, the British had 16 Bombes in operation, six at Bletchley and ten in the nearby towns, and they were routinely deciphering German Army and Luftwaffe Enigma traffic. This intelligence would soon help turn the tide of the war in North Africa. Enigma decrypts reveal that the German army was critically short of fuel and supplies. Armed with that knowledge, British General Bernard Montgomery launched the offensive that culminated in the victory at the Second Battle of El Alamein in 1942. What Turing did was so resilient to protocol changes that it would have worked at any time prior to this. It is fundamental to the structure of the Enigma machine, and it's so fundamental that they actually ultimately had to change the machine itself in order to try to avoid this, just to make it like marginally more difficult for them to to continue doing by adding a fourth rotor. And then even doing that was a nightmare for them, because you have to have it be back or it's compatible. So it's like they kind of once Turing did that, it was like, game over. You either reinvent the entire machine or, you know, prevent them from knowing any information whatsoever. The German Navy did just that. They added a fourth rotor to the Naval Enigma machine, and they created three extra rotors to choose from. Because of that, Turing had to invent a whole new statistical method to narrow down the choice of rotors, and they also had to work with the Navy to capture key sheets and trick the Germans into revealing a crib. And they had to call in the military to try to generate plaintext for them with gardening. Well, sometimes if they were really struggling to get plaintext, like in the case of the blackout with the Naval Enigma, they would basically tell them to seed mines in particular locations, and then those places would have to go and clear them out. And so they would have to say the location. - Oh that’s genius! Yeah. Oh, that's really cool. But even then, the codebreakers relied on the members of the British Navy sacrificing their lives to capture vital intelligence from sinking U-boats. I am conscious all the time that codebreaking is not the same as combat, and battles are not won by codebreakers sitting in rooms in the safety of Bletchley Park. They're won by people at the sharp end of things. By 1943, the Americans had joined the war and built over 100 Bombes of their own. You can see the turning point of the war being when the British finally mastered the U-boat Enigma in 1943, the sinkings drop like a stone, and instead the U-boat sinkings start to rise. And that's that's the point at which Germany has begun to lose the war. I'm not trying to say that Germany lost the war solely because of the, U-boat thing. I mean, obviously the Eastern Front was crucially important too but all these things conspired to mean that basically, by the end of 1943, everybody apart from Adolf Hitler knew that the Germans were going to lose. Enigma traffic from all Nazi forces was now being deciphered daily. This set the stage for the D-Day landings in 1944 and the Allied invasion of Europe. Historians estimate that the breaking of Enigma shortened the war by up to two years, and who knows how many lives had saved. Alan Turing's life story is dominated by his sexuality and what happened to him. Bearing in mind that being a practicing homosexual in the UK was still illegal for the whole of Alan Turing's lifetime. That story is very strongly colored by the fact that Alan Turing took his own life. That tends to lead to a chain of connections in people's minds, that that means that his whole life after World War II was on a downward spiral. I have to say, I disagree. From 1945 through to 1950, he was involved in the most exciting technology projects that the country had on offer. He was very frustrated from time to time because they weren't going fast enough. You know, he was writing programs for computers that weren't yet being built. So I think he achieved a great deal in the postwar years. And I have to say, I think that the end of his life does not actually define what happened before. And I think that we're looking at it the wrong way. If we see him as some sort of martyr. In 1944, Allied forces were preparing to invade Europe. But before they did, Churchill and Roosevelt launched one of the most important misinformation campaigns in history. They leaked information to the Nazis that they were going to land on a different beach. The deception plan about where the invasion of Europe was going to take place, was it going to be in Normandy or was it going to be at the Pas-de-Calais? But before the allies could land at Normandy, they needed to know whether this misinformation campaign had actually worked. And that meant deciphering messages from Hitler himself. Now that the enigma had been broken. That should have been easy. But Hitler actually didn't use Enigma. He used a completely different encryption machine, one that the allies had never seen. And while Enigma had a key space of around ten to the power of 23, this machine had a key space of ten to the power of 170. That's greater than the number of atoms in the observable universe squared. To break this would require a piece of genius that had been described as the greatest intellectual feat of World War Two, and the building of an entirely new machine vastly more sophisticated than the Bombe. Yet you've probably never heard of the guy who built it, or the codebreakers who made it possible. That's because this device was so important during the Cold War that it was classified for decades after the bomb and the Enigma. If you want to hear about it. Let us know in the comments. Hey, I just want to give a quick shout out to Bletchley Park, the National Museum of Computing and Sir Dermot Turing and every expert here who has helped us make this video possible. If you're interested in visiting, all the links are in the description, so check that out. One last thing, by the way, there's still a Naval Enigma message intercepted in the war that no one has been able to decrypt. The ciphertext is in the description. Maybe you can break it. Let us know if you can.

文中提及的人物和组织

人物: Alan Turing

公司/组织: Bletchley Park

产品/模型: Enigma, Bombe