cybersecurity · beginner · ~15 min
Validate the base64 alphabet.
Check whether a character belongs to the base64 alphabet — the per-character guard that rejects malformed or injected tokens before decoding.
Implement int is_base64_char(char c) that returns 1 if c is part of standard base64, else 0.
c: a single character the grader passes.Returns int: 1 for A-Z, a-z, 0-9, +, /, and the padding =; else 0.
is_base64_char('A') -> 1
is_base64_char('+') -> 1
is_base64_char('=') -> 1 (padding)
is_base64_char('!') -> 0
= counts as valid.A single character c.
An int: 1 if c is a base64 char (incl. =), else 0.
Standard alphabet A-Za-z0-9+/ plus padding =.
int is_base64_char(char c) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.