bkcrack 1.8.1
Crack legacy zip encryption with Biham and Kocher's known plaintext attack.
ConsoleProgress.hpp
1#ifndef BKCRACK_CONSOLEPROGRESS_HPP
2#define BKCRACK_CONSOLEPROGRESS_HPP
3
4#include <bkcrack/Progress.hpp>
5
6#include <condition_variable>
7#include <mutex>
8#include <string>
9#include <thread>
10
13{
14public:
16 explicit ConsoleProgress(std::ostream& os,
17 const std::chrono::milliseconds& interval = std::chrono::milliseconds{200});
18
21
22private:
23 const std::chrono::milliseconds m_interval;
24
25 std::mutex m_in_destructor_mutex;
26 std::condition_variable m_in_destructor_cv;
27 bool m_in_destructor;
28
29 std::thread m_printer;
30 void printerFunction();
31
32 void beforeLog(std::ostream& os) override;
33 std::size_t m_lengthToClear = 0;
34
35 auto getProgressLine() -> std::string;
36};
37
38#endif // BKCRACK_CONSOLEPROGRESS_HPP
ConsoleProgress(std::ostream &os, const std::chrono::milliseconds &interval=std::chrono::milliseconds{200})
Start a thread to print progress.
~ConsoleProgress()
Notify and stop the printing thread.
Progress(std::ostream &os)
Constructor.