Projects list 1) Secure communication through cryptography Sending the data from
ID: 3572033 • Letter: P
Question
Projects list 1) Secure communication through cryptography Sending the data from the transmitter to the receiver through an open and non-secure wireless channel could allow unauthorized individuals to intercept and read the data. You are assigned the task of designing an encryption and decryption functions using either C++ or MATLAB to make sure that even if the data was intercepted by any unauthorized person he will not be able to understand its meaning. The encryption function is described as follows: Get the text to be sent (P) and replace each letter of it with its substitution according to the table below: ABCDE FGHIJK LM NO PQRSTUVW XYZ ZYX WVUTSRQPON IML KJIHG FED CBA e.g. Ais replaced with Z Consider that each letter of the alphabet is assigned a number starting with A 01 and ending at z 26. Get the numerical representation of each letter generated from the previous step and save it in array. e.g.C is rel presented with 03 Add K to each element of the created array in the previous step to generate a new array where each element is shifted by k numbers. egg, K 2 then 03 K Os Combine the previous array in one cell variable that is called C. eg. The array containing 0301 25 will be 030125 Cis the encrypted message that will be sent through the non-secure medium. You are supposed to present two functions: Encryption function o Receive the plain text P and the key K. o Return the encrypted text C. Decryption function o Receive the encrypted text Cand the key K. o Return the plain text PExplanation / Answer
#include<stdio.h>
int main()
{
FILE *fp1, *fp2;
char ch;
fp1 = fopen("/home/tusharsoni/Desktop/Source","r");
if(fp1 == NULL)
{
printf("Source File Could Not Be Found ");
}
fp2 = fopen("/home/tusharsoni/Desktop/Target","w");
if(fp2 == NULL)
{
printf("Target File Could Not Be Found ");
}
while(1)
{
ch = fgetc(fp1);
if(ch == EOF)
{
printf(" End Of File ");
break;
}
else
{
ch = ch - (8 * 5 - 3);
fputc(ch, fp2);
}
}
fclose(fp1);
fclose(fp2);
printf(" ");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.