hi
plz help me overcome a few errors in my encryption project....
thanks
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <conio.h>
char passwrd[6]="",pw[7];
char pass[7],code;
void genpassword();
void getpassword();
void doCrypt(char *cool)
{
int cryp; //the main int this function uses
char x; //to get the chars from the file
ifstream in; //the input stream
ofstream out; //the output stream
in.open(cool); //opening the input file
if(in.fail()) //check if it's not there
{ cout<<"\nCouldn't open the IN file\n"; //if it's not, print
delay(500);
return;
}
cout<<"\nEnter the OUT file name: "; //enter the output filename
cin>>cool; //get it
out.open(cool); //open the output file
for(int s=0;s<6;s++)
out<<(char)passwrd[s];
code=passwrd[5];
in.get(x);
while(x != EOF) //while x is not beyong End Of File
{ if(code=='A')
{cryp=x-0xFA3A; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='B')
{cryp=x-0xFA3B; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='C')
{cryp=x-0xFA3C; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='D')
{cryp=x-0xFA3D; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='E')
{cryp=x-0xFA3E; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='F')
{cryp=x-0xFA3F; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='G')
{cryp=x-0xFA40; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='H')
{cryp=x-0xFA41; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='I')
{cryp=x-0xFA42; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='J')
{cryp=x-0xFA43; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='K')
{cryp=x-0xFA44; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='L')
{cryp=x-0xFA45; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='M')
{cryp=x-0xFA46; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='N')
{cryp=x-0xFA47; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='O')
{cryp=x-0xFA48; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='P')
{cryp=x-0xFA49; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='Q')
{cryp=x-0xFA4A; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='R')
{cryp=x-0xFA4B; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='S')
{cryp=x-0xFA4C; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='T')
{cryp=x-0xFA4D; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='U')
{cryp=x-0xFA4E; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='V')
{cryp=x-0xFA4F; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='W')
{cryp=x-0xFA50; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='X')
{cryp=x-0xFA51; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='Y')
{cryp=x-0xFA52; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='Z')
{cryp=x-0xFA53; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='a')
{cryp=x-0xFA54; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='b')
{cryp=x-0xFA55; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='c')
{cryp=x-0xFA56; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='d')
{cryp=x-0xFA57; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='e')
{cryp=x-0xFA58; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='f')
{cryp=x-0xFA59; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='g')
{cryp=x-0xFA5A; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='h')
{cryp=x-0xFA5B; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='i')
{cryp=x-0xFA5C; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='j')
{cryp=x-0xFA5D; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='k')
{cryp=x-0xFA5E; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='l')
{cryp=x-0xFA5F; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='m')
{cryp=x-0xFA60; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='n')
{cryp=x-0xFA61; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='o')
{cryp=x-0xFA62; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='p')
{cryp=x-0xFA63; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='q')
{cryp=x-0xFA64; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='r')
{cryp=x-0xFA65; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='s')
{cryp=x-0xFA66; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='t')
{cryp=x-0xFA67; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='u')
{cryp=x-0xFA68; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='v')
{cryp=x-0xFA69; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='w')
{cryp=x-0xFA6A; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='x')
{cryp=x-0xFA6B; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='y')
{cryp=x-0xFA6C; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code=='z')
{cryp=x-0xFA6D; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==1)
{cryp=x-0xFA6E; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==2)
{cryp=x-0xFA6F; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==3)
{cryp=x-0xFA70; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==4)
{cryp=x-0xFA71; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==5)
{cryp=x-0xFA72; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==6)
{cryp=x-0xFA73; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==7)
{cryp=x-0xFA74; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==8)
{cryp=x-0xFAC75; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==9)
{cryp=x-0xFA76; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(code==0)
{cryp=x-0xFA77; //the crypting
out<<(char)cryp; //print the crypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
in.close();
out.close();
return;
}
void deCrypt(char *daf)
{ getpassword();
int decr; //the main int
char x,vercode; //the input char
ifstream in; //input stream
ofstream out; //output stream
in.open(daf); //open the inout stream
if(in.fail()) //see if it's not there
{ cout<<"Error couldn't open the IN file\n"; //print
delay(500);
return;
}
in.getline(pass,7);
if(strcmp(pass,pw))
{cout<<"INCORRECT PASSWORD";
delay(500);
exit(0);
}
else
{ cout<<"\nEnter the OUT file name: "; //ask for the out filename
cin>>daf;
out.open(daf); //open the outfile
vercode=pw[5];
in.get(x); //get the input char
while(x != EOF) //while x is not beyong End Of File
{ if(vercode=='A')
{decr=x+0xFA3A; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='B')
{decr=x+0xFA3B; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='C')
{decr=x+0xFA3C; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='D')
{decr=x+0xFA3D; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='E')
{decr=x+0xFA3E; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='F')
{decr=x+0xFA3F; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='G')
{decr=x+0xFA40; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='H')
{decr=x+0xFA41; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='I')
{decr=x+0xFA42; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='J')
{decr=x+0xFA43; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='K')
{decr=x+0xFA44; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='L')
{decr=x+0xFA45; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='M')
{decr=x+0xFA46; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='N')
{decr=x+0xFA47; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='O')
{decr=x+0xFA48; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='P')
{decr=x+0xFA49; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='Q')
{decr=x+0xFA4A; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='R')
{decr=x+0xFA4B; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='S')
{decr=x+0xFA4C; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='T')
{decr=x+0xFA4D; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='U')
{decr=x+0xFA4E; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='V')
{decr=x+0xFA4F; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='W')
{decr=x+0xFA50; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='X')
{decr=x+0xFA51; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='Y')
{decr=x+0xFA52; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='Z')
{decr=x+0xFA53; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='a')
{decr=x+0xFA54; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='b')
{decr=x+0xFA55; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='c')
{decr=x+0xFA56; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='d')
{decr=x+0xFA57; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='e')
{decr=x+0xFA58; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='f')
{decr=x+0xFA59; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='g')
{decr=x+0xFA5A; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='h')
{decr=x+0xFA5B; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='i')
{decr=x+0xFA5C; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='j')
{decr=x+0xFA5D; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='k')
{decr=x+0xFA5E; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='l')
{decr=x+0xFA5F; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='m')
{decr=x+0xFA60; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='n')
{decr=x+0xFA61; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='o')
{decr=x+0xFA62; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='p')
{decr=x+0xFA63; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='q')
{decr=x+0xFA64; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='r')
{decr=x+0xFA65; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='s')
{decr=x+0xFA66; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='t')
{decr=x+0xFA67; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='u')
{decr=x+0xFA68; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='v')
{decr=x+0xFA69; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='w')
{decr=x+0xFA6A; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='x')
{decr=x+0xFA6B; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='y')
{decr=x+0xFA6C; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode=='z')
{decr=x+0xFA6D; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==1)
{decr=x+0xFA6E; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==2)
{decr=x+0xFA6F; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==3)
{decr=x+0xFA70; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==4)
{decr=x+0xFA71; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==5)
{decr=x+0xFA72; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==6)
{decr=x+0xFA73; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==7)
{decr=x+0xFA74; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==8)
{decr=x+0xFAC75; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==9)
{decr=x+0xFA76; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
else if(vercode==0)
{decr=x+0xFA77; //the decrypting
out<<(char)decr; //print the decrypted char
in.get(x); //get another char
if(in.eof()) //if read beyong end of file
{
delay(500);
break; }
}
}
in.close();
out.close();
return;
}
int main()
{ clrscr();
char *cool=new char[20]; //the name pointer
char nav; //"navigation char"
system("pause");
cout << "\n\n";
cout << "Use \"m\" for the Menu\n"; //print instructions
for(int i=0;i<2;i++)
{
cin>>nav;
switch(nav)
{ case 'm':
clrscr();
cout<<" WELCOME TO CRYPTER\n"
" This software will help you encrypt your Text files\n"
" and decrypt them when you need them\n\n\n\n";
cout <<" COMMAND\t FUNCTION\n";
cout << " e \tencrypt\n"
" d \tdecrypt\n"
" q \t quit \n\n\n";
cout<< " Enter your choice - ";
break;
case 'e':
clrscr();
cout << "Enter the file name: \nExample: \"file\".txt\n";
cin >> cool;
genpassword();
doCrypt(cool);
delay(500);
break;
case 'd':
clrscr();
cout << "\nEnter the file name: ";
cin >> cool;
deCrypt(cool);
delay(500);
break;
case 'q':
clrscr();
exit(0);
break;
default:
cout << "I do not understand you!\n";
delay(1000);
break;
}
}
}
void genpassword()
{
char alpha[80]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int numChars=6;
srand((unsigned)(time(0)));
for (int n=0; n<numChars; n++)
{
int x;
x = 0 + int(61.0 * rand()/(RAND_MAX+1.0));
passwrd[n]= alpha[x];
}
cout<<"The password is ";
cout.write(passwrd,6);
}
void getpassword()
{
cout<<"Enter password - ";
for(int i=0;i<6;i++)
cin>>pw[i];
}