packer-js压缩混淆加密工具

网址:http://dean.edwards.name/packer/

大名鼎鼎的jquery就是用这个压缩的。好像从90多k压到21k.

原代码 :

var a=”Hello World!”;
function MsgBox(msg)
{
alert(msg+”\n”+a);
}
MsgBox(”OK”);

pack后:

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}(’3 0=”4 5!”;6 1(2){7(2+”\\8″+0)}1(”9″);’,10,10,’a|MsgBox|b|var|Hello|World|function|alert|n|OK’.split(’|'),0,{}))

除非是用decode, 否则别人很难再看懂你的原代码。

再提供一个 js 混淆工具:

http://www.javascriptobfuscator.com/Default.aspx