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
| #include <iostream> #include <stdio.h> #include <Windows.h>
void decrypt(DWORD* v, DWORD* k) { DWORD v0 = v[0], v1 = v[1], sum = 0xC6EF3720, i; DWORD delta = 0x9E3779B9; DWORD k0 = k[0], k1 = k[1], k2 = k[2], k3 = k[3]; for (i = 0; i < 32; i++) { v1 -= ((v0 >> 5) + k3) ^ (v0 + sum) ^ ((v0 << 4) + k2); v0 -= ((v1 >> 5) + k1) ^ (v1 + sum) ^ ((v1 << 4) + k0); sum -= delta; } v[0] = v0; v[1] = v1; }
int main() { unsigned char enflag[32] = { 0x99, 0xA1, 0x85, 0x55, 0x68, 0x5D, 0x82, 0x7E, 0x39, 0x00, 0x4D, 0x94, 0x43, 0x69, 0x72, 0x71, 0x06, 0x43, 0x51, 0x6A, 0x00, 0xAD, 0x14, 0x4B, 0x3F, 0x0D, 0xD2, 0x64, 0x15, 0xDB, 0x37, 0x9F }; DWORD key[4] = { 0x6B696C69,0x79645F65,0x696D616E,0x67626463 }; for (int i = 0; i < 4; i++) decrypt((DWORD*)&enflag[i*8], key); for (int i = 0; i < 32; i++) printf("%c", enflag[i]); return 0; }
|