1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Improve performance of test_any_8th_bit() by manually unrolling a few first steps

This commit is contained in:
Jens Steube 2021-04-30 17:22:31 +02:00
parent b7dffd9259
commit f8ea1d5e78

View File

@ -1985,11 +1985,19 @@ DECLSPEC int find_hash (const u32 *digest, const u32 digests_cnt, GLOBAL_AS cons
DECLSPEC int test_any_8th_bit (const u32 *buf, const int len) DECLSPEC int test_any_8th_bit (const u32 *buf, const int len)
{ {
for (int i = 0, j = 0; i < len; i += 4, j += 1) // we simply ignore buffer length for the first 24 bytes for some extra speed boost :)
{ // number of unrolls found by simply testing what gave best results
const u32 v = buf[j];
if (v & 0x80808080) return 1; if (buf[0] & 0x80808080) return 1;
if (buf[1] & 0x80808080) return 1;
if (buf[2] & 0x80808080) return 1;
if (buf[3] & 0x80808080) return 1;
if (buf[4] & 0x80808080) return 1;
if (buf[5] & 0x80808080) return 1;
for (int i = 24, j = 6; i < len; i += 4, j += 1)
{
if (buf[j] & 0x80808080) return 1;
} }
return 0; return 0;