From 0ca5fcef1c8190ac310d0b7306bf65896f2aa1e8 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 12 Mar 2021 20:41:19 +0100 Subject: [PATCH] if weak prng key found, no need for phase2 --- tools/mf_nonce_brute/mf_nonce_brute.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/mf_nonce_brute/mf_nonce_brute.c b/tools/mf_nonce_brute/mf_nonce_brute.c index 2bd500c90..d862607b2 100644 --- a/tools/mf_nonce_brute/mf_nonce_brute.c +++ b/tools/mf_nonce_brute/mf_nonce_brute.c @@ -614,7 +614,7 @@ int main(int argc, char *argv[]) { pthread_join(threads[i], NULL); t1 = clock() - t1; - printf("execution time %.0f ticks\n", (float)t1); + printf("execution time %.2f sec\n", (float)t1 / 1000000.0); if (!global_found && !global_found_candidate) { @@ -622,15 +622,18 @@ int main(int argc, char *argv[]) { goto out; } + if (global_found) { + goto out; + } + if (enc_len < 4) { - printf("skipping phase 2\n"); + printf("Too few next cmd bytes, skipping phase 2\n"); goto out; } // reset thread signals __sync_fetch_and_add(&global_found, 0); __sync_fetch_and_add(&global_found_candidate, 0); - t1 = clock(); printf("\n----------- Phase 2 ------------------------\n"); printf("uid.......... %08x\n", uid); @@ -663,9 +666,6 @@ int main(int argc, char *argv[]) { printf("\nFailed to find a key\n\n"); } - t1 = clock() - t1; - printf("execution time %.0f ticks\n", (float)t1); - out: // clean up mutex pthread_mutex_destroy(&print_lock);