Thread: C++ encryption
View Single Post
Join Date: Oct 2008
Posts: 2
Reputation: jase728 has a little shameless behaviour in the past 
Solved Threads: 0
jase728 jase728 is offline Offline
Newbie Poster

C++ encryption

 
0
  #1
Oct 26th, 2008
I need help.
How do you encrypt multiple lines of a text file?




/*********************
*Made by Jase Inc *
*Made in 10/22/2008 *
*Boolean Cryptography*
*Using ^ operator *
*********************/





#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main () {
string line;


ifstream myfile ("text.txt");


char key[65]="jaf#$%skl%#ajlf^%dlkfhasjlk@#dsgsfsfrtw";
//Key that is used during the process
if (myfile.is_open())
{
while (! myfile.eof() )
{
getline (myfile,line);

cout << line;





}
myfile.close();
}
cout << endl;





ofstream m1 ("text.txt");

for (int x=0; x<27; x++)
{
line[x]=line[x]^key[x];

cout << line[x];

m1 << line [x];


//Encrypts data and wrties to file
}
cout << endl;



//m1 << "\nwhat is new?";
cout << endl;
m1.close();







return 0;
}

/*********************
*Made by Jase Inc *
*Made in 10/22/2008 *
*Boolean Cryptography*
*Using ^ operator *
*********************/
Reply With Quote