top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between minification and obfuscation?

+2 votes
302 views
What is the difference between minification and obfuscation?
posted Jun 5, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes
 
Best answer

Minification is the process of removing the comments, whitespaces and parts of a javascript source file which are not NCSL ( Non commented source line) . By minifying we reduce the size of the javascript file and this helps to speed up the loading of web pages.

Obfuscation refers to deliberately obscuring and shortening the identifiers and names in the source code so that their true meaning is lost and also compression is achieved.

For example if you define a variable as

var statusFlag = 0 ;

Then after obfuscating it might become

var a = 0;

So the variable name will be shortened to the minimum possible length. Obviously , the obfuscater will be intelligent enough to make sure that it will replace each reference point of statusFlag with a. This is usually fine but in some very rare cases , obfuscation leads to logic errors in the code so care must be taken in testing the obfuscated code.

Obfuscation also leads to reduction is size as the number of characters are reduced.

answer Jun 5, 2014 by Shyam Purkayastha
...