Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Your task will be to create a C program that can encrypt and decrypt using a substitution cipher. Your program should ask for a mode
Your task will be to create a C program that can encrypt and decrypt using a substitution cipher. Your program should ask for a mode (encrypt or decrypt), a text file containing the cipher, and string input (plain text if encrypting, cipher text if decrypting). The output should be the cipher text if encrypting or the plain text if decrypting. Additionally, you should ensure that your program is not case sensitive and validate the cipher file to ensure that it does not have duplicate mappings or incomplete mappings. Each letter must appear on the left-hand side exactly once and the right-hand side exactly once. The file format for the cipher file should be comma-separated values. There should be one rule per line and each begins with the letter being replaced, and ends with the letter replacing it. The above rules would be written in this format as: Requirements: - The input to your program must match what is listed in the description (mode, cipher file, string). You may either prompt or use CLI input (arguments to the exe) - Your program must not be case sensitive. 'hello', 'Hello', 'HELLO', and 'HeLlO' should all produce the same output, for example. - Your program must validate the structure of the cipher file and output with an appropriate error message if it is not followed. - A file with lines X,A and X,R should be rejected. - A file with the lines X,A and X,R should be rejected - A file with the lines X,A and D,a should be rejected - You may assume that input will only be single words - You do not need to consider whitespace, punctuation, or special symbols
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