Compare commits

...

2 Commits

@ -2992,6 +2992,24 @@ DECLSPEC int hc_execute_keyboard_layout_mapping (PRIVATE_AS u32 *w, const int pw
return out_len;
}
DECLSPEC int count_bits_32 (const u32 v0, const u32 v1)
{
u32 r = v0 ^ v1;
if (r == 0) return 0;
// from https://stackoverflow.com/questions/109023/count-the-number-of-set-bits-in-a-32-bit-integer
r = r - ((r >> 1) & 0x55555555); // add pairs of bits
r = (r & 0x33333333) + ((r >> 2) & 0x33333333); // quads
r = (r + (r >> 4)) & 0x0F0F0F0F; // groups of 8
r *= 0x01010101; // horizontal sum of bytes
// return just that top byte (after truncating to 32-bit even when int is wider than uint32_t)
return r >> 24;
}
/**
* vector functions
*/

@ -315,6 +315,8 @@ DECLSPEC int is_valid_printable_8 (const u8 v);
DECLSPEC int is_valid_printable_32 (const u32 v);
DECLSPEC int hc_find_keyboard_layout_map (const u32 search, const int search_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int hc_execute_keyboard_layout_mapping (PRIVATE_AS u32 *w, const int pw_len, LOCAL_AS keyboard_layout_mapping_t *s_keyboard_layout_mapping_buf, const int keyboard_layout_mapping_cnt);
DECLSPEC int count_bits_32 (const u32 v0, const u32 v1);
DECLSPEC void make_utf16be (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2);
DECLSPEC void make_utf16beN (PRIVATE_AS const u32x *in, PRIVATE_AS u32x *out1, PRIVATE_AS u32x *out2);
DECLSPEC void make_utf16beN_S (PRIVATE_AS const u32 *in, PRIVATE_AS u32 *out1, PRIVATE_AS u32 *out2);

@ -0,0 +1,19 @@
for (int digest_pos = 0; digest_pos < DIGESTS_CNT; digest_pos++)
{
const u32 final_hash_pos = DIGESTS_OFFSET_HOST + digest_pos;
const digest_t *digest = digests_buf + final_hash_pos;
const int invalid_bits = count_bits_32 (digest->digest_buf[0], r0)
+ count_bits_32 (digest->digest_buf[1], r1)
+ count_bits_32 (digest->digest_buf[2], r2)
+ count_bits_32 (digest->digest_buf[3], r3);
if (invalid_bits > invalid_bits_accept) continue;
if (hc_atomic_inc (&hashes_shown[final_hash_pos]) == 0)
{
mark_hash (plains_buf, d_return_buf, SALT_POS_HOST, DIGESTS_CNT, digest_pos, final_hash_pos, gid, il_pos, 0, 0);
}
}
Loading…
Cancel
Save