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 numbersWrite 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)into words. For encryption: For each letter in the word, find the

2 3 4 5 6 7 8 9 2 2 2 2 24 22 12345678901 1 ab c d e f gh klmnopqrstuvwxyz 1 j

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!