Add --mangle switch for mangling password before hashing
[hashcat.git] / include / shared.h
index 4eb100e..a9696da 100644 (file)
@@ -9,8 +9,8 @@
 #ifndef SHARED_H
 #define SHARED_H
 
-#include <common.h>
-#include <constants.h>
+#include "common.h"
+#include "inc_hash_constants.h"
 
 /**
  * thread management
@@ -46,7 +46,7 @@
 #define hc_thread_mutex_delete(m)   pthread_mutex_destroy  (&m)
 #endif
 
-#ifdef OSX
+#ifdef __APPLE__
 typedef struct cpu_set
 {
   uint32_t count;
@@ -72,6 +72,20 @@ static inline int  CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
 #define hc_dlsym dlsym
 #endif
 
+#define HC_LOAD_FUNC2(ptr,name,type,var,libname,noerr) \
+  ptr->name = (type) hc_dlsym (ptr->var, #name); \
+  if (noerr != -1) { \
+    if (!ptr->name) { \
+      if (noerr == 1) { \
+        log_error ("ERROR: %s is missing from %s shared library.", #name, #libname); \
+        exit (-1); \
+      } else { \
+        log_info ("WARNING: %s is missing from %s shared library.", #name, #libname); \
+        return -1; \
+      } \
+    } \
+  }
+
 #define HC_LOAD_FUNC(ptr,name,type,libname,noerr) \
   ptr->name = (type) hc_dlsym (ptr->lib, #name); \
   if (noerr != -1) { \
@@ -81,7 +95,7 @@ static inline int  CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
         exit (-1); \
       } else { \
         log_info ("WARNING: %s is missing from %s shared library.", #name, #libname); \
-        return (-1); \
+        return -1; \
       } \
     } \
   }
@@ -94,7 +108,7 @@ static inline int  CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
       exit (-1); \
     } else { \
       log_error ("WARNING: %s at address %08x is missing from %s shared library.", #name, addr, #libname); \
-      return (-1); \
+      return -1; \
     } \
   }
 
@@ -108,76 +122,84 @@ static inline int  CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
 #define hc_sleep(x) sleep ((x));
 #endif
 
-#include <ext_OpenCL.h>
+#include "ext_OpenCL.h"
 
 /**
  * temperature management
  */
 
-#if _WIN
-#include <ext_ADL.h>
-#include <ext_nvapi.h>
-#else
-#include <ext_ADL.h>
-#include <ext_nvml.h>
-#endif
+#include "ext_ADL.h"
+#include "ext_nvapi.h"
+#include "ext_nvml.h"
+#include "ext_xnvctrl.h"
 
 /**
  * shared stuff
  */
 
-#define ETC_MAX               (60 * 60 * 24 * 365 * 10)
+#define ETC_MAX                 (60 * 60 * 24 * 365 * 10)
+
+#define DEVICES_MAX             128
 
-#define DEVICES_MAX           128
+#define CL_PLATFORMS_MAX        16
 
-#define CL_PLATFORMS_MAX      16
+#define CL_VENDOR_AMD           "Advanced Micro Devices, Inc."
+#define CL_VENDOR_AMD_USE_INTEL "GenuineIntel"
+#define CL_VENDOR_APPLE         "Apple"
+#define CL_VENDOR_INTEL_BEIGNET "Intel"
+#define CL_VENDOR_INTEL_SDK     "Intel(R) Corporation"
+#define CL_VENDOR_MESA          "Mesa"
+#define CL_VENDOR_NV            "NVIDIA Corporation"
+#define CL_VENDOR_POCL          "The pocl project"
 
-#define CL_VENDOR_NV          "NVIDIA Corporation"
-#define CL_VENDOR_AMD         "Advanced Micro Devices, Inc."
-#define CL_VENDOR_APPLE       "Apple"
-#define CL_VENDOR_POCL        "The pocl project"
+#define VENDOR_ID_AMD           (1u << 0)
+#define VENDOR_ID_APPLE         (1u << 1)
+#define VENDOR_ID_INTEL_BEIGNET (1u << 2)
+#define VENDOR_ID_INTEL_SDK     (1u << 3)
+#define VENDOR_ID_MESA          (1u << 4)
+#define VENDOR_ID_NV            (1u << 5)
+#define VENDOR_ID_POCL          (1u << 6)
+#define VENDOR_ID_AMD_USE_INTEL (1u << 7)
+#define VENDOR_ID_GENERIC       (1u << 31)
 
