Question: .'il T-Mobile Wi-Fi . 7:38 PM Lab Lab2.pdf Implement, in C or assembly languape, an encryption/ decryption program that meets the Input Your program should

 .'il T-Mobile Wi-Fi . 7:38 PM Lab Lab2.pdf Implement, in C

.'il T-Mobile Wi-Fi . 7:38 PM Lab Lab2.pdf Implement, in C or assembly languape, an encryption/ decryption program that meets the Input Your program should prompt the user for thece separale inputs from the keyboand, as follows 1. The prompt: IF YOU WANT TO ENCRYPT-TYPE E; IF YOU WANT TO DECRYPT. TYPE D: The user will type E or D. A real woeld program should also detect any other character typed and respond with THAT IS AN ILLEGAL CHARACTER PLEASE TRY AGAIN. We will assume in this assignmment that the user can type an E or D correctly 2. The peompt:ENTER THE ENCRYPTION KEY (A SINGLE DIGIT FROM I TO 9) . The user will type a single digit, from I to 9. Again, we will assume the user is not an Aggie and can successfully hit digit keys on the keyboard. Your program will accept this digit, store it in a location of choice in RAM, and use it 1o encrypt ee decrypt the message. 3. The prompt: INPUT A MESSAGE OF NO MORE THAN 20 CHARACTERS. WHEN DONE, PRESS ENTER The user will input a character string froes the keyboand, terminating the message with the ENTER>key location of cheice in RAM. Since t .Your programs will stoee the message, starting a is restricted to #20 characters, you must reserve locations memory locations to store the message Note that 820 x14.) the message One constraint: Messages mast be less than or equal to N20 characters.(Recall: means the number is decimal) Algorithm The encryption algorithm is as follows. Each ASCII code in the message will be transfermed as follow 1. The low order bit of the code wil be togpled. That is, if in is a 1, it will be replaced by a 0 if it is a O it will be roplaced bya 2. The key will be added to the resalt of stcp I above For example, if the input (plain text) is A and the enecryption key is 6, the program should take the ASCl valuc of A, 01000001, toggle bit [0-0], peoducing 01000000 and then add the encrypion key, 6, The final output characier would be 01000110, which is the ASC value F The decryption algorithm is tbe reverse. That is I, Subtract the encryption key from the ASCII code 2. Toggle the low order bit of the result of sicp 1 . For example, if the input (cipher texr) isF, and the encryption key 6, we fir subtract the encryption key (ie, we add -6) from the ASCII value of F, 01000110+11111010, yielding 01000000 We them toggle bit [0:0]. peoducing O01000001, which is the ASC The result of the encryption/decryption algorithm should be stored in a location of choice in RAM Output Your program should output the enerypted er decrypled message to the screen Note that the algorithm stored the message to be output starting in a location of choice in RAM Courses Calendar To Do Notifications Inbox

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!