5

I'm an artist that's written a simple game in Javascript. Yah! But go easy on me because I bruise like a peach! I'm looking into difficult to cheat at the game. So code obfuscation will make it difficult to cheat, right? Difficult, not impossible. I realise that, and could accidentally open a can of worms here...

Essentially, I'm Looking for an online tool that renames variables; and don't say search and replace in textpad :). For example using http://packer.50x.eu/ on one line of code

var loopCounter = 0;

we get the result:

eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d[c]=k[c]||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 2=0;',3,3,'|var|loopCounter'.split('|'),0,{}))

The above looks like a mess, which is great; but it's quite easy to pick out English words like loopCounter. I would have expected it to make variable names obscure (single letter? words without nouns? look very similar?? Or should have that been my task anyway as part of writing the code. Or is this a waste of time trying to make variable names since a variable declaration is preceded by var and therefore there's no point to disguise it?

2
  • 1
    Maybe have a look at Closure Compiler. Does more than code obfuscation, but requires you code to follow some guidelines. Commented Jul 31, 2013 at 9:08
  • Maybe a duplicate of this: stackoverflow.com/questions/522064/… Commented Jul 31, 2013 at 11:45

3 Answers 3

2

After a lot of searching (and links to the above) I found this which allows obfuscated string variables. And that is what I was after.

Sign up to request clarification or add additional context in comments.

Comments

0

there are a few online tools available for this: javascript compressor and then theres javascript minifier that you can use for large images also. otherwise you could just google some offline tools, pretty sure they're easy to find

Comments

0

You could use the Javascript Obfuscator... your code will be very difficult to decode!

Hope it helps! ^_^

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.