Hello dear members, i am looking for a solution for my problem:

-I want to write .ini values (xor-ed)
-Then i want to read the .ini (un-xor)
-Finally i want to be able to access the values

Example :

boom = 1
haha = 23446453
text = ADSdsajew

I have made some tests, but unfortunately, i cannot read it, and access the values.
My code is so lame that i will not even post it here... please give me examples

Many thanks!

The typical way this sort of trivial "encryption" is done is to have an alpha-numeric key of some reasonable length. You then walk the key and use each character in turn to xor with a target character in the file. Example:

void encrypt(char* filedata, const char* key)
        for (int i = 0, j = strlen(key); i < j && *filedata != '\0'; i++, filedata++)
            *filedata ^= key[i];
    } while (*filedata != '\0');

void decrypt(char* filedata, const char* key)
    encrypt(filedata, key);

Note a couple of things. One is that decrypt() calls encrypt because the second pass of xor on the file data will revert the data back to its original state. Next is that the main loop in the encrypt() function will cycle over the key until the filedata element is fully encrypted. This will encrypt/decrypt the entire .ini file. You will need to make multiple calls to encrypt and decrypt if you just want to encode/decode the value data.

Thank you for the encrypt example, even though i have a much more stronger one:

string encryptDecrypt(string toEncrypt) {
    char key[64] = { 'F', '2', 'D', 'C', '5', '4', '0', 'D', 'B', 'F', '3', 'E', '1', '2', '9', 'F', '4', 'E', 'A', 'A', 'F', '7', '6', '7', '5', '6', '9', 'E', '3', 'C', 'F', '9', '7', '5', '2', 'B', '4', 'B', '8', '2', '6', 'D', '9', '8', 'F', 'D', '8', '3', '8', '4', '6', '0', '8', '5', 'C', '0', '3', '7', 'D', '3', '5', 'F', '7', '5' }; //Any chars will work, in an array of any size
    string output = toEncrypt;
    // custom function made by me :)
    for (int i = 0; i < toEncrypt.size(); i++)
        output[i] = toEncrypt[i] ^ key[i % (sizeof(key) / sizeof(char))];

    return output;

This is not what i need, i need to actually be able to use my values once is decrypted, hmm let me explain:

    std::string Filename = "abc.ini";
    std::ifstream input(Filename, std::ios::binary | ios::in);  // Open the file

    //input.seekg(0, ios::beg);
    //int fLength = input.tellg();
    //input.seekg(0, ios::end);

    std::string line;                                           // Temp variable
    std::vector<std::string> lines;                             // Vector for holding all lines in the file
    while (std::getline(input, line))                           // Read lines as long as the file is

            // Save the line in the vector ?


    // Here i should call the ini reader? but how?
    CIniReader iniReader("abc.ini");
    string my = encryptDecrypt(iniReader.ReadString("test", "baubau", ""));

    for (auto s : lines)                                         // For each line in vector
        cout << my;
        cout << endl;                                           // new line

If i call the .ini reader on the file, of course it will no be decrypted, so please help me do this, open the file, decrypt values, store them (in a temp[]?), then be able to use the values.

    Many Thanks!

Please help! :( i need this a.s.a.p ....

i need this a.s.a.p

People here help you voluntarily, do not say you need it NOW, because they really don't care. They will help you when they have time and want to help you. Stamping your feet will make them think twice.

Of course i understand, i just need this really quick and i don`t know what to do ...