Building an Enigma Machine

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys today's video is going to be the Enigma machine what is an enigma machine well let's set the scene it's World War two Germany is fighting most of the world in the second installment of the water and or was that's one guys in order to maneuver troops and stuff the Germans would send secret messages being like g'day mate actually they probably wouldn't have had an Australian accent they probably would have been pretty German anyway they'd be like get a mate yeah what sindoor yeah your camels two-quadrant be I'm um I'm not very good at history or geography so sorry anyway if the Allies could decipher this message and then send whatever camels weaknesses to quadrant B it's uh it's probably tanks I think it would be fair to say it's tanks like I'd be pretty confident sending in tanks against camels so the Allies would send in like four tanks to Quadron be rendering the Germans camelus and effectively winning the war so if the Germans wanted to have any hopes of winning they would need to encrypt their messages this is where the evening mow machine comes in leaning machine was the best encryption device the world has ever seen well there are tons of other encoding methods none of them are quite as extraordinarily paranoid as enigma and Nemo was like a fancy typewriter but when you press a key a different letter lights up on the machine this is how you use it today we want to encode a message determine the message say subscribe first you want to press the S key and a little light top let's say it's P we write down the letter P and then we rinse and repeat until we've encoded our word so subscribe becomes Pinet s fold this put permanent so subscribe becomes permanent a swaddle oh boy so far from what it was alright anyway also notice that the first s and the second s are encoded as different letters this is the wonderful thing about enigma after every key is pressed the encryption mechanism changes so the encryption of the second s was different to that of the first the machine works exactly same backwards as it does forwards so in order to decipher the message the machine has to be in the exact same state that it was when we started encoding our message then we type in the message received which was coming as fobel and we get our original message subscribe also hit that Bell button if you want to get notifications of when I upload anyway ok let's talk about how the machine actually works and then I will attempt to recreate it first thing understand is that all enigma is is a simple circuit when you press a key electricity travels from the key pressed to the light bulb which lights up the tricky bit is how the wiring changes so let's say we press the letter A electricity travels down the wire until it gets to the first of what is known as a rotor the Enigma machine holds three rotors the rotors are what changes every time you press a key zero points for anyone who guesses how they change well specifically the rightmost rotor rotates one place these rotors work much like the hands on a clock so after the right-most does a full revolution the second Rhodope rotates once and then once that one does a full revolution the third rotor rotates one place inside each rotor there are input and output connections so the electricity flows from the key pressed through to its corresponding input connection of the first rotor and each input connection is wired up to an arbitrary output making a massive tangled crisscross wiring inside each rotor so the electricity flows through the output of that rotor which is connected to the input of the second rotor which then flows to the output of the second rotor to the input of the third and finally to the output of the third rotor so depending on the position of the rodas the electricity could flow out of any place of the outputs of the third rotor the output of the third rotor is then connected back in on itself to another output of the third rotor so now the electricity flows back through the third rotor through to the second to the first and finally back through to the light bulb ha okay in order to decode a message you need to know the exact rotation of each rotor so there are three rotors each have 26 inputs and outputs thus they can be rotated to any of 26 different positions so let's work out how many possible settings this Enigma machine has it's 26 times 26 times 26 put each of the rotors okay that means there are 17,000 576 different settings that this machine has and in order to decode the message the Allies would need to guess one out of 17,576 settings but that's not it not at all we are just getting started baby first of all the voters are swappable so you can change around the positions of the rotors themselves furthermore there are five rotors to choose from so how many ways can the road is be arranged well there are five to choose from so there are five options for the first slot and then four options for the second slot and then three for the third so the number of arrangements is five times four times three which is sixty different arrangements of the rotors themselves and with each arrangement having 17,576 different settings that calculates to one million fifty four thousand five hundred and sixty different arrangements okay so that's a few but the Germans were like only one million fifty four thousand five hundred sixty possible settings that's lame so the Germans added one more addition to the Enigma machine to make the code stupidly unbreakable if you open up the front of the box then you'll see what is known as the plug board this plug board allows you to connect letters into pairs this just means that letters are kind of switched so if a and n were connected on the plug board then when we press a that would go through the plug board through the wire to N and then it would continue normally as if you press the N key it's also applies for the output if while pressing a which is now n the output would normally say C but C and T are connected on the plug board then the T light would go on so just quickly again because this is pretty complicated we press a then the electricity flows through the plug board into n then it enters the rotors and then turns around and comes back through the rotors and then output it as C which is then connected to T and thus the t light turns on bloody hell but does this really make the Enigma machine all that more unbreakable yes yes it does there are 10 plug connect to wire things which connects to lettuce together so essentially we need to connect two ends of 10 connectors 2 plugs so 20 plugs need to be plugged there are 26 places left to stick the first plug and 25 to stick the second and then 24 23 22 21 and so on this calculates out to be a stupid big number of arrangement of the plugs the actual calculation is 26 factorial divided by 6 factorial times 10 factorial times 2 to the power 10 because there's some fancy probability math required but I can't be bothered explaining that all you need to know is that the really large bloody number of arrangements of these plugs in fact there is a hundred and fifty trillion 738 billion 274 million nine hundred and thirty seven thousand 250 different possible arrangements for these plugs and for every plug board setting there is one million fifty four thousand five hundred and sixty possible settings of the rotors so that means there is in total 158 quintillion 962 quadrillion 555 trillion two hundred and seventeen billion 826 million three hundred and sixty thousand flat different arrangements of the Enigma machine the Germans accepted this that that was enough okay now we know how it works it's time for me to work for a living and actually code the damn thing and then in the next video I will attempt to crack the code in the same way that MAME and Benedict I mean Alan Turing was able to here we go okay first up let's make an interface which will show off the lamps for our Enigma machine I'll just hook it up so that it just lights up whichever key I press on the keyboard okay that's close but we need too light to turn off once you've stopped pressing it okay very nice there it is I also restricted the machine to only recognised one key press at a time so you can't press down two or more keys at once which would just kind of ruin the whole point of the machine yeah so machine just lights up the key that you pressed is hardly impressive so let's add the rotors to the machine each rotor will contain a 2d array containing all the connections I also exchanged the letters for numbers because well I do what I want and it made it easier to make sure my machine is as authentic as possible I grab the wiring for each rotor from the most legitimate source I also created a little program that converts the connections that Wikipedia gives you into the code that I need to define them because I'm super lazy I write code to give me other code anyway so now that we have the wiring for each rotor now let's use these connections to run the input through the rotor each rotor will take in a letter as input and then output whichever letter that input was connected to we also need to make sure that once a key is pressed the rotors will change position okay fantastic you can't see this but I'm just spamming a single key so since the rotors change position every time I press the key a different letter lights up okay sexy stuff but was still not done yet we need to add the plugboard this is pretty simple most of the challenge comes from making it look pretty each plug just contains two letters which it connects and if the user presses a key which a plug is connected to then it will output whichever other letter that plug is connected to and then that will be run through the rotors okay plug board is done and let's run it yep looks exactly the same fantastic job Evan quality bloody content but it is much better I swear well it has much more settings now okay so I made it look way more sexy and here it is ohyeah yeah we're talking and if you click on the bottom of the screen you'll be taken to the plugboard ok cool stuff now let's actually show this puppy in action all right so I'm gonna encode a secret message and you can't see my hand so it's super secret all right now comes the interactive section of the video I've uploaded the Enigma machine application so you can follow the link in the description to get the machine now I'll show you these my settings so you can decode this message so you need to enter the message into a machine which has the settings which are currently on the screen and if you do that hopefully the original message will pop out okay hopefully that works pretty embarrassing if it doesn't also another thing to note is that the unique machine has no way of encoding a space so the message will just be a string of letters I'm sure you can figure it out you've made it that far you can figure out the lack of spaces so you can use this machine to talk to your friends or you can even use it to command your evil Nazi Empire either way have fun with it look in the next episode of cold bullet Evan will attempt to crack this seemingly uncrackable code it's amazing feat has never never been done before not even once I I swear I promise can Evan stop the evil Nazi Camel Empire before it's too late tune in net the next time foods find out on code bullet right here okay that's enough of that you get it it's a it's a part one thing to two-part series get it okay that's real talk for a bit I've surely noticed I've been real slack lately in uploading and I have good reason I swear you he's been getting hectic lately and I was sick and it's just been a mess so I haven't been able to spend much time on making videos we're almost done though so who in like two weeks I'll be a free man able to wake way more videos so just hold on tight just for a bit and I'll be back bye you
Info
Channel: Code Bullet
Views: 3,245,718
Rating: 4.905118 out of 5
Keywords: artificial, intelligence, Enigma, Enigma Machine, nazi, hitler, the imitation game, germany, encoding, java, processing, benedict cumberbatch, alan turing, coding, simulator
Id: 2D2bJWHvqJo
Channel Id: undefined
Length: 12min 7sec (727 seconds)
Published: Wed Jun 13 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.