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.
<p>How about modifying a casino slot machine into a cipher machine that also uses reels? The old mechanical &amp; 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.)</p>
<p>If you see this, please paste up a sample message. We could all try and crack it!</p><p>(Make it a decent length so we've got something to work on.)</p><p>Looks great though. Nice work.</p>
What this machine does, in fact, is an instance of Vigen&egrave;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. <br>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&igrave;lia and Ville de Qu&eacute;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. <br>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!
Good news everyone!&nbsp; I just finished taking pictures for the instructable.&nbsp; If all goes well, it should be finished in a day or two. :)
I&nbsp;find the whole idea of building a rotor machine out of legos to be fascinating.&nbsp; And I don't want to belittle what you've done in any way.&nbsp; But, while this statement is true:<br /> <em><br /> &quot;This makes the resulting message immune to many different tactics of decoding.&nbsp; Code breaking procedures like letter frequency analysis, simply will not work.</em>&quot;<br /> <br /> This statement is not:<br /> <br /> <em>&quot;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.</em>&quot;<br /> <br /> <br />
<p>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.</p>
The inaccuracy is in the claim that the only way to break the message is exhaustive search of the key space.&nbsp; There are cryptanalytic methods other than letter frequency analysis and exhaustive search.&nbsp; 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.<br /> <br /> Ciphertext-only Cryptanalysis of Enigma, by James J. Gillogly:<br /> http://members.fortunecity.com/jpeschel/gillog1.htm<br />
<p>I haven't studied cryptanalysis, but you do have a good point.&nbsp; However I would like to point out that the number of variations is gotten by changing the order of the characters on the wheels.&nbsp; I may be wrong, but it seems the Enigma Machine's variations came from switching the rotors and altering the layout of the plugs.&nbsp; Decoding my machine might take a different technique.&nbsp; In fact, I'm going to put a few examples of codes&nbsp;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.&nbsp; How long would you want the message to be? (hopefully not too long, as coding on this machine can be very time consuming) :)</p>
Enigma placed too much reliance on the ordering of the characters on the wheels, because the ordering was too hard to change.&nbsp; Yours, on the other hand, uses paper strips.&nbsp; It'd be easy enough to provide multiple paper strips, and to make the selection of which a part of the key.<br /> <br /> I don't claim to be any sort of expert.&nbsp; But I am looking forward to a detailed description of how the machine is built - and to seeing some sample texts.<br /> <br /> Might I suggest that you include at least one sample with plaintext, ciphertext, and key?&nbsp; If I&nbsp;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.<br />
Uhh....<br /> <br /> Thats really flippin cool. <br /> <br /> Oops...<br /> <br /> I mean,<br /> <br /> AMAZING<br /> <br /> Seriously, thats a fantastic bit of engineering. Great work man!<br />
That's cool! IAC: we should make one out of knex.<br />
A Knex version of this would be cool, but it probably wouldn't be near as precise.&nbsp; Lego's just tend to be a better choice when it comes to precision building.
I'm sure that one&nbsp;could be made as precisely with knex. Although it would be much larger.
Maybe so, but I've always found that K'nex pieces do have more 'give' in them than Lego pieces do.&nbsp; I&nbsp; like to build with K'nex as well though,&nbsp;you should check out my K'nex rubberband guns on this site.&nbsp; They use an escapement mechanism to shoot off the&nbsp;rubberbands one at a time.
It has been done before, the first one was made a few years ago.
Which one has been done before?&nbsp; The rbg or the cipher machine?&nbsp; Could you give me a link so I can check it out?
The rbg, the first one was made in 2007, the second link&nbsp;shows a mech made in 2008.<br /> <br /> <a href="https://www.instructables.com/id/Semi-automatic-7-Shot-Knex-Rifle/">https://www.instructables.com/id/Semi-automatic-7-Shot-Knex-Rifle/</a><br /> <a href="https://www.instructables.com/id/mp5/">https://www.instructables.com/id/mp5/</a>
Thanks for the links, I didn't know anyone had made rbgs with similiar attributes to mine.&nbsp; My mech is a little different than those though, I assure you that I didn't copy anything.&nbsp; I made the guns&nbsp;before I knew this site even existed :)
Yeah, I figured.
Thank you.&nbsp; I'm hoping to get a full instructable of this up.&nbsp; I have to finish my college applications first though.
Might I suggest a study of Cyber Security?&nbsp; You will end up studying a lot of codes like this one, and if you were able to come up with this on your own the field will be all that much easier for you.&nbsp; <br />
Cyber security does sound interesting, but I'm pretty set on being an aerospace engineer.&nbsp; I'll probably make more codes in my spare time though, I really do find them fascinating :)
Awesome choice as well.&nbsp; Explains the Shuttle for your Icon.<br /> <br /> You may want to check out the books by and about <em>Kevin</em> <em>Mitnick</em>, he did a lot of (ahem) work on codes and code breaking.&nbsp; <br />
Thanks, I'll have to look into it :)&nbsp; Speaking of books about codes, have you read any of Dan Brown's books?&nbsp; He wrote The DaVince Code, Angels and Demons, Digital Fortress, and The Lost Symbol.&nbsp;&nbsp; Those books use a lot of coding and puzzles throughout the story.
Btw:&nbsp; Nice picture of the LHC for your icon :)
LHC = Who knows?<br /> <br /> I have read DaVinci Code and picked up a lot of the codes within the book, but could never figure out the page numbering.&nbsp; Borrowed the book, so I had to give it back after reading it.&nbsp; <br />
Great&nbsp;job on this, and on&nbsp;the description as well. I can understand how it works from your explanation. And you're right, it is quite simple. I think that examples of codes and their corresponding messages would help too though.
I'll try to get some examples put up in the near future, thanks for making that point.
This is really awesome.&nbsp; I had to study these types of encoding in my security classes.&nbsp; Actually, We had to decode them by hand, and it was a pain.&nbsp; Never was able to get the whole thing decoded, but a few of my class mates were able to.<br />
CONGRATULATIONS, that is a very complete cipher machine. <br />

About This Instructable




More by twzoom:Poly-Alphabetic Cipher Machine 3-Speed Lego Transmission K'nex multi-shot rubberband guns 
Add instructable to: