mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-23 15:18:16 +00:00
Add event_set_kernel_power_final()
This commit is contained in:
parent
d993aa5ffa
commit
f469694030
@ -112,6 +112,7 @@ typedef enum event_identifier
|
||||
EVENT_BITMAP_INIT_POST = 0x00000082,
|
||||
EVENT_WEAK_HASH_PRE = 0x00000091,
|
||||
EVENT_WEAK_HASH_POST = 0x00000092,
|
||||
EVENT_SET_KERNEL_POWER_FINAL = 0x000000a1,
|
||||
|
||||
// there will be much more event types soon
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "common.h"
|
||||
#include "types.h"
|
||||
#include "memory.h"
|
||||
#include "logging.h"
|
||||
#include "bitmap.h"
|
||||
|
||||
static u32 generate_bitmaps (const u32 digests_cnt, const u32 dgst_size, const u32 dgst_shifts, char *digests_buf_ptr, const u32 dgst_pos0, const u32 dgst_pos1, const u32 dgst_pos2, const u32 dgst_pos3, const u32 bitmap_mask, const u32 bitmap_size, u32 *bitmap_a, u32 *bitmap_b, u32 *bitmap_c, u32 *bitmap_d, const u64 collisions_max)
|
||||
|
@ -35,21 +35,15 @@
|
||||
#include "shared.h"
|
||||
#include "dispatch.h"
|
||||
|
||||
static void set_kernel_power_final (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const u64 kernel_power_final)
|
||||
static int set_kernel_power_final (hashcat_ctx_t *hashcat_ctx, const u32 kernel_power_final)
|
||||
{
|
||||
if (user_options->quiet == false)
|
||||
{
|
||||
clear_prompt ();
|
||||
EVENT_SEND (EVENT_SET_KERNEL_POWER_FINAL);
|
||||
|
||||
//log_info ("");
|
||||
|
||||
log_info ("INFO: approaching final keyspace, workload adjusted");
|
||||
log_info ("");
|
||||
|
||||
send_prompt ();
|
||||
}
|
||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||
|
||||
opencl_ctx->kernel_power_final = kernel_power_final;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
|
||||
@ -72,8 +66,12 @@ static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
|
||||
return device_param->kernel_power;
|
||||
}
|
||||
|
||||
static u32 get_work (opencl_ctx_t *opencl_ctx, status_ctx_t *status_ctx, const user_options_t *user_options, hc_device_param_t *device_param, const u64 max)
|
||||
static u32 get_work (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 max)
|
||||
{
|
||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
hc_thread_mutex_lock (status_ctx->mux_dispatcher);
|
||||
|
||||
const u64 words_cur = status_ctx->words_cur;
|
||||
@ -89,7 +87,7 @@ static u32 get_work (opencl_ctx_t *opencl_ctx, status_ctx_t *status_ctx, const u
|
||||
{
|
||||
if (opencl_ctx->kernel_power_final == 0)
|
||||
{
|
||||
set_kernel_power_final (opencl_ctx, user_options, words_left);
|
||||
set_kernel_power_final (hashcat_ctx, words_left);
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,7 +253,6 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
hashes_t *hashes = hashcat_ctx->hashes;
|
||||
straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
|
||||
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
|
||||
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
|
||||
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
|
||||
|
||||
const u32 attack_mode = user_options->attack_mode;
|
||||
@ -265,7 +262,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
{
|
||||
while (status_ctx->run_thread_level1 == true)
|
||||
{
|
||||
const u32 work = get_work (opencl_ctx, status_ctx, user_options, device_param, -1u);
|
||||
const u32 work = get_work (hashcat_ctx, device_param, -1u);
|
||||
|
||||
if (work == 0) break;
|
||||
|
||||
@ -407,7 +404,7 @@ static void calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
|
||||
|
||||
while (max)
|
||||
{
|
||||
const u32 work = get_work (opencl_ctx, status_ctx, user_options, device_param, max);
|
||||
const u32 work = get_work (hashcat_ctx, device_param, max);
|
||||
|
||||
if (work == 0) break;
|
||||
|
||||
|
17
src/main.c
17
src/main.c
@ -462,6 +462,21 @@ static int event_bitmap_init_post (hashcat_ctx_t *hashcat_ctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int event_set_kernel_power_final (hashcat_ctx_t *hashcat_ctx)
|
||||
{
|
||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||
|
||||
if (user_options->quiet == true) return 0;
|
||||
|
||||
clear_prompt ();
|
||||
|
||||
log_info ("INFO: approaching final keyspace, workload adjusted");
|
||||
log_info ("");
|
||||
|
||||
send_prompt ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int event (hashcat_ctx_t *hashcat_ctx, const u32 event)
|
||||
{
|
||||
@ -492,6 +507,8 @@ int event (hashcat_ctx_t *hashcat_ctx, const u32 event)
|
||||
case EVENT_BITMAP_INIT_POST: rc = event_bitmap_init_post (hashcat_ctx); break;
|
||||
case EVENT_WEAK_HASH_PRE: rc = event_weak_hash_pre (hashcat_ctx); break;
|
||||
case EVENT_WEAK_HASH_POST: rc = event_weak_hash_post (hashcat_ctx); break;
|
||||
case EVENT_SET_KERNEL_POWER_FINAL: rc = event_set_kernel_power_final (hashcat_ctx); break;
|
||||
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
Loading…
Reference in New Issue
Block a user