Poly-Alphabetic Cipher Machine

10K2741

Intro: Poly-Alphabetic Cipher Machine

  This is one of my coolest inventions.  It's a poly-alphabetic cipher machine made out of Lego’s.  It is a type of mechanical encoding device that is reminiscent of the Enigma Encoding Machine used by the Germans during WWII.  I didn’t have any kind of instructions or aid, and as far as I’m aware this is the first device of its kind made out of Legos. The machine isn’t all that complicated, as its beauty lies in its simplicity.  It uses a mechanical gearbox with one gearing variable that alternates the rotational direction of the encoding wheel after every letter is encoded.  In essence, each subsequent letter uses a different alphabet to encode the message, hence the term poly-alphabetic.  This makes the resulting message immune to many different tactics of decoding.  Code breaking procedures like letter frequency analysis, simply will not work.  In fact, the only way to decode the message, without using an identically built machine, is to develop a complex computer algorithm and slowly sift through the approximately 1.626x10^53 possible combinations.  The overwhelming amount of possibilities combined with the difficulty of finding the proper function to decode the message makes this code nearly impossible to break.

  The machine has two reels, each with 27 characters.  The left reel is marked with the 26 letters of the English alphabet and a slot for inserting a space. The right wheel is marked with the numbers 1-27.  Both reels can list their their respective characters in any order.  The total amount of cominations is reached by taking the possible character configurations of each wheel, 26! (26 factorial), and multiplying it by itself since the machine has two reels.  Since this is built out of Lego’s, and only has a limited number of parts to be built out of, the gears don’t always line up perfectly when you switch modes, and they have a little slack in them as well. However, I’ve reinforced the model as much as possible to reduce the error while encoding. The machine currently has an accuracy of approximately ±1/54 of a rotation. As long as care is taken while operating the machine, errors will be kept nonexistent.

  The machine is operated in a very simple manner. To encode a message, you insert the black knob on top of the machine into the hole by the left reel. Then you set the machine to its starting position.  You do this by moving the grey axel on the front until the gears are in the neutral position. Next, the reels should be rotated so that it reads A on the left and a number (1-27) on the right. Then you make a box on your coding paper and put the starting number in it. Then push in the grey axel on the front to engage the reels with the single gear. Then rotate the black knob until the letter on the left reel is the letter that you want to encode, write the corresponding number down on the code sheet.  Then put the grey axel out all of the way to engage the double gears. Turn the knob again to find the corresponding number for the next letter to be encoded, then rinse and repeat. Continue working in this fashion until the entire message has been encoded. To decode a message, simply switch knob to the right, put the gears in neutral, set the proper starting position, push the grey axel in to engage the single gear, and start decoding in the same way that the message was encoded.

39 Comments

I find the whole idea of building a rotor machine out of legos to be fascinating.  And I don't want to belittle what you've done in any way.  But, while this statement is true:

"This makes the resulting message immune to many different tactics of decoding.  Code breaking procedures like letter frequency analysis, simply will not work."

This statement is not:

"In fact, the only way to decode the message, without using an identically built machine, is to develop a complex computer algorithm and slowly sift through the approximately 1.626x10^53 possible combinations."


Thanks for checking out my machine, but could you please point out my inaccuracy in the above statement so I can fix it if needed.

The inaccuracy is in the claim that the only way to break the message is exhaustive search of the key space.  There are cryptanalytic methods other than letter frequency analysis and exhaustive search.  Even if the only attack is to search the key space - which with only one rotor is unlikely to be true - heuristic searches can generally find the key by testing only a very small fraction of the key space.

Ciphertext-only Cryptanalysis of Enigma, by James J. Gillogly:
http://members.fortunecity.com/jpeschel/gillog1.htm

I haven't studied cryptanalysis, but you do have a good point.  However I would like to point out that the number of variations is gotten by changing the order of the characters on the wheels.  I may be wrong, but it seems the Enigma Machine's variations came from switching the rotors and altering the layout of the plugs.  Decoding my machine might take a different technique.  In fact, I'm going to put a few examples of codes made with this machine, and I'll include at least one that isn't decoded, why don't you see if you can decode it using the methods you described.  How long would you want the message to be? (hopefully not too long, as coding on this machine can be very time consuming) :)

