Im trying to perform a XOR encryption on a BYTE (unsigned char) by trying to pass it directly into the function without defining it first.
XOR function:
void xor(BYTE input[], BYTE output[]) {
BYTE key[] = { 'T', 'A', 'M' }; //Can be any chars, and any size array
int i;
for (i = 0; i < sizeof(input); i++) {
output[i] = input[i] ^ key[i % (sizeof(key) / sizeof(BYTE))];
}
BYTE array example:
BYTE Shellcode[] =
{
0x48, 0x83, 0xEC, 0x08,
};
The problem is that i dont want to save the BYTE array without encrypting it because it will be exposed in memory then.
How could i directly pass the BYTE array into the function without defining it first?
With a simple char array that contains strings it would of course be easy but i cant find out how to pass the byte array with integer values instead of string literals.