Someone else may correct me, but I don't believe there is any way to answer that query except by brute force (which is, of course, the point). A strong hashing algorithm returns effectively random output for even small changes in the input, so they are specifically designed so that you can't do exactly what you are trying to do. If you were able to guess an input that hashed with a certain suffix, you would effectively be well on your way to a collision attack, which SHA256 is still secure against. However, if you know what their proof of work system is, then you can take advantage of that simple fact.
This is what I would do:
- I would calculate the SHA256 hash of 10-20 million numbers (however many my computer can calculate in a reasonable amount of time).
- If, for instance, I calculated the SHA256 hash of the first 16 million numbers, I would expect that to give me roughly 5 million unique 6 character suffixes (I'm guessing wildly here)
- That means that, if asked for a string that hashes to a random 6 character suffix, then my list with ~5 million unique 6 character suffixes has a 30% chance of containing the answer.
- Since the lookup is effectively instant, that means that I can answer the challenge 30% of the time with no further effort.
- Therefore, while my DoS has lost some of its effectiveness, I can still get through!
If you have a fast CPU and can calculate hashes quickly then you can try to increase your pool of unique siffixes (i.e. hash more numbers). Note that it doesn't actually matter what you hash - only the number of unique things you hash, since each one will give you a new hash and, potentially, a new unique suffix.
The key here is that trying to match a random 6 character suffix will take you on average ~32,000,000 attempts. However, if you just store the random suffixes of those attempts and build a lookup table, you'll likely end up with a database that gives you a decent-enough success ratio without having to do further hashing calculations.
How successful something like this would be depends a lot on the specifics of the problem, but it's probably your best bet. For reference, hashing rates for SHA256 on "standard" GPUs are usually somewhere between 1 Mhash/s and 1000 Mhash/s. This means that if you have even a low-end GPU laying around (1 Mhash/s) you can hash 100,000,000 unique inputs in just a couple of minutes. Estimating off the top of my head, I expect that with 100,000,000 hashes you could probably land a hit in your lookup table for about 75% of their challenges.