1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-13 19:28:56 +00:00

Add some reserved scratch buffer for innerloop combinator instead of reallocating each time

This commit is contained in:
jsteube 2016-10-05 15:41:56 +02:00
parent c1aba9e314
commit 15d2f9b11e
4 changed files with 14 additions and 6 deletions

View File

@ -1219,6 +1219,8 @@ typedef struct combinator_ctx
{
bool enabled;
char *scratch_buf;
char *dict1;
char *dict2;

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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;