I'm trying to simulate the corruption of a packet transfer in a way that the checksum recognizes that the received packet is invalid.
Is there a function that allows me to change one single byte of the content of my packet?
EDIT: Ok, I'm trying to use XOR, that was a great idea, but now the problem persists. How can I change one single byte of my packet if the content I'm trying to corrupt is char*? How can i force it to work like a simple char and move my way around with a for cycle or something like that?
EDIT 2:
int main() {
packet* pkt = pkt_init(0,PKT,"Test Pkt 0",5);
int length = 10;
char content[length];
char xor[length];
content[length] = (char) pkt->content;
for(int i = 0; i<length; ++i)
xor[i] = ~content[i];
printf("Content: %s, Xor: %s\n", content, xor);
return 0;
}
How to i check if the "damaging" went well? The console returns this:
Content: �~p��, Xor: O��x���!