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

Merge pull request #2222 from solardiz/nexus-wallet

Add Nexus legacy wallet support to -m 11300
This commit is contained in:
Jens Steube 2019-11-15 12:43:50 +01:00 committed by GitHub
commit bb2ea7ec57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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, 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); 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[6] = h32_from_64_S (dgst[3]);
key[7] = l32_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 #define KEYLEN 60
u32 ks[KEYLEN]; u32 ks[KEYLEN];
@ -308,10 +301,18 @@ KERNEL_FQ void m11300_comp (KERN_ATTR_TMPS_ESALT (bitcoin_wallet_tmp_t, bitcoin_
u32 out[4]; 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[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[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]); 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[1] ^= iv[1];
out[2] ^= iv[2]; out[2] ^= iv[2];
out[3] ^= iv[3]; out[3] ^= iv[3];
iv[0] = data[0];
iv[1] = data[1];
iv[2] = data[2];
iv[3] = data[3];
} }
if ((out[0] == 0x10101010) u32 pad;
&& (out[1] == 0x10101010) if (salt_bufs[salt_pos].salt_len != 18) /* most wallets */
&& (out[2] == 0x10101010) {
&& (out[3] == 0x10101010)) 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) 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.sep[1] = '$';
token.len_min[1] = 2; token.len_min[1] = 2;
token.len_max[1] = 2; token.len_max[1] = 3;
token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH token.attr[1] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_DIGIT; | TOKEN_ATTR_VERIFY_DIGIT;
token.sep[2] = '$'; token.sep[2] = '$';
token.len_min[2] = 16; token.len_min[2] = 64;
token.len_max[2] = 256; token.len_max[2] = 256;
token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH token.attr[2] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_HEX; | TOKEN_ATTR_VERIFY_HEX;
@ -145,7 +145,7 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
token.sep[4] = '$'; token.sep[4] = '$';
token.len_min[4] = 16; token.len_min[4] = 16;
token.len_max[4] = 16; token.len_max[4] = 36;
token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH token.attr[4] = TOKEN_ATTR_VERIFY_LENGTH
| TOKEN_ATTR_VERIFY_HEX; | 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 (ckey_buf_len != ckey_len) return (PARSER_SALT_VALUE);
if (public_key_buf_len != public_key_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 // esalt
@ -234,7 +237,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// salt // 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); if (parse_rc == false) return (PARSER_SALT_LENGTH);