mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 22:58:30 +00:00
Fix invalid brain session id calculation and move sorting functions to shared.c
This commit is contained in:
parent
08ea00020a
commit
d5cd0a0030
@ -24,8 +24,6 @@
|
||||
#define DOT_HASHCAT ".hashcat"
|
||||
#define SESSIONS_FOLDER "sessions"
|
||||
|
||||
int sort_by_stringptr (const void *p1, const void *p2);
|
||||
|
||||
int count_dictionaries (char **dictionary_files);
|
||||
|
||||
char *first_file_in_directory (const char *path);
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef _HASHES_H
|
||||
#define _HASHES_H
|
||||
|
||||
int sort_by_string (const void *p1, const void *p2);
|
||||
int sort_by_digest_p0p1 (const void *v1, const void *v2, void *v3);
|
||||
int sort_by_salt (const void *v1, const void *v2);
|
||||
int sort_by_hash (const void *v1, const void *v2, void *v3);
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
int sort_by_string (const void *p1, const void *p2);
|
||||
int sort_by_stringptr (const void *p1, const void *p2);
|
||||
|
||||
bool overflow_check_u32_add (const u32 a, const u32 b);
|
||||
bool overflow_check_u32_mul (const u32 a, const u32 b);
|
||||
bool overflow_check_u64_add (const u64 a, const u64 b);
|
||||
|
@ -126,7 +126,7 @@ u32 brain_compute_session (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
hcfree (out_buf);
|
||||
|
||||
qsort (out_bufs, out_idx, sizeof (char *), sort_by_string);
|
||||
qsort (out_bufs, out_idx, sizeof (char *), sort_by_stringptr);
|
||||
|
||||
for (int i = 0; i < out_idx; i++)
|
||||
{
|
||||
|
@ -14,14 +14,6 @@
|
||||
#include "event.h"
|
||||
#endif
|
||||
|
||||
int sort_by_stringptr (const void *p1, const void *p2)
|
||||
{
|
||||
const char* const *s1 = (const char* const *) p1;
|
||||
const char* const *s2 = (const char* const *) p2;
|
||||
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
static int get_exec_path (char *exec_path, const size_t exec_path_sz)
|
||||
{
|
||||
#if defined (__linux__) || defined (__CYGWIN__)
|
||||
|
@ -27,14 +27,6 @@
|
||||
#include "brain.h"
|
||||
#endif
|
||||
|
||||
int sort_by_string (const void *p1, const void *p2)
|
||||
{
|
||||
const char *s1 = (const char *) p1;
|
||||
const char *s2 = (const char *) p2;
|
||||
|
||||
return strcmp (s1, s2);
|
||||
}
|
||||
|
||||
int sort_by_digest_p0p1 (const void *v1, const void *v2, void *v3)
|
||||
{
|
||||
const u32 *d1 = (const u32 *) v1;
|
||||
|
16
src/shared.c
16
src/shared.c
@ -97,6 +97,22 @@ static const char *HASH_CATEGORY_OTP_STR = "One-Time Password
|
||||
static const char *HASH_CATEGORY_PLAIN_STR = "Plaintext";
|
||||
static const char *HASH_CATEGORY_FRAMEWORK_STR = "Framework";
|
||||
|
||||
int sort_by_string (const void *p1, const void *p2)
|
||||
{
|
||||
const char *s1 = (const char *) p1;
|
||||
const char *s2 = (const char *) p2;
|
||||
|
||||
return strcmp (s1, s2);
|
||||
}
|
||||
|
||||
int sort_by_stringptr (const void *p1, const void *p2)
|
||||
{
|
||||
const char* const *s1 = (const char* const *) p1;
|
||||
const char* const *s2 = (const char* const *) p2;
|
||||
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
static inline int get_msb32 (const u32 v)
|
||||
{
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user