You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

146 lines
4.9 KiB

#define _GNU_SOURCE
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
const uint8_t data[] = {
0xfb, 0x72, 0x3a, 0x22, 0x21, 0x4b, 0x6a, 0xc2,
0x28, 0xe6, 0xe4, 0xc1, 0xa7, 0x25, 0xb6, 0xe0,
0x98, 0xb2, 0x0a, 0xe0, 0x9b, 0xab, 0xc1, 0x84,
0xb8, 0x2d, 0x8f, 0xd8, 0x7e, 0x07, 0x3a, 0xcb,
0xc9, 0xf0, 0xf5, 0x38, 0x51, 0x43, 0xed, 0x52,
0xf8, 0x44, 0xe4, 0xc2, 0x50, 0x22, 0x27, 0x2a,
0x65, 0x44, 0x81, 0x79, 0xc2, 0x6c, 0xb4, 0xaf,
0xd9, 0x9d, 0x7c, 0x74, 0xb3, 0x58, 0xea, 0xcd,
0x69, 0xe2, 0xa2, 0xdf, 0xe7, 0xca, 0xc4, 0x65,
0xe0, 0xe8, 0xf3, 0xbe, 0xee, 0x97, 0x68, 0xad,
0x61, 0x0e, 0x27, 0x78, 0x32, 0x86, 0x6d, 0x5c,
0x02, 0xc2, 0x6e, 0xd1, 0xdf, 0x93, 0x14, 0x4d,
0xcb, 0x1a, 0x90, 0xf4, 0x20, 0x95, 0xc0, 0xd3,
0x1d, 0xe8, 0x73, 0x2b, 0xdb, 0xaf, 0xae, 0x74,
0x7a, 0x1d, 0x50, 0x4a, 0xa6, 0x9d, 0x56, 0xcc,
0xb5, 0x5d, 0x07, 0xd1, 0x04, 0xa7, 0x16, 0x5c,
0x1d, 0x40, 0x4e, 0x65, 0x51, 0xf2, 0x68, 0x0a,
0x4a, 0xb3, 0x56, 0x56, 0xc1, 0x51, 0x1f, 0x0f,
0xc2, 0x7d, 0x4b, 0x29, 0x5b, 0x58, 0x1d, 0x2f,
0xff, 0x66, 0xc0, 0x3c, 0xbb, 0xbb, 0x34,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xa8, 0xa0,
0xcd, 0xde, 0x8b, 0x72, 0x73, 0xe4, 0xfa, 0xe7,
0x33, 0x8f, 0x11, 0x1e, 0xaf, 0xd3, 0x40, 0xa7,
0x86, 0x26, 0xf3, 0x77, 0x4c, 0x6e, 0x2d, 0x2d,
0xa4, 0x03, 0xc2, 0x74, 0x2e, 0xb3, 0xdd, 0x85,
0x29, 0x41, 0x90, 0xc3, 0xc7, 0x3a, 0x96, 0xb9,
0x8e, 0x35, 0xcf, 0x37, 0xc0, 0xc8, 0xff, 0xd5,
0x8b, 0x9f, 0xa1, 0xd9, 0x0f, 0x8e, 0x8e, 0xc6,
0x11, 0xc1, 0xc0, 0xc9, 0x9e, 0x5b, 0x9c, 0xa1,
0x2d, 0xc6, 0x4b, 0xf5, 0x34, 0x65, 0xb4, 0xcc,
0xac, 0x88, 0xbf, 0x49, 0x43, 0x77, 0xac, 0x8f,
0x61, 0x71, 0x8e, 0x59, 0x7f, 0x78, 0xd9, 0x73,
0x41, 0x90, 0x73, 0x8b, 0x8e, 0x93, 0x3f, 0x6e,
0xdd, 0x2e, 0x37, 0xe8, 0x72, 0x43, 0xa1, 0xf3,
0xa9, 0xfe, 0x7f, 0x98, 0xf3, 0xa5, 0x98, 0x43,
0xe5, 0x60, 0xb9, 0x5d, 0xbd, 0xba, 0x3f, 0xae,
0x71, 0xf6, 0xed, 0xc1, 0xfe, 0x8f, 0x2d, 0x15,
0xd9, 0xc6, 0xf7, 0x57, 0x83, 0x57, 0x7e, 0x10,
0xb6, 0xc3, 0x76, 0x29, 0xb1, 0x10, 0x12, 0x1e,
0xea, 0xa1, 0x15, 0x81, 0x9c, 0x22, 0x5f, 0x8a,
0xf3, 0xff, 0x1c, 0x37, 0x4e, 0x57, 0x1b, 0x26,
0x64, 0xb7, 0xca, 0x7c, 0xc8, 0x57, 0xd9, 0x57,
};
uint8_t dec[0x200];
void decrypt(uint16_t key)
{
for (int i = 0; i < 0x200; i += 2) {
key = (key * 0x41a7) ^ 0x5555;
uint16_t d = data[i + 0] << 0 | data[i + 1] << 8;
d ^= key;
dec[i + 0] = d >> 0;
dec[i + 1] = d >> 8;
}
}
uint8_t fools[] = {'F', 'O', 'O', 'L', 'S'};
bool check()
{
return memmem(dec, 0x200, fools, sizeof(fools));
}
uint16_t hash(char *str)
{
uint16_t key = 0x9fc0;
for (;;) {
uint16_t in = str[0] << 0 | str[1] << 8;
key = (((key * 2) ^ in) * 2) + in;
if (*str == 0) break;
str++;
break;
}
return key;
}
int main()
{
uint16_t key = 0;
for (int i = 0xa4; i <= 0xffff; i++) {
decrypt(i);
if (check()) {
fwrite(dec, 0x200, 1, stdout);
key = i;
break;
}
}
printf("\n%04x\n", key);
uint8_t str[16] = {0};
for (;;) {
int i;
for (i = 0; i < 2; i++) {
str[i]++;
//if (str[i] >= 0x7b) {
//str[i] = 0x20;
//continue;
//}
//if (str[i] < 0x30) str[i] = 0x30;
//if (str[i] >= 0x3A && str[i] <= 0x40) str[i] = 0x41;
//if (str[i] >= 0x5B && str[i] <= 0x60) str[i] = 0x61;
if (str[i] == 0x7f) {
str[i] = 0x20;
continue;
}
if (str[i] < 0x20) str[i] = 0x20;
break;
}
if (i >= 2) break;
if (key == hash(str)) {
printf("%s\n", str);
}
}
}