Here is a new and interesting tool for the compression and the darkening of Javascript code (see also Reverse Engineering: the compressors of code ).
On the Web site of Dean Edwards can also download the source code of this compressor Javascript. Furthermore, the author has made available the server versions for Microsoft. NET Framework version 1.1, Perl, PHP5 and WHS.
Online is a working version available to try immediately , less complex - to be honest - one that I presented recently . Fact allows to compress the code with only two choices: the Base62 encode, which obscures the code and the Shrink variables, the optimizer variables.
Compared to the previous version have been fixed some bugs which, in situations of extreme hack (and really interesting) as:
1
| /*@cc_on!@*/ false ; isMSIE var = / * @ cc_on! @ * / false; |
did not comply with the generated output. Now both are properly supported conditional comments to Microsoft, both the + / - in conditions such as:
As outlined in page Help , however:
Should Packed scripts successfully unpack on all browsers support JavaScript That. Only basic JavaScript functionality is used to decode the packed script.
Some browsers may not support the packer itself. The web interface Requires Sun support. Legacy browsers will display disabled interface.
So attention to the end user and the type of browser support ... as usual!
More ...
A neglected issue in the context of Web2.0 is the protection of source code. With the perspective Open Source, Web 2.0 is where its greatest expression in the beta, share and participate in the community surely leaves in the background issues related to protection of source code. Let us recall that the Javascript scripts are downloaded from the Web Server into the browser as text files, so totally visible to the end user.
While the code server is protected by definition (it is impossible to access the code of a PHP page using the HTTP browser, except for rare cases of malfunctioning of the Web Server), client code could be subject to a Reverse Engineering.
However, there is a simple protection designed, from its beginnings, the size of the script for dimuire Javascript; now become real framework in some cases.
There are indeed applications and Web sites that allow you to compress (crunch) the Javascript code, but not only. This feature, in different ways, can also be applied to HTML and CSS. The JavaScript code, in particular, in addition to being compressed can be hidden, thereby obtaining a protection of the code (in view) such as to make more complex the procedure of reverse engineering.
Differences between HTML, CSS and Javascript are important and substantial. While the compression of HTML pages and style sheets can only act on the Elimination of unnecessary or superfluous characters, such as 'head', 'double spaces', etc. ... Javascript is a programming language that can then run a special code unzip himself.
JavascriptCompressor.com is a free service that can be used online, which allows you to compress JavaScript source code. The options make it extremely versatile, while providing the darkening of the code.
Example, Code of departure:
1 2 3
| function MyFunction () { "Hello World" ) ; alert ("Hello World"); } |
Code with simple compression:
1
| alert ( "Hello World" ) } function MyFunction () {alert ("Hello World")} |
Encoding standard:
1
| 5 , 5 , 'World|Hello|alert|MyFunction|function' . split ( '|' ) ) ) 3 () {2 ("1 0")} ', 5, 5,' World | Hello | alerts | MyFunction | function '. Split (' | '))) |
Obviously this is an example, with small codes compress not really make much sense, you risk making things worse and that's it (unless you're only interested in code obscuring the view).
Compressor MemTronic Cruncher is also an online service (such as previous work in offline mode), partially free in the sense that some functions are only available in paid version (as a function Obfuscade). Compared to precedende service should provide greater performance and safety in the Encryption code. I use them without distinction, as appropriate.
Peterbe.com does not allow Javascript to compress (except elimando spaces and 'head'), but proposes a compressor for HTML, CSS and XHTML. I, for example, the use to compress the sheets of styles.
Unless you use special algorithms for crunching, however, that weigh down the processing of data, you can always run a Reverse Engineering Code, that too compressed. Or soon or late, in fact, the original code must be sent to the interpreter's browser, which recognizes it (for now) only in the clear. In the future, with new versions of the browser, this obstacle could be overcome. It would be beneficial if it were implemented, within the browser, some technology capable of accepting pre-compiled JavaScript code, so to speak in binary (if anything encrypted ). In this way, the upheaval of the times download scripts, allowing a natural protection from reverse engineering and, last but not least, better performance in terms of script execution.
More ...
Latest Comments
Giovambattista Fazioli : @ kOoLiNuS: Hello, just placed. Unfortunately, the problem occurs on servers that have ...
kOoLiNuS : hello! we have reported that the latest "stable" for WP helps you ...
Gabriel : Hello, interesting article. I would need something similar but with some changes. In a ...
sebastian : Great share - thank you!
Subject : very helpful indeed! I tried it and it is just what I needed. Now I wonder how do I get ...