前段时间看到flash中写的一段混淆代码,现记录下,以备后用。
原来版本是as,先用js实现
?
?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>简单的加解密</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <div id="txt1"></div> ====================================== <div id="txt2"></div> <script type="text/javascript"> function $(id){return document.getElementById(id);} function compile(code) { var c=""; for(var i=0;i<code.length;i++){ c+=(code.charCodeAt(i)+Math.pow(i+3,2))+","; } $("txt1").innerHTML = c.substr(0,c.length-1); } compile('iteye.com') function uncompile(code) { var arr = code.split(","); var c=""; for(var i=0;i<arr.length;i++){ c+=String.fromCharCode(arr[i]-Math.pow(i+3,2)); } $("txt2").innerHTML = c; } uncompile("115,113,143,133,150,185,182,146,220,255,278"); </script> </body> </html>
?
?