-
Notifications
You must be signed in to change notification settings - Fork 9
/
shared.cpp
25 lines (21 loc) · 2.35 KB
/
shared.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "shared.h"
const unsigned char
cr08[0x50] = {0x02E,0x0C7,0x0C4,0x08D,0x0FF,0x0E5,0x05D,0x00B,0x0D6,0x0FF,0x07F,0x0FF,0x0D7,0x034,0x0D2,0x002,0x0E2,0x06D,0x09E,0x048,0x07B,0x0C6,0x06A,0x0F1,0x097,0x073,0x056,0x077,0x0FA,0x09D,0x080,0x000,0x011,0x004,0x029,0x008,0x0A6,0x08B,0x02A,0x047,0x064,0x000,0x001,0x038,0x084,0x0A0,0x040,0x069,0x001,0x0F9,0x0FA,0x0BE,0x0EA,0x0FF,0x097,0x07B,0x0A7,0x026,0x0ED,0x0F7,0x06B,0x07B,0x03B,0x04F,0x044,0x074,0x0A3,0x009,0x079,0x040,0x038,0x03A,0x020,0x05D,0x0A3,0x040,0x0C3,0x0E8,0x07F,0x03B,},
cr10[0x50] = {0x0DF,0x019,0x061,0x043,0x0AD,0x0C4,0x04C,0x01C,0x038,0x08D,0x01D,0x0BE,0x070,0x081,0x0EB,0x063,0x01A,0x052,0x0F4,0x0EC,0x084,0x0E1,0x04E,0x0EF,0x048,0x05D,0x069,0x011,0x083,0x06E,0x0E6,0x0C6,0x0F8,0x02F,0x053,0x0D0,0x0FF,0x0EA,0x0D1,0x016,0x037,0x0D4,0x0C0,0x0BE,0x056,0x051,0x0E6,0x08D,0x0A0,0x068,0x0B3,0x004,0x0CC,0x073,0x09D,0x0C0,0x063,0x03B,0x0AC,0x009,0x0F6,0x00F,0x0BC,0x0A1,0x096,0x074,0x001,0x035,0x07E,0x08C,0x0DB,0x00D,0x00A,0x0DF,0x052,0x008,0x0C1,0x02B,0x03D,0x0B5,},
cr11[0x50] = {0x0D1,0x016,0x037,0x0D4,0x0C0,0x0BE,0x056,0x051,0x0E6,0x08D,0x0A0,0x068,0x0B3,0x004,0x0CC,0x073,0x09D,0x0C0,0x0AC,0x009,0x0F6,0x00F,0x0BC,0x0A1,0x096,0x075,0x001,0x035,0x07E,0x08C,0x0DB,0x00D,0x02B,0x03D,0x0B5,0x00A,0x0DF,0x052,0x008,0x063,0x03B,0x08D,0x01D,0x0BE,0x070,0x0EB,0x063,0x0EF,0x048,0x05D,0x0AD,0x0C4,0x0C1,0x01A,0x052,0x0F4,0x0EC,0x084,0x0E1,0x04E,0x04C,0x01C,0x038,0x069,0x011,0x0DF,0x019,0x061,0x043,0x081,0x083,0x06E,0x0E6,0x0C6,0x0F8,0x02F,0x053,0x0D0,0x0FF,0x0EA,},
cr20[0x50] = {0x0C9,0x086,0x093,0x0FC,0x06A,0x044,0x018,0x0AA,0x0AA,0x012,0x09A,0x060,0x0CF,0x010,0x041,0x0E8,0x0BA,0x0BA,0x01A,0x088,0x010,0x0AF,0x0DE,0x0AD,0x0BE,0x0EF,0x084,0x091,0x05A,0x015,0x020,0x01A,0x055,0x005,0x0E7,0x087,0x001,0x011,0x0E5,0x0D1,0x006,0x0E6,0x068,0x071,0x0CC,0x0CC,0x018,0x080,0x000,0x011,0x03F,0x018,0x0CA,0x016,0x0C9,0x026,0x0AD,0x051,0x05A,0x080,0x0CD,0x0EF,0x034,0x088,0x014,0x081,0x0BE,0x0FE,0x0EE,0x0ED,0x0C0,0x0FF,0x0EE,0x0E8,0x079,0x0A5,0x0E7,0x050,0x041,0x0CA,};
void crypt(unsigned char *p, const unsigned char *key, int len)
{
int i;
for (i = 0; i < len; ++i)
{
*(p++) ^= key[(i%0x08E)%0x050]; // WTF???
}
}
void cryptver(unsigned char *p, int ver, int len)
{
if (ver<10) crypt(p, cr08, len); else
if (ver==10) crypt(p, cr10, len); else
if (ver>=11&&ver<=19) crypt(p, cr11, len); else
if (ver>=20) crypt(p, cr20, len);
}