Articles
Resource
Game Mastering
4.83
3 Votes

25xp


Hits: 1640
Comments: 3
Ideas: 0
Rating: 4.8333
Condition: Normal
ID: 8576

Submitted:

Updated:
November 14, 2016, 4:02 pm

Vote Hall of Honour

You must be a member to use HoH votes.
Author Status

Options


Enigma Ciphers

By:

The Enigma - the 'unbreakable' German WWII cipher that has become an icon of cryptography and mystery. Learn how it works and why it is a great cipher for role-playing games.

The Enigma was a cipher used in World War II by Germany to encrypt military communications. The cipher was originally deemed unbreakable, but was broken by British cryptologists using some pretty clever thinking.

Let's go through the Enigma step-by-step, building up the cipher and see how it works, what its weaknesses are, and why it might be useful in your campaign.

All code is available on Github.

Substitution Cipher

A substitution cipher is one of the easiest ciphers there are. You simply shuffle letters around. The cipher can easily be cracked by checking letter frequencies.

Cipher Rotation

Suppose we fix the substitution cipher and embed it in a disk. Now, every time we go to encode a letter, we first rotate the disk by one letter.

We are effectively cycling between four different substitution ciphers, making decoding the cipher more difficult.

Multirotor

We can do even better by stacking several disks together. We won't rotate them in-sync, as that would effectively make it a one-rotor system. Instead, we always rotate the first rotor and only rotate the upper rotors when the one below has undergone a full cycle.

Again, we are effectively cycling between substitution ciphers, but the number of substitution ciphers is much larger. (4 above, 4*4 here).

Reflector

The next thing we will do is add a reflector to the back of the disk stack. It joins pairs of letters so that everything loops back through the disks. This has several effects:

  • You pass through the rotors twice
  • At every step letters are paired, so for every A -> B, you also have B -> A
  • No letter can map to itself

The second point has an excellent side effect that made using the Enigma quite nice in practice. Letters are paired, so if you encode a message, you can decode it by running the ciphertext through the machine as if it were the input text. The decoding setting is identical to the encoding setting! This reduces the amount of info you need to effectively use the system on the battlefield.

The third point is a source of great weakness, and was exploited by cryptographers to break the Nazi code. It allows for dictionary attacks.

Consider the example above. We intercept the ciphertext "CTCSCCASSSACCC" over the radio. We want to break it. Suppose we think the sender included the word "CAT" in their message. Cats are, after all, the first word that came to mind with the limited alphabet I chose.

We can place CAT at the beginning of the ciphertext and compare it: "CTC". We know immediately that the first three letters are not CAT, because C -> C is not possible.

So we slide CAT down one, and compare it to "TCS". C->T is possible. A -> C is possible. T -> S is possible. Hmm, that word could be CAT! Let's check it....

Searching for words like those found in daily weather reports was how the real Nazi code was broken, and it was made possible by the reflector.

Plugboard

The final thing we add is the plugboard. This was an extra layer on top that allowed the sender to switch around pairs of letters.

If you look at the number of possible machine states that you need to check for an Enigma machine, it turns out that most of them come from the plugboard.

Full-Size Enigma

The real Enigma had 26 letters, three rotors that could be chosen from a set of eight, and a plugboard that allowed for up to 10 letter pairs. The provided code was tested against an Enigma emulator and can be used to encrypt or decrypt real Enigma messages. Double-stepping is enabled for Enigma machines.

Use in Your Game

Now that we know how the Enigma is constructed, we can consider using it in game.

The basic components of Enigmas make good game tools and props.

You Find a Rotor

Perhaps the players find an enigma rotor, and must deduce what it is and how it was used. Decrypting a single-rotor rotation cipher when you have the physical rotor is a lot easier - you only have to try the 26 different possible starting positions.

You Find an Enigma

Perhaps the players have access to an entire Enigma machine! There are several emulators online that you could let the players play with.

Deciphering Enigma ciphertext yourself is incredibly difficult. The Nazis thought it impossible. It took immense resources and dedicated hardware to crack it back in the day. But we have computers now, and if your players are leet coders and code crackers you can let them have a stab at it.

Instead, I recommend giving the players encoded text, but then having to go about finding the code book / enigma settings to decode it. A plethora of options present themselves. Do they raid the officers quarters? Do you trust the street urchin who is willing to sell you a grubby piece of paper he found in the streets that contains funny numbers?

