1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-21 15:48:08 +00:00

Refactor extract_dynamic_x() to extract_dynamicx_hash() and add code

This commit is contained in:
jsteube 2023-11-09 15:04:32 +00:00
parent 2d3ebf1d4e
commit 2029be782e
2 changed files with 10 additions and 22 deletions

View File

@ -104,7 +104,7 @@ int generic_salt_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8
int input_tokenizer (const u8 *input_buf, const int input_len, hc_token_t *token);
int extract_dynamic_x (const u8 *input_buf);
int extract_dynamicx_hash (const u8 *input_buf, const int input_len, u8 **output_buf, int *output_len);
#if defined (__APPLE__)
bool is_apple_silicon (void);

View File

@ -1484,31 +1484,19 @@ char *file_to_buffer (const char *filename)
return NULL;
}
int extract_dynamic_x (const u8 *input_buf)
int extract_dynamicx_hash (const u8 *input_buf, const int input_len, u8 **output_buf, int *output_len)
{
/*
if (input_len < 12) return -1;
if (input_buf[0] != '$') return -1;
if (input_buf[1] != 'd') return -1;
if (input_buf[2] != 'y') return -1;
if (input_buf[3] != 'n') return -1;
if (input_buf[4] != 'a') return -1;
if (input_buf[5] != 'm') return -1;
if (input_buf[6] != 'i') return -1;
if (input_buf[7] != 'c') return -1;
if (input_buf[8] != '_') return -1;
int digit_len = 0;
for (int i = 0; i < input_len; i++)
{
}
*/
int hash_mode = -1;
if (sscanf ((char *) input_buf, "$dynamic_%d$", &hash_mode) != 1) return -1;
*output_buf = (u8 *) index ((char *) input_buf + 10, '$');
if (*output_buf == NULL) return -1;
*output_buf += 1; // the $ itself
*output_len = input_len - (*output_buf - input_buf);
return hash_mode;
}