Enigma placed too much reliance on the ordering of the characters on the wheels, because the ordering was too hard to change.  Yours, on the other hand, uses paper strips.  It'd be easy enough to provide multiple paper strips, and to make the selection of which a part of the key.

I don't claim to be any sort of expert.  But I am looking forward to a detailed description of how the machine is built - and to seeing some sample texts.

Might I suggest that you include at least one sample with plaintext, ciphertext, and key?  If I have time to look into this (and I'm not promising anything, there's a lot on my plate), I'd probably try to emulate the machine in software, and I'd need at one set of test data to ensure that the software worked.
No offense, but this is a mono-alphabetic cypher. Polyalphabetic uses 2+ alphabets to encode, where this is just taking a regular alphabet and turning it into a number.
Not "encode" but to 'encrypt' or more specifically to 'encipher'
You have a good point, that's exactly what this machine would be if one disregards it's ability to change the mechanical linkages connecting the two reels. However the fact that after every letter is encoded the mechanical part in the middle is manually switched makes it poly-alphabetic. This reverses the rotational relationship between the two reels, essentially flipping one of the reels. Since the relationship between the reels has changed, each letter then results in a different number (except for the original letter of course, whose relationship to the other reel does not change). It's a kinda confusing concept to grasp without actually building it or seeing it in action. I really should post some example codes to demonstrate it in action.
You have a good point. But don't you think another alphabet on the encoded wheel would be better than numbers?
I'm not really sure if the letters or numbers would be harder for someone to decode, I suppose it would depend on what kind of decoding approach they took. The fact that I put numbers on the other reel is really just a personal preference. Another reel with letters, and a space of course, would work just as well, I'm just kinda a numbers person :)
Yeah, it wouldn't matter. And it's very hard to crack a cypher that mimics the Enigma cypher machine like yours. To crack the Enigma, it took the greatist minds in Europe, the first computer, and the Nazis broadcasting the code for the day, and several months. A Vigenere square, however, is a much easier poly-alphabetic cypher to crack. And mono-alphabetic cyphers are easier than pie. And a lot shorter, too!

How about modifying a casino slot machine into a cipher machine that also uses reels? The old mechanical & even the electromechanical casino slots would probably not do unless otherwise,but you could try a casino slot machine of the kind that has the reels driven by stepper motors,which casinos currently use. For example you could modify an old or used IGT S Plus slot machine into a cipher meachine. The are other brands of slot machines of the stepper reel kind(Aristocrat,WMS,Bally for example.)

If you see this, please paste up a sample message. We could all try and crack it!

(Make it a decent length so we've got something to work on.)

Looks great though. Nice work.

What this machine does, in fact, is an instance of Vigenère cipher, which has some very known and reliable attacks. On the contrary that is stated in the text, there is still a regularity, which is found in a cycle that has the same size on the alphabet. So, it is trivial to break with a computer program, and even doable by paper and pen, if you apply the correct amounts of effort and patience :) More info on this subject is available in the William Stalllings' excellent book Cryptography and Network Security.
Nevertheless, the machine is one of the coolest Lego structures I've ever seen in my life, as cool as a natural sized Lego Darth Vader I've seen in Brasìlia and Ville de Québec.
I didn't know that, thanks for sharing. It makes me want to write a program that cracks the machine now, since I've since emulated the machine in software. :) I wonder if there is a way to add something to the machine that would help to break this regularity, I'll definitely have to check out the book you mentioned.
Thanks for the compliment, Legos can be used to make some pretty cool things, and they're even reusable. I've never had the heart to scrap this machine for parts though.
You need to post instructions on how to build this.
Good news everyone!  I just finished taking pictures for the instructable.  If all goes well, it should be finished in a day or two. :)
Uhh....

Thats really flippin cool.

Oops...

I mean,

AMAZING

Seriously, thats a fantastic bit of engineering. Great work man!
That's cool! IAC: we should make one out of knex.
More Comments