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

Replace char[] with *char

The latter is more correct. The side effect is that filesize becomes smaller.

gcc    clang

before

O2
756112 762120

Os
674192 680216

after

O2
748456 760728

Os
666536 674728
This commit is contained in:
Rosen Penev 2017-11-13 12:05:40 -08:00
parent ea5425b344
commit 8458f07a57
10 changed files with 657 additions and 657 deletions

View File

@ -11,7 +11,7 @@
#define RULE_RC_SYNTAX_ERROR -1
#define RULE_RC_REJECT_ERROR -2
int _old_apply_rule (char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in_len, char out[RP_PASSWORD_SIZE]);
int _old_apply_rule (const char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in_len, char out[RP_PASSWORD_SIZE]);
int run_rule_engine (const int rule_len, const char *rule_buf);

View File

@ -861,8 +861,8 @@ struct hashconfig
int (*parse_func) (u8 *, u32, hash_t *, const struct hashconfig *);
char *st_hash;
char *st_pass;
const char *st_hash;
const char *st_pass;
};
typedef struct hashconfig hashconfig_t;
@ -1534,13 +1534,13 @@ typedef struct user_options
bool username;
bool version;
char *cpu_affinity;
char *custom_charset_1;
char *custom_charset_2;
char *custom_charset_3;
const char *custom_charset_1;
const char *custom_charset_2;
const char *custom_charset_3;
char *custom_charset_4;
char *debug_file;
char *encoding_from;
char *encoding_to;
const char *encoding_from;
const char *encoding_to;
char *induction_dir;
char *markov_hcstat;
char *opencl_devices;
@ -1551,8 +1551,8 @@ typedef struct user_options
char *potfile_path;
char *restore_file_path;
char **rp_files;
char *rule_buf_l;
char *rule_buf_r;
const char *rule_buf_l;
const char *rule_buf_r;
char separator;
const char *session;
char *truecrypt_keyfiles;

View File

@ -150,7 +150,7 @@ int combinator_ctx_init (hashcat_ctx_t *hashcat_ctx)
// we also have to switch wordlist related rules!
char *tmpc = user_options->rule_buf_l;
const char *tmpc = user_options->rule_buf_l;
user_options->rule_buf_l = user_options->rule_buf_r;
user_options->rule_buf_r = tmpc;

View File

