clean up code a bit more
This commit is contained in:
parent
9d02d7280e
commit
e8cdc4e41a
|
@ -25,6 +25,8 @@ namespace swbf {
|
|||
std::uint32_t codeHash;
|
||||
bool done = false;
|
||||
|
||||
/// The matched codes for this thread.
|
||||
/// All threads need to be summed up to get the whole list.
|
||||
std::vector<std::string> matches;
|
||||
|
||||
void DisplayProgress() {
|
||||
|
@ -96,10 +98,9 @@ namespace swbf {
|
|||
while(true) {
|
||||
hash = swbf::SwsfScramble(test_buffer);
|
||||
|
||||
// There was a match!
|
||||
// found a match
|
||||
if(hash == options.targetHash)
|
||||
DisplayData().matches.push_back(test_buffer);
|
||||
//swbf::fprint(stderr, "match: {} ({:08x})\n", test_buffer, hash);
|
||||
|
||||
CopyDisplayData();
|
||||
|
||||
|
@ -138,10 +139,15 @@ namespace swbf {
|
|||
|
||||
pool.join(); // just in case!
|
||||
|
||||
// build the matches file
|
||||
fprint(stdout, "Writing matches file...");
|
||||
fprint(stdout, "\nDone, writing matches file...\n");
|
||||
std::ofstream ofs("matches.txt");
|
||||
|
||||
if(!ofs) {
|
||||
fprint(stderr, "Could not open matches file for writing. Unfortunately, there's not much I can do about that.\n");
|
||||
std::exit(1);
|
||||
}
|
||||
|
||||
// write the matches file
|
||||
if(options.exact)
|
||||
fprint(ofs, "Matches for hash {:8x} for length {}:\n", options.targetHash, options.startLength, options.endLength);
|
||||
else
|
||||
|
@ -154,6 +160,8 @@ namespace swbf {
|
|||
|
||||
td.matches.clear();
|
||||
}
|
||||
|
||||
infoData.clear();
|
||||
}
|
||||
|
||||
} // namespace swbf
|
||||
|
|
Loading…
Reference in New Issue