i need help with very simple encryption C++

basicall i just want to write to a text file but have it encrypted and then load that file back and have it decrypt it.

i dont want any sory of encryption key, i dont care how insecure this is as its not for anything that will be used for real just want it so that the text document isnt in plain text that is simply all i want to do but i dont know how to do that

i have got it writing and loading a txt file so i no how to do that but iv heard things about changin bit order somethin anyway any help and sample code will be seriously apriciated
You can use XOR enxcryption scheme:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int main()
{
   char key=10;
   char text[]={"Hello, world!"}; // text to encrypt

   for(int i=0;i<strlen(text);i++) // encrypt
       text[i]=text[i]^key;

    cout <<"Encrypted text: "<<text<<endl;

   for(int i=0;i<strlen(text);i++) // decrypt
       text[i]=text[i]^key;

    cout <<"Decrypted text: "<<text<<endl;

}

http://en.wikipedia.org/wiki/XOR_cipher
Last edited on
Topic archived. No new replies allowed.