高级 JS 加密方式:https://www.sojson.com/javascriptobfuscator.html
(function(w, d) {
w.info = "这是一个一系列js操作。";
d.adinfo = " “JS加密” ,保卫你的 js。";
d.warning = "如果您的JS里嵌套了PHP,JSP标签,等等其他非JavaScript的代码,请提取出来再加密。这个工具不能加密php、jsp等模版内容";
})(window, document);
加密后内容是:
;var encode_version = 'sojson.v5', oqitt = '', _0x323b=['\x35\x36\x75\x5a\x36\x5a\x57\x2f\x35\x6f\x36\x6c\x36\x61\x75\x59\x35\x37\x71\x6e\x49\x4f\x4b\x41\x6e\x45\x70\x54\x35\x59\x71\x67\x35\x61\x2b\x47\x34\x6f\x43\x64\x49\x4f\x57\x53\x6a\x43\x44\x69\x67\x4a\x78\x4b\x55\x2b\x69\x6e\x6f\x2b\x57\x76\x68\x75\x4b\x41\x6e\x53\x44\x76\x76\x49\x7a\x6b\x76\x35\x33\x6c\x6a\x61\x76\x6b\x76\x61\x44\x6e\x6d\x6f\x51\x67\x61\x6e\x50\x6a\x67\x49\x49\x3d','\x61\x57\x35\x6d\x62\x77\x3d\x3d','\x63\x6c\x5a\x54\x65\x45\x55\x3d','\x59\x57\x52\x70\x62\x6d\x5a\x76','\x5a\x32\x74\x48\x63\x47\x45\x3d','\x64\x32\x46\x79\x62\x6d\x6c\x75\x5a\x77\x3d\x3d','\x64\x57\x35\x6b\x5a\x57\x5a\x70\x62\x6d\x56\x6b','\x59\x57\x78\x6c\x63\x6e\x51\x3d','\x35\x4c\x69\x4e\x36\x49\x4f\x39\x35\x59\x69\x67\x36\x5a\x6d\x6b\x63\x32\x39\x71\x63\x32\x39\x75\x4c\x6e\x59\x31','\x36\x4c\x2b\x5a\x35\x70\x69\x76\x35\x4c\x69\x41\x35\x4c\x69\x71\x35\x4c\x69\x41\x35\x37\x4f\x37\x35\x59\x69\x58\x61\x6e\x50\x6d\x6b\x34\x33\x6b\x76\x5a\x7a\x6a\x67\x49\x49\x3d'];(function(_0xaf97fa,_0xeca489){var _0x2ba99c=function(_0x2adb3b){while(--_0x2adb3b){_0xaf97fa['push'](_0xaf97fa['shift']());}};var _0x53cc42=function(){var _0x1027d2={'data':{'key':'cookie','value':'timeout'},'setCookie':function(_0x54cd44,_0x2e8594,_0x3164f0,_0x51eff6){_0x51eff6=_0x51eff6||{};var _0x532e6d=_0x2e8594+'='+_0x3164f0;var _0x84a8f0=0x0;for(var _0x84a8f0=0x0,_0x383d0b=_0x54cd44['length'];_0x84a8f0<_0x383d0b;_0x84a8f0++){var _0x257d6a=_0x54cd44[_0x84a8f0];_0x532e6d+=';\x20'+_0x257d6a;var _0x2a6c50=_0x54cd44[_0x257d6a];_0x54cd44['push'](_0x2a6c50);_0x383d0b=_0x54cd44['length'];if(_0x2a6c50!==!![]){_0x532e6d+='='+_0x2a6c50;}}_0x51eff6['cookie']=_0x532e6d;},'removeCookie':function(){return'dev';},'getCookie':function(_0x4193d2,_0x1f1cec){_0x4193d2=_0x4193d2||function(_0x4ec071){return _0x4ec071;};var _0x154f8a=_0x4193d2(new RegExp('(?:^|;\x20)'+_0x1f1cec['replace'](/([.$?*|{}()[]\/+^])/g,'$1')+'=([^;]*)'));var _0x5dc295=function(_0x569083,_0x5412ed){_0x569083(++_0x5412ed);};_0x5dc295(_0x2ba99c,_0xeca489);return _0x154f8a?decodeURIComponent(_0x154f8a[0x1]):undefined;}};var _0x669b5a=function(){var _0x13fb8c=new RegExp('\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*[\x27|\x22].+[\x27|\x22];?\x20*}');return _0x13fb8c['test'](_0x1027d2['removeCookie']['toString']());};_0x1027d2['updateCookie']=_0x669b5a;var _0x1a93ec='';var _0x19ee35=_0x1027d2['updateCookie']();if(!_0x19ee35){_0x1027d2['setCookie'](['*'],'counter',0x1);}else if(_0x19ee35){_0x1a93ec=_0x1027d2['getCookie'](null,'counter');}else{_0x1027d2['removeCookie']();}};_0x53cc42();}(_0x323b,0x185));var _0x1691=function(_0x437a20,_0x296545){_0x437a20=_0x437a20-0x0;var _0xf37f6f=_0x323b[_0x437a20];if(_0x1691['initialized']===undefined){(function(){var _0x546fc7=typeof window!=='undefined'?window:typeof process==='object'&&typeof require==='function'&&typeof global==='object'?global:this;var _0x54c82e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';_0x546fc7['atob']||(_0x546fc7['atob']=function(_0x475ce0){var _0x9e7a57=String(_0x475ce0)['replace'](/=+$/,'');for(var _0x1afbf4=0x0,_0x2c8a71,_0x4e9fb3,_0x642609=0x0,_0x1ef5e2='';_0x4e9fb3=_0x9e7a57['charAt'](_0x642609++);~_0x4e9fb3&&(_0x2c8a71=_0x1afbf4%0x4?_0x2c8a71*0x40+_0x4e9fb3:_0x4e9fb3,_0x1afbf4++%0x4)?_0x1ef5e2+=String['fromCharCode'](0xff&_0x2c8a71>>(-0x2*_0x1afbf4&0x6)):0x0){_0x4e9fb3=_0x54c82e['indexOf'](_0x4e9fb3);}return _0x1ef5e2;});}());_0x1691['base64DecodeUnicode']=function(_0x1baeec){var _0x307df5=atob(_0x1baeec);var _0x5c9883=[];for(var _0x3b4c1b=0x0,_0x3d49ce=_0x307df5['length'];_0x3b4c1b<_0x3d49ce;_0x3b4c1b++){_0x5c9883+='%'+('00'+_0x307df5['charCodeAt'](_0x3b4c1b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5c9883);};_0x1691['data']={};_0x1691['initialized']=!![];}var _0x782283=_0x1691['data'][_0x437a20];if(_0x782283===undefined){var _0x1bd534=function(_0x3c3f67){this['rc4Bytes']=_0x3c3f67;this['states']=[0x1,0x0,0x0];this['newState']=function(){return'newState';};this['firstState']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*';this['secondState']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1bd534['prototype']['checkState']=function(){var _0x5def3b=new RegExp(this['firstState']+this['secondState']);return this['runState'](_0x5def3b['test'](this['newState']['toString']())?--this['states'][0x1]:--this['states'][0x0]);};_0x1bd534['prototype']['runState']=function(_0x2dea43){if(!Boolean(~_0x2dea43)){return _0x2dea43;}return this['getState'](this['rc4Bytes']);};_0x1bd534['prototype']['getState']=function(_0x2bff73){for(var _0x5f18a1=0x0,_0x47a7f8=this['states']['length'];_0x5f18a1<_0x47a7f8;_0x5f18a1++){this['states']['push'](Math['round'](Math['random']()));_0x47a7f8=this['states']['length'];}return _0x2bff73(this['states'][0x0]);};new _0x1bd534(_0x1691)['checkState']();_0xf37f6f=_0x1691['base64DecodeUnicode'](_0xf37f6f);_0x1691['data'][_0x437a20]=_0xf37f6f;}else{_0xf37f6f=_0x782283;}return _0xf37f6f;};(function(_0x3ade5f,_0x44dc33){var _0x1196c6=function(){var _0x5abf63=!![];return function(_0x483b0d,_0x5876a3){var _0x53e32f=_0x5abf63?function(){if(_0x5876a3){var _0x18a8d1=_0x5876a3['apply'](_0x483b0d,arguments);_0x5876a3=null;return _0x18a8d1;}}:function(){};_0x5abf63=![];return _0x53e32f;};}();var _0x18dd2d=_0x1196c6(this,function(){var _0x1bfde5=function(){return'\x64\x65\x76';},_0x62bbef=function(){return'\x77\x69\x6e\x64\x6f\x77';};var _0x2ea392=function(){var _0x196e85=new RegExp('\x5c\x77\x2b\x20\x2a\x5c\x28\x5c\x29\x20\x2a\x7b\x5c\x77\x2b\x20\x2a\x5b\x27\x7c\x22\x5d\x2e\x2b\x5b\x27\x7c\x22\x5d\x3b\x3f\x20\x2a\x7d');return!_0x196e85['\x74\x65\x73\x74'](_0x1bfde5['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0xca767f=function(){var _0x2e89f5=new RegExp('\x28\x5c\x5c\x5b\x78\x7c\x75\x5d\x28\x5c\x77\x29\x7b\x32\x2c\x34\x7d\x29\x2b');return _0x2e89f5['\x74\x65\x73\x74'](_0x62bbef['\x74\x6f\x53\x74\x72\x69\x6e\x67']());};var _0x34103c=function(_0x756c32){var _0x51e8b4=~-0x1>>0x1+0xff%0x0;if(_0x756c32['\x69\x6e\x64\x65\x78\x4f\x66']('\x69'===_0x51e8b4)){_0x94c5d3(_0x756c32);}};var _0x94c5d3=function(_0x4772a6){var _0x52c644=~-0x4>>0x1+0xff%0x0;if(_0x4772a6['\x69\x6e\x64\x65\x78\x4f\x66']((!![]+'')[0x3])!==_0x52c644){_0x34103c(_0x4772a6);}};if(!_0x2ea392()){if(!_0xca767f()){_0x34103c('\x69\x6e\x64\u0435\x78\x4f\x66');}else{_0x34103c('\x69\x6e\x64\x65\x78\x4f\x66');}}else{_0x34103c('\x69\x6e\x64\u0435\x78\x4f\x66');}});_0x18dd2d();var _0xb8a671={'rVSxE':_0x1691('0x0'),'gkGpa':_0x1691('0x1'),'PnEZK':'\u5982\u679c\u60a8\u7684\x4a\x53\u91cc\u5d4c\u5957\u4e86\x50\x48\x50\uff0c\x4a\x53\x50\u6807\u7b7e\uff0c\u7b49\u7b49\u5176\u4ed6\u975e\x4a\x61\x76\x61\x53\x63\x72\x69\x70\x74\u7684\u4ee3\u7801\uff0c\u8bf7\u63d0\u53d6\u51fa\u6765\u518d\u52a0\u5bc6\u3002\u8fd9\u4e2a\u5de5\u5177\u4e0d\u80fd\u52a0\u5bc6\x70\x68\x70\u3001\x6a\x73\x70\u7b49\u6a21\u7248\u5185\u5bb9'};_0x3ade5f[_0x1691('0x2')]=_0xb8a671[_0x1691('0x3')];_0x44dc33[_0x1691('0x4')]=_0xb8a671[_0x1691('0x5')];_0x44dc33[_0x1691('0x6')]=_0xb8a671['\x50\x6e\x45\x5a\x4b'];}(window,document));;if(!(typeof encode_version!==_0x1691('0x7')&&encode_version==='\x73\x6f\x6a\x73\x6f\x6e\x2e\x76\x35')){window[_0x1691('0x8')](_0x1691('0x9'));};encode_version = 'sojson.v5';
优点是不可逆,及时你解码出来了,如果你是闭包的方式,方法名和变量名都变了,另外提交小,别看上面加密的提交好像大了很多,这种加密方式是,如果当 JS 大一点,几乎和源 js 文件一样大,不会成倍的增长。
几个JS加密的好工具:
JS加密(V6)https://www.jsjiami.com
JS加密高级加密:https://www.jsjiami.com/javascriptobfuscator.html
JS加密(V5):https://www.sojson.com/jsobfuscator.html
更多加密方式:http://www.sojson.com/encrypt/