From 6d4dbffda139a0daaa56e507521b3368d00b15d7 Mon Sep 17 00:00:00 2001 From: therealartifex Date: Fri, 30 Jul 2021 17:13:01 -0400 Subject: [PATCH] Moved the addition of static dashes to the kernel --- OpenCL/m28200_a0-pure.cl | 6 +++++- OpenCL/m28200_a1-pure.cl | 4 ++++ OpenCL/m28200_a3-pure.cl | 6 +++++- src/modules/module_28200.c | 21 +-------------------- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/OpenCL/m28200_a0-pure.cl b/OpenCL/m28200_a0-pure.cl index a5af8c675..43b69a8ba 100644 --- a/OpenCL/m28200_a0-pure.cl +++ b/OpenCL/m28200_a0-pure.cl @@ -39,7 +39,9 @@ KERNEL_FQ void m28200_mxx (KERN_ATTR_RULES ()) sha1_init (&ctx0); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); /** * loop @@ -100,8 +102,10 @@ KERNEL_FQ void m28200_sxx (KERN_ATTR_RULES ()) sha1_ctx_t ctx0; sha1_init (&ctx0); - + + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); /** * loop diff --git a/OpenCL/m28200_a1-pure.cl b/OpenCL/m28200_a1-pure.cl index 0a212113c..6802a277f 100644 --- a/OpenCL/m28200_a1-pure.cl +++ b/OpenCL/m28200_a1-pure.cl @@ -35,7 +35,9 @@ KERNEL_FQ void m28200_mxx (KERN_ATTR_BASIC ()) sha1_init (&ctx0); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len); @@ -93,7 +95,9 @@ KERNEL_FQ void m28200_sxx (KERN_ATTR_BASIC ()) sha1_init (&ctx0); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, pws[gid].i, pws[gid].pw_len); diff --git a/OpenCL/m28200_a3-pure.cl b/OpenCL/m28200_a3-pure.cl index 0e4ff3190..c215e9016 100644 --- a/OpenCL/m28200_a3-pure.cl +++ b/OpenCL/m28200_a3-pure.cl @@ -44,7 +44,9 @@ KERNEL_FQ void m28200_mxx (KERN_ATTR_VECTOR ()) sha1_init (&ctx0); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); /** * loop @@ -89,7 +91,7 @@ KERNEL_FQ void m28200_sxx (KERN_ATTR_VECTOR ()) if (gid >= gid_max) return; - const u32 dash[16] = { 0x2d2d0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + const u32x dash[16] = { 0x2d2d0000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /** * digest @@ -120,7 +122,9 @@ KERNEL_FQ void m28200_sxx (KERN_ATTR_VECTOR ()) sha1_init (&ctx0); + sha1_update_global (&ctx0, dash, 2); sha1_update_global_swap (&ctx0, salt_bufs[SALT_POS].salt_buf, salt_bufs[SALT_POS].salt_len); + sha1_update_global (&ctx0, dash, 2); /** * loop diff --git a/src/modules/module_28200.c b/src/modules/module_28200.c index 01a460fe4..a6f2d7887 100644 --- a/src/modules/module_28200.c +++ b/src/modules/module_28200.c @@ -47,8 +47,6 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig, 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; } -static const char *dashes = "--"; - 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; @@ -101,17 +99,6 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE if (parse_rc == false) return (PARSER_SALT_LENGTH); - u8 *psalt_buf = (u8 *) salt->salt_buf; - - // Add dashes before salt - memmove(psalt_buf + 2, psalt_buf, salt->salt_len + 1); - memcpy(psalt_buf, dashes, 2); - salt->salt_len += 2; - - // Add dashes after salt - memcpy(psalt_buf + salt->salt_len, dashes, 2); - salt->salt_len += 2; - return (PARSER_OK); } @@ -159,13 +146,7 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE out_len += 1; - // Remove dashes from salt - u8 *psalt_buf = (u8 *) salt->salt_buf; - const int salt_len = 40; - memmove(psalt_buf, psalt_buf + 2, salt->salt_len - 4); - psalt_buf[salt->salt_len - 4] = 0; - - out_len += generic_salt_encode (hashconfig, (const u8 *) psalt_buf, salt_len, out_buf + out_len); + out_len += generic_salt_encode (hashconfig, (const u8 *) salt->salt_buf, salt->salt_len, out_buf + out_len); return out_len; }