hashcat/hashcat-e-rule-fixes.patch
2021-06-13 17:27:27 +02:00

45 lines
1.5 KiB
Diff

diff --git a/OpenCL/inc_rp.cl b/OpenCL/inc_rp.cl
index 9a50e18020..8cecc661da 100644
--- a/OpenCL/inc_rp.cl
+++ b/OpenCL/inc_rp.cl
@@ -688,7 +688,9 @@ DECLSPEC int mangle_dupeblock_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u32 *buf, const int len)
{
- if ((len + 4) >= RP_PASSWORD_SIZE) return (len); // cheap way to not need to check for overflow of i + 1
+ if (len >= RP_PASSWORD_SIZE) return (len);
+
+ u32 rem = 0xff;
for (int i = 0, idx = 0; i < len; i += 4, idx += 1)
{
@@ -696,21 +698,17 @@ DECLSPEC int mangle_title_sep (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
buf[idx] = t | generate_cmask (t);
- u32 out0 = 0;
- u32 out1 = 0;
-
- 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;
+ u32 out = rem;
- buf[idx + 0] &= ~(generate_cmask (buf[idx + 0]) & out0);
- buf[idx + 1] &= ~(generate_cmask (buf[idx + 1]) & out1);
- }
+ rem = 0;
- const u32 t = buf[0];
+ if (((t >> 0) & 0xff) == p0) out |= 0x0000ff00;
+ if (((t >> 8) & 0xff) == p0) out |= 0x00ff0000;
+ if (((t >> 16) & 0xff) == p0) out |= 0xff000000;
+ if (((t >> 24) & 0xff) == p0) rem |= 0x000000ff;
- buf[0] = t & ~(0x00000020 & generate_cmask (t));
+ buf[idx] &= ~(generate_cmask (buf[idx]) & out);
+ }
return (len);
}