1 |
297 |
jeremybenn |
static char newshuffle[256 + 16] = {
|
2 |
|
|
0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09, 0x00, 0x01, 0x06, 0x0d,
|
3 |
|
|
0x03, 0x04, 0x0b, 0x0a, 0x02, 0x0c, 0x0e, 0x06, 0x0f, 0x00, 0x01, 0x08,
|
4 |
|
|
0x0d, 0x03, 0x0a, 0x04, 0x09, 0x0b, 0x05, 0x07, 0x05, 0x02, 0x09, 0x0f,
|
5 |
|
|
0x0c, 0x04, 0x0d, 0x00, 0x0e, 0x0a, 0x06, 0x08, 0x0b, 0x01, 0x03, 0x07,
|
6 |
|
|
0x0f, 0x0d, 0x02, 0x06, 0x07, 0x08, 0x05, 0x09, 0x00, 0x04, 0x0c, 0x03,
|
7 |
|
|
0x01, 0x0a, 0x0b, 0x0e, 0x05, 0x0e, 0x02, 0x0b, 0x0d, 0x0a, 0x07, 0x00,
|
8 |
|
|
0x08, 0x06, 0x04, 0x01, 0x0f, 0x0c, 0x03, 0x09, 0x08, 0x02, 0x0f, 0x0a,
|
9 |
|
|
0x05, 0x09, 0x06, 0x0c, 0x00, 0x0b, 0x01, 0x0d, 0x07, 0x03, 0x04, 0x0e,
|
10 |
|
|
0x0e, 0x08, 0x00, 0x09, 0x04, 0x0b, 0x02, 0x07, 0x0c, 0x03, 0x0a, 0x05,
|
11 |
|
|
0x0d, 0x01, 0x06, 0x0f, 0x01, 0x04, 0x08, 0x0a, 0x0d, 0x0b, 0x07, 0x0e,
|
12 |
|
|
0x05, 0x0f, 0x03, 0x09, 0x00, 0x02, 0x06, 0x0c, 0x05, 0x03, 0x0c, 0x08,
|
13 |
|
|
0x0b, 0x02, 0x0e, 0x0a, 0x04, 0x01, 0x0d, 0x00, 0x06, 0x07, 0x0f, 0x09,
|
14 |
|
|
0x06, 0x00, 0x0b, 0x0e, 0x0d, 0x04, 0x0c, 0x0f, 0x07, 0x02, 0x08, 0x0a,
|
15 |
|
|
0x01, 0x05, 0x03, 0x09, 0x0b, 0x05, 0x0a, 0x0e, 0x0f, 0x01, 0x0c, 0x00,
|
16 |
|
|
0x06, 0x04, 0x02, 0x09, 0x03, 0x0d, 0x07, 0x08, 0x07, 0x02, 0x0a, 0x00,
|
17 |
|
|
0x0e, 0x08, 0x0f, 0x04, 0x0c, 0x0b, 0x09, 0x01, 0x05, 0x0d, 0x03, 0x06,
|
18 |
|
|
0x07, 0x04, 0x0f, 0x09, 0x05, 0x01, 0x0c, 0x0b, 0x00, 0x03, 0x08, 0x0e,
|
19 |
|
|
0x02, 0x0a, 0x06, 0x0d, 0x09, 0x04, 0x08, 0x00, 0x0a, 0x03, 0x01, 0x0c,
|
20 |
|
|
0x05, 0x0f, 0x07, 0x02, 0x0b, 0x0e, 0x06, 0x0d, 0x09, 0x05, 0x04, 0x07,
|
21 |
|
|
0x0e, 0x08, 0x03, 0x01, 0x0d, 0x0b, 0x0c, 0x02, 0x00, 0x0f, 0x06, 0x0a,
|
22 |
|
|
0x09, 0x0a, 0x0b, 0x0d, 0x05, 0x03, 0x0f, 0x00, 0x01, 0x0c, 0x08, 0x07,
|
23 |
|
|
0x06, 0x04, 0x0e, 0x02, 0x03, 0x0e, 0x0f, 0x02, 0x0d, 0x0c, 0x04, 0x05,
|
24 |
|
|
0x09, 0x06, 0x00, 0x01, 0x0b, 0x07, 0x0a, 0x08,
|
25 |
|
|
};
|
26 |
|
|
void newpassencrypt (char *, char *, char *);
|
27 |
|
|
void
|
28 |
|
|
newpassencrypt (char *old, char *new, char *out)
|
29 |
|
|
{
|
30 |
|
|
char *p, *bx;
|
31 |
|
|
char copy[8];
|
32 |
|
|
int i, di, ax;
|
33 |
|
|
char cl, dl, ch;
|
34 |
|
|
for (i = 0; i < 16; i++)
|
35 |
|
|
{
|
36 |
|
|
for (bx = old + 7; bx > old; bx--)
|
37 |
|
|
{
|
38 |
|
|
*bx = ((bx[-1] >> 4) & 0x0f) | ((*bx) << 4);
|
39 |
|
|
}
|
40 |
|
|
for (di = 0; di < 16; di++)
|
41 |
|
|
{
|
42 |
|
|
if (newshuffle[di + 0x100] & 1)
|
43 |
|
|
ch = ((copy[newshuffle[di + 0x100] / 2] >> 4) & 0x0f);
|
44 |
|
|
else
|
45 |
|
|
ch = copy[newshuffle[di + 0x100] / 2] & 0x0f;
|
46 |
|
|
out[di / 2] |= ((di & 1) ? ch << 4 : ch);
|
47 |
|
|
}
|
48 |
|
|
memcpy (copy, out, 8);
|
49 |
|
|
}
|
50 |
|
|
}
|