IDAFTAP
IDAFTAP is a series of (reverse engineering) puzzles by ~elly.Warning: explanations and solutions inside!
IDAFTAP 0
This program interprets the command line argument as a base-3 number and checks whether it equals 52992 (the value of IDAFTAP). The twist is that the digit value is the ASCII distance from A squared: (There's also a rule against presumably space characters, though my solutions with lower case letters didn't work either.)
The upside is that digit values may be much larger than 0, 1, 2 (normal values for base 3); the downside is that this forms a Diophantine equation with multiple quadratic terms, which are terrible to deal with. In fact, when you put the equation into Z3 for a fixed number of letters (even locking in 4 of 7 letters), it takes a lot longer than just brute-forcing inputs.
...so let's just switch to brute force. And while we're at it, let's try finding actual words. One word did not yield any results. One word plus a few random characters or two concatenated words yield plenty, like ELLEISM.
Overflows
Alternatively, we can abuse the fact that the program uses 32-bit integers to find solutions for .
Various approaches are available, like picking a starting phrase and appending lots of As or repeating a single letter or repeating a string.
Picking a starting phrase (prefix) followed by "A"s reduces the problem to:
where is the value of the prefix.
Finding the inverse is easy with the Euclidean algorithm.
Finding the discrete logarithm is a bit trickier, but can be done with sheer brute force because there's only multiplications to test (but Baby-step giant-step is easy to implement).
Note that and neither 2 nor 13 come up in the generator set of 3, so the prefix