2015-12-04 14:47:52 +00:00
|
|
|
/**
|
2016-09-11 20:20:15 +00:00
|
|
|
* Author......: See docs/credits.txt
|
2015-12-04 14:47:52 +00:00
|
|
|
* License.....: MIT
|
|
|
|
*/
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#ifndef _COMMON_H
|
|
|
|
#define _COMMON_H
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2016-09-21 14:07:49 +00:00
|
|
|
#define PROGNAME "hashcat"
|
|
|
|
|
2017-07-06 08:35:25 +00:00
|
|
|
#if defined (__unix__) || defined (__APPLE__)
|
2016-09-07 20:29:57 +00:00
|
|
|
#define _POSIX
|
2017-11-05 06:50:00 +00:00
|
|
|
#elif defined (_WIN32)
|
2016-10-01 11:37:09 +00:00
|
|
|
#define _WIN 1
|
2016-09-07 20:29:57 +00:00
|
|
|
#else
|
|
|
|
#error Your Operating System is not supported or detected
|
|
|
|
#endif
|
|
|
|
|
2017-07-06 08:35:25 +00:00
|
|
|
#if defined (__BYTE_ORDER__) && defined (__ORDER_BIG_ENDIAN__)
|
2017-04-15 15:33:59 +00:00
|
|
|
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
|
|
#error "compiling for big-endian architecture not supported"
|
|
|
|
#endif
|
2017-07-06 08:35:25 +00:00
|
|
|
#endif
|
2017-04-15 15:33:59 +00:00
|
|
|
|
2016-12-29 18:13:06 +00:00
|
|
|
#ifndef _GNU_SOURCE
|
2015-12-04 14:47:52 +00:00
|
|
|
#define _GNU_SOURCE
|
2016-12-29 18:13:06 +00:00
|
|
|
#endif
|
|
|
|
|
2017-02-22 06:08:50 +00:00
|
|
|
// needed for *time_r functions under MinGW
|
|
|
|
#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
|
2017-03-05 02:51:01 +00:00
|
|
|
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
|
2017-02-22 06:08:50 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// needed for 64-bit off_t on 32-bit OSes
|
|
|
|
#ifndef _FILE_OFFSET_BITS
|
2015-12-04 14:47:52 +00:00
|
|
|
#define _FILE_OFFSET_BITS 64
|
2017-02-22 06:08:50 +00:00
|
|
|
#endif
|
2015-12-04 14:47:52 +00:00
|
|
|
|
2017-03-05 03:11:28 +00:00
|
|
|
#ifndef _FORTIFY_SOURCE
|
|
|
|
#define _FORTIFY_SOURCE 2
|
|
|
|
#endif
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
#define NOMINMAX 1
|
2016-06-14 08:18:42 +00:00
|
|
|
|
2016-01-15 16:16:43 +00:00
|
|
|
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
2015-12-15 17:41:11 +00:00
|
|
|
|
2016-05-01 16:34:59 +00:00
|
|
|
#define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a)
|
2017-02-07 16:50:02 +00:00
|
|
|
#define CEILDIV(a,b) (((a) + (b) - 1) / (b))
|
2016-05-01 16:34:59 +00:00
|
|
|
|
2016-09-07 20:29:57 +00:00
|
|
|
#if defined (__APPLE__)
|
2016-09-05 19:47:26 +00:00
|
|
|
#define __stdcall
|
|
|
|
#endif
|
|
|
|
|
2016-10-01 11:40:09 +00:00
|
|
|
#if defined (__MSC_VER)
|
|
|
|
#define HC_API_CALL __cdecl
|
2016-11-29 21:39:22 +00:00
|
|
|
#elif defined (_WIN32) || defined (__WIN32__)
|
2016-09-08 07:21:25 +00:00
|
|
|
#define HC_API_CALL __stdcall
|
|
|
|
#else
|
|
|
|
#define HC_API_CALL
|
|
|
|
#endif
|
|
|
|
|
2016-09-07 20:29:57 +00:00
|
|
|
#if defined (_WIN)
|
2016-09-05 19:47:26 +00:00
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#endif
|
2016-09-06 16:44:05 +00:00
|
|
|
|
2016-10-01 11:42:40 +00:00
|
|
|
/* The C++ standard denies redefinition of keywords,
|
|
|
|
but this is nededed for VS compiler which doesn't have inline keyword but has __inline
|
|
|
|
*/
|
|
|
|
#ifndef __cplusplus
|
|
|
|
#if defined (_MSC_VER)
|
|
|
|
#define inline __inline
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
#define MAYBE_UNUSED __attribute__((unused))
|
|
|
|
|
2017-10-04 10:23:37 +00:00
|
|
|
/*
|
|
|
|
* Check if the system uses nanoseconds for file timestamps.
|
|
|
|
* In case the system uses nanoseconds we set some custom macros here,
|
|
|
|
* e.g. the (nanosecond) access time macros for dictstat
|
|
|
|
*/
|
2017-09-29 10:13:29 +00:00
|
|
|
|
2017-10-04 10:23:37 +00:00
|
|
|
#if defined (__linux__)
|
|
|
|
#include <linux/version.h>
|
|
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,48)
|
|
|
|
#define STAT_NANOSECONDS_ACCESS_TIME st_atim.tv_nsec
|
|
|
|
#endif
|
2017-09-29 10:13:29 +00:00
|
|
|
#endif
|
|
|
|
|
2017-10-04 10:23:37 +00:00
|
|
|
#if defined (__APPLE__)
|
|
|
|
#define STAT_NANOSECONDS_ACCESS_TIME st_atimespec.tv_nsec
|
2017-09-29 10:13:29 +00:00
|
|
|
#endif
|
|
|
|
|
2016-10-25 10:25:53 +00:00
|
|
|
// config section
|
|
|
|
// do not try to simply change this, it will not work
|
|
|
|
|
|
|
|
#define PW_MIN 0
|
2017-06-29 10:19:05 +00:00
|
|
|
#define PW_MAX 256
|
|
|
|
#define PW_MAX_OLD 55
|
2016-10-25 10:25:53 +00:00
|
|
|
|
2017-07-13 09:03:57 +00:00
|
|
|
#define SALT_MIN 0
|
|
|
|
#define SALT_MAX 256
|
|
|
|
#define SALT_MAX_OLD 51
|
|
|
|
|
2016-10-29 11:51:32 +00:00
|
|
|
#define HCBUFSIZ_TINY 0x1000
|
2017-11-18 11:18:56 +00:00
|
|
|
#define HCBUFSIZ_LARGE 0xb0000
|
2016-10-25 10:25:53 +00:00
|
|
|
|
|
|
|
#define CPT_CACHE 0x20000
|
|
|
|
#define PARAMCNT 64
|
|
|
|
#define DEVICES_MAX 128
|
|
|
|
#define EXEC_CACHE 128
|
2018-02-10 19:44:13 +00:00
|
|
|
#define SPEED_CACHE 4096
|
2016-10-25 10:25:53 +00:00
|
|
|
#define SPEED_MAXAGE 4096
|
|
|
|
#define EXPECTED_ITERATIONS 10000
|
|
|
|
|
2016-09-08 12:22:10 +00:00
|
|
|
#if defined (_WIN)
|
|
|
|
#define EOL "\r\n"
|
|
|
|
#else
|
|
|
|
#define EOL "\n"
|
|
|
|
#endif
|
|
|
|
|
2016-09-06 16:44:05 +00:00
|
|
|
#endif // _COMMON_H
|