| | |
C++ encryption
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 2
Reputation:
Solved Threads: 0
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 *
*********************/
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 *
*********************/
There are a lot of ways you can do encryption, Just decide which way you want to proceed.. Which mode of operation you want to do. Which sequence you want to follow when you are XOR ing the data. Do you want to add any salt values to the key? Do you want to transform the key to something else? Do you want to follow any standard Algorithm?
Once you decide your strategy, just code that in C++. To start with, i will recommend you to read more on Ecnryption
Once you decide your strategy, just code that in C++. To start with, i will recommend you to read more on Ecnryption
![]() |
Similar Threads
- How to create SHA1 Encryption program (VB.NET)
- help with/removing window's encryption on my data (Windows NT / 2000 / XP)
- 128 bit encryption (Viruses, Spyware and other Nasties)
- AIM encryption (Viruses, Spyware and other Nasties)
- Storing passwords using reversible encryption in Active Directory (Windows NT / 2000 / XP)
- c++ windows program to demonstrate encryption (C++)
- No Encryption in IE 6.0/XP Home (Web Browsers)
Other Threads in the C++ Forum
- Previous Thread: Odd Errors When Compiling Winsock Code.
- Next Thread: Cant compile single c++ file
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






