侠物语破解算法


private function decode(data:ByteArray):ByteArray{
var dest:ByteArray = new ByteArray();
var index:int;
var key:String = "I'm a big big girl with a big big hole";
var count:int;
var i:int;
while (i < data.length) {
if (index>= key.length){
index = 0;
count++;
if (count >= 40){
dest.writeBytes(data, (40 * key.length), (data.length - (40 * key.length)));
break;
};
};
dest.writeByte((data[i] - key.charCodeAt(index)));
i++;
index++;
};
dest.position = 0;
return dest;
}

private var key:String = 'helloworld';
private function decode2(src:ByteArray, type:int):ByteArray{
var dest:ByteArray = new ByteArray();
var index:int;
var count:int;
var i:int;
while (i < src.length) {
if (index >= key.length){
index = 0;
count++;
if (count >= 50){
dest.writeBytes(src, (50 * key.length), (src.length - (50 * key.length)));
break;
};
};
if (type == 0){
dest.writeByte((src[i] + key.charCodeAt(index)));
} else {
if (type == 1){
dest.writeByte((src[i] - key.charCodeAt(index)));
};
};
i++;
index++;
};
dest.position = 0;
return (dest);
}

posted @ 2014-06-26 13:59    阅读(394)  评论(0编辑  收藏  举报
IT民工