Hello, i would like to know how can we encrypt our code…
If someone knows please help me…
Hello, i would like to know how can we encrypt our code…
If someone knows please help me…
Why would you want to do that?
(How would you read it? ;D)
lol… its to protect the code… its harder… and I dont encrypt it on the eclipse… only encrypted to the jar file…
Protect the code from what?
If the encrypting tool fails all your code will be corrupt. :o
Okay, enough joking.
Seriously, why do you need to encrypt your code?
(The average person can’t read byte code anyway)
He is talking about Obfuscation.
Try searching for obfuscation, i’m not really sure of a good obfuscation tool to use, but it is what you are looking for.
Yeah, I know. But does the OP really need encryption?
Try obfuscation + wrapping it in an EXE or converting it to EXE through tools like Excelsior JET.
You can’t “encrypt” bytecode. There has to be something that will decrypt it to run it and that could be also broken. The reason you would want to protect bytecode is because it’s easily reverse-engineered. Obfuscation allows for harder reverse-engineering and converting to native makes it even harder.
I do think it’s useless though, code is cheap. Art is much more valuable and what people will want and that is what you should protect.
Code Isn’t cheap Imagine coding a game for 2 years, releasing it without it being obfuscated. Instantly anyone can decompile the class files into THE EXACT code you made (search jd-gui on google). They now know exactly how your code works, they can modify your game and produce their own version of it, in order to very easily hack/crack the game and distribute it over the internet.
If code was cheap you wouldn’t get programming jobs paying you over $60 an hour
I have been working on my game for over a year and a half. I don’t even want to guess how many hours of frustration and hard work I put into it, I wouldn’t want some random to have access to the code just like that. But that’s just me. If you are making an open source game then its fine.
Everyone who values the code they have written and don’t want the general public to be able to read it should use proguard. Trying to find out what a large obfuscated program does IMO will be harder than coding it from scratch.
jd-gui is also a useful tool to test if your program has been obfuscated correctly.
A few point: First is that the problem is unsolvable, so don’t spend too much time on it. Secondly code is infinitely less important than content. Lastly if someone “gets” your code, then either they are unable to use it because they don’t have the skills. If they do have the needed skills they it’s very unlikely they’d want to use it. It’s mostly a non-problem. Look at the leaked original quake & half-life 2 source codes. Sure people poked around with it, but it did zero “harm” to either company. Attempting to solve this problem is simply throwing away your time for no real purpose.
Code is cheap. Understanding, writing, using and fixing code is not.
Copyright legally protects you from people stealing it. Of course it doesn’t apply to the pirates and havkers as they don’t care about the law.
The chances of someone wanting to steal your code a low. Most of the code you will ever write will be average, and anyone who is capable of stealing it should be able to code it themselves.
If you do manage to write some amazing code, everyone should know about it. Keeping it a secret is useless to everyone.
The reason most code is kept secret is because there is a major flaw that could be exploited if it is known.
if code was cheap Adobe and Autodesk wouldn’t make as much money. Dont kid yourself
You could just as easily make the observation that if the code wasn’t cheap, Adobe and Autodesk wouldn’t make so much money.
Don’t underestimate the value of content, assets, design, marketing, support, etc. Without them the code is mostly worthless. For an alternate take, maybe look at http://www.puppygames.net/blog/?p=914
And if you’re going to bring up Adobe, for God’s sake don’t ignore @HeroesGraveDev #5! ;D
I’m getting a bit tired of this argument, really. Sure, code is cheap (worthless, even) without context: assets, support, a company backing and improving it. But we can equally say that art, assets and support are cheap (worthless, even) without code. Taking anything out of its ecosystem drastically reduces its value.
Obfuscation can also reduce compiled class/jar size quite a bit.
Guys, instead of starting a philosophical argument about code protection why not just point him to some useful available tools like ProGuard?
Try it out. There must be other tools out there but ProGuard works, it’s free, and relatively easy to use.
It’s impossible to 100% protect code, obfuscation helps a little and takes practically zero effort. Besides, it makes the jar smaller as a minor bonus.
Proguard is about as good as it gets. I can read Assembly/byte code easy enough and still “steal/hack” the code. Hell i have done it enough times. Its about as much effort as working out your encryption. Since the user must have the key to run the game. Its easy to find the key and decrypt. Done that also. Just for fun too. And seriously i am no hacker.
But Proguard stops it being trivial which is about as good as it gets. It supports stack trace decoding as well. But then again i am unconvinced that its worth the extra support effort, even if all that is cut and paste. However the reduced class sizes and quicker load times are worth it for the cases i have tested it with. Also it does some optimizations that do sometimes even make the code run faster.
We’ve released all our code unencrypted. Actually we’ve even released all our source code too, including the misleading comments and broken bits (hah! traps!). No difference in sales before or after. No l33t hax0rred copies all over the internets. Hopefully some people learned how to code some things; maybe they also discovered the bugs in the sprite engine and grid collision manager we subsequently have fixed
To the OP, I will say this: obfuscating your code does make it a lot harder to parse stacktraces and debug stuff. Significant when you’re dealing with millions of installs.
Cas
[quote=“princec,post:17,topic:41330”]
Excellent practical insight, thanks. Hmmm, I’ll consider this when releasing my next game to millions of (paying) users ;D
Of course if fear of decompilation is such an issue… You could always move to a different programming language.
Thing is to balance how cost-effective it is to use obfuscation tools and wrapping techniques and whatnot, versus developing the next project on a language without that particular shortcoming.
Other languages, of course, will have their own shortcomings, again, it all depends on how important each individual shortcoming is to your needs.
I have hacked x86 asm before too. Its really not that hard. Ok well its messy. Even C decompilers exist too and are not all that bad depending on the compiler. I mean what lang are all these torrented games written in again?
This is not really java specific. Consider that there have been a few games where a large amount of code has been source lua files!