From a402822646543c47324a3310f8cdf572df0c882e Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 12 Nov 2018 14:20:42 +0100 Subject: [PATCH] Fixed output of --speed-only and --progress-only in case a fast hash is used in combination with --slow-candidates --- docs/changes.txt | 1 + src/opencl.c | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 3815acb45..fb8fa4778 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -44,6 +44,7 @@ - Fixed missing call to WSAStartup() and client indexing in order to start the brain server on Windows - Fixed out-of-bounds write in short-term memory of the brain-server - Fixed status output of progress value in case -S and -l used in combination +- Fixed output of --speed-only and --progress-only in case a fast hash is used in combination with --slow-candidates ## ## Technical diff --git a/src/opencl.c b/src/opencl.c index 8532def93..97b624f21 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -2787,20 +2787,42 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co } else { - double total = device_param->speed_msec[0]; + double total_msec = device_param->speed_msec[0]; for (u32 speed_pos = 1; speed_pos < device_param->speed_pos; speed_pos++) { - total += device_param->speed_msec[speed_pos]; + total_msec += device_param->speed_msec[speed_pos]; } - // it's unclear if 4s is enough to turn on boost mode for all opencl device + if (user_options->slow_candidates == true) + { + if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1)) + { + const u32 speed_pos = device_param->speed_pos; + + if (speed_pos) + { + device_param->speed_cnt[0] = device_param->speed_cnt[speed_pos - 1]; + device_param->speed_msec[0] = device_param->speed_msec[speed_pos - 1]; + } + + device_param->speed_pos = 1; + + device_param->speed_only_finish = true; - if ((total > 4000) || (device_param->speed_pos == SPEED_CACHE - 1)) + break; + } + } + else { - device_param->speed_only_finish = true; + // it's unclear if 4s is enough to turn on boost mode for all opencl device - break; + if ((total_msec > 4000) || (device_param->speed_pos == SPEED_CACHE - 1)) + { + device_param->speed_only_finish = true; + + break; + } } } } @@ -2833,14 +2855,14 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (user_options->speed_only == true) { - double total = device_param->speed_msec[0]; + double total_msec = device_param->speed_msec[0]; for (u32 speed_pos = 1; speed_pos < device_param->speed_pos; speed_pos++) { - total += device_param->speed_msec[speed_pos]; + total_msec += device_param->speed_msec[speed_pos]; } - device_param->outerloop_msec = total * hashes->salts_cnt * device_param->outerloop_multi; + device_param->outerloop_msec = total_msec * hashes->salts_cnt * device_param->outerloop_multi; } return 0;