1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-22 16:18:09 +00:00

Move benchmark related stuff to benchmark.c

This commit is contained in:
jsteube 2016-09-12 10:16:42 +02:00
parent 10b4670682
commit e25224a940
8 changed files with 619 additions and 637 deletions

View File

@ -6,4 +6,8 @@
#ifndef _BENCHMARK_H
#define _BENCHMARK_H
#define BENCHMARK 0
#define DEFAULT_BENCHMARK_ALGORITHMS_CNT 146
#endif // _BENCHMARK_H

View File

@ -12,9 +12,13 @@
#include <errno.h>
#include <limits.h>
#define HASH_MODE 0
#define HEX_SALT 0
#define SEPARATOR ':'
#define PW_MIN 0
#define PW_MAX 54
#define PW_MAX1 (PW_MAX + 1)
#define HASH_MODE 0
#define HEX_SALT 0
#define SEPARATOR ':'
/**
* weak hashes shutcut
@ -1661,6 +1665,11 @@ void to_hccap_t (hccap_t *hccap, uint salt_pos, uint digest_pos, hashconfig_t *h
void ascii_digest (char *out_buf, uint salt_pos, uint digest_pos, hashconfig_t *hashconfig, void *digests_buf, salt_t *salts_buf, void *esalts_buf, hashinfo_t **hash_info, char *hashfile);
int hashconfig_init (hashconfig_t *hashconfig, const uint hash_mode, const char separator, const uint hex_salt);
int hashconfig_init (hashconfig_t *hashconfig, const uint hash_mode, const char separator, const uint hex_salt);
void hashconfig_destroy (hashconfig_t *hashconfig);
uint hashconfig_general_pw_min (hashconfig_t *hashconfig);
uint hashconfig_general_pw_max (hashconfig_t *hashconfig);
void hashconfig_benchmark_defaults (hashconfig_t *hashconfig, salt_t *salt, void *esalt);
char *hashconfig_benchmark_mask (hashconfig_t *hashconfig);
#endif // _INTERFACE_H

View File

@ -45,6 +45,7 @@ typedef struct
void mp_css_to_uniq_tbl (uint css_cnt, cs_t *css, uint uniq_tbls[SP_PW_MAX][CHARSIZ]);
void mp_cut_at (char *mask, uint max);
uint mp_get_length (char *mask);
void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt);
cs_t *mp_gen_css (char *mask_buf, size_t mask_len, cs_t *mp_sys, cs_t *mp_usr, uint *css_cnt, hashconfig_t *hashconfig);
u64 mp_get_sum (uint css_cnt, cs_t *css);

View File

@ -215,9 +215,6 @@ typedef struct
} wordr_t;
#define RULES_MAX 256
#define PW_MIN 0
#define PW_MAX 54
#define PW_MAX1 (PW_MAX + 1)
#define PW_DICTMAX 31
#define PW_DICTMAX1 (PW_DICTMAX + 1)

View File

@ -5,3 +5,153 @@
#include "common.h"
#include "benchmark.h"
const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[DEFAULT_BENCHMARK_ALGORITHMS_CNT] =
{
900,
0,
5100,
100,
1400,
10800,
1700,
5000,
10100,
6000,
6100,
6900,
11700,
11800,
14000,
14100,
400,
8900,
11900,
12000,
10900,
12100,
23,
2500,
5300,
5400,
5500,
5600,
7300,
7500,
13100,
8300,
11100,
11200,
11400,
121,
2611,
2711,
2811,
8400,
13900,
11,
2612,
7900,
21,
11000,
124,
10000,
3711,
7600,
12,
131,
132,
1731,
200,
300,
3100,
112,
12300,
8000,
141,
1441,
1600,
12600,
1421,
101,
111,
1711,
3000,
1000,
1100,
2100,
12800,
1500,
12400,
500,
3200,
7400,
1800,
122,
1722,
7100,
6300,
6700,
6400,
6500,
2400,
2410,
5700,
9200,
9300,
22,
501,
5800,
8100,
8500,
7200,
9900,
7700,
7800,
10300,
8600,
8700,
9100,
133,
13500,
11600,
13600,
12500,
13000,
13200,
13300,
6211,
6221,
6231,
6241,
13711,
13721,
13731,
13741,
13751,
13761,
8800,
12900,
12200,
9700,
9710,
9800,
9810,
9400,
9500,
9600,
10400,
10410,
10500,
10600,
10700,
9000,
5200,
6800,
6600,
8200,
11300,
12700,
13400,
125
};

View File

@ -96,7 +96,9 @@ extern void (*get_next_word_func) (char *, u32, u32 *, u32 *);
extern const unsigned int full01;
extern const unsigned int full80;
static const char *PROGNAME = "hashcat";
extern const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[];
static const char PROGNAME[] = "hashcat";
const int comptime = COMPTIME;
@ -104,158 +106,6 @@ const int comptime = COMPTIME;
// benchmark
#define BENCHMARK 0
#define NUM_DEFAULT_BENCHMARK_ALGORITHMS 146
static uint default_benchmark_algorithms[NUM_DEFAULT_BENCHMARK_ALGORITHMS] =
{
900,
0,
5100,
100,
1400,
10800,
1700,
5000,
10100,
6000,
6100,
6900,
11700,
11800,
14000,
14100,
400,
8900,
11900,
12000,
10900,
12100,
23,
2500,
5300,
5400,
5500,
5600,
7300,
7500,
13100,
8300,
11100,
11200,
11400,
121,
2611,
2711,
2811,
8400,
13900,
11,
2612,
7900,
21,
11000,
124,
10000,
3711,
7600,
12,
131,
132,
1731,
200,
300,
3100,
112,
12300,
8000,
141,
1441,
1600,
12600,
1421,
101,
111,
1711,
3000,
1000,
1100,
2100,
12800,
1500,
12400,
500,
3200,
7400,
1800,
122,
1722,
7100,
6300,
6700,
6400,
6500,
2400,
2410,
5700,
9200,
9300,
22,
501,
5800,
8100,
8500,
7200,
9900,
7700,
7800,
10300,
8600,
8700,
9100,
133,
13500,
11600,
13600,
12500,
13000,
13200,
13300,
6211,
6221,
6231,
6241,
13711,
13721,
13731,
13741,
13751,
13761,
8800,
12900,
12200,
9700,
9710,
9800,
9810,
9400,
9500,
9600,
10400,
10410,
10500,
10600,
10700,
9000,
5200,
6800,
6600,
8200,
11300,
12700,
13400,
125
};
// outfile_check
#define OUTFILE_CHECK_TIMER 5
@ -5887,9 +5737,9 @@ int main (int argc, char **argv)
uint algorithm_pos = 0;
uint algorithm_max = 1;
uint *algorithms = default_benchmark_algorithms;
const int *algorithms = DEFAULT_BENCHMARK_ALGORITHMS_BUF;
if (benchmark == 1 && hash_mode_chgd == 0) algorithm_max = NUM_DEFAULT_BENCHMARK_ALGORITHMS;
if (benchmark == 1 && hash_mode_chgd == 0) algorithm_max = DEFAULT_BENCHMARK_ALGORITHMS_CNT;
for (algorithm_pos = 0; algorithm_pos < algorithm_max; algorithm_pos++)
{
@ -6003,77 +5853,8 @@ int main (int argc, char **argv)
* word len
*/
uint pw_min = PW_MIN;
uint pw_max = PW_MAX;
switch (hashconfig->hash_mode)
{
case 125: if (pw_max > 32) pw_max = 32;
break;
case 400: if (pw_max > 40) pw_max = 40;
break;
case 500: if (pw_max > 16) pw_max = 16;
break;
case 1500: if (pw_max > 8) pw_max = 8;
break;
case 1600: if (pw_max > 16) pw_max = 16;
break;
case 1800: if (pw_max > 16) pw_max = 16;
break;
case 2100: if (pw_max > 16) pw_max = 16;
break;
case 2500: if (pw_min < 8) pw_min = 8;
break;
case 3000: if (pw_max > 7) pw_max = 7;
break;
case 5200: if (pw_max > 24) pw_max = 24;
break;
case 5800: if (pw_max > 16) pw_max = 16;
break;
case 6300: if (pw_max > 16) pw_max = 16;
break;
case 7400: if (pw_max > 16) pw_max = 16;
break;
case 7700: if (pw_max > 8) pw_max = 8;
break;
case 7900: if (pw_max > 48) pw_max = 48;
break;
case 8500: if (pw_max > 8) pw_max = 8;
break;
case 8600: if (pw_max > 16) pw_max = 16;
break;
case 9710: pw_min = 5;
pw_max = 5;
break;
case 9810: pw_min = 5;
pw_max = 5;
break;
case 10410: pw_min = 5;
pw_max = 5;
break;
case 10300: if (pw_max < 3) pw_min = 3;
if (pw_max > 40) pw_max = 40;
break;
case 10500: if (pw_max < 3) pw_min = 3;
if (pw_max > 40) pw_max = 40;
break;
case 10700: if (pw_max > 16) pw_max = 16;
break;
case 11300: if (pw_max > 40) pw_max = 40;
break;
case 11600: if (pw_max > 32) pw_max = 32;
break;
case 12500: if (pw_max > 20) pw_max = 20;
break;
case 12800: if (pw_max > 24) pw_max = 24;
break;
case 14000: if (pw_min < 8) pw_min = 8;
if (pw_max > 8) pw_max = 8;
break;
case 14100: if (pw_min < 24) pw_min = 24;
if (pw_max > 24) pw_max = 24;
break;
}
uint pw_min = hashconfig_general_pw_min (hashconfig);
uint pw_max = hashconfig_general_pw_max (hashconfig);
if (hashconfig->attack_exec == ATTACK_EXEC_INSIDE_KERNEL)
{
@ -6692,394 +6473,9 @@ int main (int argc, char **argv)
}
else
{
if (hashconfig->is_salted)
{
hashes_buf[0].salt->salt_len = 8;
hashconfig_benchmark_defaults (hashconfig, hashes_buf[0].salt, hashes_buf[0].esalt);
// special salt handling
switch (hashconfig->hash_mode)
{
case 1500: hashes_buf[0].salt->salt_len = 2;
hashes_buf[0].salt->salt_buf[0] = 388; // pure magic
break;
case 1731: hashes_buf[0].salt->salt_len = 4;
break;
case 2410: hashes_buf[0].salt->salt_len = 4;
break;
case 2500: memcpy (hashes_buf[0].salt->salt_buf, "hashcat.net", 11);
break;
case 3100: hashes_buf[0].salt->salt_len = 1;
break;
case 5000: hashes_buf[0].salt->keccak_mdlen = 32;
break;
case 5800: hashes_buf[0].salt->salt_len = 16;
break;
case 6800: hashes_buf[0].salt->salt_len = 32;
break;
case 8400: hashes_buf[0].salt->salt_len = 40;
break;
case 8800: hashes_buf[0].salt->salt_len = 16;
break;
case 8900: hashes_buf[0].salt->salt_len = 16;
hashes_buf[0].salt->scrypt_N = 1024;
hashes_buf[0].salt->scrypt_r = 1;
hashes_buf[0].salt->scrypt_p = 1;
break;
case 9100: hashes_buf[0].salt->salt_len = 16;
break;
case 9300: hashes_buf[0].salt->salt_len = 14;
hashes_buf[0].salt->scrypt_N = 16384;
hashes_buf[0].salt->scrypt_r = 1;
hashes_buf[0].salt->scrypt_p = 1;
break;
case 9400: hashes_buf[0].salt->salt_len = 16;
break;
case 9500: hashes_buf[0].salt->salt_len = 16;
break;
case 9600: hashes_buf[0].salt->salt_len = 16;
break;
case 9700: hashes_buf[0].salt->salt_len = 16;
break;
case 9710: hashes_buf[0].salt->salt_len = 16;
break;
case 9720: hashes_buf[0].salt->salt_len = 16;
break;
case 9800: hashes_buf[0].salt->salt_len = 16;
break;
case 9810: hashes_buf[0].salt->salt_len = 16;
break;
case 9820: hashes_buf[0].salt->salt_len = 16;
break;
case 10300: hashes_buf[0].salt->salt_len = 12;
break;
case 11500: hashes_buf[0].salt->salt_len = 4;
break;
case 11600: hashes_buf[0].salt->salt_len = 4;
break;
case 12400: hashes_buf[0].salt->salt_len = 4;
break;
case 12500: hashes_buf[0].salt->salt_len = 8;
break;
case 12600: hashes_buf[0].salt->salt_len = 64;
break;
case 14000: hashes_buf[0].salt->salt_len = 8;
break;
case 14100: hashes_buf[0].salt->salt_len = 8;
break;
}
// special esalt handling
switch (hashconfig->hash_mode)
{
case 2500: ((wpa_t *) hashes_buf[0].esalt)->eapol_size = 128;
break;
case 5300: ((ikepsk_t *) hashes_buf[0].esalt)->nr_len = 1;
((ikepsk_t *) hashes_buf[0].esalt)->msg_len = 1;
break;
case 5400: ((ikepsk_t *) hashes_buf[0].esalt)->nr_len = 1;
((ikepsk_t *) hashes_buf[0].esalt)->msg_len = 1;
break;
case 5500: ((netntlm_t *) hashes_buf[0].esalt)->user_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->domain_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->srvchall_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->clichall_len = 1;
break;
case 5600: ((netntlm_t *) hashes_buf[0].esalt)->user_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->domain_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->srvchall_len = 1;
((netntlm_t *) hashes_buf[0].esalt)->clichall_len = 1;
break;
case 7300: ((rakp_t *) hashes_buf[0].esalt)->salt_len = 32;
break;
case 10400: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 32;
((pdf_t *) hashes_buf[0].esalt)->u_len = 32;
break;
case 10410: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 32;
((pdf_t *) hashes_buf[0].esalt)->u_len = 32;
break;
case 10420: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 32;
((pdf_t *) hashes_buf[0].esalt)->u_len = 32;
break;
case 10500: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 32;
((pdf_t *) hashes_buf[0].esalt)->u_len = 32;
break;
case 10600: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 127;
((pdf_t *) hashes_buf[0].esalt)->u_len = 127;
break;
case 10700: ((pdf_t *) hashes_buf[0].esalt)->id_len = 16;
((pdf_t *) hashes_buf[0].esalt)->o_len = 127;
((pdf_t *) hashes_buf[0].esalt)->u_len = 127;
break;
case 11600: ((seven_zip_t *) hashes_buf[0].esalt)->iv_len = 16;
((seven_zip_t *) hashes_buf[0].esalt)->data_len = 112;
((seven_zip_t *) hashes_buf[0].esalt)->unpack_size = 112;
break;
case 13400: ((keepass_t *) hashes_buf[0].esalt)->version = 2;
break;
case 13500: ((pstoken_t *) hashes_buf[0].esalt)->salt_len = 113;
break;
case 13600: ((zip2_t *) hashes_buf[0].esalt)->salt_len = 16;
((zip2_t *) hashes_buf[0].esalt)->data_len = 32;
((zip2_t *) hashes_buf[0].esalt)->mode = 3;
break;
}
}
// set hashfile
switch (hashconfig->hash_mode)
{
case 5200: data.hashfile = mystrdup ("hashcat.psafe3");
break;
case 5300: data.hashfile = mystrdup ("hashcat.ikemd5");
break;
case 5400: data.hashfile = mystrdup ("hashcat.ikesha1");
break;
case 6211: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6212: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6213: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6221: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6222: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6223: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6231: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6232: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6233: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6241: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6242: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6243: data.hashfile = mystrdup ("hashcat.tc");
break;
case 6600: data.hashfile = mystrdup ("hashcat.agilekey");
break;
case 8200: data.hashfile = mystrdup ("hashcat.cloudkey");
break;
case 9000: data.hashfile = mystrdup ("hashcat.psafe2");
break;
case 13711: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13712: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13713: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13721: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13722: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13723: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13731: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13732: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13733: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13741: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13742: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13743: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13751: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13752: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13753: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13761: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13762: data.hashfile = mystrdup ("hashcat.vc");
break;
case 13763: data.hashfile = mystrdup ("hashcat.vc");
break;
}
// set default iterations
switch (hashconfig->hash_mode)
{
case 400: hashes_buf[0].salt->salt_iter = ROUNDS_PHPASS;
break;
case 500: hashes_buf[0].salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 501: hashes_buf[0].salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 1600: hashes_buf[0].salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 1800: hashes_buf[0].salt->salt_iter = ROUNDS_SHA512CRYPT;
break;
case 2100: hashes_buf[0].salt->salt_iter = ROUNDS_DCC2;
break;
case 2500: hashes_buf[0].salt->salt_iter = ROUNDS_WPA2;
break;
case 3200: hashes_buf[0].salt->salt_iter = ROUNDS_BCRYPT;
break;
case 5200: hashes_buf[0].salt->salt_iter = ROUNDS_PSAFE3;
break;
case 5800: hashes_buf[0].salt->salt_iter = ROUNDS_ANDROIDPIN - 1;
break;
case 6211: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6212: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6213: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6221: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6222: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6223: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6231: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6232: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6233: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6241: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6242: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6243: hashes_buf[0].salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6300: hashes_buf[0].salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 6400: hashes_buf[0].salt->salt_iter = ROUNDS_SHA256AIX;
break;
case 6500: hashes_buf[0].salt->salt_iter = ROUNDS_SHA512AIX;
break;
case 6700: hashes_buf[0].salt->salt_iter = ROUNDS_SHA1AIX;
break;
case 6600: hashes_buf[0].salt->salt_iter = ROUNDS_AGILEKEY;
break;
case 6800: hashes_buf[0].salt->salt_iter = ROUNDS_LASTPASS;
break;
case 7100: hashes_buf[0].salt->salt_iter = ROUNDS_SHA512OSX;
break;
case 7200: hashes_buf[0].salt->salt_iter = ROUNDS_GRUB;
break;
case 7400: hashes_buf[0].salt->salt_iter = ROUNDS_SHA256CRYPT;
break;
case 7900: hashes_buf[0].salt->salt_iter = ROUNDS_DRUPAL7;
break;
case 8200: hashes_buf[0].salt->salt_iter = ROUNDS_CLOUDKEY;
break;
case 8300: hashes_buf[0].salt->salt_iter = ROUNDS_NSEC3;
break;
case 8800: hashes_buf[0].salt->salt_iter = ROUNDS_ANDROIDFDE;
break;
case 8900: hashes_buf[0].salt->salt_iter = 1;
break;
case 9000: hashes_buf[0].salt->salt_iter = ROUNDS_PSAFE2;
break;
case 9100: hashes_buf[0].salt->salt_iter = ROUNDS_LOTUS8;
break;
case 9200: hashes_buf[0].salt->salt_iter = ROUNDS_CISCO8;
break;
case 9300: hashes_buf[0].salt->salt_iter = 1;
break;
case 9400: hashes_buf[0].salt->salt_iter = ROUNDS_OFFICE2007;
break;
case 9500: hashes_buf[0].salt->salt_iter = ROUNDS_OFFICE2010;
break;
case 9600: hashes_buf[0].salt->salt_iter = ROUNDS_OFFICE2013;
break;
case 10000: hashes_buf[0].salt->salt_iter = ROUNDS_DJANGOPBKDF2;
break;
case 10300: hashes_buf[0].salt->salt_iter = ROUNDS_SAPH_SHA1 - 1;
break;
case 10500: hashes_buf[0].salt->salt_iter = ROUNDS_PDF14;
break;
case 10700: hashes_buf[0].salt->salt_iter = ROUNDS_PDF17L8;
break;
case 10900: hashes_buf[0].salt->salt_iter = ROUNDS_PBKDF2_SHA256 - 1;
break;
case 11300: hashes_buf[0].salt->salt_iter = ROUNDS_BITCOIN_WALLET - 1;
break;
case 11600: hashes_buf[0].salt->salt_iter = ROUNDS_SEVEN_ZIP;
break;
case 11900: hashes_buf[0].salt->salt_iter = ROUNDS_PBKDF2_MD5 - 1;
break;
case 12000: hashes_buf[0].salt->salt_iter = ROUNDS_PBKDF2_SHA1 - 1;
break;
case 12100: hashes_buf[0].salt->salt_iter = ROUNDS_PBKDF2_SHA512 - 1;
break;
case 12200: hashes_buf[0].salt->salt_iter = ROUNDS_ECRYPTFS - 1;
break;
case 12300: hashes_buf[0].salt->salt_iter = ROUNDS_ORACLET - 1;
break;
case 12400: hashes_buf[0].salt->salt_iter = ROUNDS_BSDICRYPT - 1;
break;
case 12500: hashes_buf[0].salt->salt_iter = ROUNDS_RAR3;
break;
case 12700: hashes_buf[0].salt->salt_iter = ROUNDS_MYWALLET;
break;
case 12800: hashes_buf[0].salt->salt_iter = ROUNDS_MS_DRSR - 1;
break;
case 12900: hashes_buf[0].salt->salt_iter = ROUNDS_ANDROIDFDE_SAMSUNG - 1;
break;
case 13000: hashes_buf[0].salt->salt_iter = ROUNDS_RAR5 - 1;
break;
case 13200: hashes_buf[0].salt->salt_iter = ROUNDS_AXCRYPT;
break;
case 13400: hashes_buf[0].salt->salt_iter = ROUNDS_KEEPASS;
break;
case 13600: hashes_buf[0].salt->salt_iter = ROUNDS_ZIP2;
break;
case 13711: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13712: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13713: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13721: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13722: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13723: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13731: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13732: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13733: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13741: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13742: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13743: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13751: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13752: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13753: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13761: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
case 13762: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
case 13763: hashes_buf[0].salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
}
data.hashfile = "-";
hashes_cnt = 1;
}
@ -11815,7 +11211,7 @@ int main (int argc, char **argv)
increment = 1;
maskcnt = 1;
maskcnt = 1;
}
}
else
@ -11824,23 +11220,12 @@ int main (int argc, char **argv)
* generate full masks and charsets
*/
masks = (char **) mymalloc (sizeof (char *));
mask = hashconfig_benchmark_mask (hashconfig);
switch (hashconfig->hash_mode)
{
case 1731: pw_min = 5;
pw_max = 5;
mask = mystrdup ("?b?b?b?b?b");
break;
case 12500: pw_min = 5;
pw_max = 5;
mask = mystrdup ("?b?b?b?b?b");
break;
default: pw_min = 7;
pw_max = 7;
mask = mystrdup ("?b?b?b?b?b?b?b");
break;
}
pw_min = mp_get_length (mask);
pw_max = pw_min;
masks = (char **) mymalloc (sizeof (char *));
maskcnt = 1;

