1
mirror of https://github.com/hashcat/hashcat synced 2024-12-27 05:13:45 +01:00

Optimize rule_op_mangle_dupechar_last()

This commit is contained in:
jsteube 2016-11-01 14:54:45 +01:00
parent 03fde2cdc3
commit bd12a1eb0d
2 changed files with 20 additions and 22 deletions

View File

@ -1799,17 +1799,16 @@ inline u32 rule_op_mangle_dupechar_last (const u32 p0, const u32 p1, u32 buf0[4]
u32 tmp = 0;
switch (in_len1 / 4)
{
case 0: tmp = (buf0[0] >> sh) & 0xff; break;
case 1: tmp = (buf0[1] >> sh) & 0xff; break;
case 2: tmp = (buf0[2] >> sh) & 0xff; break;
case 3: tmp = (buf0[3] >> sh) & 0xff; break;
case 4: tmp = (buf1[0] >> sh) & 0xff; break;
case 5: tmp = (buf1[1] >> sh) & 0xff; break;
case 6: tmp = (buf1[2] >> sh) & 0xff; break;
case 7: tmp = (buf1[3] >> sh) & 0xff; break;
}
tmp |= (in_len1 < 4) ? buf0[0] : 0;
tmp |= ((in_len1 >= 4) && (in_len1 < 8)) ? buf0[1] : 0;
tmp |= ((in_len1 >= 8) && (in_len1 < 12)) ? buf0[2] : 0;
tmp |= ((in_len1 >= 12) && (in_len1 < 16)) ? buf0[3] : 0;
tmp |= ((in_len1 >= 16) && (in_len1 < 20)) ? buf1[0] : 0;
tmp |= ((in_len1 >= 20) && (in_len1 < 24)) ? buf1[1] : 0;
tmp |= ((in_len1 >= 24) && (in_len1 < 28)) ? buf1[2] : 0;
tmp |= (in_len1 >= 28) ? buf1[3] : 0;
tmp = (tmp >> sh) & 0xff;
u32 out_len = in_len;

View File

@ -1881,17 +1881,16 @@ static u32 rule_op_mangle_dupechar_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED
u32 tmp = 0;
switch (in_len1 / 4)
{
case 0: tmp = (buf0[0] >> sh) & 0xff; break;
case 1: tmp = (buf0[1] >> sh) & 0xff; break;
case 2: tmp = (buf0[2] >> sh) & 0xff; break;
case 3: tmp = (buf0[3] >> sh) & 0xff; break;
case 4: tmp = (buf1[0] >> sh) & 0xff; break;
case 5: tmp = (buf1[1] >> sh) & 0xff; break;
case 6: tmp = (buf1[2] >> sh) & 0xff; break;
case 7: tmp = (buf1[3] >> sh) & 0xff; break;
}
tmp |= (in_len1 < 4) ? buf0[0] : 0;
tmp |= ((in_len1 >= 4) && (in_len1 < 8)) ? buf0[1] : 0;
tmp |= ((in_len1 >= 8) && (in_len1 < 12)) ? buf0[2] : 0;
tmp |= ((in_len1 >= 12) && (in_len1 < 16)) ? buf0[3] : 0;
tmp |= ((in_len1 >= 16) && (in_len1 < 20)) ? buf1[0] : 0;
tmp |= ((in_len1 >= 20) && (in_len1 < 24)) ? buf1[1] : 0;
tmp |= ((in_len1 >= 24) && (in_len1 < 28)) ? buf1[2] : 0;
tmp |= (in_len1 >= 28) ? buf1[3] : 0;
tmp = (tmp >> sh) & 0xff;
u32 out_len = in_len;