hashcat/include/common.h

121 lines
2.6 KiB
C
Raw Normal View History

2015-12-04 15:47:52 +01:00
/**
* Author......: See docs/credits.txt
2015-12-04 15:47:52 +01:00
* License.....: MIT
*/
#ifndef _COMMON_H
#define _COMMON_H
2015-12-04 15:47:52 +01:00
2016-09-21 16:07:49 +02:00
#define PROGNAME "hashcat"
2017-07-06 10:35:25 +02:00
#if defined (__unix__) || defined (__APPLE__)
#define _POSIX
2017-02-22 07:08:50 +01:00
#elif defined (__WINNT__)
#define _WIN 1
#else
#error Your Operating System is not supported or detected
#endif
2017-07-06 10:35:25 +02:00
#if defined (__BYTE_ORDER__) && defined (__ORDER_BIG_ENDIAN__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#error "compiling for big-endian architecture not supported"
#endif
2017-07-06 10:35:25 +02:00
#endif
#ifndef _GNU_SOURCE
2015-12-04 15:47:52 +01:00
#define _GNU_SOURCE
#endif
2017-02-22 07:08:50 +01:00
// needed for *time_r functions under MinGW
#ifndef _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
2017-02-22 07:08:50 +01:00
#endif
// needed for 64-bit off_t on 32-bit OSes
#ifndef _FILE_OFFSET_BITS
2015-12-04 15:47:52 +01:00
#define _FILE_OFFSET_BITS 64
2017-02-22 07:08:50 +01:00
#endif
2015-12-04 15:47:52 +01:00
#ifndef _FORTIFY_SOURCE
#define _FORTIFY_SOURCE 2
#endif
2016-10-25 12:25:53 +02:00
#define NOMINMAX 1
2016-06-14 10:18:42 +02:00
2016-01-15 17:16:43 +01:00
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
2016-05-01 18:34:59 +02:00
#define CEIL(a) ((a - (int) (a)) > 0 ? a + 1 : a)
#define CEILDIV(a,b) (((a) + (b) - 1) / (b))
2016-05-01 18:34:59 +02:00
#if defined (__APPLE__)
#define __stdcall
#endif
#if defined (__MSC_VER)
#define HC_API_CALL __cdecl
2016-11-29 22:39:22 +01:00
#elif defined (_WIN32) || defined (__WIN32__)
#define HC_API_CALL __stdcall
#else
#define HC_API_CALL
#endif
#if defined (_WIN)
#define WIN32_LEAN_AND_MEAN
#endif
/* 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 12:25:53 +02:00
#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:
"The nanosecond components of each timestamp are available via names of the form st_atim.tv_nsec
if the _BSD_SOURCE or _SVID_SOURCE feature test macro is defined"
*/
#if defined (_BSD_SOURCE)
#define WITH_NANOSECONDS_IN_STAT 1
#endif
#if defined (_SVID_SOURCE)
#define WITH_NANOSECONDS_IN_STAT 1
#endif
2016-10-25 12:25:53 +02:00
// config section
// do not try to simply change this, it will not work
#define PW_MIN 0
#define PW_MAX 256
#define PW_MAX_OLD 55
2016-10-25 12:25:53 +02:00
#define SALT_MIN 0
#define SALT_MAX 256
#define SALT_MAX_OLD 51
#define HCBUFSIZ_TINY 0x1000
2016-10-25 12:25:53 +02:00
#define HCBUFSIZ_LARGE 0x50000
#define CPT_CACHE 0x20000
#define PARAMCNT 64
#define DEVICES_MAX 128
#define EXEC_CACHE 128
#define SPEED_CACHE 128
#define SPEED_MAXAGE 4096
#define EXPECTED_ITERATIONS 10000
2016-09-08 14:22:10 +02:00
#if defined (_WIN)
#define EOL "\r\n"
#else
#define EOL "\n"
#endif
#endif // _COMMON_H