-#define VENDOR_ID_AMD         4098
-#define VENDOR_ID_NV          4318
-#define VENDOR_ID_APPLE_INTEL 4294967295
-#define VENDOR_ID_APPLE_IRIS  16925952
-#define VENDOR_ID_GENERIC     9999
+#define BLOCK_SIZE              64
 
-#define BLOCK_SIZE            64
+#define CHARSIZ                 0x100
+#define INFOSZ                  CHARSIZ
 
-#define CHARSIZ               0x100
-#define INFOSZ                CHARSIZ
+#define SP_HCSTAT               "hashcat.hcstat"
+#define SP_PW_MIN               2
+#define SP_PW_MAX               64
+#define SP_ROOT_CNT             (SP_PW_MAX * CHARSIZ)
+#define SP_MARKOV_CNT           (SP_PW_MAX * CHARSIZ * CHARSIZ)
 
-#define SP_HCSTAT             "hashcat.hcstat"
-#define SP_PW_MIN             2
-#define SP_PW_MAX             64
-#define SP_ROOT_CNT           (SP_PW_MAX * CHARSIZ)
-#define SP_MARKOV_CNT         (SP_PW_MAX * CHARSIZ * CHARSIZ)
+#define TUNING_DB_FILE          "hashcat.hctune"
 
-#define TUNING_DB_FILE        "hashcat_tuning.hctab"
+#define INDUCT_DIR              "induct"
+#define OUTFILES_DIR            "outfiles"
 
-#define INDUCT_DIR            "induct"
-#define OUTFILES_DIR          "outfiles"
+#define LOOPBACK_FILE           "hashcat.loopback"
 
-#define LOOPBACK_FILE         "hashcat.loopback"
+#define DICTSTAT_FILENAME       "hashcat.dictstat"
+#define POTFILE_FILENAME        "hashcat.pot"
 
 /**
  * types
  */
 
 #ifdef _WIN
-typedef LARGE_INTEGER         hc_timer_t;
-typedef HANDLE                hc_thread_t;
-typedef CRITICAL_SECTION      hc_thread_mutex_t;
+typedef LARGE_INTEGER     hc_timer_t;
+typedef HANDLE            hc_thread_t;
+typedef CRITICAL_SECTION  hc_thread_mutex_t;
 #elif _POSIX
-typedef struct timeval        hc_timer_t;
-typedef pthread_t             hc_thread_t;
-typedef pthread_mutex_t       hc_thread_mutex_t;
+typedef struct timeval    hc_timer_t;
+typedef pthread_t         hc_thread_t;
+typedef pthread_mutex_t   hc_thread_mutex_t;
 #endif
 
-#include <types.h>
+#include "types.h"
 #include "rp_cpu.h"
-#include "rp_kernel.h"
+#include "inc_rp.h"
 
 /**
  * valid project specific global stuff
@@ -195,27 +217,6 @@ extern int SUPPRESS_OUTPUT;
 
 extern hc_thread_mutex_t mux_display;
 
-/**
- * password lengths supported
- */
-
-#define PW_LENGTH_MIN_0      0
-#define PW_LENGTH_MAX_0      55
-#define PW_LENGTH_MIN_400    0
-#define PW_LENGTH_MAX_400    40
-#define PW_LENGTH_MIN_500    0
-#define PW_LENGTH_MAX_500    15
-#define PW_LENGTH_MIN_1600   0
-#define PW_LENGTH_MAX_1600   15
-#define PW_LENGTH_MIN_1800   0
-#define PW_LENGTH_MAX_1800   15
-#define PW_LENGTH_MIN_2500   0
-#define PW_LENGTH_MAX_2500   64
-#define PW_LENGTH_MIN_6300   0
-#define PW_LENGTH_MAX_6300   15
-#define PW_LENGTH_MIN_7400   0
-#define PW_LENGTH_MAX_7400   15
-
 /**
  * Strings
  */
