1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-13 19:28:56 +00:00

Get rid of segment_size variable in main

This commit is contained in:
jsteube 2016-09-21 22:07:10 +02:00
parent 99a6ac997e
commit a4647baba5
4 changed files with 13 additions and 11 deletions

View File

@ -837,6 +837,7 @@ typedef struct
bool rp_gen_seed_chgd;
bool runtime_chgd;
bool workload_profile_chgd;
bool segment_size_chgd;
} user_options_t;

View File

@ -56,7 +56,7 @@ typedef enum user_options_defaults
RP_GEN_SEED = 0,
RUNTIME = 0,
SCRYPT_TMTO = 0,
SEGMENT_SIZE = 32,
SEGMENT_SIZE = 33554432,
SEPARATOR = ':',
SHOW = 0,
SKIP = 0,

View File

@ -403,11 +403,9 @@ int main (int argc, char **argv)
char *session = NULL;
char *truecrypt_keyfiles = NULL;
char *veracrypt_keyfiles = NULL;
uint segment_size = SEGMENT_SIZE;
if (1)
{
segment_size = user_options->segment_size;
session = user_options->session;
truecrypt_keyfiles = user_options->truecrypt_keyfiles;
veracrypt_keyfiles = user_options->veracrypt_keyfiles;
@ -446,6 +444,7 @@ int main (int argc, char **argv)
data.veracrypt_keyfiles = user_options->veracrypt_keyfiles;
data.veracrypt_pim = user_options->veracrypt_pim;
data.scrypt_tmto = user_options->scrypt_tmto;
data.segment_size = user_options->segment_size;
data.rule_buf_l = user_options->rule_buf_l;
data.rule_buf_r = user_options->rule_buf_r;
@ -2032,15 +2031,11 @@ int main (int argc, char **argv)
* dictionary pad
*/
segment_size *= (1024 * 1024);
data.segment_size = segment_size;
wl_data_t *wl_data = (wl_data_t *) mymalloc (sizeof (wl_data_t));
wl_data->buf = (char *) mymalloc (segment_size);
wl_data->avail = segment_size;
wl_data->incr = segment_size;
wl_data->buf = (char *) mymalloc (user_options->segment_size);
wl_data->avail = user_options->segment_size;
wl_data->incr = user_options->segment_size;
wl_data->cnt = 0;
wl_data->pos = 0;

View File

@ -202,7 +202,8 @@ int user_options_parse (user_options_t *user_options, int myargc, char **myargv)
case IDX_TRUECRYPT_KEYFILES: user_options->truecrypt_keyfiles = optarg; break;
case IDX_VERACRYPT_KEYFILES: user_options->veracrypt_keyfiles = optarg; break;
case IDX_VERACRYPT_PIM: user_options->veracrypt_pim = atoi (optarg); break;
case IDX_SEGMENT_SIZE: user_options->segment_size = atoi (optarg); break;
case IDX_SEGMENT_SIZE: user_options->segment_size = atoi (optarg);
user_options->segment_size_chgd = true; break;
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = atoi (optarg); break;
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
case IDX_BITMAP_MIN: user_options->bitmap_min = atoi (optarg); break;
@ -353,6 +354,11 @@ int user_options_parse (user_options_t *user_options, int myargc, char **myargv)
user_options->markov_threshold = 0x100;
}
if (user_options->segment_size_chgd == true)
{
user_options->segment_size = user_options->segment_size * (1024 * 1024);
}
return 0;
}