Skip to content

Commit

Permalink
Do no show attack restart point above candidates count
Browse files Browse the repository at this point in the history
It is possible that parallel workers explore all remaining candidates
before the user's interruption or early exit actually occurs. This can
happen for example if the solution is close to the end of the list of
candidates. Then it does not make sense to restart the attack so a
restart point is not needed.
  • Loading branch information
kimci86 committed Mar 7, 2024
1 parent 9481856 commit 500a736
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ auto attack(const Data& data, const std::vector<std::uint32_t>& zi_2_32_vector,
for (auto& thread : threads)
thread.join();

start = nextCandidateIndex;
start = std::min(nextCandidateIndex.load(), size);

return solutions;
}
3 changes: 2 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ try
else if (state == Progress::State::EarlyExit)
std::cout << "Found a solution. Stopping." << std::endl;

std::cout << "You may resume the attack with the option: --continue-attack " << restart << std::endl;
if (restart < static_cast<int>(zr.getCandidates().size()))
std::cout << "You may resume the attack with the option: --continue-attack " << restart << std::endl;
}

// print the keys
Expand Down

0 comments on commit 500a736

Please sign in to comment.