@@ -234,7 +235,6 @@ extern hc_thread_mutex_t mux_display;
 #define HT_00140  "sha1($salt.unicode($pass))"
 #define HT_00150  "HMAC-SHA1 (key = $pass)"
 #define HT_00160  "HMAC-SHA1 (key = $salt)"
-#define HT_00190  "sha1(LinkedIn)"
 #define HT_00200  "MySQL323"
 #define HT_00300  "MySQL4.1/MySQL5"
 #define HT_00400  "phpass, MD5(Wordpress), MD5(phpBB3), MD5(Joomla)"
@@ -364,6 +364,11 @@ extern hc_thread_mutex_t mux_display;
 #define HT_13000  "RAR5"
 #define HT_13100  "Kerberos 5 TGS-REP etype 23"
 #define HT_13200  "AxCrypt"
+#define HT_13300  "AxCrypt in memory SHA1"
+#define HT_13400  "Keepass 1 (AES/Twofish) and Keepass 2 (AES)"
+#define HT_13500  "PeopleSoft PS_TOKEN"
+#define HT_13600  "WinZip"
+#define HT_13800  "Windows 8+ phone PIN/Password"
 
 #define HT_00011  "Joomla < 2.5.18"
 #define HT_00012  "PostgreSQL"
@@ -376,6 +381,7 @@ extern hc_thread_mutex_t mux_display;
 #define HT_00121  "SMF > v1.1"
 #define HT_00122  "OSX v10.4, v10.5, v10.6"
 #define HT_00124  "Django (SHA-1)"
+#define HT_00125  "ArubaOS"
 #define HT_00131  "MSSQL(2000)"
 #define HT_00132  "MSSQL(2005)"
 #define HT_00133  "PeopleSoft"
@@ -389,18 +395,36 @@ extern hc_thread_mutex_t mux_display;
 #define HT_02612  "PHPS"
 #define HT_02711  "vBulletin > v3.8.5"
 #define HT_02811  "IPB2+, MyBB1.2+"
