1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
|
using namespace std; _DWORD key[4] = {2,2,3,3}; unsigned int input[9] = { 0x33323130, 0x37363534, 0x33323130, 0x37363534, 0x33323130, 0x37363534, 0x33323130, 0x37363534, }; unsigned int Destination2[8] = { 0x5E487035, 0x0DC30FB7, 0x73E48B63, 0x20CDF292, 0x46C3CD6F, 0x1F2DB262, 0x73D8C2E6, 0x1222FCB8 }; unsigned int out[8] = { 0x0EA2063F8 ,0x8F66F252, 0x902A72EF, 0x411FDA74, 0x19590D4D, 0xCAE74317, 0x63870F3F, 0xD753AE61 }; unsigned int key1[32] = { 38, 7757, 28995, 31432, 40287, 52084, 60449, 92734, 103184, 133796, 139649, 167749, 168891, 169172, 189709, 205630, 214575, 240860, 243857, 258537, 279513, 311404, 333059, 358965, 377422, 378745, 407626, 409866, 419591, 451869, 454315, 454905 }; unsigned int key2[32] = { 840, 19427, 36334, 57571, 81182, 93799, 106255, 107122, 136655, 143533, 171756, 189643, 221240, 241824, 254036, 285147, 292725, 309791, 317420, 346824, 359103, 372608, 396996, 408645, 420974, 428150, 430481, 449745, 471859, 485995, 512923, 514025}; unsigned int key3[32] = { 21652, 30056, 54393, 82249, 87847, 112619, 126716, 139929, 144612, 161315, 176575, 192517, 195264, 222639, 251510, 269514, 286187, 289339, 301158, 324662, 324901, 329087, 331891, 360828, 363851, 374186, 394719, 416112, 432132, 443706, 469689, 483650 }; unsigned int key4[32] = { 624, 7689, 35258, 48088, 72255, 84491, 115740, 139376, 154995, 180722, 193422, 217745, 232667, 255441, 262252, 274314, 277879, 303070, 303189, 321936, 347986, 367606, 383940, 389908, 407432, 411009, 426055, 451586, 466044, 495316, 521846, 553980 }; int __cdecl encrypt(unsigned int *a1, _DWORD *a2) { int result; // eax unsigned int i; // [esp+64h] [ebp-28h] int v4; // [esp+68h] [ebp-24h] unsigned int v5; // [esp+6Ch] [ebp-20h] unsigned int v6; // [esp+70h] [ebp-1Ch]
v6 = *a1; v5 = a1[1]; v4 = 0; printf("%x\n",v6); printf("%x\n",v5); for ( i = 0; i < 0x20; ++i ) { // v4 -= 0x61C88647; v4 = key1[i]; v6 += (a2[1] + (v5 >> 5)) ^ (v4 + v5) ^ (*a2 + 16 * v5); v5 += (a2[3] + (v6 >> 5)) ^ (v4 + v6) ^ (a2[2] + 16 * v6); printf("%x\n",v6); printf("%x\n",v5); printf("%x\n",v4); } *a1 = v6; // printf("%d\n",v4); result = 4; a1[1] = v5; return result; }
int __cdecl decrypt(unsigned int *a1, _DWORD *a2,_DWORD *a3) { int result; // eax unsigned int i; // [esp+64h] [ebp-28h] int v4; // [esp+68h] [ebp-24h] unsigned int v5; // [esp+6Ch] [ebp-20h] unsigned int v6; // [esp+70h] [ebp-1Ch]
v6 = *a1; v5 = a1[1]; v4 = a3[31]; // printf("%x\n",v6); // printf("%x\n",v5); // printf("%x\n",v4);? for ( i = 0; i < 0x20; ++i ) { v5 -= (a2[3] + (v6 >> 5)) ^ (v4 + v6) ^ (a2[2] + 16 * v6); v6 -= (a2[1] + (v5 >> 5)) ^ (v4 + v5) ^ (*a2 + 16 * v5); v4 =a3[30-i]; // printf("%x\n",v6); // printf("%x\n",v5); // printf("%x\n",v4); } *a1 = v6; result = 4; a1[1] = v5; printf("%x\n",v6); printf("%x\n",v5); return result; }
int main(){ unsigned int data[2] = {1,2}; // encrypt(&input[0],key); printf("%x %x\n",input[0],input[1]); decrypt(&out[0],key,key1); decrypt(&out[2],key,key2); decrypt(&out[4],key,key3); decrypt(&out[6],key,key4); char *flag = (char *)out; for(int i = 0;i<=31;i++){ printf("%c",*(flag+i)); } // decrypt(&out[2],key); // decrypt(&out[4],key); // decrypt(&out[6],key); // char *flag = (char *)out;
}
|