I have seen many C# obfuscators, and they all need an assembly (.exe, .dll, etc.) Why isn't it possible to just obfuscate the source code? Like you can do with javascript for example: http://www.javascriptobfuscator.com
-
6I know at least two persons who can do the job, easily!Timbo– Timbo2012-08-17 15:57:18 +00:00Commented Aug 17, 2012 at 15:57
-
2Why obfuscate source code when you can just... not give it them at all...Egor– Egor2012-08-17 15:57:22 +00:00Commented Aug 17, 2012 at 15:57
-
Why is it not possible? It is obviously possible. There's just no product available that does it. There's no real question here.usr– usr2013-10-30 20:09:15 +00:00Commented Oct 30, 2013 at 20:09
3 Answers
It doesn't make any sense to obfuscate source code. That's because source code is shared for maintainance or experience sharing. That's why obfuscation targets deployable artifacts, like exe or dll...
In case of JavaScript the code itself is deployable artifact, so for Java Script it has a perfect meaning for intellectual property protection.
1 Comment
You obfuscate what you release to the customer, not what you have to keep clear so that you can maintain it.
You release javascript files, you obfuscate them (and keep the non obfuscated ones to maintain the application). So you have two sets of javascript files : the source and the released. If there was a distinct released compiled format, this would probably be the obfuscation target.
You release .class files, not .java files, so you obfuscate the .class.
You release exe, not c or c# files, so you obfuscate the exe.
Other concrete reasons :
- a C or C# file (or java) may be used in different applications. And the content that may be stripped or changed will be different depending on the application
- a C, C# or java file contains items necessary for the compilation that can't be stripped only in one file : you have to obfuscate the whole set (for example, if you rename a class or a visible field, you usually maintain in memory a table while obfuscating).
Comments
I agree with @dystroy, in that you obfuscate what you release.
But to directly answer the question posed-- b/c so few people release C# code.
If you need to release C# code, AND you wish to obfuscate it, I recommend a one-two punch of:
- Make "internal" all types not needed to be "public"
- Compile your assembly containing the source code to be released
- Use RedGate SmartAssembly to obfuscate that assembly.
- Use JetBrains dotPeek to reveal the obfuscated source code, and dump to disk.
- Zip obfuscated source code and release it.