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

Fixed a bug when cracking a large salted hashlist: If a word is rejected this produces so high CPU load that cracking process doesn't start

This commit is contained in:
Jens Steube 2016-11-09 02:02:11 +01:00
parent 7958479b62
commit 779662ea23
2 changed files with 32 additions and 26 deletions

View File

@ -17,6 +17,7 @@
- Status display shows what's the base and modifier keyspace currently in use
- Added a workaround for some OpenCL kernel to compile with amd-gpu-pro
- Added option --keep-guessing to continue cracking hashes even after they have been cracked (to find collisions)
- Fixed a bug when cracking a large salted hashlist: If a word is rejected this produces so high CPU load that cracking process doesn't start
##
## Algorithms

View File

@ -154,6 +154,8 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
break;
}
u32 words_extra = 0;
u32 words_buffered = 0;
while (words_buffered < device_param->kernel_power)
@ -196,14 +198,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
{
if ((line_len < hashconfig->pw_min) || (line_len > hashconfig->pw_max))
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
words_extra++;
continue;
}
@ -220,6 +215,18 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
while (status_ctx->run_thread_level1 == false) break;
if (words_extra > 0)
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
}
// flush
const u32 pws_cnt = device_param->pws_cnt;
@ -457,6 +464,8 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
u32 words_extra = -1u;
u32 words_extra_total = 0;
while (words_extra)
{
const u32 work = get_work (hashcat_ctx, device_param, words_extra);
@ -504,15 +513,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{
words_extra++;
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
continue;
}
}
@ -525,15 +525,6 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{
words_extra++;
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += combinator_ctx->combs_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
continue;
}
}
@ -543,11 +534,25 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
if (status_ctx->run_thread_level1 == false) break;
}
words_extra_total += words_extra;
if (status_ctx->run_thread_level1 == false) break;
}
if (status_ctx->run_thread_level1 == false) break;
if (words_extra_total > 0)
{
hc_thread_mutex_lock (status_ctx->mux_counter);
for (u32 salt_pos = 0; salt_pos < hashes->salts_cnt; salt_pos++)
{
status_ctx->words_progress_rejected[salt_pos] += words_extra_total * straight_ctx->kernel_rules_cnt;
}
hc_thread_mutex_unlock (status_ctx->mux_counter);
}
//
// flush
//