You can save XORed lines with some constant buffer, and restore the original line during use. Not so easy to maintain, though ...
For example, the string "hello", XORed with 0x55:
hello: 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x00 0x55: 0x55, 0x55, 0x55, 0x55, 0x55, 0x55 result: 0x3D, 0x30, 0x39, 0x39, 0x3A, 0x55
So we save the buffer:
char enc_str[] = { 0x3D, 0x30, 0x39, 0x39, 0x3A, 0x55 };
This is our decryption function (simplified):
#define DEC_STR(X, Y) getDecryptedStr(X, Y sizeof(Y)) void getDecryptedStr(char * dec_str, char * enc_str, size_t size) { int i; for (i = 0; i < size; ++i) { dec_str[i] = enc_str[i] ^ 0x55; } }
And how do we use it:
char clear_str[sizeof(enc_str)]; DEC_STR(clear_str, enc_str);