views:

216

answers:

7

I'm trying to make one of my scripts seem really complicated, when it's not. I was wondering if anyone had a snippet of code or something that would help, or a nudge in the right direction?

EDIT:
I need this because I'm trying to hide an algorithm for something in the middle of the nonsense code.

+11  A: 

This might help you.

Why would you do this, anyways?

Arve Systad
LMAO.. that is like a Bible for job security :)
Anurag
Quite a link :-)
Scott
haha, damnit I was too slow - was posting exactly the same thing :D
hollsk
Well, there goes my afternoon productivity.
NickAldwin
That link is concentrated evil. :>
John at CashCommons
+1  A: 

The term for this is obfuscation. There are many available JavaScript obfuscators.

You could also just take some random functions and variables from other places (that you're not using) and put them in your JavaScript before obfuscating it, to make the obfuscated thing longer.

By the way, this strikes me as most probably an evil thing you're doing here. But who am I to judge?

Borealid
+6  A: 

If you need to obfuscate javascript because it has security implications, you're doing it wrong.

Move the algorithm to the server.

matt-dot-net
+2  A: 

Why not create some sort of XML file, and then use XSL to translate it into Javascript. That would definitely add a level of complexity.

By the way, please let us know why you are doing this? Its very controversial and sounds like an adventure : )

funkymushroom
A: 

Does it need to be readable? I'm not sure why you'd want to generate code that does nothing. Sounds counter-intuitive. Anyhow, regex is probably your most "complicated" bet:

http://www.regular-expressions.info/javascriptexample.html

MattB
+2  A: 

Obfuscation is to program security what two foot tall picket fences are to unleashed great danes who see mail men wearing a suit made of bacon... If you have to use it for anything even vaguely important, you're doing something wrong.

Bob