The mystery inside an Enigma
September 1, 2019 10:15 AM   Subscribe

This notebook simulates an Enigma Machine and visualizes how it works.
posted by zamboni (15 comments total) 21 users marked this as a favorite
 
I found out that a woman who lived in my childhood neighborhood worked at Bletchley Park. She's a retired mathematician. They let her tell people that this happened about 2000, I think.
posted by thelonius at 10:36 AM on September 1, 2019 [2 favorites]


AVKFAIMG
posted by glonous keming at 10:42 AM on September 1, 2019


That's pretty slick, and really does help illustrate how the machines worked.
In the default example (hello world) though...How would the receiving side know there should be a space between "hello" and "world"? Just being a fluent speaker of the language and recognizing individual words as they appear?
posted by Thorzdad at 10:43 AM on September 1, 2019


New necessities emerging.
posted by Oyéah at 10:48 AM on September 1, 2019


In the default example (hello world) though...How would the receiving side know there should be a space between "hello" and "world"? Just being a fluent speaker of the language and recognizing individual words as they appear?

They either left the space out or replaced it with an x, which is more or less the rarest letter in written German. In written languages with vowels it's still possible to read sentences fairly easily without word dividers eg: theyeitherleftthespaceoutorreplaceditwithanxwhichismoreorlesstherarestletterinwrittengerman.
posted by kersplunk at 10:59 AM on September 1, 2019 [2 favorites]


They either left the space out or replaced it with an x

Wouldn't replacing it with an X introduce a glaring cryptographic weakness?
posted by thelonius at 11:07 AM on September 1, 2019 [2 favorites]


A weakness certainly - one technique the Polish used to help break codes pre-WWII was relying on the fact that so many messages started with ANX - the German for "to" followed by a space. There were other weaknesses, such as the fact that a letter was never encrypted as itself.
posted by kersplunk at 11:28 AM on September 1, 2019 [7 favorites]


Wouldn't replacing it with an X introduce a glaring cryptographic weakness?

In short, the Enigma Machine was considered "unbreakable" because it changed how the characters were replaced with each letter typed.

In more detail, there are five different rotors, of which you select three (the three internal rings in this "notebook"). Each letter pressed cycles the first rotor one step forward, until it gets to the beginning of the cycle and it shifts the next rotor, again changing the characters. There's also the reflector (the central "hub"), and the "advanced" models had additional patch cables and a plug board (also featured in the linked site), to further mix up letters.

If that's confusing, see Numberphile's tutorial with an original Enigma machine, found via Open Culture.
posted by filthy light thief at 12:56 PM on September 1, 2019 [1 favorite]


Yes, I know how an Enigma machine worked. It was considered "unbreakable", but it was not so. I suspect that using an end-of-word marker such as the character 'X', in the plaintext, is a weakness that cryptographers could exploit, regardless of the scheme used for encryption, and especially if they could consider how that would be encrypted by a known device. I don't know enough about cryptography, though, to be certain of that.
posted by thelonius at 1:05 PM on September 1, 2019


"notebook"

Notebook in the sense of an interactive, editable document defined by code, q.v. Observable, Jupyter, nteract, etc.
posted by zamboni at 1:14 PM on September 1, 2019 [2 favorites]


Metafilter: OFC OZXKYDG AMJQPN LS OZGYAL
posted by stevis23 at 1:40 PM on September 1, 2019


I suspect that using an end-of-word marker such as the character 'X', in the plaintext, is a weakness that cryptographers could exploit, regardless of the scheme used for encryption, and especially if they could consider how that would be encrypted by a known device.

The initial commerical enigma machines were vulnerable to statistical analysis of letter patterns (e.g. repeated use of X), which would help detect the rotor settings and thus break the message. The germans added the plugboard which added a far greater range of possible settings to the machine. They also limited individual message length encrypted with a given message key, both of which made statistical analysis pretty much worthless.

However, they also added the reflector. This meant that two machines set to the same settings could encrypt on one and decrypt on the other. It also meant that a letter could never be encoded to itself, which was the key cryptographic weakness that meant it could be cracked.

I.e. you'd look for a plaintext continuous sequence you expected to be in the message (such as weather reports) aka a 'crib' and find likely positions it could be in the encrypted message, given that the plaintext letter could never occupy the same position as the encrypted one. Then you could try and reverse the settings that could give you that encrypted section. The Poles created a type of lookup tables that enabled them to speed this up, which they passed to the British. The germans then added additional choices of rotorwheels with unnown wiring, which were switched around every day according to a common codebook (along with the plugboard), greatly increasing the possible initial setup conditions and making it near impossible to crack.

Another attack was against lazy operators, where they would leave the machine on it's very inital setup when they sent the first message key of the day, which then could be used to reverse find the rotor positions and get a headstart. It was still very hard to get the settings for the day, and failed much more often than they succeeded; then the settings would change at midnight, and they'd have to start again.

Turing's electromechanical bombe took a crib+ciphertext, and the way the engima was built so that it could eliminate the vast majority of the daily setup possibilities that could not create the known cipertext from the suspected crib - and simulated multiple engimas simultaneously to do so much faster than a human could. And they built more, so they could run more possible settings simulatenously and crack it faster.
posted by Absolutely No You-Know-What at 3:41 PM on September 1, 2019 [3 favorites]


By Metafilter's own genius tmcw. Check out his music posts here to soundtrack the Enigma demo.

And yes, it's notebook as in notebook computing. This visualization is built in Observable, Tom's startup along with Mike Bostock for doing notebook computing in the browser. Think of it as a very advanced version of JSFiddle or Gists, or a Javascript-centric version of Jupyter. If you scroll down the code is visible, although it's collapsed by default. Click the vertical dots and choose "edit" to show the code, the encrypt function is a good place to start. If you actually change the code it automatically updates and runs the new code for you.

There's another nice Observable visualization this week: Robust Arithmetic in Computational Geometry. This one shows how numerically unstable simple geometric algorithms are. mourner's been hacking on that one regularly; every time I look there's new stuff on it.
posted by Nelson at 3:48 PM on September 1, 2019 [3 favorites]


I like the visualization of the rotors as concentric rings. He's a smart one, that tmcw.
(his cousin Ryan makes nice music, btw)
posted by scruss at 5:06 PM on September 1, 2019


Tom blogged some notes about the success of his Enigma visualization
This was a lucky project to work on. Sure, there’s the implementation, which was tricky and required a few interlocking areas of expertise. But anyone else, given enough time, could have created something similar. It’s more that – by knowing Dana, by reading Jason’s book, by noticing that the Enigma was neat looking, by working at a company focused on explaining things, by having the ability to set some 9-5 time apart to work on this project for months on and off – and confirming that nobody had already claimed the task of creating a cool visualization of it - it all sort of lined up, in a way that’s much more luck than skill.
posted by Nelson at 6:30 PM on September 4, 2019 [1 favorite]


« Older Harvard Art Museums begin to address their racist...   |   "Finally straight people will have their voices... Newer »


This thread has been archived and is closed to new comments