@ -9,16 +9,16 @@
#include "filehandling.h"
#include "hlfmt.h"
static const char HLFMT_TEXT_HASHCAT[] = "native hashcat";
static const char HLFMT_TEXT_PWDUMP[] = "pwdump";
static const char HLFMT_TEXT_PASSWD[] = "passwd";
static const char HLFMT_TEXT_SHADOW[] = "shadow";
static const char HLFMT_TEXT_DCC[] = "DCC";
static const char HLFMT_TEXT_DCC2[] = "DCC 2";
static const char HLFMT_TEXT_NETNTLM1[] = "NetNTLMv1";
static const char HLFMT_TEXT_NETNTLM2[] = "NetNTLMv2";
static const char HLFMT_TEXT_NSLDAP[] = "nsldap";
static const char HLFMT_TEXT_NSLDAPS[] = "nsldaps";
static const char *HLFMT_TEXT_HASHCAT = "native hashcat";
static const char *HLFMT_TEXT_PWDUMP = "pwdump";
static const char *HLFMT_TEXT_PASSWD = "passwd";
static const char *HLFMT_TEXT_SHADOW = "shadow";
static const char *HLFMT_TEXT_DCC = "DCC";
static const char *HLFMT_TEXT_DCC2 = "DCC 2";
static const char *HLFMT_TEXT_NETNTLM1 = "NetNTLMv1";
static const char *HLFMT_TEXT_NETNTLM2 = "NetNTLMv2";
static const char *HLFMT_TEXT_NSLDAP = "nsldap";
static const char *HLFMT_TEXT_NSLDAPS = "nsldaps";
// hlfmt hashcat

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
#include "ext_lzma.h"
#include "mpsp.h"
static const char DEF_MASK[] = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d";
static const char *DEF_MASK = "?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d";
#define MAX_MFS 5 // 4*charset, 1*mask
@ -240,7 +240,7 @@ static int mp_add_cs_buf (hashcat_ctx_t *hashcat_ctx, const u32 *in_buf, size_t
return 0;
}
static int mp_expand (hashcat_ctx_t *hashcat_ctx, char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, u32 mp_usr_offset, int interpret)
static int mp_expand (hashcat_ctx_t *hashcat_ctx, const char *in_buf, size_t in_len, cs_t *mp_sys, cs_t *mp_usr, u32 mp_usr_offset, int interpret)
{
const user_options_t *user_options = hashcat_ctx->user_options;
@ -557,7 +557,7 @@ static void mp_setup_sys (cs_t *mp_sys)
mp_sys[7].cs_len = pos; }
}
static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, char *buf, const u32 userindex)
static int mp_setup_usr (hashcat_ctx_t *hashcat_ctx, cs_t *mp_sys, cs_t *mp_usr, const char *buf, const u32 userindex)
{
FILE *fp = fopen (buf, "rb");

View File

@ -28,10 +28,10 @@
#include "opencl.h"
#if defined (__linux__)
static const char dri_card0_path[] = "/dev/dri/card0";
static const char *dri_card0_path = "/dev/dri/card0";
static const char drm_card0_vendor_path[] = "/sys/class/drm/card0/device/vendor";
static const char drm_card0_driver_path[] = "/sys/class/drm/card0/device/driver";
static const char *drm_card0_vendor_path = "/sys/class/drm/card0/device/vendor";
static const char *drm_card0_driver_path = "/sys/class/drm/card0/device/driver";
#endif
static const u32 full01 = 0x01010101;

View File

@ -471,7 +471,7 @@ static int mangle_title_sep (char arr[RP_PASSWORD_SIZE], int arr_len, char c)
return (arr_len);
}
int _old_apply_rule (char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in_len, char out[RP_PASSWORD_SIZE])
int _old_apply_rule (const char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in_len, char out[RP_PASSWORD_SIZE])
{
char mem[RP_PASSWORD_SIZE] = { 0 };

View File

@ -20,25 +20,25 @@
#include "status.h"
#include "shared.h"
static const char ST_0000[] = "Initializing";
static const char ST_0001[] = "Autotuning";
static const char ST_0002[] = "Selftest";
static const char ST_0003[] = "Running";
static const char ST_0004[] = "Paused";
static const char ST_0005[] = "Exhausted";
static const char ST_0006[] = "Cracked";
static const char ST_0007[] = "Aborted";
static const char ST_0008[] = "Quit";
static const char ST_0009[] = "Bypass";
static const char ST_0010[] = "Aborted (Checkpoint)";
static const char ST_0011[] = "Aborted (Runtime)";
static const char ST_0012[] = "Running (Checkpoint Quit requested)";
static const char ST_9999[] = "Unknown! Bug!";
static const char *ST_0000 = "Initializing";
static const char *ST_0001 = "Autotuning";
static const char *ST_0002 = "Selftest";
static const char *ST_0003 = "Running";
static const char *ST_0004 = "Paused";
static const char *ST_0005 = "Exhausted";
static const char *ST_0006 = "Cracked";
static const char *ST_0007 = "Aborted";
static const char *ST_0008 = "Quit";
static const char *ST_0009 = "Bypass";
static const char *ST_0010 = "Aborted (Checkpoint)";
static const char *ST_0011 = "Aborted (Runtime)";
static const char *ST_0012 = "Running (Checkpoint Quit requested)";
static const char *ST_9999 = "Unknown! Bug!";
static const char UNITS[7] = { ' ', 'k', 'M', 'G', 'T', 'P', 'E' };
static const char ETA_ABSOLUTE_MAX_EXCEEDED[] = "Next Big Bang"; // in honor of ighashgpu
static const char ETA_RELATIVE_MAX_EXCEEDED[] = "> 10 years";
static const char *ETA_ABSOLUTE_MAX_EXCEEDED = "Next Big Bang"; // in honor of ighashgpu
static const char *ETA_RELATIVE_MAX_EXCEEDED = "> 10 years";
static char *status_get_rules_file (const hashcat_ctx_t *hashcat_ctx)
{

View File

@ -14,7 +14,7 @@
#include "outfile.h"
#include "user_options.h"
static const char short_options[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:O";
static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:iIbw:O";
static const struct option long_options[] =
{
@ -113,15 +113,15 @@ static const struct option long_options[] =
{}
};
static char ENCODING_FROM[] = "utf-8";
static char ENCODING_TO[] = "utf-8";
static const char *ENCODING_FROM = "utf-8";
static const char *ENCODING_TO = "utf-8";
static char RULE_BUF_R[] = ":";
static char RULE_BUF_L[] = ":";
static const char *RULE_BUF_R = ":";
static const char *RULE_BUF_L = ":";
static char DEF_MASK_CS_1[] = "?l?d?u";
static char DEF_MASK_CS_2[] = "?l?d";
static char DEF_MASK_CS_3[] = "?l?d*!$@_";
static const char *DEF_MASK_CS_1 = "?l?d?u";
static const char *DEF_MASK_CS_2 = "?l?d";
static const char *DEF_MASK_CS_3 = "?l?d*!$@_";
int user_options_init (hashcat_ctx_t *hashcat_ctx)
{