Finished refactoring to remove all global variables
This commit is contained in:
@@ -6,8 +6,6 @@
|
||||
#ifndef _AUTOTUNE_H
|
||||
#define _AUTOTUNE_H
|
||||
|
||||
int autotune (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, status_ctx_t *status_ctx);
|
||||
|
||||
void *thread_autotune (void *p);
|
||||
|
||||
#endif // _AUTOTUNE_H
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
// don't try to simply change this, it will not work
|
||||
#define PW_MIN 0
|
||||
#define PW_MAX 54
|
||||
#define PW_MAX1 (PW_MAX + 1)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _DATA_H
|
||||
#define _DATA_H
|
||||
|
||||
#endif // _DATA_H
|
||||
+1
-1
@@ -21,7 +21,7 @@ int sort_by_dictstat (const void *s1, const void *s2);
|
||||
|
||||
void dictstat_init (dictstat_ctx_t *dictstat_ctx, const user_options_t *user_options, const folder_config_t *folder_config);
|
||||
void dictstat_destroy (dictstat_ctx_t *dictstat_ctx);
|
||||
void dictstat_read (dictstat_ctx_t *dictstat_ctx);
|
||||
void dictstat_read (dictstat_ctx_t *dictstat_ctx, const int comptime);
|
||||
int dictstat_write (dictstat_ctx_t *dictstat_ctx);
|
||||
u64 dictstat_find (dictstat_ctx_t *dictstat_ctx, dictstat_t *d);
|
||||
void dictstat_append (dictstat_ctx_t *dictstat_ctx, dictstat_t *d);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _HASHCAT_H
|
||||
#define _HASHCAT_H
|
||||
|
||||
int hashcat (hashcat_ctx_t *hashcat_ctx, int argc, char **argv);
|
||||
|
||||
#endif // _HASHCAT_H
|
||||
+5
-5
@@ -6,16 +6,16 @@
|
||||
#ifndef _HASH_MANAGEMENT_H
|
||||
#define _HASH_MANAGEMENT_H
|
||||
|
||||
int sort_by_digest_p0p1 (const void *v1, const void *v2);
|
||||
int sort_by_digest_p0p1 (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_salt (const void *v1, const void *v2);
|
||||
int sort_by_hash (const void *v1, const void *v2);
|
||||
int sort_by_hash_no_salt (const void *v1, const void *v2);
|
||||
int sort_by_hash (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_hash_no_salt (const void *v1, const void *v2, void *v3);
|
||||
|
||||
void save_hash (const user_options_t *user_options, const hashconfig_t *hashconfig, const hashes_t *hashes);
|
||||
|
||||
void check_hash (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, plain_t *plain);
|
||||
void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, plain_t *plain);
|
||||
|
||||
int check_cracked (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos);
|
||||
int check_cracked (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const uint salt_pos);
|
||||
|
||||
int hashes_init_stage1 (hashes_t *hashes, const hashconfig_t *hashconfig, potfile_ctx_t *potfile_ctx, outfile_ctx_t *outfile_ctx, user_options_t *user_options, char *hash_or_file);
|
||||
int hashes_init_stage2 (hashes_t *hashes, const hashconfig_t *hashconfig, user_options_t *user_options, status_ctx_t *status_ctx);
|
||||
|
||||
+2
-2
@@ -31,12 +31,12 @@ int run_kernel_bzero (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param,
|
||||
|
||||
int run_copy (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const combinator_ctx_t *combinator_ctx, const uint pws_cnt);
|
||||
|
||||
int run_cracker (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, const mask_ctx_t *mask_ctx, const outfile_ctx_t *outfile_ctx, status_ctx_t *status_ctx, const uint pws_cnt);
|
||||
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const uint pws_cnt);
|
||||
|
||||
int opencl_ctx_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
|
||||
void opencl_ctx_destroy (opencl_ctx_t *opencl_ctx);
|
||||
|
||||
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options);
|
||||
int opencl_ctx_devices_init (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const int comptime);
|
||||
void opencl_ctx_devices_destroy (opencl_ctx_t *opencl_ctx);
|
||||
void opencl_ctx_devices_update_power (opencl_ctx_t *opencl_ctx, const user_options_t *user_options, const user_options_extra_t *user_options_extra, status_ctx_t *status_ctx);
|
||||
void opencl_ctx_devices_kernel_loops (opencl_ctx_t *opencl_ctx, const user_options_extra_t *user_options_extra, const hashconfig_t *hashconfig, const hashes_t *hashes, straight_ctx_t *straight_ctx, combinator_ctx_t *combinator_ctx, mask_ctx_t *mask_ctx);
|
||||
|
||||
+10
-6
@@ -7,15 +7,19 @@
|
||||
#define _POTFILE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define INCR_POT 1000
|
||||
|
||||
int sort_by_pot (const void *v1, const void *v2);
|
||||
int sort_by_salt_buf (const void *v1, const void *v2);
|
||||
int sort_by_pot (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_salt_buf (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_hash_t_salt (const void *v1, const void *v2);
|
||||
int sort_by_hash_t_salt_hccap (const void *v1, const void *v2);
|
||||
|
||||
void hc_qsort_r (void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
||||
void *hc_bsearch_r (const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg);
|
||||
|
||||
void potfile_init (potfile_ctx_t *potfile_ctx, const user_options_t *user_options, const folder_config_t *folder_config);
|
||||
void potfile_format_plain (potfile_ctx_t *potfile_ctx, const unsigned char *plain_ptr, const uint plain_len);
|
||||
int potfile_read_open (potfile_ctx_t *potfile_ctx);
|
||||
@@ -26,10 +30,10 @@ void potfile_write_close (potfile_ctx_t *potfile_ctx);
|
||||
void potfile_write_append (potfile_ctx_t *potfile_ctx, const char *out_buf, u8 *plain_ptr, unsigned int plain_len);
|
||||
void potfile_hash_alloc (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const uint num);
|
||||
void potfile_hash_free (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig);
|
||||
void potfile_show_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *));
|
||||
void potfile_left_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *));
|
||||
void potfile_show_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *));
|
||||
void potfile_left_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *));
|
||||
void potfile_show_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *, void *));
|
||||
void potfile_left_request (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hashes_buf, int (*sort_by_pot) (const void *, const void *, void *));
|
||||
void potfile_show_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *, void *));
|
||||
void potfile_left_request_lm (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, outfile_ctx_t *outfile_ctx, char *input_buf, int input_len, hash_t *hash_left, hash_t *hash_right, int (*sort_by_pot) (const void *, const void *, void *));
|
||||
int potfile_remove_parse (potfile_ctx_t *potfile_ctx, const hashconfig_t *hashconfig, const hashes_t *hashes);
|
||||
void potfile_destroy (potfile_ctx_t *potfile_ctx);
|
||||
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include <windows.h>
|
||||
#endif // _WIN
|
||||
|
||||
void welcome_screen (const user_options_t *user_options, const status_ctx_t *status_ctx);
|
||||
void welcome_screen (const user_options_t *user_options, const status_ctx_t *status_ctx, char *version_tag);
|
||||
void goodbye_screen (const user_options_t *user_options, const status_ctx_t *status_ctx);
|
||||
|
||||
int setup_console ();
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if defined (_WIN)
|
||||
|
||||
BOOL WINAPI sigHandler_default (DWORD sig);
|
||||
@@ -53,6 +54,7 @@ void sigHandler_benchmark (int sig);
|
||||
void hc_signal (void (callback) (int));
|
||||
|
||||
#endif
|
||||
*/
|
||||
|
||||
void mycracked (status_ctx_t *status_ctx);
|
||||
void myabort (status_ctx_t *status_ctx);
|
||||
|
||||
+16
-1
@@ -55,6 +55,10 @@ typedef struct timeval hc_timer_t;
|
||||
|
||||
// thread
|
||||
|
||||
#if defined (_POSIX)
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if defined (_WIN)
|
||||
typedef HANDLE hc_thread_t;
|
||||
typedef CRITICAL_SECTION hc_thread_mutex_t;
|
||||
@@ -1330,6 +1334,8 @@ typedef struct
|
||||
combinator_ctx_t *combinator_ctx;
|
||||
cpt_ctx_t *cpt_ctx;
|
||||
debugfile_ctx_t *debugfile_ctx;
|
||||
dictstat_ctx_t *dictstat_ctx;
|
||||
folder_config_t *folder_config;
|
||||
hashconfig_t *hashconfig;
|
||||
hashes_t *hashes;
|
||||
hwmon_ctx_t *hwmon_ctx;
|
||||
@@ -1347,7 +1353,16 @@ typedef struct
|
||||
tuning_db_t *tuning_db;
|
||||
user_options_extra_t *user_options_extra;
|
||||
user_options_t *user_options;
|
||||
wl_data_t *wl_data;
|
||||
|
||||
} hc_global_data_t;
|
||||
} hashcat_ctx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 tid;
|
||||
|
||||
hashcat_ctx_t *hashcat_ctx;
|
||||
|
||||
} thread_param_t;
|
||||
|
||||
#endif // _TYPES_H
|
||||
|
||||
+1
-1
@@ -6,6 +6,6 @@
|
||||
#ifndef _WEAK_HASH_H
|
||||
#define _WEAK_HASH_H
|
||||
|
||||
void weak_hash_check (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param, const user_options_t *user_options, const user_options_extra_t *user_options_extra, const straight_ctx_t *straight_ctx, const combinator_ctx_t *combinator_ctx, hashconfig_t *hashconfig, hashes_t *hashes, cpt_ctx_t *cpt_ctx, status_ctx_t *status_ctx, const uint salt_pos);
|
||||
void weak_hash_check (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const uint salt_pos);
|
||||
|
||||
#endif // _WEAK_HASH_H
|
||||
|
||||
Reference in New Issue
Block a user