diff --git a/OpenCL/m34200_a0-optimized.cl b/OpenCL/m34200_a0-optimized.cl new file mode 100755 index 000000000..c927cb950 --- /dev/null +++ b/OpenCL/m34200_a0-optimized.cl @@ -0,0 +1,214 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp_optimized.h) +#include M2S(INCLUDE_PATH/inc_rp_optimized.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34200_m04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[16] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u64x hash = MurmurHash64A (seed, w, out_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_m08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_m16 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_s04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[16] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u64x hash = MurmurHash64A (seed, w, out_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_s08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_s16 (KERN_ATTR_RULES ()) +{ +} diff --git a/OpenCL/m34200_a0-pure.cl b/OpenCL/m34200_a0-pure.cl new file mode 100755 index 000000000..67976dfad --- /dev/null +++ b/OpenCL/m34200_a0-pure.cl @@ -0,0 +1,178 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp.h) +#include M2S(INCLUDE_PATH/inc_rp.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34200_mxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + COPY_PW (pws[gid]); + + /** + * salt + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u64x hash = MurmurHash64A (seed, tmp.i, tmp.pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SCALAR (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_sxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * salt + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + COPY_PW (pws[gid]); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u64x hash = MurmurHash64A (seed, tmp.i, tmp.pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SCALAR (r0, r1, z, z); + } +} diff --git a/OpenCL/m34200_a1-optimized.cl b/OpenCL/m34200_a1-optimized.cl new file mode 100755 index 000000000..57d9a776c --- /dev/null +++ b/OpenCL/m34200_a1-optimized.cl @@ -0,0 +1,330 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34200_m04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u64x hash = MurmurHash64A (seed, w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_m08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_m16 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_s04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u64 hash = MurmurHash64A (seed, w, pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_s08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34200_s16 (KERN_ATTR_BASIC ()) +{ +} diff --git a/OpenCL/m34200_a1-pure.cl b/OpenCL/m34200_a1-pure.cl new file mode 100755 index 000000000..5dff43865 --- /dev/null +++ b/OpenCL/m34200_a1-pure.cl @@ -0,0 +1,194 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34200_mxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * salt + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u64x hash = MurmurHash64A (seed, comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SCALAR (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_sxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * salt + */ + + // Reconstruct seed from two u32s + const u32 seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32 seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64 seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u64 hash = MurmurHash64A (seed, comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SCALAR (r0, r1, z, z); + } +} diff --git a/OpenCL/m34200_a3-optimized.cl b/OpenCL/m34200_a3-optimized.cl new file mode 100755 index 000000000..82937b2a3 --- /dev/null +++ b/OpenCL/m34200_a3-optimized.cl @@ -0,0 +1,442 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +DECLSPEC void m34200m (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32x seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32x seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64x seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (seed, w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +DECLSPEC void m34200s (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32x seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32x seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64x seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (seed, w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_m04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34200_m08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34200_m16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34200_s04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34200_s08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34200_s16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34200s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} diff --git a/OpenCL/m34200_a3-pure.cl b/OpenCL/m34200_a3-pure.cl new file mode 100755 index 000000000..5b5491a8e --- /dev/null +++ b/OpenCL/m34200_a3-pure.cl @@ -0,0 +1,192 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (const u64 seed, PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = seed ^ (len * M); + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34200_mxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32x seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32x seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64x seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (seed, w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34200_sxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * seed + */ + + // Reconstruct seed from two u32s + const u32x seed_lo = salt_bufs[SALT_POS_HOST].salt_buf[0]; + const u32x seed_hi = salt_bufs[SALT_POS_HOST].salt_buf[1]; + const u64x seed = hl32_to_64 (seed_hi, seed_lo); + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (seed, w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} diff --git a/OpenCL/m34201_a0-optimized.cl b/OpenCL/m34201_a0-optimized.cl new file mode 100755 index 000000000..0057ae586 --- /dev/null +++ b/OpenCL/m34201_a0-optimized.cl @@ -0,0 +1,196 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp_optimized.h) +#include M2S(INCLUDE_PATH/inc_rp_optimized.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34201_m04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[8] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u64x hash = MurmurHash64A (w, out_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_m08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_m16 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_s04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[16] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u64x hash = MurmurHash64A (w, out_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_s08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_s16 (KERN_ATTR_RULES ()) +{ +} diff --git a/OpenCL/m34201_a0-pure.cl b/OpenCL/m34201_a0-pure.cl new file mode 100755 index 000000000..4ebec52d5 --- /dev/null +++ b/OpenCL/m34201_a0-pure.cl @@ -0,0 +1,160 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp.h) +#include M2S(INCLUDE_PATH/inc_rp.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34201_mxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + COPY_PW (pws[gid]); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u64 hash = MurmurHash64A (tmp.i, tmp.pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_M_SCALAR (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_sxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + COPY_PW (pws[gid]); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u64 hash = MurmurHash64A (tmp.i, tmp.pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SCALAR (r0, r1, z, z); + } +} diff --git a/OpenCL/m34201_a1-optimized.cl b/OpenCL/m34201_a1-optimized.cl new file mode 100755 index 000000000..556204201 --- /dev/null +++ b/OpenCL/m34201_a1-optimized.cl @@ -0,0 +1,312 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ + #define M 0xc6a4a7935bd1e995 + #define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + + #undef M + #undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34201_m04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u64x hash = MurmurHash64A (w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_m08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_m16 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_s04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u64 hash = MurmurHash64A (w, pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_s08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34201_s16 (KERN_ATTR_BASIC ()) +{ +} diff --git a/OpenCL/m34201_a1-pure.cl b/OpenCL/m34201_a1-pure.cl new file mode 100755 index 000000000..53260346e --- /dev/null +++ b/OpenCL/m34201_a1-pure.cl @@ -0,0 +1,176 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34201_mxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u64x hash = MurmurHash64A (comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SCALAR (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_sxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u64 hash = MurmurHash64A (comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32 r0 = l32_from_64 (hash); + const u32 r1 = h32_from_64 (hash); + const u32 z = 0; + + COMPARE_S_SCALAR (r0, r1, z, z); + } +} diff --git a/OpenCL/m34201_a3-optimized.cl b/OpenCL/m34201_a3-optimized.cl new file mode 100755 index 000000000..62cf032a5 --- /dev/null +++ b/OpenCL/m34201_a3-optimized.cl @@ -0,0 +1,424 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +DECLSPEC void m34201m (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +DECLSPEC void m34201s (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_m04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34201_m08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34201_m16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34201_s04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34201_s08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34201_s16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34201s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} diff --git a/OpenCL/m34201_a3-pure.cl b/OpenCL/m34201_a3-pure.cl new file mode 100755 index 000000000..fc6544a49 --- /dev/null +++ b/OpenCL/m34201_a3-pure.cl @@ -0,0 +1,174 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u64 MurmurHash64A (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + return hash; +} + +KERNEL_FQ KERNEL_FA void m34201_mxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_M_SIMD (r0, r1, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34201_sxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u64x hash = MurmurHash64A (w, pw_len); + + const u32x r0 = l32_from_64 (hash); + const u32x r1 = h32_from_64 (hash); + const u32x z = 0; + + COMPARE_S_SIMD (r0, r1, z, z); + } +} diff --git a/OpenCL/m34211_a0-optimized.cl b/OpenCL/m34211_a0-optimized.cl new file mode 100755 index 000000000..c2b2efc72 --- /dev/null +++ b/OpenCL/m34211_a0-optimized.cl @@ -0,0 +1,193 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp_optimized.h) +#include M2S(INCLUDE_PATH/inc_rp_optimized.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +KERNEL_FQ KERNEL_FA void m34211_m04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[16] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u32x hash = MurmurHash64A_truncated (w, out_len); + + const u32x z = 0; + + COMPARE_M_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_m08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_m16 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_s04 (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + 0, + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + u32x w[16] = { 0 }; + + const u32x out_len = apply_rules_vect_optimized (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w + 0, w + 4); + + u32x hash = MurmurHash64A_truncated (w, out_len); + + const u32x z = 0; + + COMPARE_S_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_s08 (KERN_ATTR_RULES ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_s16 (KERN_ATTR_RULES ()) +{ +} diff --git a/OpenCL/m34211_a0-pure.cl b/OpenCL/m34211_a0-pure.cl new file mode 100755 index 000000000..f36d8e393 --- /dev/null +++ b/OpenCL/m34211_a0-pure.cl @@ -0,0 +1,157 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_rp.h) +#include M2S(INCLUDE_PATH/inc_rp.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +KERNEL_FQ KERNEL_FA void m34211_mxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + COPY_PW (pws[gid]); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u32 hash = MurmurHash64A_truncated (tmp.i, tmp.pw_len); + + const u32 z = 0; + + COMPARE_M_SCALAR (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_sxx (KERN_ATTR_RULES ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + + /** + * base + */ + + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + COPY_PW (pws[gid]); + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + pw_t tmp = PASTE_PW; + + tmp.pw_len = apply_rules (rules_buf[il_pos].cmds, tmp.i, tmp.pw_len); + + u32 hash = MurmurHash64A_truncated (tmp.i, tmp.pw_len); + + const u32 z = 0; + + COMPARE_S_SCALAR (hash, z, z, z); + } +} diff --git a/OpenCL/m34211_a1-optimized.cl b/OpenCL/m34211_a1-optimized.cl new file mode 100755 index 000000000..9f4593cf4 --- /dev/null +++ b/OpenCL/m34211_a1-optimized.cl @@ -0,0 +1,309 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +KERNEL_FQ KERNEL_FA void m34211_m04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u32x hash = MurmurHash64A_truncated (w, pw_len); + + const u32x z = 0; + + COMPARE_M_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_m08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_m16 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_s04 (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + u32 pw_buf0[4]; + u32 pw_buf1[4]; + + pw_buf0[0] = pws[gid].i[0]; + pw_buf0[1] = pws[gid].i[1]; + pw_buf0[2] = pws[gid].i[2]; + pw_buf0[3] = pws[gid].i[3]; + pw_buf1[0] = pws[gid].i[4]; + pw_buf1[1] = pws[gid].i[5]; + pw_buf1[2] = pws[gid].i[6]; + pw_buf1[3] = pws[gid].i[7]; + + const u32 pw_l_len = pws[gid].pw_len; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + 0, + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32 pw_r_len = pwlenx_create_combt (combs_buf, il_pos); + + const u32 pw_len = pw_l_len + pw_r_len; + + /** + * concat password candidate + */ + + u32 wordl0[4] = { 0 }; + u32 wordl1[4] = { 0 }; + u32 wordl2[4] = { 0 }; + u32 wordl3[4] = { 0 }; + + wordl0[0] = pw_buf0[0]; + wordl0[1] = pw_buf0[1]; + wordl0[2] = pw_buf0[2]; + wordl0[3] = pw_buf0[3]; + wordl1[0] = pw_buf1[0]; + wordl1[1] = pw_buf1[1]; + wordl1[2] = pw_buf1[2]; + wordl1[3] = pw_buf1[3]; + + u32 wordr0[4] = { 0 }; + u32 wordr1[4] = { 0 }; + u32 wordr2[4] = { 0 }; + u32 wordr3[4] = { 0 }; + + wordr0[0] = ix_create_combt (combs_buf, il_pos, 0); + wordr0[1] = ix_create_combt (combs_buf, il_pos, 1); + wordr0[2] = ix_create_combt (combs_buf, il_pos, 2); + wordr0[3] = ix_create_combt (combs_buf, il_pos, 3); + wordr1[0] = ix_create_combt (combs_buf, il_pos, 4); + wordr1[1] = ix_create_combt (combs_buf, il_pos, 5); + wordr1[2] = ix_create_combt (combs_buf, il_pos, 6); + wordr1[3] = ix_create_combt (combs_buf, il_pos, 7); + + if (COMBS_MODE == COMBINATOR_MODE_BASE_LEFT) + { + switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len); + } + else + { + switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len); + } + + u32 w[16]; + + w[ 0] = wordl0[0] | wordr0[0]; + w[ 1] = wordl0[1] | wordr0[1]; + w[ 2] = wordl0[2] | wordr0[2]; + w[ 3] = wordl0[3] | wordr0[3]; + w[ 4] = wordl1[0] | wordr1[0]; + w[ 5] = wordl1[1] | wordr1[1]; + w[ 6] = wordl1[2] | wordr1[2]; + w[ 7] = wordl1[3] | wordr1[3]; + w[ 8] = wordl2[0] | wordr2[0]; + w[ 9] = wordl2[1] | wordr2[1]; + w[10] = wordl2[2] | wordr2[2]; + w[11] = wordl2[3] | wordr2[3]; + w[12] = wordl3[0] | wordr3[0]; + w[13] = wordl3[1] | wordr3[1]; + w[14] = wordl3[2] | wordr3[2]; + w[15] = wordl3[3] | wordr3[3]; + + u32 hash = MurmurHash64A_truncated (w, pw_len); + + const u32 z = 0; + + COMPARE_S_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_s08 (KERN_ATTR_BASIC ()) +{ +} + +KERNEL_FQ KERNEL_FA void m34211_s16 (KERN_ATTR_BASIC ()) +{ +} diff --git a/OpenCL/m34211_a1-pure.cl b/OpenCL/m34211_a1-pure.cl new file mode 100755 index 000000000..bd53d64ee --- /dev/null +++ b/OpenCL/m34211_a1-pure.cl @@ -0,0 +1,173 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_scalar.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +KERNEL_FQ KERNEL_FA void m34211_mxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u32 hash = MurmurHash64A_truncated (comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32 z = 0; + + COMPARE_M_SCALAR (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_sxx (KERN_ATTR_BASIC ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + PRIVATE_AS u8 combined_buf[256] = {0}; + const u32 *comb_ptr = (u32*) combined_buf; + + // copy left buffer + GLOBAL_AS const u8 *left = (GLOBAL_AS const u8*) pws[gid].i; + // probably bad for performance + for (u32 i = 0; i < pws[gid].pw_len; i++) + { + combined_buf[i] = left[i]; + } + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * loop + */ + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos++) + { + // copy right buffer + GLOBAL_AS const u8 *right = (GLOBAL_AS const u8*) combs_buf[il_pos].i; + for (u32 i = 0; i < combs_buf[il_pos].pw_len; i++) + { + combined_buf[i + pws[gid].pw_len] = right[i]; + } + + u32 hash = MurmurHash64A_truncated (comb_ptr, pws[gid].pw_len + combs_buf[il_pos].pw_len); + + const u32 z = 0; + + COMPARE_S_SCALAR (hash, z, z, z); + } +} diff --git a/OpenCL/m34211_a3-optimized.cl b/OpenCL/m34211_a3-optimized.cl new file mode 100755 index 000000000..da3e14af1 --- /dev/null +++ b/OpenCL/m34211_a3-optimized.cl @@ -0,0 +1,421 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +//#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +DECLSPEC void m34211m (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u32x hash = MurmurHash64A_truncated (w, pw_len); + + const u32x z = 0; + + COMPARE_M_SIMD (hash, z, z, z); + } +} + +DECLSPEC void m34211s (PRIVATE_AS const u32 *data, const u32 pw_len, KERN_ATTR_FUNC_VECTOR ()) +{ + /** + * modifiers are taken from args + */ + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + 0, + 0, + 0 + }; + + /** + * base + */ + + u32x w[16]; + + w[ 0] = data[ 0]; + w[ 1] = data[ 1]; + w[ 2] = data[ 2]; + w[ 3] = data[ 3]; + w[ 4] = data[ 4]; + w[ 5] = data[ 5]; + w[ 6] = data[ 6]; + w[ 7] = data[ 7]; + w[ 8] = data[ 8]; + w[ 9] = data[ 9]; + w[10] = data[10]; + w[11] = data[11]; + w[12] = data[12]; + w[13] = data[13]; + w[14] = data[14]; + w[15] = data[15]; + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u32x hash = MurmurHash64A_truncated (w, pw_len); + + const u32x z = 0; + + COMPARE_S_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_m04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34211_m08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34211_m16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211m (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34211_s04 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = 0; + w[ 5] = 0; + w[ 6] = 0; + w[ 7] = 0; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34211_s08 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = 0; + w[ 9] = 0; + w[10] = 0; + w[11] = 0; + w[12] = 0; + w[13] = 0; + w[14] = 0; + w[15] = 0; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} + +KERNEL_FQ KERNEL_FA void m34211_s16 (KERN_ATTR_VECTOR ()) +{ + /** + * base + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + const u64 lsz = get_local_size (0); + + if (gid >= GID_CNT) return; + + u32 w[16]; + + w[ 0] = pws[gid].i[ 0]; + w[ 1] = pws[gid].i[ 1]; + w[ 2] = pws[gid].i[ 2]; + w[ 3] = pws[gid].i[ 3]; + w[ 4] = pws[gid].i[ 4]; + w[ 5] = pws[gid].i[ 5]; + w[ 6] = pws[gid].i[ 6]; + w[ 7] = pws[gid].i[ 7]; + w[ 8] = pws[gid].i[ 8]; + w[ 9] = pws[gid].i[ 9]; + w[10] = pws[gid].i[10]; + w[11] = pws[gid].i[11]; + w[12] = pws[gid].i[12]; + w[13] = pws[gid].i[13]; + w[14] = pws[gid].i[14]; + w[15] = pws[gid].i[15]; + + const u32 pw_len = pws[gid].pw_len; + + /** + * main + */ + + m34211s (w, pw_len, pws, rules_buf, combs_buf, words_buf_r, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_extra0_buf, d_extra1_buf, d_extra2_buf, d_extra3_buf, kernel_param, gid, lid, lsz); +} diff --git a/OpenCL/m34211_a3-pure.cl b/OpenCL/m34211_a3-pure.cl new file mode 100755 index 000000000..bb846f189 --- /dev/null +++ b/OpenCL/m34211_a3-pure.cl @@ -0,0 +1,171 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#define NEW_SIMD_CODE + +#ifdef KERNEL_STATIC +#include M2S(INCLUDE_PATH/inc_vendor.h) +#include M2S(INCLUDE_PATH/inc_types.h) +#include M2S(INCLUDE_PATH/inc_platform.cl) +#include M2S(INCLUDE_PATH/inc_common.cl) +#include M2S(INCLUDE_PATH/inc_simd.cl) +#endif + +DECLSPEC u32 MurmurHash64A_truncated (PRIVATE_AS const u32 *data, const u32 len) +{ +#define M 0xc6a4a7935bd1e995 +#define R 47 + + // Initialize hash + u64 hash = len * M; + + // Twice the number of u64 blocks + const u32 num_u32_blocks = (len / 8) * 2; + + // Loop over one u64 at a time + u32 i = 0; + while (i < num_u32_blocks) + { + // Reconstruct u64 from two u32s + u64 k = hl32_to_64 (data[i + 1], data[i]); + + k *= M; + k ^= k >> R; + k *= M; + + hash ^= k; + hash *= M; + + i += 2; + } + + // Up to 7 overflow bytes + const u32 overflow = len & 7; + + if (overflow > 4) + { + hash ^= hl32_to_64 (data[i + 1], data[i]); + hash *= M; + } + else if (overflow > 0) + { + hash ^= hl32_to_64 (0, data[i]); + hash *= M; + } + + hash ^= hash >> R; + hash *= M; + hash ^= hash >> R; + +#undef M +#undef R + + // Truncate to high 4 bytes + return (u32) (hash >> 32); +} + +KERNEL_FQ KERNEL_FA void m34211_mxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u32x hash = MurmurHash64A_truncated (w, pw_len); + + const u32x z = 0; + + COMPARE_M_SIMD (hash, z, z, z); + } +} + +KERNEL_FQ KERNEL_FA void m34211_sxx (KERN_ATTR_VECTOR ()) +{ + /** + * modifier + */ + + const u64 lid = get_local_id (0); + const u64 gid = get_global_id (0); + + if (gid >= GID_CNT) return; + + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R0], + digests_buf[DIGESTS_OFFSET_HOST].digest_buf[DGST_R1], + 0, + 0 + }; + + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + u32x w[64] = { 0 }; + + for (u32 i = 0, idx = 0; i < pw_len; i += 4, idx += 1) + { + w[idx] = pws[gid].i[idx]; + } + + /** + * loop + */ + + u32x w0l = w[0]; + + for (u32 il_pos = 0; il_pos < IL_CNT; il_pos += VECT_SIZE) + { + const u32x w0r = words_buf_r[il_pos / VECT_SIZE]; + + const u32x w0 = w0l | w0r; + + w[0] = w0; + + const u32x hash = MurmurHash64A_truncated (w, pw_len); + + const u32x z = 0; + + COMPARE_S_SIMD (hash, z, z, z); + } +} diff --git a/docs/changes.txt b/docs/changes.txt index 1de369fdf..8d117504c 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -186,6 +186,7 @@ - Backend: Updated OpenCL/CUDA/HIP/Metal API's - Backend: Updated filename chksum format to prevent invalid cache on Apple Silicon when switching arch - Backend: Updated references of hcmalloc_aligned and hcfree_aligned to the new memory defined functions +- Benchmark: Updated benchmark_deep.pl with OS detection, Apple cache cleaning way and other minor changes - Brain: Added sanity check and corresponding error message for invalid --brain-port values - Bridge: Updated references of hcmalloc_aligned and hcfree_aligned to the new memory defined functions - Building: Support building windows binaries on macOS using MinGW diff --git a/docs/hashcat-example_hashes.md b/docs/hashcat-example_hashes.md index 913745815..bca271eff 100644 --- a/docs/hashcat-example_hashes.md +++ b/docs/hashcat-example_hashes.md @@ -556,6 +556,9 @@ All manual changes will be overwritten! | `33800` | `WBB4 (Woltlab Burning Board) Plugin [bcrypt(bcrypt($pass))]` | `$2a$08$hashcatohohohohohohohegk6PN.SFkoXxDIkacAGKFN9AF8nx.Hi` | | `33900` | `Citrix NetScaler (PBKDF2-HMAC-SHA256)` | `5567243c55099b6b10a714a350db53beea8be6ac9c247fd40fea7e96d206a9f11fd1c45735556ac2004138640de206d0e1522607ab3c3f92816156d2d7845068e` | | `34000` | `Argon2` | `$argon2id$v=19$m=65536,t=3,p=1$FBMjI4RJBhIykCgol1KEJA$2ky5GAdhT1kH4kIgPN/oERE3Taiy43vNN70a3HpiKQU` | +| `34200` | `MurmurHash64A` | `ef3014941bf1102d:837163b2348dfae1` | +| `34201` | `MurmurHash64A (zero seed)` | `73f8142b4326d36a` | +| `34211` | `MurmurHash64A truncated (zero seed)` | `73f8142b` | | `70000` | `argon2id [Bridged: reference implementation + tunings]` | `$argon2id$v=19$m=65536,t=3,p=1$FBMjI4RJBhIykCgol1KEJA$2ky5GAdhT1kH4kIgPN/oERE3Taiy43vNN70a3HpiKQU` | | `70100` | `scrypt [Bridged: Scrypt-Jane ROMix]` | `SCRYPT:16384:8:1:OTEyNzU0ODg=:Cc8SPjRH1hFQhuIPCdF51uNGtJ2aOY/isuoMlMUsJ8c=` | | `70200` | `scrypt [Bridged: Scrypt-Yescrypt]` | `SCRYPT:16384:8:1:OTEyNzU0ODg=:Cc8SPjRH1hFQhuIPCdF51uNGtJ2aOY/isuoMlMUsJ8c=` | diff --git a/src/modules/module_34200.c b/src/modules/module_34200.c new file mode 100755 index 000000000..6908d6d1d --- /dev/null +++ b/src/modules/module_34200.c @@ -0,0 +1,230 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_CHECKSUM; +static const char *HASH_NAME = "MurmurHash64A"; +static const u64 KERN_TYPE = 34200; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_NOT_ITERATED; +static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE + | OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_SUGGEST_KG + | OPTS_TYPE_ST_HEX; +static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "ef3014941bf1102d:837163b2348dfae1"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 64 : PW_MAX; + + return pw_max; +} + +u32 module_salt_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_max = 8; + + return salt_max; +} + +u32 module_salt_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const u32 salt_min = 8; + + return salt_min; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + hc_token_t token; + + memset (&token, 0, sizeof (hc_token_t)); + + token.token_cnt = 2; + + token.sep[0] = hashconfig->separator; + token.len[0] = 16; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + token.sep[1] = hashconfig->separator; + token.len[1] = 16; + token.attr[1] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Digest + + // 16 chars (hash hex string, big endian) + const u8 *hash_pos = token.buf[0]; + + // Convert to little endian u64 + digest[0] = ((hex_to_u64 (&hash_pos[0]))); + digest[1] = 0; + + digest[0] = byte_swap_64 (digest[0]); + + // Seed + + // 16 chars (salt hex string, big endian) + const u8 *salt_pos = token.buf[1]; + + u64 temp_salt = hex_to_u64 (&salt_pos[0]); // Convert hex to u64 + temp_salt = byte_swap_64 (temp_salt); // Byte swap to little endian + + // Split into two u32s for salt_buf + salt->salt_buf[0] = (u32) (temp_salt & 0xffffffff); // lo 32 bits + salt->salt_buf[1] = (u32) (temp_salt >> 32); // hi 32 bits + + salt->salt_len = 8; + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + const u64 *salt_b = (const u64 *) salt->salt_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u8 *out_buf = (u8 *) line_buf; + + int out_len = 0; + + // Write hash as big endian hex + u64_to_hex (byte_swap_64 (digest[0]), out_buf + out_len); out_len += 16; + + out_buf[out_len] = (u8) hashconfig->separator; + + out_len += 1; + + // Write salt as big endian hex + u64_to_hex (byte_swap_64 (salt_b[0]), out_buf + out_len); out_len += 16; + + // len should be 33 (16 + 1 + 16) + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_charset = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_bridge_name = MODULE_DEFAULT; + module_ctx->module_bridge_type = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_deprecated_notice = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_postprocess = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = module_salt_max; + module_ctx->module_salt_min = module_salt_min; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_34201.c b/src/modules/module_34201.c new file mode 100755 index 000000000..fa5e6d3b5 --- /dev/null +++ b/src/modules/module_34201.c @@ -0,0 +1,186 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_8_2; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "MurmurHash64A (zero seed)"; +static const u64 KERN_TYPE = 34201; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE + | OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_SUGGEST_KG; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "73f8142b4326d36a"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 64 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u64 *digest = (u64 *) digest_buf; + + hc_token_t token; + + memset (&token, 0, sizeof (hc_token_t)); + + token.token_cnt = 1; + + token.len[0] = 16; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Digest + + // 16 chars (hash hex string, big endian) + const u8 *hash_pos = token.buf[0]; + + // Convert to little endian u64 + digest[0] = ((hex_to_u64 (&hash_pos[0]))); + digest[1] = 0; + + digest[0] = byte_swap_64 (digest[0]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u64 *digest = (const u64 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u8 *out_buf = (u8 *) line_buf; + + const int out_len = 16; + + // Write hash as big endian hex + u64_to_hex (byte_swap_64 (digest[0]), out_buf); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_charset = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_bridge_name = MODULE_DEFAULT; + module_ctx->module_bridge_type = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_deprecated_notice = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_postprocess = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/src/modules/module_34211.c b/src/modules/module_34211.c new file mode 100755 index 000000000..04ec7c188 --- /dev/null +++ b/src/modules/module_34211.c @@ -0,0 +1,188 @@ +/** + * Author......: See docs/credits.txt + * License.....: MIT + */ + +#include "common.h" +#include "types.h" +#include "modules.h" +#include "bitops.h" +#include "convert.h" +#include "shared.h" + +static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL; +static const u32 DGST_POS0 = 0; +static const u32 DGST_POS1 = 1; +static const u32 DGST_POS2 = 2; +static const u32 DGST_POS3 = 3; +static const u32 DGST_SIZE = DGST_SIZE_4_4; +static const u32 HASH_CATEGORY = HASH_CATEGORY_RAW_HASH; +static const char *HASH_NAME = "MurmurHash64A truncated (zero seed)"; +static const u64 KERN_TYPE = 34211; +static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE + | OPTI_TYPE_USES_BITS_64 + | OPTI_TYPE_NOT_ITERATED + | OPTI_TYPE_NOT_SALTED; +static const u64 OPTS_TYPE = OPTS_TYPE_STOCK_MODULE + | OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_SUGGEST_KG; +static const u32 SALT_TYPE = SALT_TYPE_NONE; +static const char *ST_PASS = "hashcat"; +static const char *ST_HASH = "73f8142b"; + +u32 module_attack_exec (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ATTACK_EXEC; } +u32 module_dgst_pos0 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS0; } +u32 module_dgst_pos1 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS1; } +u32 module_dgst_pos2 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS2; } +u32 module_dgst_pos3 (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_POS3; } +u32 module_dgst_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return DGST_SIZE; } +u32 module_hash_category (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_CATEGORY; } +const char *module_hash_name (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return HASH_NAME; } +u64 module_kern_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return KERN_TYPE; } +u32 module_opti_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTI_TYPE; } +u64 module_opts_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return OPTS_TYPE; } +u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return SALT_TYPE; } +const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; } +const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; } + +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 64 : PW_MAX; + + return pw_max; +} + +int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) +{ + u32 *digest = (u32 *) digest_buf; + + hc_token_t token; + + memset (&token, 0, sizeof (hc_token_t)); + + token.token_cnt = 1; + + token.len[0] = 8; + token.attr[0] = TOKEN_ATTR_FIXED_LENGTH + | TOKEN_ATTR_VERIFY_HEX; + + const int rc_tokenizer = input_tokenizer ((const u8 *) line_buf, line_len, &token); + + if (rc_tokenizer != PARSER_OK) return (rc_tokenizer); + + // Digest + + // 8 chars (hash hex string, big endian) + const u8 *hash_pos = token.buf[0]; + + // Convert to little endian u32 + digest[0] = ((hex_to_u32 (&hash_pos[0]))); + digest[1] = 0; + digest[2] = 0; + digest[3] = 0; + + digest[0] = byte_swap_32 (digest[0]); + + return (PARSER_OK); +} + +int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t *salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t *hash_info, char *line_buf, MAYBE_UNUSED const int line_size) +{ + const u32 *digest = (const u32 *) digest_buf; + + // we can not change anything in the original buffer, otherwise destroying sorting + // therefore create some local buffer + + u8 *out_buf = (u8 *) line_buf; + + const int out_len = 8; + + // Write hash as big endian hex + u32_to_hex (byte_swap_32 (digest[0]), out_buf); + + return out_len; +} + +void module_init (module_ctx_t *module_ctx) +{ + module_ctx->module_context_size = MODULE_CONTEXT_SIZE_CURRENT; + module_ctx->module_interface_version = MODULE_INTERFACE_VERSION_CURRENT; + + module_ctx->module_attack_exec = module_attack_exec; + module_ctx->module_benchmark_esalt = MODULE_DEFAULT; + module_ctx->module_benchmark_hook_salt = MODULE_DEFAULT; + module_ctx->module_benchmark_mask = MODULE_DEFAULT; + module_ctx->module_benchmark_charset = MODULE_DEFAULT; + module_ctx->module_benchmark_salt = MODULE_DEFAULT; + module_ctx->module_bridge_name = MODULE_DEFAULT; + module_ctx->module_bridge_type = MODULE_DEFAULT; + module_ctx->module_build_plain_postprocess = MODULE_DEFAULT; + module_ctx->module_deep_comp_kernel = MODULE_DEFAULT; + module_ctx->module_deprecated_notice = MODULE_DEFAULT; + module_ctx->module_dgst_pos0 = module_dgst_pos0; + module_ctx->module_dgst_pos1 = module_dgst_pos1; + module_ctx->module_dgst_pos2 = module_dgst_pos2; + module_ctx->module_dgst_pos3 = module_dgst_pos3; + module_ctx->module_dgst_size = module_dgst_size; + module_ctx->module_dictstat_disable = MODULE_DEFAULT; + module_ctx->module_esalt_size = MODULE_DEFAULT; + module_ctx->module_extra_buffer_size = MODULE_DEFAULT; + module_ctx->module_extra_tmp_size = MODULE_DEFAULT; + module_ctx->module_extra_tuningdb_block = MODULE_DEFAULT; + module_ctx->module_forced_outfile_format = MODULE_DEFAULT; + module_ctx->module_hash_binary_count = MODULE_DEFAULT; + module_ctx->module_hash_binary_parse = MODULE_DEFAULT; + module_ctx->module_hash_binary_save = MODULE_DEFAULT; + module_ctx->module_hash_decode_postprocess = MODULE_DEFAULT; + module_ctx->module_hash_decode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_decode_zero_hash = MODULE_DEFAULT; + module_ctx->module_hash_decode = module_hash_decode; + module_ctx->module_hash_encode_status = MODULE_DEFAULT; + module_ctx->module_hash_encode_potfile = MODULE_DEFAULT; + module_ctx->module_hash_encode = module_hash_encode; + module_ctx->module_hash_init_selftest = MODULE_DEFAULT; + module_ctx->module_hash_mode = MODULE_DEFAULT; + module_ctx->module_hash_category = module_hash_category; + module_ctx->module_hash_name = module_hash_name; + module_ctx->module_hashes_count_min = MODULE_DEFAULT; + module_ctx->module_hashes_count_max = MODULE_DEFAULT; + module_ctx->module_hlfmt_disable = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_size = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_init = MODULE_DEFAULT; + module_ctx->module_hook_extra_param_term = MODULE_DEFAULT; + module_ctx->module_hook12 = MODULE_DEFAULT; + module_ctx->module_hook23 = MODULE_DEFAULT; + module_ctx->module_hook_salt_size = MODULE_DEFAULT; + module_ctx->module_hook_size = MODULE_DEFAULT; + module_ctx->module_jit_build_options = MODULE_DEFAULT; + module_ctx->module_jit_cache_disable = MODULE_DEFAULT; + module_ctx->module_kernel_accel_max = MODULE_DEFAULT; + module_ctx->module_kernel_accel_min = MODULE_DEFAULT; + module_ctx->module_kernel_loops_max = MODULE_DEFAULT; + module_ctx->module_kernel_loops_min = MODULE_DEFAULT; + module_ctx->module_kernel_threads_max = MODULE_DEFAULT; + module_ctx->module_kernel_threads_min = MODULE_DEFAULT; + module_ctx->module_kern_type = module_kern_type; + module_ctx->module_kern_type_dynamic = MODULE_DEFAULT; + module_ctx->module_opti_type = module_opti_type; + module_ctx->module_opts_type = module_opts_type; + module_ctx->module_outfile_check_disable = MODULE_DEFAULT; + module_ctx->module_outfile_check_nocomp = MODULE_DEFAULT; + module_ctx->module_potfile_custom_check = MODULE_DEFAULT; + module_ctx->module_potfile_disable = MODULE_DEFAULT; + module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; + module_ctx->module_pwdump_column = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; + module_ctx->module_pw_min = MODULE_DEFAULT; + module_ctx->module_salt_max = MODULE_DEFAULT; + module_ctx->module_salt_min = MODULE_DEFAULT; + module_ctx->module_salt_type = module_salt_type; + module_ctx->module_separator = MODULE_DEFAULT; + module_ctx->module_st_hash = module_st_hash; + module_ctx->module_st_pass = module_st_pass; + module_ctx->module_tmp_size = MODULE_DEFAULT; + module_ctx->module_unstable_warning = MODULE_DEFAULT; + module_ctx->module_warmup_disable = MODULE_DEFAULT; +} diff --git a/tools/benchmark_deep.pl b/tools/benchmark_deep.pl index f6369e995..03831c818 100755 --- a/tools/benchmark_deep.pl +++ b/tools/benchmark_deep.pl @@ -8,6 +8,11 @@ use strict; use warnings; +use File::Path qw(make_path); + +my $startTime = time(); +my $workdir = "test_benchmarkDeep_$startTime"; + my $nvidia_cache = "~/.nv"; my $amd_cache = "~/.AMD"; my $hashcat_path = "."; @@ -18,34 +23,61 @@ my $workload_profile = 3; my $runtime = 11; my $sleep_sec = 13; my $default_mask = "?a?a?a?a?a?a?a"; -my $result = "result.txt"; +my $result = "$workdir/result.txt"; my $old_hashcat = 0; # requires to have ran with new hashcat before to create the hashfiles my $repeats = 0; my $cpu_benchmark = 0; -print "\nHardware preparations... You may need to adjust some settings and probably can ignore some of the error\n\n"; - -system ("echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"); - -if ($cpu_benchmark == 1) +unless (-d $workdir) { - system ("sudo echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo"); ## for CPU benchmark Intel - system ("sudo echo 0 > /sys/devices/system/cpu/cpufreq/boost"); ## for CPU benchmark AMD -} -else -{ - #system ("rocm-smi --resetprofile --resetclocks --resetfans"); - #system ("rocm-smi --setfan 100% --setperflevel high"); - - system ("nvidia-settings -a GPUPowerMizerMode=1 -a GPUFanControlState=1 -a GPUTargetFanSpeed=100"); + make_path($workdir) or die "Unable to create '$workdir': $!"; } -print "\n\nStarting...\n\n"; +print "\n[$workdir] > Hardware preparations... You may need to adjust some settings and probably can ignore some of the error\n\n"; + +if ($^O eq 'linux') +{ + system ("echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"); + + if ($cpu_benchmark == 1) + { + system ("sudo echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo"); ## for CPU benchmark Intel + system ("sudo echo 0 > /sys/devices/system/cpu/cpufreq/boost"); ## for CPU benchmark AMD + } + else + { + #system ("rocm-smi --resetprofile --resetclocks --resetfans"); + #system ("rocm-smi --setfan 100% --setperflevel high"); + + system ("nvidia-settings -a GPUPowerMizerMode=1 -a GPUFanControlState=1 -a GPUTargetFanSpeed=100"); + } + + system ("rm -rf $nvidia_cache"); + system ("rm -rf $amd_cache"); +} +elsif ($^O eq 'darwin') +{ + open(my $stderr_orig, '>&', STDERR) or die "Can't dup STDERR: $!"; + + open(STDERR, '>', '/dev/null') or die "Can't redirect STDERR: $!"; + + chomp(my $temp_dir = `getconf DARWIN_USER_TEMP_DIR`); + chomp(my $cache_dir = `getconf DARWIN_USER_CACHE_DIR`); + + # cleanup OpenCL cache + system("find \"$temp_dir\" -mindepth 1 -exec rm -rf {} +"); + # cleanup OpenCL/Metal cache + system("rm -rf \"$cache_dir/com.apple.metalfe/*\""); + # cleanup Metal cache + system("rm -rf \"$cache_dir/com.apple.metal/*\""); + + open(STDERR, '>&', $stderr_orig) or die "Can't restore STDERR: $!"; +} -system ("rm -rf $nvidia_cache"); -system ("rm -rf $amd_cache"); system ("rm -rf $kernels_cache"); +print "\n\n[$workdir] > Starting...\n\n"; + my @hash_types_selection = ( 0, @@ -379,6 +411,8 @@ for my $hash_type (@hash_types) my $mask = $default_mask; + my $filepath = "$workdir/tmp.hash.$hash_type"; + if ($old_hashcat == 0) { my $module = get_module ($hash_type); @@ -386,7 +420,7 @@ for my $hash_type (@hash_types) my $st_hash = $module->{"st_hash"}; my $is_binary = $module->{"is_binary"}; - open (OUT, ">", "tmp.hash.$hash_type") or die; + open (OUT, ">", $filepath) or die; if ($is_binary) { @@ -406,7 +440,7 @@ for my $hash_type (@hash_types) ( $hashcat_bin, "-D2", "--quiet", - "tmp.hash.$hash_type", + $filepath, "--keep-guessing", "--self-test-disable", "--markov-disable", @@ -435,13 +469,13 @@ for my $hash_type (@hash_types) push (@command, "--backend-devices", $device); } - print "Executing command: ", join (" ", @command), "\n"; + print "[$workdir] > Executing command: ", join (" ", @command), "\n"; my $final_speed = 0; for (my $i = 0; $i <= $repeats; $i++) { - printf ("Run #%d\n", $i); + printf ("[$workdir] > Run #%d\n", $i); open (IN, "-|", @command, "--runtime", 1); close (IN); @@ -493,6 +527,16 @@ for my $hash_type (@hash_types) open (OUT, ">>", $result) or die; print OUT $final_speed, "\n"; close (OUT); + + my $endTime = time(); + my $elapsed = $endTime - $startTime; + + my $days = int($elapsed / 86400); + my $hours = int(($elapsed % 86400) / 3600); + my $minutes = int(($elapsed % 3600) / 60); + my $seconds = $elapsed % 60; + + printf("\n\n[$workdir] > All tests done in: %d days, %02d hours, %02d minutes, %02d seconds\n", $days, $hours, $minutes, $seconds); } sub get_module diff --git a/tools/test_edge.sh b/tools/test_edge.sh index 2bcf65a8d..4c866dae7 100755 --- a/tools/test_edge.sh +++ b/tools/test_edge.sh @@ -27,7 +27,8 @@ function usage() echo "" echo "-t / --target-type : set Target Type (default: all. supported: single, multi)" echo "" - echo "-V / --vector-width : set Vector Width (default: all. supported: 1, 2, 4, 8, 16)" + echo "-V / --vector-width : set Vector Width or a list of comma-separated Vector Widths" + echo " (default: all. supported: 1, 2, 4, 8, 16)" echo " --vector-width-min : set min vector-width (default: 1)" echo " --vector-width-max : set max vector-width (default: 16)" echo "" @@ -290,11 +291,21 @@ while [[ $# -gt 0 ]]; do if [[ "$optarg" == "all" ]]; then : - elif [[ "$optarg" =~ ^(1|2|4|8|16)$ ]]; then - VECTOR_WIDTH="$optarg" else - echo "Invalid vector width: $optarg" - usage + VECTOR_WIDTH="" + VECTOR_WIDTHS="" + + IFS=',' read -ra INPUT_VECTOR_WIDTHS <<< "$optarg" + for vec in "${INPUT_VECTOR_WIDTHS[@]}"; do + if [[ "$vec" =~ ^(1|2|4|8|16)$ ]]; then + VECTOR_WIDTHS+=" $vec" + else + echo "Invalid Vector width: $vec" + usage + fi + done + + VECTOR_WIDTHS="$(echo "$VECTOR_WIDTHS" | xargs)" # Trim leading/trailing spaces fi [[ "$shift_inline" -eq 0 ]] && shift @@ -513,7 +524,14 @@ if [ ${FORCE} -eq 1 ]; then fi if [ $METAL_BACKEND -eq 1 ]; then - VECTOR_WIDTHS="1 2 4" + VECTOR_WIDTHS_FILTER="" + for v in $VECTOR_WIDTHS; do + if [ "$v" -le 4 ]; then + VECTOR_WIDTHS_FILTER="$VECTOR_WIDTHS_FILTER$v " + fi + done + + VECTOR_WIDTHS="$(echo "$VECTOR_WIDTHS_FILTER" | xargs)" if [ $VECTOR_WIDTH_MAX -gt 4 ]; then VECTOR_WIDTH_MAX=4 @@ -668,9 +686,7 @@ for hash_type in $(ls tools/test_modules/*.pm | cut -d'm' -f3 | cut -d'.' -f1 | for vector_width in ${VECTOR_WIDTHS}; do - if [ $VECTOR_WIDTH != "all" ]; then - if [ $VECTOR_WIDTH -ne $vector_width ]; then continue; fi - else + if [ "$VECTOR_WIDTH" == "all" ]; then if [ ${vector_width} -lt ${VECTOR_WIDTH_MIN} ]; then continue; fi if [ ${vector_width} -gt ${VECTOR_WIDTH_MAX} ]; then continue; fi fi diff --git a/tools/test_modules/m34200.pm b/tools/test_modules/m34200.pm new file mode 100755 index 000000000..168b4c839 --- /dev/null +++ b/tools/test_modules/m34200.pm @@ -0,0 +1,156 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; +use Math::BigInt; + +sub module_constraints { [[0, 256], [16, 16], [0, 64], [16, 16], [-1, -1]] } + +my $u64_width = Math::BigInt->new ("0x10000000000000000"); # 2**64 + +# Ensure that uint64 integer overflow is replicated correctly +sub wrapping_mul +{ + my $a = shift; + my $b = shift; + + return ($a * $b)->bmod ($u64_width); +} + +my $m = Math::BigInt->new ("0xc6a4a7935bd1e995"); +my $r = 47; + +sub murmurhash64a +{ + use integer; + + my $word = shift; + my $seed = shift; + + my @chars = unpack ("C*", $word); + my $len = length $word; + + my $hash = $seed ^ wrapping_mul ($len, $m); + + my $endpos = $len - ($len & 7); + my $i; + + for ($i = 0; $i < $endpos; $i += 8) + { + my $c0 = $chars[$i + 0]; + my $c1 = $chars[$i + 1]; + my $c2 = $chars[$i + 2]; + my $c3 = $chars[$i + 3]; + my $c4 = $chars[$i + 4]; + my $c5 = $chars[$i + 5]; + my $c6 = $chars[$i + 6]; + my $c7 = $chars[$i + 7]; + + my $k = ($c0 << 0) + | ($c1 << 8) + | ($c2 << 16) + | ($c3 << 24) + | ($c4 << 32) + | ($c5 << 40) + | ($c6 << 48) + | ($c7 << 56); + + $k = wrapping_mul ($k, $m); + $k ^= $k >> $r; + $k = wrapping_mul ($k, $m); + + $hash ^= $k; + $hash = wrapping_mul ($hash, $m); + } + + my $overflow = $len & 7; + + if ($overflow == 7) + { + $hash ^= $chars[$i + 6] << 48; + } + if ($overflow >= 6) + { + $hash ^= $chars[$i + 5] << 40; + } + if ($overflow >= 5) + { + $hash ^= $chars[$i + 4] << 32; + } + if ($overflow >= 4) + { + $hash ^= $chars[$i + 3] << 24; + } + if ($overflow >= 3) + { + $hash ^= $chars[$i + 2] << 16; + } + if ($overflow >= 2) + { + $hash ^= $chars[$i + 1] << 8; + } + if ($overflow >= 1) + { + $hash ^= $chars[$i + 0] << 0; + } + + if ($overflow > 0) + { + $hash = wrapping_mul ($hash, $m); + } + + $hash ^= $hash >> $r; + $hash = wrapping_mul ($hash, $m); + $hash ^= $hash >> $r; + + return $hash; +} + +sub module_generate_hash +{ + my $word = shift; + my $salt = shift; + + my $salt_bin = pack ("H*", $salt); + + my $seed = unpack ("Q>", $salt_bin); + + my $digest = murmurhash64a ($word, $seed); + + $digest = unpack ("H*", pack ("Q>", $digest)); + + my $hash = sprintf ("%s:%016x", $digest, $seed); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $seed, $word) = split (':', $line, 3); + + return unless defined $hash; + return unless defined $seed; + return unless defined $word; + + return unless length $hash == 16; + return unless length $seed == 16; + + return unless ($hash =~ m/^[0-9a-fA-F]{16}$/); + return unless ($seed =~ m/^[0-9a-fA-F]{16}$/); + + my $word_packed = pack_if_HEX_notation ($word); + my $seed_packed = pack_if_HEX_notation ($seed); + + my $new_hash = module_generate_hash ($word_packed, $seed_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m34201.pm b/tools/test_modules/m34201.pm new file mode 100755 index 000000000..0d7a2eec5 --- /dev/null +++ b/tools/test_modules/m34201.pm @@ -0,0 +1,147 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; +use Math::BigInt; + +sub module_constraints { [[0, 256], [-1, -1], [0, 64], [-1, -1], [-1, -1]] } + +my $u64_width = Math::BigInt->new ("0x10000000000000000"); # 2**64 + +# Ensure that uint64 integer overflow is replicated correctly +sub wrapping_mul +{ + my $a = shift; + my $b = shift; + + return ($a * $b)->bmod ($u64_width); +} + +my $m = Math::BigInt->new ("0xc6a4a7935bd1e995"); +my $r = 47; + +sub murmurhash64a_zero_seed +{ + use integer; + + my $word = shift; + my $seed = 0; + + my @chars = unpack ("C*", $word); + my $len = length $word; + + my $hash = $seed ^ wrapping_mul ($len, $m); + + my $endpos = $len - ($len & 7); + my $i; + + for ($i = 0; $i < $endpos; $i += 8) + { + my $c0 = $chars[$i + 0]; + my $c1 = $chars[$i + 1]; + my $c2 = $chars[$i + 2]; + my $c3 = $chars[$i + 3]; + my $c4 = $chars[$i + 4]; + my $c5 = $chars[$i + 5]; + my $c6 = $chars[$i + 6]; + my $c7 = $chars[$i + 7]; + + my $k = ($c0 << 0) + | ($c1 << 8) + | ($c2 << 16) + | ($c3 << 24) + | ($c4 << 32) + | ($c5 << 40) + | ($c6 << 48) + | ($c7 << 56); + + $k = wrapping_mul ($k, $m); + $k ^= $k >> $r; + $k = wrapping_mul ($k, $m); + + $hash ^= $k; + $hash = wrapping_mul ($hash, $m); + } + + my $overflow = $len & 7; + + if ($overflow == 7) + { + $hash ^= $chars[$i + 6] << 48; + } + if ($overflow >= 6) + { + $hash ^= $chars[$i + 5] << 40; + } + if ($overflow >= 5) + { + $hash ^= $chars[$i + 4] << 32; + } + if ($overflow >= 4) + { + $hash ^= $chars[$i + 3] << 24; + } + if ($overflow >= 3) + { + $hash ^= $chars[$i + 2] << 16; + } + if ($overflow >= 2) + { + $hash ^= $chars[$i + 1] << 8; + } + if ($overflow >= 1) + { + $hash ^= $chars[$i + 0] << 0; + } + + if ($overflow > 0) + { + $hash = wrapping_mul ($hash, $m); + } + + $hash ^= $hash >> $r; + $hash = wrapping_mul ($hash, $m); + $hash ^= $hash >> $r; + + return $hash; +} + +sub module_generate_hash +{ + my $word = shift; + + my $digest = murmurhash64a_zero_seed ($word); + + $digest = unpack ("H*", pack ("Q>", $digest)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line, 2); + + return unless defined $hash; + return unless defined $word; + + return unless length $hash == 16; + + return unless ($hash =~ m/^[0-9a-fA-F]{16}$/); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1; diff --git a/tools/test_modules/m34211.pm b/tools/test_modules/m34211.pm new file mode 100755 index 000000000..9394e0414 --- /dev/null +++ b/tools/test_modules/m34211.pm @@ -0,0 +1,150 @@ +#!/usr/bin/env perl + +## +## Author......: See docs/credits.txt +## License.....: MIT +## + +use strict; +use warnings; +use Math::BigInt; + +sub module_constraints { [[0, 256], [-1, -1], [0, 64], [-1, -1], [-1, -1]] } + +my $u64_width = Math::BigInt->new ("0x10000000000000000"); # 2**64 + +# Ensure that uint64 integer overflow is replicated correctly +sub wrapping_mul +{ + my $a = shift; + my $b = shift; + + return ($a * $b)->bmod ($u64_width); +} + +my $m = Math::BigInt->new ("0xc6a4a7935bd1e995"); +my $r = 47; + +sub murmurhash64a_truncated_zero_seed +{ + use integer; + + my $word = shift; + my $seed = 0; + + my @chars = unpack ("C*", $word); + my $len = length $word; + + my $hash = $seed ^ wrapping_mul ($len, $m); + + my $endpos = $len - ($len & 7); + my $i; + + for ($i = 0; $i < $endpos; $i += 8) + { + my $c0 = $chars[$i + 0]; + my $c1 = $chars[$i + 1]; + my $c2 = $chars[$i + 2]; + my $c3 = $chars[$i + 3]; + my $c4 = $chars[$i + 4]; + my $c5 = $chars[$i + 5]; + my $c6 = $chars[$i + 6]; + my $c7 = $chars[$i + 7]; + + my $k = ($c0 << 0) + | ($c1 << 8) + | ($c2 << 16) + | ($c3 << 24) + | ($c4 << 32) + | ($c5 << 40) + | ($c6 << 48) + | ($c7 << 56); + + $k = wrapping_mul ($k, $m); + $k ^= $k >> $r; + $k = wrapping_mul ($k, $m); + + $hash ^= $k; + $hash = wrapping_mul ($hash, $m); + } + + my $overflow = $len & 7; + + if ($overflow == 7) + { + $hash ^= $chars[$i + 6] << 48; + } + if ($overflow >= 6) + { + $hash ^= $chars[$i + 5] << 40; + } + if ($overflow >= 5) + { + $hash ^= $chars[$i + 4] << 32; + } + if ($overflow >= 4) + { + $hash ^= $chars[$i + 3] << 24; + } + if ($overflow >= 3) + { + $hash ^= $chars[$i + 2] << 16; + } + if ($overflow >= 2) + { + $hash ^= $chars[$i + 1] << 8; + } + if ($overflow >= 1) + { + $hash ^= $chars[$i + 0] << 0; + } + + if ($overflow > 0) + { + $hash = wrapping_mul ($hash, $m); + } + + $hash ^= $hash >> $r; + $hash = wrapping_mul ($hash, $m); + $hash ^= $hash >> $r; + + # Use only high 32 bits from final hash + $hash = $hash >> 32; + + return $hash; +} + +sub module_generate_hash +{ + my $word = shift; + + my $digest = murmurhash64a_truncated_zero_seed ($word); + + $digest = unpack ("H*", pack ("L>", $digest)); + + my $hash = sprintf ("%s", $digest); + + return $hash; +} + +sub module_verify_hash +{ + my $line = shift; + + my ($hash, $word) = split (':', $line, 2); + + return unless defined $hash; + return unless defined $word; + + return unless length $hash == 8; + + return unless ($hash =~ m/^[0-9a-fA-F]{8}$/); + + my $word_packed = pack_if_HEX_notation ($word); + + my $new_hash = module_generate_hash ($word_packed); + + return ($new_hash, $word); +} + +1;