1
mirror of https://github.com/hashcat/hashcat synced 2024-11-13 17:28:58 +01:00

Do not initialize masks for attack-modes not using masks

This commit is contained in:
jsteube 2016-09-26 15:11:46 +02:00
parent 54a4ea3db2
commit 0ca4ebe1e6
2 changed files with 12 additions and 0 deletions

View File

@ -1116,6 +1116,8 @@ typedef struct
typedef struct
{
bool enabled;
cs_t mp_sys[6];
cs_t mp_usr[4];

View File

@ -856,6 +856,14 @@ int mask_ctx_init (mask_ctx_t *mask_ctx, const user_options_t *user_options, con
{
memset (mask_ctx, 0, sizeof (mask_ctx_t));
mask_ctx->enabled = false;
if ((user_options->attack_mode != ATTACK_MODE_BF)
&& (user_options->attack_mode != ATTACK_MODE_HYBRID1)
&& (user_options->attack_mode != ATTACK_MODE_HYBRID2)) return 0;
mask_ctx->enabled = true;
mask_ctx->root_table_buf = (hcstat_table_t *) mycalloc (SP_ROOT_CNT, sizeof (hcstat_table_t));
mask_ctx->markov_table_buf = (hcstat_table_t *) mycalloc (SP_MARKOV_CNT, sizeof (hcstat_table_t));
@ -1085,6 +1093,8 @@ int mask_ctx_init (mask_ctx_t *mask_ctx, const user_options_t *user_options, con
void mask_ctx_destroy (mask_ctx_t *mask_ctx)
{
if (mask_ctx->enabled == false) return;
myfree (mask_ctx->css_buf);
myfree (mask_ctx->root_css_buf);