-#define HT_06211  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 512 bit"
-#define HT_06212  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 1024 bit"
-#define HT_06213  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 1536 bit"
-#define HT_06221  "TrueCrypt 5.0+ PBKDF2-HMAC-SHA512 + XTS 512 bit"
-#define HT_06222  "TrueCrypt 5.0+ PBKDF2-HMAC-SHA512 + XTS 1024 bit"
-#define HT_06223  "TrueCrypt 5.0+ PBKDF2-HMAC-SHA512 + XTS 1536 bit"
-#define HT_06231  "TrueCrypt 5.0+ PBKDF2-HMAC-Whirlpool + XTS 512 bit"
-#define HT_06232  "TrueCrypt 5.0+ PBKDF2-HMAC-Whirlpool + XTS 1024 bit"
-#define HT_06233  "TrueCrypt 5.0+ PBKDF2-HMAC-Whirlpool + XTS 1536 bit"
-#define HT_06241  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 512 bit + boot-mode"
-#define HT_06242  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 1024 bit + boot-mode"
-#define HT_06243  "TrueCrypt 5.0+ PBKDF2-HMAC-RipeMD160 + XTS 1536 bit + boot-mode"
+#define HT_06211  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 512 bit"
+#define HT_06212  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 1024 bit"
+#define HT_06213  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 1536 bit"
+#define HT_06221  "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 512 bit"
+#define HT_06222  "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 1024 bit"
+#define HT_06223  "TrueCrypt PBKDF2-HMAC-SHA512 + XTS 1536 bit"
+#define HT_06231  "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 512 bit"
+#define HT_06232  "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 1024 bit"
+#define HT_06233  "TrueCrypt PBKDF2-HMAC-Whirlpool + XTS 1536 bit"
+#define HT_06241  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 512 bit + boot-mode"
+#define HT_06242  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 1024 bit + boot-mode"
+#define HT_06243  "TrueCrypt PBKDF2-HMAC-RipeMD160 + XTS 1536 bit + boot-mode"
+#define HT_13711  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 512 bit"
+#define HT_13712  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 1024 bit"
+#define HT_13713  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 1536 bit"
+#define HT_13721  "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 512 bit"
+#define HT_13722  "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 1024 bit"
+#define HT_13723  "VeraCrypt PBKDF2-HMAC-SHA512 + XTS 1536 bit"
+#define HT_13731  "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 512 bit"
+#define HT_13732  "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 1024 bit"
+#define HT_13733  "VeraCrypt PBKDF2-HMAC-Whirlpool + XTS 1536 bit"
+#define HT_13741  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 512 bit + boot-mode"
+#define HT_13742  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 1024 bit + boot-mode"
+#define HT_13743  "VeraCrypt PBKDF2-HMAC-RipeMD160 + XTS 1536 bit + boot-mode"
+#define HT_13751  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 512 bit"
+#define HT_13752  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1024 bit"
+#define HT_13753  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit"
+#define HT_13761  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 512 bit + boot-mode"
+#define HT_13762  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1024 bit + boot-mode"
+#define HT_13763  "VeraCrypt PBKDF2-HMAC-SHA256 + XTS 1536 bit + boot-mode"
 
 /**
  * Outfile formats
@@ -443,8 +467,6 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_150   40 + 1 + 51
 #define DISPLAY_LEN_MIN_150H  40 + 1 + 0
 #define DISPLAY_LEN_MAX_150H  40 + 1 + 102
-#define DISPLAY_LEN_MIN_190   40
-#define DISPLAY_LEN_MAX_190   40
 #define DISPLAY_LEN_MIN_200   16
 #define DISPLAY_LEN_MAX_200   16
 #define DISPLAY_LEN_MIN_300   40
@@ -659,8 +681,8 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_11100 10 + 32 + 1 + 8 + 1 + 32
 #define DISPLAY_LEN_MIN_11200 9 + 40 + 1 + 40
 #define DISPLAY_LEN_MAX_11200 9 + 40 + 1 + 40
-#define DISPLAY_LEN_MIN_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 1 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 66
-#define DISPLAY_LEN_MAX_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 6 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 66
+#define DISPLAY_LEN_MIN_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 1 + 1 + 2 + 1 + 96 + 1 + 1 + 1 + 2
+#define DISPLAY_LEN_MAX_11300 1 + 7 + 1 + 2 + 1 + 96 + 1 + 2 + 1 + 16 + 1 + 6 + 1 + 2 + 1 + 96 + 1 + 3 + 1 + 512
 #define DISPLAY_LEN_MIN_11400 6 +   0 + 1 +   0 + 1 +   0 + 1 +   0 + 1 +   0 + 1 +   0 + 1 +   1 + 1 +   0 + 1 +  1 + 1 +  0 + 1 +  0 + 1 +  0 + 1 + 3 + 1 + 32
 #define DISPLAY_LEN_MAX_11400 6 + 512 + 1 + 512 + 1 + 116 + 1 + 116 + 1 + 246 + 1 + 245 + 1 + 246 + 1 + 245 + 1 + 50 + 1 + 50 + 1 + 50 + 1 + 50 + 1 + 3 + 1 + 32
 #define DISPLAY_LEN_MIN_11500 8 + 1 + 8
@@ -701,6 +723,16 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_13100  1 + 7 + 1 + 2 + 1 + 2 + 512 + 1 + 32 + 1 + 20480
 #define DISPLAY_LEN_MIN_13200  1 + 7 + 1 + 1 + 1 + 1 + 1 + 1 + 32 + 1 + 48
 #define DISPLAY_LEN_MAX_13200  1 + 7 + 1 + 1 + 1 + 1 + 50 + 1 + 32 + 1 + 48 + 1 + 20480
+#define DISPLAY_LEN_MIN_13300  1 + 12 + 1 + 32
+#define DISPLAY_LEN_MAX_13300  1 + 12 + 1 + 40
+#define DISPLAY_LEN_MIN_13400  1 + 7 + 1 + 1 + 1 + 1 + 1 + 1 + 32 + 1 + 64 + 1 + 32 + 1 + 64 + 1 + 1 + 1 + 1
+#define DISPLAY_LEN_MAX_13400  1 + 7 + 1 + 1 + 10 + 1 + 3 + 1 + 64 + 1 + 64 + 1 + 32 + 1 + 64 + 1 + 4 + 1 + 600000 + 1 + 2 + 1 + 64
+#define DISPLAY_LEN_MIN_13500 40 + 1 + 32
+#define DISPLAY_LEN_MAX_13500 40 + 1 + 1024
+#define DISPLAY_LEN_MIN_13600 6 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 16 + 1 + 1 + 1 + 1 + 1 +    0 + 1 + 20 + 1 + 7
+#define DISPLAY_LEN_MAX_13600 6 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 32 + 1 + 4 + 1 + 4 + 1 + 8192 + 1 + 20 + 1 + 7
+#define DISPLAY_LEN_MIN_13800  64 + 1 + 256
+#define DISPLAY_LEN_MAX_13800  64 + 1 + 256
 
 #define DISPLAY_LEN_MIN_11    32 + 1 + 16
 #define DISPLAY_LEN_MAX_11    32 + 1 + 32
@@ -715,9 +747,9 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MIN_21H   32 + 1 + 2
 #define DISPLAY_LEN_MAX_21H   32 + 1 + 30
 #define DISPLAY_LEN_MIN_22    30 + 1 + 1
-#define DISPLAY_LEN_MAX_22    30 + 1 + 15
+#define DISPLAY_LEN_MAX_22    30 + 1 + 28
 #define DISPLAY_LEN_MIN_22H   30 + 1 + 2
-#define DISPLAY_LEN_MAX_22H   30 + 1 + 30
+#define DISPLAY_LEN_MAX_22H   30 + 1 + 56
 #define DISPLAY_LEN_MIN_23    32 + 1 + 0
 #define DISPLAY_LEN_MAX_23    32 + 1 + 23
 #define DISPLAY_LEN_MIN_101    5 + 28
@@ -734,6 +766,8 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_122    8 + 40
 #define DISPLAY_LEN_MIN_124   4 + 1 +  0 + 1 + 40
 #define DISPLAY_LEN_MAX_124   4 + 1 + 32 + 1 + 40
+#define DISPLAY_LEN_MIN_125   10 + 40
+#define DISPLAY_LEN_MAX_125   10 + 40
 #define DISPLAY_LEN_MIN_131    6 +  8 + 80
 #define DISPLAY_LEN_MAX_131    6 +  8 + 80
 #define DISPLAY_LEN_MIN_132    6 +  8 + 40
@@ -815,6 +849,7 @@ extern hc_thread_mutex_t mux_display;
 #define HASH_TYPE_BSDICRYPT      48
 #define HASH_TYPE_RAR3HP         49
 #define HASH_TYPE_KRB5TGS        50
+#define HASH_TYPE_STDOUT         51
 
 #define KERN_TYPE_MD5                 0
 #define KERN_TYPE_MD5_PWSLT           10
@@ -830,7 +865,6 @@ extern hc_thread_mutex_t mux_display;
 #define KERN_TYPE_SHA1_SLTPWU         140
 #define KERN_TYPE_HMACSHA1_PW         150
 #define KERN_TYPE_HMACSHA1_SLT        160
-#define KERN_TYPE_SHA1_LINKEDIN       190
 #define KERN_TYPE_MYSQL               200
 #define KERN_TYPE_MYSQL41             300
 #define KERN_TYPE_PHPASS              400
@@ -855,6 +889,7 @@ extern hc_thread_mutex_t mux_display;
 #define KERN_TYPE_HMACSHA512_PW       1750
 #define KERN_TYPE_HMACSHA512_SLT      1760
 #define KERN_TYPE_SHA512CRYPT         1800
+#define KERN_TYPE_STDOUT              2000
 #define KERN_TYPE_DCC2                2100
 #define KERN_TYPE_MD5PIX              2400
 #define KERN_TYPE_MD5ASA              2410
@@ -894,6 +929,9 @@ extern hc_thread_mutex_t mux_display;
 #define KERN_TYPE_TCWHIRLPOOL_XTS512  6231
 #define KERN_TYPE_TCWHIRLPOOL_XTS1024 6232
 #define KERN_TYPE_TCWHIRLPOOL_XTS1536 6233
+#define KERN_TYPE_VCSHA256_XTS512     13751
+#define KERN_TYPE_VCSHA256_XTS1024    13752
+#define KERN_TYPE_VCSHA256_XTS1536    13753
 #define KERN_TYPE_MD5AIX              6300
 #define KERN_TYPE_SHA256AIX           6400
 #define KERN_TYPE_SHA512AIX           6500
@@ -962,6 +1000,11 @@ extern hc_thread_mutex_t mux_display;
 #define KERN_TYPE_RAR5                13000
 #define KERN_TYPE_KRB5TGS             13100
 #define KERN_TYPE_AXCRYPT             13200
+#define KERN_TYPE_SHA1_AXCRYPT        13300
+#define KERN_TYPE_KEEPASS             13400
+#define KERN_TYPE_PSTOKEN             13500
+#define KERN_TYPE_ZIP2                13600
+#define KERN_TYPE_WIN8PHONE           13800
 
 /**
  * signatures
@@ -1033,6 +1076,10 @@ extern hc_thread_mutex_t mux_display;
 #define SIGNATURE_RAR5            "$rar5$"
 #define SIGNATURE_KRB5TGS         "$krb5tgs$23"
 #define SIGNATURE_AXCRYPT         "$axcrypt$*1"
+#define SIGNATURE_AXCRYPT_SHA1    "$axcrypt_sha1"
+#define SIGNATURE_KEEPASS         "$keepass$"
+#define SIGNATURE_ZIP2_START      "$zip2$"
+#define SIGNATURE_ZIP2_STOP       "$/zip2$"
 
 /**
  * Default iteration numbers
@@ -1046,6 +1093,10 @@ extern hc_thread_mutex_t mux_display;
 #define ROUNDS_ANDROIDPIN         1024
 #define ROUNDS_TRUECRYPT_1K       1000
 #define ROUNDS_TRUECRYPT_2K       2000
+#define ROUNDS_VERACRYPT_200000   200000
+#define ROUNDS_VERACRYPT_500000   500000
+#define ROUNDS_VERACRYPT_327661   327661
+#define ROUNDS_VERACRYPT_655331   655331
 #define ROUNDS_SHA1AIX            (1 << 6)
 #define ROUNDS_SHA256AIX          (1 << 6)
 #define ROUNDS_SHA512AIX          (1 << 6)
@@ -1085,6 +1136,9 @@ extern hc_thread_mutex_t mux_display;
 #define ROUNDS_ANDROIDFDE_SAMSUNG 4096
 #define ROUNDS_RAR5               (1 << 15)
 #define ROUNDS_AXCRYPT            10000
+#define ROUNDS_KEEPASS            6000
+#define ROUNDS_ZIP2               1000
+#define ROUNDS_STDOUT             0
 
 /**
  * salt types
@@ -1114,10 +1168,11 @@ extern hc_thread_mutex_t mux_display;
 #define OPTI_TYPE_SINGLE_SALT       (1 << 12)
 #define OPTI_TYPE_BRUTE_FORCE       (1 << 13)
 #define OPTI_TYPE_RAW_HASH          (1 << 14)
-#define OPTI_TYPE_USES_BITS_8       (1 << 15)
-#define OPTI_TYPE_USES_BITS_16      (1 << 16)
-#define OPTI_TYPE_USES_BITS_32      (1 << 17)
-#define OPTI_TYPE_USES_BITS_64      (1 << 18)
+#define OPTI_TYPE_SLOW_HASH_SIMD    (1 << 15)
+#define OPTI_TYPE_USES_BITS_8       (1 << 16)
+#define OPTI_TYPE_USES_BITS_16      (1 << 17)
+#define OPTI_TYPE_USES_BITS_32      (1 << 18)
+#define OPTI_TYPE_USES_BITS_64      (1 << 19)
 
 #define OPTI_STR_ZERO_BYTE          "Zero-Byte"
 #define OPTI_STR_PRECOMPUTE_INIT    "Precompute-Init"
@@ -1133,6 +1188,7 @@ extern hc_thread_mutex_t mux_display;
 #define OPTI_STR_SINGLE_SALT        "Single-Salt"
 #define OPTI_STR_BRUTE_FORCE        "Brute-Force"
 #define OPTI_STR_RAW_HASH           "Raw-Hash"
+#define OPTI_STR_SLOW_HASH_SIMD     "Slow-Hash-SIMD"
 #define OPTI_STR_USES_BITS_8        "Uses-8-Bit"
 #define OPTI_STR_USES_BITS_16       "Uses-16-Bit"
 #define OPTI_STR_USES_BITS_32       "Uses-32-Bit"
@@ -1174,7 +1230,6 @@ extern hc_thread_mutex_t mux_display;
  * digests
  */
 
