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:
parent
d8b25627cc
commit
7544adce8f
@ -20,6 +20,7 @@
|
||||
|
||||
#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);
|
||||
|
@ -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)
|
||||
|
20
src/mpsp.c
20
src/mpsp.c
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user