mirror of
https://github.com/hashcat/hashcat
synced 2025-01-03 11:16:23 +01:00
Switch from size_t to int
This commit is contained in:
parent
42c3ab0485
commit
ec3f3cd7b6
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
const char *strhlfmt (const u32 hashfile_format);
|
const char *strhlfmt (const u32 hashfile_format);
|
||||||
|
|
||||||
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_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *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);
|
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len);
|
||||||
|
|
||||||
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);
|
u32 hlfmt_detect (hashcat_ctx_t *hashcat_ctx, FILE *fp, u32 max_check);
|
||||||
|
|
||||||
|
44
src/hlfmt.c
44
src/hlfmt.c
@ -22,7 +22,7 @@ static const char *HLFMT_TEXT_NSLDAPS = "nsldaps";
|
|||||||
|
|
||||||
// hlfmt hashcat
|
// hlfmt hashcat
|
||||||
|
|
||||||
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)
|
static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len)
|
||||||
{
|
{
|
||||||
const user_options_t *user_options = hashcat_ctx->user_options;
|
const user_options_t *user_options = hashcat_ctx->user_options;
|
||||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
@ -37,7 +37,7 @@ static void hlfmt_hash_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
|
|||||||
char *pos = line_buf;
|
char *pos = line_buf;
|
||||||
size_t len = line_len;
|
size_t len = line_len;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++, pos++, len--)
|
for (int i = 0; i < line_len; i++, pos++, len--)
|
||||||
{
|
{
|
||||||
if (line_buf[i] == hashconfig->separator)
|
if (line_buf[i] == hashconfig->separator)
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ 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, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
|
static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len)
|
||||||
{
|
{
|
||||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ static void hlfmt_user_hashcat (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *l
|
|||||||
|
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[i] == hashconfig->separator)
|
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
|
// hlfmt pwdump
|
||||||
|
|
||||||
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
|
static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len)
|
||||||
{
|
{
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
int sep2_len = 0;
|
int sep2_len = 0;
|
||||||
int sep3_len = 0;
|
int sep3_len = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[i] == ':')
|
if (line_buf[i] == ':')
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ static int hlfmt_detect_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len)
|
||||||
{
|
{
|
||||||
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
const hashconfig_t *hashconfig = hashcat_ctx->hashconfig;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ static void hlfmt_hash_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *li
|
|||||||
|
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[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;
|
*hashbuf_len = 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)
|
static void hlfmt_user_pwdump (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len)
|
||||||
{
|
{
|
||||||
char *pos = NULL;
|
char *pos = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[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
|
// hlfmt passwd
|
||||||
|
|
||||||
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
|
static int hlfmt_detect_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len)
|
||||||
{
|
{
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
char sep5_first = 0;
|
char sep5_first = 0;
|
||||||
char sep6_first = 0;
|
char sep6_first = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
static void hlfmt_hash_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len)
|
||||||
{
|
{
|
||||||
char *pos = NULL;
|
char *pos = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[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;
|
*hashbuf_len = 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)
|
static void hlfmt_user_passwd (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len)
|
||||||
{
|
{
|
||||||
char *pos = NULL;
|
char *pos = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[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
|
// hlfmt shadow
|
||||||
|
|
||||||
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, size_t line_len)
|
static int hlfmt_detect_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, const char *line_buf, const int line_len)
|
||||||
{
|
{
|
||||||
int sep_cnt = 0;
|
int sep_cnt = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < line_len; i++)
|
for (int i = 0; i < line_len; i++)
|
||||||
{
|
{
|
||||||
if (line_buf[i] == ':') sep_cnt++;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
static void hlfmt_hash_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len)
|
||||||
{
|
{
|
||||||
hlfmt_hash_passwd (hashcat_ctx, line_buf, line_len, hashbuf_pos, 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, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
|
static void hlfmt_user_shadow (MAYBE_UNUSED hashcat_ctx_t *hashcat_ctx, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len)
|
||||||
{
|
{
|
||||||
hlfmt_user_passwd (hashcat_ctx, line_buf, line_len, userbuf_pos, 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";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
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_hash (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **hashbuf_pos, int *hashbuf_len)
|
||||||
{
|
{
|
||||||
switch (hashfile_format)
|
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, size_t line_len, char **userbuf_pos, size_t *userbuf_len)
|
void hlfmt_user (hashcat_ctx_t *hashcat_ctx, u32 hashfile_format, char *line_buf, const int line_len, char **userbuf_pos, int *userbuf_len)
|
||||||
{
|
{
|
||||||
switch (hashfile_format)
|
switch (hashfile_format)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user