Open oldoc63 opened 1 year ago
Decode my friend's message
Send your friend a coded message
Making functions for decoding and coding
Solving a Caesar Cipher without knowing the shift value
Salutations! As you can see, technology has made brute forcing simple ciphers like the Caesar Cipher extremely easy, and us cryptoenthusiasts have had to get more creative and use more complicated ciphers. This next cipher is the Vigenere Cipher, invented by an italian cryptologist named Giovan Battista Bellaso in the 16th century, but named after another cryptologist from the 16th century, Blaise de Vigenere.
The Vigenere 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 Vigenere 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 use the keyword
dog
Now we use the 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 the each letter of our message by the place value of the corresponding letter in the keyword phrase, assuming that "a" has place value of 0, "b" has a place value of 1, and so forth. Remember, we zero-index because this is Python we are talking about!
As you can imagine, this is a lot harder to crack without knowing the keyword!
In this project, you will use your Python skills to decipher the messages you receive and to encode your own responses! Put your programming skills to the test with these fun cryptography puzzles.