1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 08:08:10 +00:00

fix some datatypes

This commit is contained in:
jsteube 2018-02-08 19:13:29 +01:00
parent 98abea9a0f
commit 05a01d3843
43 changed files with 563 additions and 546 deletions

View File

@ -1990,7 +1990,7 @@ typedef struct
u32 salt_pos;
u32 digest_pos;
u32 hash_pos;
u32 gidvid;
u64 gidvid;
u32 il_pos;
} plain_t;

View File

@ -8,13 +8,13 @@
#include <ctype.h>
bool is_hexify (const u8 *buf, const int len);
int exec_unhexify (const u8 *in_buf, const int in_len, u8 *out_buf, const int out_sz);
bool is_hexify (const u8 *buf, const size_t len);
size_t exec_unhexify (const u8 *in_buf, const size_t in_len, u8 *out_buf, const size_t out_sz);
bool need_hexify (const u8 *buf, const int len, const char separator, bool always_ascii);
void exec_hexify (const u8 *buf, const int len, u8 *out);
bool need_hexify (const u8 *buf, const size_t len, const char separator, bool always_ascii);
void exec_hexify (const u8 *buf, const size_t len, u8 *out);
bool is_valid_hex_string (const u8 *s, const int len);
bool is_valid_hex_string (const u8 *s, const size_t len);
bool is_valid_hex_char (const u8 c);
u8 hex_convert (const u8 c);
@ -42,13 +42,12 @@ u8 bf64_to_int (const u8 c);
u8 int_to_lotus64 (const u8 c);
u8 lotus64_to_int (const u8 c);
int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf);
int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf);
size_t base32_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf);
size_t base32_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf);
size_t base64_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf);
size_t base64_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf);
int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf);
int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf);
void lowercase (u8 *buf, int len);
void uppercase (u8 *buf, int len);
void lowercase (u8 *buf, const size_t len);
void uppercase (u8 *buf, const size_t len);
#endif // _CONVERT_H

View File

@ -12,10 +12,10 @@
u64 count_lines (FILE *fd);
int fgetl (FILE *fp, char *line_buf);
size_t fgetl (FILE *fp, char *line_buf);
size_t superchop_with_length (char *buf, const size_t len);
int in_superchop (char *buf);
size_t in_superchop (char *buf);
#endif // _FILEHANDLING_H

View File

@ -12,8 +12,8 @@
const char *strhlfmt (const u32 hashfile_format);
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len);
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len);
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len);
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len);
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);

View File

