Created
December 24, 2016 02:25
-
-
Save laxa/2c127f9020c77703a04fa854fe21915f to your computer and use it in GitHub Desktop.
rev500 - 3DSCTF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <math.h> | |
uint64_t my_pow(uint64_t a, uint64_t b) | |
{ | |
int64_t ret = 1; | |
uint64_t i; | |
for (i = 0; i < a; i++) | |
ret = ret * b; | |
return ret; | |
} | |
int64_t huehue(uint64_t a, uint64_t b) | |
{ | |
uint64_t v2 = a / b; | |
uint64_t v3 = v2 * b; | |
return (a - v3); | |
} | |
int main(void) | |
{ | |
uint64_t v3; | |
uint64_t v4; | |
uint64_t v5; | |
uint64_t v6; | |
uint64_t i; | |
int64_t v9 = 0; | |
for (i = 0; i <= 0xC0DE41; ++i) | |
{ | |
v3 = i / 0x29; | |
v4 = my_pow(v3, 3); | |
v5 = v4 + v9; | |
v6 = v5 * i; | |
v9 = huehue(v6, 0x41DEADBABEC0FFEEuLL); | |
} | |
printf( | |
"%04llx%04llx%04llx%04llx\n", | |
(uint64_t)v9 >> 48, | |
(v9 & 0xFFFF00000000uLL) >> 32, | |
(uint64_t)((uint32_t)v9 & 0xFFFF0000) >> 16, | |
(uint16_t)v9); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment