Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  How to encrypt our code.  (Read 3473 times)
0 Members and 1 Guest are viewing this topic.
Offline joaogl

Junior Devvie


Medals: 1



« Posted 2013-03-24 02:50:46 »

Hello, i would like to know how can we encrypt our code...

If someone knows please help me...
Offline HeroesGraveDev

JGO Kernel


Medals: 295
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #1 - Posted 2013-03-24 02:59:17 »

Why would you want to do that?

(How would you read it? Grin)

Offline joaogl

Junior Devvie


Medals: 1



« Reply #2 - Posted 2013-03-24 03:01:21 »

lol... its to protect  the code.... its harder... and I dont encrypt it on the eclipse... only encrypted to the jar file...
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 295
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2013-03-24 03:22:30 »

Protect the code from what?

If the encrypting tool fails all your code will be corrupt. Shocked

Okay, enough joking. Smiley
Seriously, why do you need to encrypt your code?

(The average person can't read byte code anyway)

Offline Phased
« Reply #4 - Posted 2013-03-24 03:29:08 »

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.
Offline HeroesGraveDev

JGO Kernel


Medals: 295
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #5 - Posted 2013-03-24 03:30:20 »

Yeah, I know. But does the OP really need encryption?

Offline ra4king

JGO Kernel


Medals: 355
Projects: 3
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2013-03-24 03:30:36 »

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.

Offline roland
« Reply #7 - Posted 2013-03-24 07:22:09 »

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 Smiley 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 Wink

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.
Offline Roquen
« Reply #8 - Posted 2013-03-24 07:28:56 »

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.
Offline HeroesGraveDev

JGO Kernel


Medals: 295
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #9 - Posted 2013-03-24 07:30:39 »

1. Code is cheap. Understanding, writing, using and fixing code is not.

2. 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.

3. 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.

4. If you do manage to write some amazing code, everyone should know about it. Keeping it a secret is useless to everyone.

5. The reason most code is kept secret is because there is a major flaw that could be exploited if it is known.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #10 - Posted 2013-03-24 11:23:25 »

if code was cheap Adobe and Autodesk wouldn't make as much money. Dont kid yourself :D

Offline nsigma
« Reply #11 - Posted 2013-03-24 14:53:03 »

if code was cheap Adobe and Autodesk wouldn't make as much money.

You could just as easily make the observation that if the code wasn't cheap, Adobe and Autodesk wouldn't make so much money.  Wink

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!  Grin

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Online Riven
« League of Dukes »

« JGO Overlord »


Medals: 833
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #12 - Posted 2013-03-24 14:59:23 »

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.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline joen

Senior Newbie


Projects: 1



« Reply #13 - Posted 2013-03-24 15:26:41 »

Obfuscation can also reduce compiled class/jar size quite a bit.

Offline Grunnt

JGO Kernel


Medals: 94
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #14 - Posted 2013-03-24 15:54:31 »

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.

Offline delt0r

JGO Knight


Medals: 29
Exp: 18 years


Computers can do that?


« Reply #15 - Posted 2013-03-25 15:52:08 »

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. 

I have no special talents. I am only passionately curious.--Albert Einstein
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #16 - Posted 2013-03-25 15:57:07 »

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 Wink

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 Smiley

Offline Grunnt

JGO Kernel


Medals: 94
Projects: 8
Exp: 5 years


Complex != complicated


« Reply #17 - Posted 2013-03-25 16:57:20 »

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.

Excellent practical insight, thanks. Hmmm, I'll consider this when releasing my next game to millions of (paying) users Grin

Offline Oskuro

JGO Knight


Medals: 40
Exp: 6 years


Coding in Style


« Reply #18 - Posted 2013-03-26 10:06:20 »

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.

Offline delt0r

JGO Knight


Medals: 29
Exp: 18 years


Computers can do that?


« Reply #19 - Posted 2013-03-26 10:24:21 »

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!

I have no special talents. I am only passionately curious.--Albert Einstein
Offline mojo
« Reply #20 - Posted 2013-03-26 11:00:35 »

Make the game logic part of your project on the server side. Now any dirty secret about your game-play is safe.
Of course your customers will hate you, but if Blizzard and EA can handle it, why would you not Wink

Offline Roquen
« Reply #21 - Posted 2013-03-26 11:18:46 »

that's an to attempt to address piracy.

OP: If you're going to obtusify your code you really want to write a script that makes a version control tag and adds the obtusifier's back-translation info into your VC so you can be sure to track down problems related to a specific version.  For most folks I think this extra hassel isn't worth the effort.  Follow Cas's example and don't bother.  It should be noted that this is "as good as it gets" if you go this route...assuming you're using an off the shelf VM.  In about 5-10 minutes you can write a code snippet that talks to the tooling interface which will write all classes seen by the VM off to disk, so all further efforts are utterly pointless.  (The same can be said for all art/shader assets for any program which uses OpenGL or DirectX BTW.)

Spend your time creating something people want to steal rather than wasting it attempting to prevent it.
Offline Oskuro

JGO Knight


Medals: 40
Exp: 6 years


Coding in Style


« Reply #22 - Posted 2013-03-26 11:24:31 »

This is not really java specific.

Certainly, but decompilation is rather trivial in Java when compared to other languages. Just saying that, all other things being equal (hint: they rarely are), it might be worth switching languages if the end result after all the obfuscation is applied happens to be similar (or worse) than the default result of other languages.


The greatest problem, in the end, would be, ironically, success. If your game is successful, more people will want to crack it open increasing the chances that someone will eventually do it. It's not a matter of "if", but rather of "when", so, as with DRM, there are diminishing returns to the investment (be it effort or money) made into security.


This also means that it'd probably be better to focus on making a great game, than lose sleep over people stealing code. The idea posted above of code being "cheap" is a variation on the concept that ideas are cheap, meaning, anyone can have an idea, it is how you use it that matters. People don't see the code, they see the final result.

If your game is awesome, that's what will matter in the end, regardless of how the code is reused elsewhere.


Roquen beat me to the punch:
Quote
Spend your time creating something people want to steal rather than wasting it attempting to prevent it.


Oh my...

Of course your customers will hate you, but if Blizzard and EA can handle it, why would you not Wink

Because they are multi-million dollar companies with massive marketing departments, a long list of valuable IPs and a solid costumer loyalty base.

Don't be a dick if you can't afford the backlash.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #23 - Posted 2013-03-26 15:49:35 »

OP: If you're going to obtusify your code you really want to write a script that makes a version control tag and adds the obtusifier's back-translation info into your VC so you can be sure to track down problems related to a specific version. 

This is built-in to Proguard.

Ultimately however, the things most likely to be ripped off are assets, not code.
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #24 - Posted 2013-03-26 16:35:14 »

And let's face it, anyone borrowing assets is basically an amateur and there's generally no need to really worry about that. I'm quite happy for people to borrow stuff from us for their amateur projects.

Cas Smiley

Offline Regenuluz
« Reply #25 - Posted 2013-03-26 17:06:45 »

If people want to steal/borrow your assets/code to projects they're doing themselves, then you should just feel flattered. It means they actually like what you've made. Smiley
Offline appel

JGO Wizard


Medals: 51
Projects: 4


I always win!


« Reply #26 - Posted 2013-03-26 17:22:35 »

If people REALLY want to rip you off, there's little you can do to stop it. Of course safe guards as using obfuscation can prevent some theftary.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Online Riven
« League of Dukes »

« JGO Overlord »


Medals: 833
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #27 - Posted 2013-03-26 20:19:37 »

Anyone a biscuit? I haven't seen a group of grown men agreeing with eachother like this since 1997.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Oskuro

JGO Knight


Medals: 40
Exp: 6 years


Coding in Style


« Reply #28 - Posted 2013-03-26 20:26:21 »

I find your concept of "grown men" questionable  Wink

Offline HeroesGraveDev

JGO Kernel


Medals: 295
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #29 - Posted 2013-03-27 04:02:20 »

Anyone a biscuit? I haven't seen a group of grown men agreeing with eachother like this since 1997.

What happened in 1997?

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (38 views)
2014-11-26 15:22:04

toopeicgaming1999 (33 views)
2014-11-26 15:20:36

toopeicgaming1999 (8 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (25 views)
2014-11-25 11:26:43

Gibbo3771 (23 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!