Question
Write a c program that encrypt words into numbers and decrypt numbers into words. For encryption: For each letter in the word, find the corresponding
Write a c program that encrypt words into numbers and decrypt numbers into words. For encryption: For each letter in the word, find the corresponding number in the mapping scheme. They will then subtract the secret key from the corresponding number and then add 26 to it. They would then show the output numbers in reverse order. For example, given mapping a secret key of 10, the input word "hello" would be encrypted into the cipher text "31 28 28 21 24"
For decryption: For each number in the cipher text, they will add the secret key to it. They will then find the letter in the mapping that corresponds to whatever number they get. If the obtained number is greater than 26, the target number to look up will be the obtained number minus 26. then reverse the order of the obtained letters to get the original word that was encrypted. For example, given mapping2 , a secret key of 10, the cipher text "31 28 28 21 24" above will translate back to "hello"
note: 1.the picture is a mapping shceme. It should be a csv file, i.e.,the program should read the mapping schema (only 26 letter but with different correspondence numbers) from a file like the picture shows.
2. When encrypt words, words are read from a text file. each line contains only one word.
3.When decryprion, numbers are read from a text file. each line contains a series number ending with a letter(as the second picture shows)
2 3 4 5 6 7 8 9 2 2 2 2 24 22 12345678901 1 ab c d e f gh klmnopqrstuvwxyz 1 jStep 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