Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete using C++ Alice and Bob are avid Twitter users and tweet to each other every day. One day, Alice decides to send Bob a

Complete using C++

image text in transcribed

Alice and Bob are avid Twitter users and tweet to each other every day. One day, Alice decides to send Bob a secret message by encrypting it and tweeting it publicly to Bob. They had anticipated a scenario like this, and exchanged a shared secret key some time in the past. Unfortunately, Alice isn't very familiar with encryption algorithms, so she decides to make her own. Her encryption algorithm works as follows: Choose a key entirely composed of digits 09, for example: 1 2345 2 Iterate each letter of the plaintext message and rotate the letter forward a number of times equal to the corresponding digit in the key. If the rotation of the letter passes Z, start back at A 3. If the message is longer than the key, loop back to the first digit of the key again, as many times as needed. 4. If a non-alphabetical character is encountered, leave it as it is and don't move to the next digit in the key 5. Characters should maintain their upper or lowercase orientation after rotation Here is an example message and its encrypted output using Alice's algorithm Original message: Hi, this is an example Example Key: 4071321 Encrypted message: Li, ailu jw au facntll Where H was rotated forward 4 letters to L, i rotated 0 to i,t rotated forward 7 letters to a, etc Satisfied with the security of her algorithm, Alice tweets the following ciphertext to Bob Otjfvknou kskgnl, K mbxg iurtsvenb ksgq hoz atv. Vje xcxtyqrl vt ujg smewfv vrmcxvtg rwqr ju vhm ytsf elwepugyez. -Atvt hrqgse, Cnikg Uh oh! Unfortunately for Alice and Bob, you are Eve", the world's greatest hacker. You've been intercepting Alice's messages for some time now, and know that she always ends her messages with the signature Your friend, Alice'. Your job is now as follows: 1. Determine the key Alice is using from the above cipher text tweet.(This is to be done before you code your solution) 2. Using this key value, write a function to decrypt any future communications from Alice. This method should take the encrypted string as an input and return the original unencrypted string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions