Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <time.h>
- #include <string.h>
- typedef unsigned int uint;
- typedef unsigned short u16;
- typedef unsigned char u8;
- #define _A0F4 (_A0F3 >> 8) & 0xff
- #define _A0F5 (_A0F3 >> 16) & 0xff
- #define _A0F6 (_A0F3 >> 24) & 0xff
- #define TRUE 1
- #define FALSE 0
- u8 sA567[] = {0x15, 0xc8, 0x7b, 0x6b, 0x7f, 0xa1, 0xa3, 0x29, 0xe8, 0x81, 0x1, 0x99, 0x9f, 0xeb, 0xf2, 0x80, 0x5f, 0xa3, 0x96, 0x7c, 0x17, 0xdb, 0xd2, 0x41, 0xa1, 0xbc, 0xbb, 0x13, 0xbc, 0xd8, 0xc3, 0x9, 0xf4, 0x2, 0x1b, 0x95, 0xf3, 0x72, 0x65, 0xdb, 0x6f, 0x82, 0x9e, 0x52, 0xd9, 0x89, 0xd8, 0xdf, 0x5a, 0xb0, 0x3, 0xf2, 0x9a, 0xe6, 0xef, 0x81, 0x32, 0xa5, 0x57, 0x60, 0xe0, 0xc8, 0x2d, 0x8c, 0x52, 0x63, 0x5d, 0xd8, 0xf, 0x72, 0xdf, 0xa1, 0x36, 0x1c, 0x3e, 0xc8, 0xc2, 0x4f, 0x1e, 0xfd, 0x1d, 0x11, 0xc, 0x74, 0x13, 0x21, 0x49, 0xad, 0xc0, 0xd9, 0xba, 0xda, 0xd, 0xe4, 0x6, 0x8e, 0x94, 0xe6, 0x25, 0x8b, 0xba, 0xc2, 0x2b, 0x92, 0xa, 0x90, 0xa1, 0x4a, 0x6, 0x53, 0x84, 0x79, 0xe5, 0xe7, 0xcf, 0x60, 0x74, 0xd2, 0x3b, 0x2a, 0xe0, 0x56, 0x32, 0xa6, 0x10, 0x69, 0x52, 0xf, 0xd3, 0x3d, 0x7f, 0xf3, 0x12, 0x6d, 0x0, 0x57, 0x41, 0x3f, 0x96, 0x3b, 0x8, 0xb7, 0x48, 0x72, 0xb2, 0x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 0xdb, 0x5c, 0xa8, 0x25, 0x92, 0x70, 0xc8, 0xa5, 0xf6, 0x1a, 0x55, 0xad, 0xae, 0x44, 0x2a, 0x4a, 0x77, 0xca, 0x2d, 0x6b, 0xdd, 0x47, 0x51, 0x95, 0x58, 0xff, 0x75, 0xdd, 0x30, 0x81, 0x80, 0x1b, 0xdb, 0xc2, 0xa9, 0x29, 0xce, 0xa8, 0xd6, 0xd8, 0x8, 0xc1, 0x86, 0x1c, 0xec, 0xf, 0x63, 0x48, 0x38, 0x1b, 0xeb, 0x32, 0xe3, 0xa0, 0xe6, 0x28, 0x5e, 0xf4, 0xa, 0xa2, 0x2d, 0xf1, 0xb0, 0x61, 0xfc, 0xdd, 0x4c, 0x6b, 0x43, 0xe8, 0x82, 0x4, 0xe8, 0xf3, 0x3d, 0x43, 0xf5, 0x6d, 0x4e, 0x8a, 0x45, 0xc9, 0x6a, 0x96, 0x1d, 0x37, 0x93, 0x76, 0x53, 0x9e, 0x33, 0xa, 0xaf, 0x8, 0x3e, 0x80, 0xfc, 0xe7, 0xc5, 0x17, 0x69, 0xe7, 0x91, 0x55, 0x52, 0x4a, 0xa5, 0x51, 0x6, 0xa8, 0x3e, 0x82, 0x1d, 0xff, 0x27, 0x14, 0xee, 0x26, 0x39, 0x55, 0xc0, 0x8f, 0xd7, 0xf2, 0x47, 0x14, 0x9a, 0x54, 0x5e, 0xac, 0x9a, 0xc2, 0x93, 0xc0, 0x96, 0x60, 0x44, 0x11, 0x8, 0xed, 0x22, 0x20, 0x44, 0x77, 0xb3, 0xfc, 0x78, 0xe5, 0xda, 0xa, 0xc5, 0xa1, 0xbe, 0x64, 0x80, 0x25, 0x20, 0xa7, 0xfb, 0x3e, 0xdb, 0x26, 0x39, 0x99, 0x2a, 0xee, 0xa3, 0x36, 0x7b, 0xb6, 0x63, 0x24, 0xf6, 0xf6, 0x13, 0xe, 0x83, 0x86, 0x1f, 0x3a, 0xf};
- u16 values[65536] = {0};
- u16 values_set[65536] = {0};
- int values_size = 0;
- int main(void) {
- uint _A0F3 = 0x5d0b1c11;
- const uint _A0F7 = 0x35e79125;
- const uint _A0FB = 0x56596b10;
- struct timespec start_time;
- for (int i = 0; i < 0x3ffffb0a; i++) {
- _A0F3 = _A0F3 * _A0F7 + _A0FB;
- }
- for (int i = 0; i < 0x4f6; i++) {
- u16 _A10B = _A0F4;
- int _A10D = _A0F5;
- int _A10E = _A0F6;
- int data_count = 0;
- int start_index = -1;
- values_size = 0;
- int sublcg_count = 0;
- memset(values_set, 0xff, sizeof(values_set));
- while (TRUE) {
- values[values_size++] = _A10B;
- _A10B = (_A10B >> 1) * _A10D + _A10E;
- if (values_set[_A10B] != 0xffff) {
- start_index = values_set[_A10B];
- break;
- }
- values_set[_A10B] = values_size;
- sA567[data_count++] ^= (_A10B & 0xff);
- data_count = data_count & 0x1ff;
- sublcg_count++;
- }
- int sublcg_index = start_index;
- int period = values_size - start_index;
- while ((period & 1) == 0) {
- period >>= 1;
- }
- int num_xors_until_repeat = period * 512;
- int num_repeat_iterations = (0x1b080733 - sublcg_count) / num_xors_until_repeat;
- int remaining_sublcg_iterations = (0x1b080733 - sublcg_count) % num_xors_until_repeat;
- if (num_repeat_iterations & 1 == 1) {
- remaining_sublcg_iterations += num_xors_until_repeat;
- }
- for (int j = 0; j < remaining_sublcg_iterations; j++) {
- sA567[data_count++] ^= (values[sublcg_index++] & 0xff);
- data_count = data_count & 0x1ff;
- if (sublcg_index >= values_size) {
- sublcg_index = start_index;
- }
- }
- _A0F3 = _A0F3 * _A0F7 + _A0FB;
- if (i % 10000 == 9999) {
- struct timespec end_time;
- clock_gettime(CLOCK_MONOTONIC, &end_time);
- fprintf(stderr, "difftime: %f, iter: %u\n", 1000.0*end_time.tv_sec + 1e-6*end_time.tv_nsec - (1000.0*start_time.tv_sec + 1e-6*start_time.tv_nsec), i);
- }
- }
- for (int i = 0; i < 0x200; i++) {
- printf("0x%02x, ", sA567[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement