Poly-Alphabetic Cipher Machine

PlayK'NEX by





Introduction: 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.



    • Pocket-Sized Contest

      Pocket-Sized Contest
    • Pro Tips Challenge

      Pro Tips Challenge
    • Paper Contest 2018

      Paper Contest 2018

    We have a be nice policy.
    Please be positive and constructive.




    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.

    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.

    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!