Kaynağa Gözat

Giving a more codnsistent ordering on questions stack.

plus some verbosity.
Michele Orrù 11 yıl önce
ebeveyn
işleme
9984b07ce5
2 değiştirilmiş dosya ile 9 ekleme ve 5 silme
  1. 5 5
      src/questions/allquestions.c
  2. 4 0
      src/questions/wiener.c

+ 5 - 5
src/questions/allquestions.c

@@ -97,12 +97,12 @@ void select_all_questions(void)
   LIST_INIT(&questions);
 
   /* REGISTER_QUESTION(ExampleQuestion); */
-  REGISTER_QUESTION(WienerQuestion);
+  REGISTER_QUESTION(DixonQuestion);
+  REGISTER_QUESTION(PollardBrentRhoQuestion);
+  REGISTER_QUESTION(PollardRhoQuestion);
+  REGISTER_QUESTION(WilliamsQuestion);
   REGISTER_QUESTION(PollardQuestion);
   REGISTER_QUESTION(FermatQuestion);
+  REGISTER_QUESTION(WienerQuestion);
   REGISTER_QUESTION(MetadataQuestion);
-  /* REGISTER_QUESTION(PollardRhoQuestion); */
-  REGISTER_QUESTION(WilliamsQuestion);
-  REGISTER_QUESTION(DixonQuestion);
-  REGISTER_QUESTION(PollardBrentRhoQuestion);
 }

+ 4 - 0
src/questions/wiener.c

@@ -60,6 +60,8 @@ wiener_question_ask_rsa(const RSA *rsa)
        i++, it = cf_next(cf)) {
     t = it->h;
     d = it->k;
+
+    fprintf(stderr, "[-] Testing continued fractions (%zu/%d)\r", i, bits);
     /*
      * Recovering φ(N) = (ed - 1) / t
      * TEST1: obviously the couple {t, d} is correct → (ed-1) | t
@@ -86,6 +88,7 @@ wiener_question_ask_rsa(const RSA *rsa)
     /* delta */
     BN_sqr(tmp, b2, ctx);
     BN_usub(delta, tmp, n);
+
     if (!BN_sqrtmod(tmp, rem, delta, ctx)) continue;
     /* key found :) */
     ret = RSA_new();
@@ -104,6 +107,7 @@ wiener_question_ask_rsa(const RSA *rsa)
   BN_free(b2);
   BN_free(delta);
   BN_free(phi);
+  fprintf(stderr, "\n");
 
   return ret;
 }