Hello,
Please tell me clear steps to do code Obfusication. after code obfusication can you plz. tell me who to use it in .aspx or .html files. Which else files I have include. I am confuse about its usage.
Thanks in advance.
Submitted by:
JSCruncher Pro Support Staff
Date:
2008-05-13 09:58:16.0
Obfuscation is controlled by what are called 'mappings'. These are text files that contain list of tokens (function names, variable names, etc) that are *not* to be obfuscated. JSCP ships with mappings for ECMA, CSS and XHTML built in -- you only need to develop mappings for your own unique code.
Here is an example scenario. Say you have index.html which then includes script.js. In the html file you have a button that when clicked calls a method named addToCart() in the javascript file. To successfully obfuscate the script file and still allow addToCart to be called from the html file, you'd need to insert the addToCart token into a mapping file. The easiest way to do this is via the 'user defined' map file that JSCP maintains for you, or if you prefer you can create your own blank text file from scratch. The JSCP ui offers ways to add tokens to the user defined map file after you've run the obfuscation once. The 'log viewer' is also a handy place to both review what tokens have been obfuscated and to also add them to your custom map file. New logs are available after each compression run, and include data on all files included in that run. i.e., if you compress an entire folder of js files, data on all tokens in those files is made available in the log.
The obfuscation engine maintains token names across multiple files. For example, if the variable 'userData' is declared in script A and is then referred to in script B or C, and userData does not appear in a mapping (indicating that it should be obfuscated) then the token is replaced in all 3 files with the same obfuscated token. Note that the new tokens created by the obfuscation engine are random and are different after every run. This means that if you have tokens that are referred to in many files, *all* those files must be included in the obfuscation run to ensure that the new token is consistent within all the files.
All of this is detailed within the JSCP help files should you need more info or examples.