cybersecurity · beginner · ~15 min · safe pentest lab

Single-size UID?

Classify the UID size.

Challenge

Classify an ISO14443 UID by length. UIDs are 4 (single), 7 (double), or 10 (triple) bytes; the length signals the card generation and cascade level.

Task

Implement int uid_is_single(int len) that returns 1 if len == 4, else 0.

Input

  • len: the UID length in bytes the grader passes.

Output

Returns int: 1 if len is 4 (single-size), else 0.

Example

uid_is_single(4)   ->   1
uid_is_single(7)   ->   0   (double-size)

Edge cases

  • Any length other than 4 returns 0.

Input format

An int len: the UID length in bytes.

Output format

An int: 1 if len == 4, else 0.

Constraints

Single-size UID is exactly 4 bytes.

Starter code

int uid_is_single(int len) {
    /* TODO */
    return 0;
}

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