Skip to content

Instantly share code, notes, and snippets.

@vesim987
Created November 20, 2019 19:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vesim987/f40bc486f88a5edde9efccf3e4339a67 to your computer and use it in GitHub Desktop.
Save vesim987/f40bc486f88a5edde9efccf3e4339a67 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
unsigned __int128 a = 20;
int solve(__int128 TO, unsigned __int128 TIME, unsigned __int128 number, unsigned __int128 idd) {
for(__int128 t = -120; t < 120; t++) {
for(__int128 s1 = 0; s1 <256*16; s1++) {
for(__int128 s2 = 0; s2 < 256*16; s2++) {
unsigned __int128 tt = (__int128)TIME + t + TO * 3600;
unsigned __int128 n = 146410935049;
n = (n + 186577649851*s1) % 257084507917;
n = (n ^ (tt * 117865751629)) % 257084507917;
n = (n + 186577649851*s2) % 257084507917;
n = (n + idd * 117865751629) % 257084507917;
if (n % 10000000000 == number) {
printf("ok %lld %lld %lld %lld\n", (uint64_t)s1, (uint64_t)s2, (uint64_t)tt, (uint64_t)t);
return 1;
}
}
}
}
return 0;
printf("nope\n");
}
int main(int argc, char **argv) {
uint64_t TIME = atol(argv[1]);
uint64_t number = atol(argv[2]);
uint64_t idd = atol(argv[3]);
fprintf(stderr, "%lld %lld %lld\n", TIME, number, idd);
const __int128 arr[] = {0, -1, 1, -2, 2, -3, 3, -4, 4, -5, 5, -6, 6, -7, 7, -8, 8, -9, 9, -10, 10, -11, 11, -12, 12};
//#pragma omp parallel
for(__int128 TO = 0; TO < sizeof(arr)/sizeof(arr[1]); TO++) {
fprintf(stderr, "TO = %d\n", arr[TO]);
int i = solve(arr[TO], TIME, number, idd);
if(i == 1)
return 0;
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment