Search code examples
c#javareflectiondecompiling

Reflecting a way for decompiling?


If so, how can i protect my code from being decompiled?
Or from being reflected? If actually the two are very different from each other.
Tools like Dotfuscator for the .Net framework, do they help your code from being decompiled? Does that mean that i can still reflect on it and see it's contents??


Solution

  • You can't ever stop either. You can make it so that decompiling the program returns incomprehensible and confusing code, but it still will be valid code that results in a program that functions identically to yours. Making subtle changes will be harder, but not impossible. Doing that is called obfuscation, which is what those tools are.

    Obfuscators go around doing things like changing all variable names to meaningless alphanumeric values, performing all sorts of code refactors that don't change how the code works, but just are things that do the same thing in a different way (and is somehow harder for humans to understand, but not computers). They can also add in code that doesn't do anything, just to confuse people, etc. Different obfuscators will do all sorts of different things, and they can have some differences such as, whether or not they accidentally introduce bugs, what their effect is on the size of the compiled program, and how close the compiled program is from the original source (which, granted, is somewhat subjective).

    It has the same effect on reflection, although reflecting and decompiling are completely different.