bkcrack: include/bkcrack/Zreduction.hpp Source File

bkcrack 1.8.1 Crack legacy zip encryption with Biham and Kocher's known plaintext attack.

Zreduction.hpp
1#ifndef BKCRACK_ZREDUCTION_HPP
2#define BKCRACK_ZREDUCTION_HPP
3
4#include <bkcrack/Progress.hpp>
5#include <bkcrack/types.hpp>
6
8 class Zreduction
9{
10public:
12 explicit Zreduction(const std::vector<std::uint8_t>& keystream);
13
15 void reduce(Progress& progress);
16
18 void generate();
19
21 auto getCandidates() const -> const std::vector<std::uint32_t>&;
22
24 auto getIndex() const -> std::size_t;
25
26private:
27 const std::vector<std::uint8_t>& keystream;
28 // After constructor or reduce(), contains Z[10,32) values.
29 // After generate(), contains Zi[2,32) values.
30 std::vector<std::uint32_t> zi_vector;
31 std::size_t index;
32};
33
34#endif // BKCRACK_ZREDUCTION_HPP
Progress
Structure to report the progress of a long operation or to cancel it.
Definition Progress.hpp:11
Zreduction::generate
void generate()
Extend Zi[10,32) values into Zi[2,32) values using keystream.
Zreduction::getIndex
auto getIndex() const -> std::size_t
Zreduction::reduce
void reduce(Progress &progress)
Reduce Zi[10,32) number using extra contiguous keystream.
Zreduction::getCandidates
auto getCandidates() const -> const std::vector< std::uint32_t > &
Zreduction::Zreduction
Zreduction(const std::vector< std::uint8_t > &keystream)
Constructor generating Zi[10,32) values from the last keystream byte.
types.hpp
Useful types, constants and utility functions.