+static void* check_thread(void* x)
+{
+ check_args_t *cargs = (check_args_t *)x;
+
+ // printf("first_byte_num = %d, first_byte_Sum = %d\n", first_byte_num, first_byte_Sum);
+ num_good_first_bytes = estimate_second_byte_sum();
+ if (cargs->total_added_nonces > (2500*cargs->idx)) {
+ clock_t time1 = clock();
+ cracking = generate_candidates(first_byte_Sum, nonces[best_first_bytes[0]].Sum8_guess);
+ time1 = clock() - time1;
+ if ( time1 > 0 ) PrintAndLog("Time for generating key candidates list: %1.0f seconds", ((float)time1)/CLOCKS_PER_SEC);
+ if (known_target_key != -1) brute_force();
+ cargs->idx++;
+ }
+
+ if (cracking || num_good_first_bytes >= GOOD_BYTES_REQUIRED) {
+ if (cargs->total_added_nonces > 2500+1000) {
+ field_off = brute_force(); // switch off field with next SendCommand and then finish
+ }
+ cracking = false;
+ }
+
+ thread_check_done = true;
+
+ return (void *) NULL;
+}
+