Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write C program Deciphering it all Finally, write a program called decipher.c that will take the result of the cipher.c program and attempt to determine

write C program

Deciphering it all Finally, write a program called decipher.c that will take the result of the cipher.c program and attempt to determine what the original message was by applying all three ciphers and seeing which one gives the most likely result. Now, although we cannot be sure which cipher was used, if we make some assumptions that the original text was mostly alphanumeric characters then we can make a decent guess. To approach this problem first read in the characters from the standard input (i.e., getchar()). We will set up our testing so that the output from the cipher program is fed into the decipher program for testing (based on pipes which we will discus later in the course). Once the array of characters has been read in you should try to decipher the message using each cipher and then choose the most likely match. To find the best match you must take each deciphered character and determine if it is an alphanumeric character (i.e., is it an upper or lowercase letter or a digit from 0 to 9 or the space character). You should count the percentage of decoded characters that are alphanumeric. The cipher that has the highest percentage of decoded alphanumeric characters that will be the cipher that we will assume is the correct one and you should display that result. You should display the count for each cipher as well. To test the code, use the following command (which assumes that the cipher and decipher programs are in the current directory): ./cipher | ./decipher Here is what the output should look like: student@COMP2401-F19:~$ ./cipher | ./decipher This is an Encoded Message ! Match = 46.43% Deciphered String = i1i1y]9 YMY11yY{ Match = 96.43% Deciphered String = This is an Encoded Message ! Match = 57.14% Deciphered String = ai@i@hg@*globjb@+jhnj@H Deciphered Message: "This is an Encoded Message !" student@COMP2401-F19:~$

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions