1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 18:08:20 +00:00

Optimize rule_op_mangle_delete_last()

This commit is contained in:
jsteube 2016-11-01 14:50:54 +01:00
parent a4f7ba2c60
commit 03fde2cdc3
2 changed files with 18 additions and 24 deletions

View File

@ -1241,19 +1241,16 @@ inline u32 rule_op_mangle_delete_last (const u32 p0, const u32 p1, u32 buf0[4],
const u32 in_len1 = in_len - 1; const u32 in_len1 = in_len - 1;
const u32 tmp = (1 << ((in_len1 & 3) * 8)) - 1; const u32 mask = (1 << ((in_len1 & 3) * 8)) - 1;
switch (in_len1 / 4) buf0[0] &= (in_len1 < 4) ? mask : 0xffffffff;
{ buf0[1] &= ((in_len1 >= 4) && (in_len1 < 8)) ? mask : 0xffffffff;
case 0: buf0[0] &= tmp; break; buf0[2] &= ((in_len1 >= 8) && (in_len1 < 12)) ? mask : 0xffffffff;
case 1: buf0[1] &= tmp; break; buf0[3] &= ((in_len1 >= 12) && (in_len1 < 16)) ? mask : 0xffffffff;
case 2: buf0[2] &= tmp; break; buf1[0] &= ((in_len1 >= 16) && (in_len1 < 20)) ? mask : 0xffffffff;
case 3: buf0[3] &= tmp; break; buf1[1] &= ((in_len1 >= 20) && (in_len1 < 24)) ? mask : 0xffffffff;
case 4: buf1[0] &= tmp; break; buf1[2] &= ((in_len1 >= 24) && (in_len1 < 28)) ? mask : 0xffffffff;
case 5: buf1[1] &= tmp; break; buf1[3] &= (in_len1 >= 28) ? mask : 0xffffffff;
case 6: buf1[2] &= tmp; break;
case 7: buf1[3] &= tmp; break;
}
return in_len1; return in_len1;
} }

View File

@ -1296,19 +1296,16 @@ static u32 rule_op_mangle_delete_last (MAYBE_UNUSED const u32 p0, MAYBE_UNUSED c
const u32 in_len1 = in_len - 1; const u32 in_len1 = in_len - 1;
const u32 tmp = (1u << ((in_len1 & 3) * 8)) - 1; const u32 mask = (1 << ((in_len1 & 3) * 8)) - 1;
switch (in_len1 / 4) buf0[0] &= (in_len1 < 4) ? mask : 0xffffffff;
{ buf0[1] &= ((in_len1 >= 4) && (in_len1 < 8)) ? mask : 0xffffffff;
case 0: buf0[0] &= tmp; break; buf0[2] &= ((in_len1 >= 8) && (in_len1 < 12)) ? mask : 0xffffffff;
case 1: buf0[1] &= tmp; break; buf0[3] &= ((in_len1 >= 12) && (in_len1 < 16)) ? mask : 0xffffffff;
case 2: buf0[2] &= tmp; break; buf1[0] &= ((in_len1 >= 16) && (in_len1 < 20)) ? mask : 0xffffffff;
case 3: buf0[3] &= tmp; break; buf1[1] &= ((in_len1 >= 20) && (in_len1 < 24)) ? mask : 0xffffffff;
case 4: buf1[0] &= tmp; break; buf1[2] &= ((in_len1 >= 24) && (in_len1 < 28)) ? mask : 0xffffffff;
case 5: buf1[1] &= tmp; break; buf1[3] &= (in_len1 >= 28) ? mask : 0xffffffff;
case 6: buf1[2] &= tmp; break;
case 7: buf1[3] &= tmp; break;
}
return in_len1; return in_len1;
} }