标签:style blog color os io for ar cti
private var loader:URLLoader; ... private function init():void { loader = new URLLoader; req=URLRequest = new URLRequest("1.txt"); loader.load(req); loader.addEventListener(Event.COMPLETE,oncomlete); } private function oncomplete(e:Event):void { var str:String=loader.data; trace("src///////"); str=secret(str); trace("secret///////\n"+str); str=unsecret(str); trace("unsecret//////////////\n"+str); } private var add_key:Array=[800,650,400,525,100,250]//间距大于122(z的unicode值) private var range:Array=[65,91,97,123]//65,70,75,91,97,100,123
private var xor_key:Array=[0xaa,0xbb] private function secret(src:String):String { var res:String=""; var i:int,len:int,unicode:int; len=src.length for(i=0;i<len;i++) { unicode=str.charCodeAt(i); var idx=index(unicode); res+=String.fromCharCode(xor(add_key[idx]+unicode+random(i))) } return res; } i private function xor(v:int):int { var i:int,len:int; len=xor_key.length for(i=0;i<len;i++) { v^=xor_key[i]; } return v; } private function random(i:int):int { swicth(i%4) { case 0: if(i%9==0) return((1-Math.sin(i))*(i%100)>>0); else return((1-Math.sin(i))*(i%200)>>0); case 1: return ((1-Math.cos(i))*(i%300)>>0); case 2: return ((1-Math.cos(i)*Math.sin(i))*(i%400)>>0); case 3 if(i%3==0) return((1-Math.sin(i)*Math.cos(i)*Math.cos(i))*(i%500)>>0); else return((1-Math.sin(i)*Math.cos(i)*Math.cos(i))*(i%600)>>0); }
return 1; } private function index(u:int):int { if(u>64&&u<91||u>96&&u<123) { var i:int,len:int; len=range.length-1; for(i=0;i<len;i++) { if(u>=range[i]&&u<range[i+1]) break; } return i } else return 5 } private function index2(u:int):int { var i:int,len:int; len=add_key.length-1; for(i=0;i<len;i++) { if(u>=add_key[i]&&u<=add_key[i]+123) break; } return u-add_key[i]; } private function unsecret(src:String):String { var res:String=""; var i:int,len:int; var u:int; len=src.length; for(i=0;i<len;i++) { u=xor(src.charCodeAt(i)-random(i)); u=index2(u); res+=String.formCharCode(u); } return res; }
[65,70,80,91,97,110,123]
标签:style blog color os io for ar cti
原文地址:http://www.cnblogs.com/white-eyes/p/3894341.html