void main(int argc,char *argv[])
{
FILE *fp1,*fp2;
unsigned char c,ch;
char key[20];
char name[20];
if (argc==1)
{
system("cls");
printf("\nVersion 1.0 JM.EXE (c) by leopro\n");
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf(" This is a free program. It can encipher your files.\n");
printf("This single file can do encryption and decryption.\n\n");
printf("Command line: JM [oldfile] [newfile]\n");
printf(" OR JM [filename]\n\n");
printf(" Then you will be asked to input a password, choose a password include numbers\n");
printf("and characters. Remember the password, without it you can't open your file!\n\n\n");
printf("Press 'Q' or 'q' to quit, others to go on!\n");
ch=getch();
if((ch=='Q')||(ch=='q')) exit(0);
else
printf("Please input the filename to process: ");
scanf("%s",name);
fp1=fopen(name,"rb");
strcat(name,".jm");
fp2=fopen(name,"wb");
}
else
{
fp1=fopen(argv[1],"rb");
if (argc==2) fp2=fopen(argv[1],"wb");
if (argc==3) fp2=fopen(argv[2],"wb");
}
if (fp1==NULL || fp2==NULL)
{ printf("Cannot open file!\n");
exit(1); }
printf("Please input the key:");
scanf("%s",key);
srand((unsigned int)key);
ch=fgetc(fp1);
while (!feof(fp1)) {
c=rand();
ch=ch^c;
fputc(ch,fp2);
ch=fgetc(fp1);
}
fclose(fp1);
fclose(fp2);
exit(0);
}