1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-23 07:08:19 +00:00

Moved the addition of static dashes to the kernel

This commit is contained in:
therealartifex 2021-07-30 17:13:01 -04:00
parent c571fe4957
commit 6d4dbffda1
4 changed files with 15 additions and 22 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;
}