View File

@ -19857,3 +19857,423 @@ int hashconfig_init (hashconfig_t *hashconfig, const uint hash_mode, const char
return 0;
}
void hashconfig_destroy (hashconfig_t *hashconfig)
{
myfree (hashconfig);
}
uint hashconfig_general_pw_min (hashconfig_t *hashconfig)
{
uint pw_min = PW_MIN;
switch (hashconfig->hash_mode)
{
case 2500: pw_min = 8;
break;
case 9710: pw_min = 5;
break;
case 9810: pw_min = 5;
break;
case 10410: pw_min = 5;
break;
case 14000: pw_min = 8;
break;
case 14100: pw_min = 24;
break;
}
return pw_min;
}
uint hashconfig_general_pw_max (hashconfig_t *hashconfig)
{
uint pw_max = PW_MAX;
switch (hashconfig->hash_mode)
{
case 125: pw_max = 32;
break;
case 400: pw_max = 40;
break;
case 500: pw_max = 16;
break;
case 1500: pw_max = 8;
break;
case 1600: pw_max = 16;
break;
case 1800: pw_max = 16;
break;
case 2100: pw_max = 16;
break;
case 3000: pw_max = 7;
break;
case 5200: pw_max = 24;
break;
case 5800: pw_max = 16;
break;
case 6300: pw_max = 16;
break;
case 7400: pw_max = 16;
break;
case 7700: pw_max = 8;
break;
case 7900: pw_max = 48;
break;
case 8500: pw_max = 8;
break;
case 8600: pw_max = 16;
break;
case 9710: pw_max = 5;
break;
case 9810: pw_max = 5;
break;
case 10410: pw_max = 5;
break;
case 10300: pw_max = 40;
break;
case 10500: pw_max = 40;
break;
case 10700: pw_max = 16;
break;
case 11300: pw_max = 40;
break;
case 11600: pw_max = 32;
break;
case 12500: pw_max = 20;
break;
case 12800: pw_max = 24;
break;
case 14000: pw_max = 8;
break;
case 14100: pw_max = 24;
break;
}
return pw_max;
}
void hashconfig_benchmark_defaults (hashconfig_t *hashconfig, salt_t *salt, void *esalt)
{
if (hashconfig->is_salted)
{
salt->salt_len = 8;
// special salt handling
switch (hashconfig->hash_mode)
{
case 1500: salt->salt_len = 2;
salt->salt_buf[0] = 388; // pure magic
break;
case 1731: salt->salt_len = 4;
break;
case 2410: salt->salt_len = 4;
break;
case 2500: memcpy (salt->salt_buf, "hashcat.net", 11);
break;
case 3100: salt->salt_len = 1;
break;
case 5000: salt->keccak_mdlen = 32;
break;
case 5800: salt->salt_len = 16;
break;
case 6800: salt->salt_len = 32;
break;
case 8400: salt->salt_len = 40;
break;
case 8800: salt->salt_len = 16;
break;
case 8900: salt->salt_len = 16;
salt->scrypt_N = 1024;
salt->scrypt_r = 1;
salt->scrypt_p = 1;
break;
case 9100: salt->salt_len = 16;
break;
case 9300: salt->salt_len = 14;
salt->scrypt_N = 16384;
salt->scrypt_r = 1;
salt->scrypt_p = 1;
break;
case 9400: salt->salt_len = 16;
break;
case 9500: salt->salt_len = 16;
break;
case 9600: salt->salt_len = 16;
break;
case 9700: salt->salt_len = 16;
break;
case 9710: salt->salt_len = 16;
break;
case 9720: salt->salt_len = 16;
break;
case 9800: salt->salt_len = 16;
break;
case 9810: salt->salt_len = 16;
break;
case 9820: salt->salt_len = 16;
break;
case 10300: salt->salt_len = 12;
break;
case 11500: salt->salt_len = 4;
break;
case 11600: salt->salt_len = 4;
break;
case 12400: salt->salt_len = 4;
break;
case 12500: salt->salt_len = 8;
break;
case 12600: salt->salt_len = 64;
break;
case 14000: salt->salt_len = 8;
break;
case 14100: salt->salt_len = 8;
break;
}
// special esalt handling
switch (hashconfig->hash_mode)
{
case 2500: ((wpa_t *) esalt)->eapol_size = 128;
break;
case 5300: ((ikepsk_t *) esalt)->nr_len = 1;
((ikepsk_t *) esalt)->msg_len = 1;
break;
case 5400: ((ikepsk_t *) esalt)->nr_len = 1;
((ikepsk_t *) esalt)->msg_len = 1;
break;
case 5500: ((netntlm_t *) esalt)->user_len = 1;
((netntlm_t *) esalt)->domain_len = 1;
((netntlm_t *) esalt)->srvchall_len = 1;
((netntlm_t *) esalt)->clichall_len = 1;
break;
case 5600: ((netntlm_t *) esalt)->user_len = 1;
((netntlm_t *) esalt)->domain_len = 1;
((netntlm_t *) esalt)->srvchall_len = 1;
((netntlm_t *) esalt)->clichall_len = 1;
break;
case 7300: ((rakp_t *) esalt)->salt_len = 32;
break;
case 10400: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 32;
((pdf_t *) esalt)->u_len = 32;
break;
case 10410: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 32;
((pdf_t *) esalt)->u_len = 32;
break;
case 10420: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 32;
((pdf_t *) esalt)->u_len = 32;
break;
case 10500: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 32;
((pdf_t *) esalt)->u_len = 32;
break;
case 10600: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 127;
((pdf_t *) esalt)->u_len = 127;
break;
case 10700: ((pdf_t *) esalt)->id_len = 16;
((pdf_t *) esalt)->o_len = 127;
((pdf_t *) esalt)->u_len = 127;
break;
case 11600: ((seven_zip_t *) esalt)->iv_len = 16;
((seven_zip_t *) esalt)->data_len = 112;
((seven_zip_t *) esalt)->unpack_size = 112;
break;
case 13400: ((keepass_t *) esalt)->version = 2;
break;
case 13500: ((pstoken_t *) esalt)->salt_len = 113;
break;
case 13600: ((zip2_t *) esalt)->salt_len = 16;
((zip2_t *) esalt)->data_len = 32;
((zip2_t *) esalt)->mode = 3;
break;
}
}
// set default iterations
switch (hashconfig->hash_mode)
{
case 400: salt->salt_iter = ROUNDS_PHPASS;
break;
case 500: salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 501: salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 1600: salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 1800: salt->salt_iter = ROUNDS_SHA512CRYPT;
break;
case 2100: salt->salt_iter = ROUNDS_DCC2;
break;
case 2500: salt->salt_iter = ROUNDS_WPA2;
break;
case 3200: salt->salt_iter = ROUNDS_BCRYPT;
break;
case 5200: salt->salt_iter = ROUNDS_PSAFE3;
break;
case 5800: salt->salt_iter = ROUNDS_ANDROIDPIN - 1;
break;
case 6211: salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6212: salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6213: salt->salt_iter = ROUNDS_TRUECRYPT_2K;
break;
case 6221: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6222: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6223: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6231: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6232: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6233: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6241: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6242: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6243: salt->salt_iter = ROUNDS_TRUECRYPT_1K;
break;
case 6300: salt->salt_iter = ROUNDS_MD5CRYPT;
break;
case 6400: salt->salt_iter = ROUNDS_SHA256AIX;
break;
case 6500: salt->salt_iter = ROUNDS_SHA512AIX;
break;
case 6700: salt->salt_iter = ROUNDS_SHA1AIX;
break;
case 6600: salt->salt_iter = ROUNDS_AGILEKEY;
break;
case 6800: salt->salt_iter = ROUNDS_LASTPASS;
break;
case 7100: salt->salt_iter = ROUNDS_SHA512OSX;
break;
case 7200: salt->salt_iter = ROUNDS_GRUB;
break;
case 7400: salt->salt_iter = ROUNDS_SHA256CRYPT;
break;
case 7900: salt->salt_iter = ROUNDS_DRUPAL7;
break;
case 8200: salt->salt_iter = ROUNDS_CLOUDKEY;
break;
case 8300: salt->salt_iter = ROUNDS_NSEC3;
break;
case 8800: salt->salt_iter = ROUNDS_ANDROIDFDE;
break;
case 8900: salt->salt_iter = 1;
break;
case 9000: salt->salt_iter = ROUNDS_PSAFE2;
break;
case 9100: salt->salt_iter = ROUNDS_LOTUS8;
break;
case 9200: salt->salt_iter = ROUNDS_CISCO8;
break;
case 9300: salt->salt_iter = 1;
break;
case 9400: salt->salt_iter = ROUNDS_OFFICE2007;
break;
case 9500: salt->salt_iter = ROUNDS_OFFICE2010;
break;
case 9600: salt->salt_iter = ROUNDS_OFFICE2013;
break;
case 10000: salt->salt_iter = ROUNDS_DJANGOPBKDF2;
break;
case 10300: salt->salt_iter = ROUNDS_SAPH_SHA1 - 1;
break;
case 10500: salt->salt_iter = ROUNDS_PDF14;
break;
case 10700: salt->salt_iter = ROUNDS_PDF17L8;
break;
case 10900: salt->salt_iter = ROUNDS_PBKDF2_SHA256 - 1;
break;
case 11300: salt->salt_iter = ROUNDS_BITCOIN_WALLET - 1;
break;
case 11600: salt->salt_iter = ROUNDS_SEVEN_ZIP;
break;
case 11900: salt->salt_iter = ROUNDS_PBKDF2_MD5 - 1;
break;
case 12000: salt->salt_iter = ROUNDS_PBKDF2_SHA1 - 1;
break;
case 12100: salt->salt_iter = ROUNDS_PBKDF2_SHA512 - 1;
break;
case 12200: salt->salt_iter = ROUNDS_ECRYPTFS - 1;
break;
case 12300: salt->salt_iter = ROUNDS_ORACLET - 1;
break;
case 12400: salt->salt_iter = ROUNDS_BSDICRYPT - 1;
break;
case 12500: salt->salt_iter = ROUNDS_RAR3;
break;
case 12700: salt->salt_iter = ROUNDS_MYWALLET;
break;
case 12800: salt->salt_iter = ROUNDS_MS_DRSR - 1;
break;
case 12900: salt->salt_iter = ROUNDS_ANDROIDFDE_SAMSUNG - 1;
break;
case 13000: salt->salt_iter = ROUNDS_RAR5 - 1;
break;
case 13200: salt->salt_iter = ROUNDS_AXCRYPT;
break;
case 13400: salt->salt_iter = ROUNDS_KEEPASS;
break;
case 13600: salt->salt_iter = ROUNDS_ZIP2;
break;
case 13711: salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13712: salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13713: salt->salt_iter = ROUNDS_VERACRYPT_655331;
break;
case 13721: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13722: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13723: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13731: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13732: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13733: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13741: salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13742: salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13743: salt->salt_iter = ROUNDS_VERACRYPT_327661;
break;
case 13751: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13752: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13753: salt->salt_iter = ROUNDS_VERACRYPT_500000;
break;
case 13761: salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
case 13762: salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
case 13763: salt->salt_iter = ROUNDS_VERACRYPT_200000;
break;
}
}
char *hashconfig_benchmark_mask (hashconfig_t *hashconfig)
{
char *mask = "?b?b?b?b?b?b?b";
switch (hashconfig->hash_mode)
{
case 12500: mask = "?b?b?b?b?b";
break;
}
return mask;
}

View File

@ -318,6 +318,22 @@ void mp_exec (u64 val, char *buf, cs_t *css, int css_cnt)
}
}
uint mp_get_length (char *mask)
{
uint len = 0;
uint mask_len = strlen (mask);
for (uint i = 0; i < mask_len; i++)
{
if (mask[i] == '?') i++;
len++;
}
return len;
}
void mp_cut_at (char *mask, uint max)
{
uint i;