Making complex boolean circuits that give true as output only for a specific combination of boolean inputs
One basic strategy would be:


Choose a function f that is easily computable and collision-free on your input space. This could be anything from AES-encrypting with a fixed key to just XORing with a constant sequence. Or add some constant and take the result modulo some prime. The choice of f will determine how difficult your challenge will be, you can really go wild here.
Design a circuit C that computes f on the inputs
Compute f(x) of your desired correct input value (flag) x
Add a NOT-gate to every output of C that corresponds to a bit that is 0 in f(x). This will make sure that all outputs are 1 if your input matches x (and only then, because f is collision-free).
Combine all outputs with AND gates to get your final output