Question
The Caesar Cipher Algorithm was introduced in Week #1. Encryption is the act of encoding a message with the intent of allowing only authorized people
The Caesar Cipher Algorithm was introduced in Week #1. Encryption is the act of encoding a message with the intent of allowing only authorized people the knowledge of how to read that message. Encryption can be decoded. It helps secure content but can be read after decryption.
Recall that the Caesar Cipher used the alphabet as the primary source of information but shifted a certain number of letters to the left or right to create a key. It is easily hacked because of the simple technique used to build the key that decrypts the data.
In this example, the key will be the shift number and the direction will always be to shift down the alphabet. This provides 26 ways of encrypting a message. This makes it easier to hack because our shift can only be in the range from 0 - 25.
Write the function caesar_hack( ) that takes a Caesar Cipher encrypted message, along with an alphabet list and attempts, with a Brute Force Attack, to find the key and decrypt the message. This would typically be a technique used by an unauthorized user.
Use a nested for loop to find the key. Check the encrypted letter position based on the alphabet letter and if found, return the key number and the decrypted message. If not found, return 99 for the key and "Error: Key not found!" for the message. It might be useful to use the caesar_cipher_decrypt() method to return only the key that matches the correct message.
In main: Add a call to the caesar_hack method. Make sure you capture both of your returned variables. Then add control structures that capture if k == 99 - print the returned error message or print "Successful attempt found! Key = to the returned variable and on a new line print "Secret message: " and the returned message.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started