Code:
bool check_key(uint64_t x) {
uint64_t r = x;
for (size_t i = 0; i < 64; ++i) {
for (size_t j = 0; j < 6; ++j) {
r ^= (((x >> (1 << j)) & (i >> j) & 1) << i);
}
}
return (x && r == 0);
}
The objective is to find valid 64-bit input keys that make the function return 'true'.
1. How many valid input keys are there?
2. Can you make a generator to enumerate all valid keys?
Z3 (or other SMT/SAT) tools are not allowed as solutions!