@ -1957,7 +1957,7 @@ int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu
* hook functions
*/
void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u32 pws_cnt);
void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt);
/**
* output functions

View File

@ -29,8 +29,8 @@ int hc_clCreateBuffer (hashcat_ctx_t *hashcat_ctx, cl_context context
int hc_clCreateCommandQueue (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_device_id device, cl_command_queue_properties properties, cl_command_queue *command_queue);
int hc_clCreateContext (hashcat_ctx_t *hashcat_ctx, cl_context_properties *properties, cl_uint num_devices, const cl_device_id *devices, void (CL_CALLBACK *pfn_notify) (const char *, const void *, size_t, void *), void *user_data, cl_context *context);
int hc_clCreateKernel (hashcat_ctx_t *hashcat_ctx, cl_program program, const char *kernel_name, cl_kernel *kernel);
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program);
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program);
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, unsigned char **binaries, cl_int *binary_status, cl_program *program);
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, char **strings, const size_t *lengths, cl_program *program);
int hc_clEnqueueCopyBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer, size_t src_offset, size_t dst_offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
int hc_clEnqueueMapBuffer (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t cb, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event, void **buf);
int hc_clEnqueueNDRangeKernel (hashcat_ctx_t *hashcat_ctx, cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim, const size_t *global_work_offset, const size_t *global_work_size, const size_t *local_work_size, cl_uint num_events_in_wait_list, const cl_event *event_wait_list, cl_event *event);
@ -59,9 +59,9 @@ int hc_clWaitForEvents (hashcat_ctx_t *hashcat_ctx, cl_uint num_events
int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 gidd, pw_t *pw);
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos);
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u64 pws_cnt, const u32 fast_iteration, const u32 salt_pos);
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u32 pws_cnt, const u8 chr);
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u64 pws_cnt, const u8 chr);
int run_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num, const u32 event_update, const u32 iteration);
int run_kernel_mp (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 kern_run, const u64 num);
@ -71,8 +71,8 @@ int run_kernel_atinit (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device
int run_kernel_memset (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u32 value, const u64 size);
int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, cl_mem buf, const u64 size);
int run_kernel_decompress (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 num);
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt);
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt);
void generate_source_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *shared_dir, char *source_file);
void generate_cached_kernel_filename (const u32 attack_exec, const u32 attack_kern, const u32 kern_type, const u32 opti_type, char *profile_dir, const char *device_name_chksum, char *cached_file);

View File

@ -58,4 +58,7 @@ void hc_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream);
bool hc_same_files (char *file1, char *file2);
u32 hc_strtoul (const char *nptr, char **endptr, int base);
u64 hc_strtoull (const char *nptr, char **endptr, int base);
#endif // _SHARED_H

View File

@ -82,7 +82,7 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_
char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
u64 status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
double status_get_runtime_msec_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_kernel_accel_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);
int status_get_kernel_loops_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id);

View File

@ -20,6 +20,6 @@
#include <pwd.h>
#endif // _POSIX
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt);
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt);
#endif // _STDOUT_H

View File

@ -892,7 +892,7 @@ typedef struct plain
u32 salt_pos;
u32 digest_pos;
u32 hash_pos;
u32 gidvid;
u64 gidvid;
u32 il_pos;
} plain_t;
@ -945,18 +945,19 @@ typedef struct hc_device_param
u32 kernel_threads_by_wgs_kernel_atinit;
u32 kernel_threads_by_wgs_kernel_decompress;
u32 kernel_loops;
u32 kernel_accel;
u32 kernel_loops_prev;
u32 kernel_accel_prev;
u32 kernel_accel_min;
u32 kernel_accel_max;
u32 kernel_loops;
u32 kernel_loops_prev;
u32 kernel_loops_min;
u32 kernel_loops_max;
u32 kernel_loops_min_sav; // the _sav are required because each -i iteration
u32 kernel_loops_max_sav; // needs to recalculate the kernel_loops_min/max based on the current amplifier count
u32 kernel_accel_min;
u32 kernel_accel_max;
u32 kernel_power;
u32 hardware_power;
u64 kernel_power;
u64 hardware_power;
size_t size_pws;
size_t size_pws_amp;
@ -986,17 +987,17 @@ typedef struct hc_device_param
pw_idx_t *pws_idx;
u32 *pws_comp;
u32 pws_cnt;
u64 pws_cnt;
u64 words_off;
u64 words_done;
u32 outerloop_pos;
u32 outerloop_left;
u64 outerloop_pos;
u64 outerloop_left;
double outerloop_msec;
u64 innerloop_pos;
u64 innerloop_left;
u32 innerloop_pos;
u32 innerloop_left;
u32 exec_pos;
double exec_msec[EXEC_CACHE];
@ -1158,7 +1159,7 @@ typedef struct opencl_ctx
u32 hardware_power_all;
u32 kernel_power_all;
u64 kernel_power_all;
u64 kernel_power_final; // we save that so that all divisions are done from the same base
u32 opencl_platforms_filter;
@ -1757,7 +1758,7 @@ typedef struct device_info
int corespeed_dev;
int memoryspeed_dev;
double runtime_msec_dev;
int progress_dev;
u64 progress_dev;
int kernel_accel_dev;
int kernel_loops_dev;
int kernel_threads_dev;
@ -1934,8 +1935,8 @@ typedef struct cache_generate
typedef struct hashlist_parse
{
u32 hashes_cnt;
u32 hashes_avail;
u64 hashes_cnt;
u64 hashes_avail;
} hashlist_parse_t;
@ -1943,15 +1944,15 @@ typedef struct hashlist_parse
typedef struct event_ctx
{
char old_buf[MAX_OLD_EVENTS][HCBUFSIZ_TINY];
int old_len[MAX_OLD_EVENTS];
int old_cnt;
char old_buf[MAX_OLD_EVENTS][HCBUFSIZ_TINY];
size_t old_len[MAX_OLD_EVENTS];
int old_cnt;
char msg_buf[HCBUFSIZ_TINY];
int msg_len;
bool msg_newline;
char msg_buf[HCBUFSIZ_TINY];
size_t msg_len;
bool msg_newline;
int prev_len;
size_t prev_len;
hc_thread_mutex_t mux_event;

View File

@ -9,7 +9,7 @@
#include <time.h>
#include <inttypes.h>
u32 convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const u32 line_len);
size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_t line_len);
void pw_add (hc_device_param_t *device_param, const u8 *pw_buf, const int pw_len);

View File

@ -71,7 +71,7 @@ int set_cpu_affinity (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx)
do
{
int cpu_id = strtol (next, NULL, 10);
const int cpu_id = (const int) strtol (next, NULL, 10);
if (cpu_id == 0)
{

View File

@ -136,7 +136,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if ((exec_msec * mm) > target_msec)
{
const u32 loops_valid = target_msec / exec_msec;
const u32 loops_valid = (const u32) (target_msec / exec_msec);
kernel_loops_max_reduced = kernel_loops_min * loops_valid;
}
@ -207,7 +207,7 @@ static int autotune (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
double exec_msec_pre_final = try_run (hashcat_ctx, device_param, kernel_accel, kernel_loops);
const u32 exec_left = target_msec / exec_msec_pre_final;
const u32 exec_left = (const u32) (target_msec / exec_msec_pre_final);
const u32 accel_left = kernel_accel_max / kernel_accel;

View File

@ -8,7 +8,7 @@
#include "interface.h"
#include "benchmark.h"
const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
static const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] =
{
0,
100,

View File

@ -28,7 +28,7 @@ static void selftest_to_bitmap (const u32 dgst_shifts, char *digests_buf_ptr, co
bitmap_d[idx3] |= val3;
}
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)
static bool 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)
{
u64 collisions = 0;
@ -63,10 +63,10 @@ static u32 generate_bitmaps (const u32 digests_cnt, const u32 dgst_size, const u
bitmap_c[idx2] |= val2;
bitmap_d[idx3] |= val3;
if (collisions >= collisions_max) return 0x7fffffff;
if (collisions >= collisions_max) return true;
}
return collisions;
return false;
}
int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
@ -122,8 +122,8 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
if ((hashes->digests_cnt & bitmap_mask) == hashes->digests_cnt) break;
if (generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift1, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, hashes->digests_cnt / 2) == 0x7fffffff) continue;
if (generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift2, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, hashes->digests_cnt / 2) == 0x7fffffff) continue;
if (generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift1, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, hashes->digests_cnt / 2) == true) continue;
if (generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift2, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, hashes->digests_cnt / 2) == true) continue;
break;
}
@ -134,8 +134,8 @@ int bitmap_ctx_init (hashcat_ctx_t *hashcat_ctx)
bitmap_size = bitmap_nums * sizeof (u32);
generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift1, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, -1ul);
generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift2, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s2_a, bitmap_s2_b, bitmap_s2_c, bitmap_s2_d, -1ul);
generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift1, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s1_a, bitmap_s1_b, bitmap_s1_c, bitmap_s1_d, -1);
generate_bitmaps (hashes->digests_cnt, hashconfig->dgst_size, bitmap_shift2, (char *) hashes->digests_buf, hashconfig->dgst_pos0, hashconfig->dgst_pos1, hashconfig->dgst_pos2, hashconfig->dgst_pos3, bitmap_mask, bitmap_size, bitmap_s2_a, bitmap_s2_b, bitmap_s2_c, bitmap_s2_d, -1);
if (hashconfig->st_hash != NULL)
{

View File

@ -55,8 +55,7 @@ u64 rotr64 (const u64 a, const u64 n)
u16 byte_swap_16 (const u16 n)
{
return (n & 0xff00) >> 8
| (n & 0x00ff) << 8;
return (u16) ((n >> 8) | (n << 8));
}
u32 byte_swap_32 (const u32 n)

View File

@ -13,7 +13,7 @@
#define FALLTHROUGH
#endif
static bool printable_utf8 (const u8 *buf, const int len)
static bool printable_utf8 (const u8 *buf, const size_t len)
{
u8 a;
int length;
@ -68,9 +68,9 @@ static bool printable_utf8 (const u8 *buf, const int len)
return true;
}
static bool printable_ascii (const u8 *buf, const int len)
static bool printable_ascii (const u8 *buf, const size_t len)
{
for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
{
const u8 c = buf[i];
@ -81,9 +81,9 @@ static bool printable_ascii (const u8 *buf, const int len)
return true;
}
static bool matches_separator (const u8 *buf, const int len, const char separator)
static bool matches_separator (const u8 *buf, const size_t len, const char separator)
{
for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
{
const char c = (char) buf[i];
@ -93,7 +93,7 @@ static bool matches_separator (const u8 *buf, const int len, const char separato
return false;
}
bool is_hexify (const u8 *buf, const int len)
bool is_hexify (const u8 *buf, const size_t len)
{
if (len < 6) return false; // $HEX[] = 6
@ -115,9 +115,9 @@ bool is_hexify (const u8 *buf, const int len)
return true;
}
int exec_unhexify (const u8 *in_buf, const int in_len, u8 *out_buf, const int out_sz)
size_t exec_unhexify (const u8 *in_buf, const size_t in_len, u8 *out_buf, const size_t out_sz)
{
int i, j;
size_t i, j;
for (i = 0, j = 5; j < in_len - 1; i += 1, j += 2)
{
@ -131,7 +131,7 @@ int exec_unhexify (const u8 *in_buf, const int in_len, u8 *out_buf, const int ou
return (i);
}
bool need_hexify (const u8 *buf, const int len, const char separator, bool always_ascii)
bool need_hexify (const u8 *buf, const size_t len, const char separator, bool always_ascii)
{
bool rc = false;
@ -171,11 +171,11 @@ bool need_hexify (const u8 *buf, const int len, const char separator, bool alway
return rc;
}
void exec_hexify (const u8 *buf, const int len, u8 *out)
void exec_hexify (const u8 *buf, const size_t len, u8 *out)
{
const int max_len = (len >= PW_MAX) ? PW_MAX : len;
const size_t max_len = (len >= PW_MAX) ? PW_MAX : len;
for (int i = max_len - 1, j = i * 2; i >= 0; i -= 1, j -= 2)
for (int i = (int) max_len - 1, j = i * 2; i >= 0; i -= 1, j -= 2)
{
u8_to_hex_lower (buf[i], out + j);
}
@ -183,9 +183,9 @@ void exec_hexify (const u8 *buf, const int len, u8 *out)
out[max_len * 2] = 0;
}
bool is_valid_hex_string (const u8 *s, const int len)
bool is_valid_hex_string (const u8 *s, const size_t len)
{
for (int i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
{
const u8 c = s[i];
@ -527,13 +527,13 @@ u8 lotus64_to_int (const u8 c)
return 0;
}
int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf)
size_t base32_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf)
{
const u8 *in_ptr = in_buf;
u8 *out_ptr = out_buf;
for (int i = 0; i < in_len; i += 8)
for (size_t i = 0; i < in_len; i += 8)
{
const u8 out_val0 = f (in_ptr[0] & 0x7f);
const u8 out_val1 = f (in_ptr[1] & 0x7f);
@ -554,25 +554,27 @@ int base32_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf
out_ptr += 5;
}
for (int i = 0; i < in_len; i++)
size_t tmp_len = 0;
for (size_t i = 0; i < in_len; i++, tmp_len++)
{
if (in_buf[i] != '=') continue;
in_len = i;
break;
}
int out_len = (in_len * 5) / 8;
size_t out_len = (tmp_len * 5) / 8;
return out_len;
}
int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf)
size_t base32_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf)
{
const u8 *in_ptr = in_buf;
u8 *out_ptr = out_buf;
for (int i = 0; i < in_len; i += 5)
for (size_t i = 0; i < in_len; i += 5)
{
const u8 out_val0 = f ( ((in_ptr[0] >> 3) & 0x1f));
const u8 out_val1 = f (((in_ptr[0] << 2) & 0x1c) | ((in_ptr[1] >> 6) & 0x03));
@ -608,13 +610,13 @@ int base32_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf
return out_len;
}
int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf)
size_t base64_decode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf)
{
const u8 *in_ptr = in_buf;
u8 *out_ptr = out_buf;
for (int i = 0; i < in_len; i += 4)
for (size_t i = 0; i < in_len; i += 4)
{
const u8 out_val0 = f (in_ptr[0] & 0x7f);
const u8 out_val1 = f (in_ptr[1] & 0x7f);
@ -629,25 +631,27 @@ int base64_decode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf
out_ptr += 3;
}
for (int i = 0; i < in_len; i++)
size_t tmp_len = 0;
for (size_t i = 0; i < in_len; i++, tmp_len++)
{
if (in_buf[i] != '=') continue;
in_len = i;
break;
}
int out_len = (in_len * 6) / 8;
size_t out_len = (tmp_len * 6) / 8;
return out_len;
}
int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf)
size_t base64_encode (u8 (*f) (const u8), const u8 *in_buf, const size_t in_len, u8 *out_buf)
{
const u8 *in_ptr = in_buf;
u8 *out_ptr = out_buf;
for (int i = 0; i < in_len; i += 3)
for (size_t i = 0; i < in_len; i += 3)
{
const u8 out_val0 = f ( ((in_ptr[0] >> 2) & 0x3f));
const u8 out_val1 = f (((in_ptr[0] << 4) & 0x30) | ((in_ptr[1] >> 4) & 0x0f));
@ -675,12 +679,12 @@ int base64_encode (u8 (*f) (const u8), const u8 *in_buf, int in_len, u8 *out_buf
return out_len;
}
void lowercase (u8 *buf, int len)
void lowercase (u8 *buf, const size_t len)
{
for (int i = 0; i < len; i++) buf[i] = tolower (buf[i]);
for (size_t i = 0; i < len; i++) buf[i] = (u8) tolower ((int) buf[i]);
}
void uppercase (u8 *buf, int len)
void uppercase (u8 *buf, const size_t len)
{
for (int i = 0; i < len; i++) buf[i] = toupper (buf[i]);
for (size_t i = 0; i < len; i++) buf[i] = (u8) toupper ((int) buf[i]);
}

View File

@ -14,14 +14,8 @@
int sort_by_dictstat (const void *s1, const void *s2)
{
dictstat_t *d1 = (dictstat_t *) s1;
dictstat_t *d2 = (dictstat_t *) s2;
d2->stat.st_atime = d1->stat.st_atime;
#if defined (STAT_NANOSECONDS_ACCESS_TIME)
d2->stat.STAT_NANOSECONDS_ACCESS_TIME = d1->stat.STAT_NANOSECONDS_ACCESS_TIME;
#endif
const dictstat_t *d1 = (const dictstat_t *) s1;
const dictstat_t *d2 = (const dictstat_t *) s2;
const int rc_from = strcmp (d1->encoding_from, d2->encoding_from);
@ -31,7 +25,21 @@ int sort_by_dictstat (const void *s1, const void *s2)
if (rc_to != 0) return rc_to;
return memcmp (&d1->stat, &d2->stat, sizeof (struct stat));
struct stat stat1;
struct stat stat2;
memcpy (&stat1, &d1->stat, sizeof (struct stat));
memcpy (&stat2, &d2->stat, sizeof (struct stat));
stat1.st_atime = 0;
stat2.st_atime = 0;
#if defined (STAT_NANOSECONDS_ACCESS_TIME)
stat1.STAT_NANOSECONDS_ACCESS_TIME = 0;
stat2.STAT_NANOSECONDS_ACCESS_TIME = 0;
#endif
return memcmp (&s1, &s2, sizeof (struct stat));
}
int dictstat_init (hashcat_ctx_t *hashcat_ctx)

View File

@ -44,7 +44,7 @@ static u64 get_lowest_words_done (const hashcat_ctx_t *hashcat_ctx)
return words_cur;
}
static int set_kernel_power_final (hashcat_ctx_t *hashcat_ctx, const u32 kernel_power_final)
static int set_kernel_power_final (hashcat_ctx_t *hashcat_ctx, const u64 kernel_power_final)
{
EVENT (EVENT_SET_KERNEL_POWER_FINAL);
@ -55,7 +55,7 @@ static int set_kernel_power_final (hashcat_ctx_t *hashcat_ctx, const u32 kernel_
return 0;
}
static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
static u64 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
{
const u64 kernel_power_final = opencl_ctx->kernel_power_final;
@ -79,7 +79,7 @@ static u32 get_power (opencl_ctx_t *opencl_ctx, hc_device_param_t *device_param)
return device_param->kernel_power;
}
static u32 get_work (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 max)
static u64 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;
@ -104,9 +104,9 @@ static u32 get_work (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
}
}
const u32 kernel_power = get_power (opencl_ctx, device_param);
const u64 kernel_power = get_power (opencl_ctx, device_param);
u32 work = MIN (words_left, kernel_power);
u64 work = MIN (words_left, kernel_power);
work = MIN (work, max);
@ -156,7 +156,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
break;
}
u32 words_extra_total = 0;
u64 words_extra_total = 0;
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
memset (device_param->pws_idx, 0, device_param->size_pws_idx);
@ -169,7 +169,7 @@ static int calc_stdin (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_par
size_t line_len = in_superchop (line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
line_len = convert_from_hex (hashcat_ctx, line_buf, (u32) line_len);
// do the on-the-fly encoding
@ -342,7 +342,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
while (status_ctx->run_thread_level1 == true)
{
const u32 work = get_work (hashcat_ctx, device_param, -1u);
const u64 work = get_work (hashcat_ctx, device_param, -1);
if (work == 0) break;
@ -487,16 +487,16 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
u64 words_off = 0;
u64 words_fin = 0;
u32 words_extra = -1u;
u64 words_extra = -1u;
u32 words_extra_total = 0;
u64 words_extra_total = 0;
memset (device_param->pws_comp, 0, device_param->size_pws_comp);
memset (device_param->pws_idx, 0, device_param->size_pws_idx);
while (words_extra)
{
const u32 work = get_work (hashcat_ctx, device_param, words_extra);
const u64 work = get_work (hashcat_ctx, device_param, words_extra);
if (work == 0) break;
@ -516,7 +516,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
{
get_next_word (hashcat_ctx_tmp, fd, &line_buf, &line_len);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
line_len = (u32) convert_from_hex (hashcat_ctx, line_buf, line_len);
// post-process rule engine
@ -591,7 +591,7 @@ static int calc (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param)
// flush
//
const u32 pws_cnt = device_param->pws_cnt;
const u64 pws_cnt = device_param->pws_cnt;
if (pws_cnt)
{

View File

@ -45,13 +45,13 @@ void event_call (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, cons
event_ctx->old_len[i] = event_ctx->old_len[i - 1];
}
u32 copy_len = 0;
size_t copy_len = 0;
if (buf)
{
// truncate the whole buffer if needed (such that it fits into the old_buf):
const u32 max_buf_len = sizeof (event_ctx->old_buf[0]);
const size_t max_buf_len = sizeof (event_ctx->old_buf[0]);
copy_len = MIN (len, max_buf_len - 1);

View File

@ -28,7 +28,7 @@ int hc_lzma1_decompress (const unsigned char *in, SizeT *in_len, unsigned char *
// parameters to LzmaDecode (): unsigned char *dest, size_t *destLen, const unsigned char *src,
// size_t *srcLen, const unsigned char *props, size_t propsSize, ELzmaFinishMode finishMode, ELzmaStatus status, ISzAlloc *alloc
return LzmaDecode (out, out_len, in, in_len, (Byte *) props, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &hc_lzma_mem_alloc);
return LzmaDecode (out, out_len, in, in_len, (const Byte *) props, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &status, &hc_lzma_mem_alloc);
}
int hc_lzma2_decompress (const unsigned char *in, SizeT *in_len, unsigned char *out, SizeT *out_len, const char *props)

View File

@ -38,9 +38,9 @@ u64 count_lines (FILE *fd)
return cnt;
}
int fgetl (FILE *fp, char *line_buf)
size_t fgetl (FILE *fp, char *line_buf)
{
int line_len = 0;
size_t line_len = 0;
while (!feof (fp))
{
@ -113,7 +113,7 @@ size_t superchop_with_length (char *buf, const size_t len)
return new_len;
}
int in_superchop (char *buf)
size_t in_superchop (char *buf)
{
size_t len = strlen (buf);

View File

@ -506,7 +506,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
u32 hashlist_format = HLFMT_HASHCAT;
u32 hashes_avail = 0;
u64 hashes_avail = 0;
if ((user_options->benchmark == false) && (user_options->stdout_flag == false) && (user_options->keyspace == false))
{
@ -733,10 +733,10 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{
char *input_buf = user_options_extra->hc_hash;
u32 input_len = strlen (input_buf);
size_t input_len = strlen (input_buf);
char *hash_buf = NULL;
int hash_len = 0;
char *hash_buf = NULL;
size_t hash_len = 0;
hlfmt_hash (hashcat_ctx, hashlist_format, input_buf, input_len, &hash_buf, &hash_len);
@ -881,7 +881,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
parser_status = hashconfig->parse_func ((u8 *) hash_buf, hash_len, &hashes_buf[hashes_cnt], hashconfig);
parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig);
if (parser_status == PARSER_OK)
{
@ -902,7 +902,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
for (int keyslot_idx = 0; keyslot_idx < LUKS_NUMKEYS; keyslot_idx++)
{
parser_status = luks_parse_hash ((u8 *) hash_buf, hash_len, &hashes_buf[hashes_cnt], hashconfig, keyslot_idx);
parser_status = luks_parse_hash ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig, keyslot_idx);
if (parser_status != PARSER_OK)
{
@ -919,7 +919,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
parser_status = hashconfig->parse_func ((u8 *) hash_buf, hash_len, &hashes_buf[hashes_cnt], hashconfig);
parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig);
if (parser_status == PARSER_OK)
{
@ -954,7 +954,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
{
line_num++;
int line_len = fgetl (fp, line_buf);
const size_t line_len = fgetl (fp, line_buf);
if (line_len == 0) continue;
@ -965,8 +965,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
break;
}
char *hash_buf = NULL;
int hash_len = 0;
char *hash_buf = NULL;
size_t hash_len = 0;
hlfmt_hash (hashcat_ctx, hashlist_format, line_buf, line_len, &hash_buf, &hash_len);
@ -984,8 +984,8 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
if (user_options->username == true)
{
char *user_buf = NULL;
int user_len = 0;
char *user_buf = NULL;
size_t user_len = 0;
hlfmt_user (hashcat_ctx, hashlist_format, line_buf, line_len, &user_buf, &user_len);
@ -1019,7 +1019,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
user_ptr->user_name = hcstrdup ("");
}
user_ptr->user_len = user_len;
user_ptr->user_len = (u32) user_len;
}
}
@ -1095,7 +1095,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, hash_len, &hashes_buf[hashes_cnt], hashconfig);
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig);
if (parser_status < PARSER_GLOBAL_ZERO)
{
@ -1120,7 +1120,7 @@ int hashes_init_stage1 (hashcat_ctx_t *hashcat_ctx)
}
else
{
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, hash_len, &hashes_buf[hashes_cnt], hashconfig);
int parser_status = hashconfig->parse_func ((u8 *) hash_buf, (u32) hash_len, &hashes_buf[hashes_cnt], hashconfig);
if (parser_status < PARSER_GLOBAL_ZERO)
{
@ -1628,9 +1628,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
{
char *tmpdata = (char *) hcmalloc (sizeof (hccapx_t));
const int st_hash_len = strlen (hashconfig->st_hash);
const size_t st_hash_len = strlen (hashconfig->st_hash);
for (int i = 0, j = 0; j < st_hash_len; i += 1, j += 2)
for (size_t i = 0, j = 0; j < st_hash_len; i += 1, j += 2)
{
const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + j);
@ -1653,9 +1653,9 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
FILE *fp = fopen (tmpfile_bin, "wb");
const int st_hash_len = strlen (hashconfig->st_hash);
const size_t st_hash_len = strlen (hashconfig->st_hash);
for (int i = 0; i < st_hash_len; i += 2)
for (size_t i = 0; i < st_hash_len; i += 2)
{
const u8 c = hex_to_u8 ((const u8 *) hashconfig->st_hash + i);
@ -1664,7 +1664,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
fclose (fp);
parser_status = hashconfig->parse_func ((u8 *) tmpfile_bin, strlen (tmpfile_bin), &hash, hashconfig);
parser_status = hashconfig->parse_func ((u8 *) tmpfile_bin, (u32) strlen (tmpfile_bin), &hash, hashconfig);
unlink (tmpfile_bin);
@ -1693,7 +1693,7 @@ int hashes_init_selftest (hashcat_ctx_t *hashcat_ctx)
char *tmpdata = hcstrdup (hashconfig->st_hash);
parser_status = hashconfig->parse_func ((u8 *) tmpdata, strlen (hashconfig->st_hash), &hash, hashconfig_st);
parser_status = hashconfig->parse_func ((u8 *) tmpdata, (u32) strlen (hashconfig->st_hash), &hash, hashconfig_st);
hcfree (tmpdata);

View File

@ -22,7 +22,7 @@ static const char *HLFMT_TEXT_NSLDAPS = "nsldaps";
// hlfmt hashcat
static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len)
static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -34,10 +34,10 @@ static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
}
else
{
char *pos = line_buf;
int len = line_len;
char *pos = line_buf;
size_t len = line_len;
for (int i = 0; i < line_len; i++, pos++, len--)
for (size_t i = 0; i < line_len; i++, pos++, len--)
{
if (line_buf[i] == hashconfig->separator)
{
@ -54,16 +54,16 @@ static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
}
}
static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len)
static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
char *pos = NULL;
int len = 0;
char *pos = NULL;
size_t len = 0;
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == hashconfig->separator)
{
@ -86,14 +86,14 @@ static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
// hlfmt pwdump
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
{
int sep_cnt = 0;
int sep2_len = 0;
int sep3_len = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -111,16 +111,16 @@ static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c
return 0;
}
static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len)
static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len)
{
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
char *pos = NULL;
int len = 0;
char *pos = NULL;
size_t len = 0;
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -153,14 +153,14 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
*hashbuf_len = len;
}
static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len)
static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
{
char *pos = NULL;
int len = 0;
char *pos = NULL;
size_t len = 0;
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -183,14 +183,14 @@ static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
// hlfmt passwd
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
{
int sep_cnt = 0;
char sep5_first = 0;
char sep6_first = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -208,14 +208,14 @@ static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c
return 0;
}
static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len)
static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len)
{
char *pos = NULL;
int len = 0;
char *pos = NULL;
size_t len = 0;
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -236,14 +236,14 @@ static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
*hashbuf_len = len;
}
static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len)
static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
{
char *pos = NULL;
int len = 0;
char *pos = NULL;
size_t len = 0;
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':')
{
@ -266,11 +266,11 @@ static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
// hlfmt shadow
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, int line_len)
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
{
int sep_cnt = 0;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (line_buf[i] == ':') sep_cnt++;
}
@ -280,12 +280,12 @@ static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c
return 0;
}
static void hlfmt_hash_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len)
static void hlfmt_hash_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len)
{
hlfmt_hash_passwd (hashcat_ctx, line_buf, line_len, hashbuf_pos, hashbuf_len);
}
static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len)
static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
{
hlfmt_user_passwd (hashcat_ctx, line_buf, line_len, userbuf_pos, userbuf_len);
}
@ -311,7 +311,7 @@ const char *strhlfmt (const u32 hashfile_format)
return "Unknown";
}
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **hashbuf_pos, int *hashbuf_len)
void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **hashbuf_pos, size_t *hashbuf_len)
{
switch (hashfile_format)
{
@ -322,7 +322,7 @@ void hlfmt_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf
}
}
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, int line_len, char **userbuf_pos, int *userbuf_len)
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
{
switch (hashfile_format)
{
@ -350,7 +350,7 @@ u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check)
while (!feof (fp))
{
int line_len = fgetl (fp, line_buf);
const size_t line_len = fgetl (fp, line_buf);
if (line_len == 0) continue;

View File

@ -25,7 +25,10 @@ static int sort_by_mtime (const void *p1, const void *p2)
if (rc1 < rc2) return 1;
if (rc1 > rc2) return -1;
return s2.st_mtime - s1.st_mtime;
if (s1.st_mtime < s2.st_mtime) return 1;
if (s1.st_mtime > s2.st_mtime) return -1;
return 0;
}
int induct_ctx_init (hashcat_ctx_t *hashcat_ctx)

View File

@ -2606,7 +2606,7 @@ int bcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
u8 *iter_pos = input_buf + 4;
salt->salt_iter = 1u << strtoul ((const char *) iter_pos, NULL, 10);
salt->salt_iter = 1u << hc_strtoul ((const char *) iter_pos, NULL, 10);
u8 *salt_pos = (u8 *) strchr ((const char *) iter_pos, '$');
@ -3069,7 +3069,7 @@ int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
salt_t *salt = hash_buf->salt;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1)
{
@ -3205,8 +3205,8 @@ int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
contents_pos++;
u32 version = strtoul ((const char *) version_pos, NULL, 10);
u32 contents_len = strtoul ((const char *) contents_len_pos, NULL, 10);
u32 version = hc_strtoul ((const char *) version_pos, NULL, 10);
u32 contents_len = hc_strtoul ((const char *) contents_len_pos, NULL, 10);
if (version == 1 && contents_len != 208) return (PARSER_SALT_LENGTH);
if (version == 2 && contents_len != 288) return (PARSER_SALT_LENGTH);
@ -3219,9 +3219,9 @@ int dpapimk_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
if (effective_contents_len != contents_len) return (PARSER_SALT_LENGTH);
dpapimk->context = strtoul ((const char *) context_pos, NULL, 10);
dpapimk->context = hc_strtoul ((const char *) context_pos, NULL, 10);
salt->salt_iter = strtoul ((const char *) rounds_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10) - 1;
dpapimk->iv[0] = hex_to_u32 ((const u8 *) &iv_pos[ 0]);
dpapimk->iv[1] = hex_to_u32 ((const u8 *) &iv_pos[ 8]);
@ -3682,7 +3682,7 @@ int md5crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
salt_pos[0] = 0x0;
salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt_pos += 1;
@ -3741,7 +3741,7 @@ int md5apr1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
salt_pos[0] = 0x0;
salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt_pos += 1;
@ -5732,7 +5732,7 @@ int sha512crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB
salt_pos[0] = 0x0;
salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt_pos += 1;
@ -6494,9 +6494,9 @@ int sha1aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
u8 salt_iter[3] = { iter_pos[0], iter_pos[1], 0 };
salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1;
salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1;
hash_pos++;
@ -6543,9 +6543,9 @@ int sha256aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 };
salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1;
salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1;
hash_pos++;
@ -6595,9 +6595,9 @@ int sha512aix_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
char salt_iter[3] = { iter_pos[0], iter_pos[1], 0 };
salt->salt_sign[0] = strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_sign[0] = hc_strtoul ((const char *) salt_iter, NULL, 10);
salt->salt_iter = (1u << strtoul ((const char *) salt_iter, NULL, 10)) - 1;
salt->salt_iter = (1u << hc_strtoul ((const char *) salt_iter, NULL, 10)) - 1;
hash_pos++;
@ -6659,7 +6659,7 @@ int agilekey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
* pbkdf2 iterations
*/
salt->salt_iter = strtoul ((const char *) iterations_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) iterations_pos, NULL, 10) - 1;
/**
* handle salt encoding
@ -6769,7 +6769,7 @@ int lastpass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
salt->salt_len = salt_len;
salt->salt_iter = strtoul ((const char *) iterations_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) iterations_pos, NULL, 10) - 1;
if (is_valid_hex_string (hashbuf_pos, 32) == false) return (PARSER_HASH_ENCODING);
@ -6829,7 +6829,7 @@ int sha256crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB
salt_pos[0] = 0x0;
salt->salt_iter = strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) (salt_pos - iterations_len), NULL, 10);
salt_pos += 1;
@ -6932,7 +6932,7 @@ int sha512macos_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB
salt->salt_buf[0] = pbkdf2_sha512->salt_buf[0];
salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1;
return (PARSER_OK);
}
@ -7067,7 +7067,7 @@ int sha512grub_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
salt->salt_len = salt_len;
salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1;
return (PARSER_OK);
}
@ -7958,7 +7958,7 @@ int cloudkey_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
// iteration
salt->salt_iter = strtoul ((const char *) iteration_pos, NULL, 10) - 1;
salt->salt_iter = hc_strtoul ((const char *) iteration_pos, NULL, 10) - 1;
// data
@ -8098,7 +8098,7 @@ int nsec3_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUS
// iteration
salt->salt_iter = strtoul ((const char *) iteration_pos, NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) iteration_pos, NULL, 10);
return (PARSER_OK);
}
@ -8397,7 +8397,7 @@ int lotus8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
tmp_iter_buf[10] = 0;
salt->salt_iter = strtoul ((const char *) tmp_iter_buf, NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) tmp_iter_buf, NULL, 10);
if (salt->salt_iter < 1) // well, the limit hopefully is much higher
{
@ -8779,7 +8779,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
N_pos++;
salt->scrypt_N = strtoul ((const char *) N_pos, NULL, 10);
salt->scrypt_N = hc_strtoul ((const char *) N_pos, NULL, 10);
// r
@ -8789,7 +8789,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
r_pos++;
salt->scrypt_r = strtoul ((const char *) r_pos, NULL, 10);
salt->scrypt_r = hc_strtoul ((const char *) r_pos, NULL, 10);
// p
@ -8799,7 +8799,7 @@ int scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNU
p_pos++;
salt->scrypt_p = strtoul ((const char *) p_pos, NULL, 10);
salt->scrypt_p = hc_strtoul ((const char *) p_pos, NULL, 10);
// salt
@ -9089,10 +9089,10 @@ int office2007_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
if (osalt_len != 32) return (PARSER_SALT_LENGTH);
if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH);
const u32 version = strtoul ((const char *) version_pos, NULL, 10);
const u32 verifierHashSize = strtoul ((const char *) verifierHashSize_pos, NULL, 10);
const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10);
const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10);
const u32 verifierHashSize = hc_strtoul ((const char *) verifierHashSize_pos, NULL, 10);
const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10);
if (version != 2007) return (PARSER_SALT_VALUE);
if (verifierHashSize != 20) return (PARSER_SALT_VALUE);
@ -9239,10 +9239,10 @@ int office2010_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
if (osalt_len != 32) return (PARSER_SALT_LENGTH);
if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH);
const u32 version = strtoul ((const char *) version_pos, NULL, 10);
const u32 spinCount = strtoul ((const char *) spinCount_pos, NULL, 10);
const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10);
const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10);
const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10);
const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10);
if (version != 2010) return (PARSER_SALT_VALUE);
if (spinCount != 100000) return (PARSER_SALT_VALUE);
@ -9393,10 +9393,10 @@ int office2013_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
if (osalt_len != 32) return (PARSER_SALT_LENGTH);
if (encryptedVerifier_len != 32) return (PARSER_SALT_LENGTH);
const u32 version = strtoul ((const char *) version_pos, NULL, 10);
const u32 spinCount = strtoul ((const char *) spinCount_pos, NULL, 10);
const u32 keySize = strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = strtoul ((const char *) saltSize_pos, NULL, 10);
const u32 version = hc_strtoul ((const char *) version_pos, NULL, 10);
const u32 spinCount = hc_strtoul ((const char *) spinCount_pos, NULL, 10);
const u32 keySize = hc_strtoul ((const char *) keySize_pos, NULL, 10);
const u32 saltSize = hc_strtoul ((const char *) saltSize_pos, NULL, 10);
if (version != 2013) return (PARSER_SALT_VALUE);
if (spinCount != 100000) return (PARSER_SALT_VALUE);
@ -10311,7 +10311,7 @@ int saph_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
u8 *iter_pos = input_buf + 10;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1)
{
@ -11255,9 +11255,9 @@ int pdf17l8_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
if ((enc_md != 0) && (enc_md != 1)) return (PARSER_SALT_VALUE);
const u32 id_len = strtoul ((const char *) id_len_pos, NULL, 10);
const u32 u_len = strtoul ((const char *) u_len_pos, NULL, 10);
const u32 o_len = strtoul ((const char *) o_len_pos, NULL, 10);
const u32 id_len = hc_strtoul ((const char *) id_len_pos, NULL, 10);
const u32 u_len = hc_strtoul ((const char *) u_len_pos, NULL, 10);
const u32 o_len = hc_strtoul ((const char *) o_len_pos, NULL, 10);
if (V_len > 6) return (PARSER_SALT_LENGTH);
if (R_len > 6) return (PARSER_SALT_LENGTH);
@ -11321,7 +11321,7 @@ int pbkdf2_sha256_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
u8 *iter_pos = input_buf + 7;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
if (iter > 999999) return (PARSER_SALT_ITERATION);
@ -11644,10 +11644,10 @@ int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, M
u32 public_key_buf_len = input_len - 1 - 7 - 1 - cry_master_len_len - 1 - cry_master_buf_len - 1 - cry_salt_len_len - 1 - cry_salt_buf_len - 1 - cry_rounds_len - 1 - ckey_len_len - 1 - ckey_buf_len - 1 - public_key_len_len - 1;
const u32 cry_master_len = strtoul ((const char *) cry_master_len_pos, NULL, 10);
const u32 cry_salt_len = strtoul ((const char *) cry_salt_len_pos, NULL, 10);
const u32 ckey_len = strtoul ((const char *) ckey_len_pos, NULL, 10);
const u32 public_key_len = strtoul ((const char *) public_key_len_pos, NULL, 10);
const u32 cry_master_len = hc_strtoul ((const char *) cry_master_len_pos, NULL, 10);
const u32 cry_salt_len = hc_strtoul ((const char *) cry_salt_len_pos, NULL, 10);
const u32 ckey_len = hc_strtoul ((const char *) ckey_len_pos, NULL, 10);
const u32 public_key_len = hc_strtoul ((const char *) public_key_len_pos, NULL, 10);
if (cry_master_buf_len != cry_master_len) return (PARSER_SALT_VALUE);
if (cry_salt_buf_len != cry_salt_len) return (PARSER_SALT_VALUE);
@ -11694,7 +11694,7 @@ int bitcoin_wallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, M
if (cry_rounds_len >= 7) return (PARSER_SALT_VALUE);
const u32 cry_rounds = strtoul ((const char *) cry_rounds_pos, NULL, 10);
const u32 cry_rounds = hc_strtoul ((const char *) cry_rounds_pos, NULL, 10);
salt->salt_iter = cry_rounds - 1;
@ -11737,7 +11737,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
URI_client_pos[0] = 0;
URI_client_pos++;
u32 URI_server_len = strlen ((const char *) URI_server_pos);
size_t URI_server_len = strlen ((const char *) URI_server_pos);
if (URI_server_len > 512) return (PARSER_SALT_LENGTH);
@ -11750,7 +11750,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
user_pos[0] = 0;
user_pos++;
u32 URI_client_len = strlen ((const char *) URI_client_pos);
size_t URI_client_len = strlen ((const char *) URI_client_pos);
if (URI_client_len > 512) return (PARSER_SALT_LENGTH);
@ -11763,7 +11763,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
realm_pos[0] = 0;
realm_pos++;
u32 user_len = strlen ((const char *) user_pos);
size_t user_len = strlen ((const char *) user_pos);
if (user_len > 116) return (PARSER_SALT_LENGTH);
@ -11776,7 +11776,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
method_pos[0] = 0;
method_pos++;
u32 realm_len = strlen ((const char *) realm_pos);
size_t realm_len = strlen ((const char *) realm_pos);
if (realm_len > 116) return (PARSER_SALT_LENGTH);
@ -11789,7 +11789,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
URI_prefix_pos[0] = 0;
URI_prefix_pos++;
u32 method_len = strlen ((const char *) method_pos);
size_t method_len = strlen ((const char *) method_pos);
if (method_len > 246) return (PARSER_SALT_LENGTH);
@ -11802,7 +11802,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
URI_resource_pos[0] = 0;
URI_resource_pos++;
u32 URI_prefix_len = strlen ((const char *) URI_prefix_pos);
size_t URI_prefix_len = strlen ((const char *) URI_prefix_pos);
if (URI_prefix_len > 245) return (PARSER_SALT_LENGTH);
@ -11815,7 +11815,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
URI_suffix_pos[0] = 0;
URI_suffix_pos++;
u32 URI_resource_len = strlen ((const char *) URI_resource_pos);
size_t URI_resource_len = strlen ((const char *) URI_resource_pos);
if (URI_resource_len < 1 || URI_resource_len > 246) return (PARSER_SALT_LENGTH);
@ -11828,7 +11828,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
nonce_pos[0] = 0;
nonce_pos++;
u32 URI_suffix_len = strlen ((const char *) URI_suffix_pos);
size_t URI_suffix_len = strlen ((const char *) URI_suffix_pos);
if (URI_suffix_len > 245) return (PARSER_SALT_LENGTH);
@ -11841,7 +11841,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
nonce_client_pos[0] = 0;
nonce_client_pos++;
u32 nonce_len = strlen ((const char *) nonce_pos);
size_t nonce_len = strlen ((const char *) nonce_pos);
if (nonce_len < 1 || nonce_len > 50) return (PARSER_SALT_LENGTH);
@ -11854,7 +11854,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
nonce_count_pos[0] = 0;
nonce_count_pos++;
u32 nonce_client_len = strlen ((const char *) nonce_client_pos);
size_t nonce_client_len = strlen ((const char *) nonce_client_pos);
if (nonce_client_len > 50) return (PARSER_SALT_LENGTH);
@ -11867,7 +11867,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
qop_pos[0] = 0;
qop_pos++;
u32 nonce_count_len = strlen ((const char *) nonce_count_pos);
size_t nonce_count_len = strlen ((const char *) nonce_count_pos);
if (nonce_count_len > 50) return (PARSER_SALT_LENGTH);
@ -11880,7 +11880,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
directive_pos[0] = 0;
directive_pos++;
u32 qop_len = strlen ((const char *) qop_pos);
size_t qop_len = strlen ((const char *) qop_pos);
if (qop_len > 50) return (PARSER_SALT_LENGTH);
@ -11893,7 +11893,7 @@ int sip_auth_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
digest_pos[0] = 0;
digest_pos++;
u32 directive_len = strlen ((const char *) directive_pos);
size_t directive_len = strlen ((const char *) directive_pos);
if (directive_len != 3) return (PARSER_SALT_LENGTH);
@ -12239,13 +12239,13 @@ int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
data_buf_len = input_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1;
}
const u32 iter = strtoul ((const char *) NumCyclesPower_pos, NULL, 10);
const u32 crc = strtoul ((const char *) crc_buf_pos, NULL, 10);
const u32 data_type = strtoul ((const char *) data_type_pos, NULL, 10);
const u32 salt_len = strtoul ((const char *) salt_len_pos, NULL, 10);
const u32 iv_len = strtoul ((const char *) iv_len_pos, NULL, 10);
const u32 unpack_size = strtoul ((const char *) unpack_size_pos, NULL, 10);
const u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10);
const u32 iter = hc_strtoul ((const char *) NumCyclesPower_pos, NULL, 10);
const u32 crc = hc_strtoul ((const char *) crc_buf_pos, NULL, 10);
const u32 data_type = hc_strtoul ((const char *) data_type_pos, NULL, 10);
const u32 salt_len = hc_strtoul ((const char *) salt_len_pos, NULL, 10);
const u32 iv_len = hc_strtoul ((const char *) iv_len_pos, NULL, 10);
const u32 unpack_size = hc_strtoul ((const char *) unpack_size_pos, NULL, 10);
const u32 data_len = hc_strtoul ((const char *) data_len_pos, NULL, 10);
// if neither uncompressed nor truncated, then we need the length for crc and coder attributes
@ -12259,7 +12259,7 @@ int seven_zip_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_
coder_attributes_len = input_len - 1 - 2 - 1 - data_type_len - 1 - NumCyclesPower_len - 1 - salt_len_len - 1 - salt_buf_len - 1 - iv_len_len - 1 - iv_buf_len - 1 - crc_buf_len - 1 - data_len_len - 1 - unpack_size_len - 1 - data_buf_len - 1 - crc_len_len - 1;
crc_len = strtoul ((const char *) crc_len_pos, NULL, 10);
crc_len = hc_strtoul ((const char *) crc_len_pos, NULL, 10);
}
/**
@ -12468,7 +12468,7 @@ int pbkdf2_md5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
u8 *iter_pos = input_buf + 4;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
if (iter > 999999) return (PARSER_SALT_ITERATION);
@ -12552,7 +12552,7 @@ int pbkdf2_sha1_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYB
u8 *iter_pos = input_buf + 5;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
if (iter > 999999) return (PARSER_SALT_ITERATION);
@ -12641,7 +12641,7 @@ int pbkdf2_sha512_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
u8 *iter_pos = input_buf + 7;
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
if (iter > 999999) return (PARSER_SALT_ITERATION);
@ -12968,9 +12968,9 @@ int rar5_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
u8 *iv = param3_pos;
u8 *pswcheck = param5_pos;
const u32 salt_len = strtoul ((const char *) param0_pos, NULL, 10);
const u32 iterations = strtoul ((const char *) param2_pos, NULL, 10);
const u32 pswcheck_len = strtoul ((const char *) param4_pos, NULL, 10);
const u32 salt_len = hc_strtoul ((const char *) param0_pos, NULL, 10);
const u32 iterations = hc_strtoul ((const char *) param2_pos, NULL, 10);
const u32 pswcheck_len = hc_strtoul ((const char *) param4_pos, NULL, 10);
/**
* verify some data
@ -13160,7 +13160,7 @@ int axcrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
u8 *data_pos;
salt->salt_iter = strtoul ((const char *) wrapping_rounds_pos, NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) wrapping_rounds_pos, NULL, 10);
salt_pos = (u8 *) strchr ((const char *) wrapping_rounds_pos, '*');
@ -13268,7 +13268,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
version_pos = input_buf + 8 + 1 + 1;
keepass->version = strtoul ((const char *) version_pos, NULL, 10);
keepass->version = hc_strtoul ((const char *) version_pos, NULL, 10);
rounds_pos = (u8 *) strchr ((const char *) version_pos, '*');
@ -13276,7 +13276,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
rounds_pos++;
salt->salt_iter = strtoul ((const char *) rounds_pos, NULL, 10);
salt->salt_iter = hc_strtoul ((const char *) rounds_pos, NULL, 10);
algorithm_pos = (u8 *) strchr ((const char *) rounds_pos, '*');
@ -13284,7 +13284,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
algorithm_pos++;
keepass->algorithm = strtoul ((const char *) algorithm_pos, NULL, 10);
keepass->algorithm = hc_strtoul ((const char *) algorithm_pos, NULL, 10);
final_random_seed_pos = (u8 *) strchr ((const char *) algorithm_pos, '*');
@ -13415,7 +13415,7 @@ int keepass_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
inline_flag_pos++;
u32 inline_flag = strtoul ((const char *) inline_flag_pos, NULL, 10);
u32 inline_flag = hc_strtoul ((const char *) inline_flag_pos, NULL, 10);
if (inline_flag != 1) return (PARSER_SALT_LENGTH);
@ -13744,7 +13744,7 @@ int mywallet_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_U
if (data_buf_len % 16) return (PARSER_HASH_LENGTH);
u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10);
u32 data_len = hc_strtoul ((const char *) data_len_pos, NULL, 10);
if ((data_len * 2) != data_buf_len) return (PARSER_HASH_LENGTH);
@ -13838,11 +13838,11 @@ int mywalletv2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE
if (data_buf_len % 16) return (PARSER_HASH_LENGTH);
u32 data_len = strtoul ((const char *) data_len_pos, NULL, 10);
u32 data_len = hc_strtoul ((const char *) data_len_pos, NULL, 10);
if ((data_len * 2) != data_buf_len) return (PARSER_HASH_LENGTH);
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
/**
* salt
@ -13943,7 +13943,7 @@ int ms_drsr_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UN
salt->salt_len = salt_len / 2;
salt->salt_iter = strtoul ((const char *) iter_pos, NULL, 10) - 1ul;
salt->salt_iter = hc_strtoul ((const char *) iter_pos, NULL, 10) - 1ul;
/**
* digest buf
@ -14133,9 +14133,9 @@ int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
u32 param7_len = param8_pos - param7_pos;
const u32 type = strtoul ((const char *) param0_pos, NULL, 10);
const u32 mode = strtoul ((const char *) param1_pos, NULL, 10);
const u32 magic = strtoul ((const char *) param2_pos, NULL, 10);
const u32 type = hc_strtoul ((const char *) param0_pos, NULL, 10);
const u32 mode = hc_strtoul ((const char *) param1_pos, NULL, 10);
const u32 magic = hc_strtoul ((const char *) param2_pos, NULL, 10);
u8 *salt_buf = param3_pos;
@ -14146,7 +14146,7 @@ int zip2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE
return (PARSER_SALT_VALUE);
}
const u32 compress_length = strtoul ((const char *) param5_pos, NULL, 10);
const u32 compress_length = hc_strtoul ((const char *) param5_pos, NULL, 10);
u8 *data_buf = param6_pos;
u8 *auth = param7_pos;
@ -14893,7 +14893,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
if ((version_len != 1) && (version_len != 2)) return (PARSER_SEPARATOR_UNMATCHED);
u32 version = strtoul ((const char *) version_pos, NULL, 10);
u32 version = hc_strtoul ((const char *) version_pos, NULL, 10);
if (hash_mode == 14700)
{
@ -14909,7 +14909,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
if (iter_len < 1) return (PARSER_SALT_ITERATION);
if (iter_len > 6) return (PARSER_SALT_ITERATION);
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
@ -14930,7 +14930,7 @@ int itunes_backup_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MA
if (dpic_len < 1) return (PARSER_SALT_ITERATION);
if (dpic_len > 9) return (PARSER_SALT_ITERATION);
dpic = strtoul ((const char *) dpic_pos, NULL, 10);
dpic = hc_strtoul ((const char *) dpic_pos, NULL, 10);
if (dpic < 1) return (PARSER_SALT_ITERATION);
@ -15275,7 +15275,7 @@ int netbsd_sha1crypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf,
* verify data
*/
u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 99) return (PARSER_SALT_ITERATION); // (actually: CRYPT_SHA1_ITERATIONS should be 24680 or more)
@ -15607,7 +15607,7 @@ int ethereum_pbkdf2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf,
* verify some data
*/
const u32 iter = strtoul ((const char *) iter_pos, NULL, 10);
const u32 iter = hc_strtoul ((const char *) iter_pos, NULL, 10);
if (iter < 1) return (PARSER_SALT_ITERATION);
@ -15747,9 +15747,9 @@ int ethereum_scrypt_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf,
* verify some data
*/
const u32 scrypt_N = strtoul ((const char *) scryptN_pos, NULL, 10);
const u32 scrypt_r = strtoul ((const char *) scryptr_pos, NULL, 10);
const u32 scrypt_p = strtoul ((const char *) scryptp_pos, NULL, 10);
const u32 scrypt_N = hc_strtoul ((const char *) scryptN_pos, NULL, 10);
const u32 scrypt_r = hc_strtoul ((const char *) scryptr_pos, NULL, 10);
const u32 scrypt_p = hc_strtoul ((const char *) scryptp_pos, NULL, 10);
if (salt_len != 64) return (PARSER_SALT_LENGTH);
if (ciphertext_len != 64) return (PARSER_SALT_LENGTH);
@ -16000,8 +16000,8 @@ int apple_secure_notes_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_bu
* verify some data
*/
const u32 Z_PK = strtoul ((const char *) Z_PK_pos, NULL, 10);
const u32 ZCRYPTOITERATIONCOUNT = strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10);
const u32 Z_PK = hc_strtoul ((const char *) Z_PK_pos, NULL, 10);
const u32 ZCRYPTOITERATIONCOUNT = hc_strtoul ((const char *) ZCRYPTOITERATIONCOUNT_pos, NULL, 10);
if (ZCRYPTOSALT_len != 32) return (PARSER_SALT_ENCODING);
if (ZCRYPTOWRAPPEDKEY_len != 48) return (PARSER_SALT_ENCODING);
@ -16402,7 +16402,7 @@ int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf
* verify some data
*/
const u32 salt_type = strtoul ((const char *) salt_type_pos, NULL, 10);
const u32 salt_type = hc_strtoul ((const char *) salt_type_pos, NULL, 10);
if ((salt_type == 1) || (salt_type == 2) || (salt_type == 3))
{
@ -16471,7 +16471,7 @@ int electrum_wallet13_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf
* hook functions
*/
void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u32 pws_cnt)
void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf, const u32 salt_pos, const u64 pws_cnt)
{
seven_zip_hook_t *hook_items = (seven_zip_hook_t *) device_param->hooks_buf;
@ -16482,7 +16482,7 @@ void seven_zip_hook_func (hc_device_param_t *device_param, void *hook_salts_buf,
u32 *data_buf = seven_zip->data_buf;
u32 unpack_size = seven_zip->unpack_size;
for (u32 pw_pos = 0; pw_pos < pws_cnt; pw_pos++)
for (u64 pw_pos = 0; pw_pos < pws_cnt; pw_pos++)
{
// this hook data needs to be updated (the "hook_success" variable):
@ -26010,12 +26010,12 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p
if (user_options->workload_profile == 4)
{
kernel_threads = device_param->device_maxworkgroup_size;
kernel_threads = (u32) device_param->device_maxworkgroup_size;
}
// and (2) an opencl device can force an lower value (limited resources on device)
kernel_threads = MIN (kernel_threads, device_param->device_maxworkgroup_size);
kernel_threads = MIN (kernel_threads, (u32) device_param->device_maxworkgroup_size);
// and (3) if an OpenCL device allows a very high thread count (for example 1024 on nvidia),
// the host memory required is 32 times as high with 32 (It jumps from 128MB to 4GB device memory requirement).

View File

@ -25,13 +25,13 @@
int _dowildcard = -1;
#endif
static void main_log_clear_line (MAYBE_UNUSED const int prev_len, MAYBE_UNUSED FILE *fp)
static void main_log_clear_line (MAYBE_UNUSED const size_t prev_len, MAYBE_UNUSED FILE *fp)
{
#if defined (_WIN)
fputc ('\r', fp);
for (int i = 0; i < prev_len; i++)
for (size_t i = 0; i < prev_len; i++)
{
fputc (' ', fp);
}
@ -49,13 +49,13 @@ static void main_log (hashcat_ctx_t *hashcat_ctx, FILE *fp, const int loglevel)
{
event_ctx_t *event_ctx = hashcat_ctx->event_ctx;
const char *msg_buf = event_ctx->msg_buf;
const int msg_len = event_ctx->msg_len;
const bool msg_newline = event_ctx->msg_newline;
const char *msg_buf = event_ctx->msg_buf;
const size_t msg_len = event_ctx->msg_len;
const bool msg_newline = event_ctx->msg_newline;
// handle last_len
const int prev_len = event_ctx->prev_len;
const size_t prev_len = event_ctx->prev_len;
if (prev_len)
{
@ -847,16 +847,16 @@ static void main_hashlist_parse_hash (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, M
const hashlist_parse_t *hashlist_parse = (const hashlist_parse_t *) buf;
const u32 hashes_cnt = hashlist_parse->hashes_cnt;
const u32 hashes_avail = hashlist_parse->hashes_avail;
const u64 hashes_cnt = hashlist_parse->hashes_cnt;
const u64 hashes_avail = hashlist_parse->hashes_avail;
if (hashes_cnt < hashes_avail)
{
event_log_info_nn (hashcat_ctx, "Parsing Hashes: %u/%u (%0.2f%%)...", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100.0);
event_log_info_nn (hashcat_ctx, "Parsing Hashes: %" PRIu64 "/%" PRIu64 " (%0.2f%%)...", hashes_cnt, hashes_avail, ((double) hashes_cnt / hashes_avail) * 100.0);
}
else
{
event_log_info_nn (hashcat_ctx, "Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt, hashes_avail, 100.0);
event_log_info_nn (hashcat_ctx, "Parsed Hashes: %" PRIu64 "/%" PRIu64 " (%0.2f%%)", hashes_cnt, hashes_avail, 100.0);
}
}

View File

@ -99,10 +99,6 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
// timer
time_t last_temp_check_time;
time (&last_temp_check_time);
u32 slowdown_warnings = 0;
u32 performance_warnings = 0;
@ -151,14 +147,6 @@ static int monitor (hashcat_ctx_t *hashcat_ctx)
{
hc_thread_mutex_lock (status_ctx->mux_hwmon);
time_t temp_check_time;
time (&temp_check_time);
u32 Ta = temp_check_time - last_temp_check_time; // set Ta = sleep_time; is not good enough (see --remove etc)
if (Ta == 0) Ta = 1;
for (u32 device_id = 0; device_id < opencl_ctx->devices_cnt; device_id++)
{
hc_device_param_t *device_param = &opencl_ctx->devices_param[device_id];

View File

@ -26,7 +26,13 @@ static int sp_comp_val (const void *p1, const void *p2)
const hcstat_table_t *b1 = (const hcstat_table_t *) p1;
const hcstat_table_t *b2 = (const hcstat_table_t *) p2;
return b2->val - b1->val;
const u64 v1 = b1->val;
const u64 v2 = b2->val;
if (v1 < v2) return 1;
if (v1 > v2) return -1;
return 0;
}
static void mp_css_split_cnt (hashcat_ctx_t *hashcat_ctx, const u32 css_cnt_orig, u32 css_cnt_lr[2])
@ -1113,9 +1119,9 @@ u32 mp_get_length (const char *mask)
{
u32 len = 0;
u32 mask_len = strlen (mask);
const size_t mask_len = strlen (mask);
for (u32 i = 0; i < mask_len; i++)
for (size_t i = 0; i < mask_len; i++)
{
if (mask[i] == '?') i++;
@ -1125,13 +1131,13 @@ u32 mp_get_length (const char *mask)
return len;
}
static char *mask_ctx_parse_maskfile_find_mask (char *line_buf, int line_len)
static char *mask_ctx_parse_maskfile_find_mask (char *line_buf, const size_t line_len)
{
char *mask_buf = line_buf;
bool escaped = false;
for (int i = 0; i < line_len; i++)
for (size_t i = 0; i < line_len; i++)
{
if (escaped == true)
{
@ -1449,7 +1455,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp))
{
const int line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (mask_fp, line_buf);
if (line_len == 0) continue;
@ -1542,7 +1548,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp))
{
const int line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (mask_fp, line_buf);
if (line_len == 0) continue;
@ -1616,7 +1622,7 @@ int mask_ctx_init (hashcat_ctx_t *hashcat_ctx)
while (!feof (mask_fp))
{
const int line_len = fgetl (mask_fp, line_buf);
const size_t line_len = fgetl (mask_fp, line_buf);
if (line_len == 0) continue;
@ -1713,15 +1719,15 @@ int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
mfs_buf[3].mf_len = 0;
mfs_buf[4].mf_len = 0;
int mfs_cnt = 0;
size_t mfs_cnt = 0;
char *mask_buf = mask_ctx->mask;
const int mask_len = strlen (mask_buf);
const size_t mask_len = strlen (mask_buf);
bool escaped = false;
for (int i = 0; i < mask_len; i++)
for (size_t i = 0; i < mask_len; i++)
{
mf_t *mf = mfs_buf + mfs_cnt;
@ -1775,7 +1781,7 @@ int mask_ctx_parse_maskfile (hashcat_ctx_t *hashcat_ctx)
mp_reset_usr (mask_ctx->mp_usr, 2);
mp_reset_usr (mask_ctx->mp_usr, 3);
for (int i = 0; i < mfs_cnt; i++)
for (size_t i = 0; i < mfs_cnt; i++)
{
switch (i)
{

View File

@ -123,7 +123,7 @@ static int setup_opencl_platforms_filter (hashcat_ctx_t *hashcat_ctx, const char
do
{
int platform = strtol (next, NULL, 10);
int platform = (int) strtol (next, NULL, 10);
if (platform < 1 || platform > 32)
{
@ -166,7 +166,7 @@ static int setup_devices_filter (hashcat_ctx_t *hashcat_ctx, const char *opencl_
do
{
int device_id = strtol (next, NULL, 10);
int device_id = (int) strtol (next, NULL, 10);
if (device_id < 1 || device_id > 32)
{
@ -209,7 +209,7 @@ static int setup_device_types_filter (hashcat_ctx_t *hashcat_ctx, const char *op
do
{
int device_type = strtol (next, NULL, 10);
int device_type = (int) strtol (next, NULL, 10);
if (device_type < 1 || device_type > 3)
{
@ -281,7 +281,7 @@ static int read_kernel_binary (hashcat_ctx_t *hashcat_ctx, const char *kernel_fi
time_t tlog = time (NULL);
const int extra_len = snprintf (buf + st.st_size, EXTRASZ, "\n//%lu\n", tlog);
const int extra_len = snprintf (buf + st.st_size, EXTRASZ, "\n//%u\n", (u32) tlog);
st.st_size += extra_len;
}
@ -830,7 +830,7 @@ int hc_clCreateBuffer (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_mem_fl
return 0;
}
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, const char **strings, const size_t *lengths, cl_program *program)
int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint count, char **strings, const size_t *lengths, cl_program *program)
{
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
@ -838,7 +838,7 @@ int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context
cl_int CL_err;
*program = ocl->clCreateProgramWithSource (context, count, strings, lengths, &CL_err);
*program = ocl->clCreateProgramWithSource (context, count, (const char **) strings, lengths, &CL_err);
if (CL_err != CL_SUCCESS)
{
@ -850,7 +850,7 @@ int hc_clCreateProgramWithSource (hashcat_ctx_t *hashcat_ctx, cl_context context
return 0;
}
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, const unsigned char **binaries, cl_int *binary_status, cl_program *program)
int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context, cl_uint num_devices, const cl_device_id *device_list, const size_t *lengths, unsigned char **binaries, cl_int *binary_status, cl_program *program)
{
opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;
@ -858,7 +858,7 @@ int hc_clCreateProgramWithBinary (hashcat_ctx_t *hashcat_ctx, cl_context context
cl_int CL_err;
*program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, binaries, binary_status, &CL_err);
*program = ocl->clCreateProgramWithBinary (context, num_devices, device_list, lengths, (const unsigned char **) binaries, binary_status, &CL_err);
if (CL_err != CL_SUCCESS)
{
@ -1175,7 +1175,7 @@ int gidd_to_pw_t (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, c
return 0;
}
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u32 pws_cnt, const u32 fast_iteration, const u32 salt_pos)
int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 highest_pw_len, const u64 pws_cnt, const u32 fast_iteration, const u32 salt_pos)
{
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
hashes_t *hashes = hashcat_ctx->hashes;
@ -1418,7 +1418,7 @@ int choose_kernel (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
return 0;
}
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u32 pws_cnt, const u8 chr)
void rebuild_pws_compressed_append (hc_device_param_t *device_param, const u64 pws_cnt, const u8 chr)
{
// this function is used if we have to modify the compressed pws buffer in order to
// append some data to each password candidate
@ -1955,7 +1955,7 @@ int run_kernel_bzero (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_para
return run_kernel_memset (hashcat_ctx, device_param, buf, 0, size);
}
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt)
{
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -2098,7 +2098,7 @@ int run_copy (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const
return 0;
}
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt)
{
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -2167,25 +2167,25 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
// iteration type
u64 innerloop_step = 0;
u64 innerloop_cnt = 0;
u32 innerloop_step = 0;
u32 innerloop_cnt = 0;
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL) innerloop_step = device_param->kernel_loops;
else innerloop_step = 1;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = straight_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = combinator_ctx->combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = mask_ctx->bfs_cnt;
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = (u32) straight_ctx->kernel_rules_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = (u32) combinator_ctx->combs_cnt;
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = (u32) mask_ctx->bfs_cnt;
// innerloops
for (u64 innerloop_pos = 0; innerloop_pos < innerloop_cnt; innerloop_pos += innerloop_step)
for (u32 innerloop_pos = 0; innerloop_pos < innerloop_cnt; innerloop_pos += innerloop_step)
{
while (status_ctx->devices_status == STATUS_PAUSED) sleep (1);
u32 fast_iteration = 0;
u64 innerloop_left = innerloop_cnt - innerloop_pos;
u32 innerloop_left = innerloop_cnt - innerloop_pos;
if (innerloop_left > innerloop_step)
{
@ -2230,13 +2230,13 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
{
char *line_buf = combinator_ctx->scratch_buf;
u64 i = 0;
u32 i = 0;
while (i < innerloop_left)
{
if (feof (combs_fp)) break;
int line_len = fgetl (combs_fp, line_buf);
size_t line_len = fgetl (combs_fp, line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -2252,7 +2252,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_r, user_options_extra->rule_len_r, line_buf, line_len, rule_buf_out);
const int rule_len_out = _old_apply_rule (user_options->rule_buf_r, user_options_extra->rule_len_r, line_buf, (u32) line_len, rule_buf_out);
if (rule_len_out < 0)
{
@ -2292,12 +2292,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
}
}
device_param->combs_buf[i].pw_len = line_len;
device_param->combs_buf[i].pw_len = (u32) line_len;
i++;
}
for (u64 j = i; j < innerloop_left; j++)
for (u32 j = i; j < innerloop_left; j++)
{
memset (&device_param->combs_buf[j], 0, sizeof (pw_t));
}
@ -2347,13 +2347,13 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
{
char *line_buf = combinator_ctx->scratch_buf;
u64 i = 0;
u32 i = 0;
while (i < innerloop_left)
{
if (feof (combs_fp)) break;
int line_len = fgetl (combs_fp, line_buf);
size_t line_len = fgetl (combs_fp, line_buf);
line_len = convert_from_hex (hashcat_ctx, line_buf, line_len);
@ -2369,7 +2369,7 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_r, user_options_extra->rule_len_r, line_buf, line_len, rule_buf_out);
const int rule_len_out = _old_apply_rule (user_options->rule_buf_r, user_options_extra->rule_len_r, line_buf, (u32) line_len, rule_buf_out);
if (rule_len_out < 0)
{
@ -2411,12 +2411,12 @@ int run_cracker (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, co
}
*/
device_param->combs_buf[i].pw_len = line_len;
device_param->combs_buf[i].pw_len = (u32) line_len;
i++;
}
for (u64 j = i; j < innerloop_left; j++)
for (u32 j = i; j < innerloop_left; j++)
{
memset (&device_param->combs_buf[j], 0, sizeof (pw_t));
}
@ -3533,7 +3533,7 @@ int opencl_ctx_devices_init (hashcat_ctx_t *hashcat_ctx, const int comptime)
else
{
// Support for ROCm platform
if (strtof (device_param->driver_version, NULL) >= 1.1) amd_warn = false;
if (strtof (device_param->driver_version, NULL) >= 1.1f) amd_warn = false;
}
#elif defined (_WIN)
// AMD Radeon Software 14.9 and higher, should be updated to 15.12
@ -3808,13 +3808,13 @@ void opencl_ctx_devices_kernel_loops (hashcat_ctx_t *hashcat_ctx)
if (device_param->kernel_loops_min < device_param->kernel_loops_max)
{
u64 innerloop_cnt = 0;
u32 innerloop_cnt = 0;
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = MIN (KERNEL_RULES, straight_ctx->kernel_rules_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = MIN (KERNEL_COMBS, combinator_ctx->combs_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = MIN (KERNEL_BFS, mask_ctx->bfs_cnt);
if (user_options_extra->attack_kern == ATTACK_KERN_STRAIGHT) innerloop_cnt = MIN (KERNEL_RULES, (u32) straight_ctx->kernel_rules_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_COMBI) innerloop_cnt = MIN (KERNEL_COMBS, (u32) combinator_ctx->combs_cnt);
else if (user_options_extra->attack_kern == ATTACK_KERN_BF) innerloop_cnt = MIN (KERNEL_BFS, (u32) mask_ctx->bfs_cnt);
}
else
{
@ -3850,12 +3850,12 @@ static int get_kernel_threads (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *de
if (work_group_size > 0)
{
kernel_threads = MIN (kernel_threads, work_group_size);
kernel_threads = MIN (kernel_threads, (u32) work_group_size);
}
if (compile_work_group_size[0] > 0)
{
kernel_threads = MIN (kernel_threads, compile_work_group_size[0]);
kernel_threads = MIN (kernel_threads, (u32) compile_work_group_size[0]);
}
*result = kernel_threads;
@ -4222,7 +4222,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
tmto_stop = user_options->scrypt_tmto;
}
const u32 kernel_power_max = device_param->hardware_power * device_param->kernel_accel_max;
const u64 kernel_power_max = device_param->hardware_power * device_param->kernel_accel_max;
// size_pws
@ -4363,7 +4363,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
while (kernel_accel_max >= kernel_accel_min)
{
const u32 kernel_power_max = device_param->hardware_power * kernel_accel_max;
const u64 kernel_power_max = device_param->hardware_power * kernel_accel_max;
// size_pws
@ -4668,7 +4668,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, (const char **) kernel_sources, NULL, &device_param->program);
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, kernel_sources, NULL, &device_param->program);
if (CL_rc == -1) return -1;
@ -4732,7 +4732,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (const unsigned char **) kernel_sources, NULL, &device_param->program);
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (unsigned char **) kernel_sources, NULL, &device_param->program);
if (CL_rc == -1) return -1;
@ -4747,7 +4747,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, (const char **) kernel_sources, NULL, &device_param->program);
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, kernel_sources, NULL, &device_param->program);
if (CL_rc == -1) return -1;
@ -4871,7 +4871,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, (const char **) kernel_sources, NULL, &device_param->program_mp);
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, kernel_sources, NULL, &device_param->program_mp);
if (CL_rc == -1) return -1;
@ -4933,7 +4933,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (const unsigned char **) kernel_sources, NULL, &device_param->program_mp);
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (unsigned char **) kernel_sources, NULL, &device_param->program_mp);
if (CL_rc == -1) return -1;
@ -5012,7 +5012,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, (const char **) kernel_sources, NULL, &device_param->program_amp);
CL_rc = hc_clCreateProgramWithSource (hashcat_ctx, device_param->context, 1, kernel_sources, NULL, &device_param->program_amp);
if (CL_rc == -1) return -1;
@ -5074,7 +5074,7 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
if (rc_read_kernel == -1) return -1;
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (const unsigned char **) kernel_sources, NULL, &device_param->program_amp);
CL_rc = hc_clCreateProgramWithBinary (hashcat_ctx, device_param->context, 1, &device_param->device, kernel_lengths, (unsigned char **) kernel_sources, NULL, &device_param->program_amp);
if (CL_rc == -1) return -1;

View File

@ -28,7 +28,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
const u32 gidvid = plain->gidvid;
const u64 gidvid = plain->gidvid;
const u32 il_pos = plain->il_pos;
int plain_len = 0;
@ -43,7 +43,7 @@ int build_plain (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
if (rc == -1) return -1;
const u32 off = device_param->innerloop_pos + il_pos;
const u64 off = device_param->innerloop_pos + il_pos;
if (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL)
{
@ -240,7 +240,7 @@ int build_crackpos (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
const user_options_extra_t *user_options_extra = hashcat_ctx->user_options_extra;
const u32 gidvid = plain->gidvid;
const u64 gidvid = plain->gidvid;
const u32 il_pos = plain->il_pos;
u64 crackpos = device_param->words_off;
@ -275,7 +275,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
const straight_ctx_t *straight_ctx = hashcat_ctx->straight_ctx;
const user_options_t *user_options = hashcat_ctx->user_options;
const u32 gidvid = plain->gidvid;
const u64 gidvid = plain->gidvid;
const u32 il_pos = plain->il_pos;
if (user_options->attack_mode != ATTACK_MODE_STRAIGHT) return 0;
@ -292,7 +292,7 @@ int build_debugdata (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
int plain_len = (int) pw.pw_len;
const u32 off = device_param->innerloop_pos + il_pos;
const u64 off = device_param->innerloop_pos + il_pos;
// save rule
if ((debug_mode == 1) || (debug_mode == 3) || (debug_mode == 4))

View File

@ -26,12 +26,12 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
status_ctx_t *status_ctx = hashcat_ctx->status_ctx;
user_options_t *user_options = hashcat_ctx->user_options;
u32 dgst_size = hashconfig->dgst_size;
bool is_salted = hashconfig->is_salted;
u32 esalt_size = hashconfig->esalt_size;
u32 hook_salt_size = hashconfig->hook_salt_size;
u32 hash_mode = hashconfig->hash_mode;
char separator = hashconfig->separator;
size_t dgst_size = hashconfig->dgst_size;
bool is_salted = hashconfig->is_salted;
size_t esalt_size = hashconfig->esalt_size;
size_t hook_salt_size = hashconfig->hook_salt_size;
u32 hash_mode = hashconfig->hash_mode;
char separator = hashconfig->separator;
char *root_directory = outcheck_ctx->root_directory;
u32 outfile_check_timer = user_options->outfile_check_timer;
@ -181,7 +181,7 @@ static int outfile_remove (hashcat_ctx_t *hashcat_ctx)
if ((hash_mode != 2500) && (hash_mode != 2501) && (hash_mode != 6800))
{
parser_status = hashconfig->parse_func ((u8 *) line_buf, line_len - 1, &hash_buf, hashconfig);
parser_status = hashconfig->parse_func ((u8 *) line_buf, (u32) line_len - 1, &hash_buf, hashconfig);
}
u32 found = 0;

View File

@ -531,7 +531,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
while (!feof (potfile_ctx->fp))
{
int line_len = fgetl (potfile_ctx->fp, line_buf);
size_t line_len = fgetl (potfile_ctx->fp, line_buf);
if (line_len == 0) continue;
@ -541,11 +541,11 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
char *line_pw_buf = last_separator + 1;
int line_pw_len = line_buf + line_len - line_pw_buf;
size_t line_pw_len = line_buf + line_len - line_pw_buf;
char *line_hash_buf = line_buf;
int line_hash_len = last_separator - line_buf;
size_t line_hash_len = last_separator - line_buf;
line_hash_buf[line_hash_len] = 0;
@ -575,7 +575,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
// manipulate salt_buf
memcpy (hash_buf.salt->salt_buf, line_hash_buf, line_hash_len);
hash_buf.salt->salt_len = line_hash_len;
hash_buf.salt->salt_len = (u32) line_hash_len;
found = (hash_t *) bsearch (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash_t_salt);
}
@ -598,9 +598,9 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
char *essid_pos = sep_pos + 1;
int essid_len = (int) strlen (essid_pos);
size_t essid_len = strlen (essid_pos);
if (is_hexify ((const u8 *) essid_pos, (const int) essid_len) == true)
if (is_hexify ((const u8 *) essid_pos, essid_len) == true)
{
essid_len = exec_unhexify ((const u8 *) essid_pos, essid_len, (u8 *) essid_pos, essid_len);
}
@ -613,7 +613,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
memcpy (hash_buf.salt->salt_buf, essid_pos, essid_len);
hash_buf.salt->salt_len = essid_len;
hash_buf.salt->salt_len = (u32) essid_len;
hash_buf.salt->salt_iter = ROUNDS_WPA - 1;
u32 hash[4];
@ -640,13 +640,13 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
}
else
{
int parser_status = hashconfig->parse_func ((u8 *) line_hash_buf, line_hash_len, &hash_buf, hashconfig);
int parser_status = hashconfig->parse_func ((u8 *) line_hash_buf, (u32) line_hash_len, &hash_buf, hashconfig);
if (parser_status != PARSER_OK) continue;
if (potfile_ctx->keep_all_hashes == true)
{
potfile_update_hashes (hashcat_ctx, &hash_buf, line_pw_buf, line_pw_len, all_hashes_tree);
potfile_update_hashes (hashcat_ctx, &hash_buf, line_pw_buf, (u32) line_pw_len, all_hashes_tree);
continue;
}
@ -654,7 +654,7 @@ int potfile_remove_parse (hashcat_ctx_t *hashcat_ctx)
found = (hash_t *) hc_bsearch_r (&hash_buf, hashes_buf, hashes_cnt, sizeof (hash_t), sort_by_hash, (void *) hashconfig);
}
potfile_update_hash (hashcat_ctx, found, line_pw_buf, line_pw_len);
potfile_update_hash (hashcat_ctx, found, line_pw_buf, (u32) line_pw_len);
}
hcfree (line_buf);
@ -878,11 +878,9 @@ int potfile_handle_show (hashcat_ctx_t *hashcat_ctx)
{
u8 pass_unhexified[HCBUFSIZ_TINY] = { 0 };
u32 pass_unhexified_len = 0;
const size_t pass_unhexified_len = exec_unhexify ((u8 *) hash->pw_buf, hash->pw_len, pass_unhexified, sizeof (pass_unhexified));
pass_unhexified_len = exec_unhexify ((u8 *) hash->pw_buf, hash->pw_len, pass_unhexified, sizeof (pass_unhexified));
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, pass_unhexified, pass_unhexified_len, 0, username, user_len, (char *) tmp_buf);
tmp_len = outfile_write (hashcat_ctx, (char *) out_buf, pass_unhexified, (u32) pass_unhexified_len, 0, username, user_len, (char *) tmp_buf);
}
else
{

View File

@ -225,8 +225,8 @@ int generate_random_rule (char rule_buf[RP_RULE_SIZE], const u32 rp_gen_func_min
#define SET_P0_CONV(rule,val) INCR_POS; (rule)->cmds[rule_cnt] |= ((conv_ctoi (val)) & 0xff) << 8
#define SET_P1_CONV(rule,val) INCR_POS; (rule)->cmds[rule_cnt] |= ((conv_ctoi (val)) & 0xff) << 16
#define GET_P0_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 8) & 0xff)
#define GET_P1_CONV(rule) INCR_POS; rule_buf[rule_pos] = conv_itoc (((rule)->cmds[rule_cnt] >> 16) & 0xff)
#define GET_P0_CONV(rule) INCR_POS; rule_buf[rule_pos] = (char) conv_itoc (((rule)->cmds[rule_cnt] >> 8) & 0xff)
#define GET_P1_CONV(rule) INCR_POS; rule_buf[rule_pos] = (char) conv_itoc (((rule)->cmds[rule_cnt] >> 16) & 0xff)
int cpu_rule_to_kernel_rule (char *rule_buf, u32 rule_len, kernel_rule_t *rule)
{
@ -707,7 +707,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
char *rule_buf = (char *) hcmalloc (HCBUFSIZ_LARGE);
int rule_len = 0;
u32 rule_len = 0;
for (u32 i = 0; i < user_options->rp_files_cnt; i++)
{
@ -737,7 +737,7 @@ int kernel_rules_load (hashcat_ctx_t *hashcat_ctx, kernel_rule_t **out_buf, u32
while (!feof (fp))
{
rule_len = fgetl (fp, rule_buf);
rule_len = (u32) fgetl (fp, rule_buf);
rule_line++;

View File

@ -395,7 +395,7 @@ static int mangle_delete_last (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p
{
if (len == 0) return 0;
return mangle_delete_at (len - 1, p1, buf, len);
return mangle_delete_at ((u8) len - 1, p1, buf, len);
}
static int mangle_extract (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const u8 p1, u8 *buf, const int len)
@ -651,7 +651,7 @@ static int mangle_dupeblock_first (MAYBE_UNUSED const u8 p0, MAYBE_UNUSED const
if (out_len >= RP_PASSWORD_SIZE) return (len);
for (int i = 0; i < p0; i++)
for (u8 i = 0; i < p0; i++)
{
const u8 c = buf[i * 2];

View File

@ -78,11 +78,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
char *pw_ptr = (char *) &pw.i;
int pw_len = strlen (hashconfig->st_pass);
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr, hashconfig->st_pass, pw_len);
pw.pw_len = pw_len;
pw.pw_len = (u32) pw_len;
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL);
@ -97,11 +97,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
char *pw_ptr = (char *) &pw.i;
int pw_len = strlen (hashconfig->st_pass);
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr, hashconfig->st_pass, pw_len - 1);
pw.pw_len = pw_len - 1;
pw.pw_len = (u32) pw_len - 1;
pw_t comb; memset (&comb, 0, sizeof (comb));
@ -139,7 +139,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
char *pw_ptr = (char *) &pw.i;
int pw_len = strlen (hashconfig->st_pass);
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr, hashconfig->st_pass, pw_len);
@ -148,7 +148,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
uppercase ((u8 *) pw_ptr, pw_len);
}
pw.pw_len = pw_len;
pw.pw_len = (u32) pw_len;
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL);
@ -201,17 +201,17 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
char *pw_ptr = (char *) &pw.i;
int pw_len = strlen (hashconfig->st_pass);
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr + 1, hashconfig->st_pass + 1, pw_len - 1);
int new_pass_len = pw_len;
size_t new_pass_len = pw_len;
if (hashconfig->opts_type & OPTS_TYPE_PT_UTF16LE)
{
memset (pw_ptr, 0, pw_len);
for (int i = 1, j = 2; i < new_pass_len; i += 1, j += 2)
for (size_t i = 1, j = 2; i < new_pass_len; i += 1, j += 2)
{
pw_ptr[j + 0] = hashconfig->st_pass[i];
pw_ptr[j + 1] = 0;
@ -223,7 +223,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
{
memset (pw_ptr, 0, pw_len);
for (int i = 1, j = 2; i < new_pass_len; i += 1, j += 2)
for (size_t i = 1, j = 2; i < new_pass_len; i += 1, j += 2)
{
pw_ptr[j + 0] = 0;
pw_ptr[j + 1] = hashconfig->st_pass[i];
@ -247,7 +247,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
}
}
pw.pw_len = new_pass_len;
pw.pw_len = (u32) new_pass_len;
if (hashconfig->opts_type & OPTS_TYPE_PT_ADD01)
{
@ -261,14 +261,14 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (hashconfig->opts_type & OPTS_TYPE_PT_ADDBITS14)
{
pw.i[14] = new_pass_len * 8;
pw.i[14] = (u32) new_pass_len * 8;
pw.i[15] = 0;
}
if (hashconfig->opts_type & OPTS_TYPE_PT_ADDBITS15)
{
pw.i[14] = 0;
pw.i[15] = new_pass_len * 8;
pw.i[15] = (u32) new_pass_len * 8;
}
if (hashconfig->opts_type & OPTS_TYPE_PT_GENERATE_BE)
@ -290,11 +290,11 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
char *pw_ptr = (char *) &pw.i;
int pw_len = strlen (hashconfig->st_pass);
const size_t pw_len = strlen (hashconfig->st_pass);
memcpy (pw_ptr, hashconfig->st_pass, pw_len);
pw.pw_len = pw_len;
pw.pw_len = (u32) pw_len;
CL_err = hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, 1 * sizeof (pw_t), &pw, 0, NULL, NULL);

View File

@ -327,11 +327,9 @@ void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed)
}
else
{
time_t ts;
const time_t ts = time (NULL); // don't tell me that this is an insecure seed
time (&ts);
srand (ts);
srand ((unsigned int) ts);
}
}
@ -498,3 +496,13 @@ bool hc_same_files (char *file1, char *file2)
return false;
}
u32 hc_strtoul (const char *nptr, char **endptr, int base)
{
return (u32) strtoul (nptr, endptr, base);
}
u64 hc_strtoull (const char *nptr, char **endptr, int base)
{
return (u64) strtoull (nptr, endptr, base);
}

View File

@ -834,8 +834,8 @@ char *status_get_guess_candidates_dev (const hashcat_ctx_t *hashcat_ctx, const i
if ((device_param->outerloop_left == 0) || (device_param->innerloop_left == 0)) return display;
const u32 outerloop_first = 0;
const u32 outerloop_last = device_param->outerloop_left - 1;
const u64 outerloop_first = 0;
const u64 outerloop_last = device_param->outerloop_left - 1;
const u32 innerloop_first = 0;
const u32 innerloop_last = device_param->innerloop_left - 1;
@ -1759,7 +1759,7 @@ int status_get_memoryspeed_dev (const hashcat_ctx_t *hashcat_ctx, const int devi
return num_memoryspeed;
}
int status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
u64 status_get_progress_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id)
{
const opencl_ctx_t *opencl_ctx = hashcat_ctx->opencl_ctx;

View File

@ -50,7 +50,7 @@ static void out_push (out_t *out, const u8 *pw_buf, const int pw_len)
}
}
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u32 pws_cnt)
int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, const u64 pws_cnt)
{
combinator_ctx_t *combinator_ctx = hashcat_ctx->combinator_ctx;
hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
@ -102,7 +102,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
pw_t pw;
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
{
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
@ -146,7 +146,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
pw_t pw;
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
{
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
@ -190,7 +190,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
}
else if (user_options->attack_mode == ATTACK_MODE_BF)
{
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
{
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
{
@ -216,7 +216,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
pw_t pw;
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
{
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);
@ -253,7 +253,7 @@ int process_stdout (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param,
{
pw_t pw;
for (u32 gidvid = 0; gidvid < pws_cnt; gidvid++)
for (u64 gidvid = 0; gidvid < pws_cnt; gidvid++)
{
const int rc = gidd_to_pw_t (hashcat_ctx, device_param, gidvid, &pw);

View File

@ -731,7 +731,7 @@ void opencl_info_compact (hashcat_ctx_t *hashcat_ctx)
if (platform_skipped == false)
{
const int len = event_log_info (hashcat_ctx, "OpenCL Platform #%u: %s", platforms_idx + 1, platform_vendor);
const size_t len = event_log_info (hashcat_ctx, "OpenCL Platform #%u: %s", platforms_idx + 1, platform_vendor);
char line[HCBUFSIZ_TINY];
@ -1482,7 +1482,7 @@ void status_progress_machine_readable (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx, "%d:%d:%0.2f", device_id + 1, device_info->progress_dev, device_info->runtime_msec_dev);
event_log_info (hashcat_ctx, "%d:%" PRIu64 ":%0.2f", device_id + 1, device_info->progress_dev, device_info->runtime_msec_dev);
}
status_status_destroy (hashcat_ctx, hashcat_status);
@ -1519,7 +1519,7 @@ void status_progress (hashcat_ctx_t *hashcat_ctx)
if (device_info->skipped_dev == true) continue;
event_log_info (hashcat_ctx,
"Progress.Dev.#%d..: %d", device_id + 1,
"Progress.Dev.#%d..: %" PRIu64, device_id + 1,
device_info->progress_dev);
}

View File

@ -85,7 +85,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
hcfree (tuning_db_file);
int num_lines = count_lines (fp);
const size_t num_lines = count_lines (fp);
// a bit over-allocated
@ -109,7 +109,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
line_num++;
const int line_len = in_superchop (line_buf);
const size_t line_len = in_superchop (line_buf);
if (line_len == 0) continue;
@ -179,9 +179,9 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
int kernel_accel = -1;
int kernel_loops = -1;
if (token_ptr[1][0] != '*') attack_mode = strtol (token_ptr[1], NULL, 10);
if (token_ptr[2][0] != '*') hash_type = strtol (token_ptr[2], NULL, 10);
if (token_ptr[3][0] != 'N') vector_width = strtol (token_ptr[3], NULL, 10);
if (token_ptr[1][0] != '*') attack_mode = (int) strtol (token_ptr[1], NULL, 10);
if (token_ptr[2][0] != '*') hash_type = (int) strtol (token_ptr[2], NULL, 10);
if (token_ptr[3][0] != 'N') vector_width = (int) strtol (token_ptr[3], NULL, 10);
if (token_ptr[4][0] == 'A')
{
@ -193,7 +193,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
kernel_accel = strtol (token_ptr[4], NULL, 10);
kernel_accel = (int) strtol (token_ptr[4], NULL, 10);
if ((kernel_accel < 1) || (kernel_accel > 1024))
{
@ -224,7 +224,7 @@ int tuning_db_init (hashcat_ctx_t *hashcat_ctx)
}
else
{
kernel_loops = strtol (token_ptr[5], NULL, 10);
kernel_loops = (int) strtol (token_ptr[5], NULL, 10);
if (kernel_loops < 1)
{
@ -327,9 +327,9 @@ tuning_db_entry_t *tuning_db_search (hashcat_ctx_t *hashcat_ctx, const char *dev
char *device_name_nospace = hcstrdup (device_name);
int device_name_length = strlen (device_name_nospace);
const size_t device_name_length = strlen (device_name_nospace);
int i;
size_t i;
for (i = 0; i < device_name_length; i++)
{

View File

@ -310,111 +310,111 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv)
{
switch (c)
{
case IDX_HELP: user_options->usage = true; break;
case IDX_VERSION: user_options->version = true; break;
case IDX_RESTORE: user_options->restore = true; break;
case IDX_QUIET: user_options->quiet = true; break;
case IDX_SHOW: user_options->show = true; break;
case IDX_LEFT: user_options->left = true; break;
case IDX_ADVICE_DISABLE: user_options->advice_disable = true; break;
case IDX_USERNAME: user_options->username = true; break;
case IDX_REMOVE: user_options->remove = true; break;
case IDX_REMOVE_TIMER: user_options->remove_timer = strtoul (optarg, NULL, 10);
user_options->remove_timer_chgd = true; break;
case IDX_POTFILE_DISABLE: user_options->potfile_disable = true; break;
case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break;
case IDX_DEBUG_MODE: user_options->debug_mode = strtoul (optarg, NULL, 10); break;
case IDX_DEBUG_FILE: user_options->debug_file = optarg; break;
case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break;
case IDX_ENCODING_TO: user_options->encoding_to = optarg; break;
case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break;
case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break;
case IDX_EXAMPLE_HASHES: user_options->example_hashes = true; break;
case IDX_FORCE: user_options->force = true; break;
case IDX_SELF_TEST_DISABLE: user_options->self_test_disable = true; break;
case IDX_SKIP: user_options->skip = strtoull (optarg, NULL, 10); break;
case IDX_LIMIT: user_options->limit = strtoull (optarg, NULL, 10); break;
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
case IDX_KEYSPACE: user_options->keyspace = true; break;
case IDX_BENCHMARK: user_options->benchmark = true; break;
case IDX_BENCHMARK_ALL: user_options->benchmark_all = true; break;
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
case IDX_PROGRESS_ONLY: user_options->progress_only = true; break;
case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break;
case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break;
case IDX_STATUS: user_options->status = true; break;
case IDX_STATUS_TIMER: user_options->status_timer = strtoul (optarg, NULL, 10); break;
case IDX_MACHINE_READABLE: user_options->machine_readable = true; break;
case IDX_LOOPBACK: user_options->loopback = true; break;
case IDX_SESSION: user_options->session = optarg; break;
case IDX_HASH_MODE: user_options->hash_mode = strtoul (optarg, NULL, 10);
user_options->hash_mode_chgd = true; break;
case IDX_RUNTIME: user_options->runtime = strtoul (optarg, NULL, 10);
user_options->runtime_chgd = true; break;
case IDX_ATTACK_MODE: user_options->attack_mode = strtoul (optarg, NULL, 10);
user_options->attack_mode_chgd = true; break;
case IDX_RP_FILE: user_options->rp_files[user_options->rp_files_cnt++] = optarg; break;
case IDX_RP_GEN: user_options->rp_gen = strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = strtoul (optarg, NULL, 10);
user_options->rp_gen_seed_chgd = true; break;
case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break;
case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break;
case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break;
case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break;
case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = strtoul (optarg, NULL, 10); break;
case IDX_MARKOV_HCSTAT: user_options->markov_hcstat = optarg; break;
case IDX_OUTFILE: user_options->outfile = optarg; break;
case IDX_OUTFILE_FORMAT: user_options->outfile_format = strtoul (optarg, NULL, 10);
user_options->outfile_format_chgd = true; break;
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = strtoul (optarg, NULL, 10); break;
case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break;
case IDX_HEX_CHARSET: user_options->hex_charset = true; break;
case IDX_HEX_SALT: user_options->hex_salt = true; break;
case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break;
case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break;
case IDX_OPENCL_INFO: user_options->opencl_info = true; break;
case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break;
case IDX_OPENCL_PLATFORMS: user_options->opencl_platforms = optarg; break;
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = strtoul (optarg, NULL, 10);
user_options->opencl_vector_width_chgd = true; break;
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
case IDX_WORKLOAD_PROFILE: user_options->workload_profile = strtoul (optarg, NULL, 10);
user_options->workload_profile_chgd = true; break;
case IDX_KERNEL_ACCEL: user_options->kernel_accel = strtoul (optarg, NULL, 10);
user_options->kernel_accel_chgd = true; break;
case IDX_KERNEL_LOOPS: user_options->kernel_loops = strtoul (optarg, NULL, 10);
user_options->kernel_loops_chgd = true; break;
case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = strtoul (optarg, NULL, 10);
user_options->nvidia_spin_damp_chgd = true; break;
case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break;
case IDX_GPU_TEMP_ABORT: user_options->gpu_temp_abort = strtoul (optarg, NULL, 10); break;
case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break;
case IDX_HCCAPX_MESSAGE_PAIR: user_options->hccapx_message_pair = strtoul (optarg, NULL, 10);
user_options->hccapx_message_pair_chgd = true; break;
case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = strtoul (optarg, NULL, 10); break;
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 = strtoul (optarg, NULL, 10); break;
case IDX_SEGMENT_SIZE: user_options->segment_size = strtoul (optarg, NULL, 10);
user_options->segment_size_chgd = true; break;
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = strtoul (optarg, NULL, 10); break;
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
case IDX_BITMAP_MIN: user_options->bitmap_min = strtoul (optarg, NULL, 10); break;
case IDX_BITMAP_MAX: user_options->bitmap_max = strtoul (optarg, NULL, 10); break;
case IDX_INCREMENT: user_options->increment = true; break;
case IDX_INCREMENT_MIN: user_options->increment_min = strtoul (optarg, NULL, 10);
user_options->increment_min_chgd = true; break;
case IDX_INCREMENT_MAX: user_options->increment_max = strtoul (optarg, NULL, 10);
user_options->increment_max_chgd = true; break;
case IDX_CUSTOM_CHARSET_1: user_options->custom_charset_1 = optarg; break;
case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break;
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
case IDX_HELP: user_options->usage = true; break;
case IDX_VERSION: user_options->version = true; break;
case IDX_RESTORE: user_options->restore = true; break;
case IDX_QUIET: user_options->quiet = true; break;
case IDX_SHOW: user_options->show = true; break;
case IDX_LEFT: user_options->left = true; break;
case IDX_ADVICE_DISABLE: user_options->advice_disable = true; break;
case IDX_USERNAME: user_options->username = true; break;
case IDX_REMOVE: user_options->remove = true; break;
case IDX_REMOVE_TIMER: user_options->remove_timer = hc_strtoul (optarg, NULL, 10);
user_options->remove_timer_chgd = true; break;
case IDX_POTFILE_DISABLE: user_options->potfile_disable = true; break;
case IDX_POTFILE_PATH: user_options->potfile_path = optarg; break;
case IDX_DEBUG_MODE: user_options->debug_mode = hc_strtoul (optarg, NULL, 10); break;
case IDX_DEBUG_FILE: user_options->debug_file = optarg; break;
case IDX_ENCODING_FROM: user_options->encoding_from = optarg; break;
case IDX_ENCODING_TO: user_options->encoding_to = optarg; break;
case IDX_INDUCTION_DIR: user_options->induction_dir = optarg; break;
case IDX_OUTFILE_CHECK_DIR: user_options->outfile_check_dir = optarg; break;
case IDX_EXAMPLE_HASHES: user_options->example_hashes = true; break;
case IDX_FORCE: user_options->force = true; break;
case IDX_SELF_TEST_DISABLE: user_options->self_test_disable = true; break;
case IDX_SKIP: user_options->skip = hc_strtoull (optarg, NULL, 10); break;
case IDX_LIMIT: user_options->limit = hc_strtoull (optarg, NULL, 10); break;
case IDX_KEEP_GUESSING: user_options->keep_guessing = true; break;
case IDX_KEYSPACE: user_options->keyspace = true; break;
case IDX_BENCHMARK: user_options->benchmark = true; break;
case IDX_BENCHMARK_ALL: user_options->benchmark_all = true; break;
case IDX_STDOUT_FLAG: user_options->stdout_flag = true; break;
case IDX_SPEED_ONLY: user_options->speed_only = true; break;
case IDX_PROGRESS_ONLY: user_options->progress_only = true; break;
case IDX_RESTORE_DISABLE: user_options->restore_disable = true; break;
case IDX_RESTORE_FILE_PATH: user_options->restore_file_path = optarg; break;
case IDX_STATUS: user_options->status = true; break;
case IDX_STATUS_TIMER: user_options->status_timer = hc_strtoul (optarg, NULL, 10); break;
case IDX_MACHINE_READABLE: user_options->machine_readable = true; break;
case IDX_LOOPBACK: user_options->loopback = true; break;
case IDX_SESSION: user_options->session = optarg; break;
case IDX_HASH_MODE: user_options->hash_mode = hc_strtoul (optarg, NULL, 10);
user_options->hash_mode_chgd = true; break;
case IDX_RUNTIME: user_options->runtime = hc_strtoul (optarg, NULL, 10);
user_options->runtime_chgd = true; break;
case IDX_ATTACK_MODE: user_options->attack_mode = hc_strtoul (optarg, NULL, 10);
user_options->attack_mode_chgd = true; break;
case IDX_RP_FILE: user_options->rp_files[user_options->rp_files_cnt++] = optarg; break;
case IDX_RP_GEN: user_options->rp_gen = hc_strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_FUNC_MIN: user_options->rp_gen_func_min = hc_strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_FUNC_MAX: user_options->rp_gen_func_max = hc_strtoul (optarg, NULL, 10); break;
case IDX_RP_GEN_SEED: user_options->rp_gen_seed = hc_strtoul (optarg, NULL, 10);
user_options->rp_gen_seed_chgd = true; break;
case IDX_RULE_BUF_L: user_options->rule_buf_l = optarg; break;
case IDX_RULE_BUF_R: user_options->rule_buf_r = optarg; break;
case IDX_MARKOV_DISABLE: user_options->markov_disable = true; break;
case IDX_MARKOV_CLASSIC: user_options->markov_classic = true; break;
case IDX_MARKOV_THRESHOLD: user_options->markov_threshold = hc_strtoul (optarg, NULL, 10); break;
case IDX_MARKOV_HCSTAT: user_options->markov_hcstat = optarg; break;
case IDX_OUTFILE: user_options->outfile = optarg; break;
case IDX_OUTFILE_FORMAT: user_options->outfile_format = hc_strtoul (optarg, NULL, 10);
user_options->outfile_format_chgd = true; break;
case IDX_OUTFILE_AUTOHEX_DISABLE: user_options->outfile_autohex = false; break;
case IDX_OUTFILE_CHECK_TIMER: user_options->outfile_check_timer = hc_strtoul (optarg, NULL, 10); break;
case IDX_WORDLIST_AUTOHEX_DISABLE: user_options->wordlist_autohex_disable = true; break;
case IDX_HEX_CHARSET: user_options->hex_charset = true; break;
case IDX_HEX_SALT: user_options->hex_salt = true; break;
case IDX_HEX_WORDLIST: user_options->hex_wordlist = true; break;
case IDX_CPU_AFFINITY: user_options->cpu_affinity = optarg; break;
case IDX_OPENCL_INFO: user_options->opencl_info = true; break;
case IDX_OPENCL_DEVICES: user_options->opencl_devices = optarg; break;
case IDX_OPENCL_PLATFORMS: user_options->opencl_platforms = optarg; break;
case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break;
case IDX_OPENCL_VECTOR_WIDTH: user_options->opencl_vector_width = hc_strtoul (optarg, NULL, 10);
user_options->opencl_vector_width_chgd = true; break;
case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break;
case IDX_WORKLOAD_PROFILE: user_options->workload_profile = hc_strtoul (optarg, NULL, 10);
user_options->workload_profile_chgd = true; break;
case IDX_KERNEL_ACCEL: user_options->kernel_accel = hc_strtoul (optarg, NULL, 10);
user_options->kernel_accel_chgd = true; break;
case IDX_KERNEL_LOOPS: user_options->kernel_loops = hc_strtoul (optarg, NULL, 10);
user_options->kernel_loops_chgd = true; break;
case IDX_NVIDIA_SPIN_DAMP: user_options->nvidia_spin_damp = hc_strtoul (optarg, NULL, 10);
user_options->nvidia_spin_damp_chgd = true; break;
case IDX_GPU_TEMP_DISABLE: user_options->gpu_temp_disable = true; break;
case IDX_GPU_TEMP_ABORT: user_options->gpu_temp_abort = hc_strtoul (optarg, NULL, 10); break;
case IDX_LOGFILE_DISABLE: user_options->logfile_disable = true; break;
case IDX_HCCAPX_MESSAGE_PAIR: user_options->hccapx_message_pair = hc_strtoul (optarg, NULL, 10);
user_options->hccapx_message_pair_chgd = true; break;
case IDX_NONCE_ERROR_CORRECTIONS: user_options->nonce_error_corrections = hc_strtoul (optarg, NULL, 10); break;
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 = hc_strtoul (optarg, NULL, 10); break;
case IDX_SEGMENT_SIZE: user_options->segment_size = hc_strtoul (optarg, NULL, 10);
user_options->segment_size_chgd = true; break;
case IDX_SCRYPT_TMTO: user_options->scrypt_tmto = hc_strtoul (optarg, NULL, 10); break;
case IDX_SEPARATOR: user_options->separator = optarg[0]; break;
case IDX_BITMAP_MIN: user_options->bitmap_min = hc_strtoul (optarg, NULL, 10); break;
case IDX_BITMAP_MAX: user_options->bitmap_max = hc_strtoul (optarg, NULL, 10); break;
case IDX_INCREMENT: user_options->increment = true; break;
case IDX_INCREMENT_MIN: user_options->increment_min = hc_strtoul (optarg, NULL, 10);
user_options->increment_min_chgd = true; break;
case IDX_INCREMENT_MAX: user_options->increment_max = hc_strtoul (optarg, NULL, 10);
user_options->increment_max_chgd = true; break;
case IDX_CUSTOM_CHARSET_1: user_options->custom_charset_1 = optarg; break;
case IDX_CUSTOM_CHARSET_2: user_options->custom_charset_2 = optarg; break;
case IDX_CUSTOM_CHARSET_3: user_options->custom_charset_3 = optarg; break;
case IDX_CUSTOM_CHARSET_4: user_options->custom_charset_4 = optarg; break;
}
}

View File

@ -15,7 +15,7 @@
#include "shared.h"
#include "wordlist.h"
u32 convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const u32 line_len)
size_t convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const size_t line_len)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -37,11 +37,11 @@ u32 convert_from_hex (hashcat_ctx_t *hashcat_ctx, char *line_buf, const u32 line
if (user_options->wordlist_autohex_disable == false)
{
if (is_hexify ((const u8 *) line_buf, (const int) line_len) == true)
if (is_hexify ((const u8 *) line_buf, line_len) == true)
{
const int new_len = exec_unhexify ((const u8 *) line_buf, (const int) line_len, (u8 *) line_buf, (const int) line_len);
const size_t new_len = exec_unhexify ((const u8 *) line_buf, line_len, (u8 *) line_buf, line_len);
return (u32) new_len;
return new_len;
}
}
@ -213,7 +213,7 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *o
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, len, rule_buf_out);
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, (u32) len, rule_buf_out);
if (rule_len_out < 0) continue;
}
@ -221,7 +221,7 @@ void get_next_word (hashcat_ctx_t *hashcat_ctx, FILE *fd, char **out_buf, u32 *o
if (len >= PW_MAX) continue;
*out_buf = ptr;
*out_len = len;
*out_len = (u32) len;
return;
}
@ -425,7 +425,7 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
memset (rule_buf_out, 0, sizeof (rule_buf_out));
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, len, rule_buf_out);
const int rule_len_out = _old_apply_rule (user_options->rule_buf_l, user_options_extra->rule_len_l, ptr, (u32) len, rule_buf_out);
if (rule_len_out < 0) continue;
}