the encryption i use for my save games in my game is
encryption:
Code:
#include <iostream.h>
#include <windows.h>
#include <fstream.h>
void EncryptString(char* String)
{
int Length = strlen(String);
for(int i=0; i<Length; i++)
{
String[i]++;
}
}
int main()
{
ofstream outfile;
char encr[256];
cout<<"Type a string to encrypt(type * and then enter to encrypt): ";
cin.getline(encr, 256, '*');
EncryptString(encr);
outfile.open("encr.txt", ios::binary|ios::trunc);
outfile<<encr;
outfile.close();
Sleep(3000);
return 0;
}
decryption:
Code:
#include <iostream.h>
#include <windows.h>
#include <fstream.h>
#include <conio.h>
#include <conio.c>
#include <string.h>
#define PASSWORD "password"
void DecryptString(char* String)
{
int Length = strlen(String);
for(int i=0; i<Length; i++)
{
String[i]--;
}
}
int main()
{
ifstream infile;
char encr[250];
char pass[50];
int fail;
cout<<"A small hint...";
cout<<"\n\nThe password is: "<<strlen(PASSWORD)<<" characters long";
Sleep(2000);
clrscr();
cout<<"Password: ";
cin>>pass;
if(strcmpi(PASSWORD, pass) == 0)
{
cout<<"\n\nCorrect...";
Sleep(2500);
clrscr();
cout<<"Encrypted Data: \n\n\n";
infile.open("encr.txt", ios::binary);
infile >> encr;
infile.close();
DecryptString(encr);
cout<<encr;
getchar();
return 0;
}
else
{
while(strcmpi(PASSWORD, pass) != 0)
{
if(fail == 5)
{
clrscr();
cout<<"\nSorry...";
getchar();
exit(1);
}
fail++;
cout<<"\n\nIncorrect...";
Sleep(2500);
clrscr();
cout<<"Password: ";
cin>>pass;
}
cout<<"Correct...";
Sleep(2500);
clrscr();
cout<<"Encrypted Data: \n\n\n";
infile.open("encr.txt", ios::binary);
infile >> encr;
infile.close();
DecryptString(encr);
cout<<encr;
getchar();
return 0;
}
}
for me that is unreadable enough...it becomes even worse when you save it as binary as well