Javascript Obfuscators

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Javascript Obfuscators

Post by Jackolantern »

I figured I would post a couple of the nice JS obfuscators I have found. These can be quite important in PBBG game development so that your players cannot make heads or tails of the code in their browser, while still allowing it to run no problem. It will also run better in some cases, since some obfuscators compress the code, making it download and execute faster.

Free JS Obfuscator: This is a free one, and probably does the weakest obfuscation, but I have included it because it is browser-based and can be used with no download. Just type your code into the code window, hit Obfuscate and then copy'n'paste the code from the bottom window. A large portion of what this one does is just convert a lot of your code to hex. This could slow down some basic users, but it can be fairly easily broken if your code is not very complex (if it is complex, it would be hard to decode because of the loss of organization).

Javascript Obfuscator: Real creative names, huh? Anyway, this is the most powerful obfuscator I have found so far. It is a commercial product, but it is only $40 for a single-user license, and there is a trial to check it out. This one adds new functions, changes function and variable names, and basically turns your code into unapproachable garble while compressing your files by about 25 - 50%. There is absolutely no way to reverse the obfuscation on this version's method. This product also boasts some fairly large names using their obfuscator.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Javascript Obfuscators

Post by hallsofvallhalla »

as far as hiding the code I just include it in a .js file and it hides the source. You just have to pass and declare the php variables on the initial page.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Javascript Obfuscators

Post by Jackolantern »

hallsofvallhalla wrote:as far as hiding the code I just include it in a .js file and it hides the source. You just have to pass and declare the php variables on the initial page.
I would be careful about relying on this method, since there are tools/methods for seeing it even when put in an external file. It obviously has to be transmitting to the client for it to have any effect in their browser, and if it is sent to the user, they can see it is they are motivated to do so. Pretty much all of the major Javascript websites (Amazon, Ebay, Gmail, etc.) rely on obfuscation to protect their code. Of course I can't be sure what they use, but the strength looks similar to the second tool I linked above.
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Javascript Obfuscators

Post by hallsofvallhalla »

yeah i guess if someone is committed to getting your code they will do what it takes.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Javascript Obfuscators

Post by Jackolantern »

Of course there is no way to have an unbreakable obfuscator for JS since it still has to be understood by the browser, but it can make it so complex that it is incomprehensible. I will likely be trying out several obfuscators for my game's JS :)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Javascript Obfuscators

Post by hallsofvallhalla »

make sure to right a review for them. I will most likely be looking for one soon.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Javascript Obfuscators

Post by Jackolantern »

I will definitely do that, but I can almost guarantee that I am going to start with that second one I linked above. Their screenshots of obfuscated code look almost just like the source of major JS sites, such as Amazon and GMail. I will write up a review once I have some JS code complex enough to warrant trying it. I believe they also have a free trial, so I will try that out before buying it.
The indelible lord of tl;dr
User avatar
MAruz
Posts: 117
Joined: Fri Nov 20, 2009 12:31 pm

Re: Javascript Obfuscators

Post by MAruz »

Halls, if you use external CSS and JS files, all you need to do to see them is "view source", and click on the link for the CSS or JS file in question, and you'll have it in it's complete state. So it's not hidden at all for the players.
PHP, Java, JavaScript, HTML, CSS, XML, MySQL / Oracle
Photoshop, Illustrator
www.cuddly-zombie.com
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Javascript Obfuscators

Post by hallsofvallhalla »

um no, doesnt work that way. Unless someone set their attribs wrong on the server maybe.
Post Reply

Return to “Coding”