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

Add special marker for speed only mode

This commit is contained in:
jsteube 2018-02-12 09:41:46 +01:00
parent 00bd356ade
commit 91e522d094
4 changed files with 32 additions and 10 deletions

View File

@ -1048,6 +1048,7 @@ typedef struct hc_device_param
u32 speed_pos;
u64 speed_cnt[SPEED_CACHE];
double speed_msec[SPEED_CACHE];
bool speed_only_finish;
hc_timer_t timer_speed;

View File

@ -269,7 +269,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
if (status_ctx->run_thread_level1 == false) break;
if (user_options->speed_only == true) break;
if (device_param->speed_only_finish == true) break;
}
device_param->kernel_accel_prev = device_param->kernel_accel;
@ -363,7 +363,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
device_param->pws_cnt = 0;
if (user_options->speed_only == true) break;
if (device_param->speed_only_finish == true) break;
if (status_ctx->run_thread_level2 == true)
{
@ -668,7 +668,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
*/
}
if (user_options->speed_only == true) break;
if (device_param->speed_only_finish == true) break;
if (status_ctx->run_thread_level2 == true)
{

View File

@ -26007,6 +26007,24 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p
if (device_param->kernel_preferred_wgs_multiple_loop2) kernel_threads = MIN (kernel_threads, device_param->kernel_preferred_wgs_multiple_loop2);
}
}
else
{
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
if (device_param->kernel_wgs1) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs1);
}
else
{
if (device_param->kernel_wgs4) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs4);
}
}
else
{
if (device_param->kernel_wgs2) kernel_threads = MIN (kernel_threads, device_param->kernel_wgs2);
}
}
// we'll return a number power of two, makes future processing much more easy
// kernel_threads = power_of_two_floor_32 (kernel_threads);

View File

@ -1322,7 +1322,9 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
device_param->speed_pos = 1;
return -2; // special RC
device_param->speed_only_finish = true;
return 0;
}
}
}
@ -1528,7 +1530,7 @@ int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, con
kernel_threads = MIN (kernel_threads, device_param->kernel_threads);
kernel_threads = power_of_two_floor_32 (kernel_threads);
// kernel_threads = power_of_two_floor_32 (kernel_threads);
while (num_elements % kernel_threads) num_elements++;
@ -2468,10 +2470,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
* benchmark was aborted because too long kernel runtime (slow hashes only)
*/
if (user_options->speed_only == true)
{
if (rc == -2) break;
}
if (device_param->speed_only_finish == true) break;
/**
* speed
@ -2549,6 +2548,8 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->speed_pos = 1;
device_param->speed_only_finish = true;
break;
}
}
@ -2569,7 +2570,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
device_param->outerloop_msec += device_param->speed_msec[0] * m * hashes->salts_cnt;
}
if (user_options->speed_only == true) break;
if (device_param->speed_only_finish == true) break;
//status screen makes use of this, can't reset here
//device_param->innerloop_pos = 0;
@ -6317,6 +6318,8 @@ void opencl_session_reset (hashcat_ctx_t *hashcat_ctx)
memset (device_param->speed_cnt, 0, SPEED_CACHE * sizeof (u64));
memset (device_param->speed_msec, 0, SPEED_CACHE * sizeof (double));
device_param->speed_only_finish = false;
device_param->exec_pos = 0;
memset (device_param->exec_msec, 0, EXEC_CACHE * sizeof (double));