1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-22 05:31:11 +00:00

Add cry_salt_buf[] and cry_salt_len for easier readability in -m 11300

This commit is contained in:
Jens Steube 2019-11-15 13:06:45 +01:00
parent bb2ea7ec57
commit 08a74596c1
2 changed files with 29 additions and 9 deletions

View File

@ -26,6 +26,9 @@ typedef struct bitcoin_wallet
u32 cry_master_buf[64];
u32 cry_master_len;
u32 cry_salt_buf[16];
u32 cry_salt_len;
} bitcoin_wallet_t;
DECLSPEC void hmac_sha512_run_V (u32x *w0, u32x *w1, u32x *w2, u32x *w3, u32x *w4, u32x *w5, u32x *w6, u32x *w7, u64x *ipad, u64x *opad, u64x *digest)
@ -102,7 +105,7 @@ KERNEL_FQ void m11300_init (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
sha512_update_global_swap (&ctx, pws[gid].i, pws[gid].pw_len);
sha512_update_global_swap (&ctx, salt_bufs[salt_pos].salt_buf, 8);
sha512_update_global_swap (&ctx, salt_bufs[salt_pos].salt_buf, salt_bufs[salt_pos].salt_len);
sha512_final (&ctx);
@ -305,6 +308,7 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
u32 i = esalt_bufs[digests_offset].cry_master_len - 32;
u32 iv[4];
iv[0] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 0]);
iv[1] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 1]);
iv[2] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 2]);
@ -313,6 +317,7 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
i += 16;
u32 data[4];
data[0] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 0]);
data[1] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 1]);
data[2] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 2]);
@ -326,13 +331,19 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
out[3] ^= iv[3];
}
u32 pad;
if (salt_bufs[salt_pos].salt_len != 18) /* most wallets */
u32 pad = 0;
if (esalt_bufs[digests_offset].cry_salt_len != 18)
{
/* most wallets */
pad = 0x10101010;
if (out[0] != pad || out[1] != pad)
return;
} else { /* Nexus legacy wallet */
if (out[0] != pad) return;
if (out[1] != pad) return;
}
else
{
/* Nexus legacy wallet */
pad = 0x08080808;
}

View File

@ -51,6 +51,9 @@ typedef struct bitcoin_wallet
u32 cry_master_buf[64];
u32 cry_master_len;
u32 cry_salt_buf[16];
u32 cry_salt_len;
} bitcoin_wallet_t;
typedef struct bitcoin_wallet_tmp
@ -235,13 +238,19 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
salt->salt_iter = cry_rounds - 1;
// salt
// esalt
const bool parse_rc = generic_salt_decode (hashconfig, cry_salt_buf_pos, 16 /* instead of cry_salt_buf_len */, (u8 *) salt->salt_buf, (int *) &salt->salt_len);
salt->salt_len = cry_salt_buf_len / 2; /* communicate original salt size to the kernel */
const bool parse_rc = generic_salt_decode (hashconfig, cry_salt_buf_pos, cry_salt_buf_len, (u8 *) bitcoin_wallet->cry_salt_buf, (int *) &bitcoin_wallet->cry_salt_len);
if (parse_rc == false) return (PARSER_SALT_LENGTH);
// salt
salt->salt_buf[0] = bitcoin_wallet->cry_salt_buf[0];
salt->salt_buf[1] = bitcoin_wallet->cry_salt_buf[1];
salt->salt_len = 8;
return (PARSER_OK);
}