CRYPTOGRAPHY(text file) in C PROGRAMMING
JAYA ENGINEERING COLLEGE
MENTOR : SAM
(JAYA ENGINEERING COLLEGE)
(JAYA ENGINEERING COLLEGE)
DEPARTMENT : CSE - B
PROJECT DONE BY
#include<stdio.h>
#include<stdlib.h>
int encrypt();
int decrypt();
#include<stdlib.h>
int encrypt();
int decrypt();
FILE *fsrc,*fdes;
char ch;
int main()
{
int choice;
while(1)
{
printf("1 Encrypt \n");
printf("2 Decrypt \n");
printf("3 Exit \n");
printf("Enter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:encrypt();
break;
case 2:decrypt();
break;
case 3:exit(1);
break;
}
}
printf("\n");
}
char ch;
int main()
{
int choice;
while(1)
{
printf("1 Encrypt \n");
printf("2 Decrypt \n");
printf("3 Exit \n");
printf("Enter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:encrypt();
break;
case 2:decrypt();
break;
case 3:exit(1);
break;
}
}
printf("\n");
}
int encrypt()
{
char src[25];
printf("\nEnter file name to Encrypt : ");
scanf("%s", src);
fsrc = fopen(src,"r");
{
char src[25];
printf("\nEnter file name to Encrypt : ");
scanf("%s", src);
fsrc = fopen(src,"r");
if(fsrc == NULL)
{
printf("not found \n");
}
fdes = fopen("encrypt.txt","w");
if(fdes == NULL)
{
printf("not found \n");
}
while(1)
{
ch = fgetc(fsrc);
if(ch == EOF)
{
printf("end of the file\n");
break;
}
else
{
ch = ch + 10;
fputc(ch,fdes);
}
}
fclose(fsrc);
fclose(fdes);
printf("\n");
}
{
printf("not found \n");
}
fdes = fopen("encrypt.txt","w");
if(fdes == NULL)
{
printf("not found \n");
}
while(1)
{
ch = fgetc(fsrc);
if(ch == EOF)
{
printf("end of the file\n");
break;
}
else
{
ch = ch + 10;
fputc(ch,fdes);
}
}
fclose(fsrc);
fclose(fdes);
printf("\n");
}
int decrypt()
{
printf("\n");
fsrc = fopen("encrypt.txt","r");
if(fsrc == NULL)
{
printf("not found \n");
}
fdes = fopen("output.txt","w");
if(fdes == NULL)
{
printf("not found \n");
}
while(1)
{
ch = fgetc(fsrc);
if(ch == EOF)
{
printf("end of the file\n");
break;
}
else
{
ch = ch - 10;
fputc(ch,fdes);
}
}
fclose(fdes);
fclose(fsrc);
printf("\n");
}
{
printf("\n");
fsrc = fopen("encrypt.txt","r");
if(fsrc == NULL)
{
printf("not found \n");
}
fdes = fopen("output.txt","w");
if(fdes == NULL)
{
printf("not found \n");
}
while(1)
{
ch = fgetc(fsrc);
if(ch == EOF)
{
printf("end of the file\n");
break;
}
else
{
ch = ch - 10;
fputc(ch,fdes);
}
}
fclose(fdes);
fclose(fsrc);
printf("\n");
}
Thank you for sharing this useful information.
ReplyDeleteEthical Hacking Course in Chennai | Hacking Course in Chennai
The content you posted that is related to technology is good. I expect more information from you like this.
ReplyDeleteWordpress Training in Chennai
Wordpress Training
wordpress course fees
Wordpress Training in Anna Nagar
Struts Training in Chennai
Struts Training center in Chennai
Spring Training in Chennai
Hibernate Training in Chennai
This blog is very informative. Keep posting like this...
ReplyDeleteCCNA training in chennai
Matlab training in chennai
C++ training in chennai
Ethical Hacking training in chennai
Cloud computing training in chennai
r programming training in chennai
Nice blog, very interesting to read. Thanks for your information.... Ethical Hacking Course Training, provides a real-time exposure for the students on the new and advanced technologies.
ReplyDeleteMatlab Training in Chennai | CCNA Training in Chennai | Ethical Hacking Training in Chennai | IOT Training in Chennai | Machine Learning training in Chennai
This program is very useful IOT Training in Chennai | R programming Training in Chennai | Selenium Training in Chennai | Big Data Training in Chennai
ReplyDelete