mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-22 08:08:10 +00:00
Fix calculation of mask length for status view in case hex-charset is used
This commit is contained in:
parent
2622993c00
commit
c78b8878d5
@ -22,7 +22,7 @@
|
||||
|
||||
#define INCR_MASKS 1000
|
||||
|
||||
u32 mp_get_length (const char *mask);
|
||||
u32 mp_get_length (const char *mask, const u32 opts_type);
|
||||
|
||||
void sp_exec (u64 ctx, char *pw_buf, cs_t *root_css_buf, cs_t *markov_css_buf, u32 start, u32 stop);
|
||||
|
||||
|
27
src/mpsp.c
27
src/mpsp.c
@ -1061,7 +1061,7 @@ static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask, const char
|
||||
|
||||
if (user_options->increment == true)
|
||||
{
|
||||
const u32 mask_length = mp_get_length (mask);
|
||||
const u32 mask_length = mp_get_length (mask, hashconfig->opts_type);
|
||||
|
||||
u32 increment_min = user_options->increment_min;
|
||||
u32 increment_max = user_options->increment_max;
|
||||
@ -1129,17 +1129,34 @@ static int mask_append (hashcat_ctx_t *hashcat_ctx, const char *mask, const char
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 mp_get_length (const char *mask)
|
||||
u32 mp_get_length (const char *mask, const u32 opts_type)
|
||||
{
|
||||
bool ignore_next = false;
|
||||
|
||||
u32 len = 0;
|
||||
|
||||
const size_t mask_len = strlen (mask);
|
||||
|
||||
for (size_t i = 0; i < mask_len; i++)
|
||||
{
|
||||
if (mask[i] == '?') i++;
|
||||
if (ignore_next == true)
|
||||
{
|
||||
ignore_next = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mask[i] == '?')
|
||||
{
|
||||
ignore_next = true;
|
||||
}
|
||||
|
||||
len++;
|
||||
if (opts_type & OPTS_TYPE_PT_HEX)
|
||||
{
|
||||
ignore_next = true;
|
||||
}
|
||||
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
return len;
|
||||
@ -1260,7 +1277,7 @@ int mask_ctx_update_loop (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
if (user_options->benchmark == true)
|
||||
{
|
||||
pw_min = mp_get_length (mask_ctx->mask);
|
||||
pw_min = mp_get_length (mask_ctx->mask, hashconfig->opts_type);
|
||||
pw_max = pw_min;
|
||||
}
|
||||
|
||||
|
@ -778,13 +778,14 @@ char *status_get_guess_charset (const hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
int status_get_guess_mask_length (const hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||
const mask_ctx_t *mask_ctx = hashcat_ctx->mask_ctx;
|
||||
|
||||
if (mask_ctx == NULL) return -1;
|
||||
|
||||
if (mask_ctx->mask == NULL) return -1;
|
||||
|
||||
return mp_get_length (mask_ctx->mask);
|
||||
return mp_get_length (mask_ctx->mask, hashconfig->opts_type);
|
||||
}
|
||||
|
||||
char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const int backend_devices_idx)
|
||||
|
Loading…
Reference in New Issue
Block a user