Haha! eat it Dev-C++..
My Encryption program is now fully(73%) working!
Intructions:
Encrypt
1. Download all files into the same folder
2. Type the message you want to encrypt into
encrypt.txt
3. The the encrypted text will be saved to
decrypt.txt
4. Run
Encrypt.exe
5. Type in a one character key (This key will be used to decrypt your message.)
6. Just open up
decrypt.txt to view the encryption.
Decrypt
1. Copy and paste the code you want to decrypt into the
encrypt.txt & save
2. Clear the
decrypt.txt and save it. (you will need it clear to view the decrypted message)
3. Run Encrypt.exe
4. Type in the key used to decrypt the file.
5. Check
decrypt.txt for the decrypted message.
Credits:
A freakin huge amount of credit goes to
zeco for figuring out how to write and read files. Thanks zeco
Wo_Ot! lalakijilp got the secret message. Here is the source:
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void encrypt();
void decrypt();
void start();
int main()
{
start();
system("pause");
return 0;
}
void start(){
char choice;
cout << "Would you like to encrypt, or Decrypt a file?\n" << endl;
cout << "q.) Quit\n";
cout << "e.) Encrypt/Decrypt\n";
cin >> choice;
switch(choice){
case 'q':
break;
case 'e':
system("cls");
decrypt();
system("cls");
start();
break;
default:
system("cls");
start();
break;
}
}
void decrypt()
{
fstream ifile;
fstream efile;
char key;
string iput;
ifile.open("encrypt.txt");
efile.open("decrypt.txt");
cout << "Place the text you want to decrypt or encrypt in the file 'encrypt.txt'"<<endl;
if (ifile.is_open())
{
cout << "What key is the input encrypted in?" << endl;
cin >> key;
while(!ifile.eof())
{
getline(ifile, iput);
for(int i = 0; iput[i]; i++)
{
iput[i] = iput[i] ^ key;
}
efile << iput;
cout << iput;
}
ifile.close();
efile.close();
}
cout << endl;
system("pause");
}
I have also included the source in an attached .txt file
There is a sample message to decrypt included in the encrypt.txt file. the key is 'd'. Have fun!