To decrypt a Vigenère cipher without knowing the key, follow a two-step process: First, determine the key length by writing the ciphertext multiple times with increasing shifts and counting coincidences (matching letters at the same position); the key length corresponds to the periodicity of high coincidence counts. Second, find each key character by grouping every Nth letter (where N is the key length), calculating letter frequencies for each group, and finding the shift that maximizes the sum of products between ciphertext frequencies and expected language frequencies (using the principle that aligning largest values with largest values yields the maximum product sum).
Vigenere Cipher Decryption: How to Find the Unknown Key
Added:this is the second video on how to decrypt the visionaire cipher the first video was about if you know the key in this video I'm going to talk about what happens when you do not know the key for the vision a cipher how do you crack in that case there are two steps one find the key length you have to know how long the key is if the key is three numbers long or 10 numbers long um step two is you have to find each number in the key once you know how long it is you have to figure out what the numbers are in order to find the key length first thing you have to do is write out your Cipher text so this is my Cipher text that I want to find out what it says what I'm going to do is I'm going to literally rewrite the cipher text only one over so our Cipher text is v v HQ Etc so I'm doing the same thing I'm just just scooting it over one place so I just literally rewrote the exact same thing Cipher text only one over and in nice little lines um I didn't write the last G right here um should be JG I just wrote the J that's okay we can just go ahead and stop at the um end of the line what I'm going to do is I'm going to write it again and I'm going to scoot it over one more time so I started here before now I'm going to start here so again I just wrote the cipher text out only one place farther over now I'm going to do it again so at this point you're probably getting the pattern I'm going to write it quite a few times and just keep moving over each time so you can see I just kept going and moved it over one space each time you can stop when you've either got a lot of rows you run out of letters or in my case I ran out of colors so once we have that what we want to look for is what we call coincidences um so coincidence is when you have the same thing in your top row in the same place that you have it in the next row for instance we have a v here and we have a v right below it that's a coincidence let's look for any more we've got another one here that's a coincidence um yeah that's it for that row so this row has two coincidences the purple row has two coincidences all right now let's look at the green row remember we're comparing the top one the blue one with the green one not the purple and the green the blue and the green right so let's look and see if any of these match so let's look and see if any in the blue and green row match H and V Q V I go all the way down and what I see is right here see I'm looking at this G and this G right here um I don't care about the purple row right now but the blue row and the green row um both have a g in the same place so this row has one coincidence all right let's compare the blue row and the red row now this row does not have anything in common with the blue row so let's try the next one orange all right so we have one in this case now let's move on to the next row and I'm going to go ahead and count all the rows hopefully I don't make any mistakes sorry if I do they're hard to catch but I'm going to basically count see V and V here I'm going to count the coincidences for every row I have have okay now that I have um counted the number of coincidences what I want to do is look for numbers that are particularly large um in this case our Cipher text was really short this is actually considered short normally you need a lot of text to be accurate about this but you can see that right here is a bigger number and right here is a bigger number um we have twos in both cases instead of ones and zeros that's a little better now what we want to do is count how often big numbers occur so right now we have here and then one two three four so four places later another big number occurs therefore we would conclude that the key has a length of four now normally you like I said you get bigger numbers like if you had like see this is more like what you want to see um see you've got a big number here and then one two three four spots later you've got another big number got 30 25 and then one two three four spots later you've got a 40 those are all much bigger than uh zero one five six even um so that's a little bit more what you want to be looking for but in this example the cipher text was very short it would take a very long time to write it all out therefore we have smaller numbers however you can sort of see a pattern there so we would assume the length the key for this message is four digits long or four numbers long step two finding the actual numbers once you know the length of the key you have to figure out what the numbers in the key are but before I can show you how to do that I have to convince you of a mathematical concept and how it works all right so let's say you have have the numbers one two and five now you want to multiply each of these numbers with one two and five how do you get the largest possible number if we want to add them up like I could say um if I did 1 time 2 2 * 1 and five * 5 that could be an option 2 * one so that would be two + 2 + 25 all right so we have 29 now let's try a different combination let's try five and one two and five one and two all right so then we've got 2 + 10 + 5 and that will equal 17 now we can do a whole lot of different um options we can mix them match them up uh lots of different ways but the way we're going to get the largest number is if we do the largest with the largest that's five with five then the next with the next two with two and then the smallest with the smallest now let me show you that would be 25 + 4 + 1 equal 30 so you'll notice that this is greater than 17 and 29 it'll also be greater than any of the other combinations you try so you have to get them in the right order aligned with each other in the same order in order for it to produce the largest number now that you understand that you have to put them in the same order and multiply them to get the biggest possible number I can explain to you how the vision eror Cipher decryption works because it's based um very strongly on that principle I'll come back to that math principle in a bit but first we have to do something with the message this is the encrypted message that we are attempting to decrypt now first what we have to do um let's just say this is just the very beginning of a message because you would need a very long message in order to make this work the length is four let's say we already determined that in the previous step so therefore we're going to take every fourth letter one two three four one two three four one two three and then it would um keep going like that and that is going to be used to find all the letters that I would box in the fourth letter all the way down to the very end of the message assuming you had a very long message we would um we're going to use this to find the first number in the key so we know that right now that the key is 1 2 3 four four things that we don't know that we have to fill in the blanks for now there's one other thing we know in this case we're using an alphabet with three letters ABC for Simplicity sake and we know that the frequencies in this um language for these letters are 0.1 2 and 7 for a b and c respectively so that's what we start out knowing about the alphabet and this is what we knew from the last step I started with one two three um every fourth letter because it was length four and what these are going to do is fill this blank so what I would do is I would pull down all these letters in this case I have one of each but let's say I went through and I counted them let's say I went through an entire message and I counted and I found that there were 50 A's there were 200 bees there were 25 C's okay so I went through every fourth letter added them all together how many I had of each when counting at every fourth and ended up with those numbers like I said needs to be long um which is why I'm not counting that many letters so what we have to do now is determine the frequency of each of these letters in the encrypted um message so how we do that um obviously we add these up whoops oh let's that's not 200 let's say that's 125 so that the total is 200 all right so we have 200 we want to find the frequency of a so 50 / 200 0.25 125 / 200 is125 25 no excuse me that goes here 125 divid 200 will be 625 so those are the frequencies of the letters that we have now what we're going to do is we're going to multiply these numbers with these numbers in the correct order in the order the alphabet goes in okay so I just rewrote those numbers over here what we're going to do is we're going to write down the alphabet frequencies of the numers or the letters in the alphabet in order of the alphabet we are using so like the English alphabet has certain frequencies we would write that down in in order next we are going to write down these in order underneath it in order of ABC so what we're going to do with that is we're going to multiply these multiply that that and that and then we're going to add each of these numbers up so when we add them up I'm going to put it over here I know that's weird okay so what I did was I multiplied this times this plus this times this plus this times this I hope I did that math right but should be24 approximately so you can see how I wrote a zero here that's because I didn't shift this blue row it was in order of a b c this a this was B this was C of our Cipher text next what I'm going to do is I'm going to shift the whole thing this direction so I'm going to take the C and I'm going to move it over one place I'm going to take take the B I'm going to move it over one I'm going to take the A and it gets bumped around at the beginning and then I'm going to do the same thing where I multiply this times this and then add this times this and add this times this and let's see what number I get for that okay so assuming I actually did my multiplication and addition correctly um you should get a 26 here and that was with a shift of one one next we're going to shift it over again in the same direction um so before we had c b and a now we're going to take the a move it over here take our C move it over here take our um B and bump it around to the end and then I'm going to repeat the process multiply this time this this time this and this time this and add those three numbers together now once again assuming I did my math correctly I got 050 for the sum for that one and that was with a shift of two with c b and a so what we can see here from these numbers is that this number remember that math principle I went over at the beginning how you have to align them to get the largest possible value so this number where we got the largest possible value is where they are aligned where the true frequencies these ones are aligned with the correct frequencies for the um shift so we can see that that occurred with a shift of two therefore this number in the first key here or the first number in the key here is two because that's what kind of shift it took to get it correctly aligned so we have the first number for the key I know that's kind of long but the other numbers are calculated the same way with the same process only for the second one we start at the second letter so we go this one and then one two four after that and then two three four after that and then we would take all these letters all the way down to the end of the message that I'm encircling with a red box and we would count how many A's how many B's how many C's and we would get a total some number of total letters and then we would calculate the frequencies like five3 and 2 or something like that and then we would repeat the process using the True Values and remember multiplying it times the correct order starting with ABC the frequency of a the frequency of B the frequency of c and then shift and then shift again um if you need to back back up in the video and review that process it's the exact same thing it's the exact same thing only you're just counting the letters that are every fourth letter starting with the second one and then you do that and you say let's let's say for instance that a shift of one um resulted in your largest sum your largest value then the shift would go here and then we would do the process again for we would count this one these we do it again count them do the process all over again fill in this box based on that those letters then we would um finally count these letters same exact process do the frequencies multiply the frequencies see what makes what shift makes the largest sum and fill that in with the key there and therefore once you have the key you can go back to the video on how to decrypt when you know the key and use that to um decrypt the message it's simple from there
Up Next

AES Encryption Explained: How the Advanced Encryption Standard Works
@Computerphile
1.4M views•2019-11-22

BitTorrent Protocol Explained: Piece Selection & Peer Choking
@StevenGordonAU
481 views•2013-02-22

HTTP Requests Explained: GET, POST, PUT, DELETE
@codecademy
103.1K views•2021-10-07

Enigma Machine Mechanics: WWII Encryption Explained
@JaredOwen
13.2M views•2021-12-11
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Computer Science















































