Is it bad to Base62 encode a javascript file?

后端 未结 2 403
清酒与你
清酒与你 2020-12-28 16:13

I just found Dean Edwards javascript packer here: http://dean.edwards.name/packer/

It has a couple of options,

  1. Base62 encode
  2. Shrink variable
2条回答
  •  Happy的楠姐
    2020-12-28 16:54

    It does create more work on the client. The client has to run the code to decode the encoded script. This is pretty obvious if you enter just a little bit of code in the encoding block.

    For example:

    var a = 10;
    

    Encodes as:

    eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0 1=2;',3,3,'var|a|10'.split('|'),0,{}))
    

提交回复
热议问题