diff --git a/OpenCL/m00000_a0-pure.cl b/OpenCL/m00000_a0-pure.cl index 8e4cc7a8b..2b6a39ac3 100644 --- a/OpenCL/m00000_a0-pure.cl +++ b/OpenCL/m00000_a0-pure.cl @@ -3,7 +3,7 @@ * License.....: MIT */ -#define NEW_SIMD_CODE +//#define NEW_SIMD_CODE #include "inc_vendor.cl" #include "inc_hash_constants.h" @@ -26,13 +26,45 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule if (gid >= gid_max) return; + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + const u32 pw_lenv = ceil ((float) pw_len / 4); + + u32 w[64] = { 0 }; + + for (int idx = 0; idx < pw_lenv; idx++) + { + w[idx] = pws[gid].i[idx]; + + barrier (CLK_GLOBAL_MEM_FENCE); + } + /** * loop */ for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { + // todo: add rules engine + md5_ctx_t ctx; + + md5_init (&ctx); + + md5_update (&ctx, w, pw_len); + + md5_final (&ctx); + + const u32 r0 = ctx.h[DGST_R0]; + const u32 r1 = ctx.h[DGST_R1]; + const u32 r2 = ctx.h[DGST_R2]; + const u32 r3 = ctx.h[DGST_R3]; + + COMPARE_M_SCALAR (r0, r1, r2, r3); } } @@ -47,6 +79,23 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule if (gid >= gid_max) return; + /** + * base + */ + + const u32 pw_len = pws[gid].pw_len; + + const u32 pw_lenv = ceil ((float) pw_len / 4); + + u32 w[64] = { 0 }; + + for (int idx = 0; idx < pw_lenv; idx++) + { + w[idx] = pws[gid].i[idx]; + + barrier (CLK_GLOBAL_MEM_FENCE); + } + /** * digest */ @@ -65,6 +114,21 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule for (u32 il_pos = 0; il_pos < il_cnt; il_pos++) { + // todo: add rules engine + md5_ctx_t ctx; + + md5_init (&ctx); + + md5_update (&ctx, w, pw_len); + + md5_final (&ctx); + + const u32 r0 = ctx.h[DGST_R0]; + const u32 r1 = ctx.h[DGST_R1]; + const u32 r2 = ctx.h[DGST_R2]; + const u32 r3 = ctx.h[DGST_R3]; + + COMPARE_S_SCALAR (r0, r1, r2, r3); } } diff --git a/OpenCL/m00000_a1-pure.cl b/OpenCL/m00000_a1-pure.cl index b27b0d0a4..2a21790ed 100644 --- a/OpenCL/m00000_a1-pure.cl +++ b/OpenCL/m00000_a1-pure.cl @@ -46,15 +46,16 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule md5_final (&ctx_inner); - const u32 a = ctx_inner.h[0]; - const u32 b = ctx_inner.h[1]; - const u32 c = ctx_inner.h[2]; - const u32 d = ctx_inner.h[3]; + const u32 r0 = ctx.h[DGST_R0]; + const u32 r1 = ctx.h[DGST_R1]; + const u32 r2 = ctx.h[DGST_R2]; + const u32 r3 = ctx.h[DGST_R3]; - COMPARE_M_SCALAR (a, d, c, b); + COMPARE_M_SCALAR (r0, r1, r2, r3); } } + __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rules_buf, __global const pw_t *combs_buf, __global const bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global const u32 *bitmaps_buf_s1_a, __global const u32 *bitmaps_buf_s1_b, __global const u32 *bitmaps_buf_s1_c, __global const u32 *bitmaps_buf_s1_d, __global const u32 *bitmaps_buf_s2_a, __global const u32 *bitmaps_buf_s2_b, __global const u32 *bitmaps_buf_s2_c, __global const u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global const digest_t *digests_buf, __global u32 *hashes_shown, __global const salt_t *salt_bufs, __global const void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max) { /** @@ -100,11 +101,11 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule md5_final (&ctx_inner); - const u32 a = ctx_inner.h[0]; - const u32 b = ctx_inner.h[1]; - const u32 c = ctx_inner.h[2]; - const u32 d = ctx_inner.h[3]; + const u32 r0 = ctx.h[DGST_R0]; + const u32 r1 = ctx.h[DGST_R1]; + const u32 r2 = ctx.h[DGST_R2]; + const u32 r3 = ctx.h[DGST_R3]; - COMPARE_S_SCALAR (a, d, c, b); + COMPARE_S_SCALAR (r0, r1, r2, r3); } } diff --git a/OpenCL/m00000_a3-pure.cl b/OpenCL/m00000_a3-pure.cl index 2b92b7674..4ba2f93e4 100644 --- a/OpenCL/m00000_a3-pure.cl +++ b/OpenCL/m00000_a3-pure.cl @@ -41,6 +41,18 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule barrier (CLK_GLOBAL_MEM_FENCE); } + /** + * digest + */ + + const u32 search[4] = + { + digests_buf[digests_offset].digest_buf[DGST_R0], + digests_buf[digests_offset].digest_buf[DGST_R1], + digests_buf[digests_offset].digest_buf[DGST_R2], + digests_buf[digests_offset].digest_buf[DGST_R3] + }; + /** * loop */ @@ -63,12 +75,12 @@ __kernel void m00000_mxx (__global pw_t *pws, __global const kernel_rule_t *rule md5_final_vector (&ctx); - const u32x a = ctx.h[0]; - const u32x b = ctx.h[1]; - const u32x c = ctx.h[2]; - const u32x d = ctx.h[3]; + const u32x r0 = ctx.h[DGST_R0]; + const u32x r1 = ctx.h[DGST_R1]; + const u32x r2 = ctx.h[DGST_R2]; + const u32x r3 = ctx.h[DGST_R3]; - COMPARE_M_SIMD (a, d, c, b); + COMPARE_M_SIMD (r0, r1, r2, r3); } } @@ -134,11 +146,11 @@ __kernel void m00000_sxx (__global pw_t *pws, __global const kernel_rule_t *rule md5_final_vector (&ctx); - const u32x a = ctx.h[0]; - const u32x b = ctx.h[1]; - const u32x c = ctx.h[2]; - const u32x d = ctx.h[3]; + const u32x r0 = ctx.h[DGST_R0]; + const u32x r1 = ctx.h[DGST_R1]; + const u32x r2 = ctx.h[DGST_R2]; + const u32x r3 = ctx.h[DGST_R3]; - COMPARE_S_SIMD (a, d, c, b); + COMPARE_S_SIMD (r0, r1, r2, r3); } } diff --git a/src/straight.c b/src/straight.c index fe805636f..46f3cfca2 100644 --- a/src/straight.c +++ b/src/straight.c @@ -246,30 +246,26 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) } } - // If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes + /** + * pw_min and pw_max + */ u32 pw_min = hashconfig->pw_min; u32 pw_max = hashconfig->pw_max; - const bool has_noop = kernel_rules_has_noop (straight_ctx->kernel_rules_buf, straight_ctx->kernel_rules_cnt); - - // this entire section should go away as soon as we have a rule engine for 256 byte - - #define PW_DICTMAX 32 - - if (has_noop == false) + if (user_options->length_limit_disable == true) { - switch (user_options_extra->attack_kern) - { - case ATTACK_KERN_STRAIGHT: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX; - break; - case ATTACK_KERN_COMBI: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX; - break; - } + } else { - if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + // If we have a NOOP rule then we can process words from wordlists > length 32 for slow hashes + + const bool has_noop = kernel_rules_has_noop (straight_ctx->kernel_rules_buf, straight_ctx->kernel_rules_cnt); + + #define PW_DICTMAX 32 + + if (has_noop == false) { switch (user_options_extra->attack_kern) { @@ -281,7 +277,20 @@ int straight_ctx_init (hashcat_ctx_t *hashcat_ctx) } else { - // in this case we can process > 32 + if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) + { + switch (user_options_extra->attack_kern) + { + case ATTACK_KERN_STRAIGHT: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX; + break; + case ATTACK_KERN_COMBI: if (pw_max > PW_DICTMAX) pw_max = PW_DICTMAX; + break; + } + } + else + { + // in this case we can process > 32 + } } }