cybersecurity · intermediate · ~15 min · safe pentest lab
Hex-encode a byte buffer.
Implement int uid_to_hex(const unsigned char *uid, int n, char *out, int outsz) writing the lowercase hex of n bytes into out, returning the length (n2), or -1 if it won't fit (need n2+1 bytes).
int uid_to_hex(const unsigned char *uid, int n, char *out, int outsz) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.