#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include <stdint.h>
unsigned
char
S[256];
void
swap(unsigned
char
* a, unsigned
char
* b) {
unsigned
char
temp = *a;
*a = *b;
*b = temp;
}
void
rc4_key_setup(unsigned
char
* key,
int
key_length, unsigned
char
S[256]) {
unsigned
char
T[256];
int
i, j;
for
(i = 0; i < 256; i++) {
S[i] = i;
T[i] = key[i % key_length];
}
j = 0;
for
(i = 0; i < 256; i++) {
j = (j + S[i] + T[i]) % 256;
swap(&S[i], &S[j]);
}
}
char
__cdecl sub_121290(
char
* a1,
char
* a2)
{
char
result;
unsigned
int
i;
char
* v4;
unsigned
__int8
v6;
unsigned
__int8
v7;
v7 = 0;
v6 = 0;
int
k = 0;
for
(i = 0; i < 44; ++i)
{
v6 += S[++v7];
swap(&S[v7], &S[v6]);
a2[i] = a1[i] - (S[(unsigned
char
)(S[v6] + S[v7])] ^ 0x33);
}
return
0;
}
char
* __cdecl sub_1213C0(uint32_t* a1)
{
char
* result;
int
v2[4];
int
v3;
int
i;
uint32_t v5;
uint32_t v6;
unsigned
int
v7;
v2[0] = 1855465527;
v2[1] = 1144201745;
v2[2] = 287454020;
v2[3] = 925407342;
v6 = a1[0];
v5 = a1[1];
v7 = 1719109785 + (0x9E3779B8 * 33);
v3 = 0x9E3779B8;
for
(i = 0; i <= 32; ++i)
{
v5 -= (v2[(v7 >> 11) & 3] + v7) ^ (v6 + ((v6 >> 5) ^ (16 * v6)));
v7 -= v3;
v6 -= (v2[v7 & 3] + v7) ^ (v5 + ((v5 >> 6) ^ (32 * v5)));
}
a1[0] = v6;
a1[1] = v5;
return
0;
}
int
main() {
unsigned
char
key[] =
"th0s_i0_ke9"
;
int
key_length =
strlen
((
const
char
*)key);
rc4_key_setup(key, key_length, S);
unsigned
char
encenc[] = { 0x50, 0xD4, 0xC8, 0xC4, 0x8F, 0x84, 0x40, 0xEB, 0x32, 0x81, 0x8F, 0x85, 0x6C, 0xB2, 0x2B, 0x06,
0xBF, 0x05, 0x35, 0x5D, 0x2E, 0xE3, 0x7D, 0x46, 0x8D, 0x35, 0x01, 0x70, 0x3A, 0x80, 0x81, 0xC5,
0xE6, 0x71, 0xD3, 0xD6, 0x50, 0x69, 0x6F, 0xE2, 0x6E, 0x78, 0x14, 0xD8, 0x25 };
for
(
int
i = 36; i >= 0; i--)
{
sub_1213C0((uint32_t*)&encenc[i]);
}
char
encrypted_data[44];
sub_121290((
char
*)encenc, encrypted_data);
printf
(
"%s\n"
, encrypted_data);
return
0;
}