I’m having some issues trying to figure out what codecademy is asking us to do in this off-platform exercise.
I was able to breeze through steps 1 through 4 without a problem. The explanation pretty clear, However, step 5 isn’t so clear, and of course there is no available solution or video walk-through.
I cannot seem to make sense of the example that codecademy gives, and considering that this updated track has had a number of mistakes in it up to this point, I’m not sure if there are mistakes in the example given by codecademy, or if I’m just not understanding how the Viginere Cypher works.
If they keyword is ‘dog’ and the message is ‘barry is the spy’
replacing ‘barry is the spy’ with ‘dog’:
dogdo gd ogd ogd
How did they get the resulting ‘place values’ (I’m assuming they mean index of a list containing the alphabet here?):
4 14 15 12 16 24 11 21 25 22 22 17 5
If ‘place value’ is the same as ‘index’, then in a list of the alphabet d should be 3, o would be correct at 14, but I have no clue how they got 15 for g or any of the other 'place values’.
Does anyone know what a ‘place value’ is? Do they mean ‘index’ of an alphabet list? How did codecademy get these ‘place values’?
Below are the instructions and example given by codecademy:
Salutations! As you can see, technology has made brute forcing simple ciphers like the Caesar Cipher extremely easy, and us crypto-enthusiasts have had to get more creative and use more complicated ciphers. This next cipher I'm going to teach you is the Vigenère Cipher, invented by an Italian cryptologist named Giovan Battista Bellaso (cool name eh?) in the 16th century, but named after another cryptologist from the 16th century, Blaise de Vigenère. The Vigenère Cipher is a polyalphabetic substitution cipher, as opposed to the Caesar Cipher which was a monoalphabetic substitution cipher. What this means is that opposed to having a single shift that is applied to every letter, the Vigenère Cipher has a different shift for each individual letter. The value of the shift for each letter is determined by a given keyword.
Consider the message:
barry is the spy
If we want to code this message, first we choose a keyword. For this example, we’ll use the keyword
dog Now we repeat the keyword over and over to generate a _keyword phrase_ that is the same length as the message we want to code. So if we want to code the message "barry is the spy" our _keyword phrase_ is "dogdo gd ogd ogd". Now we are ready to start coding our message. We shift each letter of our message by the place value of the corresponding letter in the keyword phrase, assuming that "a" has a place value of 0, "b" has a place value of 1, and so forth. Remember, we zero-index because this is Python we're talking about! message: b a r r y i s t h e s p y keyword phrase: d o g d o g d o g d o g d
resulting place value: 4 14 15 12 16 24 11 21 25 22 22 17 5
So we shift "b", which has an index of 1, by the index of "d", which is 3. This gives us an place value of 4, which is "e". Then continue the trend: we shift "a" by the place value of "o", 14, and get "o" again, we shift "r" by the place value of "g", 15, and get "x", shift the next "r" by 12 places and "u", and so forth. Once we complete all the shifts we end up with our coded message: eoxum ov hnh gvb As you can imagine, this is a lot harder to crack without knowing the keyword! So now comes the hard part. I'll give you a message and the keyword, and you'll see if you can figure out how to crack it! Ready? Okay here's my message: dfc aruw fsti gr vjtwhr wznj? vmph otis! cbx swv jipreneo uhllj kpi rahjib eg fjdkwkedhmp!
and the keyword to decode my message is
friends
Because that’s what we are! Good luck friend!
Any and all help would be greatly appreciated. I’m really disliking the disorganized and seemingly ‘rushed’ manner of these course updates.