1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-25 16:08:18 +00:00

Merge pull request #1383 from philsmd/master

fixed the nanosecond access time problem, also working on macos now
This commit is contained in:
Jens Steube 2017-10-04 12:55:52 +02:00 committed by GitHub
commit 48684d9fcf
3 changed files with 16 additions and 13 deletions

View File

@ -75,18 +75,21 @@ but this is nededed for VS compiler which doesn't have inline keyword but has __
#define MAYBE_UNUSED __attribute__((unused)) #define MAYBE_UNUSED __attribute__((unused))
/* Check if we also need to use/set the nanoseconds for the file stats: /*
The linux manual says that the only valid way to check for nanosecond resolution is to follow this rule: * Check if the system uses nanoseconds for file timestamps.
"The nanosecond components of each timestamp are available via names of the form st_atim.tv_nsec * In case the system uses nanoseconds we set some custom macros here,
if the _BSD_SOURCE or _SVID_SOURCE feature test macro is defined" * e.g. the (nanosecond) access time macros for dictstat
*/ */
#if defined (_BSD_SOURCE) #if defined (__linux__)
#define WITH_NANOSECONDS_IN_STAT 1 #include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,48)
#define STAT_NANOSECONDS_ACCESS_TIME st_atim.tv_nsec
#endif
#endif #endif
#if defined (_SVID_SOURCE) #if defined (__APPLE__)
#define WITH_NANOSECONDS_IN_STAT 1 #define STAT_NANOSECONDS_ACCESS_TIME st_atimespec.tv_nsec
#endif #endif
// config section // config section

View File

@ -19,8 +19,8 @@ int sort_by_dictstat (const void *s1, const void *s2)
d2->stat.st_atime = d1->stat.st_atime; d2->stat.st_atime = d1->stat.st_atime;
#if defined (WITH_NANOSECONDS_IN_STAT) #if defined (STAT_NANOSECONDS_ACCESS_TIME)
d2->stat.st_atim.tv_nsec = d1->stat.st_atim.tv_nsec; d2->stat.STAT_NANOSECONDS_ACCESS_TIME = d1->stat.STAT_NANOSECONDS_ACCESS_TIME;
#endif #endif
const int rc_from = strcmp (d1->encoding_from, d2->encoding_from); const int rc_from = strcmp (d1->encoding_from, d2->encoding_from);

View File

@ -293,8 +293,8 @@ int count_words (hashcat_ctx_t *hashcat_ctx, FILE *fd, const char *dictfile, u64
d.stat.st_rdev = 0; d.stat.st_rdev = 0;
d.stat.st_atime = 0; d.stat.st_atime = 0;
#if defined (WITH_NANOSECONDS_IN_STAT) #if defined (STAT_NANOSECONDS_ACCESS_TIME)
d.stat.st_atim.tv_nsec = 0; d.stat.STAT_NANOSECONDS_ACCESS_TIME = 0;
#endif #endif
#if defined (_POSIX) #if defined (_POSIX)