Skip to content

Instantly share code, notes, and snippets.

@zorix
Last active July 20, 2017 12:50
Show Gist options
  • Save zorix/0ecf4a5b44b0dd7665d122bf966f3373 to your computer and use it in GitHub Desktop.
Save zorix/0ecf4a5b44b0dd7665d122bf966f3373 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <ctime>
#include <iostream>
using namespace std;
const __int32 start_time = 1500465600; // guessed time
const __int32 end_time = 1500498000; // guessed time
__int8 encryptedMessage[] =
{
0x9a, 0x60, 0x76, 0x14, 0x8b, 0x36, 0x5a, 0x10, 0x2b, 0x91, 0xc4, 0x6c, 0xab, 0x27, 0x92, 0x99,
0xf8, 0x6a, 0xec, 0x5d, 0x32, 0x20, 0x3d, 0x61, 0x8f, 0xc7, 0xfb, 0xdd, 0x02, 0x72, 0xbf,
};
static_assert(sizeof(encryptedMessage) == 31);
void testTime(__int64 time)
{
srand(time);
__int8 key[31] = { 0 };
for (auto& byte : key)
{
auto v5 = rand();
byte = v5 - ((unsigned __int64)(2139127681i64 * v5 >> 39) - (v5 >> 31));
}
__int8 outMsg[31] = { 0 };
for (auto i = 0; i < 31; ++i)
outMsg[i] = encryptedMessage[i] ^ key[i];
bool ok = true;
for (auto byte : outMsg)
{
if (byte < 32 || byte > 127)
{
ok = false;
break;
}
}
if (ok)
{
printf("%.*s\n", 31, outMsg);
printf("%u\n", time);
for (auto& byte : key)
{
union
{
unsigned __int32 i32;
__int8 i8;
} c;
c.i32 = 0;
c.i8 = byte;
printf("%.2X ", c.i32);
}
printf("\n");
}
}
int main()
{
cout << "Starting" << endl;
for (auto i = start_time; i <= end_time; ++i)
testTime(i);
cout << "Finished" << endl;
cin.get();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment