1<script>2a=62;3 4 functionencode () {5 varCode = document.getElementById (' Code '). Value;6Code = code.replace (/[\r\n]+/g, ");7Code = code.replace (/'/g, "\ \"));8 varTMP = Code.match (/\b (\w+) \b/g);9 Tmp.sort ();Ten varDict = []; One varI, t = ' '; A for(vari=0; i<tmp. Length; i++) { - if(Tmp[i]! = t) Dict.push (t =tmp[i]); - } the varLen =dict.length; - varch; - for(i=0; i<len; i++) { -CH =num (i); +Code = Code.replace (NewREGEXP (' \\b ' +dict[i]+ ' \\b ', ' g '), ch); - if(ch = = Dict[i]) dict[i] = "; + } Adocument.getElementById (' Code '). Value = "eval (function (p,a,c,k,e,d) {e=function (c) {return (c<a?": E (parseint (c/ a)) + ((c=c%a) >35? String.fromCharCode (c+29): c.tostring (+))};if (! ". Replace (/^/,string)) {while (c--) d[e (c)]=k[c]| | E (c); K=[function (e) {return d[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} (" at+ "'" "+code+" ', "+a+", "+len+", ' "+ dict.join (' | ') + "'. Split (' | '), 0,{})"; - } - - functionNum (c) { - return(c<a? ": Num (parseint (C/A)) + ((c=c%a) >35?) String.fromCharCode (c+29): c.tostring (36)); - } in - functionrun () { toEval (document.getElementById (' Code '). value); + } - the functiondecode () { * varCode = document.getElementById (' Code '). Value; $Code = code.replace (/^eval/, ");Panax Notoginsengdocument.getElementById (' Code '). Value =eval (code); - } the</a></tmp></script> + A the<textarea Id=code cols=80 rows=20> + -</TEXTAREA><BR/><input Type=button onclick=encode () value= encoding/> $<input Type=button onclick=run () value= execution/> $<input Type=button Onclick=decode () value= decoding/>
JavaScript encryption and decryption compression tool