From d9d57fc9a0b4fafcc51ba77ad1ba45ba0df23ad8 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Fri, 11 Jul 2025 10:08:08 +0200 Subject: [PATCH] Fixed autotune edge case and encoder bugs Improved handling of an autotune edge case. In theory, increasing accel early can improve accuracy, and it does, but it also prevents increasing the thread count because it's more likely to run into high runtime limits. OTOH, we want to prioritize threads over accel. This change may slightly reduce performance for algorithms that benefit from high accel and low thread counts (e.g., 7800, 14900), but those can be managed by limiting thread count or, preferably, by setting OPTS_TYPE_NATIVE_THREADS. Added OPTS_TYPE_NATIVE_THREADS to 7800, 7810, and 14900. Also fixed encoder bugs in hash-mode 29920 and 29940, identified using the new test_edge.sh script. The encoders in the modules failed to properly terminate the output string. --- src/autotune.c | 9 +++++++++ src/modules/module_07800.c | 1 + src/modules/module_07801.c | 1 + src/modules/module_14900.c | 1 + src/modules/module_29920.c | 2 ++ src/modules/module_29940.c | 2 ++ 6 files changed, 16 insertions(+) diff --git a/src/autotune.c b/src/autotune.c index cf233a88f..4c8566f3b 100644 --- a/src/autotune.c +++ b/src/autotune.c @@ -334,6 +334,14 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param // v7 autotuner is a lot more straight forward // we start with some purely theoretical values as a base, then move on to some meassured tests + /* This causes more problems than it solves. + * In theory, it's fine to boost accel early to improve accuracy, and it does, + * but on the other hand, it prevents increasing the thread count due to high runtime. + * For longer runtimes, we want to prioritize more threads over higher accel. + * This change also has some downsides for algorithms that actually benefit + * from higher accel and fewer threads (e.g., 7800, 14900). But those are easy to manage + * by limiting thread count, or better, by setting them to OPTS_TYPE_NATIVE_THREADS. + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) { if (kernel_accel_min < kernel_accel_max) @@ -348,6 +356,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param } } } + */ if (kernel_threads_min < kernel_threads_max) { diff --git a/src/modules/module_07800.c b/src/modules/module_07800.c index ce94bead4..cd45730f4 100644 --- a/src/modules/module_07800.c +++ b/src/modules/module_07800.c @@ -24,6 +24,7 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_NOT_ITERATED; static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE | OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_NATIVE_THREADS | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_UPPER; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; diff --git a/src/modules/module_07801.c b/src/modules/module_07801.c index 17f8777d4..2696dfbe2 100644 --- a/src/modules/module_07801.c +++ b/src/modules/module_07801.c @@ -24,6 +24,7 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_NOT_ITERATED; static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE | OPTS_TYPE_PT_GENERATE_BE + | OPTS_TYPE_NATIVE_THREADS | OPTS_TYPE_ST_ADD80 | OPTS_TYPE_ST_UPPER; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; diff --git a/src/modules/module_14900.c b/src/modules/module_14900.c index fcc639688..38fee41dd 100644 --- a/src/modules/module_14900.c +++ b/src/modules/module_14900.c @@ -23,6 +23,7 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_REGISTER_LIMIT; static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE | OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_NATIVE_THREADS | OPTS_TYPE_SUGGEST_KG; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *BENCHMARK_MASK = "?b?b?b?b?bxxxxx"; diff --git a/src/modules/module_29920.c b/src/modules/module_29920.c index 6cf4a3611..63d170526 100644 --- a/src/modules/module_29920.c +++ b/src/modules/module_29920.c @@ -245,6 +245,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE u32_to_hex (byte_swap_32 (encdatavault->keychain[i]), (u8 *) tmp_buf + j); } + tmp_buf[32 * 8] = 0; + const int line_len = snprintf (line_buf, line_size, "%s%u$%u$%08x%08x$%08x%08x$32$%08x%08x%08x%08x%08x%08x%08x%08x$%u$%s", SIGNATURE_ENCDATAVAULT, encdatavault->version, diff --git a/src/modules/module_29940.c b/src/modules/module_29940.c index aa2791475..4abcc0a0f 100644 --- a/src/modules/module_29940.c +++ b/src/modules/module_29940.c @@ -207,6 +207,8 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE u32_to_hex (byte_swap_32 (encdatavault->keychain[i]), (u8 *) tmp_buf + j); } + tmp_buf[32 * 8] = 0; + const int line_len = snprintf (line_buf, line_size, "%s%u$%u$%08x%08x$%08x%08x$%s", SIGNATURE_ENCDATAVAULT, encdatavault->version,