diff --git a/OpenCL/m21420_a0-pure.cl b/OpenCL/m21420_a0-pure.cl index 24070528a..4da324233 100644 --- a/OpenCL/m21420_a0-pure.cl +++ b/OpenCL/m21420_a0-pure.cl @@ -22,8 +22,9 @@ KERNEL_FQ void m21420_mxx (KERN_ATTR_RULES ()) * modifier */ - const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); if (gid >= gid_max) return; @@ -31,48 +32,63 @@ KERNEL_FQ void m21420_mxx (KERN_ATTR_RULES ()) * base */ + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + COPY_PW (pws[gid]); - sha256_ctx_t ctx0; + const u32 salt_len = salt_bufs[SALT_POS].salt_len; - sha256_init (&ctx0); + u32 s[64] = { 0 }; - sha256_update_global_swap (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len); + for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) + { + s[idx] = hc_swap32_S (salt_bufs[SALT_POS].salt_buf[idx]); + } /** * loop */ - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - 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); - sha256_ctx_t ctx1; + sha256_ctx_t ctx0; + + sha256_init (&ctx0); + + sha256_update_swap (&ctx0, tmp.i, tmp.pw_len); - sha256_init (&ctx1); + sha256_final (&ctx0); - sha256_update_swap (&ctx1, tmp.i, tmp.pw_len); + const u32 a = ctx0.h[0]; + const u32 b = ctx0.h[1]; + const u32 c = ctx0.h[2]; + const u32 d = ctx0.h[3]; + const u32 e = ctx0.h[4]; + const u32 f = ctx0.h[5]; + const u32 g = ctx0.h[6]; + const u32 h = ctx0.h[7]; - sha256_final (&ctx1); + sha256_ctx_t ctx; - sha256_ctx_t ctx = ctx0; + sha256_init (&ctx); - w0[0] = ctx1.h[0]; - w0[1] = ctx1.h[1]; - w0[2] = ctx1.h[2]; - w0[3] = ctx1.h[3]; - w1[0] = ctx1.h[4]; - w1[1] = ctx1.h[5]; - w1[2] = ctx1.h[6]; - w1[3] = ctx1.h[7]; + sha256_update (&ctx, s, salt_len); + w0[0] = a; + w0[1] = b; + w0[2] = c; + w0[3] = d; + w1[0] = e; + w1[1] = f; + w1[2] = g; + w1[3] = h; w2[0] = 0; w2[1] = 0; w2[2] = 0; @@ -101,8 +117,9 @@ KERNEL_FQ void m21420_sxx (KERN_ATTR_RULES ()) * modifier */ - const u64 lid = get_local_id (0); const u64 gid = get_global_id (0); + const u64 lid = get_local_id (0); + const u64 lsz = get_local_size (0); if (gid >= gid_max) return; @@ -112,58 +129,73 @@ KERNEL_FQ void m21420_sxx (KERN_ATTR_RULES ()) 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] + 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] }; /** * base */ + u32 w0[4]; + u32 w1[4]; + u32 w2[4]; + u32 w3[4]; + COPY_PW (pws[gid]); - sha256_ctx_t ctx0; + const u32 salt_len = salt_bufs[SALT_POS].salt_len; - sha256_init (&ctx0); + u32 s[64] = { 0 }; - sha256_update_global_swap (&ctx0, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len); + for (int i = 0, idx = 0; i < salt_len; i += 4, idx += 1) + { + s[idx] = hc_swap32_S (salt_bufs[SALT_POS].salt_buf[idx]); + } /** * loop */ - u32 w0[4]; - u32 w1[4]; - u32 w2[4]; - u32 w3[4]; - 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); - sha256_ctx_t ctx1; + sha256_ctx_t ctx0; + + sha256_init (&ctx0); + + sha256_update_swap (&ctx0, tmp.i, tmp.pw_len); - sha256_init (&ctx1); + sha256_final (&ctx0); - sha256_update_swap (&ctx1, tmp.i, tmp.pw_len); + const u32 a = ctx0.h[0]; + const u32 b = ctx0.h[1]; + const u32 c = ctx0.h[2]; + const u32 d = ctx0.h[3]; + const u32 e = ctx0.h[4]; + const u32 f = ctx0.h[5]; + const u32 g = ctx0.h[6]; + const u32 h = ctx0.h[7]; - sha256_final (&ctx1); + sha256_ctx_t ctx; - sha256_ctx_t ctx = ctx0; + sha256_init (&ctx); - w0[0] = ctx1.h[0]; - w0[1] = ctx1.h[1]; - w0[2] = ctx1.h[2]; - w0[3] = ctx1.h[3]; - w1[0] = ctx1.h[4]; - w1[1] = ctx1.h[5]; - w1[2] = ctx1.h[6]; - w1[3] = ctx1.h[7]; + sha256_update (&ctx, s, salt_len); + w0[0] = a; + w0[1] = b; + w0[2] = c; + w0[3] = d; + w1[0] = e; + w1[1] = f; + w1[2] = g; + w1[3] = h; w2[0] = 0; w2[1] = 0; w2[2] = 0;