networking · beginner · ~15 min

XOR checksum

Compute a one-byte XOR check.

Challenge

Implement unsigned char xor_checksum(const unsigned char *data, int n) returning the XOR of all n bytes (a simple parity/BCC check).

Starter code

unsigned char xor_checksum(const unsigned char *data, int n) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.