@@ -767,8 +767,6 @@ static void simulate_acquire_nonces()
767767
768768static int acquire_nonces (uint8_t blockNo , uint8_t keyType , uint8_t * key , uint8_t trgBlockNo , uint8_t trgKeyType , bool nonce_file_write , bool slow )
769769{
770- uint8_t three_in_row = 0 ;
771- uint8_t prev_best = 0 ;
772770 clock_t time1 = clock ();
773771 bool initialize = true;
774772 bool finished = false;
@@ -791,8 +789,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
791789 do {
792790
793791 flags = 0 ;
794- //flags |= initialize ? 0x0001 : 0;
795- flags |= 0x0001 ;
792+ flags |= initialize ? 0x0001 : 0 ;
796793 flags |= slow ? 0x0002 : 0 ;
797794 flags |= field_off ? 0x0004 : 0 ;
798795 c .arg [2 ] = flags ;
@@ -871,31 +868,14 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
871868 );
872869 }
873870
874- if ( num_good_first_bytes > 0 ) {
875-
876- if ( prev_best == best_first_bytes [0 ] ){
877- ++ three_in_row ;
878- } else {
879- three_in_row = 0 ;
880- }
881- prev_best = best_first_bytes [0 ];
882-
883- //printf("GOOD BYTES: %s \n", sprint_hex(best_first_bytes, num_good_first_bytes) );
884- if ( total_added_nonces >= (NONCES_THRESHOLD * idx ) || three_in_row >= 3 ) {
885-
886- bool cracking = generate_candidates (first_byte_Sum , nonces [best_first_bytes [0 ]].Sum8_guess );
887- if (cracking || known_target_key != -1 ) {
888-
889- UsbCommand cOff = {CMD_FPGA_MAJOR_MODE_OFF , {0 ,0 ,0 } };
890- SendCommand (& cOff );
891- field_off = brute_force ();
871+ if (total_added_nonces >= (NONCES_THRESHOLD * idx )) {
872+ if (num_good_first_bytes > 0 ) {
873+ if (generate_candidates (first_byte_Sum , nonces [best_first_bytes [0 ]].Sum8_guess ) || known_target_key != -1 ) {
874+ field_off = brute_force (); // switch off field with next SendCommand and then finish
892875 }
893- three_in_row = 0 ;
894876 }
877+ idx ++ ;
895878 }
896-
897- if ( total_added_nonces >= (NONCES_THRESHOLD * idx ))
898- ++ idx ;
899879 }
900880 } while (!finished );
901881
0 commit comments