-#define DGST_SIZE_0                 0
 #define DGST_SIZE_4_2               (2  * sizeof (uint))   // 8
 #define DGST_SIZE_4_4               (4  * sizeof (uint))   // 16
 #define DGST_SIZE_4_5               (5  * sizeof (uint))   // 20
@@ -1207,7 +1262,8 @@ extern hc_thread_mutex_t mux_display;
 #define PARSER_PSAFE2_FILE_SIZE    -13
 #define PARSER_PSAFE3_FILE_SIZE    -14
 #define PARSER_TC_FILE_SIZE        -15
-#define PARSER_SIP_AUTH_DIRECTIVE  -16
+#define PARSER_VC_FILE_SIZE        -16
+#define PARSER_SIP_AUTH_DIRECTIVE  -17
 #define PARSER_UNKNOWN_ERROR       -255
 
 #define PA_000 "OK"
@@ -1226,7 +1282,8 @@ extern hc_thread_mutex_t mux_display;
 #define PA_013 "Invalid psafe2 filesize"
 #define PA_014 "Invalid psafe3 filesize"
 #define PA_015 "Invalid truecrypt filesize"
-#define PA_016 "Invalid SIP directive, only MD5 is supported"
+#define PA_016 "Invalid veracrypt filesize"
+#define PA_017 "Invalid SIP directive, only MD5 is supported"
 #define PA_255 "Unknown error"
 
 /**
@@ -1349,7 +1406,7 @@ u32 get_random_num (const u32 min, const u32 max);
 u32 mydivc32 (const u32 dividend, const u32 divisor);
 u64 mydivc64 (const u64 dividend, const u64 divisor);
 
-void ascii_digest (char out_buf[1024], uint salt_pos, uint digest_pos);
+void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos);
 void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos);
 
 void format_speed_display (float val, char *buf, size_t len);
@@ -1390,31 +1447,37 @@ void fsync (int fd);
 
 #ifdef HAVE_HWMON
 
-#if defined(HAVE_NVML) || defined(HAVE_NVAPI)
-int hm_get_adapter_index_nv (HM_ADAPTER_NV nvGPUHandle[DEVICES_MAX]);
-#endif
+int get_adapters_num_adl (void *adl, int *iNumberAdapters);
+
+int hm_get_adapter_index_adl (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
 
-#ifdef HAVE_ADL
-int get_adapters_num_amd (void *adl, int *iNumberAdapters);
+int hm_get_adapter_index_nvapi (HM_ADAPTER_NVAPI nvapiGPUHandle[DEVICES_MAX]);
 
-int hm_get_adapter_index_amd (hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
+int hm_get_adapter_index_nvml (HM_ADAPTER_NVML nvmlGPUHandle[DEVICES_MAX]);
 
-LPAdapterInfo hm_get_adapter_info_amd (void *adl, int iNumberAdapters);
+LPAdapterInfo hm_get_adapter_info_adl (void *adl, int iNumberAdapters);
 
 u32 *hm_get_list_valid_adl_adapters (int iNumberAdapters, int *num_adl_adapters, LPAdapterInfo lpAdapterInfo);
 
 int hm_get_overdrive_version  (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
 int hm_check_fanspeed_control (void *adl, hm_attrs_t *hm_device, u32 *valid_adl_device_list, int num_adl_adapters, LPAdapterInfo lpAdapterInfo);
 
-// int hm_get_device_num (void *adl, HM_ADAPTER_AMD hm_adapter_index, int *hm_device_num);
+// int hm_get_device_num (void *adl, HM_ADAPTER_ADL hm_adapter_index, int *hm_device_num);
 // void hm_get_opencl_busid_devid (hm_attrs_t *hm_device, uint opencl_num_devices, cl_device_id *devices);
-#endif // HAVE_ADL
 
-int hm_get_temperature_with_device_id (const uint device_id);
-int hm_get_fanspeed_with_device_id    (const uint device_id);
-int hm_get_utilization_with_device_id (const uint device_id);
-
-int hm_set_fanspeed_with_device_id_amd (const uint device_id, const int fanspeed);
+int hm_get_threshold_slowdown_with_device_id (const uint device_id);
+int hm_get_threshold_shutdown_with_device_id (const uint device_id);
+int hm_get_temperature_with_device_id        (const uint device_id);
+int hm_get_fanspeed_with_device_id           (const uint device_id);
+int hm_get_fanpolicy_with_device_id          (const uint device_id);
+int hm_get_buslanes_with_device_id           (const uint device_id);
+int hm_get_utilization_with_device_id        (const uint device_id);
+int hm_get_memoryspeed_with_device_id        (const uint device_id);
+int hm_get_corespeed_with_device_id          (const uint device_id);
+int hm_get_throttle_with_device_id           (const uint device_id);
+int hm_set_fanspeed_with_device_id_adl       (const uint device_id, const int fanspeed, const int fanpolicy);
+int hm_set_fanspeed_with_device_id_nvapi     (const uint device_id, const int fanspeed, const int fanpolicy);
+int hm_set_fanspeed_with_device_id_xnvctrl   (const uint device_id, const int fanspeed);
 
 void hm_device_val_to_str (char *target_buf, int max_buf_size, char *suffix, int value);
 #endif // HAVE_HWMON
@@ -1480,11 +1543,11 @@ int oracleh_parse_hash            (char *input_buf, uint input_len, hash_t *hash
 int oracles_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int oraclet_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int osc_parse_hash                (char *input_buf, uint input_len, hash_t *hash_buf);
+int arubaos_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int osx1_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
 int osx512_parse_hash             (char *input_buf, uint input_len, hash_t *hash_buf);
 int phpass_parse_hash             (char *input_buf, uint input_len, hash_t *hash_buf);
 int sha1_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
-int sha1linkedin_parse_hash       (char *input_buf, uint input_len, hash_t *hash_buf);
 int sha1b64_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int sha1b64s_parse_hash           (char *input_buf, uint input_len, hash_t *hash_buf);
 int sha1s_parse_hash              (char *input_buf, uint input_len, hash_t *hash_buf);
@@ -1595,7 +1658,18 @@ int mywallet_parse_hash           (char *input_buf, uint input_len, hash_t *hash
 int ms_drsr_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int androidfde_samsung_parse_hash (char *input_buf, uint input_len, hash_t *hash_buf);
 int axcrypt_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
-
+int sha1axcrypt_parse_hash        (char *input_buf, uint input_len, hash_t *hash_buf);
+int keepass_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
+int pstoken_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
+int zip2_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
+int veracrypt_parse_hash_200000   (char *input_buf, uint input_len, hash_t *hash_buf);
+int veracrypt_parse_hash_500000   (char *input_buf, uint input_len, hash_t *hash_buf);
+int veracrypt_parse_hash_327661   (char *input_buf, uint input_len, hash_t *hash_buf);
+int veracrypt_parse_hash_655331   (char *input_buf, uint input_len, hash_t *hash_buf);
+int win8phone_parse_hash          (char *input_buf, uint input_len, hash_t *hash_buf);
+
+void naive_replace (char *s, const u8 key_char, const u8 replace_char);
+void naive_escape (char *s, size_t s_max, const u8 key_char, const u8 escape_char);
 void load_kernel (const char *kernel_file, int num_devices, size_t *kernel_lengths, const u8 **kernel_sources);
 void writeProgramBin (char *dst, u8 *binary, size_t binary_size);
 
@@ -1660,8 +1734,8 @@ int mangle_title              (char arr[BLOCK_SIZE], int arr_len);
 int generate_random_rule (char rule_buf[RP_RULE_BUFSIZ], u32 rp_gen_func_min, u32 rp_gen_func_max);
 int _old_apply_rule (char *rule, int rule_len, char in[BLOCK_SIZE], int in_len, char out[BLOCK_SIZE]);
 
-int cpu_rule_to_kernel_rule (char rule_buf[BUFSIZ], uint rule_len, kernel_rule_t *rule);
-int kernel_rule_to_cpu_rule (char rule_buf[BUFSIZ], kernel_rule_t *rule);
+int cpu_rule_to_kernel_rule (char *rule_buf, uint rule_len, kernel_rule_t *rule);
+int kernel_rule_to_cpu_rule (char *rule_buf, kernel_rule_t *rule);
 
 void *thread_device_watch (void *p);
 void *thread_keypress     (void *p);