我颠倒了一个解压缩程序,但必须弄清楚压缩。
因为可执行文件只解密,因此没有压缩例程,而且我对压缩不满意,这对我来说真的很难。
这是我用 C# 编写的代码:
private unsafe void Decompress(byte[] decom, byte[] com, int comSize) {
byte[] dict = new byte[4096];
fixed (byte* pDict = dict, p1 = decom, p2 = com) {
byte* pDecom = p1, pCom = p2;
byte next;
int r6 = 0, r7 = 0xfee, r10, r9;
while (true) {
r6 >>= 1;
if ((r6 & 0x100) == 0) {
if (comSize-- == 0)
return;
r6 = 0xFF00 | *(pCom++);
}
if ((r6 & 1) == 1) {
if (comSize-- == 0)
return;
next = *(pCom++);
*(pDecom++) = next;
*(pDict + r7) = next;
r7 = (r7 + 1) & 0xFFF;
} else {
if ((comSize -= 2) <= 0)
return;
r10 = (*(pCom++) << 8) | *(pCom++);
r9 = r10 >> 4;
r10 = (r10 & 0xF) + 2;
for (int i = r10 + 1; i > 0; --i) {
r10 = r9++ & 0xFFF;
next = *(pDict + r10);
*(pDecom++) = next;
*(pDict + r7) = next;
r7 = (r7 + 1) & 0xfff;
}
}
}
}
}
如果有人可以识别或发布压缩代码的链接,那就太好了。任何帮助表示赞赏。