If you have an Enigma you can also use it. Do your players coordinate with allies, or each other, using their own code book? How do their enemies attempt to crack it? What are the players willing to do to prevent it from getting in the wrong hands?

Water-Soluble Codebooks

Code books play a huge role in cryptography. Everyone on your side has to know what the daily codes are so that they can send and receive messages. The Nazi codebooks were written with special ink such that they would dissolve when their U-boat sank.

In one famous case a Uboat was destroyed, and the Nazis evacuated, assuming that the water would destroy the code book. Three Royal Navy sailors boarded the sinking Uboat and recovered the codebook before it was harmed. This was crucial to helping the allied code breakers, especially since the axis did not know that the codebook was obtained.

A similar setup could be created for your campaign. Are your players willing to risk diving into the sinking Uboat?

Code

All code used for creating the visuals is available online. It is written in Julia, which is a free, open-source language.

You can use JuliaBox to get started.

Code is provided as-is, but feel free to submit issues and/or pull requests.



Additional Ideas (0)

Please register to add an idea. It only takes a moment.

Join Now!!



Gain the ability to:
Vote and add your ideas to submissions.
Upvote and give XP to useful comments.
Work on submissions in private or flag them for assistance.
Earn XP and gain levels that give you more site abilities.
Join a Guild in the forums or complete a Quest and level-up your experience.
Comments ( 3 )
Commenters gain extra XP from Author votes.

Voted Dozus
November 14, 2016, 19:43
5xp
This is a really awesome and well-explained (and illustrated!) dive into cryptography. I kind of knew how the Enigma machine work, but you made it concrete for me.

You mostly talked about a modern setting with computers and whatnot. I wonder how it could be adapted to a fantasy setting. Some of the less complex methods you mentioned that are components of Enigma could be employed with more basic technology. I can see a Da Vinci type coming up with such an encoding system in an earlier era.

For added fun, a physical decryptor would add a lot to a game. Here's a 3D printed Enigma device: http://hackaday.com/2016/10/21/3d-print-an-enigma-machine-thats-close-to-the-real-thing/
Simpler tools like Caesar cypher wheels can be made with even more ease.

Anyway, this excellent sub sparked a lot in my mind. Very well done.
Voted Skull
November 15, 2016, 10:18
6xp
I was also trying to figure out how to apply this to a fantasy setting. I was thinking instead of using a plug-board I might use a set of runes that correspond to north/south/east. (In essence, still a plug-board, just with a fantasy flare.) And most likely I won't be using a reflector to make it a little easier for my players. However if I was to use a reflector I would add "west" to the runes and also give them one designation of orientation when reading left to right, then another for reading right to left. (It makes sense in my head. I'm just not sure I'm making sense to anyone else.) Anyway, well done and I'm going to get to work on this cipher for my campaign right away!
Voted valadaar
November 15, 2016, 10:36
5xp
This is a top-notch article here. Can't add more other then to say thank you for this article. I have read a lot of WWII history and although I knew what the Enigma machine was, I really did not clearly understand how it worked. This helps immensely!

Freetext



Random Idea Seed View All Idea Seeds

       By: Scrasamax

Expansion from the Horse Brass item: Specific Armor charms.

Cooling Touch Charm: protects horse against extreme heat, and fire, magical and mundane

Jove's Favor: tin charm shaped by a lightning bolt that protects a horse primarily from natural lightning, but also potentially from lightning based attacks. In real life, lightning kills quite a few horses and cattle a year.

Hermes' Blessing: gold charm that grants the horse magic resistance, and perhaps immunity to cantrip level magics.

Vulcan's Steed: This large iron charm in epic fashion renders the steed invulnerable to iron weapons. Such things clatter off of the animal's hide like twigs.

Ideas  ( Items ) | June 7, 2004 | View | UpVote 0xp


Creative Commons License
Individual submissions, unless otherwise noted by the author, are licensed under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
and requires a link back to the original.

We would love it if you left a comment when you use an idea!
PayPal
Powered by Lockmor 4.1 with Codeigniter | Copyright © 2013 Strolen's Citadel
A Role Player's Creative Workshop.
Read. Post. Play.
Optimized for anything except IE.
0.0190