It’s what I believe to be an undiscovered – or unnoticed – variant of the Rail Fence encryption method.
I have an ongoing interest in something called the Dorabella Cipher, about which I’ll blog in more detail at a future date.
Related to that subject is another, probably even more esoteric, concerning Sir Edward Elgar‘s possible use of visual mnemonics in the form of “hairy footballs” to remind himself – or to signal to a recipient of a coded message – what the specific symbol-to-letter mapping sequence was for a specific message.
Likewise, I’ll blog at more length about that later.
Today’s post is about something I discovered while trying to work out how Sir Edward Elgar (known to his friends and family as EE) might have encoded the message that has resisted decryption efforts for – well, since 1897, which is when he wrote a rather cryptic looking note to a younger lady friend, a Miss Dora Penny, known to both EE and his wife through the lady’s stepmother.
In support of this caper investigation I developed a rough and ready TTF font for use in various applications (such as Microsoft Word, Excel, PowerPoint, etc., or any of a thousand other applications that make use of fonts). It seems to get output to PDF well enough, too, which is an added bonus.
It can be downloaded from this site (right-click on that link and opt to save the target onto your local machine), and installation is straightforward – it should generally only be necessary to just drag it into your Fonts folder (although older OSs may require it to be formally added through a wizard).
You won’t need it to follow this particular part of this mini-series (it’s a little complex but not impossible to follow), but you’ll need it if you want to play with the Dorabella Cipher in the posts to come.
To start with, I’ll provide a brief overview of the Rail Fence encryption method so that we all start on the same page.
There’s an article on Wikipedia about Rail Fence if you want to go that route first, but it does seem to omit some key variants of the technique (and there are many).
The basic method is very simple. Take a message (such as “here is a simple message”) and write it out over several lines (the number varies according to the flavour of Rail Fence you choose to use) so that the 1st letter of the message is placed on the first line, the 2nd letter goes on the second line, the 3rd on the third, and so on, until you reach the bottom line, at which point you continue writing out the message, but in the reverse direction (towards the top line) so that you zig-zag up and down like so:
The re-arrangement of the message is achieved by reading off the letters row by row, starting from the top line, and concatenating the rows, thus:
h i s e s m s a r a p e g e s l m e i e
One variant adds padding letters to the end if necessary and another breaks up the final string of re-arranged letters into equal sized groups (five seems to be a commonly chosen number). Yet another variant reads the rows following a pre-arranged sequence (such as 2nd row first, 5th row second, 1st row third, and so on), and still another re-arranges the text of the message first, according to a similar scheme, before writing it out onto the rails.
To reconstitute the message it’s generally necessary to know the number of rows used – and this is usually agreed beforehand between the sender and the recipient. Knowing the boundaries (end points) of the rows helps considerably, but it isn’t too hard, providing the number of rows is known.
In fact Rail Fence is so easy to crack because of its repeating nature that it’s generally considered a trivial matter to write code (VB, C++, whatever) to perform the decryption even if the number of rows or rails is not known.
The variant shown above is sometimes referred to as the “W” variant, which may be obvious: the zig-zag appears to be a series of “W”.
Another variant is the so-called “M” style – an inversion of the “W” style – and it yields a slightly different re-arrangement of the letters:
In this case the result of reading off the rows is:
i e e s l m e r a p e g e s m s a h i s
Other variants of the arrangement of letters on the rows include the left-leaning diagonal and its counterpart, the right-leaning:
h s p s e a l s r s e a e i m g i m e e
i m e e e i m g r s e a e a l s h s p s
Each variant re-arranges the original message differently, and as such is more of a steganographic method than an encryption method, because the original letters in the message are simply moved around according to a rule or rules, rather than being substituted by one or more different letters (or symbols).
Even so, the regularity of the re-arrangement makes the method quite unsuitable for serious work.
Musical Rail Fence (MRF)
It may not be immediately obvious, but the musical staff or stave makes a handy substitute for the rails in a rather less predictable version of Rail Fence. But there are two things to bear in mind.
- Notes can lie on the stave or between the lines, so any representation as a rail fence has to take that into account. The usual five-line stave is actually a nine-line railset in its reincarnation as a rail fence variant.
- We don’t care about the duration or timing of the notes (except that they should only form a single note melody – there should be no grouping of notes to form chords, at least not at this stage of the game (that’s getting way ahead of ourselves, and my research))
Something like this simple melody, for example:
actually only has notes on 5 out of the possible 9 positions (EFGABCDEF – or more, bearing in mind that notes can be placed above or below the stave).
In Rail Fence terms, this is equivalent to:
To underscore the effect I have placed filled circles where the notes fall, and then added a single word (“messages”) arranged to follow those notes exactly, as an example. The shaded lines correspond to the actual lines contained in the five line stave (and to further emphasize that I have included at the left hand side the sequence of letters in the scale as it applies to the stave). Note that although there are many more rails available than are actually used, it doesn’t matter.
Thus we can take a sheet of simple music that already exists (that’s key) and map a plain text message onto the notes in sequence, then read them off line by line and concatenate them together. For that single word “messages” the re-arrangement yields “emassegs”.
If by chance the chosen melody is shorter than the message to be re-arranged, once the last note is reached the user simply returns to the beginning of the melody and continues writing out the message, looping as many times as is necessary to compile the re-arrangement.
For a single word like “messages” it’s obviously no big deal; running the text through an online anagram analyzer would pretty swiftly yield a potential solution. But for a much larger message it’s nowhere near as straightforward.
So technically all the recipient needs to know is the specific sheet music that was used to re-arrange the original message.
This makes the method similar to that used in Public Key Encryption, with the difference that the key doesn’t need to be exchanged (the key being the sheet music), only a reference to the specific music involved (which itself could be hidden in any one of a number of ways – even whistling the melody out loud could be the reference, as long as (a) the sender can whistle and isn’t tone deaf, and (b) the recipient can recognise the melody and isn’t tone deaf either!)
To decode, all that needs to be done is to write down each letter in the ciphered message in sequence, starting with the highest note(s) and working downwards, line by line, following the notes as they lie on each line. If the message is longer than the melody, once you have filled all the note positions with letters, you continue from the beginning of the melody and repeat as many times as is necessary. This could be relatively trivial to code to create an application that can do all the work for you.
Next time I’ll include a worked example using a simple melody, and then show a worked decoding to obtain the original message.
This case is one in which a previously created musical score is employed to re-arrange a plain text message. An obvious variant is to encrypt the message first, using any one of a number of very simple encryption systems, and then re-arrange the already ciphered message to make it even harder to decrypt.
What comes out of this is an encrypted message that’s almost impossible to decrypt without knowing exactly how. Further, if you undertake an analysis of the letter frequencies (for example, calculating Friedman’s Index of Coincidence) the result will be the same as if you had applied that analysis to the original plain text.
This is what seems to happen with the Dorabella Cipher: Friedman’s IC indicates that the message has been written in either regular English or something close to it. As you’ll see when I post details of my own research, the situation with regard to Dorabella is potentially even more complicated.
There is another case: the possibility of taking a plain text message and re-arranging it into either a single anagram or a group thereof using a variety of approaches. The relationship between the message and its anagram yields a melody – so that aspect could be employed as a compositional aid.
Further, a plain text message can be re-arranged so that it is sorted alphabetically, and the relationship between the sorted and original text also yields a melody.
In addition, the same process can be applied to the re-arranged message after it has been processed using a simple melody – that is, sorting the letters in the re-arranged message and either applying a compression method that masks the result still further, or utilising the relationship between the enciphered text and the sorted enciphered text to yield yet another melody (as either a compositional aid or to create a piece of sheet music that could be exchanged).
There is an additional aspect to the sorted text, namely that the relationship between the original and the sorted sequence can be processed in two different ways, one of which applies a positional significance to multiple instances of the same letter.
Finally, in order to abstract the discussion a little (which usually makes it easier to visualize some of the issues) I spent some time trying devise a method of representing MRF mathematically and co-opted the matrix to that end as well as a creating a symbology to represent succinctly the different approaches.
The advantage to this approach is that a single representation can be used to express and describe MRF, the musical stave, and the translation process as well as defining the constraints of the method. Plus it looks cool on paper 🙂
It will all become clear as mud eventually. Hopefully. But not this time.