1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Fixed output password of 'e' rule in pure and cpu rule engine if separator character is also the first letter

This commit is contained in:
jsteube 2019-03-28 13:07:39 +01:00
parent 5a1d929628
commit ffd8ec9001
2 changed files with 13 additions and 7 deletions

View File

@ -680,24 +680,28 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
{
if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1
mangle_lrest_ufirst (0, 0, buf, len);
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
const u32 v = buf[idx];
const u32 t = buf[idx];
buf[idx] = t | generate_cmask (t);
u32 out0 = 0;
u32 out1 = 0;
if (((v >> 0) & 0xff) == p0) out0 |= 0x0000ff00;
if (((v >> 8) & 0xff) == p0) out0 |= 0x00ff0000;
if (((v >> 16) & 0xff) == p0) out0 |= 0xff000000;
if (((v >> 24) & 0xff) == p0) out1 |= 0x000000ff;
if (((t >> 0) & 0xff) == p0) out0 |= 0x0000ff00;
if (((t >> 8) & 0xff) == p0) out0 |= 0x00ff0000;
if (((t >> 16) & 0xff) == p0) out0 |= 0xff000000;
if (((t >> 24) & 0xff) == p0) out1 |= 0x000000ff;
buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0);
buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1);
}
const u32 t = buf[0];
buf[0] = t & ~(0x00000020 & generate_cmask (t));
return (len);
}

View File

@ -470,6 +470,8 @@ static int mangle_title_sep (char arr[RP_PASSWORD_SIZE], int arr_len, char c)
}
}
MANGLE_UPPER_AT (arr, 0);
return (arr_len);
}