I have to decrypt two files(Cryptogram1 and Cryptogram2). I have the program that encrypted the files, and I have to switch part of it in order to change program to decryption.
Cryptogram2 encrypted with the key: engineer
I was told that I should change the last portion of this encryption program in order to complete my assignment.
What should I change in order to achieve my goal.
Encryption Program:
#include<stdio.h>
main()
{
FILE *fpin, *fpout;
char Stringarray[100];
char datafile[20];
char outfile[20];
char key[8];
short theChar, keySize;
short n, temp1, temp2;
keySize=8;
printf("\n this program will read in a character string");
printf("\n enter the char string filename:");
scanf("%s", datafile);
printf("\n enter an 8-char key:");
scanf("%s",key);
if ((fpin=fopen(datafile,"r"))==NULL)
{
printf("Open input file error:%s is not found.\n", datafile);
return 0;
}
printf("\n enter the output filename:");
scanf("%s",outfile);
if ((fpout=fopen(datafile,"r"))==NULL)
{
printf("Open input file error:%s\n",outfile);
fclose(fpin);
return 0;
}
printf("\n enter the output filename:");
scanf("%s",outfile);