I'm aware that this is a bizarre request, but I need to obfuscate raw c# source code.
Although it is a bad idea, the c# code would be compiled client side via a CSharpCodeProvider. Is there any existing class in c# to obfuscate source code? Alternatively, is there a third party library to do so?
I've thought about using Roslyn and manual variable renaming but I can't find any information on how to do that. Does anyone know how to rename variables (and load a solution) using Roslyn?
I've tried a manual syntax parser, which didn't go well.
What I've done so far:
Removed ALL comments.
Removed all newlines and whitespace.
Put all the files from all the different projects into one folder with random 25 character alphanumeric names.
Added random comments mid code line. Not gonna stop anyone but gives me a headache to read public /*SJKDSJKDJ398sLAjljKKxklw*/int /*SDSDSJCJKIORIO*/ privateServerKey = /*SDKSDKSDFKJSFKJ*/ ...
Bizzare? No. Sometimes one has to send compilable source code to a third party, without making it possible for the third party to easily understand the source code. We'll agree that obfuscators don't make it impossible to understand code, but that's not the point. Your house front door lock won't stop any serious thieves, but you'd be a fool to not have one if you have a house.
Our C# Source Code Obfuscator probably does what you want.
Mostly what it does is scramble the identifiers in a safe way. The bigger the code base, the more effective this is.
It also strips whitespace and comments to damage readability. It doesn't shuffle code files between different directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With