Created
April 2, 2019 11:48
-
-
Save Silur/7121fabafc697e3b9fc82a5cb8ab023f to your computer and use it in GitHub Desktop.
timelock puzzle solver
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 <gmp.h> | |
#include <stdio.h> | |
int main(int argc, char **argv) | |
{ | |
mpz_t ret; | |
mpz_t exp; | |
mpz_t n; | |
mpz_t two; | |
mpz_inits(ret, exp, n, two, 0); | |
mpz_set_str(n, "147710164742839770105418389512240074997644188475824187928019488659050860608555713845140958979292386801844424266229240090284454968761835586483815852946875368053537745817800552096030151193719613985791148827776019150556575150066500426995204859737360411566322825773501601724033282407354916391853693576174163273259", 10); | |
unsigned long long t = atoll(argv[1]); | |
unsigned long long i; | |
mpz_set_ui(exp, 2); | |
mpz_set_ui(two, 2); | |
for(i=0; i<t; i++) | |
{ | |
mpz_powm(ret, exp, two, n); | |
mpz_set(exp, ret); | |
} | |
gmp_printf("%Zd\n", ret); | |
mpz_clears(ret, exp, n, two, 0); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment