oeseling plain tese Es-nte.and then use Problem 4 125 Points: Decipher the messa
ID: 3815663 • Letter: O
Question
oeseling plain tese Es-nte.and then use Problem 4 125 Points: Decipher the message CWCV YKECK. Asumethat youkeerwav- Amne cipher and further nore you know that the key of the corresponding and a plain text "en is enciphered to "C". Please statethe details or herwyouwaae corresponding plain text by including ( 1 ) the values of the cipher text VS points. eywddcas on of how do you get the key of corresponding additive cipher 17 points: O)the value, corresponding plain text IS points: and then (4) the final result of correspondingplanwx1(8 points].Explanation / Answer
This Programme for converting plain text to cipher text:
#include <stdio.h>
#include <string.h>
int main()
{
char plainText[100], cipherText[100], value;
int i = 0, auto_key;
/* We are taking input string from the user */
printf("Enter the value of plain text(captial letters):");
fgets(plainText, 100, stdin);
/* We are taking autokey as a input from the user */
printf("Enter the auto key to convert cipher text:");
scanf("%d", &auto_key);
plainText[strlen(plainText) - 1] = '';
/* converting plain text to cipher text */
while (plainText[i] != '') {
if ((plainText[i] + auto_key) > 'Z') {
value = (plainText[i] + auto_key) - 'Z';
cipherText[i] = 'A' + value - 1;
} else {
cipherText[i] = plainText[i] + auto_key;
}
i++;
}
cipherText[i] = '';
/* print message of the cipher text */
printf("The values of the ciphertext: %s ", cipherText);
i = 0;
/* Again here converting cipher text to plain text */
printf("Final result of Corresponding Plain Text:");
while (cipherText[i] != '') {
if ((cipherText[i] - auto_key) < 'A') {
printf("%c", 'Z' + 1 - ('A' - (cipherText[i] - auto_key)));
}
else
{
printf("%c", cipherText[i] - auto_key);
}
i++;
}
printf(" ");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.