1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-24 06:31:07 +00:00

Add mp_css_unicode_expand()

This commit is contained in:
jsteube 2016-10-04 08:21:03 +02:00
parent d8b25627cc
commit 7544adce8f
3 changed files with 23 additions and 17 deletions

View File

@ -20,9 +20,10 @@
#define INCR_MASKS 1000
void mp_css_unicode_expand (mask_ctx_t *mask_ctx);
void mp_css_to_uniq_tbl (u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ]);
void mp_cut_at (char *mask, u32 max);
u32 mp_get_length (char *mask);
u32 mp_get_length (char *mask);
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt);
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, u32 *css_cnt, const hashconfig_t *hashconfig, const user_options_t *user_options);
u64 mp_get_sum (u32 css_cnt, cs_t *css);

View File

@ -657,22 +657,7 @@ static int inner1_loop (hashcat_ctx_t *hashcat_ctx)
if (hashconfig->opts_type & OPTS_TYPE_PT_UNICODE)
{
u32 css_cnt_unicode = mask_ctx->css_cnt * 2;
cs_t *css_buf_unicode = (cs_t *) mycalloc (css_cnt_unicode, sizeof (cs_t));
for (u32 i = 0, j = 0; i < mask_ctx->css_cnt; i += 1, j += 2)
{
memcpy (&css_buf_unicode[j + 0], &mask_ctx->css_buf[i], sizeof (cs_t));
css_buf_unicode[j + 1].cs_buf[0] = 0;
css_buf_unicode[j + 1].cs_len = 1;
}
myfree (mask_ctx->css_buf);
mask_ctx->css_buf = css_buf_unicode;
mask_ctx->css_cnt = css_cnt_unicode;
mp_css_unicode_expand (mask_ctx);
}
// check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)

View File

@ -20,6 +20,26 @@ static const char DEF_MASK[] = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d";
#define MAX_MFS 5 // 4*charset, 1*mask
void mp_css_unicode_expand (mask_ctx_t *mask_ctx)
{
u32 css_cnt_unicode = mask_ctx->css_cnt * 2;
cs_t *css_buf_unicode = (cs_t *) mycalloc (css_cnt_unicode, sizeof (cs_t));
for (u32 i = 0, j = 0; i < mask_ctx->css_cnt; i += 1, j += 2)
{
memcpy (&css_buf_unicode[j + 0], &mask_ctx->css_buf[i], sizeof (cs_t));
css_buf_unicode[j + 1].cs_buf[0] = 0;
css_buf_unicode[j + 1].cs_len = 1;
}
myfree (mask_ctx->css_buf);
mask_ctx->css_buf = css_buf_unicode;
mask_ctx->css_cnt = css_cnt_unicode;
}
void mp_css_to_uniq_tbl (u32 css_cnt, cs_t *css, u32 uniq_tbls[SP_PW_MAX][CHARSIZ])
{
/* generates a lookup table where key is the char itself for fastest possible lookup performance */