- Home /
making a c# file unreadable
hi everyone i was just wandering how i stop people from being able to read my c# script after uploading it to the asset store
this came up a few days ago, I have no knowledge on the subject but maybe these links can help :
http://answers.unity3d.com/questions/10879/is-it-possible-to-hackdecode-asset-files.html
http://answers.unity3d.com/questions/33273/hacking-unity3d.html
http://answers.unity3d.com/questions/252901/unity-scripts-can-be-stolen.html
to be honest i dont really $$anonymous$$d if people want to edit my script, or whatever they want to do with it, by all means make it better just make sure to give me a copy hah.
it was mainly to stop the scripts from being edited inside unity so that it couldn't cause problems to the user if they thought im going to add something to it and it causes their computer to blow up.
ive noticed when i download assets they are closed from being read or rather encrypted and that what i want, im on mac
Answer by DaveA · May 17, 2012 at 02:44 AM
There is an Obfuscator plugin in the Asset Store. It will make it harder to read. Like 'bullet proof' there is no such thing. But 'good enough' there is. So if you want to scare off the casual hacker, obfuscate it. Cuts down on the number of folks able/willing to rip you off. Never 100%. But better than nothing if you really want it.
i think theres actually two answers to a simple question which has now turned into a pro/con forum
Answer by rutter · May 16, 2012 at 07:29 PM
Why would you even want to do that? I don't think I'd buy anything from the asset store that didn't include source code.
Well, a lot software has a closed-source-philosophy, especially the most expensive pieces ;) Unity3D is the best example. They don't offer you the source since that would prevent a lot people from buying it. If the source is available, it will be shared across the internet. The fact that it's illegal to use it without license will be ignored by most people since it's hard to tell someone used your code when it can be changed at anytime.
$$anonymous$$ost expensive assets in the store (` > $200 `) also don't include the source. If it's just a managed code assembly it's easy to get the code back, but native code plugins for example can not be decompiled that easy ;)
Good point. Substances might be another example where people would feel less need to be able to tinker. So I guess it comes down to: the smaller and simpler a system is, the more I can reasonably expect to be able to tinker with its inner workings? Something like that, anyway.
I also sometimes worry about being able to fix bugs, especially regressions introduced by new Unity versions, which is theoretically less of a concern with a product that's being reliably supported and updated.
Closed-source software is one of the greatest evils of our age. It's like selling you a motorbike, and saying "but if it breaks down, or fails for any reason, you'll have to wait for us to fix it for you 'cause you're not allowed to do anything to it yourself". Even if you have the skills to repair/improve the buggy or non-functional code you are provided with (and let's face it, everything has bugs), you simply can't do it because they don't allow you to see the source.
Answer by Tasarran · May 16, 2012 at 05:11 PM
You cannot.
Best you can do is to make it hard to read, but that won't stop someone who is determined.
One can even extract your code from a compiled EXE file.
The code has to be readable by the computer, and if it can be run in your computer, it can be de-compiled by a savvy user.
That's what I read the other day on http://answers.unity3d.com/questions/252901/unity-scripts-can-be-stolen.html . But my Property is not all that Intellectual to worry about it =]
Basically, its like door locks:
There isn't a lock in the world that can't be picked by someone who knows how to pick locks, given enough skill and time.
But people still lock doors, and it still keeps most people out, most of the time.
Unfortunately nothing's completely certain in this vale of $$anonymous$$rs, my friend...
$$anonymous$$y standard response to the issue: "If you're worried about somebody s$$anonymous$$ling your code, you haven't been program$$anonymous$$g long enough." With very few exceptions, the value of your work is never in actual text file.
This is one of the reasons so many people are willing to share their code; it's just not even worth trying to hide it in most cases, because if someone really wants it, they will get it anyway.
so basically i dont need a door i need a bank vault with a nuke that blows when its opened
Answer by by0log1c · May 16, 2012 at 08:48 PM
People have done a great job explaining why there'll always be a way to retrieve the source code, especially with the CIL. People have also point out that AssetStore's users like and want to have a copy of the source code, so those are not very good reason to lock your code away.
That being said, you may help yourself by compiling to a .exe or .dll and by using the ObfuscateAssemblyAttribute. Finally, roll your compiled program through Telerik's Eazfuscator. The whole process should keep most people off.
I read through all answers and was about to suggest building a custom assembly, but then, at the end i found your answer ;)
If he just worrys about the code being changed, compiling to a dll will be enough. If someone is interested how it's made he can simply use a .NET reflector.
Your answer
Follow this Question
Related Questions
XML Encryption 1 Answer
Data encryption to transfer data over web 1 Answer
How to properly handle encryption for files? 0 Answers
How to convert texture2D to image in C# 3 Answers
java to c# 2 Answers