From fa379074b6d74d048dfd617bd52e23f7ed872ad9 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Fri, 9 Feb 2018 18:30:53 +0100 Subject: [PATCH] Fixed a logic error in storing temporary progress for slow hashes,leading to invalid speeds in status view --- docs/changes.txt | 1 + src/opencl.c | 43 +++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index b6cacc05a..ac05e64cb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -27,6 +27,7 @@ - Fixed a configuration setting for -m 400 which said it's capable of doing SIMD while it is not - Fixed a hash parsing problem for 7-Zip hashes: allow a longer crc32 data length field within the hash format - Fixed a hash parsing problem when using --show/--left with hashes with long salts that required pure kernels +- Fixed a logic error in storing temporary progress for slow hashes,leading to invalid speeds in status view - Fixed a mask-length check issue: Return -1 in case the mask-length is not within the password-length range - Fixed a missing check for returncode in case hashcat.hcstat2 was not found - Fixed a race condition in combinator- and hybrid-mode where the same scratch buffer was used by multiple threads diff --git a/src/opencl.c b/src/opencl.c index f01d1d12f..4819035da 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -2111,8 +2111,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co // init speed timer - u32 speed_pos = device_param->speed_pos; - #if defined (_WIN) if (device_param->timer_speed.QuadPart == 0) { @@ -2491,32 +2489,39 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co * speed */ - const u64 perf_sum_all = (u64) pws_cnt * innerloop_left; + if (status_ctx->run_thread_level2 == true) + { + const u64 perf_sum_all = (u64) pws_cnt * innerloop_left; - const double speed_msec = hc_timer_get (device_param->timer_speed); + const double speed_msec = hc_timer_get (device_param->timer_speed); - hc_timer_set (&device_param->timer_speed); + hc_timer_set (&device_param->timer_speed); - device_param->speed_cnt[speed_pos] = perf_sum_all; + u32 speed_pos = device_param->speed_pos; - device_param->speed_msec[speed_pos] = speed_msec; + device_param->speed_cnt[speed_pos] = perf_sum_all; - speed_pos++; + device_param->speed_msec[speed_pos] = speed_msec; - if (speed_pos == SPEED_CACHE) - { - speed_pos = 0; - } + speed_pos++; - /** - * progress - */ + if (speed_pos == SPEED_CACHE) + { + speed_pos = 0; + } + + device_param->speed_pos = speed_pos; + + /** + * progress + */ - hc_thread_mutex_lock (status_ctx->mux_counter); + hc_thread_mutex_lock (status_ctx->mux_counter); - status_ctx->words_progress_done[salt_pos] += perf_sum_all; + status_ctx->words_progress_done[salt_pos] += perf_sum_all; - hc_thread_mutex_unlock (status_ctx->mux_counter); + hc_thread_mutex_unlock (status_ctx->mux_counter); + } /** * benchmark, part2 @@ -2553,8 +2558,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co //device_param->outerloop_pos = 0; //device_param->outerloop_left = 0; - device_param->speed_pos = speed_pos; - return 0; }