Code of Vengeance
I’ve been promising to blog about this for a while, and have finally found some time to do it. As readers of Sword of Vengeance will know, there’s a passage in the book where Schwarzhelm comes into possession of a coded letter written by his old master Lassus, which he then works to decipher.
In the original draft of the novel, the contents of the letter were reported by Schwarzhelm’s aide, Pieter Verstohlen. After reading the draft, my editor Lindsey Priestley had the bright idea of generating a real code that could be solved by the reader. I was a bit daunted by this idea for a while. The more I thought about it, though, the more I liked it, and so I started to do some research.
I didn’t know much about historical ciphers, so had to read around for a bit. Warhammer Fantasy is set in a roughly renaissance-era mythical Europe, and the military forces of the Empire operate like 16-17th century Germans. That placed a few constraints on what I could come up with. The code couldn’t be too complicated, since time and resources on a battlefield are limited, and also because the vast majority of the Empire’s population are illiterate anyway. And it would need to be solvable using quill and parchment – no Enigma machines necessary.
The simplest code type is a substitution cipher. This involves swapping letters in the plaintext (the text that needs decoding) with replacements to create a jumbled mess, called ciphertext. So, for example, a very basic code would involve shifting every letter three places to the right in an alphabetical sequence (so an ‘a’ becomes a ‘d’, a ‘b’ becomes an ‘e’, and so on):
Plaintext: Kill them all!
Ciphertext: Nloo wkhp doo!
Not very difficult to decipher! I wanted something slightly more challenging. Tougher substitution schemes, such as the one invented by Giovan Battista Bellaso in the 16th century, use a key – a short word – to add some complexity. This kind of cipher is more commonly known as a Vigeniere cipher, which is what I based Lassus’s code on in the book (Verstohlen calls it a ‘Vignius’ cipher in his letter in the epilogue).
The idea here is that instead of shifting, say, three places every time, the decoder has to shift by a different amount every time he decodes a letter in the ciphertext. The amount he has to shift by is given to him by using the key. If you have the key, then decoding the ciphertext is relatively easy. If you don’t have it, then it’s very difficult.
To see how this works, we need to use an alphabet table like the one on the right. Suppose I use a key of ‘Altdorf’, and I want to decode the instruction ‘Kill them all!’. I start with the first letter of the key, ‘a’. This gives me the row that I need to use in the alphabet table. Then I find the column headed by the first letter of the plaintext (‘k’). Where the column and the row meet gives me the first letter of the ciphertext: ‘k’. You then repeat this process with the second letter of the key (row ‘l’) and the second letter of the plaintext (column ‘i’), which gives ‘t’. Once you run out of letters in the key, then you just loop round and start again.
Here’s how the whole thing translates (with spaces removed):
So, that tells you how to encrypt some text. In the book, the challenge is the opposite – Schwarzhelm needs to work out what Lassus was saying. Without the key, this challenge is almost impossible. However, he stumbles fortuitously across the keyword, which is ‘Wenenlich’ (the name of Schwarzhelm’s home village). Once they have this, they have a chance of cracking the code. On page 207, an extract of Lassus’ letter is reproduced:
To decode this, you need to use the alphabet table again. The process is very similar, but you’ll need to get your letters from the top of the table, rather than the middle of it. Just as before, move to the row given by the first letter of the key (‘w’). Now scan along that row until you get to the first letter of the ciphertext (‘j’). Once you’ve found that, scan up the column to get the letter at the top (‘n’). That’s the one you need. Once you’ve done that, repeat the process with the second letter of the key and the second letter of the ciphertext, and then again and again, until you go mad from frustration or boredom.
To get you started, here’s the first bit done for you:
You might be thinking ‘What the hell’s nhlreplyt?’ Well there’s a final complication. Even after you’ve deciphered the text, you’ll discover that (a) there are no spaces and no punctuation, and (b) there are plenty of abbreviations. So ‘n’ is a fragment of a preceding word, and ‘hl’ are the initials of Heinrich Lassus.
In case all of that sounds like far too much hard work, then here is the ‘raw’ deciphered text. Don’t carry on reading if you don’t want any spoilers!
And if working all that out is too much of a chore too, then here’s what it looks like with spaces and punctuation added and some abbreviations expanded:
…n. HL reply to last message. LS sent south. His man Gruppen in Ostland. Only Grunwald remains of command staff. Will be with you soon. Cannot help feel regret for part in this. Was time when loved him as son. Even now do not think will break easily. Proceeds joyroot distribution received. Deposited securely. All else in hand. Still caution against Helborg but you make own mind up. After much work greenskins ready to play part. Defences weakened and funds received Black Fire Keep safely. HL.
So there we are. That’s how to decode and encode messages written in the ‘Vignius polyalphabetic cipher’ that Verstohlen refers to in the epilogue. I hope that anyone who tried it had fun, and didn’t end up with a broken brain (as I did, sadly, trying to write the damn thing).