1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-26 01:50:10 +00:00

Add Nexus legacy wallet support to -m 11300

This commit is contained in:
Solar Designer 2019-11-12 19:32:03 +01:00
parent e194fec229
commit 9d9351da22
2 changed files with 31 additions and 24 deletions

View File

@ -102,7 +102,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, salt_bufs[salt_pos].salt_len);
sha512_update_global_swap (&ctx, salt_bufs[salt_pos].salt_buf, 8);
sha512_final (&ctx);
@ -293,13 +293,6 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
key[6] = h32_from_64_S (dgst[3]);
key[7] = l32_from_64_S (dgst[3]);
u32 iv[4];
iv[0] = h32_from_64_S (dgst[4]);
iv[1] = l32_from_64_S (dgst[4]);
iv[2] = h32_from_64_S (dgst[5]);
iv[3] = l32_from_64_S (dgst[5]);
#define KEYLEN 60
u32 ks[KEYLEN];
@ -308,10 +301,18 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
u32 out[4];
for (u32 i = 0; i < esalt_bufs[digests_offset].cry_master_len; i += 16)
{
u32 data[4];
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]);
iv[3] = hc_swap32_S (esalt_bufs[digests_offset].cry_master_buf[(i / 4) + 3]);
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]);
@ -323,17 +324,19 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
out[1] ^= iv[1];
out[2] ^= iv[2];
out[3] ^= iv[3];
iv[0] = data[0];
iv[1] = data[1];
iv[2] = data[2];
iv[3] = data[3];
}
if ((out[0] == 0x10101010)
&& (out[1] == 0x10101010)
&& (out[2] == 0x10101010)
&& (out[3] == 0x10101010))
u32 pad;
if (salt_bufs[salt_pos].salt_len != 18) /* most wallets */
{
pad = 0x10101010;
if (out[0] != pad || out[1] != pad)
return;
} else { /* Nexus legacy wallet */
pad = 0x08080808;
}
if (out[2] == pad && out[3] == pad)
{
if (atomic_inc (&hashes_shown[digests_offset]) == 0)
{

View File

@ -127,12 +127,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
token.sep[1] = '$';
token.len_min[1] = 2;
token.len_max[1] = 2;
token.len_max[1] = 3;
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_DIGIT;
token.sep[2] = '$';
token.len_min[2] = 16;
token.len_min[2] = 64;
token.len_max[2] = 256;
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_HEX;
@ -145,7 +145,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
token.sep[4] = '$';
token.len_min[4] = 16;
token.len_max[4] = 16;
token.len_max[4] = 36;
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_HEX;
@ -208,7 +208,10 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
if (ckey_buf_len != ckey_len) return (PARSER_SALT_VALUE);
if (public_key_buf_len != public_key_len) return (PARSER_SALT_VALUE);
if (cry_master_len % 16) return (PARSER_SALT_VALUE);
if (cry_master_len < 64) return (PARSER_SALT_VALUE);
if (cry_master_len % 32) return (PARSER_SALT_VALUE);
if (cry_salt_len != 16 && cry_salt_len != 36) return (PARSER_SALT_VALUE);
// esalt
@ -234,7 +237,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// salt
const bool parse_rc = generic_salt_decode (hashconfig, cry_salt_buf_pos, cry_salt_buf_len, (u8 *) salt->salt_buf, (int *) &salt->salt_len);
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 */
if (parse_rc == false) return (PARSER_SALT_LENGTH);