#pragma once #include #include namespace swbf { constexpr static auto MAX_CODE_LENGTH = 8; constexpr static auto THREAD_COUNT = 26; // this is a-z /// private structure struct ThreadInfoData; /// returns true when all threads finished bool DisplayThreadInfo(); /// Per-thread worker for brute-forcing struct BruteforceWorker { /// Options for the worker. struct Options { /// The target hash to find matches for. std::uint32_t targetHash; /// If `startLength` should be treated as the code length. bool exact; std::uint32_t startLength; std::uint32_t endLength; }; BruteforceWorker(unsigned tid, const Options& options); /// Public-facing driver function - the thread pool runs this. void Bruteforce(char prefix); private: void BruteforceForLength(char prefix, std::uint32_t length); void CopyDisplayData(); ThreadInfoData& DisplayData(); Options options; unsigned threadIndex; std::string test_buffer; std::uint32_t hash; }; } // namespace swbf