avoid re-compile from IPA or APP file
The .ipa file etc. do not contain the app's source code, so the app cannot be recompiled from that.
It can be modified in other ways, though, so...
Is there something like HASH key and it will be changed if be re-complile?
That's what AppAttest does. But it's only useful if your app has some sort of server communication, i.e. the app sends an AppAttest-signed request to your server, which can check it. If there is no server communication it doesn't help. Note also that AppAttest is not supported on all devices, specifically if an iOS app is run on a Mac in "made for iPad" mode AppAttest is not available. Apple tells us that an AppAttest failure is just a factor that we should take into account, not a definitive yes/no. Which makes it much less useful than it would be otherwise.
Fundamentally, my advice has always been to avoid app types / demographics where piracy is a problem. There was a great Dilbert where he says "We will be targeting this type of customer..." and he is pointing to a chart where it says "Rich/Poor", "Smart/Stupid". If you can come up with an app that rich stupid people will buy, they will neither be motivated to pirate it, nor will they have the skills to do so.
The other bit of advice is to avoid apps where you actually have costs associated with pirated users, i.e. server costs or royalties that you pay to third parties. If you have royalties to pay, make sure that your contract only requires you to pay royalties for legitimate users. And try to ensure that your server costs are either fixed, or minimal.