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.

Comments

author
mathew.bailey.79 (author)2015-03-18

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.)

author
_soapy_ (author)2015-01-02

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.

author
jtorres38 (author)2013-10-09

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.

author
twzoom (author)jtorres382013-10-09

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.

author
Jorbs3210 (author)2011-01-28

You need to post instructions on how to build this.

author
Saturn V (author)2010-08-03

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.

author
twzoom (author)Saturn V2010-08-05

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.

author
Saturn V (author)twzoom2010-08-12

You have a good point. But don't you think another alphabet on the encoded wheel would be better than numbers?

author
twzoom (author)Saturn V2010-08-13

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 :)

author
Saturn V (author)twzoom2010-08-23

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!

author
twzoom (author)2009-10-24

Good news everyone!  I just finished taking pictures for the instructable.  If all goes well, it should be finished in a day or two. :)

author
jdege (author)2009-10-21

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."


author
twzoom (author)jdege2009-10-21

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.

author
jdege (author)twzoom2009-10-22

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

author
twzoom (author)jdege2009-10-22

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) :)

author
jdege (author)twzoom2009-10-23

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.

author
I_am_Canadian (author)2009-10-20

Uhh....

Thats really flippin cool.

Oops...

I mean,

AMAZING

Seriously, thats a fantastic bit of engineering. Great work man!

author

That's cool! IAC: we should make one out of knex.

author
twzoom (author)shadowninja312009-10-21

A Knex version of this would be cool, but it probably wouldn't be near as precise.  Lego's just tend to be a better choice when it comes to precision building.

author
Oblivitus (author)twzoom2009-10-21

I'm sure that one could be made as precisely with knex. Although it would be much larger.

author
twzoom (author)Oblivitus2009-10-21

Maybe so, but I've always found that K'nex pieces do have more 'give' in them than Lego pieces do.  I  like to build with K'nex as well though, you should check out my K'nex rubberband guns on this site.  They use an escapement mechanism to shoot off the rubberbands one at a time.

author
Oblivitus (author)twzoom2009-10-21

It has been done before, the first one was made a few years ago.

author
twzoom (author)Oblivitus2009-10-21

Which one has been done before?  The rbg or the cipher machine?  Could you give me a link so I can check it out?

author
Oblivitus (author)twzoom2009-10-22

The rbg, the first one was made in 2007, the second link shows a mech made in 2008.

https://www.instructables.com/id/Semi-automatic-7-Shot-Knex-Rifle/
https://www.instructables.com/id/mp5/

author
twzoom (author)Oblivitus2009-10-22

Thanks for the links, I didn't know anyone had made rbgs with similiar attributes to mine.  My mech is a little different than those though, I assure you that I didn't copy anything.  I made the guns before I knew this site even existed :)

author
Oblivitus (author)twzoom2009-10-23

Yeah, I figured.

author
twzoom (author)I_am_Canadian2009-10-20

Thank you.  I'm hoping to get a full instructable of this up.  I have to finish my college applications first though.

author
atombomb1945 (author)twzoom2009-10-21

Might I suggest a study of Cyber Security?  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. 

author
twzoom (author)atombomb19452009-10-21

Cyber security does sound interesting, but I'm pretty set on being an aerospace engineer.  I'll probably make more codes in my spare time though, I really do find them fascinating :)

author
atombomb1945 (author)twzoom2009-10-21

Awesome choice as well.  Explains the Shuttle for your Icon.

You may want to check out the books by and about KevinMitnick, he did a lot of (ahem) work on codes and code breaking. 

author
twzoom (author)atombomb19452009-10-21

Thanks, I'll have to look into it :)  Speaking of books about codes, have you read any of Dan Brown's books?  He wrote The DaVince Code, Angels and Demons, Digital Fortress, and The Lost Symbol.   Those books use a lot of coding and puzzles throughout the story.

author
twzoom (author)twzoom2009-10-21

Btw:  Nice picture of the LHC for your icon :)

author
atombomb1945 (author)twzoom2009-10-22

LHC = Who knows?

I have read DaVinci Code and picked up a lot of the codes within the book, but could never figure out the page numbering.  Borrowed the book, so I had to give it back after reading it. 

author
Oblivitus (author)2009-10-21

Great job on this, and on 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.

author
twzoom (author)Oblivitus2009-10-21

I'll try to get some examples put up in the near future, thanks for making that point.

author
atombomb1945 (author)2009-10-21

This is really awesome.  I had to study these types of encoding in my security classes.  Actually, We had to decode them by hand, and it was a pain.  Never was able to get the whole thing decoded, but a few of my class mates were able to.

author
rimar2000 (author)2009-10-21

CONGRATULATIONS, that is a very complete cipher machine.

About This Instructable

7,551views

23favorites

License:

More by twzoom:Poly-Alphabetic Cipher Machine3-Speed Lego TransmissionK'nex multi-shot rubberband guns
Add instructable to: