From 342b661f770ddb6f583ee8414c8e09799aa916a8 Mon Sep 17 00:00:00 2001 From: kimci86 Date: Fri, 28 Jun 2024 00:00:00 +0200 Subject: [PATCH] Allow to set a new target for SixCharactersRecovery --- src/password.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/password.cpp b/src/password.cpp index 6c08a7e..c7ccd45 100644 --- a/src/password.cpp +++ b/src/password.cpp @@ -15,8 +15,8 @@ template class SixCharactersRecovery { public: - SixCharactersRecovery(const Keys& target, const std::vector& charset4, - const std::vector& charset5) + void setTarget(const Keys& target, const std::vector& charset4, + const std::vector& charset5) { // initialize target X, Y and Z values x[6] = target.getX(); @@ -31,6 +31,8 @@ class SixCharactersRecovery z[i - 1] = Crc32Tab::crc32inv(z[i], msb(y[i])); // precompute possible Z0[16,32) and Z{-1}[24,32) + z0_16_32.reset(); + zm1_24_32.reset(); for (const auto p5 : charset5) { x[5] = Crc32Tab::crc32inv(x[6], p5); @@ -140,13 +142,13 @@ class BruteforceRecovery : public SixCharactersRecovery public: BruteforceRecovery(const Keys& keys, const std::vector& charset, std::vector& solutions, std::mutex& solutionsMutex, bool exhaustive, Progress& progress) - : SixCharactersRecovery{keys, charset, charset} - , charset{charset} + : charset{charset} , solutions{solutions} , solutionsMutex{solutionsMutex} , exhaustive{exhaustive} , progress{progress} { + setTarget(keys, charset, charset); } void search(std::size_t length)