Fixing minor definitions.
[hashcat.git] / include / shared.h
index 41d388d..d690571 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * Authors.....: Jens Steube <jens.steube@gmail.com>
  *               Gabriele Gristina <matrix@hashcat.net>
+ *               magnum <john.magnum@hushmail.com>
  *
  * License.....: MIT
  */
@@ -153,16 +154,16 @@ static inline int  CPU_ISSET (int num, cpu_set_t *cs) { return (cs->count & (1 <
 #define SP_ROOT_CNT           (SP_PW_MAX * CHARSIZ)
 #define SP_MARKOV_CNT         (SP_PW_MAX * CHARSIZ * CHARSIZ)
 
-#define TUNING_DB_FILE                  "hashcat_tuning.hctab"
-#define TUNING_DB_DEFAULT_VECTOR_WIDTH  1
-#define TUNING_DB_DEFAULT_KERNEL_ACCEL  1
-#define TUNING_DB_DEFAULT_KERNEL_LOOPS  1
+#define TUNING_DB_FILE        "hashcat_tuning.hctab"
 
 #define INDUCT_DIR            "induct"
 #define OUTFILES_DIR          "outfiles"
 
 #define LOOPBACK_FILE         "hashcat.loopback"
 
+#define DICTSTAT_FILENAME     "hashcat.dictstat"
+#define POTFILE_FILENAME      "hashcat.pot"
+
 /**
  * types
  */
@@ -197,27 +198,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
  */
@@ -364,6 +344,11 @@ extern hc_thread_mutex_t mux_display;
 #define HT_12800  "MS-AzureSync PBKDF2-HMAC-SHA256"
 #define HT_12900  "Android FDE (Samsung DEK)"
 #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_00011  "Joomla < 2.5.18"
 #define HT_00012  "PostgreSQL"
@@ -376,6 +361,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"
@@ -697,6 +683,16 @@ extern hc_thread_mutex_t mux_display;
 #define DISPLAY_LEN_MAX_12900 64 + 64 + 32
 #define DISPLAY_LEN_MIN_13000 1 + 4 + 1 + 2 + 1 + 32 + 1 + 2 + 1 + 32 + 1 + 1 + 1 + 16
 #define DISPLAY_LEN_MAX_13000 1 + 4 + 1 + 2 + 1 + 32 + 1 + 2 + 1 + 32 + 1 + 1 + 1 + 16
+#define DISPLAY_LEN_MIN_13100  1 + 7 + 1 + 2 + 1 + 0 + 0 + 32 + 1 + 64
+#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_11    32 + 1 + 16
 #define DISPLAY_LEN_MAX_11    32 + 1 + 32
@@ -711,9 +707,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
@@ -730,6 +726,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
@@ -810,6 +808,7 @@ extern hc_thread_mutex_t mux_display;
 #define HASH_TYPE_ORACLET        47
 #define HASH_TYPE_BSDICRYPT      48
 #define HASH_TYPE_RAR3HP         49
+#define HASH_TYPE_KRB5TGS        50
 
 #define KERN_TYPE_MD5                 0
 #define KERN_TYPE_MD5_PWSLT           10
@@ -955,6 +954,10 @@ extern hc_thread_mutex_t mux_display;
 #define KERN_TYPE_MS_DRSR             12800
 #define KERN_TYPE_ANDROIDFDE_SAMSUNG  12900
 #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
 
 /**
  * signatures
@@ -1024,6 +1027,10 @@ extern hc_thread_mutex_t mux_display;
 #define SIGNATURE_MYWALLET        "$blockchain$"
 #define SIGNATURE_MS_DRSR         "v1;PPH1_MD4"
 #define SIGNATURE_RAR5            "$rar5$"
+#define SIGNATURE_KRB5TGS         "$krb5tgs$23"
+#define SIGNATURE_AXCRYPT         "$axcrypt$*1"
+#define SIGNATURE_AXCRYPT_SHA1     "$axcrypt_sha1"
+#define SIGNATURE_KEEPASS         "$keepass$"
 
 /**
  * Default iteration numbers
@@ -1075,6 +1082,8 @@ extern hc_thread_mutex_t mux_display;
 #define ROUNDS_MS_DRSR            100
 #define ROUNDS_ANDROIDFDE_SAMSUNG 4096
 #define ROUNDS_RAR5               (1 << 15)
+#define ROUNDS_AXCRYPT            10000
+#define ROUNDS_KEEPASS            6000
 
 /**
  * salt types
@@ -1233,6 +1242,7 @@ extern hc_thread_mutex_t mux_display;
 #define STATUS_QUIT               7
 #define STATUS_BYPASS             8
 #define STATUS_STOP_AT_CHECKPOINT 9
+#define STATUS_AUTOTUNE           10
 
 #define ST_0000 "Initializing"
 #define ST_0001 "Starting"
@@ -1244,6 +1254,7 @@ extern hc_thread_mutex_t mux_display;
 #define ST_0007 "Quit"
 #define ST_0008 "Bypass"
 #define ST_0009 "Running (stop at checkpoint)"
+#define ST_0010 "Autotuning"
 
 /**
  * kernel types
@@ -1263,6 +1274,8 @@ extern hc_thread_mutex_t mux_display;
  * functions
  */
 
+u32 is_power_of_2(u32 v);
+
 u32 rotl32 (const u32 a, const u32 n);
 u32 rotr32 (const u32 a, const u32 n);
 u64 rotl64 (const u64 a, const u64 n);
@@ -1288,6 +1301,7 @@ uint count_lines (FILE *fd);
 
 void *rulefind (const void *key, void *base, int nmemb, size_t size, int (*compar) (const void *, const void *));
 
+int sort_by_u32          (const void *p1, const void *p2);
 int sort_by_mtime        (const void *p1, const void *p2);
 int sort_by_cpu_rule     (const void *p1, const void *p2);
 int sort_by_kernel_rule  (const void *p1, const void *p2);
@@ -1334,7 +1348,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);
@@ -1433,7 +1447,7 @@ void sp_stretch_root (hcstat_table_t *in, hcstat_table_t *out);
 void tuning_db_destroy (tuning_db_t *tuning_db);
 tuning_db_t *tuning_db_alloc (FILE *fp);
 tuning_db_t *tuning_db_init (const char *tuning_db_file);
-tuning_db_entry_t *tuning_db_search (tuning_db_t *tuning_db, char *device_name, int attack_mode, int hash_type, int workload_profile);
+tuning_db_entry_t *tuning_db_search (tuning_db_t *tuning_db, hc_device_param_t *device_param, int attack_mode, int hash_type);
 
 int bcrypt_parse_hash             (char *input_buf, uint input_len, hash_t *hash_buf);
 int cisco4_parse_hash             (char *input_buf, uint input_len, hash_t *hash_buf);
@@ -1465,6 +1479,7 @@ 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);
@@ -1510,6 +1525,7 @@ int hmacsha256_parse_hash         (char *input_buf, uint input_len, hash_t *hash
 int hmacsha512_parse_hash         (char *input_buf, uint input_len, hash_t *hash_buf);
 int hmacmd5_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int krb5pa_parse_hash             (char *input_buf, uint input_len, hash_t *hash_buf);
+int krb5tgs_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
 int sapb_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
 int sapg_parse_hash               (char *input_buf, uint input_len, hash_t *hash_buf);
 int drupal7_parse_hash            (char *input_buf, uint input_len, hash_t *hash_buf);
@@ -1578,6 +1594,10 @@ int cf10_parse_hash               (char *input_buf, uint input_len, hash_t *hash
 int mywallet_parse_hash           (char *input_buf, uint input_len, hash_t *hash_buf);
 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);
 
 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);
@@ -1643,8 +1663,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);