Obfuscation – What is Obfuscation in Javascript? Why Obfuscation is used?

plantilla ultimatum opciones binarias In this post, we will discuss more on obfuscation and where it is used and its advantages.

What is Obfuscation?

go site Obfuscation is the deliberate act of creating obfuscated code, i.e. http://cougars-rencontres.fr/?fityue=site-de-rencontres-completement-gratuit&f21=79 source or machine code that is difficult for humans to understand. It is something similar to encryption however machine can able to understand the code and able to execute the code.

http://www.romagnamotorsport.it/?binarnewe=strategia-opzioni-binarie-a-15-minuti&364=43 Sample URL to Obfuscate JavaScript code.

  1. http://closure-compiler.appspot.com/home
  2. http://www.danstools.com/javascript-obfuscate/

http://www.industries3r.com/albiol/2243 Obfuscation using danstools.

Original code:

function hello(name) {
console.log('Hello, ' + name);
hello('New user');

After Obfuscation:

eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--){d=k||c}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k)}}return p}('3 0(1){2.4(\'5, \'+1)}0(\'7 6\');',8,8,'hello|name|console|function|log|Hello|user|New'.split('|'),0,{}))

the output of both programs will be same.

Obfuscation output

Obfuscation can be used to hide the business logic from outside world and also obfuscation will reduce the size of the file drastically so data transfer between server and client will be fast.

Minification also a type of obfuscation here empty spaces will be removed and variables will be renamed.

source site Examples:

free online dating sites in michigan Minified File: https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js

http://www.mentzer-consult.de/?afinoes=forex-binary-options-hedging&fe6=0d Original File: https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js

mejor broker opciones binarias 2017 Why are open source projects obfuscated?

  • Code size will be reduced.
  • In JavaScript, download time will reduce.

Most of the Open source javascript projects are minified to reduce the download time and to reduce the code size. During minification, minified file and map file will get generated. Using map file actual code can be retrieved. Map file for the above angular js file will be

bares para solteros en bogota 2017 Map file: https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.js.map

Why Obfuscation?

  • Code size will be reduced.
  • Hide the business logic and your code from others.
  • Reverse Engineering is highly difficult.
  • In JavaScript, download time will reduce.


Obfuscation Example

Obfuscation  == Encryption ?

No, Obfuscation  != Encryption .

  • In JavaScript, Browser can’t execute encrypted code whereas browser will execute the obfuscated code.
  • Encrypted code always needs decryption to being executed.
  • The obfuscated code doesn’t require Deobfuscation to execute.

Bottom line, It is good to obfuscate the javascript code.

If you are developing enterprise application, Then I believe you can use a product like Jscrambler for obfuscating your code. Reverse engineering of obfuscated code is really difficult hence we can hide the business logic and core logic from outside world.