Harts
Harts

Reputation: 4093

HTML5 hide code like Flash

I was wondering, if I have a proprietary flash code (e.g: some cool animation which is really just client side stuff, its just example), and about to rewrite it using HTML5, is it possible to hide the code? or at least make it harder to see (unlike right click, view source, then you can just copy paste the code). e.g: to get to see or maybe reuse flash, u have to reverse engineer it.

Upvotes: 1

Views: 1542

Answers (2)

John
John

Reputation: 131

You can obfuscate your code so that people have a hard time reading it use this http://javascriptobfuscator.com/default.aspx

for exemple this:

 var a="Hello World!";
 function MsgBox(msg)
 {
     alert(msg+"\n"+a);
 }
 MsgBox("OK");

will become this:

 var _0xb75d=["\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x21","\x0A","\x4F\x4B"];var
 a=_0xb75d[0];function MsgBox(_0x4338x3){alert(_0x4338x3+_0xb75d[1]+a);}  
 ;MsgBox(_0xb75d[2]);

To protect swf files from decompilation you could use:http://www.kindi.com/

Upvotes: 2

shaunhusain
shaunhusain

Reputation: 19748

No there is no way to do this. Also reverse engineering swf files is trivial with programs like swf-decompiler and trillix, so it doesn't really matter too much. The main point is don't put anything important in the client side code that you wouldn't want compromised. Anything sent from a server to a client to do processing on the client side can be intercepted by a proxy running on said client and de-compiled/disassembled. As the other user here stated you can use .htaccess to restrict access to server side scripts (ones executed on the server) but you cannot completely "hide" anything that is going to be executed on the client machine.

Possibly the best attempts I've seen at doing this were done by Google for their flash maps api where they give you a swc in their SDK to use that has only interfaces then the implementation is fetched at run-time in the form of another swf, problem is that swf can also be intercepted and then de-compiled. There is no hiding when it comes to something executed on a persons machine assuming they have admin privileges on the machine that the code is executing on. (this is not a fallacy of HTML or Flash it's true of any language, C creates assembly, which with the right knowledge can be reverse engineered).

Upvotes: 1

Related Questions