From 15d2f9b11e315a3ab2b28973764559a20e7012e4 Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 5 Oct 2016 15:41:56 +0200 Subject: [PATCH] Add some reserved scratch buffer for innerloop combinator instead of reallocating each time --- include/types.h | 2 ++ src/combinator.c | 4 ++++ src/opencl.c | 6 ++---- src/status.c | 8 ++++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/types.h b/include/types.h index 9c2df6943..cf6edf9ae 100644 --- a/include/types.h +++ b/include/types.h @@ -1219,6 +1219,8 @@ typedef struct combinator_ctx { bool enabled; + char *scratch_buf; + char *dict1; char *dict2; diff --git a/src/combinator.c b/src/combinator.c index d08016735..14c168bf0 100644 --- a/src/combinator.c +++ b/src/combinator.c @@ -26,6 +26,8 @@ int combinator_ctx_init (combinator_ctx_t *combinator_ctx, user_options_t *user_ combinator_ctx->enabled = true; + combinator_ctx->scratch_buf = (char *) mymalloc (HCBUFSIZ_LARGE); + if (user_options->attack_mode == ATTACK_MODE_STRAIGHT) { // nothing to do @@ -175,5 +177,7 @@ void combinator_ctx_destroy (combinator_ctx_t *combinator_ctx) { if (combinator_ctx->enabled == false) return; + myfree (combinator_ctx->scratch_buf); + memset (combinator_ctx, 0, sizeof (combinator_ctx_t)); } diff --git a/src/opencl.c b/src/opencl.c index dbaca0779..8a3fa45c9 100644 --- a/src/opencl.c +++ b/src/opencl.c @@ -998,8 +998,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co user_options_t *user_options = hashcat_ctx->user_options; user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra; - char *line_buf = (char *) mymalloc (HCBUFSIZ_LARGE); - // init speed timer u32 speed_pos = device_param->speed_pos; @@ -1111,6 +1109,8 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co if (user_options->attack_mode == ATTACK_MODE_COMBI) { + char *line_buf = combinator_ctx->scratch_buf; + u32 i = 0; while (i < innerloop_left) @@ -1348,8 +1348,6 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co device_param->speed_pos = speed_pos; - myfree (line_buf); - return 0; } diff --git a/src/status.c b/src/status.c index 6c247974e..786c7a1a2 100644 --- a/src/status.c +++ b/src/status.c @@ -875,8 +875,12 @@ void status_display (hashcat_ctx_t *hashcat_ctx) if (device_param->skipped) continue; - if (device_param->outerloop_left == 0) continue; // not ready - if (device_param->innerloop_left == 0) continue; + if ((device_param->outerloop_left == 0) || (device_param->innerloop_left == 0)) + { + log_info ("Candidates.#%d..: [Copying/Generating]", device_id + 1); + + continue; + } const u32 outerloop_first = 0; const u32 outerloop_last = device_param->outerloop_left - 1;