bkcrack: include/bkcrack/MultTab.hpp Source File

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

MultTab.hpp
1#ifndef BKCRACK_MULTTAB_HPP
2#define BKCRACK_MULTTAB_HPP
3
4#include <bkcrack/types.hpp>
5
7 class MultTab
8{
9public:
12 static auto getMsbProdFiber2(std::uint8_t msbprodinv) -> const std::vector<std::uint8_t>&
13 {
14 return instance.msbprodfiber2[msbprodinv];
15 }
16
19 static auto getMsbProdFiber3(std::uint8_t msbprodinv) -> const std::vector<std::uint8_t>&
20 {
21 return instance.msbprodfiber3[msbprodinv];
22 }
23
25 static constexpr std::uint32_t mult = 0x08088405;
26
28 static constexpr std::uint32_t multInv = 0xd94fa8cd;
29 static_assert(mult * multInv == 1);
30
31private:
32 // initialize lookup tables
33 MultTab();
34
35 // lookup tables
36 std::array<std::vector<std::uint8_t>, 256> msbprodfiber2;
37 std::array<std::vector<std::uint8_t>, 256> msbprodfiber3;
38
39 static const MultTab instance;
40};
41
42#endif // BKCRACK_MULTTAB_HPP
MultTab::mult
static constexpr std::uint32_t mult
Multiplicative constant used in traditional PKWARE encryption.
Definition MultTab.hpp:25
MultTab::multInv
static constexpr std::uint32_t multInv
Multiplicative inverse of mult modulo 2^32.
Definition MultTab.hpp:28
MultTab::getMsbProdFiber3
static auto getMsbProdFiber3(std::uint8_t msbprodinv) -> const std::vector< std::uint8_t > &
Definition MultTab.hpp:19
MultTab::getMsbProdFiber2
static auto getMsbProdFiber2(std::uint8_t msbprodinv) -> const std::vector< std::uint8_t > &
Definition MultTab.hpp:12
types.hpp
Useful types, constants and utility functions.