Initial commit
[hashcat.git] / include / common.h
1 /**
2 * Author......: Jens Steube <jens.steube@gmail.com>
3 * License.....: MIT
4 */
5
6 #ifndef COMMON_H
7 #define COMMON_H
8
9 #define _POSIX_SOURCE
10 #define _GNU_SOURCE
11 #define _FILE_OFFSET_BITS 64
12 #define _CRT_SECURE_NO_WARNINGS
13
14 #include <stdarg.h>
15 #include <stdint.h>
16 #include <stdio.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <errno.h>
20 #include <getopt.h>
21 #include <math.h>
22 #include <ctype.h>
23 #include <dirent.h>
24 #include <time.h>
25 #include <unistd.h>
26 #include <signal.h>
27 #include <sys/stat.h>
28 #include <sys/types.h>
29 #include <search.h>
30
31 #ifdef _POSIX
32 #include <sys/time.h>
33 #include <pthread.h>
34 #include <semaphore.h>
35 #include <dlfcn.h>
36
37 #ifdef LINUX
38 #include <termio.h>
39 #endif
40
41 #ifdef OSX
42 #include <termios.h>
43 #include <sys/ioctl.h>
44 #endif
45
46 typedef void *HM_LIB;
47 #endif
48
49 #ifdef _WIN
50 #define WIN32_LEAN_AND_MEAN
51 #include <windows.h>
52 #include <process.h>
53 #include <conio.h>
54 #include <tchar.h>
55 #include <psapi.h>
56 #include <io.h>
57 #include <fcntl.h>
58
59 typedef UINT8 uint8_t;
60 typedef UINT16 uint16_t;
61 typedef UINT32 uint32_t;
62 typedef UINT64 uint64_t;
63 typedef INT8 int8_t;
64 typedef INT16 int16_t;
65 typedef INT32 int32_t;
66 typedef INT64 int64_t;
67
68 typedef UINT32 uint;
69 typedef UINT64 uint64_t;
70
71 typedef HINSTANCE HM_LIB;
72 #endif
73
74 #define SPEED_CACHE 128
75 #define SPEED_MAXAGE 4096
76
77 #undef BUFSIZ
78 #define BUFSIZ 8192
79
80 /**
81 * functions
82 */
83
84 void log_out_nn (FILE *fp, const char *fmt, ...);
85 void log_info_nn (const char *fmt, ...);
86 void log_error_nn (const char *fmt, ...);
87
88 void log_out (FILE *fp, const char *fmt, ...);
89 void log_info (const char *fmt, ...);
90 void log_error (const char *fmt, ...);
91
92 #endif
93
94 typedef uint32_t uint; // we should rename to u32, sooner or later, for consistency
95 typedef uint64_t u64;