2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 70
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
318 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
324 static unsigned int full01
= 0x01010101;
325 static unsigned int full80
= 0x80808080;
327 int SUPPRESS_OUTPUT
= 0;
329 hc_thread_mutex_t mux_adl
;
330 hc_thread_mutex_t mux_counter
;
331 hc_thread_mutex_t mux_dispatcher
;
332 hc_thread_mutex_t mux_display
;
334 hc_global_data_t data
;
336 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
338 const char *USAGE_MINI
[] =
340 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
342 "Try --help for more help.",
346 const char *USAGE_BIG
[] =
348 "%s, advanced password recovery",
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
354 " Options Short / Long | Type | Description | Example",
355 "===============================|======|======================================================|=======================",
356 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
357 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
358 " -V, --version | | Print version |",
359 " -h, --help | | Print help |",
360 " --quiet | | Suppress output |",
361 " --hex-charset | | Assume charset is given in hex |",
362 " --hex-salt | | Assume salt is given in hex |",
363 " --hex-wordlist | | Assume words in wordlist is given in hex |",
364 " --force | | Ignore warnings |",
365 " --status | | Enable automatic update of the status-screen |",
366 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
367 " --machine-readable | | Display the status view in a machine readable format |",
368 " --loopback | | Add new plains to induct directory |",
369 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
370 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
371 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
372 " --markov-classic | | Enables classic markov-chains, no per-position |",
373 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
374 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
375 " --session | Str | Define specific session name | --session=mysession",
376 " --restore | | Restore session from --session |",
377 " --restore-disable | | Do not write restore file |",
378 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
379 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
380 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
381 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
382 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
383 " --show | | Show cracked passwords only |",
384 " --left | | Show un-cracked passwords only |",
385 " --username | | Enable ignoring of usernames in hashfile |",
386 " --remove | | Enable remove of hash once it is cracked |",
387 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
388 " --potfile-disable | | Do not write potfile |",
389 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
390 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
391 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
392 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
393 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
394 " --logfile-disable | | Disable the logfile |",
395 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
396 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
397 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
398 " -b, --benchmark | | Run benchmark |",
399 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
400 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
401 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
402 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
403 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
404 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
405 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
406 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
407 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
408 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
409 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
410 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
412 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
413 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
415 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
418 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
419 " -s, --skip | Num | Skip X words from the start | -s 1000000",
420 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
421 " --keyspace | | Show keyspace base:mod values and quit |",
422 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
423 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
424 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
425 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
426 " --generate-rules-func-min | Num | Force min X funcs per rule |",
427 " --generate-rules-func-max | Num | Force max X funcs per rule |",
428 " --generate-rules-seed | Num | Force RNG seed set to X |",
429 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
430 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
431 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
432 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
433 " -i, --increment | | Enable mask increment mode |",
434 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
435 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
437 "- [ Hash modes ] -",
439 " # | Name | Category",
440 " ======+==================================================+======================================",
441 " 900 | MD4 | Raw Hash",
442 " 0 | MD5 | Raw Hash",
443 " 5100 | Half MD5 | Raw Hash",
444 " 100 | SHA1 | Raw Hash",
445 " 10800 | SHA-384 | Raw Hash",
446 " 1400 | SHA-256 | Raw Hash",
447 " 1700 | SHA-512 | Raw Hash",
448 " 5000 | SHA-3(Keccak) | Raw Hash",
449 " 10100 | SipHash | Raw Hash",
450 " 6000 | RipeMD160 | Raw Hash",
451 " 6100 | Whirlpool | Raw Hash",
452 " 6900 | GOST R 34.11-94 | Raw Hash",
453 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
454 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
455 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
456 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
457 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
458 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
459 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
461 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
462 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
463 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
464 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
465 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
466 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
467 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
469 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
470 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
471 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
480 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
481 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
482 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
483 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
484 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
485 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
486 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
487 " 400 | phpass | Generic KDF",
488 " 8900 | scrypt | Generic KDF",
489 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
490 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
491 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
492 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
493 " 23 | Skype | Network protocols",
494 " 2500 | WPA/WPA2 | Network protocols",
495 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
496 " 5300 | IKE-PSK MD5 | Network protocols",
497 " 5400 | IKE-PSK SHA1 | Network protocols",
498 " 5500 | NetNTLMv1 | Network protocols",
499 " 5500 | NetNTLMv1 + ESS | Network protocols",
500 " 5600 | NetNTLMv2 | Network protocols",
501 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
502 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
503 " 8300 | DNSSEC (NSEC3) | Network protocols",
504 " 10200 | Cram MD5 | Network protocols",
505 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
506 " 11200 | MySQL CRAM (SHA1) | Network protocols",
507 " 11400 | SIP digest authentication (MD5) | Network protocols",
508 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
509 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
510 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
511 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
512 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
513 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
514 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
515 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
516 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
517 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
518 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
519 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
520 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
521 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
522 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
523 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
524 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
525 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
526 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
527 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
528 " 12 | PostgreSQL | Database Server",
529 " 131 | MSSQL(2000) | Database Server",
530 " 132 | MSSQL(2005) | Database Server",
531 " 1731 | MSSQL(2012) | Database Server",
532 " 1731 | MSSQL(2014) | Database Server",
533 " 200 | MySQL323 | Database Server",
534 " 300 | MySQL4.1/MySQL5 | Database Server",
535 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
536 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
537 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
538 " 8000 | Sybase ASE | Database Server",
539 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
540 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
541 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
542 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
543 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
544 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
545 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
546 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
547 " 11500 | CRC32 | Checksums",
548 " 3000 | LM | Operating-Systems",
549 " 1000 | NTLM | Operating-Systems",
550 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
551 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
552 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
553 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
554 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
555 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
556 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
557 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
558 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
559 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
560 " 1722 | OSX v10.7 | Operating-Systems",
561 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
562 " 6300 | AIX {smd5} | Operating-Systems",
563 " 6700 | AIX {ssha1} | Operating-Systems",
564 " 6400 | AIX {ssha256} | Operating-Systems",
565 " 6500 | AIX {ssha512} | Operating-Systems",
566 " 2400 | Cisco-PIX | Operating-Systems",
567 " 2410 | Cisco-ASA | Operating-Systems",
568 " 500 | Cisco-IOS $1$ | Operating-Systems",
569 " 5700 | Cisco-IOS $4$ | Operating-Systems",
570 " 9200 | Cisco-IOS $8$ | Operating-Systems",
571 " 9300 | Cisco-IOS $9$ | Operating-Systems",
572 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
573 " 501 | Juniper IVE | Operating-Systems",
574 " 5800 | Android PIN | Operating-Systems",
575 " 8100 | Citrix Netscaler | Operating-Systems",
576 " 8500 | RACF | Operating-Systems",
577 " 7200 | GRUB 2 | Operating-Systems",
578 " 9900 | Radmin2 | Operating-Systems",
579 " 125 | ArubaOS | Operating-Systems",
580 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
581 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
582 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
583 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
584 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
585 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
586 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
587 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
588 " 11600 | 7-Zip | Archives",
589 " 12500 | RAR3-hp | Archives",
590 " 13000 | RAR5 | Archives",
591 " 13200 | AxCrypt | Archives",
592 " 13300 | AxCrypt in memory SHA1 | Archives",
593 " 13600 | WinZip | Archives",
594 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
595 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
596 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
597 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
598 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
600 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
601 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
608 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
609 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
610 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
611 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
612 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
613 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
614 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
615 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
616 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
617 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
618 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
628 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
629 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
630 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
631 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
632 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
633 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
634 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
635 " 9400 | MS Office 2007 | Documents",
636 " 9500 | MS Office 2010 | Documents",
637 " 9600 | MS Office 2013 | Documents",
638 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
639 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
640 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
641 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
642 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
643 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
644 " 9000 | Password Safe v2 | Password Managers",
645 " 5200 | Password Safe v3 | Password Managers",
646 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
647 " 6600 | 1Password, agilekeychain | Password Managers",
648 " 8200 | 1Password, cloudkeychain | Password Managers",
649 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
650 " 12700 | Blockchain, My Wallet | Password Managers",
651 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
653 "- [ Outfile Formats ] -",
659 " 3 | hash[:salt]:plain",
661 " 5 | hash[:salt]:hex_plain",
662 " 6 | plain:hex_plain",
663 " 7 | hash[:salt]:plain:hex_plain",
665 " 9 | hash[:salt]:crack_pos",
666 " 10 | plain:crack_pos",
667 " 11 | hash[:salt]:plain:crack_pos",
668 " 12 | hex_plain:crack_pos",
669 " 13 | hash[:salt]:hex_plain:crack_pos",
670 " 14 | plain:hex_plain:crack_pos",
671 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
673 "- [ Rule Debugging Modes ] -",
678 " 2 | Original-Word",
679 " 3 | Original-Word:Finding-Rule",
680 " 4 | Original-Word:Finding-Rule:Processed-Word",
682 "- [ Attack Modes ] -",
689 " 6 | Hybrid Wordlist + Mask",
690 " 7 | Hybrid Mask + Wordlist",
692 "- [ Built-in Charsets ] -",
696 " l | abcdefghijklmnopqrstuvwxyz",
697 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
699 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
703 "- [ OpenCL Device Types ] -",
706 " ===+=============",
709 " 3 | FPGA, DSP, Co-Processor",
711 "- [ Workload Profiles ] -",
713 " # | Performance | Runtime | Power Consumption | Desktop Impact",
714 " ===+=============+=========+===================+=================",
715 " 1 | Low | 2 ms | Low | Minimal",
716 " 2 | Default | 12 ms | Economic | Noticeable",
717 " 3 | High | 96 ms | High | Unresponsive",
718 " 4 | Nightmare | 480 ms | Insane | Headless",
720 "If you have no idea what just happened then visit the following pages:",
722 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
723 "* https://hashcat.net/wiki/#frequently_asked_questions",
729 * hashcat specific functions
732 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
734 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
736 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
738 double exec_ms_sum
= 0;
742 for (int i
= 0; i
< last_num_entries
; i
++)
744 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
748 exec_ms_sum
+= exec_ms
;
754 if (exec_ms_cnt
== 0) return 0;
756 return exec_ms_sum
/ exec_ms_cnt
;
759 void status_display_machine_readable ()
763 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
769 fprintf (out
, "SPEED\t");
771 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
773 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
775 if (device_param
->skipped
) continue;
780 for (int i
= 0; i
< SPEED_CACHE
; i
++)
782 speed_cnt
+= device_param
->speed_cnt
[i
];
783 speed_ms
+= device_param
->speed_ms
[i
];
786 speed_cnt
/= SPEED_CACHE
;
787 speed_ms
/= SPEED_CACHE
;
789 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
796 fprintf (out
, "EXEC_RUNTIME\t");
798 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
800 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
802 if (device_param
->skipped
) continue;
804 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
806 fprintf (out
, "%f\t", exec_ms_avg
);
813 u64 words_cur
= get_lowest_words_done ();
815 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
821 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
824 u64 all_rejected
= 0;
825 u64 all_restored
= 0;
827 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
829 all_done
+= data
.words_progress_done
[salt_pos
];
830 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
831 all_restored
+= data
.words_progress_restored
[salt_pos
];
834 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
835 u64 progress_end
= progress_total
;
837 u64 progress_skip
= 0;
841 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
843 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
844 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
845 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
850 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
852 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
853 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
854 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
857 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
858 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
860 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
866 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
867 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
874 if (data
.gpu_temp_disable
== 0)
876 fprintf (out
, "TEMP\t");
878 hc_thread_mutex_lock (mux_adl
);
880 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
884 if (device_param
->skipped
) continue;
886 int temp
= hm_get_temperature_with_device_id (device_id
);
888 fprintf (out
, "%d\t", temp
);
891 hc_thread_mutex_unlock (mux_adl
);
911 void status_display ()
913 if (data
.devices_status
== STATUS_INIT
) return;
914 if (data
.devices_status
== STATUS_STARTING
) return;
915 if (data
.devices_status
== STATUS_BYPASS
) return;
917 if (data
.machine_readable
== 1)
919 status_display_machine_readable ();
924 char tmp_buf
[1000] = { 0 };
928 log_info ("Session.Name...: %s", data
.session
);
930 char *status_type
= strstatus (data
.devices_status
);
932 uint hash_mode
= data
.hash_mode
;
934 char *hash_type
= strhashtype (hash_mode
); // not a bug
936 log_info ("Status.........: %s", status_type
);
942 if (data
.rp_files_cnt
)
946 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
948 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
951 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
953 log_info ("Rules.Type.....: %s", tmp_buf
);
960 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
962 if (data
.rp_gen_seed
)
964 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
972 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
974 if (data
.wordlist_mode
== WL_MODE_FILE
)
976 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
978 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
980 log_info ("Input.Mode.....: Pipe");
983 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
985 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
986 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
988 else if (data
.attack_mode
== ATTACK_MODE_BF
)
990 char *mask
= data
.mask
;
994 uint mask_len
= data
.css_cnt
;
996 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1000 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1002 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1004 mask_len
-= data
.salts_buf
[0].salt_len
;
1008 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1010 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1013 if (data
.maskcnt
> 1)
1015 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1017 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1020 log_info ("Input.Mode.....: %s", tmp_buf
);
1025 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1027 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1028 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1030 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1032 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1033 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1036 if (data
.digests_cnt
== 1)
1038 if (data
.hash_mode
== 2500)
1040 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1042 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1043 (char *) data
.salts_buf
[0].salt_buf
,
1057 else if (data
.hash_mode
== 5200)
1059 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1061 else if (data
.hash_mode
== 9000)
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1065 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1069 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1071 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1075 char out_buf
[HCBUFSIZ
] = { 0 };
1077 ascii_digest (out_buf
, 0, 0);
1080 if (strlen (out_buf
) > 40)
1088 log_info ("Hash.Target....: %s", out_buf
);
1093 if (data
.hash_mode
== 3000)
1095 char out_buf1
[32] = { 0 };
1096 char out_buf2
[32] = { 0 };
1098 ascii_digest (out_buf1
, 0, 0);
1099 ascii_digest (out_buf2
, 0, 1);
1101 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1105 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1109 log_info ("Hash.Type......: %s", hash_type
);
1115 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1116 double speed_ms
[DEVICES_MAX
] = { 0 };
1118 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1120 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1122 if (device_param
->skipped
) continue;
1124 speed_cnt
[device_id
] = 0;
1125 speed_ms
[device_id
] = 0;
1127 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1129 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1130 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1133 speed_cnt
[device_id
] /= SPEED_CACHE
;
1134 speed_ms
[device_id
] /= SPEED_CACHE
;
1137 double hashes_all_ms
= 0;
1139 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1141 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1143 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1145 if (device_param
->skipped
) continue;
1147 hashes_dev_ms
[device_id
] = 0;
1149 if (speed_ms
[device_id
])
1151 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1153 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1161 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1163 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1165 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1167 if (device_param
->skipped
) continue;
1169 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1171 exec_all_ms
[device_id
] = exec_ms_avg
;
1178 double ms_running
= 0;
1180 hc_timer_get (data
.timer_running
, ms_running
);
1182 double ms_paused
= data
.ms_paused
;
1184 if (data
.devices_status
== STATUS_PAUSED
)
1186 double ms_paused_tmp
= 0;
1188 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1190 ms_paused
+= ms_paused_tmp
;
1195 __time64_t sec_run
= ms_running
/ 1000;
1199 time_t sec_run
= ms_running
/ 1000;
1205 char display_run
[32] = { 0 };
1209 struct tm
*tmp
= NULL
;
1213 tmp
= _gmtime64 (&sec_run
);
1217 tmp
= gmtime (&sec_run
);
1223 memset (&tm_run
, 0, sizeof (tm_run
));
1225 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1227 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1229 char *start
= ctime (&data
.proc_start
);
1231 size_t start_len
= strlen (start
);
1233 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1234 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1236 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1241 log_info ("Time.Started...: 0 secs");
1248 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1251 u64 all_rejected
= 0;
1252 u64 all_restored
= 0;
1254 u64 progress_noneed
= 0;
1256 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1258 all_done
+= data
.words_progress_done
[salt_pos
];
1259 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1260 all_restored
+= data
.words_progress_restored
[salt_pos
];
1262 // Important for ETA only
1264 if (data
.salts_shown
[salt_pos
] == 1)
1266 const u64 all
= data
.words_progress_done
[salt_pos
]
1267 + data
.words_progress_rejected
[salt_pos
]
1268 + data
.words_progress_restored
[salt_pos
];
1270 const u64 left
= data
.words_cnt
- all
;
1272 progress_noneed
+= left
;
1276 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1277 u64 progress_end
= progress_total
;
1279 u64 progress_skip
= 0;
1283 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1285 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1286 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1287 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1292 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1294 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1295 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1296 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1299 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1300 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1302 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1304 if (data
.devices_status
!= STATUS_CRACKED
)
1307 __time64_t sec_etc
= 0;
1314 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1316 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1318 sec_etc
= ms_left
/ 1000;
1323 //log_info ("Time.Estimated.: 0 secs");
1325 else if ((u64
) sec_etc
> ETC_MAX
)
1327 log_info ("Time.Estimated.: > 10 Years");
1331 char display_etc
[32] = { 0 };
1335 struct tm
*tmp
= NULL
;
1339 tmp
= _gmtime64 (&sec_etc
);
1343 tmp
= gmtime (&sec_etc
);
1349 memset (&tm_etc
, 0, sizeof (tm_etc
));
1351 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1353 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1361 char *etc
= ctime (&now
);
1363 size_t etc_len
= strlen (etc
);
1365 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1366 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1368 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1374 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1376 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1378 if (device_param
->skipped
) continue;
1380 char display_dev_cur
[16] = { 0 };
1382 strncpy (display_dev_cur
, "0.00", 4);
1384 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1386 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1389 char display_all_cur
[16] = { 0 };
1391 strncpy (display_all_cur
, "0.00", 4);
1393 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1395 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1397 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1398 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1400 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1404 if (data
.digests_cnt
> 100)
1406 time_t now
= time (NULL
);
1408 int cpt_cur_min
= 0;
1409 int cpt_cur_hour
= 0;
1410 int cpt_cur_day
= 0;
1412 for (int i
= 0; i
< CPT_BUF
; i
++)
1414 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1415 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1417 if ((timestamp
+ 60) > now
)
1419 cpt_cur_min
+= cracked
;
1422 if ((timestamp
+ 3600) > now
)
1424 cpt_cur_hour
+= cracked
;
1427 if ((timestamp
+ 86400) > now
)
1429 cpt_cur_day
+= cracked
;
1433 double ms_real
= ms_running
- ms_paused
;
1435 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1436 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1437 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1439 if ((data
.cpt_start
+ 86400) < now
)
1441 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1449 else if ((data
.cpt_start
+ 3600) < now
)
1451 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1458 else if ((data
.cpt_start
+ 60) < now
)
1460 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1468 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1477 u64 restore_point
= get_lowest_words_done ();
1479 u64 restore_total
= data
.words_base
;
1481 float percent_restore
= 0;
1483 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1485 if (progress_end_relative_skip
)
1487 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1489 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1490 float percent_rejected
= 0.0;
1494 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1497 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1498 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1500 if (data
.restore_disable
== 0)
1502 if (percent_finished
!= 1)
1504 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1511 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1513 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1516 if (data
.restore_disable
== 0)
1518 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1523 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1524 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1526 // --restore not allowed if stdin is used -- really? why?
1528 //if (data.restore_disable == 0)
1530 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1536 if (data
.gpu_temp_disable
== 0)
1538 hc_thread_mutex_lock (mux_adl
);
1540 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1542 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1544 if (device_param
->skipped
) continue;
1546 #define HM_STR_BUF_SIZE 255
1548 if (data
.hm_device
[device_id
].fan_supported
== 1)
1550 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1551 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1552 char fanspeed
[HM_STR_BUF_SIZE
] = { 0 };
1554 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1555 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1557 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
1559 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1561 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
1563 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1566 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan", device_id
+ 1, utilization
, temperature
, fanspeed
);
1570 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1571 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1573 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1574 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1576 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id
+ 1, utilization
, temperature
);
1580 hc_thread_mutex_unlock (mux_adl
);
1582 #endif // HAVE_HWMON
1585 static void status_benchmark_automate ()
1587 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1588 double speed_ms
[DEVICES_MAX
] = { 0 };
1590 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1592 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1594 if (device_param
->skipped
) continue;
1596 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1597 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1600 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1602 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1604 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1606 if (device_param
->skipped
) continue;
1608 hashes_dev_ms
[device_id
] = 0;
1610 if (speed_ms
[device_id
])
1612 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1616 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1618 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1620 if (device_param
->skipped
) continue;
1622 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1626 static void status_benchmark ()
1628 if (data
.devices_status
== STATUS_INIT
) return;
1629 if (data
.devices_status
== STATUS_STARTING
) return;
1630 if (data
.devices_status
== STATUS_BYPASS
) return;
1632 if (data
.machine_readable
== 1)
1634 status_benchmark_automate ();
1639 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1640 double speed_ms
[DEVICES_MAX
] = { 0 };
1642 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1644 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1646 if (device_param
->skipped
) continue;
1648 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1649 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1652 double hashes_all_ms
= 0;
1654 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1656 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1658 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1660 if (device_param
->skipped
) continue;
1662 hashes_dev_ms
[device_id
] = 0;
1664 if (speed_ms
[device_id
])
1666 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1668 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1676 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1678 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1680 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1682 if (device_param
->skipped
) continue;
1684 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1686 exec_all_ms
[device_id
] = exec_ms_avg
;
1689 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1691 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1693 if (device_param
->skipped
) continue;
1695 char display_dev_cur
[16] = { 0 };
1697 strncpy (display_dev_cur
, "0.00", 4);
1699 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1701 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1704 char display_all_cur
[16] = { 0 };
1706 strncpy (display_all_cur
, "0.00", 4);
1708 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1710 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1714 * hashcat -only- functions
1717 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1719 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1721 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1722 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1723 else if (attack_kern
== ATTACK_KERN_COMBI
)
1724 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1725 else if (attack_kern
== ATTACK_KERN_BF
)
1726 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1729 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1732 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1734 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1736 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1737 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1738 else if (attack_kern
== ATTACK_KERN_COMBI
)
1739 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1740 else if (attack_kern
== ATTACK_KERN_BF
)
1741 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1745 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1749 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1751 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1753 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1757 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1761 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1763 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1765 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1769 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1773 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1775 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1778 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1780 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1783 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1785 if (line_len
& 1) return (line_len
); // not in hex
1787 if (data
.hex_wordlist
== 1)
1792 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1794 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1797 memset (line_buf
+ i
, 0, line_len
- i
);
1801 else if (line_len
>= 6) // $HEX[] = 6
1803 if (line_buf
[0] != '$') return (line_len
);
1804 if (line_buf
[1] != 'H') return (line_len
);
1805 if (line_buf
[2] != 'E') return (line_len
);
1806 if (line_buf
[3] != 'X') return (line_len
);
1807 if (line_buf
[4] != '[') return (line_len
);
1808 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1813 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1815 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1818 memset (line_buf
+ i
, 0, line_len
- i
);
1826 static void clear_prompt ()
1828 fputc ('\r', stdout
);
1830 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1832 fputc (' ', stdout
);
1835 fputc ('\r', stdout
);
1840 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1842 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1845 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1847 char *outfile
= data
.outfile
;
1848 uint quiet
= data
.quiet
;
1849 FILE *pot_fp
= data
.pot_fp
;
1850 uint loopback
= data
.loopback
;
1851 uint debug_mode
= data
.debug_mode
;
1852 char *debug_file
= data
.debug_file
;
1854 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1855 int debug_rule_len
= 0; // -1 error
1856 uint debug_plain_len
= 0;
1858 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1862 char out_buf
[HCBUFSIZ
] = { 0 };
1864 const u32 salt_pos
= plain
->salt_pos
;
1865 const u32 digest_pos
= plain
->digest_pos
; // relative
1866 const u32 gidvid
= plain
->gidvid
;
1867 const u32 il_pos
= plain
->il_pos
;
1869 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1873 u64 crackpos
= device_param
->words_off
;
1875 uint plain_buf
[16] = { 0 };
1877 u8
*plain_ptr
= (u8
*) plain_buf
;
1879 unsigned int plain_len
= 0;
1881 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1885 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1887 for (int i
= 0; i
< 16; i
++)
1889 plain_buf
[i
] = pw
.i
[i
];
1892 plain_len
= pw
.pw_len
;
1894 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1901 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1903 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1905 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1909 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1911 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1913 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1915 debug_plain_len
= plain_len
;
1919 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1922 crackpos
*= data
.kernel_rules_cnt
;
1923 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1925 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1927 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1931 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1933 for (int i
= 0; i
< 16; i
++)
1935 plain_buf
[i
] = pw
.i
[i
];
1938 plain_len
= pw
.pw_len
;
1940 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1941 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1943 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1945 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1949 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1951 memcpy (plain_ptr
, comb_buf
, comb_len
);
1954 plain_len
+= comb_len
;
1957 crackpos
*= data
.combs_cnt
;
1958 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1960 if (data
.pw_max
!= PW_DICTMAX1
)
1962 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1965 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1967 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1968 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1970 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1971 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1973 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1974 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1976 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1977 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1979 plain_len
= data
.css_cnt
;
1982 crackpos
*= data
.bfs_cnt
;
1983 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1985 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1989 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1991 for (int i
= 0; i
< 16; i
++)
1993 plain_buf
[i
] = pw
.i
[i
];
1996 plain_len
= pw
.pw_len
;
1998 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2001 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2003 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2005 plain_len
+= start
+ stop
;
2008 crackpos
*= data
.combs_cnt
;
2009 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2011 if (data
.pw_max
!= PW_DICTMAX1
)
2013 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2016 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2020 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2022 for (int i
= 0; i
< 16; i
++)
2024 plain_buf
[i
] = pw
.i
[i
];
2027 plain_len
= pw
.pw_len
;
2029 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2032 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2034 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2036 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2038 plain_len
+= start
+ stop
;
2041 crackpos
*= data
.combs_cnt
;
2042 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2044 if (data
.pw_max
!= PW_DICTMAX1
)
2046 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2050 if (data
.attack_mode
== ATTACK_MODE_BF
)
2052 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2054 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2056 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2058 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2062 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2064 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2066 plain_ptr
[j
] = plain_ptr
[i
];
2069 plain_len
= plain_len
/ 2;
2074 // if enabled, update also the potfile
2080 fprintf (pot_fp
, "%s:", out_buf
);
2082 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2084 fputc ('\n', pot_fp
);
2088 unlock_file (pot_fp
);
2093 FILE *out_fp
= NULL
;
2095 if (outfile
!= NULL
)
2097 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2099 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2109 if (quiet
== 0) clear_prompt ();
2112 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2114 if (outfile
!= NULL
)
2116 if (out_fp
!= stdout
)
2123 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2125 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2127 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2128 if (quiet
== 0) fflush (stdout
);
2137 char *loopback_file
= data
.loopback_file
;
2141 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2145 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2147 fputc ('\n', fb_fp
);
2153 // (rule) debug mode
2155 // the next check implies that:
2156 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2159 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2161 if (debug_rule_len
< 0) debug_rule_len
= 0;
2163 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2165 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2167 if ((quiet
== 0) && (debug_file
== NULL
))
2169 fprintf (stdout
, "%s", PROMPT
);
2176 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2178 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2182 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2186 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2190 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2192 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, 0, num_cracked
* sizeof (plain_t
), cracked
, 0, NULL
, NULL
);
2194 uint cpt_cracked
= 0;
2196 for (uint i
= 0; i
< num_cracked
; i
++)
2198 const uint hash_pos
= cracked
[i
].hash_pos
;
2200 if (data
.digests_shown
[hash_pos
] == 1) continue;
2202 hc_thread_mutex_lock (mux_display
);
2204 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2206 data
.digests_shown
[hash_pos
] = 1;
2208 data
.digests_done
++;
2212 salt_buf
->digests_done
++;
2214 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2216 data
.salts_shown
[salt_pos
] = 1;
2222 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2224 hc_thread_mutex_unlock (mux_display
);
2226 check_hash (device_param
, &cracked
[i
]);
2231 if (cpt_cracked
> 0)
2233 hc_thread_mutex_lock (mux_display
);
2235 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2236 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2240 data
.cpt_total
+= cpt_cracked
;
2242 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2244 hc_thread_mutex_unlock (mux_display
);
2247 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2249 // we need to reset cracked state on the device
2250 // otherwise host thinks again and again the hash was cracked
2251 // and returns invalid password each time
2253 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2255 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, salt_buf
->digests_offset
* sizeof (uint
), salt_buf
->digests_cnt
* sizeof (uint
), &data
.digests_shown_tmp
[salt_buf
->digests_offset
], 0, NULL
, NULL
);
2260 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2264 static void save_hash ()
2266 char *hashfile
= data
.hashfile
;
2268 char new_hashfile
[256] = { 0 };
2269 char old_hashfile
[256] = { 0 };
2271 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2272 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2274 unlink (new_hashfile
);
2276 char separator
= data
.separator
;
2278 FILE *fp
= fopen (new_hashfile
, "wb");
2282 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2287 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2289 if (data
.salts_shown
[salt_pos
] == 1) continue;
2291 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2293 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2295 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2297 if (data
.digests_shown
[idx
] == 1) continue;
2299 if (data
.hash_mode
!= 2500)
2301 char out_buf
[HCBUFSIZ
] = { 0 };
2303 if (data
.username
== 1)
2305 user_t
*user
= data
.hash_info
[idx
]->user
;
2309 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2311 fputc (separator
, fp
);
2314 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2316 fputs (out_buf
, fp
);
2324 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2326 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2335 unlink (old_hashfile
);
2337 if (rename (hashfile
, old_hashfile
) != 0)
2339 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2346 if (rename (new_hashfile
, hashfile
) != 0)
2348 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2353 unlink (old_hashfile
);
2356 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2358 // function called only in case kernel_power_all > words_left
2360 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2362 kernel_power_div
+= kernel_power_div
/ 100;
2364 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2366 while (kernel_power_new
< total_left
)
2368 kernel_power_div
+= kernel_power_div
/ 100;
2370 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2373 if (data
.quiet
== 0)
2379 log_info ("INFO: approaching final keyspace, workload adjusted");
2382 fprintf (stdout
, "%s", PROMPT
);
2387 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2389 return kernel_power_div
;
2392 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2394 uint num_elements
= num
;
2396 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2397 device_param
->kernel_params_buf32
[31] = num
;
2399 uint kernel_threads
= device_param
->kernel_threads
;
2401 while (num_elements
% kernel_threads
) num_elements
++;
2403 cl_kernel kernel
= NULL
;
2407 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2408 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2409 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2410 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2411 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2414 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2415 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2416 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2417 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2418 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2419 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2420 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2421 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2422 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2423 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2424 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2428 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2430 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2431 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2433 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2437 if (kern_run
== KERN_RUN_2
)
2439 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2441 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2445 while (num_elements
% kernel_threads
) num_elements
++;
2447 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2448 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2450 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2453 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2455 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2459 cl_ulong time_start
;
2462 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2463 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2465 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2467 uint exec_pos
= device_param
->exec_pos
;
2469 device_param
->exec_ms
[exec_pos
] = exec_time
;
2473 if (exec_pos
== EXEC_CACHE
)
2478 device_param
->exec_pos
= exec_pos
;
2481 hc_clReleaseEvent (data
.ocl
, event
);
2483 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2486 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2488 uint num_elements
= num
;
2492 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2493 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2494 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2497 // causes problems with special threads like in bcrypt
2498 // const uint kernel_threads = device_param->kernel_threads;
2500 uint kernel_threads
= device_param
->kernel_threads
;
2502 while (num_elements
% kernel_threads
) num_elements
++;
2504 cl_kernel kernel
= NULL
;
2508 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2509 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2510 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2515 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2516 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2517 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2518 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2519 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2520 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2522 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2523 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2524 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2525 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2526 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2527 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2529 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2530 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2531 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2532 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2533 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2534 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2535 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2539 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2540 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2542 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2544 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2546 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2549 static void run_kernel_tm (hc_device_param_t
*device_param
)
2551 const uint num_elements
= 1024; // fixed
2553 uint kernel_threads
= 32;
2555 cl_kernel kernel
= device_param
->kernel_tm
;
2557 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2558 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2560 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2562 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2564 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2567 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2569 uint num_elements
= num
;
2571 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2572 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2574 // causes problems with special threads like in bcrypt
2575 // const uint kernel_threads = device_param->kernel_threads;
2577 uint kernel_threads
= device_param
->kernel_threads
;
2579 while (num_elements
% kernel_threads
) num_elements
++;
2581 cl_kernel kernel
= device_param
->kernel_amp
;
2583 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2584 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2586 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2587 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2589 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2591 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2593 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2596 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2598 const u32 num16d
= num
/ 16;
2599 const u32 num16m
= num
% 16;
2603 device_param
->kernel_params_memset_buf32
[1] = value
;
2604 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2606 uint kernel_threads
= device_param
->kernel_threads
;
2608 uint num_elements
= num16d
;
2610 while (num_elements
% kernel_threads
) num_elements
++;
2612 cl_kernel kernel
= device_param
->kernel_memset
;
2614 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2615 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2616 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2618 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2619 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2621 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2623 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2625 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2637 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2641 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2643 run_kernel_memset (device_param
, buf
, 0, size
);
2648 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2650 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2652 const cl_uchar zero = 0;
2654 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2659 // NOTE: clEnqueueFillBuffer () always fails with -59
2660 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2661 // How's that possible, OpenCL 1.2 support is advertised??
2662 // We need to workaround...
2664 #define FILLSZ 0x100000
2666 char *tmp = (char *) mymalloc (FILLSZ);
2668 for (size_t i = 0; i < size; i += FILLSZ)
2670 const size_t left = size - i;
2672 const size_t fillsz = MIN (FILLSZ, left);
2674 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2682 static void choose_kernel (hc_device_param_t
*device_param
, const uint attack_exec
, const uint attack_mode
, const uint opts_type
, const salt_t
*salt_buf
, const uint highest_pw_len
, const uint pws_cnt
)
2684 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2686 if (attack_mode
== ATTACK_MODE_BF
)
2688 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2690 const uint size_tm
= 32 * sizeof (bs_word_t
);
2692 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2694 run_kernel_tm (device_param
);
2696 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2700 if (highest_pw_len
< 16)
2702 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2704 else if (highest_pw_len
< 32)
2706 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2710 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2715 run_kernel_amp (device_param
, pws_cnt
);
2717 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2719 if (opts_type
& OPTS_TYPE_HOOK12
)
2721 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2724 uint iter
= salt_buf
->salt_iter
;
2726 uint loop_step
= device_param
->kernel_loops
;
2728 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2730 uint loop_left
= iter
- loop_pos
;
2732 loop_left
= MIN (loop_left
, loop_step
);
2734 device_param
->kernel_params_buf32
[25] = loop_pos
;
2735 device_param
->kernel_params_buf32
[26] = loop_left
;
2737 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2739 if (data
.devices_status
== STATUS_CRACKED
) break;
2740 if (data
.devices_status
== STATUS_ABORTED
) break;
2741 if (data
.devices_status
== STATUS_QUIT
) break;
2747 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2749 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2753 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2755 const u32 speed_pos
= device_param
->speed_pos
;
2757 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2759 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2761 if (data
.benchmark
== 1)
2763 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2767 if (opts_type
& OPTS_TYPE_HOOK23
)
2769 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2771 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2773 // do something with data
2775 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2778 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2782 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2788 else if (rule_len
== 1)
2790 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2796 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2798 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2800 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2804 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2806 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2808 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2810 for (u32 i
= 0; i
< pws_cnt
; i
++)
2812 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2814 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2819 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2821 for (u32 i
= 0; i
< pws_cnt
; i
++)
2823 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2825 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2832 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2834 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2836 for (u32 i
= 0; i
< pws_cnt
; i
++)
2838 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2840 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2845 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2847 for (u32 i
= 0; i
< pws_cnt
; i
++)
2849 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2851 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2858 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2860 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2862 const u64 off
= device_param
->words_off
;
2864 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2866 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2870 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2872 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2874 device_param
->kernel_params_buf32
[25] = 0;
2875 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2876 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2878 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2880 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2884 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2887 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2889 return exec_ms_prev
;
2892 static void autotune (hc_device_param_t
*device_param
)
2894 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2896 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2897 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2899 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2900 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2902 u32 kernel_accel
= kernel_accel_min
;
2903 u32 kernel_loops
= kernel_loops_min
;
2905 // in this case the user specified a fixed -u and -n on the commandline
2906 // no way to tune anything
2907 // but we need to run a few caching rounds
2909 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2911 try_run (device_param
, kernel_accel
, kernel_loops
);
2912 try_run (device_param
, kernel_accel
, kernel_loops
);
2913 try_run (device_param
, kernel_accel
, kernel_loops
);
2914 try_run (device_param
, kernel_accel
, kernel_loops
);
2916 device_param
->kernel_accel
= kernel_accel
;
2917 device_param
->kernel_loops
= kernel_loops
;
2919 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2921 device_param
->kernel_power
= kernel_power
;
2926 // from here it's clear we are allowed to autotune
2927 // so let's init some fake words
2929 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2931 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2933 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2935 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2939 for (u32 i = 0; i < kernel_power_max; i++)
2941 device_param->pws_buf[i].i[0] = i;
2942 device_param->pws_buf[i].i[1] = 0x01234567;
2943 device_param->pws_buf[i].pw_len = 7;
2946 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
2948 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2950 run_kernel_amp (device_param, kernel_power_max);
2954 #define VERIFIER_CNT 1
2956 // first find out highest kernel-loops that stays below target_ms
2958 if (kernel_loops_min
< kernel_loops_max
)
2960 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2962 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2964 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2966 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2968 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2971 if (exec_ms
< target_ms
) break;
2975 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2977 #define STEPS_CNT 10
2979 if (kernel_accel_min
< kernel_accel_max
)
2981 for (int i
= 0; i
< STEPS_CNT
; i
++)
2983 const u32 kernel_accel_try
= 1 << i
;
2985 if (kernel_accel_try
< kernel_accel_min
) continue;
2986 if (kernel_accel_try
> kernel_accel_max
) break;
2988 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2990 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2992 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2994 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2997 if (exec_ms
> target_ms
) break;
2999 kernel_accel
= kernel_accel_try
;
3003 // at this point we want to know the actual runtime for the following reason:
3004 // we need a reference for the balancing loop following up, and this
3005 // the balancing loop can have an effect that the creates a new opportunity, for example:
3006 // if the target is 95 ms and the current runtime is 48ms the above loop
3007 // stopped the execution because the previous exec_ms was > 95ms
3008 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3009 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3011 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3013 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3015 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3017 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3020 u32 diff
= kernel_loops
- kernel_accel
;
3022 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3024 u32 kernel_accel_orig
= kernel_accel
;
3025 u32 kernel_loops_orig
= kernel_loops
;
3027 for (u32 f
= 1; f
< 1024; f
++)
3029 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3030 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3032 if (kernel_accel_try
> kernel_accel_max
) break;
3033 if (kernel_loops_try
< kernel_loops_min
) break;
3035 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3037 if (diff_new
> diff
) break;
3041 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3043 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3045 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3047 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3050 if (exec_ms
< exec_ms_pre_final
)
3052 exec_ms_pre_final
= exec_ms
;
3054 kernel_accel
= kernel_accel_try
;
3055 kernel_loops
= kernel_loops_try
;
3060 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3062 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3064 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3066 if (exec_accel_min
>= 1.0)
3068 // this is safe to not overflow kernel_accel_max because of accel_left
3070 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3073 // reset them fake words
3076 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3078 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3079 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3082 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3084 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3086 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3091 device_param
->exec_pos
= 0;
3093 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3097 device_param
->kernel_accel
= kernel_accel
;
3098 device_param
->kernel_loops
= kernel_loops
;
3100 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3102 device_param
->kernel_power
= kernel_power
;
3106 if (data
.quiet
== 0)
3110 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3111 "Device #%u: autotuned kernel-loops to %u\n",
3112 device_param
->device_id
+ 1, kernel_accel
,
3113 device_param
->device_id
+ 1, kernel_loops
);
3115 fprintf (stdout
, "%s", PROMPT
);
3123 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3125 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3129 uint speed_pos
= device_param
->speed_pos
;
3132 if (device_param
->timer_speed
.tv_sec
== 0)
3134 hc_timer_set (&device_param
->timer_speed
);
3139 if (device_param
->timer_speed
.QuadPart
== 0)
3141 hc_timer_set (&device_param
->timer_speed
);
3145 // find higest password length, this is for optimization stuff
3147 uint highest_pw_len
= 0;
3149 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3152 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3155 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3157 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3158 + device_param
->kernel_params_mp_l_buf32
[5];
3163 uint innerloop_step
= 0;
3164 uint innerloop_cnt
= 0;
3166 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3167 else innerloop_step
= 1;
3169 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3170 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3171 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3173 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3175 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3177 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3179 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3181 if (data
.devices_status
== STATUS_CRACKED
) break;
3182 if (data
.devices_status
== STATUS_ABORTED
) break;
3183 if (data
.devices_status
== STATUS_QUIT
) break;
3184 if (data
.devices_status
== STATUS_BYPASS
) break;
3186 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3188 device_param
->kernel_params_buf32
[24] = salt_pos
;
3189 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3190 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3192 FILE *combs_fp
= device_param
->combs_fp
;
3194 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3201 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3203 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3205 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3207 if (data
.devices_status
== STATUS_CRACKED
) break;
3208 if (data
.devices_status
== STATUS_ABORTED
) break;
3209 if (data
.devices_status
== STATUS_QUIT
) break;
3210 if (data
.devices_status
== STATUS_BYPASS
) break;
3212 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3214 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3216 device_param
->innerloop_pos
= innerloop_pos
;
3217 device_param
->innerloop_left
= innerloop_left
;
3219 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3221 // i think we can get rid of this
3222 if (innerloop_left
== 0)
3224 puts ("bug, how should this happen????\n");
3229 if (data
.salts_shown
[salt_pos
] == 1)
3231 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3236 // initialize amplifiers
3238 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3242 while (i
< innerloop_left
)
3244 if (feof (combs_fp
)) break;
3246 int line_len
= fgetl (combs_fp
, line_buf
);
3248 if (line_len
>= PW_MAX1
) continue;
3250 line_len
= convert_from_hex (line_buf
, line_len
);
3252 char *line_buf_new
= line_buf
;
3254 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3256 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3258 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3260 if (rule_len_out
< 0)
3262 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3267 line_len
= rule_len_out
;
3269 line_buf_new
= rule_buf_out
;
3272 line_len
= MIN (line_len
, PW_DICTMAX
);
3274 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3276 memcpy (ptr
, line_buf_new
, line_len
);
3278 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3280 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3282 uppercase (ptr
, line_len
);
3285 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3287 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3289 ptr
[line_len
] = 0x80;
3292 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3294 ptr
[line_len
] = 0x01;
3298 device_param
->combs_buf
[i
].pw_len
= line_len
;
3303 for (uint j
= i
; j
< innerloop_left
; j
++)
3305 device_param
->combs_buf
[j
].i
[0] = 0;
3306 device_param
->combs_buf
[j
].i
[1] = 0;
3307 device_param
->combs_buf
[j
].i
[2] = 0;
3308 device_param
->combs_buf
[j
].i
[3] = 0;
3309 device_param
->combs_buf
[j
].i
[4] = 0;
3310 device_param
->combs_buf
[j
].i
[5] = 0;
3311 device_param
->combs_buf
[j
].i
[6] = 0;
3312 device_param
->combs_buf
[j
].i
[7] = 0;
3314 device_param
->combs_buf
[j
].pw_len
= 0;
3319 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3321 u64 off
= innerloop_pos
;
3323 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3325 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3327 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3329 u64 off
= innerloop_pos
;
3331 device_param
->kernel_params_mp_buf64
[3] = off
;
3333 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3335 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3337 u64 off
= innerloop_pos
;
3339 device_param
->kernel_params_mp_buf64
[3] = off
;
3341 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3346 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3348 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (kernel_rule_t
), 0, innerloop_left
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3350 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3352 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
3354 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3356 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
3358 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3360 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
3362 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3364 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
3367 if (data
.benchmark
== 1)
3369 hc_timer_set (&device_param
->timer_speed
);
3372 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3374 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3376 if (data
.devices_status
== STATUS_CRACKED
) break;
3377 if (data
.devices_status
== STATUS_ABORTED
) break;
3378 if (data
.devices_status
== STATUS_QUIT
) break;
3384 check_cracked (device_param
, salt_pos
);
3390 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3392 hc_thread_mutex_lock (mux_counter
);
3394 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3396 hc_thread_mutex_unlock (mux_counter
);
3404 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3406 hc_timer_set (&device_param
->timer_speed
);
3410 //hc_thread_mutex_lock (mux_display);
3412 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3414 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3416 //hc_thread_mutex_unlock (mux_display);
3420 if (speed_pos
== SPEED_CACHE
)
3429 if (data
.benchmark
== 1) break;
3433 device_param
->speed_pos
= speed_pos
;
3438 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3440 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3444 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3446 wl_data
->buf
[wl_data
->cnt
] = 0;
3448 if (wl_data
->cnt
== 0) return;
3450 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3454 if (wl_data
->cnt
== wl_data
->avail
)
3456 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3458 wl_data
->avail
+= wl_data
->incr
;
3461 const int c
= fgetc (fd
);
3463 if (c
== EOF
) break;
3465 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3469 if (c
== '\n') break;
3472 // ensure stream ends with a newline
3474 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3478 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3484 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3488 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3490 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3500 if (*ptr
!= '\n') continue;
3504 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3515 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3519 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3521 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3523 if (*ptr
!= '\n') continue;
3527 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3538 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3542 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3544 if (*ptr
!= '\n') continue;
3548 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3559 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3561 while (wl_data
->pos
< wl_data
->cnt
)
3566 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3568 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3570 wl_data
->pos
+= off
;
3572 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3574 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3576 int rule_len_out
= -1;
3578 if (len
< BLOCK_SIZE
)
3580 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3583 if (rule_len_out
< 0)
3588 if (rule_len_out
> PW_MAX
)
3609 fprintf (stderr
, "BUG feof()!!\n");
3614 load_segment (wl_data
, fd
);
3616 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3620 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3624 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3634 fstat (fileno (fd
), &d
.stat
);
3638 _fstat64 (fileno (fd
), &d
.stat
);
3642 d
.stat
.st_nlink
= 0;
3646 d
.stat
.st_atime
= 0;
3649 d
.stat
.st_blksize
= 0;
3650 d
.stat
.st_blocks
= 0;
3653 if (d
.stat
.st_size
== 0) return 0;
3655 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3657 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3661 u64 cnt
= d_cache
->cnt
;
3665 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3667 keyspace
*= data
.kernel_rules_cnt
;
3669 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3671 keyspace
*= data
.combs_cnt
;
3674 if (data
.quiet
== 0) log_info ("Cache-hit dictionary stats %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) d
.stat
.st_size
, (unsigned long long int) cnt
, (unsigned long long int) keyspace
);
3675 if (data
.quiet
== 0) log_info ("");
3677 hc_signal (sigHandler_default
);
3692 load_segment (wl_data
, fd
);
3694 comp
+= wl_data
->cnt
;
3698 while (i
< wl_data
->cnt
)
3703 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3705 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3707 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3709 int rule_len_out
= -1;
3711 if (len
< BLOCK_SIZE
)
3713 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3716 if (rule_len_out
< 0)
3728 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3730 cnt
+= data
.kernel_rules_cnt
;
3732 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3734 cnt
+= data
.combs_cnt
;
3747 if ((now
- prev
) == 0) continue;
3749 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3751 if (data
.quiet
== 0) log_info_nn ("Generating dictionary stats for %s: %llu bytes (%.2f%%), %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, percent
* 100, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
3756 if (data
.quiet
== 0) log_info ("Generated dictionary stats for %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
3757 if (data
.quiet
== 0) log_info ("");
3759 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3761 hc_signal (sigHandler_default
);
3766 static void *thread_monitor (void *p
)
3768 uint runtime_check
= 0;
3769 uint remove_check
= 0;
3770 uint status_check
= 0;
3771 uint restore_check
= 0;
3773 uint restore_left
= data
.restore_timer
;
3774 uint remove_left
= data
.remove_timer
;
3775 uint status_left
= data
.status_timer
;
3778 uint hwmon_check
= 0;
3780 // these variables are mainly used for fan control (AMD only)
3782 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3784 // temperature controller "loopback" values
3786 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3787 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3790 int temp_threshold
= 1; // degrees celcius
3792 int fan_speed_min
= 15; // in percentage
3793 int fan_speed_max
= 100;
3796 time_t last_temp_check_time
;
3797 #endif // HAVE_HWMON
3799 uint sleep_time
= 1;
3806 if (data
.restore_timer
)
3811 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3816 if (data
.status
== 1)
3822 if (data
.gpu_temp_disable
== 0)
3824 time (&last_temp_check_time
);
3830 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3833 if (hwmon_check
== 0)
3838 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3840 hc_sleep (sleep_time
);
3842 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3845 if (hwmon_check
== 1)
3847 hc_thread_mutex_lock (mux_adl
);
3849 time_t temp_check_time
;
3851 time (&temp_check_time
);
3853 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3855 if (Ta
== 0) Ta
= 1;
3857 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3859 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3861 if (device_param
->skipped
) continue;
3863 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3865 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3867 if (temperature
> (int) data
.gpu_temp_abort
)
3869 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3871 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3877 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3879 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3881 if (data
.hm_device
[device_id
].fan_supported
== 1)
3883 int temp_cur
= temperature
;
3885 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3887 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3889 // calculate Ta value (time difference in seconds between the last check and this check)
3891 last_temp_check_time
= temp_check_time
;
3897 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3899 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[device_id
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[device_id
])) / Ta
);
3901 if (abs (fan_diff_required
) >= temp_threshold
)
3903 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3905 int fan_speed_level
= fan_speed_cur
;
3907 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3909 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3911 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3912 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3914 if (fan_speed_new
!= fan_speed_cur
)
3916 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3917 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3919 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3921 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
3923 fan_speed_chgd
[device_id
] = 1;
3926 temp_diff_old
[device_id
] = temp_diff_new
;
3934 hc_thread_mutex_unlock (mux_adl
);
3936 #endif // HAVE_HWMON
3938 if (restore_check
== 1)
3942 if (restore_left
== 0)
3944 if (data
.restore_disable
== 0) cycle_restore ();
3946 restore_left
= data
.restore_timer
;
3950 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3954 time (&runtime_cur
);
3956 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3958 if (runtime_left
<= 0)
3960 if (data
.benchmark
== 0)
3962 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3965 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3969 if (remove_check
== 1)
3973 if (remove_left
== 0)
3975 if (data
.digests_saved
!= data
.digests_done
)
3977 data
.digests_saved
= data
.digests_done
;
3982 remove_left
= data
.remove_timer
;
3986 if (status_check
== 1)
3990 if (status_left
== 0)
3992 //hc_thread_mutex_lock (mux_display);
3994 if (data
.quiet
== 0) clear_prompt ();
3996 if (data
.quiet
== 0) log_info ("");
4000 if (data
.quiet
== 0) log_info ("");
4002 //hc_thread_mutex_unlock (mux_display);
4004 status_left
= data
.status_timer
;
4010 myfree (fan_speed_chgd
);
4012 myfree (temp_diff_old
);
4013 myfree (temp_diff_sum
);
4021 static void *thread_outfile_remove (void *p
)
4023 // some hash-dependent constants
4024 char *outfile_dir
= data
.outfile_check_directory
;
4025 uint dgst_size
= data
.dgst_size
;
4026 uint isSalted
= data
.isSalted
;
4027 uint esalt_size
= data
.esalt_size
;
4028 uint hash_mode
= data
.hash_mode
;
4030 uint outfile_check_timer
= data
.outfile_check_timer
;
4032 char separator
= data
.separator
;
4034 // some hash-dependent functions
4035 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4036 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4039 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4041 hash_buf
.digest
= mymalloc (dgst_size
);
4043 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4045 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4047 uint digest_buf
[64] = { 0 };
4049 outfile_data_t
*out_info
= NULL
;
4051 char **out_files
= NULL
;
4053 time_t folder_mtime
= 0;
4057 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4059 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4063 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4067 if (check_left
== 0)
4069 struct stat outfile_check_stat
;
4071 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4073 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4077 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4079 char **out_files_new
= scan_directory (outfile_dir
);
4081 int out_cnt_new
= count_dictionaries (out_files_new
);
4083 outfile_data_t
*out_info_new
= NULL
;
4085 if (out_cnt_new
> 0)
4087 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4089 for (int i
= 0; i
< out_cnt_new
; i
++)
4091 out_info_new
[i
].file_name
= out_files_new
[i
];
4093 // check if there are files that we have seen/checked before (and not changed)
4095 for (int j
= 0; j
< out_cnt
; j
++)
4097 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4099 struct stat outfile_stat
;
4101 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4103 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4105 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4106 out_info_new
[i
].seek
= out_info
[j
].seek
;
4114 local_free (out_info
);
4115 local_free (out_files
);
4117 out_files
= out_files_new
;
4118 out_cnt
= out_cnt_new
;
4119 out_info
= out_info_new
;
4121 folder_mtime
= outfile_check_stat
.st_mtime
;
4124 for (int j
= 0; j
< out_cnt
; j
++)
4126 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4130 //hc_thread_mutex_lock (mux_display);
4133 struct stat outfile_stat
;
4135 fstat (fileno (fp
), &outfile_stat
);
4139 struct stat64 outfile_stat
;
4141 _fstat64 (fileno (fp
), &outfile_stat
);
4144 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4146 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4147 out_info
[j
].seek
= 0;
4150 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4152 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4156 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4158 if (ptr
== NULL
) break;
4160 int line_len
= strlen (line_buf
);
4162 if (line_len
<= 0) continue;
4164 int iter
= MAX_CUT_TRIES
;
4166 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4168 if (line_buf
[i
] != separator
) continue;
4170 int parser_status
= PARSER_OK
;
4172 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4174 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4179 if (parser_status
== PARSER_OK
)
4181 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4183 if (data
.salts_shown
[salt_pos
] == 1) continue;
4185 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4187 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4189 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4191 if (data
.digests_shown
[idx
] == 1) continue;
4195 if (hash_mode
== 6800)
4197 if (i
== salt_buf
->salt_len
)
4199 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4202 else if (hash_mode
== 2500)
4204 // BSSID : MAC1 : MAC2 (:plain)
4205 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4207 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4209 if (!cracked
) continue;
4211 // now compare MAC1 and MAC2 too, since we have this additional info
4212 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4213 char *mac2_pos
= mac1_pos
+ 12 + 1;
4215 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4216 wpa_t
*wpa
= &wpas
[salt_pos
];
4218 // compare hex string(s) vs binary MAC address(es)
4220 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4222 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4231 if (!cracked
) continue;
4233 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4235 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4246 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4248 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4250 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4257 data
.digests_shown
[idx
] = 1;
4259 data
.digests_done
++;
4261 salt_buf
->digests_done
++;
4263 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4265 data
.salts_shown
[salt_pos
] = 1;
4269 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4274 if (data
.devices_status
== STATUS_CRACKED
) break;
4280 if (data
.devices_status
== STATUS_CRACKED
) break;
4285 if (data
.devices_status
== STATUS_CRACKED
) break;
4290 out_info
[j
].seek
= ftell (fp
);
4292 //hc_thread_mutex_unlock (mux_display);
4300 check_left
= outfile_check_timer
;
4304 if (esalt_size
) local_free (hash_buf
.esalt
);
4306 if (isSalted
) local_free (hash_buf
.salt
);
4308 local_free (hash_buf
.digest
);
4310 local_free (out_info
);
4312 local_free (out_files
);
4319 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4321 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4323 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4325 u8
*ptr
= (u8
*) pw
->i
;
4327 memcpy (ptr
, pw_buf
, pw_len
);
4329 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4331 pw
->pw_len
= pw_len
;
4333 device_param
->pws_cnt
++;
4337 fprintf (stderr
, "BUG pw_add()!!\n");
4343 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4345 hc_thread_mutex_lock (mux_dispatcher
);
4347 const u64 words_cur
= data
.words_cur
;
4348 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4350 device_param
->words_off
= words_cur
;
4352 const u64 words_left
= words_base
- words_cur
;
4356 if (data
.kernel_power_all
> words_left
)
4358 if (data
.kernel_power_div
== 0)
4360 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4364 if (data
.kernel_power_div
)
4366 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4368 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4370 if (kernel_power_new
< device_param
->kernel_power
)
4372 device_param
->kernel_power
= kernel_power_new
;
4378 const uint kernel_power
= device_param
->kernel_power
;
4380 uint work
= MIN (words_left
, kernel_power
);
4382 work
= MIN (work
, max
);
4384 data
.words_cur
+= work
;
4386 hc_thread_mutex_unlock (mux_dispatcher
);
4391 static void *thread_calc_stdin (void *p
)
4393 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4395 if (device_param
->skipped
) return NULL
;
4397 autotune (device_param
);
4399 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4401 const uint attack_kern
= data
.attack_kern
;
4403 const uint kernel_power
= device_param
->kernel_power
;
4405 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4407 hc_thread_mutex_lock (mux_dispatcher
);
4409 if (feof (stdin
) != 0)
4411 hc_thread_mutex_unlock (mux_dispatcher
);
4418 while (words_cur
< kernel_power
)
4420 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4422 if (line_buf
== NULL
) break;
4424 uint line_len
= in_superchop (line_buf
);
4426 line_len
= convert_from_hex (line_buf
, line_len
);
4428 // post-process rule engine
4430 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4432 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4434 int rule_len_out
= -1;
4436 if (line_len
< BLOCK_SIZE
)
4438 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4441 if (rule_len_out
< 0) continue;
4443 line_buf
= rule_buf_out
;
4444 line_len
= rule_len_out
;
4447 if (line_len
> PW_MAX
)
4452 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4454 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4456 hc_thread_mutex_lock (mux_counter
);
4458 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4460 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4463 hc_thread_mutex_unlock (mux_counter
);
4468 else if (attack_kern
== ATTACK_KERN_COMBI
)
4470 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4471 // since we still need to combine the plains
4473 if (line_len
> data
.pw_max
)
4475 hc_thread_mutex_lock (mux_counter
);
4477 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4479 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4482 hc_thread_mutex_unlock (mux_counter
);
4488 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4492 if (data
.devices_status
== STATUS_CRACKED
) break;
4493 if (data
.devices_status
== STATUS_ABORTED
) break;
4494 if (data
.devices_status
== STATUS_QUIT
) break;
4495 if (data
.devices_status
== STATUS_BYPASS
) break;
4498 hc_thread_mutex_unlock (mux_dispatcher
);
4500 if (data
.devices_status
== STATUS_CRACKED
) break;
4501 if (data
.devices_status
== STATUS_ABORTED
) break;
4502 if (data
.devices_status
== STATUS_QUIT
) break;
4503 if (data
.devices_status
== STATUS_BYPASS
) break;
4507 const uint pws_cnt
= device_param
->pws_cnt
;
4511 run_copy (device_param
, pws_cnt
);
4513 run_cracker (device_param
, pws_cnt
);
4515 device_param
->pws_cnt
= 0;
4519 if (attack_kern == ATTACK_KERN_STRAIGHT)
4521 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4523 else if (attack_kern == ATTACK_KERN_COMBI)
4525 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4531 device_param
->kernel_accel
= 0;
4532 device_param
->kernel_loops
= 0;
4539 static void *thread_calc (void *p
)
4541 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4543 if (device_param
->skipped
) return NULL
;
4545 autotune (device_param
);
4547 const uint attack_mode
= data
.attack_mode
;
4548 const uint attack_kern
= data
.attack_kern
;
4550 if (attack_mode
== ATTACK_MODE_BF
)
4552 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4554 const uint work
= get_work (device_param
, -1, true);
4556 if (work
== 0) break;
4558 const u64 words_off
= device_param
->words_off
;
4559 const u64 words_fin
= words_off
+ work
;
4561 const uint pws_cnt
= work
;
4563 device_param
->pws_cnt
= pws_cnt
;
4567 run_copy (device_param
, pws_cnt
);
4569 run_cracker (device_param
, pws_cnt
);
4571 device_param
->pws_cnt
= 0;
4575 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4579 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4581 if (data
.devices_status
== STATUS_CRACKED
) break;
4582 if (data
.devices_status
== STATUS_ABORTED
) break;
4583 if (data
.devices_status
== STATUS_QUIT
) break;
4584 if (data
.devices_status
== STATUS_BYPASS
) break;
4586 if (data
.benchmark
== 1) break;
4588 device_param
->words_done
= words_fin
;
4593 const uint segment_size
= data
.segment_size
;
4595 char *dictfile
= data
.dictfile
;
4597 if (attack_mode
== ATTACK_MODE_COMBI
)
4599 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4601 dictfile
= data
.dictfile2
;
4605 FILE *fd
= fopen (dictfile
, "rb");
4609 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4614 if (attack_mode
== ATTACK_MODE_COMBI
)
4616 const uint combs_mode
= data
.combs_mode
;
4618 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4620 const char *dictfilec
= data
.dictfile2
;
4622 FILE *combs_fp
= fopen (dictfilec
, "rb");
4624 if (combs_fp
== NULL
)
4626 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4633 device_param
->combs_fp
= combs_fp
;
4635 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4637 const char *dictfilec
= data
.dictfile
;
4639 FILE *combs_fp
= fopen (dictfilec
, "rb");
4641 if (combs_fp
== NULL
)
4643 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4650 device_param
->combs_fp
= combs_fp
;
4654 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4656 wl_data
->buf
= (char *) mymalloc (segment_size
);
4657 wl_data
->avail
= segment_size
;
4658 wl_data
->incr
= segment_size
;
4664 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4669 bool allow_div
= true;
4675 const uint work
= get_work (device_param
, max
, allow_div
);
4679 if (work
== 0) break;
4681 words_off
= device_param
->words_off
;
4682 words_fin
= words_off
+ work
;
4687 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4691 for ( ; words_cur
< words_fin
; words_cur
++)
4693 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4695 line_len
= convert_from_hex (line_buf
, line_len
);
4697 // post-process rule engine
4699 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4701 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4703 int rule_len_out
= -1;
4705 if (line_len
< BLOCK_SIZE
)
4707 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4710 if (rule_len_out
< 0) continue;
4712 line_buf
= rule_buf_out
;
4713 line_len
= rule_len_out
;
4716 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4718 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4722 hc_thread_mutex_lock (mux_counter
);
4724 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4726 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4729 hc_thread_mutex_unlock (mux_counter
);
4734 else if (attack_kern
== ATTACK_KERN_COMBI
)
4736 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4737 // since we still need to combine the plains
4739 if (line_len
> data
.pw_max
)
4743 hc_thread_mutex_lock (mux_counter
);
4745 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4747 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4750 hc_thread_mutex_unlock (mux_counter
);
4756 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4758 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4760 if (data
.devices_status
== STATUS_CRACKED
) break;
4761 if (data
.devices_status
== STATUS_ABORTED
) break;
4762 if (data
.devices_status
== STATUS_QUIT
) break;
4763 if (data
.devices_status
== STATUS_BYPASS
) break;
4766 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4768 if (data
.devices_status
== STATUS_CRACKED
) break;
4769 if (data
.devices_status
== STATUS_ABORTED
) break;
4770 if (data
.devices_status
== STATUS_QUIT
) break;
4771 if (data
.devices_status
== STATUS_BYPASS
) break;
4774 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4776 if (data
.devices_status
== STATUS_CRACKED
) break;
4777 if (data
.devices_status
== STATUS_ABORTED
) break;
4778 if (data
.devices_status
== STATUS_QUIT
) break;
4779 if (data
.devices_status
== STATUS_BYPASS
) break;
4785 const uint pws_cnt
= device_param
->pws_cnt
;
4789 run_copy (device_param
, pws_cnt
);
4791 run_cracker (device_param
, pws_cnt
);
4793 device_param
->pws_cnt
= 0;
4797 if (attack_kern == ATTACK_KERN_STRAIGHT)
4799 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4801 else if (attack_kern == ATTACK_KERN_COMBI)
4803 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4808 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4810 if (data
.devices_status
== STATUS_CRACKED
) break;
4811 if (data
.devices_status
== STATUS_ABORTED
) break;
4812 if (data
.devices_status
== STATUS_QUIT
) break;
4813 if (data
.devices_status
== STATUS_BYPASS
) break;
4815 if (words_fin
== 0) break;
4817 device_param
->words_done
= words_fin
;
4820 if (attack_mode
== ATTACK_MODE_COMBI
)
4822 fclose (device_param
->combs_fp
);
4825 free (wl_data
->buf
);
4831 device_param
->kernel_accel
= 0;
4832 device_param
->kernel_loops
= 0;
4837 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4841 log_error ("ERROR: %s : Invalid argument", __func__
);
4846 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4848 device_param
->kernel_params_buf32
[24] = salt_pos
;
4849 device_param
->kernel_params_buf32
[27] = 1;
4850 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4851 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4852 device_param
->kernel_params_buf32
[30] = 0;
4853 device_param
->kernel_params_buf32
[31] = 1;
4855 char *dictfile_old
= data
.dictfile
;
4857 const char *weak_hash_check
= "weak-hash-check";
4859 data
.dictfile
= (char *) weak_hash_check
;
4861 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4863 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4869 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4871 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4875 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4877 uint loop_step
= 16;
4879 const uint iter
= salt_buf
->salt_iter
;
4881 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4883 uint loop_left
= iter
- loop_pos
;
4885 loop_left
= MIN (loop_left
, loop_step
);
4887 device_param
->kernel_params_buf32
[25] = loop_pos
;
4888 device_param
->kernel_params_buf32
[26] = loop_left
;
4890 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4893 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4900 check_cracked (device_param
, salt_pos
);
4906 device_param
->kernel_params_buf32
[24] = 0;
4907 device_param
->kernel_params_buf32
[25] = 0;
4908 device_param
->kernel_params_buf32
[26] = 0;
4909 device_param
->kernel_params_buf32
[27] = 0;
4910 device_param
->kernel_params_buf32
[28] = 0;
4911 device_param
->kernel_params_buf32
[29] = 0;
4912 device_param
->kernel_params_buf32
[30] = 0;
4913 device_param
->kernel_params_buf32
[31] = 0;
4915 data
.dictfile
= dictfile_old
;
4917 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4922 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4924 if (data
.username
== 0)
4926 *hashbuf_pos
= line_buf
;
4927 *hashbuf_len
= line_len
;
4931 char *pos
= line_buf
;
4934 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4936 if (line_buf
[i
] == data
.separator
)
4951 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
4958 for (int i
= 0; i
< line_len
; i
++)
4960 if (line_buf
[i
] == data
.separator
)
4969 if (pos
== NULL
) pos
= line_buf
+ i
;
4981 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
4988 for (int i
= 0; i
< line_len
; i
++)
4990 if (line_buf
[i
] == ':')
4997 if (sep_cnt
== 2) sep2_len
++;
4998 if (sep_cnt
== 3) sep3_len
++;
5001 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5006 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5013 for (int i
= 0; i
< line_len
; i
++)
5015 if (line_buf
[i
] == ':')
5022 if (data
.hash_mode
== 1000)
5026 if (pos
== NULL
) pos
= line_buf
+ i
;
5031 else if (data
.hash_mode
== 3000)
5035 if (pos
== NULL
) pos
= line_buf
+ i
;
5046 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5053 for (int i
= 0; i
< line_len
; i
++)
5055 if (line_buf
[i
] == ':')
5064 if (pos
== NULL
) pos
= line_buf
+ i
;
5076 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5080 char sep5_first
= 0;
5081 char sep6_first
= 0;
5083 for (int i
= 0; i
< line_len
; i
++)
5085 if (line_buf
[i
] == ':')
5092 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5093 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5096 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5101 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5108 for (int i
= 0; i
< line_len
; i
++)
5110 if (line_buf
[i
] == ':')
5119 if (pos
== NULL
) pos
= line_buf
+ i
;
5129 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5136 for (int i
= 0; i
< line_len
; i
++)
5138 if (line_buf
[i
] == ':')
5147 if (pos
== NULL
) pos
= line_buf
+ i
;
5159 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5163 for (int i
= 0; i
< line_len
; i
++)
5165 if (line_buf
[i
] == ':') sep_cnt
++;
5168 if (sep_cnt
== 8) return 1;
5173 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5175 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5178 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5180 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5185 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5187 switch (hashfile_format
)
5189 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5190 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5191 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5192 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5196 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5198 switch (hashfile_format
)
5200 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5201 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5202 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5203 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5207 char *strhlfmt (const uint hashfile_format
)
5209 switch (hashfile_format
)
5211 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5212 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5213 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5214 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5215 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5216 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5217 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5218 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5219 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5220 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5223 return ((char *) "Unknown");
5226 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5228 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5230 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5231 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5233 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5237 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5241 int line_len
= fgetl (fp
, line_buf
);
5243 if (line_len
== 0) continue;
5245 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5246 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5247 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5249 if (num_check
== max_check
) break;
5256 uint hashlist_format
= HLFMT_HASHCAT
;
5258 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5260 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5262 hashlist_format
= i
;
5267 return hashlist_format
;
5271 * some further helper function
5274 // wrapper around mymalloc for ADL
5276 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5277 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5279 return mymalloc (iSize
);
5283 static uint
generate_bitmaps (const uint digests_cnt
, const uint dgst_size
, const uint dgst_shifts
, char *digests_buf_ptr
, const uint bitmap_mask
, const uint bitmap_size
, uint
*bitmap_a
, uint
*bitmap_b
, uint
*bitmap_c
, uint
*bitmap_d
, const u64 collisions_max
)
5287 const uint dgst_pos0
= data
.dgst_pos0
;
5288 const uint dgst_pos1
= data
.dgst_pos1
;
5289 const uint dgst_pos2
= data
.dgst_pos2
;
5290 const uint dgst_pos3
= data
.dgst_pos3
;
5292 memset (bitmap_a
, 0, bitmap_size
);
5293 memset (bitmap_b
, 0, bitmap_size
);
5294 memset (bitmap_c
, 0, bitmap_size
);
5295 memset (bitmap_d
, 0, bitmap_size
);
5297 for (uint i
= 0; i
< digests_cnt
; i
++)
5299 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5301 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5303 digests_buf_ptr
+= dgst_size
;
5305 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5306 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5307 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5308 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5310 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5311 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5312 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5313 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5315 if (bitmap_a
[idx0
] & val0
) collisions
++;
5316 if (bitmap_b
[idx1
] & val1
) collisions
++;
5317 if (bitmap_c
[idx2
] & val2
) collisions
++;
5318 if (bitmap_d
[idx3
] & val3
) collisions
++;
5320 bitmap_a
[idx0
] |= val0
;
5321 bitmap_b
[idx1
] |= val1
;
5322 bitmap_c
[idx2
] |= val2
;
5323 bitmap_d
[idx3
] |= val3
;
5325 if (collisions
>= collisions_max
) return 0x7fffffff;
5336 void SetConsoleWindowSize (const int x
, const int y
)
5338 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
5340 if (h
== INVALID_HANDLE_VALUE
) return;
5342 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
5344 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
5346 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
5350 sr
->Right
= MAX (sr
->Right
, x
- 1);
5351 sr
->Bottom
= MAX (sr
->Bottom
, y
- 1);
5355 co
.X
= sr
->Right
+ 1;
5356 co
.Y
= sr
->Bottom
+ 1;
5358 co
.Y
= MAX (co
.Y
, 1337);
5360 if (!SetConsoleScreenBufferSize (h
, co
)) return;
5362 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
5366 int main (int argc
, char **argv
)
5369 SetConsoleWindowSize (132, 44);
5373 * To help users a bit
5376 char *compute
= getenv ("COMPUTE");
5380 static char display
[100];
5382 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5388 if (getenv ("DISPLAY") == NULL
)
5389 putenv ((char *) "DISPLAY=:0");
5392 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5393 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5395 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5396 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5398 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5399 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5401 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5402 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5404 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5405 putenv ((char *) "POCL_KERNEL_CACHE=0");
5413 memset (&data
, 0, sizeof (hc_global_data_t
));
5419 data
.proc_start
= proc_start
;
5422 char **myargv
= argv
;
5424 hc_thread_mutex_init (mux_dispatcher
);
5425 hc_thread_mutex_init (mux_counter
);
5426 hc_thread_mutex_init (mux_display
);
5427 hc_thread_mutex_init (mux_adl
);
5430 * commandline parameters
5434 uint version
= VERSION
;
5436 uint benchmark
= BENCHMARK
;
5439 uint username
= USERNAME
;
5440 uint remove
= REMOVE
;
5441 uint remove_timer
= REMOVE_TIMER
;
5444 uint keyspace
= KEYSPACE
;
5445 uint potfile_disable
= POTFILE_DISABLE
;
5446 char *potfile_path
= NULL
;
5447 uint debug_mode
= DEBUG_MODE
;
5448 char *debug_file
= NULL
;
5449 char *induction_dir
= NULL
;
5450 char *outfile_check_dir
= NULL
;
5452 uint runtime
= RUNTIME
;
5453 uint hash_mode
= HASH_MODE
;
5454 uint attack_mode
= ATTACK_MODE
;
5455 uint markov_disable
= MARKOV_DISABLE
;
5456 uint markov_classic
= MARKOV_CLASSIC
;
5457 uint markov_threshold
= MARKOV_THRESHOLD
;
5458 char *markov_hcstat
= NULL
;
5459 char *outfile
= NULL
;
5460 uint outfile_format
= OUTFILE_FORMAT
;
5461 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5462 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5463 uint restore
= RESTORE
;
5464 uint restore_timer
= RESTORE_TIMER
;
5465 uint restore_disable
= RESTORE_DISABLE
;
5466 uint status
= STATUS
;
5467 uint status_timer
= STATUS_TIMER
;
5468 uint machine_readable
= MACHINE_READABLE
;
5469 uint loopback
= LOOPBACK
;
5470 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5471 char *session
= NULL
;
5472 uint hex_charset
= HEX_CHARSET
;
5473 uint hex_salt
= HEX_SALT
;
5474 uint hex_wordlist
= HEX_WORDLIST
;
5475 uint rp_gen
= RP_GEN
;
5476 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5477 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5478 uint rp_gen_seed
= RP_GEN_SEED
;
5479 char *rule_buf_l
= (char *) RULE_BUF_L
;
5480 char *rule_buf_r
= (char *) RULE_BUF_R
;
5481 uint increment
= INCREMENT
;
5482 uint increment_min
= INCREMENT_MIN
;
5483 uint increment_max
= INCREMENT_MAX
;
5484 char *cpu_affinity
= NULL
;
5485 OCL_PTR
*ocl
= NULL
;
5486 char *opencl_devices
= NULL
;
5487 char *opencl_platforms
= NULL
;
5488 char *opencl_device_types
= NULL
;
5489 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5490 char *truecrypt_keyfiles
= NULL
;
5491 char *veracrypt_keyfiles
= NULL
;
5492 uint veracrypt_pim
= 0;
5493 uint workload_profile
= WORKLOAD_PROFILE
;
5494 uint kernel_accel
= KERNEL_ACCEL
;
5495 uint kernel_loops
= KERNEL_LOOPS
;
5496 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5498 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5499 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5501 uint powertune_enable
= POWERTUNE_ENABLE
;
5504 uint logfile_disable
= LOGFILE_DISABLE
;
5505 uint segment_size
= SEGMENT_SIZE
;
5506 uint scrypt_tmto
= SCRYPT_TMTO
;
5507 char separator
= SEPARATOR
;
5508 uint bitmap_min
= BITMAP_MIN
;
5509 uint bitmap_max
= BITMAP_MAX
;
5510 char *custom_charset_1
= NULL
;
5511 char *custom_charset_2
= NULL
;
5512 char *custom_charset_3
= NULL
;
5513 char *custom_charset_4
= NULL
;
5515 #define IDX_HELP 'h'
5516 #define IDX_VERSION 'V'
5517 #define IDX_VERSION_LOWER 'v'
5518 #define IDX_QUIET 0xff02
5519 #define IDX_SHOW 0xff03
5520 #define IDX_LEFT 0xff04
5521 #define IDX_REMOVE 0xff05
5522 #define IDX_REMOVE_TIMER 0xff37
5523 #define IDX_SKIP 's'
5524 #define IDX_LIMIT 'l'
5525 #define IDX_KEYSPACE 0xff35
5526 #define IDX_POTFILE_DISABLE 0xff06
5527 #define IDX_POTFILE_PATH 0xffe0
5528 #define IDX_DEBUG_MODE 0xff43
5529 #define IDX_DEBUG_FILE 0xff44
5530 #define IDX_INDUCTION_DIR 0xff46
5531 #define IDX_OUTFILE_CHECK_DIR 0xff47
5532 #define IDX_USERNAME 0xff07
5533 #define IDX_FORCE 0xff08
5534 #define IDX_RUNTIME 0xff09
5535 #define IDX_BENCHMARK 'b'
5536 #define IDX_HASH_MODE 'm'
5537 #define IDX_ATTACK_MODE 'a'
5538 #define IDX_RP_FILE 'r'
5539 #define IDX_RP_GEN 'g'
5540 #define IDX_RP_GEN_FUNC_MIN 0xff10
5541 #define IDX_RP_GEN_FUNC_MAX 0xff11
5542 #define IDX_RP_GEN_SEED 0xff34
5543 #define IDX_RULE_BUF_L 'j'
5544 #define IDX_RULE_BUF_R 'k'
5545 #define IDX_INCREMENT 'i'
5546 #define IDX_INCREMENT_MIN 0xff12
5547 #define IDX_INCREMENT_MAX 0xff13
5548 #define IDX_OUTFILE 'o'
5549 #define IDX_OUTFILE_FORMAT 0xff14
5550 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5551 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5552 #define IDX_RESTORE 0xff15
5553 #define IDX_RESTORE_DISABLE 0xff27
5554 #define IDX_STATUS 0xff17
5555 #define IDX_STATUS_TIMER 0xff18
5556 #define IDX_MACHINE_READABLE 0xff50
5557 #define IDX_LOOPBACK 0xff38
5558 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5559 #define IDX_SESSION 0xff19
5560 #define IDX_HEX_CHARSET 0xff20
5561 #define IDX_HEX_SALT 0xff21
5562 #define IDX_HEX_WORDLIST 0xff40
5563 #define IDX_MARKOV_DISABLE 0xff22
5564 #define IDX_MARKOV_CLASSIC 0xff23
5565 #define IDX_MARKOV_THRESHOLD 't'
5566 #define IDX_MARKOV_HCSTAT 0xff24
5567 #define IDX_CPU_AFFINITY 0xff25
5568 #define IDX_OPENCL_DEVICES 'd'
5569 #define IDX_OPENCL_PLATFORMS 0xff72
5570 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5571 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5572 #define IDX_WORKLOAD_PROFILE 'w'
5573 #define IDX_KERNEL_ACCEL 'n'
5574 #define IDX_KERNEL_LOOPS 'u'
5575 #define IDX_GPU_TEMP_DISABLE 0xff29
5576 #define IDX_GPU_TEMP_ABORT 0xff30
5577 #define IDX_GPU_TEMP_RETAIN 0xff31
5578 #define IDX_POWERTUNE_ENABLE 0xff41
5579 #define IDX_LOGFILE_DISABLE 0xff51
5580 #define IDX_TRUECRYPT_KEYFILES 0xff52
5581 #define IDX_VERACRYPT_KEYFILES 0xff53
5582 #define IDX_VERACRYPT_PIM 0xff54
5583 #define IDX_SCRYPT_TMTO 0xff61
5584 #define IDX_SEGMENT_SIZE 'c'
5585 #define IDX_SEPARATOR 'p'
5586 #define IDX_BITMAP_MIN 0xff70
5587 #define IDX_BITMAP_MAX 0xff71
5588 #define IDX_CUSTOM_CHARSET_1 '1'
5589 #define IDX_CUSTOM_CHARSET_2 '2'
5590 #define IDX_CUSTOM_CHARSET_3 '3'
5591 #define IDX_CUSTOM_CHARSET_4 '4'
5593 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5595 struct option long_options
[] =
5597 {"help", no_argument
, 0, IDX_HELP
},
5598 {"version", no_argument
, 0, IDX_VERSION
},
5599 {"quiet", no_argument
, 0, IDX_QUIET
},
5600 {"show", no_argument
, 0, IDX_SHOW
},
5601 {"left", no_argument
, 0, IDX_LEFT
},
5602 {"username", no_argument
, 0, IDX_USERNAME
},
5603 {"remove", no_argument
, 0, IDX_REMOVE
},
5604 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5605 {"skip", required_argument
, 0, IDX_SKIP
},
5606 {"limit", required_argument
, 0, IDX_LIMIT
},
5607 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5608 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5609 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5610 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5611 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5612 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5613 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5614 {"force", no_argument
, 0, IDX_FORCE
},
5615 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5616 {"restore", no_argument
, 0, IDX_RESTORE
},
5617 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5618 {"status", no_argument
, 0, IDX_STATUS
},
5619 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5620 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5621 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5622 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5623 {"session", required_argument
, 0, IDX_SESSION
},
5624 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5625 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5626 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5627 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5628 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5629 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5630 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5631 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5632 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5633 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5634 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5635 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5636 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5637 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5638 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5639 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5640 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5641 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5642 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5643 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5644 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5645 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5646 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5647 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5648 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5649 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5650 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5651 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5652 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5653 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5655 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5656 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5658 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5660 #endif // HAVE_HWMON
5661 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5662 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5663 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5664 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5665 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5666 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5667 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5668 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5669 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5670 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5671 {"increment", no_argument
, 0, IDX_INCREMENT
},
5672 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5673 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5674 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5675 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5676 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5677 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5681 uint rp_files_cnt
= 0;
5683 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5685 int option_index
= 0;
5691 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5695 case IDX_HELP
: usage
= 1; break;
5697 case IDX_VERSION_LOWER
: version
= 1; break;
5698 case IDX_RESTORE
: restore
= 1; break;
5699 case IDX_SESSION
: session
= optarg
; break;
5700 case IDX_SHOW
: show
= 1; break;
5701 case IDX_LEFT
: left
= 1; break;
5702 case '?': return (-1);
5708 log_error ("ERROR: Invalid argument specified");
5719 log_info ("%s", VERSION_TAG
);
5726 usage_big_print (PROGNAME
);
5732 * session needs to be set, always!
5735 if (session
== NULL
) session
= (char *) PROGNAME
;
5738 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5741 char *exec_path
= get_exec_path ();
5745 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5746 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5748 char *install_dir
= get_install_dir (resolved_exec_path
);
5749 char *profile_dir
= NULL
;
5750 char *session_dir
= NULL
;
5751 char *shared_dir
= NULL
;
5753 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5755 struct passwd
*pw
= getpwuid (getuid ());
5757 const char *homedir
= pw
->pw_dir
;
5759 profile_dir
= get_profile_dir (homedir
);
5760 session_dir
= get_session_dir (profile_dir
);
5761 shared_dir
= strdup (SHARED_FOLDER
);
5763 mkdir (profile_dir
, 0700);
5764 mkdir (session_dir
, 0700);
5768 profile_dir
= install_dir
;
5769 session_dir
= install_dir
;
5770 shared_dir
= install_dir
;
5773 myfree (resolved_install_folder
);
5774 myfree (resolved_exec_path
);
5778 char *install_dir
= get_install_dir (exec_path
);
5779 char *profile_dir
= install_dir
;
5780 char *session_dir
= install_dir
;
5781 char *shared_dir
= install_dir
;
5785 data
.install_dir
= install_dir
;
5786 data
.profile_dir
= profile_dir
;
5787 data
.session_dir
= session_dir
;
5788 data
.shared_dir
= shared_dir
;
5793 * kernel cache, we need to make sure folder exist
5796 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5798 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5800 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5802 mkdir (kernels_folder
, 0700);
5804 myfree (kernels_folder
);
5810 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5812 data
.session
= session
;
5814 char *eff_restore_file
= (char *) mymalloc (session_size
);
5815 char *new_restore_file
= (char *) mymalloc (session_size
);
5817 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5818 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5820 data
.eff_restore_file
= eff_restore_file
;
5821 data
.new_restore_file
= new_restore_file
;
5823 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5825 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5826 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5831 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5832 if ((show
== 1) || (left
== 1))
5834 restore_disable
= 1;
5839 data
.restore_disable
= restore_disable
;
5841 restore_data_t
*rd
= init_restore (argc
, argv
);
5851 read_restore (eff_restore_file
, rd
);
5853 if (rd
->version_bin
< RESTORE_MIN
)
5855 log_error ("ERROR: Incompatible restore-file version");
5864 rd
->pid
= getpid ();
5866 rd
->pid
= GetCurrentProcessId ();
5870 uint hash_mode_chgd
= 0;
5871 uint runtime_chgd
= 0;
5872 uint kernel_loops_chgd
= 0;
5873 uint kernel_accel_chgd
= 0;
5874 uint attack_mode_chgd
= 0;
5875 uint outfile_format_chgd
= 0;
5876 uint rp_gen_seed_chgd
= 0;
5877 uint remove_timer_chgd
= 0;
5878 uint increment_min_chgd
= 0;
5879 uint increment_max_chgd
= 0;
5880 uint workload_profile_chgd
= 0;
5881 uint opencl_vector_width_chgd
= 0;
5883 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5884 uint gpu_temp_retain_chgd
= 0;
5885 uint gpu_temp_abort_chgd
= 0;
5892 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5896 //case IDX_HELP: usage = 1; break;
5897 //case IDX_VERSION: version = 1; break;
5898 //case IDX_RESTORE: restore = 1; break;
5899 case IDX_QUIET
: quiet
= 1; break;
5900 //case IDX_SHOW: show = 1; break;
5901 case IDX_SHOW
: break;
5902 //case IDX_LEFT: left = 1; break;
5903 case IDX_LEFT
: break;
5904 case IDX_USERNAME
: username
= 1; break;
5905 case IDX_REMOVE
: remove
= 1; break;
5906 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5907 remove_timer_chgd
= 1; break;
5908 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5909 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5910 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5911 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5912 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5913 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5914 case IDX_FORCE
: force
= 1; break;
5915 case IDX_SKIP
: skip
= atoll (optarg
); break;
5916 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5917 case IDX_KEYSPACE
: keyspace
= 1; break;
5918 case IDX_BENCHMARK
: benchmark
= 1; break;
5919 case IDX_RESTORE
: break;
5920 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5921 case IDX_STATUS
: status
= 1; break;
5922 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5923 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5924 case IDX_LOOPBACK
: loopback
= 1; break;
5925 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5926 //case IDX_SESSION: session = optarg; break;
5927 case IDX_SESSION
: break;
5928 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5929 hash_mode_chgd
= 1; break;
5930 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5931 runtime_chgd
= 1; break;
5932 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5933 attack_mode_chgd
= 1; break;
5934 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5935 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5936 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5937 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5938 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5939 rp_gen_seed_chgd
= 1; break;
5940 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5941 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5942 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5943 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5944 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5945 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5946 case IDX_OUTFILE
: outfile
= optarg
; break;
5947 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5948 outfile_format_chgd
= 1; break;
5949 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
5950 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
5951 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5952 case IDX_HEX_SALT
: hex_salt
= 1; break;
5953 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5954 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5955 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
5956 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
5957 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
5958 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
5959 opencl_vector_width_chgd
= 1; break;
5960 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
5961 workload_profile_chgd
= 1; break;
5962 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
5963 kernel_accel_chgd
= 1; break;
5964 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
5965 kernel_loops_chgd
= 1; break;
5966 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5968 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
5970 gpu_temp_abort_chgd
= 1;
5973 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
5975 gpu_temp_retain_chgd
= 1;
5979 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5981 #endif // HAVE_HWMON
5982 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5983 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5984 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
5985 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
5986 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5987 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5988 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5989 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5990 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5991 case IDX_INCREMENT
: increment
= 1; break;
5992 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5993 increment_min_chgd
= 1; break;
5994 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5995 increment_max_chgd
= 1; break;
5996 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5997 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5998 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5999 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6002 log_error ("ERROR: Invalid argument specified");
6009 log_error ("ERROR: Invalid argument specified");
6015 * Inform user things getting started,
6016 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6017 * - we do not need to check algorithm_pos
6024 if (machine_readable
== 0)
6026 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6031 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6034 else if (restore
== 1)
6036 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6041 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6050 if (attack_mode
> 7)
6052 log_error ("ERROR: Invalid attack-mode specified");
6057 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6059 log_error ("ERROR: Invalid runtime specified");
6064 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6066 log_error ("ERROR: Invalid hash-type specified");
6071 // renamed hash modes
6085 log_error ("Old -m specified, use -m %d instead", n
);
6093 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6095 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6101 if (outfile_format
> 16)
6103 log_error ("ERROR: Invalid outfile-format specified");
6110 if (outfile_format_chgd
== 1)
6112 if (outfile_format
> 1)
6114 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6121 outfile_format
= OUTFILE_FMT_HASH
;
6127 if (outfile_format_chgd
== 1)
6129 if ((outfile_format
> 7) && (outfile_format
< 16))
6131 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6138 if (increment_min
< INCREMENT_MIN
)
6140 log_error ("ERROR: Invalid increment-min specified");
6145 if (increment_max
> INCREMENT_MAX
)
6147 log_error ("ERROR: Invalid increment-max specified");
6152 if (increment_min
> increment_max
)
6154 log_error ("ERROR: Invalid increment-min specified");
6159 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6161 log_error ("ERROR: increment is not allowed in attack-mode 0");
6166 if ((increment
== 0) && (increment_min_chgd
== 1))
6168 log_error ("ERROR: increment-min is only supported together with increment switch");
6173 if ((increment
== 0) && (increment_max_chgd
== 1))
6175 log_error ("ERROR: increment-max is only supported together with increment switch");
6180 if (rp_files_cnt
&& rp_gen
)
6182 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6187 if (rp_files_cnt
|| rp_gen
)
6189 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6191 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6197 if (rp_gen_func_min
> rp_gen_func_max
)
6199 log_error ("ERROR: Invalid rp-gen-func-min specified");
6204 if (kernel_accel_chgd
== 1)
6208 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6209 log_info ("Please consider using the option -w instead");
6210 log_info ("You can use --force to override this but do not post error reports if you do so");
6216 if (kernel_accel
< 1)
6218 log_error ("ERROR: Invalid kernel-accel specified");
6223 if (kernel_accel
> 1024)
6225 log_error ("ERROR: Invalid kernel-accel specified");
6231 if (kernel_loops_chgd
== 1)
6235 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6236 log_info ("Please consider using the option -w instead");
6237 log_info ("You can use --force to override this but do not post error reports if you do so");
6243 if (kernel_loops
< 1)
6245 log_error ("ERROR: Invalid kernel-loops specified");
6250 if (kernel_loops
> 1024)
6252 log_error ("ERROR: Invalid kernel-loops specified");
6258 if ((workload_profile
< 1) || (workload_profile
> 4))
6260 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6265 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6267 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6272 if (show
== 1 || left
== 1)
6274 attack_mode
= ATTACK_MODE_NONE
;
6278 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6283 if (potfile_disable
== 1)
6285 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6291 uint attack_kern
= ATTACK_KERN_NONE
;
6293 switch (attack_mode
)
6295 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6296 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6297 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6298 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6299 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6306 int num_additional_params
= 1;
6308 if (attack_kern
== ATTACK_KERN_COMBI
)
6310 num_additional_params
= 2;
6313 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6315 if (keyspace_wordlist_specified
== 0) optind
--;
6318 if (attack_kern
== ATTACK_KERN_NONE
)
6320 if ((optind
+ 1) != myargc
)
6322 usage_mini_print (myargv
[0]);
6327 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6329 if ((optind
+ 1) > myargc
)
6331 usage_mini_print (myargv
[0]);
6336 else if (attack_kern
== ATTACK_KERN_COMBI
)
6338 if ((optind
+ 3) != myargc
)
6340 usage_mini_print (myargv
[0]);
6345 else if (attack_kern
== ATTACK_KERN_BF
)
6347 if ((optind
+ 1) > myargc
)
6349 usage_mini_print (myargv
[0]);
6356 usage_mini_print (myargv
[0]);
6363 if (myargv
[optind
] != 0)
6365 log_error ("ERROR: Invalid argument for benchmark mode specified");
6370 if (attack_mode_chgd
== 1)
6372 if (attack_mode
!= ATTACK_MODE_BF
)
6374 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6381 if (skip
!= 0 && limit
!= 0)
6390 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6396 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6401 potfile_disable
= 1;
6403 restore_disable
= 1;
6407 weak_hash_threshold
= 0;
6412 if (remove_timer_chgd
== 1)
6416 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6421 if (remove_timer
< 1)
6423 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6431 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6433 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6435 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6442 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6450 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6452 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6457 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6459 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6467 log_error ("ERROR: Invalid debug-mode specified");
6472 if (debug_file
!= NULL
)
6476 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6482 if (induction_dir
!= NULL
)
6484 if (attack_mode
== ATTACK_MODE_BF
)
6486 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6492 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6494 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6496 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6501 weak_hash_threshold
= 0;
6505 * induction directory
6508 char *induction_directory
= NULL
;
6510 if (attack_mode
!= ATTACK_MODE_BF
)
6512 if (induction_dir
== NULL
)
6514 induction_directory
= (char *) mymalloc (session_size
);
6516 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6518 // create induction folder if it does not already exist
6522 if (rmdir (induction_directory
) == -1)
6524 if (errno
== ENOENT
)
6526 // good, we can ignore
6528 else if (errno
== ENOTEMPTY
)
6530 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6532 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6534 if (rename (induction_directory
, induction_directory_mv
) != 0)
6536 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6543 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6549 if (mkdir (induction_directory
, 0700) == -1)
6551 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6559 induction_directory
= induction_dir
;
6563 data
.induction_directory
= induction_directory
;
6569 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6571 char *loopback_file
= (char *) mymalloc (loopback_size
);
6577 char tuning_db_file
[256] = { 0 };
6579 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6581 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6584 * outfile-check directory
6587 char *outfile_check_directory
= NULL
;
6589 if (outfile_check_dir
== NULL
)
6591 outfile_check_directory
= (char *) mymalloc (session_size
);
6593 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6597 outfile_check_directory
= outfile_check_dir
;
6600 data
.outfile_check_directory
= outfile_check_directory
;
6604 struct stat outfile_check_stat
;
6606 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6608 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6612 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6617 else if (outfile_check_dir
== NULL
)
6619 if (mkdir (outfile_check_directory
, 0700) == -1)
6621 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6629 * special other stuff
6632 if (hash_mode
== 9710)
6635 outfile_format_chgd
= 1;
6638 if (hash_mode
== 9810)
6641 outfile_format_chgd
= 1;
6644 if (hash_mode
== 10410)
6647 outfile_format_chgd
= 1;
6654 data
.hash_mode
= hash_mode
;
6655 data
.restore
= restore
;
6656 data
.restore_timer
= restore_timer
;
6657 data
.restore_disable
= restore_disable
;
6658 data
.status
= status
;
6659 data
.status_timer
= status_timer
;
6660 data
.machine_readable
= machine_readable
;
6661 data
.loopback
= loopback
;
6662 data
.runtime
= runtime
;
6663 data
.remove
= remove
;
6664 data
.remove_timer
= remove_timer
;
6665 data
.debug_mode
= debug_mode
;
6666 data
.debug_file
= debug_file
;
6667 data
.username
= username
;
6669 data
.outfile
= outfile
;
6670 data
.outfile_format
= outfile_format
;
6671 data
.outfile_autohex
= outfile_autohex
;
6672 data
.hex_charset
= hex_charset
;
6673 data
.hex_salt
= hex_salt
;
6674 data
.hex_wordlist
= hex_wordlist
;
6675 data
.separator
= separator
;
6676 data
.rp_files
= rp_files
;
6677 data
.rp_files_cnt
= rp_files_cnt
;
6678 data
.rp_gen
= rp_gen
;
6679 data
.rp_gen_seed
= rp_gen_seed
;
6681 data
.benchmark
= benchmark
;
6686 data
.powertune_enable
= powertune_enable
;
6689 data
.logfile_disable
= logfile_disable
;
6690 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6691 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6692 data
.veracrypt_pim
= veracrypt_pim
;
6693 data
.scrypt_tmto
= scrypt_tmto
;
6694 data
.workload_profile
= workload_profile
;
6702 set_cpu_affinity (cpu_affinity
);
6705 if (rp_gen_seed_chgd
== 0)
6711 srand (rp_gen_seed
);
6718 if (logfile_disable
== 0)
6720 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6722 char *logfile
= (char *) mymalloc (logfile_size
);
6724 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6726 data
.logfile
= logfile
;
6728 char *topid
= logfile_generate_topid ();
6733 // logfile_append() checks for logfile_disable internally to make it easier from here
6735 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6736 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6737 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6738 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6739 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6740 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6741 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6742 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6743 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6744 #define logfile_sub_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s\t%s", data.topid, data.subid, (var), (val));
6746 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6747 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6748 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6749 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6750 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6751 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6752 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6753 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6755 logfile_top_msg ("START");
6757 logfile_top_uint (attack_mode
);
6758 logfile_top_uint (attack_kern
);
6759 logfile_top_uint (benchmark
);
6760 logfile_top_uint (bitmap_min
);
6761 logfile_top_uint (bitmap_max
);
6762 logfile_top_uint (debug_mode
);
6763 logfile_top_uint (force
);
6764 logfile_top_uint (kernel_accel
);
6765 logfile_top_uint (kernel_loops
);
6766 logfile_top_uint (gpu_temp_disable
);
6768 logfile_top_uint (gpu_temp_abort
);
6769 logfile_top_uint (gpu_temp_retain
);
6771 logfile_top_uint (hash_mode
);
6772 logfile_top_uint (hex_charset
);
6773 logfile_top_uint (hex_salt
);
6774 logfile_top_uint (hex_wordlist
);
6775 logfile_top_uint (increment
);
6776 logfile_top_uint (increment_max
);
6777 logfile_top_uint (increment_min
);
6778 logfile_top_uint (keyspace
);
6779 logfile_top_uint (left
);
6780 logfile_top_uint (logfile_disable
);
6781 logfile_top_uint (loopback
);
6782 logfile_top_uint (markov_classic
);
6783 logfile_top_uint (markov_disable
);
6784 logfile_top_uint (markov_threshold
);
6785 logfile_top_uint (outfile_autohex
);
6786 logfile_top_uint (outfile_check_timer
);
6787 logfile_top_uint (outfile_format
);
6788 logfile_top_uint (potfile_disable
);
6789 logfile_top_string (potfile_path
);
6790 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6791 logfile_top_uint (powertune_enable
);
6793 logfile_top_uint (scrypt_tmto
);
6794 logfile_top_uint (quiet
);
6795 logfile_top_uint (remove
);
6796 logfile_top_uint (remove_timer
);
6797 logfile_top_uint (restore
);
6798 logfile_top_uint (restore_disable
);
6799 logfile_top_uint (restore_timer
);
6800 logfile_top_uint (rp_gen
);
6801 logfile_top_uint (rp_gen_func_max
);
6802 logfile_top_uint (rp_gen_func_min
);
6803 logfile_top_uint (rp_gen_seed
);
6804 logfile_top_uint (runtime
);
6805 logfile_top_uint (segment_size
);
6806 logfile_top_uint (show
);
6807 logfile_top_uint (status
);
6808 logfile_top_uint (machine_readable
);
6809 logfile_top_uint (status_timer
);
6810 logfile_top_uint (usage
);
6811 logfile_top_uint (username
);
6812 logfile_top_uint (version
);
6813 logfile_top_uint (weak_hash_threshold
);
6814 logfile_top_uint (workload_profile
);
6815 logfile_top_uint64 (limit
);
6816 logfile_top_uint64 (skip
);
6817 logfile_top_char (separator
);
6818 logfile_top_string (cpu_affinity
);
6819 logfile_top_string (custom_charset_1
);
6820 logfile_top_string (custom_charset_2
);
6821 logfile_top_string (custom_charset_3
);
6822 logfile_top_string (custom_charset_4
);
6823 logfile_top_string (debug_file
);
6824 logfile_top_string (opencl_devices
);
6825 logfile_top_string (opencl_platforms
);
6826 logfile_top_string (opencl_device_types
);
6827 logfile_top_uint (opencl_vector_width
);
6828 logfile_top_string (induction_dir
);
6829 logfile_top_string (markov_hcstat
);
6830 logfile_top_string (outfile
);
6831 logfile_top_string (outfile_check_dir
);
6832 logfile_top_string (rule_buf_l
);
6833 logfile_top_string (rule_buf_r
);
6834 logfile_top_string (session
);
6835 logfile_top_string (truecrypt_keyfiles
);
6836 logfile_top_string (veracrypt_keyfiles
);
6837 logfile_top_uint (veracrypt_pim
);
6840 * Init OpenCL library loader
6845 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6853 * OpenCL platform selection
6856 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6859 * OpenCL device selection
6862 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6865 * OpenCL device type selection
6868 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6877 * disable useless stuff for benchmark
6882 restore_disable
= 1;
6883 potfile_disable
= 1;
6884 weak_hash_threshold
= 0;
6885 gpu_temp_disable
= 1;
6887 data
.status_timer
= status_timer
;
6888 data
.restore_timer
= restore_timer
;
6889 data
.restore_disable
= restore_disable
;
6892 * force attack mode to be bruteforce
6895 attack_mode
= ATTACK_MODE_BF
;
6896 attack_kern
= ATTACK_KERN_BF
;
6898 if (workload_profile_chgd
== 0)
6900 workload_profile
= 3;
6902 data
.workload_profile
= workload_profile
;
6912 uint attack_exec
= 0;
6916 uint esalt_size
= 0;
6918 uint dgst_pos0
= -1;
6919 uint dgst_pos1
= -1;
6920 uint dgst_pos2
= -1;
6921 uint dgst_pos3
= -1;
6923 int (*parse_func
) (char *, uint
, hash_t
*);
6924 int (*sort_by_digest
) (const void *, const void *);
6926 uint algorithm_pos
= 0;
6927 uint algorithm_max
= 1;
6929 uint
*algorithms
= default_benchmark_algorithms
;
6931 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6933 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6936 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6937 * the following algos are skipped entirely
6940 if (algorithm_pos
> 0)
6944 rd
= init_restore (argc
, argv
);
6950 * update hash_mode in case of multihash benchmark
6955 if (hash_mode_chgd
== 0)
6957 hash_mode
= algorithms
[algorithm_pos
];
6959 data
.hash_mode
= hash_mode
;
6969 case 0: hash_type
= HASH_TYPE_MD5
;
6970 salt_type
= SALT_TYPE_NONE
;
6971 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6972 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6973 | OPTS_TYPE_PT_ADD80
6974 | OPTS_TYPE_PT_ADDBITS14
;
6975 kern_type
= KERN_TYPE_MD5
;
6976 dgst_size
= DGST_SIZE_4_4
;
6977 parse_func
= md5_parse_hash
;
6978 sort_by_digest
= sort_by_digest_4_4
;
6979 opti_type
= OPTI_TYPE_ZERO_BYTE
6980 | OPTI_TYPE_PRECOMPUTE_INIT
6981 | OPTI_TYPE_PRECOMPUTE_MERKLE
6982 | OPTI_TYPE_MEET_IN_MIDDLE
6983 | OPTI_TYPE_EARLY_SKIP
6984 | OPTI_TYPE_NOT_ITERATED
6985 | OPTI_TYPE_NOT_SALTED
6986 | OPTI_TYPE_RAW_HASH
;
6993 case 10: hash_type
= HASH_TYPE_MD5
;
6994 salt_type
= SALT_TYPE_INTERN
;
6995 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6996 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6997 | OPTS_TYPE_ST_ADD80
6998 | OPTS_TYPE_ST_ADDBITS14
;
6999 kern_type
= KERN_TYPE_MD5_PWSLT
;
7000 dgst_size
= DGST_SIZE_4_4
;
7001 parse_func
= md5s_parse_hash
;
7002 sort_by_digest
= sort_by_digest_4_4
;
7003 opti_type
= OPTI_TYPE_ZERO_BYTE
7004 | OPTI_TYPE_PRECOMPUTE_INIT
7005 | OPTI_TYPE_PRECOMPUTE_MERKLE
7006 | OPTI_TYPE_MEET_IN_MIDDLE
7007 | OPTI_TYPE_EARLY_SKIP
7008 | OPTI_TYPE_NOT_ITERATED
7009 | OPTI_TYPE_APPENDED_SALT
7010 | OPTI_TYPE_RAW_HASH
;
7017 case 11: hash_type
= HASH_TYPE_MD5
;
7018 salt_type
= SALT_TYPE_INTERN
;
7019 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7020 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7021 | OPTS_TYPE_ST_ADD80
7022 | OPTS_TYPE_ST_ADDBITS14
;
7023 kern_type
= KERN_TYPE_MD5_PWSLT
;
7024 dgst_size
= DGST_SIZE_4_4
;
7025 parse_func
= joomla_parse_hash
;
7026 sort_by_digest
= sort_by_digest_4_4
;
7027 opti_type
= OPTI_TYPE_ZERO_BYTE
7028 | OPTI_TYPE_PRECOMPUTE_INIT
7029 | OPTI_TYPE_PRECOMPUTE_MERKLE
7030 | OPTI_TYPE_MEET_IN_MIDDLE
7031 | OPTI_TYPE_EARLY_SKIP
7032 | OPTI_TYPE_NOT_ITERATED
7033 | OPTI_TYPE_APPENDED_SALT
7034 | OPTI_TYPE_RAW_HASH
;
7041 case 12: hash_type
= HASH_TYPE_MD5
;
7042 salt_type
= SALT_TYPE_INTERN
;
7043 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7045 | OPTS_TYPE_ST_ADD80
7046 | OPTS_TYPE_ST_ADDBITS14
;
7047 kern_type
= KERN_TYPE_MD5_PWSLT
;
7048 dgst_size
= DGST_SIZE_4_4
;
7049 parse_func
= postgresql_parse_hash
;
7050 sort_by_digest
= sort_by_digest_4_4
;
7051 opti_type
= OPTI_TYPE_ZERO_BYTE
7052 | OPTI_TYPE_PRECOMPUTE_INIT
7053 | OPTI_TYPE_PRECOMPUTE_MERKLE
7054 | OPTI_TYPE_MEET_IN_MIDDLE
7055 | OPTI_TYPE_EARLY_SKIP
7056 | OPTI_TYPE_NOT_ITERATED
7057 | OPTI_TYPE_APPENDED_SALT
7058 | OPTI_TYPE_RAW_HASH
;
7065 case 20: hash_type
= HASH_TYPE_MD5
;
7066 salt_type
= SALT_TYPE_INTERN
;
7067 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7069 | OPTS_TYPE_PT_ADD80
7070 | OPTS_TYPE_PT_ADDBITS14
;
7071 kern_type
= KERN_TYPE_MD5_SLTPW
;
7072 dgst_size
= DGST_SIZE_4_4
;
7073 parse_func
= md5s_parse_hash
;
7074 sort_by_digest
= sort_by_digest_4_4
;
7075 opti_type
= OPTI_TYPE_ZERO_BYTE
7076 | OPTI_TYPE_PRECOMPUTE_INIT
7077 | OPTI_TYPE_PRECOMPUTE_MERKLE
7078 | OPTI_TYPE_EARLY_SKIP
7079 | OPTI_TYPE_NOT_ITERATED
7080 | OPTI_TYPE_PREPENDED_SALT
7081 | OPTI_TYPE_RAW_HASH
;
7088 case 21: hash_type
= HASH_TYPE_MD5
;
7089 salt_type
= SALT_TYPE_INTERN
;
7090 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7092 | OPTS_TYPE_PT_ADD80
7093 | OPTS_TYPE_PT_ADDBITS14
;
7094 kern_type
= KERN_TYPE_MD5_SLTPW
;
7095 dgst_size
= DGST_SIZE_4_4
;
7096 parse_func
= osc_parse_hash
;
7097 sort_by_digest
= sort_by_digest_4_4
;
7098 opti_type
= OPTI_TYPE_ZERO_BYTE
7099 | OPTI_TYPE_PRECOMPUTE_INIT
7100 | OPTI_TYPE_PRECOMPUTE_MERKLE
7101 | OPTI_TYPE_EARLY_SKIP
7102 | OPTI_TYPE_NOT_ITERATED
7103 | OPTI_TYPE_PREPENDED_SALT
7104 | OPTI_TYPE_RAW_HASH
;
7111 case 22: hash_type
= HASH_TYPE_MD5
;
7112 salt_type
= SALT_TYPE_EMBEDDED
;
7113 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7115 | OPTS_TYPE_PT_ADD80
7116 | OPTS_TYPE_PT_ADDBITS14
;
7117 kern_type
= KERN_TYPE_MD5_SLTPW
;
7118 dgst_size
= DGST_SIZE_4_4
;
7119 parse_func
= netscreen_parse_hash
;
7120 sort_by_digest
= sort_by_digest_4_4
;
7121 opti_type
= OPTI_TYPE_ZERO_BYTE
7122 | OPTI_TYPE_PRECOMPUTE_INIT
7123 | OPTI_TYPE_PRECOMPUTE_MERKLE
7124 | OPTI_TYPE_EARLY_SKIP
7125 | OPTI_TYPE_NOT_ITERATED
7126 | OPTI_TYPE_PREPENDED_SALT
7127 | OPTI_TYPE_RAW_HASH
;
7134 case 23: hash_type
= HASH_TYPE_MD5
;
7135 salt_type
= SALT_TYPE_EMBEDDED
;
7136 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7137 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7138 | OPTS_TYPE_PT_ADD80
7139 | OPTS_TYPE_PT_ADDBITS14
;
7140 kern_type
= KERN_TYPE_MD5_SLTPW
;
7141 dgst_size
= DGST_SIZE_4_4
;
7142 parse_func
= skype_parse_hash
;
7143 sort_by_digest
= sort_by_digest_4_4
;
7144 opti_type
= OPTI_TYPE_ZERO_BYTE
7145 | OPTI_TYPE_PRECOMPUTE_INIT
7146 | OPTI_TYPE_PRECOMPUTE_MERKLE
7147 | OPTI_TYPE_EARLY_SKIP
7148 | OPTI_TYPE_NOT_ITERATED
7149 | OPTI_TYPE_PREPENDED_SALT
7150 | OPTI_TYPE_RAW_HASH
;
7157 case 30: hash_type
= HASH_TYPE_MD5
;
7158 salt_type
= SALT_TYPE_INTERN
;
7159 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7160 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7161 | OPTS_TYPE_PT_UNICODE
7162 | OPTS_TYPE_ST_ADD80
7163 | OPTS_TYPE_ST_ADDBITS14
;
7164 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7165 dgst_size
= DGST_SIZE_4_4
;
7166 parse_func
= md5s_parse_hash
;
7167 sort_by_digest
= sort_by_digest_4_4
;
7168 opti_type
= OPTI_TYPE_ZERO_BYTE
7169 | OPTI_TYPE_PRECOMPUTE_INIT
7170 | OPTI_TYPE_PRECOMPUTE_MERKLE
7171 | OPTI_TYPE_MEET_IN_MIDDLE
7172 | OPTI_TYPE_EARLY_SKIP
7173 | OPTI_TYPE_NOT_ITERATED
7174 | OPTI_TYPE_APPENDED_SALT
7175 | OPTI_TYPE_RAW_HASH
;
7182 case 40: hash_type
= HASH_TYPE_MD5
;
7183 salt_type
= SALT_TYPE_INTERN
;
7184 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7185 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7186 | OPTS_TYPE_PT_ADD80
7187 | OPTS_TYPE_PT_ADDBITS14
7188 | OPTS_TYPE_PT_UNICODE
;
7189 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7190 dgst_size
= DGST_SIZE_4_4
;
7191 parse_func
= md5s_parse_hash
;
7192 sort_by_digest
= sort_by_digest_4_4
;
7193 opti_type
= OPTI_TYPE_ZERO_BYTE
7194 | OPTI_TYPE_PRECOMPUTE_INIT
7195 | OPTI_TYPE_PRECOMPUTE_MERKLE
7196 | OPTI_TYPE_EARLY_SKIP
7197 | OPTI_TYPE_NOT_ITERATED
7198 | OPTI_TYPE_PREPENDED_SALT
7199 | OPTI_TYPE_RAW_HASH
;
7206 case 50: hash_type
= HASH_TYPE_MD5
;
7207 salt_type
= SALT_TYPE_INTERN
;
7208 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7210 | OPTS_TYPE_ST_ADD80
7211 | OPTS_TYPE_ST_ADDBITS14
;
7212 kern_type
= KERN_TYPE_HMACMD5_PW
;
7213 dgst_size
= DGST_SIZE_4_4
;
7214 parse_func
= hmacmd5_parse_hash
;
7215 sort_by_digest
= sort_by_digest_4_4
;
7216 opti_type
= OPTI_TYPE_ZERO_BYTE
7217 | OPTI_TYPE_NOT_ITERATED
;
7224 case 60: hash_type
= HASH_TYPE_MD5
;
7225 salt_type
= SALT_TYPE_INTERN
;
7226 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7227 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7228 | OPTS_TYPE_PT_ADD80
7229 | OPTS_TYPE_PT_ADDBITS14
;
7230 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7231 dgst_size
= DGST_SIZE_4_4
;
7232 parse_func
= hmacmd5_parse_hash
;
7233 sort_by_digest
= sort_by_digest_4_4
;
7234 opti_type
= OPTI_TYPE_ZERO_BYTE
7235 | OPTI_TYPE_NOT_ITERATED
;
7242 case 100: hash_type
= HASH_TYPE_SHA1
;
7243 salt_type
= SALT_TYPE_NONE
;
7244 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7245 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7246 | OPTS_TYPE_PT_ADD80
7247 | OPTS_TYPE_PT_ADDBITS15
;
7248 kern_type
= KERN_TYPE_SHA1
;
7249 dgst_size
= DGST_SIZE_4_5
;
7250 parse_func
= sha1_parse_hash
;
7251 sort_by_digest
= sort_by_digest_4_5
;
7252 opti_type
= OPTI_TYPE_ZERO_BYTE
7253 | OPTI_TYPE_PRECOMPUTE_INIT
7254 | OPTI_TYPE_PRECOMPUTE_MERKLE
7255 | OPTI_TYPE_EARLY_SKIP
7256 | OPTI_TYPE_NOT_ITERATED
7257 | OPTI_TYPE_NOT_SALTED
7258 | OPTI_TYPE_RAW_HASH
;
7265 case 101: hash_type
= HASH_TYPE_SHA1
;
7266 salt_type
= SALT_TYPE_NONE
;
7267 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7268 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7269 | OPTS_TYPE_PT_ADD80
7270 | OPTS_TYPE_PT_ADDBITS15
;
7271 kern_type
= KERN_TYPE_SHA1
;
7272 dgst_size
= DGST_SIZE_4_5
;
7273 parse_func
= sha1b64_parse_hash
;
7274 sort_by_digest
= sort_by_digest_4_5
;
7275 opti_type
= OPTI_TYPE_ZERO_BYTE
7276 | OPTI_TYPE_PRECOMPUTE_INIT
7277 | OPTI_TYPE_PRECOMPUTE_MERKLE
7278 | OPTI_TYPE_EARLY_SKIP
7279 | OPTI_TYPE_NOT_ITERATED
7280 | OPTI_TYPE_NOT_SALTED
7281 | OPTI_TYPE_RAW_HASH
;
7288 case 110: hash_type
= HASH_TYPE_SHA1
;
7289 salt_type
= SALT_TYPE_INTERN
;
7290 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7291 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7292 | OPTS_TYPE_ST_ADD80
7293 | OPTS_TYPE_ST_ADDBITS15
;
7294 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7295 dgst_size
= DGST_SIZE_4_5
;
7296 parse_func
= sha1s_parse_hash
;
7297 sort_by_digest
= sort_by_digest_4_5
;
7298 opti_type
= OPTI_TYPE_ZERO_BYTE
7299 | OPTI_TYPE_PRECOMPUTE_INIT
7300 | OPTI_TYPE_PRECOMPUTE_MERKLE
7301 | OPTI_TYPE_EARLY_SKIP
7302 | OPTI_TYPE_NOT_ITERATED
7303 | OPTI_TYPE_APPENDED_SALT
7304 | OPTI_TYPE_RAW_HASH
;
7311 case 111: hash_type
= HASH_TYPE_SHA1
;
7312 salt_type
= SALT_TYPE_EMBEDDED
;
7313 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7314 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7315 | OPTS_TYPE_ST_ADD80
7316 | OPTS_TYPE_ST_ADDBITS15
;
7317 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7318 dgst_size
= DGST_SIZE_4_5
;
7319 parse_func
= sha1b64s_parse_hash
;
7320 sort_by_digest
= sort_by_digest_4_5
;
7321 opti_type
= OPTI_TYPE_ZERO_BYTE
7322 | OPTI_TYPE_PRECOMPUTE_INIT
7323 | OPTI_TYPE_PRECOMPUTE_MERKLE
7324 | OPTI_TYPE_EARLY_SKIP
7325 | OPTI_TYPE_NOT_ITERATED
7326 | OPTI_TYPE_APPENDED_SALT
7327 | OPTI_TYPE_RAW_HASH
;
7334 case 112: hash_type
= HASH_TYPE_SHA1
;
7335 salt_type
= SALT_TYPE_INTERN
;
7336 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7337 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7338 | OPTS_TYPE_ST_ADD80
7339 | OPTS_TYPE_ST_ADDBITS15
7341 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7342 dgst_size
= DGST_SIZE_4_5
;
7343 parse_func
= oracles_parse_hash
;
7344 sort_by_digest
= sort_by_digest_4_5
;
7345 opti_type
= OPTI_TYPE_ZERO_BYTE
7346 | OPTI_TYPE_PRECOMPUTE_INIT
7347 | OPTI_TYPE_PRECOMPUTE_MERKLE
7348 | OPTI_TYPE_EARLY_SKIP
7349 | OPTI_TYPE_NOT_ITERATED
7350 | OPTI_TYPE_APPENDED_SALT
7351 | OPTI_TYPE_RAW_HASH
;
7358 case 120: hash_type
= HASH_TYPE_SHA1
;
7359 salt_type
= SALT_TYPE_INTERN
;
7360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7361 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7362 | OPTS_TYPE_PT_ADD80
7363 | OPTS_TYPE_PT_ADDBITS15
;
7364 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7365 dgst_size
= DGST_SIZE_4_5
;
7366 parse_func
= sha1s_parse_hash
;
7367 sort_by_digest
= sort_by_digest_4_5
;
7368 opti_type
= OPTI_TYPE_ZERO_BYTE
7369 | OPTI_TYPE_PRECOMPUTE_INIT
7370 | OPTI_TYPE_PRECOMPUTE_MERKLE
7371 | OPTI_TYPE_EARLY_SKIP
7372 | OPTI_TYPE_NOT_ITERATED
7373 | OPTI_TYPE_PREPENDED_SALT
7374 | OPTI_TYPE_RAW_HASH
;
7381 case 121: hash_type
= HASH_TYPE_SHA1
;
7382 salt_type
= SALT_TYPE_INTERN
;
7383 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7384 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7385 | OPTS_TYPE_PT_ADD80
7386 | OPTS_TYPE_PT_ADDBITS15
7387 | OPTS_TYPE_ST_LOWER
;
7388 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7389 dgst_size
= DGST_SIZE_4_5
;
7390 parse_func
= smf_parse_hash
;
7391 sort_by_digest
= sort_by_digest_4_5
;
7392 opti_type
= OPTI_TYPE_ZERO_BYTE
7393 | OPTI_TYPE_PRECOMPUTE_INIT
7394 | OPTI_TYPE_PRECOMPUTE_MERKLE
7395 | OPTI_TYPE_EARLY_SKIP
7396 | OPTI_TYPE_NOT_ITERATED
7397 | OPTI_TYPE_PREPENDED_SALT
7398 | OPTI_TYPE_RAW_HASH
;
7405 case 122: hash_type
= HASH_TYPE_SHA1
;
7406 salt_type
= SALT_TYPE_EMBEDDED
;
7407 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7408 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7409 | OPTS_TYPE_PT_ADD80
7410 | OPTS_TYPE_PT_ADDBITS15
7412 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7413 dgst_size
= DGST_SIZE_4_5
;
7414 parse_func
= osx1_parse_hash
;
7415 sort_by_digest
= sort_by_digest_4_5
;
7416 opti_type
= OPTI_TYPE_ZERO_BYTE
7417 | OPTI_TYPE_PRECOMPUTE_INIT
7418 | OPTI_TYPE_PRECOMPUTE_MERKLE
7419 | OPTI_TYPE_EARLY_SKIP
7420 | OPTI_TYPE_NOT_ITERATED
7421 | OPTI_TYPE_PREPENDED_SALT
7422 | OPTI_TYPE_RAW_HASH
;
7429 case 124: hash_type
= HASH_TYPE_SHA1
;
7430 salt_type
= SALT_TYPE_EMBEDDED
;
7431 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7432 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7433 | OPTS_TYPE_PT_ADD80
7434 | OPTS_TYPE_PT_ADDBITS15
;
7435 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7436 dgst_size
= DGST_SIZE_4_5
;
7437 parse_func
= djangosha1_parse_hash
;
7438 sort_by_digest
= sort_by_digest_4_5
;
7439 opti_type
= OPTI_TYPE_ZERO_BYTE
7440 | OPTI_TYPE_PRECOMPUTE_INIT
7441 | OPTI_TYPE_PRECOMPUTE_MERKLE
7442 | OPTI_TYPE_EARLY_SKIP
7443 | OPTI_TYPE_NOT_ITERATED
7444 | OPTI_TYPE_PREPENDED_SALT
7445 | OPTI_TYPE_RAW_HASH
;
7452 case 125: hash_type
= HASH_TYPE_SHA1
;
7453 salt_type
= SALT_TYPE_EMBEDDED
;
7454 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7455 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7456 | OPTS_TYPE_PT_ADD80
7457 | OPTS_TYPE_PT_ADDBITS15
7459 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7460 dgst_size
= DGST_SIZE_4_5
;
7461 parse_func
= arubaos_parse_hash
;
7462 sort_by_digest
= sort_by_digest_4_5
;
7463 opti_type
= OPTI_TYPE_ZERO_BYTE
7464 | OPTI_TYPE_PRECOMPUTE_INIT
7465 | OPTI_TYPE_PRECOMPUTE_MERKLE
7466 | OPTI_TYPE_EARLY_SKIP
7467 | OPTI_TYPE_NOT_ITERATED
7468 | OPTI_TYPE_PREPENDED_SALT
7469 | OPTI_TYPE_RAW_HASH
;
7476 case 130: hash_type
= HASH_TYPE_SHA1
;
7477 salt_type
= SALT_TYPE_INTERN
;
7478 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7479 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7480 | OPTS_TYPE_PT_UNICODE
7481 | OPTS_TYPE_ST_ADD80
7482 | OPTS_TYPE_ST_ADDBITS15
;
7483 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7484 dgst_size
= DGST_SIZE_4_5
;
7485 parse_func
= sha1s_parse_hash
;
7486 sort_by_digest
= sort_by_digest_4_5
;
7487 opti_type
= OPTI_TYPE_ZERO_BYTE
7488 | OPTI_TYPE_PRECOMPUTE_INIT
7489 | OPTI_TYPE_PRECOMPUTE_MERKLE
7490 | OPTI_TYPE_EARLY_SKIP
7491 | OPTI_TYPE_NOT_ITERATED
7492 | OPTI_TYPE_APPENDED_SALT
7493 | OPTI_TYPE_RAW_HASH
;
7500 case 131: hash_type
= HASH_TYPE_SHA1
;
7501 salt_type
= SALT_TYPE_EMBEDDED
;
7502 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7503 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7504 | OPTS_TYPE_PT_UNICODE
7505 | OPTS_TYPE_PT_UPPER
7506 | OPTS_TYPE_ST_ADD80
7507 | OPTS_TYPE_ST_ADDBITS15
7509 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7510 dgst_size
= DGST_SIZE_4_5
;
7511 parse_func
= mssql2000_parse_hash
;
7512 sort_by_digest
= sort_by_digest_4_5
;
7513 opti_type
= OPTI_TYPE_ZERO_BYTE
7514 | OPTI_TYPE_PRECOMPUTE_INIT
7515 | OPTI_TYPE_PRECOMPUTE_MERKLE
7516 | OPTI_TYPE_EARLY_SKIP
7517 | OPTI_TYPE_NOT_ITERATED
7518 | OPTI_TYPE_APPENDED_SALT
7519 | OPTI_TYPE_RAW_HASH
;
7526 case 132: hash_type
= HASH_TYPE_SHA1
;
7527 salt_type
= SALT_TYPE_EMBEDDED
;
7528 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7529 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7530 | OPTS_TYPE_PT_UNICODE
7531 | OPTS_TYPE_ST_ADD80
7532 | OPTS_TYPE_ST_ADDBITS15
7534 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7535 dgst_size
= DGST_SIZE_4_5
;
7536 parse_func
= mssql2005_parse_hash
;
7537 sort_by_digest
= sort_by_digest_4_5
;
7538 opti_type
= OPTI_TYPE_ZERO_BYTE
7539 | OPTI_TYPE_PRECOMPUTE_INIT
7540 | OPTI_TYPE_PRECOMPUTE_MERKLE
7541 | OPTI_TYPE_EARLY_SKIP
7542 | OPTI_TYPE_NOT_ITERATED
7543 | OPTI_TYPE_APPENDED_SALT
7544 | OPTI_TYPE_RAW_HASH
;
7551 case 133: hash_type
= HASH_TYPE_SHA1
;
7552 salt_type
= SALT_TYPE_EMBEDDED
;
7553 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7554 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7555 | OPTS_TYPE_PT_UNICODE
7556 | OPTS_TYPE_ST_ADD80
7557 | OPTS_TYPE_ST_ADDBITS15
;
7558 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7559 dgst_size
= DGST_SIZE_4_5
;
7560 parse_func
= peoplesoft_parse_hash
;
7561 sort_by_digest
= sort_by_digest_4_5
;
7562 opti_type
= OPTI_TYPE_ZERO_BYTE
7563 | OPTI_TYPE_PRECOMPUTE_INIT
7564 | OPTI_TYPE_PRECOMPUTE_MERKLE
7565 | OPTI_TYPE_EARLY_SKIP
7566 | OPTI_TYPE_NOT_ITERATED
7567 | OPTI_TYPE_APPENDED_SALT
7568 | OPTI_TYPE_RAW_HASH
;
7575 case 140: hash_type
= HASH_TYPE_SHA1
;
7576 salt_type
= SALT_TYPE_INTERN
;
7577 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7578 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7579 | OPTS_TYPE_PT_ADD80
7580 | OPTS_TYPE_PT_ADDBITS15
7581 | OPTS_TYPE_PT_UNICODE
;
7582 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7583 dgst_size
= DGST_SIZE_4_5
;
7584 parse_func
= sha1s_parse_hash
;
7585 sort_by_digest
= sort_by_digest_4_5
;
7586 opti_type
= OPTI_TYPE_ZERO_BYTE
7587 | OPTI_TYPE_PRECOMPUTE_INIT
7588 | OPTI_TYPE_PRECOMPUTE_MERKLE
7589 | OPTI_TYPE_EARLY_SKIP
7590 | OPTI_TYPE_NOT_ITERATED
7591 | OPTI_TYPE_PREPENDED_SALT
7592 | OPTI_TYPE_RAW_HASH
;
7599 case 141: hash_type
= HASH_TYPE_SHA1
;
7600 salt_type
= SALT_TYPE_EMBEDDED
;
7601 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7602 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7603 | OPTS_TYPE_PT_ADD80
7604 | OPTS_TYPE_PT_ADDBITS15
7605 | OPTS_TYPE_PT_UNICODE
7606 | OPTS_TYPE_ST_BASE64
;
7607 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7608 dgst_size
= DGST_SIZE_4_5
;
7609 parse_func
= episerver_parse_hash
;
7610 sort_by_digest
= sort_by_digest_4_5
;
7611 opti_type
= OPTI_TYPE_ZERO_BYTE
7612 | OPTI_TYPE_PRECOMPUTE_INIT
7613 | OPTI_TYPE_PRECOMPUTE_MERKLE
7614 | OPTI_TYPE_EARLY_SKIP
7615 | OPTI_TYPE_NOT_ITERATED
7616 | OPTI_TYPE_PREPENDED_SALT
7617 | OPTI_TYPE_RAW_HASH
;
7624 case 150: hash_type
= HASH_TYPE_SHA1
;
7625 salt_type
= SALT_TYPE_INTERN
;
7626 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7627 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7628 | OPTS_TYPE_ST_ADD80
7629 | OPTS_TYPE_ST_ADDBITS15
;
7630 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7631 dgst_size
= DGST_SIZE_4_5
;
7632 parse_func
= hmacsha1_parse_hash
;
7633 sort_by_digest
= sort_by_digest_4_5
;
7634 opti_type
= OPTI_TYPE_ZERO_BYTE
7635 | OPTI_TYPE_NOT_ITERATED
;
7642 case 160: hash_type
= HASH_TYPE_SHA1
;
7643 salt_type
= SALT_TYPE_INTERN
;
7644 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7645 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7646 | OPTS_TYPE_PT_ADD80
7647 | OPTS_TYPE_PT_ADDBITS15
;
7648 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7649 dgst_size
= DGST_SIZE_4_5
;
7650 parse_func
= hmacsha1_parse_hash
;
7651 sort_by_digest
= sort_by_digest_4_5
;
7652 opti_type
= OPTI_TYPE_ZERO_BYTE
7653 | OPTI_TYPE_NOT_ITERATED
;
7660 case 190: hash_type
= HASH_TYPE_SHA1
;
7661 salt_type
= SALT_TYPE_NONE
;
7662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7663 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7664 | OPTS_TYPE_PT_ADD80
7665 | OPTS_TYPE_PT_ADDBITS15
;
7666 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7667 dgst_size
= DGST_SIZE_4_5
;
7668 parse_func
= sha1linkedin_parse_hash
;
7669 sort_by_digest
= sort_by_digest_4_5
;
7670 opti_type
= OPTI_TYPE_ZERO_BYTE
7671 | OPTI_TYPE_PRECOMPUTE_INIT
7672 | OPTI_TYPE_EARLY_SKIP
7673 | OPTI_TYPE_NOT_ITERATED
7674 | OPTI_TYPE_NOT_SALTED
;
7681 case 200: hash_type
= HASH_TYPE_MYSQL
;
7682 salt_type
= SALT_TYPE_NONE
;
7683 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7685 kern_type
= KERN_TYPE_MYSQL
;
7686 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7687 parse_func
= mysql323_parse_hash
;
7688 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7689 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7696 case 300: hash_type
= HASH_TYPE_SHA1
;
7697 salt_type
= SALT_TYPE_NONE
;
7698 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7699 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7700 | OPTS_TYPE_PT_ADD80
7701 | OPTS_TYPE_PT_ADDBITS15
;
7702 kern_type
= KERN_TYPE_MYSQL41
;
7703 dgst_size
= DGST_SIZE_4_5
;
7704 parse_func
= sha1_parse_hash
;
7705 sort_by_digest
= sort_by_digest_4_5
;
7706 opti_type
= OPTI_TYPE_ZERO_BYTE
7707 | OPTI_TYPE_PRECOMPUTE_INIT
7708 | OPTI_TYPE_PRECOMPUTE_MERKLE
7709 | OPTI_TYPE_EARLY_SKIP
7710 | OPTI_TYPE_NOT_ITERATED
7711 | OPTI_TYPE_NOT_SALTED
;
7718 case 400: hash_type
= HASH_TYPE_MD5
;
7719 salt_type
= SALT_TYPE_EMBEDDED
;
7720 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7721 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7722 kern_type
= KERN_TYPE_PHPASS
;
7723 dgst_size
= DGST_SIZE_4_4
;
7724 parse_func
= phpass_parse_hash
;
7725 sort_by_digest
= sort_by_digest_4_4
;
7726 opti_type
= OPTI_TYPE_ZERO_BYTE
7727 | OPTI_TYPE_SLOW_HASH_SIMD
;
7734 case 500: hash_type
= HASH_TYPE_MD5
;
7735 salt_type
= SALT_TYPE_EMBEDDED
;
7736 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7737 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7738 kern_type
= KERN_TYPE_MD5CRYPT
;
7739 dgst_size
= DGST_SIZE_4_4
;
7740 parse_func
= md5crypt_parse_hash
;
7741 sort_by_digest
= sort_by_digest_4_4
;
7742 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7749 case 501: hash_type
= HASH_TYPE_MD5
;
7750 salt_type
= SALT_TYPE_EMBEDDED
;
7751 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7752 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7753 | OPTS_TYPE_HASH_COPY
;
7754 kern_type
= KERN_TYPE_MD5CRYPT
;
7755 dgst_size
= DGST_SIZE_4_4
;
7756 parse_func
= juniper_parse_hash
;
7757 sort_by_digest
= sort_by_digest_4_4
;
7758 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7765 case 900: hash_type
= HASH_TYPE_MD4
;
7766 salt_type
= SALT_TYPE_NONE
;
7767 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7768 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7769 | OPTS_TYPE_PT_ADD80
7770 | OPTS_TYPE_PT_ADDBITS14
;
7771 kern_type
= KERN_TYPE_MD4
;
7772 dgst_size
= DGST_SIZE_4_4
;
7773 parse_func
= md4_parse_hash
;
7774 sort_by_digest
= sort_by_digest_4_4
;
7775 opti_type
= OPTI_TYPE_ZERO_BYTE
7776 | OPTI_TYPE_PRECOMPUTE_INIT
7777 | OPTI_TYPE_PRECOMPUTE_MERKLE
7778 | OPTI_TYPE_MEET_IN_MIDDLE
7779 | OPTI_TYPE_EARLY_SKIP
7780 | OPTI_TYPE_NOT_ITERATED
7781 | OPTI_TYPE_NOT_SALTED
7782 | OPTI_TYPE_RAW_HASH
;
7789 case 1000: hash_type
= HASH_TYPE_MD4
;
7790 salt_type
= SALT_TYPE_NONE
;
7791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7793 | OPTS_TYPE_PT_ADD80
7794 | OPTS_TYPE_PT_ADDBITS14
7795 | OPTS_TYPE_PT_UNICODE
;
7796 kern_type
= KERN_TYPE_MD4_PWU
;
7797 dgst_size
= DGST_SIZE_4_4
;
7798 parse_func
= md4_parse_hash
;
7799 sort_by_digest
= sort_by_digest_4_4
;
7800 opti_type
= OPTI_TYPE_ZERO_BYTE
7801 | OPTI_TYPE_PRECOMPUTE_INIT
7802 | OPTI_TYPE_PRECOMPUTE_MERKLE
7803 | OPTI_TYPE_MEET_IN_MIDDLE
7804 | OPTI_TYPE_EARLY_SKIP
7805 | OPTI_TYPE_NOT_ITERATED
7806 | OPTI_TYPE_NOT_SALTED
7807 | OPTI_TYPE_RAW_HASH
;
7814 case 1100: hash_type
= HASH_TYPE_MD4
;
7815 salt_type
= SALT_TYPE_INTERN
;
7816 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7817 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7818 | OPTS_TYPE_PT_ADD80
7819 | OPTS_TYPE_PT_ADDBITS14
7820 | OPTS_TYPE_PT_UNICODE
7821 | OPTS_TYPE_ST_ADD80
7822 | OPTS_TYPE_ST_UNICODE
7823 | OPTS_TYPE_ST_LOWER
;
7824 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7825 dgst_size
= DGST_SIZE_4_4
;
7826 parse_func
= dcc_parse_hash
;
7827 sort_by_digest
= sort_by_digest_4_4
;
7828 opti_type
= OPTI_TYPE_ZERO_BYTE
7829 | OPTI_TYPE_PRECOMPUTE_INIT
7830 | OPTI_TYPE_PRECOMPUTE_MERKLE
7831 | OPTI_TYPE_EARLY_SKIP
7832 | OPTI_TYPE_NOT_ITERATED
;
7839 case 1400: hash_type
= HASH_TYPE_SHA256
;
7840 salt_type
= SALT_TYPE_NONE
;
7841 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7842 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7843 | OPTS_TYPE_PT_ADD80
7844 | OPTS_TYPE_PT_ADDBITS15
;
7845 kern_type
= KERN_TYPE_SHA256
;
7846 dgst_size
= DGST_SIZE_4_8
;
7847 parse_func
= sha256_parse_hash
;
7848 sort_by_digest
= sort_by_digest_4_8
;
7849 opti_type
= OPTI_TYPE_ZERO_BYTE
7850 | OPTI_TYPE_PRECOMPUTE_INIT
7851 | OPTI_TYPE_PRECOMPUTE_MERKLE
7852 | OPTI_TYPE_EARLY_SKIP
7853 | OPTI_TYPE_NOT_ITERATED
7854 | OPTI_TYPE_NOT_SALTED
7855 | OPTI_TYPE_RAW_HASH
;
7862 case 1410: hash_type
= HASH_TYPE_SHA256
;
7863 salt_type
= SALT_TYPE_INTERN
;
7864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7865 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7866 | OPTS_TYPE_ST_ADD80
7867 | OPTS_TYPE_ST_ADDBITS15
;
7868 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7869 dgst_size
= DGST_SIZE_4_8
;
7870 parse_func
= sha256s_parse_hash
;
7871 sort_by_digest
= sort_by_digest_4_8
;
7872 opti_type
= OPTI_TYPE_ZERO_BYTE
7873 | OPTI_TYPE_PRECOMPUTE_INIT
7874 | OPTI_TYPE_PRECOMPUTE_MERKLE
7875 | OPTI_TYPE_EARLY_SKIP
7876 | OPTI_TYPE_NOT_ITERATED
7877 | OPTI_TYPE_APPENDED_SALT
7878 | OPTI_TYPE_RAW_HASH
;
7885 case 1420: hash_type
= HASH_TYPE_SHA256
;
7886 salt_type
= SALT_TYPE_INTERN
;
7887 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7888 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7889 | OPTS_TYPE_PT_ADD80
7890 | OPTS_TYPE_PT_ADDBITS15
;
7891 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7892 dgst_size
= DGST_SIZE_4_8
;
7893 parse_func
= sha256s_parse_hash
;
7894 sort_by_digest
= sort_by_digest_4_8
;
7895 opti_type
= OPTI_TYPE_ZERO_BYTE
7896 | OPTI_TYPE_PRECOMPUTE_INIT
7897 | OPTI_TYPE_PRECOMPUTE_MERKLE
7898 | OPTI_TYPE_EARLY_SKIP
7899 | OPTI_TYPE_NOT_ITERATED
7900 | OPTI_TYPE_PREPENDED_SALT
7901 | OPTI_TYPE_RAW_HASH
;
7908 case 1421: hash_type
= HASH_TYPE_SHA256
;
7909 salt_type
= SALT_TYPE_EMBEDDED
;
7910 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7911 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7912 | OPTS_TYPE_PT_ADD80
7913 | OPTS_TYPE_PT_ADDBITS15
;
7914 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7915 dgst_size
= DGST_SIZE_4_8
;
7916 parse_func
= hmailserver_parse_hash
;
7917 sort_by_digest
= sort_by_digest_4_8
;
7918 opti_type
= OPTI_TYPE_ZERO_BYTE
7919 | OPTI_TYPE_PRECOMPUTE_INIT
7920 | OPTI_TYPE_PRECOMPUTE_MERKLE
7921 | OPTI_TYPE_EARLY_SKIP
7922 | OPTI_TYPE_NOT_ITERATED
7923 | OPTI_TYPE_PREPENDED_SALT
7924 | OPTI_TYPE_RAW_HASH
;
7931 case 1430: hash_type
= HASH_TYPE_SHA256
;
7932 salt_type
= SALT_TYPE_INTERN
;
7933 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7934 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7935 | OPTS_TYPE_PT_UNICODE
7936 | OPTS_TYPE_ST_ADD80
7937 | OPTS_TYPE_ST_ADDBITS15
;
7938 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7939 dgst_size
= DGST_SIZE_4_8
;
7940 parse_func
= sha256s_parse_hash
;
7941 sort_by_digest
= sort_by_digest_4_8
;
7942 opti_type
= OPTI_TYPE_ZERO_BYTE
7943 | OPTI_TYPE_PRECOMPUTE_INIT
7944 | OPTI_TYPE_PRECOMPUTE_MERKLE
7945 | OPTI_TYPE_EARLY_SKIP
7946 | OPTI_TYPE_NOT_ITERATED
7947 | OPTI_TYPE_APPENDED_SALT
7948 | OPTI_TYPE_RAW_HASH
;
7955 case 1440: hash_type
= HASH_TYPE_SHA256
;
7956 salt_type
= SALT_TYPE_INTERN
;
7957 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7958 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7959 | OPTS_TYPE_PT_ADD80
7960 | OPTS_TYPE_PT_ADDBITS15
7961 | OPTS_TYPE_PT_UNICODE
;
7962 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7963 dgst_size
= DGST_SIZE_4_8
;
7964 parse_func
= sha256s_parse_hash
;
7965 sort_by_digest
= sort_by_digest_4_8
;
7966 opti_type
= OPTI_TYPE_ZERO_BYTE
7967 | OPTI_TYPE_PRECOMPUTE_INIT
7968 | OPTI_TYPE_PRECOMPUTE_MERKLE
7969 | OPTI_TYPE_EARLY_SKIP
7970 | OPTI_TYPE_NOT_ITERATED
7971 | OPTI_TYPE_PREPENDED_SALT
7972 | OPTI_TYPE_RAW_HASH
;
7979 case 1441: hash_type
= HASH_TYPE_SHA256
;
7980 salt_type
= SALT_TYPE_EMBEDDED
;
7981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7982 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7983 | OPTS_TYPE_PT_ADD80
7984 | OPTS_TYPE_PT_ADDBITS15
7985 | OPTS_TYPE_PT_UNICODE
7986 | OPTS_TYPE_ST_BASE64
;
7987 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7988 dgst_size
= DGST_SIZE_4_8
;
7989 parse_func
= episerver4_parse_hash
;
7990 sort_by_digest
= sort_by_digest_4_8
;
7991 opti_type
= OPTI_TYPE_ZERO_BYTE
7992 | OPTI_TYPE_PRECOMPUTE_INIT
7993 | OPTI_TYPE_PRECOMPUTE_MERKLE
7994 | OPTI_TYPE_EARLY_SKIP
7995 | OPTI_TYPE_NOT_ITERATED
7996 | OPTI_TYPE_PREPENDED_SALT
7997 | OPTI_TYPE_RAW_HASH
;
8004 case 1450: hash_type
= HASH_TYPE_SHA256
;
8005 salt_type
= SALT_TYPE_INTERN
;
8006 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8007 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8008 | OPTS_TYPE_ST_ADD80
;
8009 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8010 dgst_size
= DGST_SIZE_4_8
;
8011 parse_func
= hmacsha256_parse_hash
;
8012 sort_by_digest
= sort_by_digest_4_8
;
8013 opti_type
= OPTI_TYPE_ZERO_BYTE
8014 | OPTI_TYPE_NOT_ITERATED
;
8021 case 1460: hash_type
= HASH_TYPE_SHA256
;
8022 salt_type
= SALT_TYPE_INTERN
;
8023 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8024 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8025 | OPTS_TYPE_PT_ADD80
8026 | OPTS_TYPE_PT_ADDBITS15
;
8027 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8028 dgst_size
= DGST_SIZE_4_8
;
8029 parse_func
= hmacsha256_parse_hash
;
8030 sort_by_digest
= sort_by_digest_4_8
;
8031 opti_type
= OPTI_TYPE_ZERO_BYTE
8032 | OPTI_TYPE_NOT_ITERATED
;
8039 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8040 salt_type
= SALT_TYPE_EMBEDDED
;
8041 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8042 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8043 | OPTS_TYPE_PT_BITSLICE
;
8044 kern_type
= KERN_TYPE_DESCRYPT
;
8045 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8046 parse_func
= descrypt_parse_hash
;
8047 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8048 opti_type
= OPTI_TYPE_ZERO_BYTE
8049 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8056 case 1600: hash_type
= HASH_TYPE_MD5
;
8057 salt_type
= SALT_TYPE_EMBEDDED
;
8058 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8059 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8060 kern_type
= KERN_TYPE_APR1CRYPT
;
8061 dgst_size
= DGST_SIZE_4_4
;
8062 parse_func
= md5apr1_parse_hash
;
8063 sort_by_digest
= sort_by_digest_4_4
;
8064 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8071 case 1700: hash_type
= HASH_TYPE_SHA512
;
8072 salt_type
= SALT_TYPE_NONE
;
8073 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8074 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8075 | OPTS_TYPE_PT_ADD80
8076 | OPTS_TYPE_PT_ADDBITS15
;
8077 kern_type
= KERN_TYPE_SHA512
;
8078 dgst_size
= DGST_SIZE_8_8
;
8079 parse_func
= sha512_parse_hash
;
8080 sort_by_digest
= sort_by_digest_8_8
;
8081 opti_type
= OPTI_TYPE_ZERO_BYTE
8082 | OPTI_TYPE_PRECOMPUTE_INIT
8083 | OPTI_TYPE_PRECOMPUTE_MERKLE
8084 | OPTI_TYPE_EARLY_SKIP
8085 | OPTI_TYPE_NOT_ITERATED
8086 | OPTI_TYPE_NOT_SALTED
8087 | OPTI_TYPE_USES_BITS_64
8088 | OPTI_TYPE_RAW_HASH
;
8095 case 1710: hash_type
= HASH_TYPE_SHA512
;
8096 salt_type
= SALT_TYPE_INTERN
;
8097 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8098 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8099 | OPTS_TYPE_ST_ADD80
8100 | OPTS_TYPE_ST_ADDBITS15
;
8101 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8102 dgst_size
= DGST_SIZE_8_8
;
8103 parse_func
= sha512s_parse_hash
;
8104 sort_by_digest
= sort_by_digest_8_8
;
8105 opti_type
= OPTI_TYPE_ZERO_BYTE
8106 | OPTI_TYPE_PRECOMPUTE_INIT
8107 | OPTI_TYPE_PRECOMPUTE_MERKLE
8108 | OPTI_TYPE_EARLY_SKIP
8109 | OPTI_TYPE_NOT_ITERATED
8110 | OPTI_TYPE_APPENDED_SALT
8111 | OPTI_TYPE_USES_BITS_64
8112 | OPTI_TYPE_RAW_HASH
;
8119 case 1711: hash_type
= HASH_TYPE_SHA512
;
8120 salt_type
= SALT_TYPE_EMBEDDED
;
8121 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8122 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8123 | OPTS_TYPE_ST_ADD80
8124 | OPTS_TYPE_ST_ADDBITS15
;
8125 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8126 dgst_size
= DGST_SIZE_8_8
;
8127 parse_func
= sha512b64s_parse_hash
;
8128 sort_by_digest
= sort_by_digest_8_8
;
8129 opti_type
= OPTI_TYPE_ZERO_BYTE
8130 | OPTI_TYPE_PRECOMPUTE_INIT
8131 | OPTI_TYPE_PRECOMPUTE_MERKLE
8132 | OPTI_TYPE_EARLY_SKIP
8133 | OPTI_TYPE_NOT_ITERATED
8134 | OPTI_TYPE_APPENDED_SALT
8135 | OPTI_TYPE_USES_BITS_64
8136 | OPTI_TYPE_RAW_HASH
;
8143 case 1720: hash_type
= HASH_TYPE_SHA512
;
8144 salt_type
= SALT_TYPE_INTERN
;
8145 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8146 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8147 | OPTS_TYPE_PT_ADD80
8148 | OPTS_TYPE_PT_ADDBITS15
;
8149 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8150 dgst_size
= DGST_SIZE_8_8
;
8151 parse_func
= sha512s_parse_hash
;
8152 sort_by_digest
= sort_by_digest_8_8
;
8153 opti_type
= OPTI_TYPE_ZERO_BYTE
8154 | OPTI_TYPE_PRECOMPUTE_INIT
8155 | OPTI_TYPE_PRECOMPUTE_MERKLE
8156 | OPTI_TYPE_EARLY_SKIP
8157 | OPTI_TYPE_NOT_ITERATED
8158 | OPTI_TYPE_PREPENDED_SALT
8159 | OPTI_TYPE_USES_BITS_64
8160 | OPTI_TYPE_RAW_HASH
;
8167 case 1722: hash_type
= HASH_TYPE_SHA512
;
8168 salt_type
= SALT_TYPE_EMBEDDED
;
8169 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8170 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8171 | OPTS_TYPE_PT_ADD80
8172 | OPTS_TYPE_PT_ADDBITS15
8174 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8175 dgst_size
= DGST_SIZE_8_8
;
8176 parse_func
= osx512_parse_hash
;
8177 sort_by_digest
= sort_by_digest_8_8
;
8178 opti_type
= OPTI_TYPE_ZERO_BYTE
8179 | OPTI_TYPE_PRECOMPUTE_INIT
8180 | OPTI_TYPE_PRECOMPUTE_MERKLE
8181 | OPTI_TYPE_EARLY_SKIP
8182 | OPTI_TYPE_NOT_ITERATED
8183 | OPTI_TYPE_PREPENDED_SALT
8184 | OPTI_TYPE_USES_BITS_64
8185 | OPTI_TYPE_RAW_HASH
;
8192 case 1730: hash_type
= HASH_TYPE_SHA512
;
8193 salt_type
= SALT_TYPE_INTERN
;
8194 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8195 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8196 | OPTS_TYPE_PT_UNICODE
8197 | OPTS_TYPE_ST_ADD80
8198 | OPTS_TYPE_ST_ADDBITS15
;
8199 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8200 dgst_size
= DGST_SIZE_8_8
;
8201 parse_func
= sha512s_parse_hash
;
8202 sort_by_digest
= sort_by_digest_8_8
;
8203 opti_type
= OPTI_TYPE_ZERO_BYTE
8204 | OPTI_TYPE_PRECOMPUTE_INIT
8205 | OPTI_TYPE_PRECOMPUTE_MERKLE
8206 | OPTI_TYPE_EARLY_SKIP
8207 | OPTI_TYPE_NOT_ITERATED
8208 | OPTI_TYPE_APPENDED_SALT
8209 | OPTI_TYPE_USES_BITS_64
8210 | OPTI_TYPE_RAW_HASH
;
8217 case 1731: hash_type
= HASH_TYPE_SHA512
;
8218 salt_type
= SALT_TYPE_EMBEDDED
;
8219 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8220 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8221 | OPTS_TYPE_PT_UNICODE
8222 | OPTS_TYPE_ST_ADD80
8223 | OPTS_TYPE_ST_ADDBITS15
8225 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8226 dgst_size
= DGST_SIZE_8_8
;
8227 parse_func
= mssql2012_parse_hash
;
8228 sort_by_digest
= sort_by_digest_8_8
;
8229 opti_type
= OPTI_TYPE_ZERO_BYTE
8230 | OPTI_TYPE_PRECOMPUTE_INIT
8231 | OPTI_TYPE_PRECOMPUTE_MERKLE
8232 | OPTI_TYPE_EARLY_SKIP
8233 | OPTI_TYPE_NOT_ITERATED
8234 | OPTI_TYPE_APPENDED_SALT
8235 | OPTI_TYPE_USES_BITS_64
8236 | OPTI_TYPE_RAW_HASH
;
8243 case 1740: hash_type
= HASH_TYPE_SHA512
;
8244 salt_type
= SALT_TYPE_INTERN
;
8245 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8246 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8247 | OPTS_TYPE_PT_ADD80
8248 | OPTS_TYPE_PT_ADDBITS15
8249 | OPTS_TYPE_PT_UNICODE
;
8250 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8251 dgst_size
= DGST_SIZE_8_8
;
8252 parse_func
= sha512s_parse_hash
;
8253 sort_by_digest
= sort_by_digest_8_8
;
8254 opti_type
= OPTI_TYPE_ZERO_BYTE
8255 | OPTI_TYPE_PRECOMPUTE_INIT
8256 | OPTI_TYPE_PRECOMPUTE_MERKLE
8257 | OPTI_TYPE_EARLY_SKIP
8258 | OPTI_TYPE_NOT_ITERATED
8259 | OPTI_TYPE_PREPENDED_SALT
8260 | OPTI_TYPE_USES_BITS_64
8261 | OPTI_TYPE_RAW_HASH
;
8268 case 1750: hash_type
= HASH_TYPE_SHA512
;
8269 salt_type
= SALT_TYPE_INTERN
;
8270 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8271 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8272 | OPTS_TYPE_ST_ADD80
;
8273 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8274 dgst_size
= DGST_SIZE_8_8
;
8275 parse_func
= hmacsha512_parse_hash
;
8276 sort_by_digest
= sort_by_digest_8_8
;
8277 opti_type
= OPTI_TYPE_ZERO_BYTE
8278 | OPTI_TYPE_USES_BITS_64
8279 | OPTI_TYPE_NOT_ITERATED
;
8286 case 1760: hash_type
= HASH_TYPE_SHA512
;
8287 salt_type
= SALT_TYPE_INTERN
;
8288 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8289 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8290 | OPTS_TYPE_PT_ADD80
8291 | OPTS_TYPE_PT_ADDBITS15
;
8292 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8293 dgst_size
= DGST_SIZE_8_8
;
8294 parse_func
= hmacsha512_parse_hash
;
8295 sort_by_digest
= sort_by_digest_8_8
;
8296 opti_type
= OPTI_TYPE_ZERO_BYTE
8297 | OPTI_TYPE_USES_BITS_64
8298 | OPTI_TYPE_NOT_ITERATED
;
8305 case 1800: hash_type
= HASH_TYPE_SHA512
;
8306 salt_type
= SALT_TYPE_EMBEDDED
;
8307 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8308 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8309 kern_type
= KERN_TYPE_SHA512CRYPT
;
8310 dgst_size
= DGST_SIZE_8_8
;
8311 parse_func
= sha512crypt_parse_hash
;
8312 sort_by_digest
= sort_by_digest_8_8
;
8313 opti_type
= OPTI_TYPE_ZERO_BYTE
8314 | OPTI_TYPE_USES_BITS_64
;
8321 case 2100: hash_type
= HASH_TYPE_DCC2
;
8322 salt_type
= SALT_TYPE_EMBEDDED
;
8323 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8324 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8325 | OPTS_TYPE_ST_LOWER
8326 | OPTS_TYPE_ST_UNICODE
;
8327 kern_type
= KERN_TYPE_DCC2
;
8328 dgst_size
= DGST_SIZE_4_4
;
8329 parse_func
= dcc2_parse_hash
;
8330 sort_by_digest
= sort_by_digest_4_4
;
8331 opti_type
= OPTI_TYPE_ZERO_BYTE
8332 | OPTI_TYPE_SLOW_HASH_SIMD
;
8339 case 2400: hash_type
= HASH_TYPE_MD5
;
8340 salt_type
= SALT_TYPE_NONE
;
8341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8343 kern_type
= KERN_TYPE_MD5PIX
;
8344 dgst_size
= DGST_SIZE_4_4
;
8345 parse_func
= md5pix_parse_hash
;
8346 sort_by_digest
= sort_by_digest_4_4
;
8347 opti_type
= OPTI_TYPE_ZERO_BYTE
8348 | OPTI_TYPE_PRECOMPUTE_INIT
8349 | OPTI_TYPE_PRECOMPUTE_MERKLE
8350 | OPTI_TYPE_EARLY_SKIP
8351 | OPTI_TYPE_NOT_ITERATED
8352 | OPTI_TYPE_NOT_SALTED
;
8359 case 2410: hash_type
= HASH_TYPE_MD5
;
8360 salt_type
= SALT_TYPE_INTERN
;
8361 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8363 kern_type
= KERN_TYPE_MD5ASA
;
8364 dgst_size
= DGST_SIZE_4_4
;
8365 parse_func
= md5asa_parse_hash
;
8366 sort_by_digest
= sort_by_digest_4_4
;
8367 opti_type
= OPTI_TYPE_ZERO_BYTE
8368 | OPTI_TYPE_PRECOMPUTE_INIT
8369 | OPTI_TYPE_PRECOMPUTE_MERKLE
8370 | OPTI_TYPE_EARLY_SKIP
8371 | OPTI_TYPE_NOT_ITERATED
;
8378 case 2500: hash_type
= HASH_TYPE_WPA
;
8379 salt_type
= SALT_TYPE_EMBEDDED
;
8380 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8381 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8382 kern_type
= KERN_TYPE_WPA
;
8383 dgst_size
= DGST_SIZE_4_4
;
8384 parse_func
= wpa_parse_hash
;
8385 sort_by_digest
= sort_by_digest_4_4
;
8386 opti_type
= OPTI_TYPE_ZERO_BYTE
8387 | OPTI_TYPE_SLOW_HASH_SIMD
;
8394 case 2600: hash_type
= HASH_TYPE_MD5
;
8395 salt_type
= SALT_TYPE_VIRTUAL
;
8396 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8397 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8398 | OPTS_TYPE_PT_ADD80
8399 | OPTS_TYPE_PT_ADDBITS14
8400 | OPTS_TYPE_ST_ADD80
;
8401 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8402 dgst_size
= DGST_SIZE_4_4
;
8403 parse_func
= md5md5_parse_hash
;
8404 sort_by_digest
= sort_by_digest_4_4
;
8405 opti_type
= OPTI_TYPE_ZERO_BYTE
8406 | OPTI_TYPE_PRECOMPUTE_INIT
8407 | OPTI_TYPE_PRECOMPUTE_MERKLE
8408 | OPTI_TYPE_EARLY_SKIP
;
8415 case 2611: hash_type
= HASH_TYPE_MD5
;
8416 salt_type
= SALT_TYPE_INTERN
;
8417 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8418 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8419 | OPTS_TYPE_PT_ADD80
8420 | OPTS_TYPE_PT_ADDBITS14
8421 | OPTS_TYPE_ST_ADD80
;
8422 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8423 dgst_size
= DGST_SIZE_4_4
;
8424 parse_func
= vb3_parse_hash
;
8425 sort_by_digest
= sort_by_digest_4_4
;
8426 opti_type
= OPTI_TYPE_ZERO_BYTE
8427 | OPTI_TYPE_PRECOMPUTE_INIT
8428 | OPTI_TYPE_PRECOMPUTE_MERKLE
8429 | OPTI_TYPE_EARLY_SKIP
;
8436 case 2612: hash_type
= HASH_TYPE_MD5
;
8437 salt_type
= SALT_TYPE_EMBEDDED
;
8438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8440 | OPTS_TYPE_PT_ADD80
8441 | OPTS_TYPE_PT_ADDBITS14
8442 | OPTS_TYPE_ST_ADD80
8444 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8445 dgst_size
= DGST_SIZE_4_4
;
8446 parse_func
= phps_parse_hash
;
8447 sort_by_digest
= sort_by_digest_4_4
;
8448 opti_type
= OPTI_TYPE_ZERO_BYTE
8449 | OPTI_TYPE_PRECOMPUTE_INIT
8450 | OPTI_TYPE_PRECOMPUTE_MERKLE
8451 | OPTI_TYPE_EARLY_SKIP
;
8458 case 2711: hash_type
= HASH_TYPE_MD5
;
8459 salt_type
= SALT_TYPE_INTERN
;
8460 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8462 | OPTS_TYPE_PT_ADD80
8463 | OPTS_TYPE_PT_ADDBITS14
8464 | OPTS_TYPE_ST_ADD80
;
8465 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8466 dgst_size
= DGST_SIZE_4_4
;
8467 parse_func
= vb30_parse_hash
;
8468 sort_by_digest
= sort_by_digest_4_4
;
8469 opti_type
= OPTI_TYPE_ZERO_BYTE
8470 | OPTI_TYPE_PRECOMPUTE_INIT
8471 | OPTI_TYPE_EARLY_SKIP
;
8478 case 2811: hash_type
= HASH_TYPE_MD5
;
8479 salt_type
= SALT_TYPE_INTERN
;
8480 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8481 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8482 | OPTS_TYPE_PT_ADD80
8483 | OPTS_TYPE_PT_ADDBITS14
;
8484 kern_type
= KERN_TYPE_MD55_SLTPW
;
8485 dgst_size
= DGST_SIZE_4_4
;
8486 parse_func
= ipb2_parse_hash
;
8487 sort_by_digest
= sort_by_digest_4_4
;
8488 opti_type
= OPTI_TYPE_ZERO_BYTE
8489 | OPTI_TYPE_PRECOMPUTE_INIT
8490 | OPTI_TYPE_EARLY_SKIP
;
8497 case 3000: hash_type
= HASH_TYPE_LM
;
8498 salt_type
= SALT_TYPE_NONE
;
8499 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8501 | OPTS_TYPE_PT_UPPER
8502 | OPTS_TYPE_PT_BITSLICE
;
8503 kern_type
= KERN_TYPE_LM
;
8504 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8505 parse_func
= lm_parse_hash
;
8506 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8507 opti_type
= OPTI_TYPE_ZERO_BYTE
8508 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8515 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8516 salt_type
= SALT_TYPE_INTERN
;
8517 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8518 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8519 | OPTS_TYPE_PT_UPPER
8520 | OPTS_TYPE_ST_UPPER
;
8521 kern_type
= KERN_TYPE_ORACLEH
;
8522 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8523 parse_func
= oracleh_parse_hash
;
8524 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8525 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8532 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8533 salt_type
= SALT_TYPE_EMBEDDED
;
8534 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8535 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8536 | OPTS_TYPE_ST_GENERATE_LE
;
8537 kern_type
= KERN_TYPE_BCRYPT
;
8538 dgst_size
= DGST_SIZE_4_6
;
8539 parse_func
= bcrypt_parse_hash
;
8540 sort_by_digest
= sort_by_digest_4_6
;
8541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8548 case 3710: hash_type
= HASH_TYPE_MD5
;
8549 salt_type
= SALT_TYPE_INTERN
;
8550 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8551 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8552 | OPTS_TYPE_PT_ADD80
8553 | OPTS_TYPE_PT_ADDBITS14
;
8554 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8555 dgst_size
= DGST_SIZE_4_4
;
8556 parse_func
= md5s_parse_hash
;
8557 sort_by_digest
= sort_by_digest_4_4
;
8558 opti_type
= OPTI_TYPE_ZERO_BYTE
8559 | OPTI_TYPE_PRECOMPUTE_INIT
8560 | OPTI_TYPE_PRECOMPUTE_MERKLE
8561 | OPTI_TYPE_EARLY_SKIP
;
8568 case 3711: hash_type
= HASH_TYPE_MD5
;
8569 salt_type
= SALT_TYPE_EMBEDDED
;
8570 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8571 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8572 | OPTS_TYPE_PT_ADD80
8573 | OPTS_TYPE_PT_ADDBITS14
;
8574 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8575 dgst_size
= DGST_SIZE_4_4
;
8576 parse_func
= mediawiki_b_parse_hash
;
8577 sort_by_digest
= sort_by_digest_4_4
;
8578 opti_type
= OPTI_TYPE_ZERO_BYTE
8579 | OPTI_TYPE_PRECOMPUTE_INIT
8580 | OPTI_TYPE_PRECOMPUTE_MERKLE
8581 | OPTI_TYPE_EARLY_SKIP
;
8588 case 3800: hash_type
= HASH_TYPE_MD5
;
8589 salt_type
= SALT_TYPE_INTERN
;
8590 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8591 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8592 | OPTS_TYPE_ST_ADDBITS14
;
8593 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8594 dgst_size
= DGST_SIZE_4_4
;
8595 parse_func
= md5s_parse_hash
;
8596 sort_by_digest
= sort_by_digest_4_4
;
8597 opti_type
= OPTI_TYPE_ZERO_BYTE
8598 | OPTI_TYPE_PRECOMPUTE_INIT
8599 | OPTI_TYPE_PRECOMPUTE_MERKLE
8600 | OPTI_TYPE_EARLY_SKIP
8601 | OPTI_TYPE_NOT_ITERATED
8602 | OPTI_TYPE_RAW_HASH
;
8609 case 4300: hash_type
= HASH_TYPE_MD5
;
8610 salt_type
= SALT_TYPE_VIRTUAL
;
8611 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8612 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8613 | OPTS_TYPE_PT_ADD80
8614 | OPTS_TYPE_PT_ADDBITS14
8615 | OPTS_TYPE_ST_ADD80
;
8616 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8617 dgst_size
= DGST_SIZE_4_4
;
8618 parse_func
= md5md5_parse_hash
;
8619 sort_by_digest
= sort_by_digest_4_4
;
8620 opti_type
= OPTI_TYPE_ZERO_BYTE
8621 | OPTI_TYPE_PRECOMPUTE_INIT
8622 | OPTI_TYPE_PRECOMPUTE_MERKLE
8623 | OPTI_TYPE_EARLY_SKIP
;
8631 case 4400: hash_type
= HASH_TYPE_MD5
;
8632 salt_type
= SALT_TYPE_NONE
;
8633 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8634 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8635 | OPTS_TYPE_PT_ADD80
8636 | OPTS_TYPE_PT_ADDBITS15
;
8637 kern_type
= KERN_TYPE_MD5_SHA1
;
8638 dgst_size
= DGST_SIZE_4_4
;
8639 parse_func
= md5_parse_hash
;
8640 sort_by_digest
= sort_by_digest_4_4
;
8641 opti_type
= OPTI_TYPE_ZERO_BYTE
8642 | OPTI_TYPE_PRECOMPUTE_INIT
8643 | OPTI_TYPE_PRECOMPUTE_MERKLE
8644 | OPTI_TYPE_EARLY_SKIP
8645 | OPTI_TYPE_NOT_ITERATED
8646 | OPTI_TYPE_NOT_SALTED
8647 | OPTI_TYPE_RAW_HASH
;
8654 case 4500: hash_type
= HASH_TYPE_SHA1
;
8655 salt_type
= SALT_TYPE_NONE
;
8656 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8657 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8658 | OPTS_TYPE_PT_ADD80
8659 | OPTS_TYPE_PT_ADDBITS15
;
8660 kern_type
= KERN_TYPE_SHA11
;
8661 dgst_size
= DGST_SIZE_4_5
;
8662 parse_func
= sha1_parse_hash
;
8663 sort_by_digest
= sort_by_digest_4_5
;
8664 opti_type
= OPTI_TYPE_ZERO_BYTE
8665 | OPTI_TYPE_PRECOMPUTE_INIT
8666 | OPTI_TYPE_PRECOMPUTE_MERKLE
8667 | OPTI_TYPE_EARLY_SKIP
8668 | OPTI_TYPE_NOT_SALTED
;
8675 case 4700: hash_type
= HASH_TYPE_SHA1
;
8676 salt_type
= SALT_TYPE_NONE
;
8677 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8678 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8679 | OPTS_TYPE_PT_ADD80
8680 | OPTS_TYPE_PT_ADDBITS14
;
8681 kern_type
= KERN_TYPE_SHA1_MD5
;
8682 dgst_size
= DGST_SIZE_4_5
;
8683 parse_func
= sha1_parse_hash
;
8684 sort_by_digest
= sort_by_digest_4_5
;
8685 opti_type
= OPTI_TYPE_ZERO_BYTE
8686 | OPTI_TYPE_PRECOMPUTE_INIT
8687 | OPTI_TYPE_PRECOMPUTE_MERKLE
8688 | OPTI_TYPE_EARLY_SKIP
8689 | OPTI_TYPE_NOT_ITERATED
8690 | OPTI_TYPE_NOT_SALTED
8691 | OPTI_TYPE_RAW_HASH
;
8698 case 4800: hash_type
= HASH_TYPE_MD5
;
8699 salt_type
= SALT_TYPE_EMBEDDED
;
8700 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8701 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8702 | OPTS_TYPE_PT_ADDBITS14
;
8703 kern_type
= KERN_TYPE_MD5_CHAP
;
8704 dgst_size
= DGST_SIZE_4_4
;
8705 parse_func
= chap_parse_hash
;
8706 sort_by_digest
= sort_by_digest_4_4
;
8707 opti_type
= OPTI_TYPE_ZERO_BYTE
8708 | OPTI_TYPE_PRECOMPUTE_INIT
8709 | OPTI_TYPE_PRECOMPUTE_MERKLE
8710 | OPTI_TYPE_MEET_IN_MIDDLE
8711 | OPTI_TYPE_EARLY_SKIP
8712 | OPTI_TYPE_NOT_ITERATED
8713 | OPTI_TYPE_RAW_HASH
;
8720 case 4900: hash_type
= HASH_TYPE_SHA1
;
8721 salt_type
= SALT_TYPE_INTERN
;
8722 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8723 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8724 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8725 dgst_size
= DGST_SIZE_4_5
;
8726 parse_func
= sha1s_parse_hash
;
8727 sort_by_digest
= sort_by_digest_4_5
;
8728 opti_type
= OPTI_TYPE_ZERO_BYTE
8729 | OPTI_TYPE_PRECOMPUTE_INIT
8730 | OPTI_TYPE_PRECOMPUTE_MERKLE
8731 | OPTI_TYPE_EARLY_SKIP
;
8738 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8739 salt_type
= SALT_TYPE_EMBEDDED
;
8740 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8742 | OPTS_TYPE_PT_ADD01
;
8743 kern_type
= KERN_TYPE_KECCAK
;
8744 dgst_size
= DGST_SIZE_8_25
;
8745 parse_func
= keccak_parse_hash
;
8746 sort_by_digest
= sort_by_digest_8_25
;
8747 opti_type
= OPTI_TYPE_ZERO_BYTE
8748 | OPTI_TYPE_USES_BITS_64
8749 | OPTI_TYPE_RAW_HASH
;
8756 case 5100: hash_type
= HASH_TYPE_MD5H
;
8757 salt_type
= SALT_TYPE_NONE
;
8758 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8759 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8760 | OPTS_TYPE_PT_ADD80
8761 | OPTS_TYPE_PT_ADDBITS14
;
8762 kern_type
= KERN_TYPE_MD5H
;
8763 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8764 parse_func
= md5half_parse_hash
;
8765 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8766 opti_type
= OPTI_TYPE_ZERO_BYTE
8767 | OPTI_TYPE_RAW_HASH
;
8774 case 5200: hash_type
= HASH_TYPE_SHA256
;
8775 salt_type
= SALT_TYPE_EMBEDDED
;
8776 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8777 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8778 kern_type
= KERN_TYPE_PSAFE3
;
8779 dgst_size
= DGST_SIZE_4_8
;
8780 parse_func
= psafe3_parse_hash
;
8781 sort_by_digest
= sort_by_digest_4_8
;
8782 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8789 case 5300: hash_type
= HASH_TYPE_MD5
;
8790 salt_type
= SALT_TYPE_EMBEDDED
;
8791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8793 | OPTS_TYPE_ST_ADD80
;
8794 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8795 dgst_size
= DGST_SIZE_4_4
;
8796 parse_func
= ikepsk_md5_parse_hash
;
8797 sort_by_digest
= sort_by_digest_4_4
;
8798 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8805 case 5400: hash_type
= HASH_TYPE_SHA1
;
8806 salt_type
= SALT_TYPE_EMBEDDED
;
8807 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8808 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8809 | OPTS_TYPE_ST_ADD80
;
8810 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8811 dgst_size
= DGST_SIZE_4_5
;
8812 parse_func
= ikepsk_sha1_parse_hash
;
8813 sort_by_digest
= sort_by_digest_4_5
;
8814 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8821 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8822 salt_type
= SALT_TYPE_EMBEDDED
;
8823 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8824 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8825 | OPTS_TYPE_PT_ADD80
8826 | OPTS_TYPE_PT_ADDBITS14
8827 | OPTS_TYPE_PT_UNICODE
8829 kern_type
= KERN_TYPE_NETNTLMv1
;
8830 dgst_size
= DGST_SIZE_4_4
;
8831 parse_func
= netntlmv1_parse_hash
;
8832 sort_by_digest
= sort_by_digest_4_4
;
8833 opti_type
= OPTI_TYPE_ZERO_BYTE
8834 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8841 case 5600: hash_type
= HASH_TYPE_MD5
;
8842 salt_type
= SALT_TYPE_EMBEDDED
;
8843 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8844 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8845 | OPTS_TYPE_PT_ADD80
8846 | OPTS_TYPE_PT_ADDBITS14
8847 | OPTS_TYPE_PT_UNICODE
;
8848 kern_type
= KERN_TYPE_NETNTLMv2
;
8849 dgst_size
= DGST_SIZE_4_4
;
8850 parse_func
= netntlmv2_parse_hash
;
8851 sort_by_digest
= sort_by_digest_4_4
;
8852 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8859 case 5700: hash_type
= HASH_TYPE_SHA256
;
8860 salt_type
= SALT_TYPE_NONE
;
8861 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8862 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8863 | OPTS_TYPE_PT_ADD80
8864 | OPTS_TYPE_PT_ADDBITS15
;
8865 kern_type
= KERN_TYPE_SHA256
;
8866 dgst_size
= DGST_SIZE_4_8
;
8867 parse_func
= cisco4_parse_hash
;
8868 sort_by_digest
= sort_by_digest_4_8
;
8869 opti_type
= OPTI_TYPE_ZERO_BYTE
8870 | OPTI_TYPE_PRECOMPUTE_INIT
8871 | OPTI_TYPE_PRECOMPUTE_MERKLE
8872 | OPTI_TYPE_EARLY_SKIP
8873 | OPTI_TYPE_NOT_ITERATED
8874 | OPTI_TYPE_NOT_SALTED
8875 | OPTI_TYPE_RAW_HASH
;
8882 case 5800: hash_type
= HASH_TYPE_SHA1
;
8883 salt_type
= SALT_TYPE_INTERN
;
8884 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8885 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8886 | OPTS_TYPE_ST_ADD80
;
8887 kern_type
= KERN_TYPE_ANDROIDPIN
;
8888 dgst_size
= DGST_SIZE_4_5
;
8889 parse_func
= androidpin_parse_hash
;
8890 sort_by_digest
= sort_by_digest_4_5
;
8891 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8898 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8899 salt_type
= SALT_TYPE_NONE
;
8900 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8901 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8902 | OPTS_TYPE_PT_ADD80
;
8903 kern_type
= KERN_TYPE_RIPEMD160
;
8904 dgst_size
= DGST_SIZE_4_5
;
8905 parse_func
= ripemd160_parse_hash
;
8906 sort_by_digest
= sort_by_digest_4_5
;
8907 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8914 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8915 salt_type
= SALT_TYPE_NONE
;
8916 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8917 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8918 | OPTS_TYPE_PT_ADD80
;
8919 kern_type
= KERN_TYPE_WHIRLPOOL
;
8920 dgst_size
= DGST_SIZE_4_16
;
8921 parse_func
= whirlpool_parse_hash
;
8922 sort_by_digest
= sort_by_digest_4_16
;
8923 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8930 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8931 salt_type
= SALT_TYPE_EMBEDDED
;
8932 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8933 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8934 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8935 dgst_size
= DGST_SIZE_4_5
;
8936 parse_func
= truecrypt_parse_hash_2k
;
8937 sort_by_digest
= sort_by_digest_4_5
;
8938 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8945 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8946 salt_type
= SALT_TYPE_EMBEDDED
;
8947 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8948 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8949 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8950 dgst_size
= DGST_SIZE_4_5
;
8951 parse_func
= truecrypt_parse_hash_2k
;
8952 sort_by_digest
= sort_by_digest_4_5
;
8953 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8960 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8961 salt_type
= SALT_TYPE_EMBEDDED
;
8962 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8964 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8965 dgst_size
= DGST_SIZE_4_5
;
8966 parse_func
= truecrypt_parse_hash_2k
;
8967 sort_by_digest
= sort_by_digest_4_5
;
8968 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8975 case 6221: hash_type
= HASH_TYPE_SHA512
;
8976 salt_type
= SALT_TYPE_EMBEDDED
;
8977 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8978 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8979 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8980 dgst_size
= DGST_SIZE_8_8
;
8981 parse_func
= truecrypt_parse_hash_1k
;
8982 sort_by_digest
= sort_by_digest_8_8
;
8983 opti_type
= OPTI_TYPE_ZERO_BYTE
8984 | OPTI_TYPE_USES_BITS_64
;
8991 case 6222: hash_type
= HASH_TYPE_SHA512
;
8992 salt_type
= SALT_TYPE_EMBEDDED
;
8993 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8994 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8995 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8996 dgst_size
= DGST_SIZE_8_8
;
8997 parse_func
= truecrypt_parse_hash_1k
;
8998 sort_by_digest
= sort_by_digest_8_8
;
8999 opti_type
= OPTI_TYPE_ZERO_BYTE
9000 | OPTI_TYPE_USES_BITS_64
;
9007 case 6223: hash_type
= HASH_TYPE_SHA512
;
9008 salt_type
= SALT_TYPE_EMBEDDED
;
9009 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9010 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9011 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9012 dgst_size
= DGST_SIZE_8_8
;
9013 parse_func
= truecrypt_parse_hash_1k
;
9014 sort_by_digest
= sort_by_digest_8_8
;
9015 opti_type
= OPTI_TYPE_ZERO_BYTE
9016 | OPTI_TYPE_USES_BITS_64
;
9023 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9024 salt_type
= SALT_TYPE_EMBEDDED
;
9025 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9026 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9027 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9028 dgst_size
= DGST_SIZE_4_8
;
9029 parse_func
= truecrypt_parse_hash_1k
;
9030 sort_by_digest
= sort_by_digest_4_8
;
9031 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9038 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9039 salt_type
= SALT_TYPE_EMBEDDED
;
9040 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9041 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9042 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9043 dgst_size
= DGST_SIZE_4_8
;
9044 parse_func
= truecrypt_parse_hash_1k
;
9045 sort_by_digest
= sort_by_digest_4_8
;
9046 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9053 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9054 salt_type
= SALT_TYPE_EMBEDDED
;
9055 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9056 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9057 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9058 dgst_size
= DGST_SIZE_4_8
;
9059 parse_func
= truecrypt_parse_hash_1k
;
9060 sort_by_digest
= sort_by_digest_4_8
;
9061 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9068 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9069 salt_type
= SALT_TYPE_EMBEDDED
;
9070 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9071 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9072 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9073 dgst_size
= DGST_SIZE_4_5
;
9074 parse_func
= truecrypt_parse_hash_1k
;
9075 sort_by_digest
= sort_by_digest_4_5
;
9076 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9083 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9084 salt_type
= SALT_TYPE_EMBEDDED
;
9085 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9086 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9087 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9088 dgst_size
= DGST_SIZE_4_5
;
9089 parse_func
= truecrypt_parse_hash_1k
;
9090 sort_by_digest
= sort_by_digest_4_5
;
9091 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9098 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9099 salt_type
= SALT_TYPE_EMBEDDED
;
9100 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9101 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9102 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9103 dgst_size
= DGST_SIZE_4_5
;
9104 parse_func
= truecrypt_parse_hash_1k
;
9105 sort_by_digest
= sort_by_digest_4_5
;
9106 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9113 case 6300: hash_type
= HASH_TYPE_MD5
;
9114 salt_type
= SALT_TYPE_EMBEDDED
;
9115 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9116 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9117 kern_type
= KERN_TYPE_MD5AIX
;
9118 dgst_size
= DGST_SIZE_4_4
;
9119 parse_func
= md5aix_parse_hash
;
9120 sort_by_digest
= sort_by_digest_4_4
;
9121 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9128 case 6400: hash_type
= HASH_TYPE_SHA256
;
9129 salt_type
= SALT_TYPE_EMBEDDED
;
9130 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9131 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9132 kern_type
= KERN_TYPE_SHA256AIX
;
9133 dgst_size
= DGST_SIZE_4_8
;
9134 parse_func
= sha256aix_parse_hash
;
9135 sort_by_digest
= sort_by_digest_4_8
;
9136 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9143 case 6500: hash_type
= HASH_TYPE_SHA512
;
9144 salt_type
= SALT_TYPE_EMBEDDED
;
9145 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9146 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9147 kern_type
= KERN_TYPE_SHA512AIX
;
9148 dgst_size
= DGST_SIZE_8_8
;
9149 parse_func
= sha512aix_parse_hash
;
9150 sort_by_digest
= sort_by_digest_8_8
;
9151 opti_type
= OPTI_TYPE_ZERO_BYTE
9152 | OPTI_TYPE_USES_BITS_64
;
9159 case 6600: hash_type
= HASH_TYPE_AES
;
9160 salt_type
= SALT_TYPE_EMBEDDED
;
9161 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9162 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9163 kern_type
= KERN_TYPE_AGILEKEY
;
9164 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9165 parse_func
= agilekey_parse_hash
;
9166 sort_by_digest
= sort_by_digest_4_5
;
9167 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9174 case 6700: hash_type
= HASH_TYPE_SHA1
;
9175 salt_type
= SALT_TYPE_EMBEDDED
;
9176 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9177 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9178 kern_type
= KERN_TYPE_SHA1AIX
;
9179 dgst_size
= DGST_SIZE_4_5
;
9180 parse_func
= sha1aix_parse_hash
;
9181 sort_by_digest
= sort_by_digest_4_5
;
9182 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9189 case 6800: hash_type
= HASH_TYPE_AES
;
9190 salt_type
= SALT_TYPE_EMBEDDED
;
9191 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9192 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9193 kern_type
= KERN_TYPE_LASTPASS
;
9194 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9195 parse_func
= lastpass_parse_hash
;
9196 sort_by_digest
= sort_by_digest_4_8
;
9197 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9204 case 6900: hash_type
= HASH_TYPE_GOST
;
9205 salt_type
= SALT_TYPE_NONE
;
9206 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9207 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9208 kern_type
= KERN_TYPE_GOST
;
9209 dgst_size
= DGST_SIZE_4_8
;
9210 parse_func
= gost_parse_hash
;
9211 sort_by_digest
= sort_by_digest_4_8
;
9212 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9219 case 7100: hash_type
= HASH_TYPE_SHA512
;
9220 salt_type
= SALT_TYPE_EMBEDDED
;
9221 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9222 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9223 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9224 dgst_size
= DGST_SIZE_8_16
;
9225 parse_func
= sha512osx_parse_hash
;
9226 sort_by_digest
= sort_by_digest_8_16
;
9227 opti_type
= OPTI_TYPE_ZERO_BYTE
9228 | OPTI_TYPE_USES_BITS_64
9229 | OPTI_TYPE_SLOW_HASH_SIMD
;
9236 case 7200: hash_type
= HASH_TYPE_SHA512
;
9237 salt_type
= SALT_TYPE_EMBEDDED
;
9238 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9239 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9240 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9241 dgst_size
= DGST_SIZE_8_16
;
9242 parse_func
= sha512grub_parse_hash
;
9243 sort_by_digest
= sort_by_digest_8_16
;
9244 opti_type
= OPTI_TYPE_ZERO_BYTE
9245 | OPTI_TYPE_USES_BITS_64
9246 | OPTI_TYPE_SLOW_HASH_SIMD
;
9253 case 7300: hash_type
= HASH_TYPE_SHA1
;
9254 salt_type
= SALT_TYPE_EMBEDDED
;
9255 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9256 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9257 | OPTS_TYPE_ST_ADD80
9258 | OPTS_TYPE_ST_ADDBITS15
;
9259 kern_type
= KERN_TYPE_RAKP
;
9260 dgst_size
= DGST_SIZE_4_5
;
9261 parse_func
= rakp_parse_hash
;
9262 sort_by_digest
= sort_by_digest_4_5
;
9263 opti_type
= OPTI_TYPE_ZERO_BYTE
9264 | OPTI_TYPE_NOT_ITERATED
;
9271 case 7400: hash_type
= HASH_TYPE_SHA256
;
9272 salt_type
= SALT_TYPE_EMBEDDED
;
9273 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9274 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9275 kern_type
= KERN_TYPE_SHA256CRYPT
;
9276 dgst_size
= DGST_SIZE_4_8
;
9277 parse_func
= sha256crypt_parse_hash
;
9278 sort_by_digest
= sort_by_digest_4_8
;
9279 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9286 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9287 salt_type
= SALT_TYPE_EMBEDDED
;
9288 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9289 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9290 kern_type
= KERN_TYPE_KRB5PA
;
9291 dgst_size
= DGST_SIZE_4_4
;
9292 parse_func
= krb5pa_parse_hash
;
9293 sort_by_digest
= sort_by_digest_4_4
;
9294 opti_type
= OPTI_TYPE_ZERO_BYTE
9295 | OPTI_TYPE_NOT_ITERATED
;
9302 case 7600: hash_type
= HASH_TYPE_SHA1
;
9303 salt_type
= SALT_TYPE_INTERN
;
9304 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9305 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9306 | OPTS_TYPE_PT_ADD80
9307 | OPTS_TYPE_PT_ADDBITS15
;
9308 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9309 dgst_size
= DGST_SIZE_4_5
;
9310 parse_func
= redmine_parse_hash
;
9311 sort_by_digest
= sort_by_digest_4_5
;
9312 opti_type
= OPTI_TYPE_ZERO_BYTE
9313 | OPTI_TYPE_PRECOMPUTE_INIT
9314 | OPTI_TYPE_EARLY_SKIP
9315 | OPTI_TYPE_NOT_ITERATED
9316 | OPTI_TYPE_PREPENDED_SALT
;
9323 case 7700: hash_type
= HASH_TYPE_SAPB
;
9324 salt_type
= SALT_TYPE_EMBEDDED
;
9325 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9326 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9327 | OPTS_TYPE_PT_UPPER
9328 | OPTS_TYPE_ST_UPPER
;
9329 kern_type
= KERN_TYPE_SAPB
;
9330 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9331 parse_func
= sapb_parse_hash
;
9332 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9333 opti_type
= OPTI_TYPE_ZERO_BYTE
9334 | OPTI_TYPE_PRECOMPUTE_INIT
9335 | OPTI_TYPE_NOT_ITERATED
;
9342 case 7800: hash_type
= HASH_TYPE_SAPG
;
9343 salt_type
= SALT_TYPE_EMBEDDED
;
9344 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9345 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9346 | OPTS_TYPE_ST_ADD80
9347 | OPTS_TYPE_ST_UPPER
;
9348 kern_type
= KERN_TYPE_SAPG
;
9349 dgst_size
= DGST_SIZE_4_5
;
9350 parse_func
= sapg_parse_hash
;
9351 sort_by_digest
= sort_by_digest_4_5
;
9352 opti_type
= OPTI_TYPE_ZERO_BYTE
9353 | OPTI_TYPE_PRECOMPUTE_INIT
9354 | OPTI_TYPE_NOT_ITERATED
;
9361 case 7900: hash_type
= HASH_TYPE_SHA512
;
9362 salt_type
= SALT_TYPE_EMBEDDED
;
9363 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9365 kern_type
= KERN_TYPE_DRUPAL7
;
9366 dgst_size
= DGST_SIZE_8_8
;
9367 parse_func
= drupal7_parse_hash
;
9368 sort_by_digest
= sort_by_digest_8_8
;
9369 opti_type
= OPTI_TYPE_ZERO_BYTE
9370 | OPTI_TYPE_USES_BITS_64
;
9377 case 8000: hash_type
= HASH_TYPE_SHA256
;
9378 salt_type
= SALT_TYPE_EMBEDDED
;
9379 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9380 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9381 | OPTS_TYPE_PT_UNICODE
9382 | OPTS_TYPE_ST_ADD80
9384 kern_type
= KERN_TYPE_SYBASEASE
;
9385 dgst_size
= DGST_SIZE_4_8
;
9386 parse_func
= sybasease_parse_hash
;
9387 sort_by_digest
= sort_by_digest_4_8
;
9388 opti_type
= OPTI_TYPE_ZERO_BYTE
9389 | OPTI_TYPE_PRECOMPUTE_INIT
9390 | OPTI_TYPE_EARLY_SKIP
9391 | OPTI_TYPE_NOT_ITERATED
9392 | OPTI_TYPE_RAW_HASH
;
9399 case 8100: hash_type
= HASH_TYPE_SHA1
;
9400 salt_type
= SALT_TYPE_EMBEDDED
;
9401 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9402 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9403 kern_type
= KERN_TYPE_NETSCALER
;
9404 dgst_size
= DGST_SIZE_4_5
;
9405 parse_func
= netscaler_parse_hash
;
9406 sort_by_digest
= sort_by_digest_4_5
;
9407 opti_type
= OPTI_TYPE_ZERO_BYTE
9408 | OPTI_TYPE_PRECOMPUTE_INIT
9409 | OPTI_TYPE_PRECOMPUTE_MERKLE
9410 | OPTI_TYPE_EARLY_SKIP
9411 | OPTI_TYPE_NOT_ITERATED
9412 | OPTI_TYPE_PREPENDED_SALT
9413 | OPTI_TYPE_RAW_HASH
;
9420 case 8200: hash_type
= HASH_TYPE_SHA256
;
9421 salt_type
= SALT_TYPE_EMBEDDED
;
9422 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9423 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9424 kern_type
= KERN_TYPE_CLOUDKEY
;
9425 dgst_size
= DGST_SIZE_4_8
;
9426 parse_func
= cloudkey_parse_hash
;
9427 sort_by_digest
= sort_by_digest_4_8
;
9428 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9435 case 8300: hash_type
= HASH_TYPE_SHA1
;
9436 salt_type
= SALT_TYPE_EMBEDDED
;
9437 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9438 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9440 | OPTS_TYPE_ST_ADD80
;
9441 kern_type
= KERN_TYPE_NSEC3
;
9442 dgst_size
= DGST_SIZE_4_5
;
9443 parse_func
= nsec3_parse_hash
;
9444 sort_by_digest
= sort_by_digest_4_5
;
9445 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9452 case 8400: hash_type
= HASH_TYPE_SHA1
;
9453 salt_type
= SALT_TYPE_INTERN
;
9454 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9455 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9456 | OPTS_TYPE_PT_ADD80
9457 | OPTS_TYPE_PT_ADDBITS15
;
9458 kern_type
= KERN_TYPE_WBB3
;
9459 dgst_size
= DGST_SIZE_4_5
;
9460 parse_func
= wbb3_parse_hash
;
9461 sort_by_digest
= sort_by_digest_4_5
;
9462 opti_type
= OPTI_TYPE_ZERO_BYTE
9463 | OPTI_TYPE_PRECOMPUTE_INIT
9464 | OPTI_TYPE_NOT_ITERATED
;
9471 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9472 salt_type
= SALT_TYPE_EMBEDDED
;
9473 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9474 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9475 | OPTS_TYPE_ST_UPPER
;
9476 kern_type
= KERN_TYPE_RACF
;
9477 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9478 parse_func
= racf_parse_hash
;
9479 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9480 opti_type
= OPTI_TYPE_ZERO_BYTE
9481 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9488 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9489 salt_type
= SALT_TYPE_NONE
;
9490 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9492 kern_type
= KERN_TYPE_LOTUS5
;
9493 dgst_size
= DGST_SIZE_4_4
;
9494 parse_func
= lotus5_parse_hash
;
9495 sort_by_digest
= sort_by_digest_4_4
;
9496 opti_type
= OPTI_TYPE_EARLY_SKIP
9497 | OPTI_TYPE_NOT_ITERATED
9498 | OPTI_TYPE_NOT_SALTED
9499 | OPTI_TYPE_RAW_HASH
;
9506 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9507 salt_type
= SALT_TYPE_EMBEDDED
;
9508 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9509 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9510 kern_type
= KERN_TYPE_LOTUS6
;
9511 dgst_size
= DGST_SIZE_4_4
;
9512 parse_func
= lotus6_parse_hash
;
9513 sort_by_digest
= sort_by_digest_4_4
;
9514 opti_type
= OPTI_TYPE_EARLY_SKIP
9515 | OPTI_TYPE_NOT_ITERATED
9516 | OPTI_TYPE_RAW_HASH
;
9523 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9524 salt_type
= SALT_TYPE_EMBEDDED
;
9525 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9526 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9527 kern_type
= KERN_TYPE_ANDROIDFDE
;
9528 dgst_size
= DGST_SIZE_4_4
;
9529 parse_func
= androidfde_parse_hash
;
9530 sort_by_digest
= sort_by_digest_4_4
;
9531 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9538 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9539 salt_type
= SALT_TYPE_EMBEDDED
;
9540 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9541 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9542 kern_type
= KERN_TYPE_SCRYPT
;
9543 dgst_size
= DGST_SIZE_4_8
;
9544 parse_func
= scrypt_parse_hash
;
9545 sort_by_digest
= sort_by_digest_4_8
;
9546 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9553 case 9000: hash_type
= HASH_TYPE_SHA1
;
9554 salt_type
= SALT_TYPE_EMBEDDED
;
9555 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9556 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9557 | OPTS_TYPE_ST_GENERATE_LE
;
9558 kern_type
= KERN_TYPE_PSAFE2
;
9559 dgst_size
= DGST_SIZE_4_5
;
9560 parse_func
= psafe2_parse_hash
;
9561 sort_by_digest
= sort_by_digest_4_5
;
9562 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9569 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9570 salt_type
= SALT_TYPE_EMBEDDED
;
9571 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9572 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9573 kern_type
= KERN_TYPE_LOTUS8
;
9574 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9575 parse_func
= lotus8_parse_hash
;
9576 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9577 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9584 case 9200: hash_type
= HASH_TYPE_SHA256
;
9585 salt_type
= SALT_TYPE_EMBEDDED
;
9586 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9587 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9588 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9589 dgst_size
= DGST_SIZE_4_32
;
9590 parse_func
= cisco8_parse_hash
;
9591 sort_by_digest
= sort_by_digest_4_32
;
9592 opti_type
= OPTI_TYPE_ZERO_BYTE
9593 | OPTI_TYPE_SLOW_HASH_SIMD
;
9600 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9601 salt_type
= SALT_TYPE_EMBEDDED
;
9602 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9603 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9604 kern_type
= KERN_TYPE_SCRYPT
;
9605 dgst_size
= DGST_SIZE_4_8
;
9606 parse_func
= cisco9_parse_hash
;
9607 sort_by_digest
= sort_by_digest_4_8
;
9608 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9615 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9616 salt_type
= SALT_TYPE_EMBEDDED
;
9617 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9618 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9619 kern_type
= KERN_TYPE_OFFICE2007
;
9620 dgst_size
= DGST_SIZE_4_4
;
9621 parse_func
= office2007_parse_hash
;
9622 sort_by_digest
= sort_by_digest_4_4
;
9623 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9630 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9631 salt_type
= SALT_TYPE_EMBEDDED
;
9632 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9633 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9634 kern_type
= KERN_TYPE_OFFICE2010
;
9635 dgst_size
= DGST_SIZE_4_4
;
9636 parse_func
= office2010_parse_hash
;
9637 sort_by_digest
= sort_by_digest_4_4
;
9638 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9645 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9646 salt_type
= SALT_TYPE_EMBEDDED
;
9647 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9648 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9649 kern_type
= KERN_TYPE_OFFICE2013
;
9650 dgst_size
= DGST_SIZE_4_4
;
9651 parse_func
= office2013_parse_hash
;
9652 sort_by_digest
= sort_by_digest_4_4
;
9653 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9660 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9661 salt_type
= SALT_TYPE_EMBEDDED
;
9662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9664 | OPTS_TYPE_PT_ADD80
9665 | OPTS_TYPE_PT_UNICODE
;
9666 kern_type
= KERN_TYPE_OLDOFFICE01
;
9667 dgst_size
= DGST_SIZE_4_4
;
9668 parse_func
= oldoffice01_parse_hash
;
9669 sort_by_digest
= sort_by_digest_4_4
;
9670 opti_type
= OPTI_TYPE_ZERO_BYTE
9671 | OPTI_TYPE_PRECOMPUTE_INIT
9672 | OPTI_TYPE_NOT_ITERATED
;
9679 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9680 salt_type
= SALT_TYPE_EMBEDDED
;
9681 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9683 | OPTS_TYPE_PT_ADD80
;
9684 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9685 dgst_size
= DGST_SIZE_4_4
;
9686 parse_func
= oldoffice01cm1_parse_hash
;
9687 sort_by_digest
= sort_by_digest_4_4
;
9688 opti_type
= OPTI_TYPE_ZERO_BYTE
9689 | OPTI_TYPE_PRECOMPUTE_INIT
9690 | OPTI_TYPE_NOT_ITERATED
;
9697 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9698 salt_type
= SALT_TYPE_EMBEDDED
;
9699 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9700 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9701 | OPTS_TYPE_PT_ADD80
9702 | OPTS_TYPE_PT_UNICODE
9703 | OPTS_TYPE_PT_NEVERCRACK
;
9704 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9705 dgst_size
= DGST_SIZE_4_4
;
9706 parse_func
= oldoffice01cm2_parse_hash
;
9707 sort_by_digest
= sort_by_digest_4_4
;
9708 opti_type
= OPTI_TYPE_ZERO_BYTE
9709 | OPTI_TYPE_PRECOMPUTE_INIT
9710 | OPTI_TYPE_NOT_ITERATED
;
9717 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9718 salt_type
= SALT_TYPE_EMBEDDED
;
9719 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9720 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9721 | OPTS_TYPE_PT_ADD80
9722 | OPTS_TYPE_PT_UNICODE
;
9723 kern_type
= KERN_TYPE_OLDOFFICE34
;
9724 dgst_size
= DGST_SIZE_4_4
;
9725 parse_func
= oldoffice34_parse_hash
;
9726 sort_by_digest
= sort_by_digest_4_4
;
9727 opti_type
= OPTI_TYPE_ZERO_BYTE
9728 | OPTI_TYPE_PRECOMPUTE_INIT
9729 | OPTI_TYPE_NOT_ITERATED
;
9736 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9737 salt_type
= SALT_TYPE_EMBEDDED
;
9738 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9739 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9740 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9741 dgst_size
= DGST_SIZE_4_4
;
9742 parse_func
= oldoffice34cm1_parse_hash
;
9743 sort_by_digest
= sort_by_digest_4_4
;
9744 opti_type
= OPTI_TYPE_ZERO_BYTE
9745 | OPTI_TYPE_PRECOMPUTE_INIT
9746 | OPTI_TYPE_NOT_ITERATED
;
9753 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9754 salt_type
= SALT_TYPE_EMBEDDED
;
9755 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9756 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9757 | OPTS_TYPE_PT_ADD80
9758 | OPTS_TYPE_PT_UNICODE
9759 | OPTS_TYPE_PT_NEVERCRACK
;
9760 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9761 dgst_size
= DGST_SIZE_4_4
;
9762 parse_func
= oldoffice34cm2_parse_hash
;
9763 sort_by_digest
= sort_by_digest_4_4
;
9764 opti_type
= OPTI_TYPE_ZERO_BYTE
9765 | OPTI_TYPE_PRECOMPUTE_INIT
9766 | OPTI_TYPE_NOT_ITERATED
;
9773 case 9900: hash_type
= HASH_TYPE_MD5
;
9774 salt_type
= SALT_TYPE_NONE
;
9775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9777 kern_type
= KERN_TYPE_RADMIN2
;
9778 dgst_size
= DGST_SIZE_4_4
;
9779 parse_func
= radmin2_parse_hash
;
9780 sort_by_digest
= sort_by_digest_4_4
;
9781 opti_type
= OPTI_TYPE_ZERO_BYTE
9782 | OPTI_TYPE_PRECOMPUTE_INIT
9783 | OPTI_TYPE_EARLY_SKIP
9784 | OPTI_TYPE_NOT_ITERATED
9785 | OPTI_TYPE_NOT_SALTED
;
9792 case 10000: hash_type
= HASH_TYPE_SHA256
;
9793 salt_type
= SALT_TYPE_EMBEDDED
;
9794 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9795 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9796 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9797 dgst_size
= DGST_SIZE_4_32
;
9798 parse_func
= djangopbkdf2_parse_hash
;
9799 sort_by_digest
= sort_by_digest_4_32
;
9800 opti_type
= OPTI_TYPE_ZERO_BYTE
9801 | OPTI_TYPE_SLOW_HASH_SIMD
;
9808 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9809 salt_type
= SALT_TYPE_EMBEDDED
;
9810 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9811 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9812 kern_type
= KERN_TYPE_SIPHASH
;
9813 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9814 parse_func
= siphash_parse_hash
;
9815 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9816 opti_type
= OPTI_TYPE_ZERO_BYTE
9817 | OPTI_TYPE_NOT_ITERATED
9818 | OPTI_TYPE_RAW_HASH
;
9825 case 10200: hash_type
= HASH_TYPE_MD5
;
9826 salt_type
= SALT_TYPE_EMBEDDED
;
9827 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9828 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9829 | OPTS_TYPE_ST_ADD80
9830 | OPTS_TYPE_ST_ADDBITS14
;
9831 kern_type
= KERN_TYPE_HMACMD5_PW
;
9832 dgst_size
= DGST_SIZE_4_4
;
9833 parse_func
= crammd5_parse_hash
;
9834 sort_by_digest
= sort_by_digest_4_4
;
9835 opti_type
= OPTI_TYPE_ZERO_BYTE
9836 | OPTI_TYPE_NOT_ITERATED
;
9843 case 10300: hash_type
= HASH_TYPE_SHA1
;
9844 salt_type
= SALT_TYPE_EMBEDDED
;
9845 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9846 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9847 kern_type
= KERN_TYPE_SAPH_SHA1
;
9848 dgst_size
= DGST_SIZE_4_5
;
9849 parse_func
= saph_sha1_parse_hash
;
9850 sort_by_digest
= sort_by_digest_4_5
;
9851 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9858 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9859 salt_type
= SALT_TYPE_EMBEDDED
;
9860 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9861 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9862 kern_type
= KERN_TYPE_PDF11
;
9863 dgst_size
= DGST_SIZE_4_4
;
9864 parse_func
= pdf11_parse_hash
;
9865 sort_by_digest
= sort_by_digest_4_4
;
9866 opti_type
= OPTI_TYPE_ZERO_BYTE
9867 | OPTI_TYPE_NOT_ITERATED
;
9874 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9875 salt_type
= SALT_TYPE_EMBEDDED
;
9876 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9877 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9878 kern_type
= KERN_TYPE_PDF11CM1
;
9879 dgst_size
= DGST_SIZE_4_4
;
9880 parse_func
= pdf11cm1_parse_hash
;
9881 sort_by_digest
= sort_by_digest_4_4
;
9882 opti_type
= OPTI_TYPE_ZERO_BYTE
9883 | OPTI_TYPE_NOT_ITERATED
;
9890 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9891 salt_type
= SALT_TYPE_EMBEDDED
;
9892 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9893 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9894 kern_type
= KERN_TYPE_PDF11CM2
;
9895 dgst_size
= DGST_SIZE_4_4
;
9896 parse_func
= pdf11cm2_parse_hash
;
9897 sort_by_digest
= sort_by_digest_4_4
;
9898 opti_type
= OPTI_TYPE_ZERO_BYTE
9899 | OPTI_TYPE_NOT_ITERATED
;
9906 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9907 salt_type
= SALT_TYPE_EMBEDDED
;
9908 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9909 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9910 kern_type
= KERN_TYPE_PDF14
;
9911 dgst_size
= DGST_SIZE_4_4
;
9912 parse_func
= pdf14_parse_hash
;
9913 sort_by_digest
= sort_by_digest_4_4
;
9914 opti_type
= OPTI_TYPE_ZERO_BYTE
9915 | OPTI_TYPE_NOT_ITERATED
;
9922 case 10600: hash_type
= HASH_TYPE_SHA256
;
9923 salt_type
= SALT_TYPE_EMBEDDED
;
9924 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9925 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9926 | OPTS_TYPE_ST_ADD80
9927 | OPTS_TYPE_ST_ADDBITS15
9928 | OPTS_TYPE_HASH_COPY
;
9929 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9930 dgst_size
= DGST_SIZE_4_8
;
9931 parse_func
= pdf17l3_parse_hash
;
9932 sort_by_digest
= sort_by_digest_4_8
;
9933 opti_type
= OPTI_TYPE_ZERO_BYTE
9934 | OPTI_TYPE_PRECOMPUTE_INIT
9935 | OPTI_TYPE_PRECOMPUTE_MERKLE
9936 | OPTI_TYPE_EARLY_SKIP
9937 | OPTI_TYPE_NOT_ITERATED
9938 | OPTI_TYPE_APPENDED_SALT
9939 | OPTI_TYPE_RAW_HASH
;
9946 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9947 salt_type
= SALT_TYPE_EMBEDDED
;
9948 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9950 | OPTS_TYPE_HASH_COPY
;
9951 kern_type
= KERN_TYPE_PDF17L8
;
9952 dgst_size
= DGST_SIZE_4_8
;
9953 parse_func
= pdf17l8_parse_hash
;
9954 sort_by_digest
= sort_by_digest_4_8
;
9955 opti_type
= OPTI_TYPE_ZERO_BYTE
9956 | OPTI_TYPE_NOT_ITERATED
;
9963 case 10800: hash_type
= HASH_TYPE_SHA384
;
9964 salt_type
= SALT_TYPE_NONE
;
9965 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9966 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9967 | OPTS_TYPE_PT_ADD80
9968 | OPTS_TYPE_PT_ADDBITS15
;
9969 kern_type
= KERN_TYPE_SHA384
;
9970 dgst_size
= DGST_SIZE_8_8
;
9971 parse_func
= sha384_parse_hash
;
9972 sort_by_digest
= sort_by_digest_8_8
;
9973 opti_type
= OPTI_TYPE_ZERO_BYTE
9974 | OPTI_TYPE_PRECOMPUTE_INIT
9975 | OPTI_TYPE_PRECOMPUTE_MERKLE
9976 | OPTI_TYPE_EARLY_SKIP
9977 | OPTI_TYPE_NOT_ITERATED
9978 | OPTI_TYPE_NOT_SALTED
9979 | OPTI_TYPE_USES_BITS_64
9980 | OPTI_TYPE_RAW_HASH
;
9987 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9988 salt_type
= SALT_TYPE_EMBEDDED
;
9989 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9990 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9991 | OPTS_TYPE_ST_BASE64
9992 | OPTS_TYPE_HASH_COPY
;
9993 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9994 dgst_size
= DGST_SIZE_4_32
;
9995 parse_func
= pbkdf2_sha256_parse_hash
;
9996 sort_by_digest
= sort_by_digest_4_32
;
9997 opti_type
= OPTI_TYPE_ZERO_BYTE
9998 | OPTI_TYPE_SLOW_HASH_SIMD
;
10005 case 11000: hash_type
= HASH_TYPE_MD5
;
10006 salt_type
= SALT_TYPE_INTERN
;
10007 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10008 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10009 | OPTS_TYPE_PT_ADD80
;
10010 kern_type
= KERN_TYPE_PRESTASHOP
;
10011 dgst_size
= DGST_SIZE_4_4
;
10012 parse_func
= prestashop_parse_hash
;
10013 sort_by_digest
= sort_by_digest_4_4
;
10014 opti_type
= OPTI_TYPE_ZERO_BYTE
10015 | OPTI_TYPE_PRECOMPUTE_INIT
10016 | OPTI_TYPE_NOT_ITERATED
10017 | OPTI_TYPE_PREPENDED_SALT
;
10024 case 11100: hash_type
= HASH_TYPE_MD5
;
10025 salt_type
= SALT_TYPE_EMBEDDED
;
10026 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10027 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10028 | OPTS_TYPE_ST_ADD80
;
10029 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10030 dgst_size
= DGST_SIZE_4_4
;
10031 parse_func
= postgresql_auth_parse_hash
;
10032 sort_by_digest
= sort_by_digest_4_4
;
10033 opti_type
= OPTI_TYPE_ZERO_BYTE
10034 | OPTI_TYPE_PRECOMPUTE_INIT
10035 | OPTI_TYPE_PRECOMPUTE_MERKLE
10036 | OPTI_TYPE_EARLY_SKIP
;
10043 case 11200: hash_type
= HASH_TYPE_SHA1
;
10044 salt_type
= SALT_TYPE_EMBEDDED
;
10045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10046 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10047 | OPTS_TYPE_PT_ADD80
10048 | OPTS_TYPE_ST_HEX
;
10049 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10050 dgst_size
= DGST_SIZE_4_5
;
10051 parse_func
= mysql_auth_parse_hash
;
10052 sort_by_digest
= sort_by_digest_4_5
;
10053 opti_type
= OPTI_TYPE_ZERO_BYTE
10054 | OPTI_TYPE_EARLY_SKIP
;
10061 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10062 salt_type
= SALT_TYPE_EMBEDDED
;
10063 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10064 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10066 | OPTS_TYPE_ST_ADD80
;
10067 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10068 dgst_size
= DGST_SIZE_4_4
;
10069 parse_func
= bitcoin_wallet_parse_hash
;
10070 sort_by_digest
= sort_by_digest_4_4
;
10071 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10078 case 11400: hash_type
= HASH_TYPE_MD5
;
10079 salt_type
= SALT_TYPE_EMBEDDED
;
10080 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10081 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10082 | OPTS_TYPE_PT_ADD80
10083 | OPTS_TYPE_HASH_COPY
;
10084 kern_type
= KERN_TYPE_SIP_AUTH
;
10085 dgst_size
= DGST_SIZE_4_4
;
10086 parse_func
= sip_auth_parse_hash
;
10087 sort_by_digest
= sort_by_digest_4_4
;
10088 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10095 case 11500: hash_type
= HASH_TYPE_CRC32
;
10096 salt_type
= SALT_TYPE_INTERN
;
10097 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10099 | OPTS_TYPE_ST_GENERATE_LE
10100 | OPTS_TYPE_ST_HEX
;
10101 kern_type
= KERN_TYPE_CRC32
;
10102 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10103 parse_func
= crc32_parse_hash
;
10104 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10105 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10112 case 11600: hash_type
= HASH_TYPE_AES
;
10113 salt_type
= SALT_TYPE_EMBEDDED
;
10114 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10115 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10116 | OPTS_TYPE_PT_NEVERCRACK
;
10117 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10118 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10119 parse_func
= seven_zip_parse_hash
;
10120 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10121 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10128 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10129 salt_type
= SALT_TYPE_NONE
;
10130 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10131 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10132 | OPTS_TYPE_PT_ADD01
;
10133 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10134 dgst_size
= DGST_SIZE_4_8
;
10135 parse_func
= gost2012sbog_256_parse_hash
;
10136 sort_by_digest
= sort_by_digest_4_8
;
10137 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10144 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10145 salt_type
= SALT_TYPE_NONE
;
10146 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10147 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10148 | OPTS_TYPE_PT_ADD01
;
10149 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10150 dgst_size
= DGST_SIZE_4_16
;
10151 parse_func
= gost2012sbog_512_parse_hash
;
10152 sort_by_digest
= sort_by_digest_4_16
;
10153 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10160 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10161 salt_type
= SALT_TYPE_EMBEDDED
;
10162 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10164 | OPTS_TYPE_ST_BASE64
10165 | OPTS_TYPE_HASH_COPY
;
10166 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10167 dgst_size
= DGST_SIZE_4_32
;
10168 parse_func
= pbkdf2_md5_parse_hash
;
10169 sort_by_digest
= sort_by_digest_4_32
;
10170 opti_type
= OPTI_TYPE_ZERO_BYTE
10171 | OPTI_TYPE_SLOW_HASH_SIMD
;
10178 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10179 salt_type
= SALT_TYPE_EMBEDDED
;
10180 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10182 | OPTS_TYPE_ST_BASE64
10183 | OPTS_TYPE_HASH_COPY
;
10184 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10185 dgst_size
= DGST_SIZE_4_32
;
10186 parse_func
= pbkdf2_sha1_parse_hash
;
10187 sort_by_digest
= sort_by_digest_4_32
;
10188 opti_type
= OPTI_TYPE_ZERO_BYTE
10189 | OPTI_TYPE_SLOW_HASH_SIMD
;
10196 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10197 salt_type
= SALT_TYPE_EMBEDDED
;
10198 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10199 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10200 | OPTS_TYPE_ST_BASE64
10201 | OPTS_TYPE_HASH_COPY
;
10202 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10203 dgst_size
= DGST_SIZE_8_16
;
10204 parse_func
= pbkdf2_sha512_parse_hash
;
10205 sort_by_digest
= sort_by_digest_8_16
;
10206 opti_type
= OPTI_TYPE_ZERO_BYTE
10207 | OPTI_TYPE_USES_BITS_64
10208 | OPTI_TYPE_SLOW_HASH_SIMD
;
10215 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10216 salt_type
= SALT_TYPE_EMBEDDED
;
10217 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10218 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10219 kern_type
= KERN_TYPE_ECRYPTFS
;
10220 dgst_size
= DGST_SIZE_8_8
;
10221 parse_func
= ecryptfs_parse_hash
;
10222 sort_by_digest
= sort_by_digest_8_8
;
10223 opti_type
= OPTI_TYPE_ZERO_BYTE
10224 | OPTI_TYPE_USES_BITS_64
;
10231 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10232 salt_type
= SALT_TYPE_EMBEDDED
;
10233 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10235 kern_type
= KERN_TYPE_ORACLET
;
10236 dgst_size
= DGST_SIZE_8_16
;
10237 parse_func
= oraclet_parse_hash
;
10238 sort_by_digest
= sort_by_digest_8_16
;
10239 opti_type
= OPTI_TYPE_ZERO_BYTE
10240 | OPTI_TYPE_USES_BITS_64
;
10247 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10248 salt_type
= SALT_TYPE_EMBEDDED
;
10249 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10250 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10251 kern_type
= KERN_TYPE_BSDICRYPT
;
10252 dgst_size
= DGST_SIZE_4_4
;
10253 parse_func
= bsdicrypt_parse_hash
;
10254 sort_by_digest
= sort_by_digest_4_4
;
10255 opti_type
= OPTI_TYPE_ZERO_BYTE
10256 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10263 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10264 salt_type
= SALT_TYPE_EMBEDDED
;
10265 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10266 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10267 kern_type
= KERN_TYPE_RAR3
;
10268 dgst_size
= DGST_SIZE_4_4
;
10269 parse_func
= rar3hp_parse_hash
;
10270 sort_by_digest
= sort_by_digest_4_4
;
10271 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10278 case 12600: hash_type
= HASH_TYPE_SHA256
;
10279 salt_type
= SALT_TYPE_INTERN
;
10280 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10281 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10282 | OPTS_TYPE_PT_ADD80
;
10283 kern_type
= KERN_TYPE_CF10
;
10284 dgst_size
= DGST_SIZE_4_8
;
10285 parse_func
= cf10_parse_hash
;
10286 sort_by_digest
= sort_by_digest_4_8
;
10287 opti_type
= OPTI_TYPE_ZERO_BYTE
10288 | OPTI_TYPE_PRECOMPUTE_INIT
10289 | OPTI_TYPE_EARLY_SKIP
10290 | OPTI_TYPE_NOT_ITERATED
;
10297 case 12700: hash_type
= HASH_TYPE_AES
;
10298 salt_type
= SALT_TYPE_EMBEDDED
;
10299 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10301 | OPTS_TYPE_HASH_COPY
;
10302 kern_type
= KERN_TYPE_MYWALLET
;
10303 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10304 parse_func
= mywallet_parse_hash
;
10305 sort_by_digest
= sort_by_digest_4_5
;
10306 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10313 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10314 salt_type
= SALT_TYPE_EMBEDDED
;
10315 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10316 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10317 kern_type
= KERN_TYPE_MS_DRSR
;
10318 dgst_size
= DGST_SIZE_4_8
;
10319 parse_func
= ms_drsr_parse_hash
;
10320 sort_by_digest
= sort_by_digest_4_8
;
10321 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10328 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10329 salt_type
= SALT_TYPE_EMBEDDED
;
10330 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10331 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10332 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10333 dgst_size
= DGST_SIZE_4_8
;
10334 parse_func
= androidfde_samsung_parse_hash
;
10335 sort_by_digest
= sort_by_digest_4_8
;
10336 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10343 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10344 salt_type
= SALT_TYPE_EMBEDDED
;
10345 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10346 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10347 kern_type
= KERN_TYPE_RAR5
;
10348 dgst_size
= DGST_SIZE_4_4
;
10349 parse_func
= rar5_parse_hash
;
10350 sort_by_digest
= sort_by_digest_4_4
;
10351 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10358 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10359 salt_type
= SALT_TYPE_EMBEDDED
;
10360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10362 kern_type
= KERN_TYPE_KRB5TGS
;
10363 dgst_size
= DGST_SIZE_4_4
;
10364 parse_func
= krb5tgs_parse_hash
;
10365 sort_by_digest
= sort_by_digest_4_4
;
10366 opti_type
= OPTI_TYPE_ZERO_BYTE
10367 | OPTI_TYPE_NOT_ITERATED
;
10374 case 13200: hash_type
= HASH_TYPE_AES
;
10375 salt_type
= SALT_TYPE_EMBEDDED
;
10376 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10378 kern_type
= KERN_TYPE_AXCRYPT
;
10379 dgst_size
= DGST_SIZE_4_4
;
10380 parse_func
= axcrypt_parse_hash
;
10381 sort_by_digest
= sort_by_digest_4_4
;
10382 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10389 case 13300: hash_type
= HASH_TYPE_SHA1
;
10390 salt_type
= SALT_TYPE_NONE
;
10391 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10392 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10393 | OPTS_TYPE_PT_ADD80
10394 | OPTS_TYPE_PT_ADDBITS15
;
10395 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10396 dgst_size
= DGST_SIZE_4_5
;
10397 parse_func
= sha1axcrypt_parse_hash
;
10398 sort_by_digest
= sort_by_digest_4_5
;
10399 opti_type
= OPTI_TYPE_ZERO_BYTE
10400 | OPTI_TYPE_PRECOMPUTE_INIT
10401 | OPTI_TYPE_EARLY_SKIP
10402 | OPTI_TYPE_NOT_ITERATED
10403 | OPTI_TYPE_NOT_SALTED
;
10410 case 13400: hash_type
= HASH_TYPE_AES
;
10411 salt_type
= SALT_TYPE_EMBEDDED
;
10412 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10414 kern_type
= KERN_TYPE_KEEPASS
;
10415 dgst_size
= DGST_SIZE_4_4
;
10416 parse_func
= keepass_parse_hash
;
10417 sort_by_digest
= sort_by_digest_4_4
;
10418 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10425 case 13500: hash_type
= HASH_TYPE_SHA1
;
10426 salt_type
= SALT_TYPE_EMBEDDED
;
10427 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10428 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10429 | OPTS_TYPE_PT_UNICODE
10430 | OPTS_TYPE_PT_ADD80
;
10431 kern_type
= KERN_TYPE_PSTOKEN
;
10432 dgst_size
= DGST_SIZE_4_5
;
10433 parse_func
= pstoken_parse_hash
;
10434 sort_by_digest
= sort_by_digest_4_5
;
10435 opti_type
= OPTI_TYPE_ZERO_BYTE
10436 | OPTI_TYPE_PRECOMPUTE_INIT
10437 | OPTI_TYPE_EARLY_SKIP
10438 | OPTI_TYPE_NOT_ITERATED
10439 | OPTI_TYPE_PREPENDED_SALT
10440 | OPTI_TYPE_RAW_HASH
;
10447 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10448 salt_type
= SALT_TYPE_EMBEDDED
;
10449 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10450 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10451 kern_type
= KERN_TYPE_ZIP2
;
10452 dgst_size
= DGST_SIZE_4_4
;
10453 parse_func
= zip2_parse_hash
;
10454 sort_by_digest
= sort_by_digest_4_4
;
10455 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10462 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10463 salt_type
= SALT_TYPE_EMBEDDED
;
10464 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10465 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10466 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10467 dgst_size
= DGST_SIZE_4_5
;
10468 parse_func
= veracrypt_parse_hash_655331
;
10469 sort_by_digest
= sort_by_digest_4_5
;
10470 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10477 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10478 salt_type
= SALT_TYPE_EMBEDDED
;
10479 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10480 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10481 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10482 dgst_size
= DGST_SIZE_4_5
;
10483 parse_func
= veracrypt_parse_hash_655331
;
10484 sort_by_digest
= sort_by_digest_4_5
;
10485 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10492 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10493 salt_type
= SALT_TYPE_EMBEDDED
;
10494 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10495 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10496 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10497 dgst_size
= DGST_SIZE_4_5
;
10498 parse_func
= veracrypt_parse_hash_655331
;
10499 sort_by_digest
= sort_by_digest_4_5
;
10500 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10507 case 13721: hash_type
= HASH_TYPE_SHA512
;
10508 salt_type
= SALT_TYPE_EMBEDDED
;
10509 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10510 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10511 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10512 dgst_size
= DGST_SIZE_8_8
;
10513 parse_func
= veracrypt_parse_hash_500000
;
10514 sort_by_digest
= sort_by_digest_8_8
;
10515 opti_type
= OPTI_TYPE_ZERO_BYTE
10516 | OPTI_TYPE_USES_BITS_64
;
10523 case 13722: hash_type
= HASH_TYPE_SHA512
;
10524 salt_type
= SALT_TYPE_EMBEDDED
;
10525 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10526 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10527 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10528 dgst_size
= DGST_SIZE_8_8
;
10529 parse_func
= veracrypt_parse_hash_500000
;
10530 sort_by_digest
= sort_by_digest_8_8
;
10531 opti_type
= OPTI_TYPE_ZERO_BYTE
10532 | OPTI_TYPE_USES_BITS_64
;
10539 case 13723: hash_type
= HASH_TYPE_SHA512
;
10540 salt_type
= SALT_TYPE_EMBEDDED
;
10541 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10542 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10543 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10544 dgst_size
= DGST_SIZE_8_8
;
10545 parse_func
= veracrypt_parse_hash_500000
;
10546 sort_by_digest
= sort_by_digest_8_8
;
10547 opti_type
= OPTI_TYPE_ZERO_BYTE
10548 | OPTI_TYPE_USES_BITS_64
;
10555 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10556 salt_type
= SALT_TYPE_EMBEDDED
;
10557 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10558 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10559 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10560 dgst_size
= DGST_SIZE_4_8
;
10561 parse_func
= veracrypt_parse_hash_500000
;
10562 sort_by_digest
= sort_by_digest_4_8
;
10563 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10570 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10571 salt_type
= SALT_TYPE_EMBEDDED
;
10572 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10573 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10574 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10575 dgst_size
= DGST_SIZE_4_8
;
10576 parse_func
= veracrypt_parse_hash_500000
;
10577 sort_by_digest
= sort_by_digest_4_8
;
10578 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10585 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10586 salt_type
= SALT_TYPE_EMBEDDED
;
10587 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10588 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10589 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10590 dgst_size
= DGST_SIZE_4_8
;
10591 parse_func
= veracrypt_parse_hash_500000
;
10592 sort_by_digest
= sort_by_digest_4_8
;
10593 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10600 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10601 salt_type
= SALT_TYPE_EMBEDDED
;
10602 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10603 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10604 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10605 dgst_size
= DGST_SIZE_4_5
;
10606 parse_func
= veracrypt_parse_hash_327661
;
10607 sort_by_digest
= sort_by_digest_4_5
;
10608 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10615 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10616 salt_type
= SALT_TYPE_EMBEDDED
;
10617 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10618 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10619 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10620 dgst_size
= DGST_SIZE_4_5
;
10621 parse_func
= veracrypt_parse_hash_327661
;
10622 sort_by_digest
= sort_by_digest_4_5
;
10623 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10630 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10631 salt_type
= SALT_TYPE_EMBEDDED
;
10632 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10633 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10634 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10635 dgst_size
= DGST_SIZE_4_5
;
10636 parse_func
= veracrypt_parse_hash_327661
;
10637 sort_by_digest
= sort_by_digest_4_5
;
10638 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10645 case 13751: hash_type
= HASH_TYPE_SHA256
;
10646 salt_type
= SALT_TYPE_EMBEDDED
;
10647 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10648 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10649 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10650 dgst_size
= DGST_SIZE_4_8
;
10651 parse_func
= veracrypt_parse_hash_500000
;
10652 sort_by_digest
= sort_by_digest_4_8
;
10653 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10660 case 13752: hash_type
= HASH_TYPE_SHA256
;
10661 salt_type
= SALT_TYPE_EMBEDDED
;
10662 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10664 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10665 dgst_size
= DGST_SIZE_4_8
;
10666 parse_func
= veracrypt_parse_hash_500000
;
10667 sort_by_digest
= sort_by_digest_4_8
;
10668 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10675 case 13753: hash_type
= HASH_TYPE_SHA256
;
10676 salt_type
= SALT_TYPE_EMBEDDED
;
10677 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10678 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10679 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10680 dgst_size
= DGST_SIZE_4_8
;
10681 parse_func
= veracrypt_parse_hash_500000
;
10682 sort_by_digest
= sort_by_digest_4_8
;
10683 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10690 case 13761: hash_type
= HASH_TYPE_SHA256
;
10691 salt_type
= SALT_TYPE_EMBEDDED
;
10692 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10693 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10694 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10695 dgst_size
= DGST_SIZE_4_8
;
10696 parse_func
= veracrypt_parse_hash_200000
;
10697 sort_by_digest
= sort_by_digest_4_8
;
10698 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10705 case 13762: hash_type
= HASH_TYPE_SHA256
;
10706 salt_type
= SALT_TYPE_EMBEDDED
;
10707 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10708 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10709 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10710 dgst_size
= DGST_SIZE_4_8
;
10711 parse_func
= veracrypt_parse_hash_200000
;
10712 sort_by_digest
= sort_by_digest_4_8
;
10713 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10720 case 13763: hash_type
= HASH_TYPE_SHA256
;
10721 salt_type
= SALT_TYPE_EMBEDDED
;
10722 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10723 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10724 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10725 dgst_size
= DGST_SIZE_4_8
;
10726 parse_func
= veracrypt_parse_hash_200000
;
10727 sort_by_digest
= sort_by_digest_4_8
;
10728 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10736 default: usage_mini_print (PROGNAME
); return (-1);
10743 data
.parse_func
= parse_func
;
10751 if (salt_type
== SALT_TYPE_INTERN
)
10753 opts_type
|= OPTS_TYPE_ST_HEX
;
10757 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10763 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10764 | (salt_type
== SALT_TYPE_EXTERN
)
10765 | (salt_type
== SALT_TYPE_EMBEDDED
)
10766 | (salt_type
== SALT_TYPE_VIRTUAL
));
10768 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10770 data
.hash_type
= hash_type
;
10771 data
.attack_mode
= attack_mode
;
10772 data
.attack_kern
= attack_kern
;
10773 data
.attack_exec
= attack_exec
;
10774 data
.kern_type
= kern_type
;
10775 data
.opts_type
= opts_type
;
10776 data
.dgst_size
= dgst_size
;
10777 data
.salt_type
= salt_type
;
10778 data
.isSalted
= isSalted
;
10779 data
.sort_by_digest
= sort_by_digest
;
10780 data
.dgst_pos0
= dgst_pos0
;
10781 data
.dgst_pos1
= dgst_pos1
;
10782 data
.dgst_pos2
= dgst_pos2
;
10783 data
.dgst_pos3
= dgst_pos3
;
10789 case 2500: esalt_size
= sizeof (wpa_t
); break;
10790 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10791 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10792 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10793 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10794 case 6211: esalt_size
= sizeof (tc_t
); break;
10795 case 6212: esalt_size
= sizeof (tc_t
); break;
10796 case 6213: esalt_size
= sizeof (tc_t
); break;
10797 case 6221: esalt_size
= sizeof (tc_t
); break;
10798 case 6222: esalt_size
= sizeof (tc_t
); break;
10799 case 6223: esalt_size
= sizeof (tc_t
); break;
10800 case 6231: esalt_size
= sizeof (tc_t
); break;
10801 case 6232: esalt_size
= sizeof (tc_t
); break;
10802 case 6233: esalt_size
= sizeof (tc_t
); break;
10803 case 6241: esalt_size
= sizeof (tc_t
); break;
10804 case 6242: esalt_size
= sizeof (tc_t
); break;
10805 case 6243: esalt_size
= sizeof (tc_t
); break;
10806 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10807 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10808 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10809 case 7300: esalt_size
= sizeof (rakp_t
); break;
10810 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10811 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10812 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10813 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10814 case 9400: esalt_size
= sizeof (office2007_t
); break;
10815 case 9500: esalt_size
= sizeof (office2010_t
); break;
10816 case 9600: esalt_size
= sizeof (office2013_t
); break;
10817 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10818 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10819 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10820 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10821 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10822 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10823 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10824 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10825 case 10400: esalt_size
= sizeof (pdf_t
); break;
10826 case 10410: esalt_size
= sizeof (pdf_t
); break;
10827 case 10420: esalt_size
= sizeof (pdf_t
); break;
10828 case 10500: esalt_size
= sizeof (pdf_t
); break;
10829 case 10600: esalt_size
= sizeof (pdf_t
); break;
10830 case 10700: esalt_size
= sizeof (pdf_t
); break;
10831 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10832 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10833 case 11400: esalt_size
= sizeof (sip_t
); break;
10834 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10835 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10836 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10837 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10838 case 13000: esalt_size
= sizeof (rar5_t
); break;
10839 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10840 case 13400: esalt_size
= sizeof (keepass_t
); break;
10841 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10842 case 13600: esalt_size
= sizeof (zip2_t
); break;
10843 case 13711: esalt_size
= sizeof (tc_t
); break;
10844 case 13712: esalt_size
= sizeof (tc_t
); break;
10845 case 13713: esalt_size
= sizeof (tc_t
); break;
10846 case 13721: esalt_size
= sizeof (tc_t
); break;
10847 case 13722: esalt_size
= sizeof (tc_t
); break;
10848 case 13723: esalt_size
= sizeof (tc_t
); break;
10849 case 13731: esalt_size
= sizeof (tc_t
); break;
10850 case 13732: esalt_size
= sizeof (tc_t
); break;
10851 case 13733: esalt_size
= sizeof (tc_t
); break;
10852 case 13741: esalt_size
= sizeof (tc_t
); break;
10853 case 13742: esalt_size
= sizeof (tc_t
); break;
10854 case 13743: esalt_size
= sizeof (tc_t
); break;
10855 case 13751: esalt_size
= sizeof (tc_t
); break;
10856 case 13752: esalt_size
= sizeof (tc_t
); break;
10857 case 13753: esalt_size
= sizeof (tc_t
); break;
10858 case 13761: esalt_size
= sizeof (tc_t
); break;
10859 case 13762: esalt_size
= sizeof (tc_t
); break;
10860 case 13763: esalt_size
= sizeof (tc_t
); break;
10863 data
.esalt_size
= esalt_size
;
10866 * choose dictionary parser
10869 if (hash_type
== HASH_TYPE_LM
)
10871 get_next_word_func
= get_next_word_lm
;
10873 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10875 get_next_word_func
= get_next_word_uc
;
10879 get_next_word_func
= get_next_word_std
;
10886 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10889 size_t dictstat_nmemb
= 0;
10893 uint dictstat_nmemb
= 0;
10896 char dictstat
[256] = { 0 };
10898 FILE *dictstat_fp
= NULL
;
10902 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10904 dictstat_fp
= fopen (dictstat
, "rb");
10909 struct stat tmpstat
;
10911 fstat (fileno (dictstat_fp
), &tmpstat
);
10915 struct stat64 tmpstat
;
10917 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10920 if (tmpstat
.st_mtime
< COMPTIME
)
10922 /* with v0.15 the format changed so we have to ensure user is using a good version
10923 since there is no version-header in the dictstat file */
10925 fclose (dictstat_fp
);
10931 while (!feof (dictstat_fp
))
10935 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
10937 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
10939 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
10941 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
10947 fclose (dictstat_fp
);
10956 char potfile
[256] = { 0 };
10958 if (potfile_path
== NULL
)
10960 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
10964 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
10967 data
.pot_fp
= NULL
;
10969 FILE *out_fp
= NULL
;
10970 FILE *pot_fp
= NULL
;
10972 if (show
== 1 || left
== 1)
10974 pot_fp
= fopen (potfile
, "rb");
10976 if (pot_fp
== NULL
)
10978 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10983 if (outfile
!= NULL
)
10985 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
10987 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11001 if (potfile_disable
== 0)
11003 pot_fp
= fopen (potfile
, "ab");
11005 if (pot_fp
== NULL
)
11007 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11012 data
.pot_fp
= pot_fp
;
11019 uint pot_avail
= 0;
11021 if (show
== 1 || left
== 1)
11023 SUPPRESS_OUTPUT
= 1;
11025 pot_avail
= count_lines (pot_fp
);
11029 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11031 uint pot_hashes_avail
= 0;
11035 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11037 while (!feof (pot_fp
))
11041 int line_len
= fgetl (pot_fp
, line_buf
);
11043 if (line_len
== 0) continue;
11045 char *plain_buf
= line_buf
+ line_len
;
11047 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11049 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11051 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11052 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11054 if (pot_cnt
== pot_hashes_avail
)
11058 for (pos
= 0; pos
< INCR_POT
; pos
++)
11060 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11062 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11064 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11066 tmp_hash
->digest
= mymalloc (dgst_size
);
11070 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11075 tmp_hash
->esalt
= mymalloc (esalt_size
);
11078 pot_hashes_avail
++;
11086 int iter
= MAX_CUT_TRIES
;
11090 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11092 if (line_buf
[i
] == ':')
11100 if (data
.hash_mode
!= 2500)
11102 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11106 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11108 if (line_len
> max_salt_size
)
11110 parser_status
= PARSER_GLOBAL_LENGTH
;
11114 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11116 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11118 hashes_buf
->salt
->salt_len
= line_len
;
11120 parser_status
= PARSER_OK
;
11124 // if NOT parsed without error, we add the ":" to the plain
11126 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11132 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11134 if (parser_status
< PARSER_GLOBAL_ZERO
)
11136 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11141 if (plain_len
>= 255) continue;
11143 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11145 pot_ptr
->plain_len
= plain_len
;
11154 SUPPRESS_OUTPUT
= 0;
11156 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11163 uint pw_min
= PW_MIN
;
11164 uint pw_max
= PW_MAX
;
11168 case 125: if (pw_max
> 32) pw_max
= 32;
11170 case 400: if (pw_max
> 40) pw_max
= 40;
11172 case 500: if (pw_max
> 16) pw_max
= 16;
11174 case 1500: if (pw_max
> 8) pw_max
= 8;
11176 case 1600: if (pw_max
> 16) pw_max
= 16;
11178 case 1800: if (pw_max
> 16) pw_max
= 16;
11180 case 2100: if (pw_max
> 16) pw_max
= 16;
11182 case 2500: if (pw_min
< 8) pw_min
= 8;
11184 case 3000: if (pw_max
> 7) pw_max
= 7;
11186 case 5200: if (pw_max
> 24) pw_max
= 24;
11188 case 5800: if (pw_max
> 16) pw_max
= 16;
11190 case 6300: if (pw_max
> 16) pw_max
= 16;
11192 case 7400: if (pw_max
> 16) pw_max
= 16;
11194 case 7500: if (pw_max
> 8) pw_max
= 8;
11196 case 7900: if (pw_max
> 48) pw_max
= 48;
11198 case 8500: if (pw_max
> 8) pw_max
= 8;
11200 case 8600: if (pw_max
> 16) pw_max
= 16;
11202 case 9710: pw_min
= 5;
11205 case 9810: pw_min
= 5;
11208 case 10410: pw_min
= 5;
11211 case 10300: if (pw_max
< 3) pw_min
= 3;
11212 if (pw_max
> 40) pw_max
= 40;
11214 case 10500: if (pw_max
< 3) pw_min
= 3;
11215 if (pw_max
> 40) pw_max
= 40;
11217 case 10700: if (pw_max
> 16) pw_max
= 16;
11219 case 11300: if (pw_max
> 40) pw_max
= 40;
11221 case 11600: if (pw_max
> 32) pw_max
= 32;
11223 case 12500: if (pw_max
> 20) pw_max
= 20;
11225 case 12800: if (pw_max
> 24) pw_max
= 24;
11229 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11231 switch (attack_kern
)
11233 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11235 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11241 * charsets : keep them together for more easy maintainnce
11244 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11245 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11247 mp_setup_sys (mp_sys
);
11249 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11250 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11251 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11252 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11255 * load hashes, part I: find input mode, count hashes
11258 uint hashlist_mode
= 0;
11259 uint hashlist_format
= HLFMT_HASHCAT
;
11261 uint hashes_avail
= 0;
11263 if (benchmark
== 0)
11267 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11269 if ((hash_mode
== 2500) ||
11270 (hash_mode
== 5200) ||
11271 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11272 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11273 (hash_mode
== 9000))
11275 hashlist_mode
= HL_MODE_ARG
;
11277 char *hashfile
= myargv
[optind
];
11279 data
.hashfile
= hashfile
;
11281 logfile_top_var_string ("target", hashfile
);
11284 if (hashlist_mode
== HL_MODE_ARG
)
11286 if (hash_mode
== 2500)
11290 if (stat (data
.hashfile
, &st
) == -1)
11292 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11297 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11304 else if (hashlist_mode
== HL_MODE_FILE
)
11306 char *hashfile
= myargv
[optind
];
11308 data
.hashfile
= hashfile
;
11310 logfile_top_var_string ("target", hashfile
);
11314 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11316 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11321 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11323 hashes_avail
= count_lines (fp
);
11327 if (hashes_avail
== 0)
11329 log_error ("ERROR: hashfile is empty or corrupt");
11336 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11338 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11340 log_error ("ERROR: remove not supported in native hashfile-format mode");
11352 hashlist_mode
= HL_MODE_ARG
;
11357 if (hash_mode
== 3000) hashes_avail
*= 2;
11359 data
.hashlist_mode
= hashlist_mode
;
11360 data
.hashlist_format
= hashlist_format
;
11362 logfile_top_uint (hashlist_mode
);
11363 logfile_top_uint (hashlist_format
);
11366 * load hashes, part II: allocate required memory, set pointers
11369 hash_t
*hashes_buf
= NULL
;
11370 void *digests_buf
= NULL
;
11371 salt_t
*salts_buf
= NULL
;
11372 void *esalts_buf
= NULL
;
11374 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11376 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11378 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11382 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11384 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11386 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11388 if (username
&& (remove
|| show
|| left
))
11390 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11395 hash_info
->orighash
= (char *) mymalloc (256);
11402 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11406 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11411 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11414 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11416 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11420 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11424 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11429 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11434 * load hashes, part III: parse hashes or generate them if benchmark
11437 uint hashes_cnt
= 0;
11439 if (benchmark
== 0)
11443 // useless to read hash file for keyspace, cheat a little bit w/ optind
11445 else if (hashes_avail
== 0)
11448 else if (hashlist_mode
== HL_MODE_ARG
)
11450 char *input_buf
= myargv
[optind
];
11452 uint input_len
= strlen (input_buf
);
11454 logfile_top_var_string ("target", input_buf
);
11456 char *hash_buf
= NULL
;
11459 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11461 bool hash_fmt_error
= 0;
11463 if (hash_len
< 1) hash_fmt_error
= 1;
11464 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11466 if (hash_fmt_error
)
11468 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11472 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11474 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11476 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11481 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11484 int parser_status
= PARSER_OK
;
11486 if (hash_mode
== 2500)
11490 log_error ("ERROR: hccap file not specified");
11495 hashlist_mode
= HL_MODE_FILE
;
11497 data
.hashlist_mode
= hashlist_mode
;
11499 FILE *fp
= fopen (hash_buf
, "rb");
11503 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11508 if (hashes_avail
< 1)
11510 log_error ("ERROR: hccap file is empty or corrupt");
11517 uint hccap_size
= sizeof (hccap_t
);
11519 char *in
= (char *) mymalloc (hccap_size
);
11523 int n
= fread (in
, hccap_size
, 1, fp
);
11527 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11532 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11534 if (parser_status
!= PARSER_OK
)
11536 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11541 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11543 if ((show
== 1) || (left
== 1))
11545 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11547 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11549 int cur_pos
= tmp_salt
->salt_len
;
11550 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11552 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11554 // do the appending task
11556 snprintf (salt_ptr
+ cur_pos
,
11558 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11570 wpa
->orig_mac2
[5]);
11572 // memset () the remaining part of the salt
11574 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11575 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11577 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11579 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11582 if (show
== 1) handle_show_request (pot
, pot_cnt
, (char *) hashes_buf
[hashes_cnt
].salt
->salt_buf
, hashes_buf
[hashes_cnt
].salt
->salt_len
, &hashes_buf
[hashes_cnt
], sort_by_salt_buf
, out_fp
);
11583 if (left
== 1) handle_left_request (pot
, pot_cnt
, (char *) hashes_buf
[hashes_cnt
].salt
->salt_buf
, hashes_buf
[hashes_cnt
].salt
->salt_len
, &hashes_buf
[hashes_cnt
], sort_by_salt_buf
, out_fp
);
11592 else if (hash_mode
== 3000)
11594 if (hash_len
== 32)
11596 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11598 hash_t
*lm_hash_left
= NULL
;
11600 if (parser_status
== PARSER_OK
)
11602 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11608 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11611 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11613 hash_t
*lm_hash_right
= NULL
;
11615 if (parser_status
== PARSER_OK
)
11617 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11623 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11628 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11630 if (show
== 1) handle_show_request_lm (pot
, pot_cnt
, input_buf
, input_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
11631 if (left
== 1) handle_left_request_lm (pot
, pot_cnt
, input_buf
, input_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
11636 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11638 if (parser_status
== PARSER_OK
)
11640 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11641 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11644 if (parser_status
== PARSER_OK
)
11650 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11656 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11658 if (parser_status
== PARSER_OK
)
11660 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11661 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11664 if (parser_status
== PARSER_OK
)
11670 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11675 else if (hashlist_mode
== HL_MODE_FILE
)
11677 char *hashfile
= data
.hashfile
;
11681 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11683 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11690 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11696 int line_len
= fgetl (fp
, line_buf
);
11698 if (line_len
== 0) continue;
11700 char *hash_buf
= NULL
;
11703 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11705 bool hash_fmt_error
= 0;
11707 if (hash_len
< 1) hash_fmt_error
= 1;
11708 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11710 if (hash_fmt_error
)
11712 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11719 char *user_buf
= NULL
;
11722 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11724 if (remove
|| show
)
11726 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11728 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11730 user_t
*user_ptr
= *user
;
11732 if (user_buf
!= NULL
)
11734 user_ptr
->user_name
= mystrdup (user_buf
);
11738 user_ptr
->user_name
= mystrdup ("");
11741 user_ptr
->user_len
= user_len
;
11745 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11747 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11749 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11754 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11757 if (hash_mode
== 3000)
11759 if (hash_len
== 32)
11761 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11763 if (parser_status
< PARSER_GLOBAL_ZERO
)
11765 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11770 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11774 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11776 if (parser_status
< PARSER_GLOBAL_ZERO
)
11778 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11783 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11785 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11791 if (show
== 1) handle_show_request_lm (pot
, pot_cnt
, line_buf
, line_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
11792 if (left
== 1) handle_left_request_lm (pot
, pot_cnt
, line_buf
, line_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
11796 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11798 if (parser_status
< PARSER_GLOBAL_ZERO
)
11800 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11805 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11807 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11808 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11815 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11817 if (parser_status
< PARSER_GLOBAL_ZERO
)
11819 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11824 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11826 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11827 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11837 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11839 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11846 hashes_buf
[0].salt
->salt_len
= 8;
11848 // special salt handling
11852 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11853 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11855 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11857 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11859 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11861 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11863 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11865 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11867 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11869 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11871 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11873 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11874 hashes_buf
[0].salt
->scrypt_N
= 1024;
11875 hashes_buf
[0].salt
->scrypt_r
= 1;
11876 hashes_buf
[0].salt
->scrypt_p
= 1;
11878 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11880 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11881 hashes_buf
[0].salt
->scrypt_N
= 16384;
11882 hashes_buf
[0].salt
->scrypt_r
= 1;
11883 hashes_buf
[0].salt
->scrypt_p
= 1;
11885 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11887 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11889 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11891 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11893 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11895 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11897 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11899 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11901 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11903 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11905 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11907 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11909 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11911 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11913 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11917 // special esalt handling
11921 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11923 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11924 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11926 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11927 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11929 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11930 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11931 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11932 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11934 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11935 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11936 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11937 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11939 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
11941 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11942 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11943 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11945 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11946 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11947 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11949 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11950 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11951 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11953 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11954 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11955 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11957 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11958 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11959 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11961 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11962 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11963 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11965 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
11966 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
11967 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
11969 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
11971 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
11973 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
11974 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
11975 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
11984 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
11986 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
11988 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
11990 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
11992 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
11994 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
11996 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
11998 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12000 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12002 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12004 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12006 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12008 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12010 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12012 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12014 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12016 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12018 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12020 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12022 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12024 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12026 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12028 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12030 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12032 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12034 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12036 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12038 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12040 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12042 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12044 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12046 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12048 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12050 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12052 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12054 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12058 // set default iterations
12062 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12064 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12066 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12068 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12070 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12072 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12074 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12076 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12078 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12080 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12082 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12084 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12086 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12088 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12090 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12092 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12094 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12096 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12098 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12100 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12102 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12104 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12106 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12108 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12110 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12112 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12114 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12116 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12118 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12120 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12122 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12124 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12126 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12128 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12130 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12132 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12134 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12136 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12138 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12140 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12142 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12144 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12146 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12148 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12150 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12152 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12154 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12156 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12158 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12160 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12162 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12164 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12166 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12168 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12170 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12172 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12174 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12176 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12178 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12180 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12182 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12184 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12186 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12188 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12190 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12192 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12194 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12196 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12198 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12200 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12202 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12204 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12206 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12208 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12210 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12212 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12214 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12216 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12218 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12220 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12222 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12224 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12231 if (show
== 1 || left
== 1)
12233 for (uint i
= 0; i
< pot_cnt
; i
++)
12235 pot_t
*pot_ptr
= &pot
[i
];
12237 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12239 local_free (hashes_buf
->digest
);
12243 local_free (hashes_buf
->salt
);
12249 if (data
.quiet
== 0) log_info_nn ("");
12256 if (hashes_cnt
== 0)
12258 log_error ("ERROR: No hashes loaded");
12265 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12268 if (data
.outfile
!= NULL
)
12270 if (data
.hashfile
!= NULL
)
12273 struct stat tmpstat_outfile
;
12274 struct stat tmpstat_hashfile
;
12278 struct stat64 tmpstat_outfile
;
12279 struct stat64 tmpstat_hashfile
;
12282 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12284 if (tmp_outfile_fp
)
12287 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12291 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12294 fclose (tmp_outfile_fp
);
12297 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12299 if (tmp_hashfile_fp
)
12302 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12306 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12309 fclose (tmp_hashfile_fp
);
12312 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12314 tmpstat_outfile
.st_mode
= 0;
12315 tmpstat_outfile
.st_nlink
= 0;
12316 tmpstat_outfile
.st_uid
= 0;
12317 tmpstat_outfile
.st_gid
= 0;
12318 tmpstat_outfile
.st_rdev
= 0;
12319 tmpstat_outfile
.st_atime
= 0;
12321 tmpstat_hashfile
.st_mode
= 0;
12322 tmpstat_hashfile
.st_nlink
= 0;
12323 tmpstat_hashfile
.st_uid
= 0;
12324 tmpstat_hashfile
.st_gid
= 0;
12325 tmpstat_hashfile
.st_rdev
= 0;
12326 tmpstat_hashfile
.st_atime
= 0;
12329 tmpstat_outfile
.st_blksize
= 0;
12330 tmpstat_outfile
.st_blocks
= 0;
12332 tmpstat_hashfile
.st_blksize
= 0;
12333 tmpstat_hashfile
.st_blocks
= 0;
12337 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12339 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12346 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12348 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12358 * Remove duplicates
12361 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12365 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12369 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12372 uint hashes_cnt_orig
= hashes_cnt
;
12376 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12380 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12382 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12387 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12390 if (hashes_pos
> hashes_cnt
)
12392 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12402 uint potfile_remove_cracks
= 0;
12404 if (potfile_disable
== 0)
12408 hash_buf
.digest
= mymalloc (dgst_size
);
12409 hash_buf
.salt
= NULL
;
12410 hash_buf
.esalt
= NULL
;
12411 hash_buf
.hash_info
= NULL
;
12412 hash_buf
.cracked
= 0;
12416 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12421 hash_buf
.esalt
= mymalloc (esalt_size
);
12424 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12426 // no solution for these special hash types (for instane because they use hashfile in output etc)
12427 if ((hash_mode
!= 5200) &&
12428 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12429 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12430 (hash_mode
!= 9000))
12432 FILE *fp
= fopen (potfile
, "rb");
12436 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12438 // to be safe work with a copy (because of line_len loop, i etc)
12439 // moved up here because it's easier to handle continue case
12442 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12446 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12448 if (ptr
== NULL
) break;
12450 int line_len
= strlen (line_buf
);
12452 if (line_len
== 0) continue;
12454 int iter
= MAX_CUT_TRIES
;
12456 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12458 if (line_buf
[i
] != ':') continue;
12462 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12465 hash_t
*found
= NULL
;
12467 if (hash_mode
== 6800)
12469 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12471 // manipulate salt_buf
12472 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12474 hash_buf
.salt
->salt_len
= i
;
12476 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12479 else if (hash_mode
== 2500)
12481 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12483 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12484 // manipulate salt_buf
12486 memcpy (line_buf_cpy
, line_buf
, i
);
12488 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12490 if (mac2_pos
== NULL
) continue;
12495 if (strlen (mac2_pos
) != 12) continue;
12497 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12499 if (mac1_pos
== NULL
) continue;
12504 if (strlen (mac1_pos
) != 12) continue;
12506 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12508 // here we need the ESSID
12509 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12511 hash_buf
.salt
->salt_len
= essid_length
;
12513 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12517 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12519 // compare hex string(s) vs binary MAC address(es)
12521 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12523 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12532 if (!found
) continue;
12534 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12536 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12548 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12550 if (parser_status
== PARSER_OK
)
12554 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12558 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12563 if (found
== NULL
) continue;
12565 if (!found
->cracked
) potfile_remove_cracks
++;
12567 found
->cracked
= 1;
12575 myfree (line_buf_cpy
);
12585 local_free (hash_buf
.esalt
);
12590 local_free (hash_buf
.salt
);
12593 local_free (hash_buf
.digest
);
12597 * Now generate all the buffers required for later
12600 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12602 salt_t
*salts_buf_new
= NULL
;
12603 void *esalts_buf_new
= NULL
;
12607 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12611 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12616 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12619 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12621 uint digests_cnt
= hashes_cnt
;
12622 uint digests_done
= 0;
12624 size_t size_digests
= digests_cnt
* dgst_size
;
12625 size_t size_shown
= digests_cnt
* sizeof (uint
);
12627 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12628 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12630 uint salts_cnt
= 0;
12631 uint salts_done
= 0;
12633 hashinfo_t
**hash_info
= NULL
;
12635 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12637 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12639 if (username
&& (remove
|| show
))
12643 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12645 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12647 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12652 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12657 // copied from inner loop
12659 salt_buf
= &salts_buf_new
[salts_cnt
];
12661 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12665 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12668 salt_buf
->digests_cnt
= 0;
12669 salt_buf
->digests_done
= 0;
12670 salt_buf
->digests_offset
= 0;
12675 if (hashes_buf
[0].cracked
== 1)
12677 digests_shown
[0] = 1;
12681 salt_buf
->digests_done
++;
12684 salt_buf
->digests_cnt
++;
12686 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12688 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12690 hash_info
[0] = hashes_buf
[0].hash_info
;
12693 // copy from inner loop
12695 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12699 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12701 salt_buf
= &salts_buf_new
[salts_cnt
];
12703 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12707 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12710 salt_buf
->digests_cnt
= 0;
12711 salt_buf
->digests_done
= 0;
12712 salt_buf
->digests_offset
= hashes_pos
;
12718 if (hashes_buf
[hashes_pos
].cracked
== 1)
12720 digests_shown
[hashes_pos
] = 1;
12724 salt_buf
->digests_done
++;
12727 salt_buf
->digests_cnt
++;
12729 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12731 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12733 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12737 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12739 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12741 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12743 salts_shown
[salt_pos
] = 1;
12748 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12751 local_free (digests_buf
);
12752 local_free (salts_buf
);
12753 local_free (esalts_buf
);
12755 digests_buf
= digests_buf_new
;
12756 salts_buf
= salts_buf_new
;
12757 esalts_buf
= esalts_buf_new
;
12759 local_free (hashes_buf
);
12762 * special modification not set from parser
12767 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12768 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12769 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12770 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12771 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12772 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12773 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12774 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12775 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12776 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12777 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12778 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12779 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12780 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12781 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12782 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12783 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12784 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12785 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12786 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12787 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12788 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12789 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12790 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12791 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12792 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12793 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12794 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12795 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12796 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12799 if (truecrypt_keyfiles
)
12801 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12803 char *keyfiles
= strdup (truecrypt_keyfiles
);
12805 char *keyfile
= strtok (keyfiles
, ",");
12809 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12811 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12816 if (veracrypt_keyfiles
)
12818 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12820 char *keyfiles
= strdup (veracrypt_keyfiles
);
12822 char *keyfile
= strtok (keyfiles
, ",");
12826 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12828 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12833 data
.digests_cnt
= digests_cnt
;
12834 data
.digests_done
= digests_done
;
12835 data
.digests_buf
= digests_buf
;
12836 data
.digests_shown
= digests_shown
;
12837 data
.digests_shown_tmp
= digests_shown_tmp
;
12839 data
.salts_cnt
= salts_cnt
;
12840 data
.salts_done
= salts_done
;
12841 data
.salts_buf
= salts_buf
;
12842 data
.salts_shown
= salts_shown
;
12844 data
.esalts_buf
= esalts_buf
;
12845 data
.hash_info
= hash_info
;
12848 * Automatic Optimizers
12851 if (salts_cnt
== 1)
12852 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12854 if (digests_cnt
== 1)
12855 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12857 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12858 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12860 if (attack_mode
== ATTACK_MODE_BF
)
12861 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12863 data
.opti_type
= opti_type
;
12865 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12867 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12869 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12871 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12873 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12874 opts_type
|= OPTS_TYPE_PT_ADD80
;
12877 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12879 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12880 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12883 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12885 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12886 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12893 * Some algorithm, like descrypt, can benefit from JIT compilation
12896 int force_jit_compilation
= -1;
12898 if (hash_mode
== 8900)
12900 force_jit_compilation
= 8900;
12902 else if (hash_mode
== 9300)
12904 force_jit_compilation
= 8900;
12906 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12908 force_jit_compilation
= 1500;
12912 * generate bitmap tables
12915 const uint bitmap_shift1
= 5;
12916 const uint bitmap_shift2
= 13;
12918 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12920 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12921 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12922 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12923 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12924 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12925 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12926 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12927 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12934 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12936 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12938 bitmap_nums
= 1 << bitmap_bits
;
12940 bitmap_mask
= bitmap_nums
- 1;
12942 bitmap_size
= bitmap_nums
* sizeof (uint
);
12944 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12946 if (generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift1
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, digests_cnt
/ 2) == 0x7fffffff) continue;
12947 if (generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift2
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, digests_cnt
/ 2) == 0x7fffffff) continue;
12952 bitmap_nums
= 1 << bitmap_bits
;
12954 bitmap_mask
= bitmap_nums
- 1;
12956 bitmap_size
= bitmap_nums
* sizeof (uint
);
12958 generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift1
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s1_a
, bitmap_s1_b
, bitmap_s1_c
, bitmap_s1_d
, -1);
12959 generate_bitmaps (digests_cnt
, dgst_size
, bitmap_shift2
, (char *) data
.digests_buf
, bitmap_mask
, bitmap_size
, bitmap_s2_a
, bitmap_s2_b
, bitmap_s2_c
, bitmap_s2_d
, -1);
12962 * prepare quick rule
12965 data
.rule_buf_l
= rule_buf_l
;
12966 data
.rule_buf_r
= rule_buf_r
;
12968 int rule_len_l
= (int) strlen (rule_buf_l
);
12969 int rule_len_r
= (int) strlen (rule_buf_r
);
12971 data
.rule_len_l
= rule_len_l
;
12972 data
.rule_len_r
= rule_len_r
;
12978 uint
*all_kernel_rules_cnt
= NULL
;
12980 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
12984 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12986 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
12989 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
12993 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12995 uint kernel_rules_avail
= 0;
12997 uint kernel_rules_cnt
= 0;
12999 kernel_rule_t
*kernel_rules_buf
= NULL
;
13001 char *rp_file
= rp_files
[i
];
13003 char in
[BLOCK_SIZE
] = { 0 };
13004 char out
[BLOCK_SIZE
] = { 0 };
13008 uint rule_line
= 0;
13010 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13012 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13019 memset (rule_buf
, 0, HCBUFSIZ
);
13021 rule_len
= fgetl (fp
, rule_buf
);
13025 if (rule_len
== 0) continue;
13027 if (rule_buf
[0] == '#') continue;
13029 if (kernel_rules_avail
== kernel_rules_cnt
)
13031 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13033 kernel_rules_avail
+= INCR_RULES
;
13036 memset (in
, 0, BLOCK_SIZE
);
13037 memset (out
, 0, BLOCK_SIZE
);
13039 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13043 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13048 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13050 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13052 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13058 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13060 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13066 kernel_rules_cnt
++;
13071 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13073 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13077 * merge rules or automatic rule generator
13080 uint kernel_rules_cnt
= 0;
13082 kernel_rule_t
*kernel_rules_buf
= NULL
;
13084 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13088 kernel_rules_cnt
= 1;
13090 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13092 repeats
[0] = kernel_rules_cnt
;
13094 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13096 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13098 repeats
[i
+ 1] = kernel_rules_cnt
;
13101 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13103 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13105 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13109 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13111 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13113 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13116 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13118 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13120 if (out_pos
== RULES_MAX
- 1)
13122 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13127 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13132 local_free (repeats
);
13136 uint kernel_rules_avail
= 0;
13138 while (kernel_rules_cnt
< rp_gen
)
13140 if (kernel_rules_avail
== kernel_rules_cnt
)
13142 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13144 kernel_rules_avail
+= INCR_RULES
;
13147 memset (rule_buf
, 0, HCBUFSIZ
);
13149 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13151 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13153 kernel_rules_cnt
++;
13161 * generate NOP rules
13164 if (kernel_rules_cnt
== 0)
13166 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13168 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13170 kernel_rules_cnt
++;
13173 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13174 data
.kernel_rules_buf
= kernel_rules_buf
;
13177 * OpenCL platforms: detect
13180 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13181 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13183 cl_uint platforms_cnt
= 0;
13184 cl_uint platform_devices_cnt
= 0;
13188 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13190 if (platforms_cnt
== 0)
13193 log_info ("ATTENTION! No OpenCL compatible platform found");
13195 log_info ("You're probably missing the OpenCL runtime installation");
13196 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13197 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13198 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13204 if (opencl_platforms_filter
!= (uint
) -1)
13206 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13208 if (opencl_platforms_filter
> platform_cnt_mask
)
13210 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13218 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13221 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13223 cl_platform_id platform
= platforms
[platform_id
];
13225 char platform_vendor
[INFOSZ
] = { 0 };
13227 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13230 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13231 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13233 // make sure that we do not directly control the fan for NVidia
13235 gpu_temp_retain
= 0;
13237 data
.gpu_temp_retain
= gpu_temp_retain
;
13239 #endif // HAVE_NVML || HAVE_NVAPI
13244 * OpenCL device types:
13245 * In case the user did not specify --opencl-device-types and the user runs hashcat in a system with only a CPU only he probably want to use that CPU.
13246 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13249 if (opencl_device_types
== NULL
)
13251 cl_device_type device_types_all
= 0;
13253 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13255 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13257 cl_platform_id platform
= platforms
[platform_id
];
13259 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13261 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13263 cl_device_id device
= platform_devices
[platform_devices_id
];
13265 cl_device_type device_type
;
13267 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13269 device_types_all
|= device_type
;
13273 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13275 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13280 * OpenCL devices: simply push all devices from all platforms into the same device array
13283 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13285 data
.devices_param
= devices_param
;
13287 uint devices_cnt
= 0;
13289 uint devices_active
= 0;
13291 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13293 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13295 cl_platform_id platform
= platforms
[platform_id
];
13297 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13299 char platform_vendor
[INFOSZ
] = { 0 };
13301 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13303 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13304 // this causes trouble with vendor id based macros
13305 // we'll assign generic to those without special optimization available
13307 cl_uint platform_vendor_id
= 0;
13309 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13311 platform_vendor_id
= VENDOR_ID_AMD
;
13313 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13315 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13317 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13319 platform_vendor_id
= VENDOR_ID_APPLE
;
13321 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13323 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13325 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13327 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13329 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13331 platform_vendor_id
= VENDOR_ID_MESA
;
13333 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13335 platform_vendor_id
= VENDOR_ID_NV
;
13337 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13339 platform_vendor_id
= VENDOR_ID_POCL
;
13343 platform_vendor_id
= VENDOR_ID_GENERIC
;
13346 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13348 size_t param_value_size
= 0;
13350 const uint device_id
= devices_cnt
;
13352 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13354 device_param
->platform_vendor_id
= platform_vendor_id
;
13356 device_param
->device
= platform_devices
[platform_devices_id
];
13358 device_param
->device_id
= device_id
;
13360 device_param
->platform_devices_id
= platform_devices_id
;
13364 cl_device_type device_type
;
13366 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13368 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13370 device_param
->device_type
= device_type
;
13374 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13376 char *device_name
= (char *) mymalloc (param_value_size
);
13378 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13380 device_param
->device_name
= device_name
;
13384 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13386 char *device_vendor
= (char *) mymalloc (param_value_size
);
13388 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13390 device_param
->device_vendor
= device_vendor
;
13392 cl_uint device_vendor_id
= 0;
13394 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13396 device_vendor_id
= VENDOR_ID_AMD
;
13398 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13400 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13402 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13404 device_vendor_id
= VENDOR_ID_APPLE
;
13406 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13408 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13410 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13412 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13414 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13416 device_vendor_id
= VENDOR_ID_MESA
;
13418 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13420 device_vendor_id
= VENDOR_ID_NV
;
13422 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13424 device_vendor_id
= VENDOR_ID_POCL
;
13428 device_vendor_id
= VENDOR_ID_GENERIC
;
13431 device_param
->device_vendor_id
= device_vendor_id
;
13435 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13439 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13441 char *device_version
= (char *) mymalloc (param_value_size
);
13443 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13445 device_param
->device_version
= device_version
;
13447 // device_opencl_version
13449 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13451 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13453 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13455 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13457 myfree (device_opencl_version
);
13461 cl_uint vector_width
;
13463 if (opencl_vector_width_chgd
== 0)
13465 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13467 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13469 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13473 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13478 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13483 vector_width
= opencl_vector_width
;
13486 if (vector_width
> 16) vector_width
= 16;
13488 device_param
->vector_width
= vector_width
;
13490 // max_compute_units
13492 cl_uint device_processors
;
13494 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13496 device_param
->device_processors
= device_processors
;
13498 // device_maxmem_alloc
13499 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13501 cl_ulong device_maxmem_alloc
;
13503 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13505 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13507 // device_global_mem
13509 cl_ulong device_global_mem
;
13511 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13513 device_param
->device_global_mem
= device_global_mem
;
13515 // max_work_group_size
13517 size_t device_maxworkgroup_size
;
13519 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13521 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13523 // max_clock_frequency
13525 cl_uint device_maxclock_frequency
;
13527 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13529 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13531 // device_endian_little
13533 cl_bool device_endian_little
;
13535 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13537 if (device_endian_little
== CL_FALSE
)
13539 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13541 device_param
->skipped
= 1;
13544 // device_available
13546 cl_bool device_available
;
13548 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13550 if (device_available
== CL_FALSE
)
13552 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13554 device_param
->skipped
= 1;
13557 // device_compiler_available
13559 cl_bool device_compiler_available
;
13561 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13563 if (device_compiler_available
== CL_FALSE
)
13565 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13567 device_param
->skipped
= 1;
13570 // device_execution_capabilities
13572 cl_device_exec_capabilities device_execution_capabilities
;
13574 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13576 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13578 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13580 device_param
->skipped
= 1;
13583 // device_extensions
13585 size_t device_extensions_size
;
13587 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13589 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13591 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13593 if (strstr (device_extensions
, "base_atomics") == 0)
13595 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13597 device_param
->skipped
= 1;
13600 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13602 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13604 device_param
->skipped
= 1;
13607 myfree (device_extensions
);
13609 // device_local_mem_size
13611 cl_ulong device_local_mem_size
;
13613 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13615 if (device_local_mem_size
< 32768)
13617 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13619 device_param
->skipped
= 1;
13622 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13623 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13624 // This results in both utilizing it for 50%
13625 // However, Intel has much better SIMD control over their own hardware
13626 // It makes sense to give them full control over their own hardware
13628 if (device_type
& CL_DEVICE_TYPE_CPU
)
13630 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13632 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13634 device_param
->skipped
= 1;
13640 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13641 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13645 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13647 char *driver_version
= (char *) mymalloc (param_value_size
);
13649 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13651 device_param
->driver_version
= driver_version
;
13653 // device_name_chksum
13655 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13658 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 64, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
13660 snprintf (device_name_chksum
, INFOSZ
- 1, "%u-%u-%u-%s-%s-%s-%u", 32, device_param
->platform_vendor_id
, device_param
->vector_width
, device_param
->device_name
, device_param
->device_version
, device_param
->driver_version
, COMPTIME
);
13663 uint device_name_digest
[4] = { 0 };
13665 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13667 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13669 device_param
->device_name_chksum
= device_name_chksum
;
13671 // device_processor_cores
13673 if (device_type
& CL_DEVICE_TYPE_CPU
)
13675 cl_uint device_processor_cores
= 1;
13677 device_param
->device_processor_cores
= device_processor_cores
;
13680 if (device_type
& CL_DEVICE_TYPE_GPU
)
13682 if (device_vendor_id
== VENDOR_ID_AMD
)
13684 cl_uint device_processor_cores
= 0;
13686 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13688 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13690 device_param
->device_processor_cores
= device_processor_cores
;
13692 else if (device_vendor_id
== VENDOR_ID_NV
)
13694 cl_uint kernel_exec_timeout
= 0;
13696 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13698 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13700 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13702 cl_uint device_processor_cores
= 0;
13704 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13706 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13708 device_param
->device_processor_cores
= device_processor_cores
;
13710 cl_uint sm_minor
= 0;
13711 cl_uint sm_major
= 0;
13713 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13714 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13716 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13717 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13719 device_param
->sm_minor
= sm_minor
;
13720 device_param
->sm_major
= sm_major
;
13724 cl_uint device_processor_cores
= 1;
13726 device_param
->device_processor_cores
= device_processor_cores
;
13732 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13734 if (machine_readable
== 0)
13736 if (device_param
->skipped
== 0)
13738 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %dMhz, %uMCU",
13741 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13742 (unsigned int) (device_global_mem
/ 1024 / 1024),
13743 (unsigned int) (device_maxclock_frequency
),
13744 (unsigned int) device_processors
);
13748 log_info ("Device #%u: %s, skipped",
13755 // common driver check
13757 if (device_param
->skipped
== 0)
13759 if (device_type
& CL_DEVICE_TYPE_GPU
)
13761 if (platform_vendor_id
== VENDOR_ID_AMD
)
13763 int catalyst_check
= (force
== 1) ? 0 : 1;
13765 int catalyst_warn
= 0;
13767 int catalyst_broken
= 0;
13769 if (catalyst_check
== 1)
13773 // v14.9 and higher
13774 if (atoi (device_param
->driver_version
) >= 1573)
13779 catalyst_check
= 0;
13782 if (catalyst_broken
== 1)
13785 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13786 log_info ("It will pass over cracked hashes and does not report them as cracked");
13787 log_info ("You are STRONGLY encouraged not to use it");
13788 log_info ("You can use --force to override this but do not post error reports if you do so");
13794 if (catalyst_warn
== 1)
13797 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13798 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13799 log_info ("See hashcat's homepage for official supported catalyst drivers");
13801 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13803 log_info ("You can use --force to override this but do not post error reports if you do so");
13809 else if (platform_vendor_id
== VENDOR_ID_NV
)
13811 if (device_param
->kernel_exec_timeout
!= 0)
13813 if (data
.quiet
== 0) log_info ("Device #%u: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id
+ 1);
13814 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13819 /* turns out pocl still creates segfaults (because of llvm)
13820 if (device_type & CL_DEVICE_TYPE_CPU)
13822 if (platform_vendor_id == VENDOR_ID_AMD)
13827 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13828 log_info ("You are STRONGLY encouraged not to use it");
13829 log_info ("You can use --force to override this but do not post error reports if you do so");
13830 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13840 * kernel accel and loops tuning db adjustment
13843 device_param
->kernel_accel_min
= 1;
13844 device_param
->kernel_accel_max
= 1024;
13846 device_param
->kernel_loops_min
= 1;
13847 device_param
->kernel_loops_max
= 1024;
13849 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13851 if (tuningdb_entry
)
13853 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13854 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13858 device_param
->kernel_accel_min
= _kernel_accel
;
13859 device_param
->kernel_accel_max
= _kernel_accel
;
13864 if (workload_profile
== 1)
13866 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13868 else if (workload_profile
== 2)
13870 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13873 device_param
->kernel_loops_min
= _kernel_loops
;
13874 device_param
->kernel_loops_max
= _kernel_loops
;
13878 // commandline parameters overwrite tuningdb entries
13882 device_param
->kernel_accel_min
= kernel_accel
;
13883 device_param
->kernel_accel_max
= kernel_accel
;
13888 device_param
->kernel_loops_min
= kernel_loops
;
13889 device_param
->kernel_loops_max
= kernel_loops
;
13905 if (keyspace
== 0 && devices_active
== 0)
13907 log_error ("ERROR: No devices found/left");
13912 // additional check to see if the user has chosen a device that is not within the range of available devices (i.e. larger than devices_cnt)
13914 if (devices_filter
!= (uint
) -1)
13916 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13918 if (devices_filter
> devices_cnt_mask
)
13920 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13926 data
.devices_cnt
= devices_cnt
;
13928 data
.devices_active
= devices_active
;
13930 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13932 if (machine_readable
== 0)
13943 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13944 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13948 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13951 if (gpu_temp_disable
== 0)
13953 #if defined(WIN) && defined(HAVE_NVAPI)
13954 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
13956 if (nvapi_init (nvapi
) == 0)
13957 data
.hm_nv
= nvapi
;
13961 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
13963 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13965 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
13969 for (int i
= 0; i
< tmp_in
; i
++)
13971 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
13974 for (int i
= 0; i
< tmp_out
; i
++)
13976 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
13978 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
13980 if (hm_NvAPI_GPU_GetCoolerSettings (data
.hm_nv
, hm_adapters_nv
[i
].adapter_index
.nv
, 0, &pCoolerSettings
) != NVAPI_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
13984 #endif // WIN && HAVE_NVAPI
13986 #if defined(LINUX) && defined(HAVE_NVML)
13987 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
13989 if (nvml_init (nvml
) == 0)
13994 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
13996 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13998 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
14002 for (int i
= 0; i
< tmp_in
; i
++)
14004 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
14007 for (int i
= 0; i
< tmp_out
; i
++)
14009 unsigned int speed
;
14011 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nv
, 1, hm_adapters_nv
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
14015 #endif // LINUX && HAVE_NVML
14017 data
.hm_amd
= NULL
;
14020 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14022 if (adl_init (adl
) == 0)
14027 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14029 // total number of adapters
14031 int hm_adapters_num
;
14033 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14037 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14039 if (lpAdapterInfo
== NULL
) return (-1);
14041 // get a list (of ids of) valid/usable adapters
14043 int num_adl_adapters
= 0;
14045 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14047 if (num_adl_adapters
> 0)
14049 hc_thread_mutex_lock (mux_adl
);
14051 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14053 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14055 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14056 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14058 hc_thread_mutex_unlock (mux_adl
);
14061 myfree (valid_adl_device_list
);
14062 myfree (lpAdapterInfo
);
14067 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14069 gpu_temp_disable
= 1;
14074 * OpenCL devices: allocate buffer for device specific information
14078 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14081 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14083 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14088 * enable custom signal handler(s)
14091 if (benchmark
== 0)
14093 hc_signal (sigHandler_default
);
14097 hc_signal (sigHandler_benchmark
);
14101 * User-defined GPU temp handling
14105 if (gpu_temp_disable
== 1)
14107 gpu_temp_abort
= 0;
14108 gpu_temp_retain
= 0;
14111 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14113 if (gpu_temp_abort
< gpu_temp_retain
)
14115 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14121 data
.gpu_temp_disable
= gpu_temp_disable
;
14122 data
.gpu_temp_abort
= gpu_temp_abort
;
14123 data
.gpu_temp_retain
= gpu_temp_retain
;
14130 if (data
.quiet
== 0)
14132 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14134 log_info ("Bitmaps: %u bits, %u entries, 0x%08x mask, %u bytes, %u/%u rotates", bitmap_bits
, bitmap_nums
, bitmap_mask
, bitmap_size
, bitmap_shift1
, bitmap_shift2
);
14136 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14138 log_info ("Rules: %u", kernel_rules_cnt
);
14143 log_info ("Applicable Optimizers:");
14145 for (uint i
= 0; i
< 32; i
++)
14147 const uint opti_bit
= 1u << i
;
14149 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14154 * Watchdog and Temperature balance
14158 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14160 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14163 if (gpu_temp_abort
== 0)
14165 log_info ("Watchdog: Temperature abort trigger disabled");
14169 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14172 if (gpu_temp_retain
== 0)
14174 log_info ("Watchdog: Temperature retain trigger disabled");
14178 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14181 if (data
.quiet
== 0) log_info ("");
14189 if (gpu_temp_disable
== 0)
14191 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14193 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14195 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14197 if (device_param
->skipped
) continue;
14199 const uint platform_devices_id
= device_param
->platform_devices_id
;
14201 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14202 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14204 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14209 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14211 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14219 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14220 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14221 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14222 * Driver / ADL bug?
14226 if (powertune_enable
== 1)
14228 hc_thread_mutex_lock (mux_adl
);
14230 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14232 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14234 if (device_param
->skipped
) continue;
14236 if (data
.hm_device
[device_id
].od_version
== 6)
14238 // set powertune value only
14240 int powertune_supported
= 0;
14244 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14246 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14251 if (powertune_supported
!= 0)
14254 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14256 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14258 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14263 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14265 log_error ("ERROR: Failed to set new ADL PowerControl values");
14273 hc_thread_mutex_unlock (mux_adl
);
14276 #endif // HAVE_HWMON
14279 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14282 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14284 uint kernel_power_all
= 0;
14286 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14292 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14294 if (device_param
->skipped
) continue;
14297 * device properties
14300 const char *device_name_chksum
= device_param
->device_name_chksum
;
14301 const u32 device_processors
= device_param
->device_processors
;
14302 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14305 * create context for each device
14308 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14311 * create command-queue
14314 // not supported with NV
14315 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14317 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14320 * kernel threads: some algorithms need a fixed kernel-threads count
14321 * because of shared memory usage or bitslice
14322 * there needs to be some upper limit, otherwise there's too much overhead
14325 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14327 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14329 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14332 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14333 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14334 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14335 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14336 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14337 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14338 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14339 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14340 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14341 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14342 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14343 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14344 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14347 * create input buffers on device : calculate size of fixed memory buffers
14350 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14351 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14353 device_param
->size_root_css
= size_root_css
;
14354 device_param
->size_markov_css
= size_markov_css
;
14356 size_t size_results
= sizeof (uint
);
14358 device_param
->size_results
= size_results
;
14360 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14361 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14363 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14364 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14365 size_t size_esalts
= salts_cnt
* esalt_size
;
14367 device_param
->size_plains
= size_plains
;
14368 device_param
->size_digests
= size_digests
;
14369 device_param
->size_shown
= size_shown
;
14370 device_param
->size_salts
= size_salts
;
14372 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14373 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14374 size_t size_tm
= 32 * sizeof (bs_word_t
);
14378 size_t size_scryptV
= 1;
14380 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14382 uint tmto_start
= 0;
14383 uint tmto_stop
= 10;
14387 tmto_start
= scrypt_tmto
;
14391 // in case the user did not specify the tmto manually
14392 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14393 // but set the lower end only in case the user has a device with too less memory
14395 if (hash_mode
== 8900)
14397 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14401 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14406 else if (hash_mode
== 9300)
14408 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14412 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14419 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14421 // TODO: in theory the following calculation needs to be done per salt, not global
14422 // we assume all hashes have the same scrypt settings
14424 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14426 size_scryptV
/= 1 << tmto
;
14428 size_scryptV
*= device_processors
* device_processor_cores
;
14430 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14432 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14437 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14439 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14440 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14446 if (data
.salts_buf
[0].scrypt_phy
== 0)
14448 log_error ("ERROR: can't allocate enough device memory");
14453 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14457 * some algorithms need a fixed kernel-loops count
14460 if (hash_mode
== 1500)
14462 const u32 kernel_loops_fixed
= 1024;
14464 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14465 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14468 if (hash_mode
== 3000)
14470 const u32 kernel_loops_fixed
= 1024;
14472 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14473 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14476 if (hash_mode
== 8900)
14478 const u32 kernel_loops_fixed
= 1;
14480 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14481 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14484 if (hash_mode
== 9300)
14486 const u32 kernel_loops_fixed
= 1;
14488 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14489 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14492 if (hash_mode
== 12500)
14494 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14496 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14497 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14501 * some algorithms have a maximum kernel-loops count
14504 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14506 u32 innerloop_cnt
= 0;
14508 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14510 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14511 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14512 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14516 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14519 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14520 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14522 device_param
->kernel_loops_max
= innerloop_cnt
;
14526 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14527 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14529 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14531 size_t size_pws
= 4;
14532 size_t size_tmps
= 4;
14533 size_t size_hooks
= 4;
14535 while (kernel_accel_max
>= kernel_accel_min
)
14537 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14541 size_pws
= kernel_power_max
* sizeof (pw_t
);
14547 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14548 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14549 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14550 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14551 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14552 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14553 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14554 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14555 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14556 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14557 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14558 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14559 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14560 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14561 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14562 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14563 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14564 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14565 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14566 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14567 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14568 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14569 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14570 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14571 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14572 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14573 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14574 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14575 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14576 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14577 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14578 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14579 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14580 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14581 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14582 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14583 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14584 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14585 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14586 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14587 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14588 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14589 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14590 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14591 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14592 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14593 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14594 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14595 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14596 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14597 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14598 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14599 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14600 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14601 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14602 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14603 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14604 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14605 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14606 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14607 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14608 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14609 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14610 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14611 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14612 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14613 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14614 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14615 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14616 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14617 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14618 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14619 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14620 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14621 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14622 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14623 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14624 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14625 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14626 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14627 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14628 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14633 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14638 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14639 // if not, decrease amplifier and try again
14643 const u64 size_total
14660 + size_pws
// not a bug
14671 // Don't ask me, ask AMD!
14673 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14674 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14678 kernel_accel_max
--;
14687 if (kernel_accel_max == 0)
14689 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14695 device_param
->kernel_accel_min
= kernel_accel_min
;
14696 device_param
->kernel_accel_max
= kernel_accel_max
;
14699 if (kernel_accel_max < kernel_accel)
14701 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14703 device_param->kernel_accel = kernel_accel_max;
14707 device_param
->size_bfs
= size_bfs
;
14708 device_param
->size_combs
= size_combs
;
14709 device_param
->size_rules
= size_rules
;
14710 device_param
->size_rules_c
= size_rules_c
;
14711 device_param
->size_pws
= size_pws
;
14712 device_param
->size_tmps
= size_tmps
;
14713 device_param
->size_hooks
= size_hooks
;
14715 // do not confuse kernel_accel_max with kernel_accel here
14717 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14719 device_param
->kernel_threads
= kernel_threads
;
14720 device_param
->kernel_power_user
= kernel_power
;
14722 kernel_power_all
+= kernel_power
;
14725 * default building options
14728 char build_opts
[1024] = { 0 };
14730 // we don't have sm_* on vendors not NV but it doesn't matter
14733 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\\OpenCL\\\" -I '%s\\OpenCL\\' -I %s\\OpenCL\\ -I\"%s\\OpenCL\\\" -I'%s\\OpenCL\\' -I%s\\OpenCL\\", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14735 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s/OpenCL/\" -I '%s/OpenCL/' -I %s/OpenCL/ -I\"%s/OpenCL/\" -I'%s/OpenCL/' -I%s/OpenCL/", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14738 char build_opts_new
[1024] = { 0 };
14740 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -DVENDOR_ID=%u -DCUDA_ARCH=%d -DVECT_SIZE=%u -DDEVICE_TYPE=%u -DKERN_TYPE=%u -D_unroll -cl-std=CL1.1", build_opts
, device_param
->device_vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
, device_param
->vector_width
, (u32
) device_param
->device_type
, kern_type
);
14742 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14745 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14747 // we do vectorizing much better than the auto-vectorizer
14749 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14751 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14756 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14765 * kernel source filename
14768 char source_file
[256] = { 0 };
14770 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14774 if (stat (source_file
, &sst
) == -1)
14776 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14782 * kernel cached filename
14785 char cached_file
[256] = { 0 };
14787 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14793 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14799 * kernel compile or load
14802 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14804 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14806 if (force_jit_compilation
== -1)
14810 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14812 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14814 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14816 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14819 size_t build_log_size
= 0;
14821 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14823 if (build_log_size
> 1)
14825 char *build_log
= (char *) malloc (build_log_size
+ 1);
14827 memset (build_log
, 0, build_log_size
+ 1);
14829 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14839 device_param
->skipped
= true;
14841 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14846 size_t binary_size
;
14848 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14850 u8
*binary
= (u8
*) mymalloc (binary_size
);
14852 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14854 writeProgramBin (cached_file
, binary
, binary_size
);
14856 local_free (binary
);
14861 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14864 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14866 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14868 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14874 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14877 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14879 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14881 char build_opts_update
[1024] = { 0 };
14883 if (force_jit_compilation
== 1500)
14885 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14887 else if (force_jit_compilation
== 8900)
14889 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.salts_buf
[0].scrypt_tmto
);
14893 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14896 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14899 size_t build_log_size
= 0;
14901 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14903 if (build_log_size
> 1)
14905 char *build_log
= (char *) malloc (build_log_size
+ 1);
14907 memset (build_log
, 0, build_log_size
+ 1);
14909 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14919 device_param
->skipped
= true;
14921 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14925 local_free (kernel_lengths
);
14926 local_free (kernel_sources
[0]);
14927 local_free (kernel_sources
);
14931 * word generator kernel
14934 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14937 * kernel mp source filename
14940 char source_file
[256] = { 0 };
14942 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14946 if (stat (source_file
, &sst
) == -1)
14948 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14954 * kernel mp cached filename
14957 char cached_file
[256] = { 0 };
14959 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
14965 if (stat (cached_file
, &cst
) == -1)
14971 * kernel compile or load
14974 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14976 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14980 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14981 if (quiet
== 0) log_info ("");
14983 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14985 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14987 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14991 device_param
->skipped
= true;
14993 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14998 size_t binary_size
;
15000 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15002 u8
*binary
= (u8
*) mymalloc (binary_size
);
15004 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15006 writeProgramBin (cached_file
, binary
, binary_size
);
15008 local_free (binary
);
15013 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15016 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15018 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15020 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15023 local_free (kernel_lengths
);
15024 local_free (kernel_sources
[0]);
15025 local_free (kernel_sources
);
15032 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15039 * kernel amp source filename
15042 char source_file
[256] = { 0 };
15044 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15048 if (stat (source_file
, &sst
) == -1)
15050 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15056 * kernel amp cached filename
15059 char cached_file
[256] = { 0 };
15061 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15067 if (stat (cached_file
, &cst
) == -1)
15073 * kernel compile or load
15076 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15078 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15082 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15083 if (quiet
== 0) log_info ("");
15085 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15087 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15089 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15093 device_param
->skipped
= true;
15095 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15100 size_t binary_size
;
15102 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15104 u8
*binary
= (u8
*) mymalloc (binary_size
);
15106 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15108 writeProgramBin (cached_file
, binary
, binary_size
);
15110 local_free (binary
);
15115 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15118 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15120 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15122 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15125 local_free (kernel_lengths
);
15126 local_free (kernel_sources
[0]);
15127 local_free (kernel_sources
);
15130 // some algorithm collide too fast, make that impossible
15132 if (benchmark
== 1)
15134 ((uint
*) digests_buf
)[0] = -1;
15135 ((uint
*) digests_buf
)[1] = -1;
15136 ((uint
*) digests_buf
)[2] = -1;
15137 ((uint
*) digests_buf
)[3] = -1;
15144 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15145 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15146 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15147 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15148 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15149 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15150 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15151 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15152 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15153 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15154 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15155 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15156 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15157 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15158 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15159 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15160 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15161 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15163 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
15164 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
15165 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
15166 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
15167 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
15168 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
15169 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
15170 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
15171 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15172 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15173 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15179 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15181 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15182 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15184 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15186 else if (attack_kern
== ATTACK_KERN_COMBI
)
15188 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15189 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15190 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15191 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15193 else if (attack_kern
== ATTACK_KERN_BF
)
15195 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15196 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15197 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15198 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15199 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15204 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15206 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15213 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15215 device_param
->pws_buf
= pws_buf
;
15217 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15219 device_param
->combs_buf
= combs_buf
;
15221 void *hooks_buf
= mymalloc (size_hooks
);
15223 device_param
->hooks_buf
= hooks_buf
;
15229 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15230 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15231 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15232 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15233 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15234 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15235 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15236 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15237 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15238 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15239 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15241 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15242 ? &device_param
->d_pws_buf
15243 : &device_param
->d_pws_amp_buf
;
15244 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15245 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15246 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15247 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15248 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15249 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15250 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15251 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15252 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15253 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15254 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15255 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15256 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15257 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15258 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15259 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15260 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15261 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15262 device_param
->kernel_params
[19] = &device_param
->d_result
;
15263 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15264 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15265 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15266 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15267 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15268 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15269 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15270 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15271 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15272 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15273 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15274 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15276 device_param
->kernel_params_mp_buf64
[3] = 0;
15277 device_param
->kernel_params_mp_buf32
[4] = 0;
15278 device_param
->kernel_params_mp_buf32
[5] = 0;
15279 device_param
->kernel_params_mp_buf32
[6] = 0;
15280 device_param
->kernel_params_mp_buf32
[7] = 0;
15281 device_param
->kernel_params_mp_buf32
[8] = 0;
15283 device_param
->kernel_params_mp
[0] = NULL
;
15284 device_param
->kernel_params_mp
[1] = NULL
;
15285 device_param
->kernel_params_mp
[2] = NULL
;
15286 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15287 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15288 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15289 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15290 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15291 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15293 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15294 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15295 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15296 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15297 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15298 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15299 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15301 device_param
->kernel_params_mp_l
[0] = NULL
;
15302 device_param
->kernel_params_mp_l
[1] = NULL
;
15303 device_param
->kernel_params_mp_l
[2] = NULL
;
15304 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15305 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15306 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15307 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15308 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15309 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15310 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15312 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15313 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15314 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15315 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15316 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15317 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15319 device_param
->kernel_params_mp_r
[0] = NULL
;
15320 device_param
->kernel_params_mp_r
[1] = NULL
;
15321 device_param
->kernel_params_mp_r
[2] = NULL
;
15322 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15323 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15324 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15325 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15326 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15327 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15329 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15330 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15332 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15333 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15334 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15335 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15336 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15337 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15338 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15340 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15341 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15343 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15344 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15346 device_param
->kernel_params_memset
[0] = NULL
;
15347 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15348 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15354 size_t kernel_wgs_tmp
;
15356 char kernel_name
[64] = { 0 };
15358 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15360 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15362 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15364 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15366 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15368 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15370 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15372 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15376 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15378 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15380 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15382 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15384 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15386 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15389 if (data
.attack_mode
== ATTACK_MODE_BF
)
15391 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15393 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15395 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15397 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_tm
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15403 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15405 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15407 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15409 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15411 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15413 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15415 if (opts_type
& OPTS_TYPE_HOOK12
)
15417 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15419 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15421 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel12
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15424 if (opts_type
& OPTS_TYPE_HOOK23
)
15426 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15428 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15430 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel23
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15434 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel1
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15435 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel2
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15436 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel3
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15438 for (uint i
= 0; i
<= 20; i
++)
15440 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15441 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15442 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15444 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15445 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15448 for (uint i
= 21; i
<= 31; i
++)
15450 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15451 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15452 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15454 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15455 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15460 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15462 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_memset
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15464 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15465 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15466 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15470 if (attack_mode
== ATTACK_MODE_BF
)
15472 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15473 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15475 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp_l
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15476 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp_r
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15478 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15480 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15481 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15484 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15486 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15488 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15490 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15492 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15494 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_mp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15497 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15503 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15505 hc_clGetKernelWorkGroupInfo (data
.ocl
, device_param
->kernel_amp
, device_param
->device
, CL_KERNEL_WORK_GROUP_SIZE
, sizeof (size_t), &kernel_wgs_tmp
, NULL
); kernel_threads
= MIN (kernel_threads
, kernel_wgs_tmp
);
15508 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15514 for (uint i
= 0; i
< 5; i
++)
15516 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15519 for (uint i
= 5; i
< 7; i
++)
15521 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15525 // maybe this has been updated by clGetKernelWorkGroupInfo()
15526 // value can only be decreased, so we don't need to reallocate buffers
15528 device_param
->kernel_threads
= kernel_threads
;
15530 // zero some data buffers
15532 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15533 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15534 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15535 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15536 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15537 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15543 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15545 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15547 else if (attack_kern
== ATTACK_KERN_COMBI
)
15549 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15550 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15551 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15552 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15554 else if (attack_kern
== ATTACK_KERN_BF
)
15556 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15557 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15558 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15559 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15560 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15564 * Store initial fanspeed if gpu_temp_retain is enabled
15567 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15568 int gpu_temp_retain_set
= 0;
15570 if (gpu_temp_disable
== 0)
15572 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15574 hc_thread_mutex_lock (mux_adl
);
15576 if (data
.hm_device
[device_id
].fan_supported
== 1)
15578 if (gpu_temp_retain_chgd
== 0)
15581 uint default_temp
= 0;
15583 int ADL_rc
= hm_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
15585 if (ADL_rc
== ADL_OK
)
15587 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15589 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15591 // special case with multi gpu setups: always use minimum retain
15593 if (gpu_temp_retain_set
== 0)
15595 gpu_temp_retain
= gpu_temp_retain_target
;
15596 gpu_temp_retain_set
= 1;
15600 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15603 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15607 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15609 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15611 if (fan_speed
== -1)
15613 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15615 temp_retain_fanspeed_value
[device_id
] = 0;
15619 hc_thread_mutex_unlock (mux_adl
);
15624 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15627 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15629 hc_thread_mutex_lock (mux_adl
);
15631 if (data
.hm_device
[device_id
].od_version
== 6)
15635 // check powertune capabilities first, if not available then skip device
15637 int powertune_supported
= 0;
15639 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15641 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15646 if (powertune_supported
!= 0)
15648 // powercontrol settings
15650 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15652 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15654 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15657 if (ADL_rc
!= ADL_OK
)
15659 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15664 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15666 log_error ("ERROR: Failed to set new ADL PowerControl values");
15673 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15675 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15677 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15679 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15684 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15686 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15688 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15690 log_error ("ERROR: Failed to get ADL device capabilities");
15695 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15696 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15698 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15699 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15701 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15702 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15704 // warning if profile has too low max values
15706 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15708 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15711 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15713 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15716 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15718 performance_state
->iNumberOfPerformanceLevels
= 2;
15720 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15721 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15722 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15723 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15725 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15727 log_info ("ERROR: Failed to set ADL performance state");
15732 local_free (performance_state
);
15736 hc_thread_mutex_unlock (mux_adl
);
15738 #endif // HAVE_HWMON && HAVE_ADL
15741 data
.kernel_power_all
= kernel_power_all
;
15743 if (data
.quiet
== 0) log_info_nn ("");
15746 * In benchmark-mode, inform user which algorithm is checked
15749 if (benchmark
== 1)
15751 if (machine_readable
== 0)
15755 data
.quiet
= quiet
;
15757 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15759 log_info ("Hashtype: %s", hash_type
);
15765 * keep track of the progress
15768 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15769 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15770 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15777 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15779 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15784 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15786 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15791 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15793 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15803 segment_size
*= (1024 * 1024);
15805 data
.segment_size
= segment_size
;
15807 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15809 wl_data
->buf
= (char *) mymalloc (segment_size
);
15810 wl_data
->avail
= segment_size
;
15811 wl_data
->incr
= segment_size
;
15815 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15817 data
.wordlist_mode
= wordlist_mode
;
15819 cs_t
*css_buf
= NULL
;
15823 char **masks
= NULL
;
15824 char **dictfiles
= NULL
;
15826 uint mask_from_file
= 0;
15828 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15830 if (wordlist_mode
== WL_MODE_FILE
)
15832 int wls_left
= myargc
- (optind
+ 1);
15834 for (int i
= 0; i
< wls_left
; i
++)
15836 char *l0_filename
= myargv
[optind
+ 1 + i
];
15838 struct stat l0_stat
;
15840 if (stat (l0_filename
, &l0_stat
) == -1)
15842 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15847 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15851 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15855 dictfiles
[dictcnt
- 1] = l0_filename
;
15859 // do not allow --keyspace w/ a directory
15863 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15868 char **dictionary_files
= NULL
;
15870 dictionary_files
= scan_directory (l0_filename
);
15872 if (dictionary_files
!= NULL
)
15874 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15876 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15878 char *l1_filename
= dictionary_files
[d
];
15880 struct stat l1_stat
;
15882 if (stat (l1_filename
, &l1_stat
) == -1)
15884 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15889 if (S_ISREG (l1_stat
.st_mode
))
15891 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15895 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15900 local_free (dictionary_files
);
15906 log_error ("ERROR: No usable dictionary file found.");
15911 else if (wordlist_mode
== WL_MODE_STDIN
)
15916 else if (attack_mode
== ATTACK_MODE_COMBI
)
15920 char *dictfile1
= myargv
[optind
+ 1 + 0];
15921 char *dictfile2
= myargv
[optind
+ 1 + 1];
15923 // find the bigger dictionary and use as base
15928 struct stat tmp_stat
;
15930 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15932 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15937 if (stat (dictfile1
, &tmp_stat
) == -1)
15939 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15946 if (S_ISDIR (tmp_stat
.st_mode
))
15948 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
15955 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
15957 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15964 if (stat (dictfile2
, &tmp_stat
) == -1)
15966 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15974 if (S_ISDIR (tmp_stat
.st_mode
))
15976 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
15984 data
.combs_cnt
= 1;
15988 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
15990 data
.quiet
= quiet
;
15992 if (words1_cnt
== 0)
15994 log_error ("ERROR: %s: empty file", dictfile1
);
16002 data
.combs_cnt
= 1;
16006 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
16008 data
.quiet
= quiet
;
16010 if (words2_cnt
== 0)
16012 log_error ("ERROR: %s: empty file", dictfile2
);
16023 data
.dictfile
= dictfile1
;
16024 data
.dictfile2
= dictfile2
;
16026 if (words1_cnt
>= words2_cnt
)
16028 data
.combs_cnt
= words2_cnt
;
16029 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16031 dictfiles
= &data
.dictfile
;
16037 data
.combs_cnt
= words1_cnt
;
16038 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16040 dictfiles
= &data
.dictfile2
;
16044 // we also have to switch wordlist related rules!
16046 char *tmpc
= data
.rule_buf_l
;
16048 data
.rule_buf_l
= data
.rule_buf_r
;
16049 data
.rule_buf_r
= tmpc
;
16051 int tmpi
= data
.rule_len_l
;
16053 data
.rule_len_l
= data
.rule_len_r
;
16054 data
.rule_len_r
= tmpi
;
16057 else if (attack_mode
== ATTACK_MODE_BF
)
16063 if (benchmark
== 0)
16065 mask
= myargv
[optind
+ 1];
16067 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16069 if ((optind
+ 2) <= myargc
)
16071 struct stat file_stat
;
16073 if (stat (mask
, &file_stat
) == -1)
16077 masks
[maskcnt
- 1] = mystrdup (mask
);
16081 int wls_left
= myargc
- (optind
+ 1);
16083 uint masks_avail
= INCR_MASKS
;
16085 for (int i
= 0; i
< wls_left
; i
++)
16089 mask
= myargv
[optind
+ 1 + i
];
16091 if (stat (mask
, &file_stat
) == -1)
16093 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16099 uint is_file
= S_ISREG (file_stat
.st_mode
);
16105 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16107 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16112 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16114 while (!feof (mask_fp
))
16116 memset (line_buf
, 0, HCBUFSIZ
);
16118 int line_len
= fgetl (mask_fp
, line_buf
);
16120 if (line_len
== 0) continue;
16122 if (line_buf
[0] == '#') continue;
16124 if (masks_avail
== maskcnt
)
16126 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16128 masks_avail
+= INCR_MASKS
;
16131 masks
[maskcnt
] = mystrdup (line_buf
);
16142 log_error ("ERROR: %s: unsupported file-type", mask
);
16148 mask_from_file
= 1;
16153 custom_charset_1
= (char *) "?l?d?u";
16154 custom_charset_2
= (char *) "?l?d";
16155 custom_charset_3
= (char *) "?l?d*!$@_";
16157 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16158 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16159 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16161 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16163 wordlist_mode
= WL_MODE_MASK
;
16165 data
.wordlist_mode
= wordlist_mode
;
16175 * generate full masks and charsets
16178 masks
= (char **) mymalloc (sizeof (char *));
16182 case 1731: pw_min
= 5;
16184 mask
= mystrdup ("?b?b?b?b?b");
16186 case 12500: pw_min
= 5;
16188 mask
= mystrdup ("?b?b?b?b?b");
16190 default: pw_min
= 7;
16192 mask
= mystrdup ("?b?b?b?b?b?b?b");
16198 masks
[maskcnt
- 1] = mystrdup (mask
);
16200 wordlist_mode
= WL_MODE_MASK
;
16202 data
.wordlist_mode
= wordlist_mode
;
16207 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16211 if (increment_min
> pw_min
) pw_min
= increment_min
;
16213 if (increment_max
< pw_max
) pw_max
= increment_max
;
16216 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16218 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16222 char *mask
= myargv
[myargc
- 1];
16226 masks
= (char **) mymalloc (1 * sizeof (char *));
16230 struct stat file_stat
;
16232 if (stat (mask
, &file_stat
) == -1)
16236 masks
[maskcnt
- 1] = mystrdup (mask
);
16240 uint is_file
= S_ISREG (file_stat
.st_mode
);
16246 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16248 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16253 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16255 uint masks_avail
= 1;
16257 while (!feof (mask_fp
))
16259 memset (line_buf
, 0, HCBUFSIZ
);
16261 int line_len
= fgetl (mask_fp
, line_buf
);
16263 if (line_len
== 0) continue;
16265 if (line_buf
[0] == '#') continue;
16267 if (masks_avail
== maskcnt
)
16269 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16271 masks_avail
+= INCR_MASKS
;
16274 masks
[maskcnt
] = mystrdup (line_buf
);
16283 mask_from_file
= 1;
16289 masks
[maskcnt
- 1] = mystrdup (mask
);
16295 int wls_left
= myargc
- (optind
+ 2);
16297 for (int i
= 0; i
< wls_left
; i
++)
16299 char *filename
= myargv
[optind
+ 1 + i
];
16301 struct stat file_stat
;
16303 if (stat (filename
, &file_stat
) == -1)
16305 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16310 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16314 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16318 dictfiles
[dictcnt
- 1] = filename
;
16322 // do not allow --keyspace w/ a directory
16326 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16331 char **dictionary_files
= NULL
;
16333 dictionary_files
= scan_directory (filename
);
16335 if (dictionary_files
!= NULL
)
16337 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16339 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16341 char *l1_filename
= dictionary_files
[d
];
16343 struct stat l1_stat
;
16345 if (stat (l1_filename
, &l1_stat
) == -1)
16347 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16352 if (S_ISREG (l1_stat
.st_mode
))
16354 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16358 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16363 local_free (dictionary_files
);
16369 log_error ("ERROR: No usable dictionary file found.");
16378 uint mask_min
= increment_min
; // we can't reject smaller masks here
16379 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16381 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16383 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16385 if (cur_mask
== NULL
) break;
16387 masks
[maskcnt
] = cur_mask
;
16391 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16395 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16397 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16401 char *mask
= myargv
[optind
+ 1 + 0];
16405 masks
= (char **) mymalloc (1 * sizeof (char *));
16409 struct stat file_stat
;
16411 if (stat (mask
, &file_stat
) == -1)
16415 masks
[maskcnt
- 1] = mystrdup (mask
);
16419 uint is_file
= S_ISREG (file_stat
.st_mode
);
16425 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16427 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16432 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16434 uint masks_avail
= 1;
16436 while (!feof (mask_fp
))
16438 memset (line_buf
, 0, HCBUFSIZ
);
16440 int line_len
= fgetl (mask_fp
, line_buf
);
16442 if (line_len
== 0) continue;
16444 if (line_buf
[0] == '#') continue;
16446 if (masks_avail
== maskcnt
)
16448 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16450 masks_avail
+= INCR_MASKS
;
16453 masks
[maskcnt
] = mystrdup (line_buf
);
16462 mask_from_file
= 1;
16468 masks
[maskcnt
- 1] = mystrdup (mask
);
16474 int wls_left
= myargc
- (optind
+ 2);
16476 for (int i
= 0; i
< wls_left
; i
++)
16478 char *filename
= myargv
[optind
+ 2 + i
];
16480 struct stat file_stat
;
16482 if (stat (filename
, &file_stat
) == -1)
16484 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16489 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16493 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16497 dictfiles
[dictcnt
- 1] = filename
;
16501 // do not allow --keyspace w/ a directory
16505 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16510 char **dictionary_files
= NULL
;
16512 dictionary_files
= scan_directory (filename
);
16514 if (dictionary_files
!= NULL
)
16516 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16518 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16520 char *l1_filename
= dictionary_files
[d
];
16522 struct stat l1_stat
;
16524 if (stat (l1_filename
, &l1_stat
) == -1)
16526 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16531 if (S_ISREG (l1_stat
.st_mode
))
16533 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16537 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16542 local_free (dictionary_files
);
16548 log_error ("ERROR: No usable dictionary file found.");
16557 uint mask_min
= increment_min
; // we can't reject smaller masks here
16558 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16560 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16562 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16564 if (cur_mask
== NULL
) break;
16566 masks
[maskcnt
] = cur_mask
;
16570 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16575 data
.pw_min
= pw_min
;
16576 data
.pw_max
= pw_max
;
16582 if (weak_hash_threshold
>= salts_cnt
)
16584 hc_device_param_t
*device_param
= NULL
;
16586 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16588 device_param
= &data
.devices_param
[device_id
];
16590 if (device_param
->skipped
) continue;
16595 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16597 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16599 weak_hash_check (device_param
, salt_pos
);
16602 // Display hack, guarantee that there is at least one \r before real start
16604 //if (data.quiet == 0) log_info ("");
16608 * status and monitor threads
16611 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16613 hc_thread_t i_thread
= 0;
16615 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16617 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16620 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16622 uint ni_threads_cnt
= 0;
16624 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16626 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16636 if (outfile_check_timer
!= 0)
16638 if (data
.outfile_check_directory
!= NULL
)
16640 if ((hash_mode
!= 5200) &&
16641 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16642 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16643 (hash_mode
!= 9000))
16645 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16651 outfile_check_timer
= 0;
16656 outfile_check_timer
= 0;
16662 * Inform the user if we got some hashes remove because of the pot file remove feature
16665 if (data
.quiet
== 0)
16667 if (potfile_remove_cracks
> 0)
16669 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16670 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16674 data
.outfile_check_timer
= outfile_check_timer
;
16680 char **induction_dictionaries
= NULL
;
16682 int induction_dictionaries_cnt
= 0;
16684 hcstat_table_t
*root_table_buf
= NULL
;
16685 hcstat_table_t
*markov_table_buf
= NULL
;
16687 uint initial_restore_done
= 0;
16689 data
.maskcnt
= maskcnt
;
16691 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16693 if (data
.devices_status
== STATUS_CRACKED
) break;
16695 data
.devices_status
= STATUS_INIT
;
16697 if (maskpos
> rd
->maskpos
)
16702 rd
->maskpos
= maskpos
;
16703 data
.maskpos
= maskpos
;
16705 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16707 char *mask
= masks
[maskpos
];
16709 if (mask_from_file
== 1)
16711 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16716 uint mask_offset
= 0;
16718 uint separator_cnt
;
16720 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16722 str_ptr
= strstr (mask
+ mask_offset
, ",");
16724 if (str_ptr
== NULL
) break;
16726 str_pos
= str_ptr
- mask
;
16728 // escaped separator, i.e. "\,"
16732 if (mask
[str_pos
- 1] == '\\')
16736 mask_offset
= str_pos
+ 1;
16742 // reset the offset
16746 mask
[str_pos
] = '\0';
16748 switch (separator_cnt
)
16751 mp_reset_usr (mp_usr
, 0);
16753 custom_charset_1
= mask
;
16754 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16758 mp_reset_usr (mp_usr
, 1);
16760 custom_charset_2
= mask
;
16761 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16765 mp_reset_usr (mp_usr
, 2);
16767 custom_charset_3
= mask
;
16768 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16772 mp_reset_usr (mp_usr
, 3);
16774 custom_charset_4
= mask
;
16775 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16779 mask
= mask
+ str_pos
+ 1;
16783 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16787 local_free (css_buf
);
16788 local_free (data
.root_css_buf
);
16789 local_free (data
.markov_css_buf
);
16791 local_free (masks
[maskpos
- 1]);
16794 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16797 data
.css_cnt
= css_cnt
;
16798 data
.css_buf
= css_buf
;
16800 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16802 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16804 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16805 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16807 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16809 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16811 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16812 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16814 data
.root_css_buf
= root_css_buf
;
16815 data
.markov_css_buf
= markov_css_buf
;
16817 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16819 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16821 local_free (root_table_buf
);
16822 local_free (markov_table_buf
);
16826 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16828 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16830 if (device_param
->skipped
) continue;
16832 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16833 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16834 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16836 device_param
->kernel_params_mp_buf64
[3] = 0;
16837 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16838 device_param
->kernel_params_mp_buf32
[5] = 0;
16839 device_param
->kernel_params_mp_buf32
[6] = 0;
16840 device_param
->kernel_params_mp_buf32
[7] = 0;
16842 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16844 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16845 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16846 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16847 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16849 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16851 device_param
->kernel_params_mp_buf32
[5] = 0;
16852 device_param
->kernel_params_mp_buf32
[6] = 0;
16853 device_param
->kernel_params_mp_buf32
[7] = 0;
16856 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
16857 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
16858 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
16860 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
16861 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
16864 else if (attack_mode
== ATTACK_MODE_BF
)
16866 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16870 for (uint i
= 0; i
< dictcnt
; i
++)
16872 local_free (dictfiles
[i
]);
16875 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16877 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16879 if (l1_filename
== NULL
) break;
16883 dictfiles
[dictcnt
- 1] = l1_filename
;
16890 dictfiles
[dictcnt
- 1] = mask
;
16895 log_error ("ERROR: Mask is too small");
16902 free (induction_dictionaries
);
16904 // induction_dictionaries_cnt = 0; // implied
16906 if (attack_mode
!= ATTACK_MODE_BF
)
16910 induction_dictionaries
= scan_directory (induction_directory
);
16912 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16916 if (induction_dictionaries_cnt
)
16918 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16922 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16926 if ((maskcnt
> 1) || (dictcnt
> 1))
16928 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16934 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
16936 char *subid
= logfile_generate_subid ();
16938 data
.subid
= subid
;
16940 logfile_sub_msg ("START");
16942 data
.devices_status
= STATUS_INIT
;
16944 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
16945 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
16946 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
16948 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
16952 data
.cpt_start
= time (NULL
);
16954 data
.cpt_total
= 0;
16956 if (data
.restore
== 0)
16958 rd
->words_cur
= skip
;
16965 data
.ms_paused
= 0;
16967 data
.words_cur
= rd
->words_cur
;
16969 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16971 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16973 if (device_param
->skipped
) continue;
16975 device_param
->speed_pos
= 0;
16977 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
16978 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
16980 device_param
->exec_pos
= 0;
16982 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
16984 device_param
->kernel_power
= device_param
->kernel_power_user
;
16986 device_param
->outerloop_pos
= 0;
16987 device_param
->outerloop_left
= 0;
16988 device_param
->innerloop_pos
= 0;
16989 device_param
->innerloop_left
= 0;
16991 // some more resets:
16993 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
16995 device_param
->pws_cnt
= 0;
16997 device_param
->words_off
= 0;
16998 device_param
->words_done
= 0;
17001 data
.kernel_power_div
= 0;
17003 // figure out some workload
17005 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17007 if (data
.wordlist_mode
== WL_MODE_FILE
)
17009 char *dictfile
= NULL
;
17011 if (induction_dictionaries_cnt
)
17013 dictfile
= induction_dictionaries
[0];
17017 dictfile
= dictfiles
[dictpos
];
17020 data
.dictfile
= dictfile
;
17022 logfile_sub_string (dictfile
);
17024 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17026 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17029 FILE *fd2
= fopen (dictfile
, "rb");
17033 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17038 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17042 if (data
.words_cnt
== 0)
17044 if (data
.devices_status
== STATUS_CRACKED
) break;
17045 if (data
.devices_status
== STATUS_ABORTED
) break;
17053 else if (attack_mode
== ATTACK_MODE_COMBI
)
17055 char *dictfile
= data
.dictfile
;
17056 char *dictfile2
= data
.dictfile2
;
17058 logfile_sub_string (dictfile
);
17059 logfile_sub_string (dictfile2
);
17061 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17063 FILE *fd2
= fopen (dictfile
, "rb");
17067 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17072 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17076 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17078 FILE *fd2
= fopen (dictfile2
, "rb");
17082 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17087 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17092 if (data
.words_cnt
== 0)
17094 if (data
.devices_status
== STATUS_CRACKED
) break;
17095 if (data
.devices_status
== STATUS_ABORTED
) break;
17102 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17104 char *dictfile
= NULL
;
17106 if (induction_dictionaries_cnt
)
17108 dictfile
= induction_dictionaries
[0];
17112 dictfile
= dictfiles
[dictpos
];
17115 data
.dictfile
= dictfile
;
17117 char *mask
= data
.mask
;
17119 logfile_sub_string (dictfile
);
17120 logfile_sub_string (mask
);
17122 FILE *fd2
= fopen (dictfile
, "rb");
17126 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17131 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17135 if (data
.words_cnt
== 0)
17137 if (data
.devices_status
== STATUS_CRACKED
) break;
17138 if (data
.devices_status
== STATUS_ABORTED
) break;
17145 else if (attack_mode
== ATTACK_MODE_BF
)
17147 local_free (css_buf
);
17148 local_free (data
.root_css_buf
);
17149 local_free (data
.markov_css_buf
);
17151 char *mask
= dictfiles
[dictpos
];
17153 logfile_sub_string (mask
);
17157 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17159 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17161 uint css_cnt_unicode
= css_cnt
* 2;
17163 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17165 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17167 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17169 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17170 css_buf_unicode
[j
+ 1].cs_len
= 1;
17175 css_buf
= css_buf_unicode
;
17176 css_cnt
= css_cnt_unicode
;
17179 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17181 uint mask_min
= pw_min
;
17182 uint mask_max
= pw_max
;
17184 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17190 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17192 if (css_cnt
< mask_min
)
17194 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17197 if (css_cnt
> mask_max
)
17199 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17202 // skip to next mask
17206 rd
->dictpos
= dictpos
;
17208 logfile_sub_msg ("STOP");
17213 uint save_css_cnt
= css_cnt
;
17215 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17217 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17219 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17220 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17222 uint css_cnt_salt
= css_cnt
+ salt_len
;
17224 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17226 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17228 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17230 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17231 css_buf_salt
[j
].cs_len
= 1;
17236 css_buf
= css_buf_salt
;
17237 css_cnt
= css_cnt_salt
;
17242 data
.css_cnt
= css_cnt
;
17243 data
.css_buf
= css_buf
;
17245 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17247 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17249 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17251 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17252 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17254 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17256 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17258 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17259 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17261 data
.root_css_buf
= root_css_buf
;
17262 data
.markov_css_buf
= markov_css_buf
;
17264 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17266 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17268 local_free (root_table_buf
);
17269 local_free (markov_table_buf
);
17273 uint css_cnt_l
= css_cnt
;
17276 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17278 if (save_css_cnt
< 6)
17282 else if (save_css_cnt
== 6)
17288 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17290 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17301 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17316 /* unfinished code?
17317 int sum = css_buf[css_cnt_r - 1].cs_len;
17319 for (uint i = 1; i < 4 && i < css_cnt; i++)
17321 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17325 sum *= css_buf[css_cnt_r - 1].cs_len;
17330 css_cnt_l
-= css_cnt_r
;
17332 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17334 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17336 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17338 if (device_param
->skipped
) continue;
17340 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17341 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17342 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17344 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17345 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17346 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17347 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17348 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17349 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17351 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17352 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17353 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17354 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17356 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17357 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17358 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17360 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17361 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17362 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17363 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17364 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17366 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
17367 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
17368 for (uint i
= 4; i
< 9; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
17370 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
17371 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
17372 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
17374 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
17375 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
17379 u64 words_base
= data
.words_cnt
;
17381 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17383 if (data
.kernel_rules_cnt
)
17385 words_base
/= data
.kernel_rules_cnt
;
17388 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17390 if (data
.combs_cnt
)
17392 words_base
/= data
.combs_cnt
;
17395 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17399 words_base
/= data
.bfs_cnt
;
17403 data
.words_base
= words_base
;
17407 log_info ("%llu", (unsigned long long int) words_base
);
17412 if (data
.words_cur
> data
.words_base
)
17414 log_error ("ERROR: restore value greater keyspace");
17419 if (data
.words_cur
)
17421 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17423 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17425 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17428 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17430 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17432 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17435 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17437 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17439 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17445 * Inform user about possible slow speeds
17448 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17450 if (data
.words_base
< kernel_power_all
)
17454 log_info ("ATTENTION!");
17455 log_info (" The wordlist or mask you are using is too small.");
17456 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17457 log_info (" The cracking speed will drop.");
17458 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17465 * Update loopback file
17474 uint random_num
= get_random_num (0, 9999);
17476 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17478 data
.loopback_file
= loopback_file
;
17482 * Update dictionary statistic
17487 dictstat_fp
= fopen (dictstat
, "wb");
17491 lock_file (dictstat_fp
);
17493 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17495 fclose (dictstat_fp
);
17499 data
.devices_status
= STATUS_RUNNING
;
17501 if (initial_restore_done
== 0)
17503 if (data
.restore_disable
== 0) cycle_restore ();
17505 initial_restore_done
= 1;
17508 hc_timer_set (&data
.timer_running
);
17510 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17512 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17514 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17515 if (quiet
== 0) fflush (stdout
);
17518 else if (wordlist_mode
== WL_MODE_STDIN
)
17520 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17521 if (data
.quiet
== 0) log_info ("");
17524 time_t runtime_start
;
17526 time (&runtime_start
);
17528 data
.runtime_start
= runtime_start
;
17531 * create cracker threads
17534 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17536 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17538 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17540 if (wordlist_mode
== WL_MODE_STDIN
)
17542 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17546 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17550 // wait for crack threads to exit
17552 hc_thread_wait (data
.devices_cnt
, c_threads
);
17554 local_free (c_threads
);
17560 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17562 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17564 if (data
.devices_status
== STATUS_CRACKED
) break;
17565 if (data
.devices_status
== STATUS_ABORTED
) break;
17567 if (data
.devices_status
== STATUS_BYPASS
)
17569 data
.devices_status
= STATUS_RUNNING
;
17572 if (induction_dictionaries_cnt
)
17574 unlink (induction_dictionaries
[0]);
17577 free (induction_dictionaries
);
17579 if (attack_mode
!= ATTACK_MODE_BF
)
17581 induction_dictionaries
= scan_directory (induction_directory
);
17583 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17586 if (benchmark
== 0)
17588 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17590 if (quiet
== 0) clear_prompt ();
17592 if (quiet
== 0) log_info ("");
17600 if (quiet
== 0) status_display ();
17603 if (quiet
== 0) log_info ("");
17607 if (attack_mode
== ATTACK_MODE_BF
)
17611 rd
->dictpos
= dictpos
;
17615 if (induction_dictionaries_cnt
)
17617 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17623 rd
->dictpos
= dictpos
;
17627 time_t runtime_stop
;
17629 time (&runtime_stop
);
17631 data
.runtime_stop
= runtime_stop
;
17633 logfile_sub_uint (runtime_start
);
17634 logfile_sub_uint (runtime_stop
);
17636 logfile_sub_msg ("STOP");
17638 global_free (subid
);
17641 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17643 if (data
.devices_status
== STATUS_CRACKED
) break;
17644 if (data
.devices_status
== STATUS_ABORTED
) break;
17645 if (data
.devices_status
== STATUS_QUIT
) break;
17647 if (data
.devices_status
== STATUS_BYPASS
)
17649 data
.devices_status
= STATUS_RUNNING
;
17653 // problems could occur if already at startup everything was cracked (because of .pot file reading etc), we must set some variables here to avoid NULL pointers
17655 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17657 if (data
.wordlist_mode
== WL_MODE_FILE
)
17659 if (data
.dictfile
== NULL
)
17661 if (dictfiles
!= NULL
)
17663 data
.dictfile
= dictfiles
[0];
17665 hc_timer_set (&data
.timer_running
);
17670 // NOTE: combi is okay because it is already set beforehand
17671 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17673 if (data
.dictfile
== NULL
)
17675 if (dictfiles
!= NULL
)
17677 hc_timer_set (&data
.timer_running
);
17679 data
.dictfile
= dictfiles
[0];
17683 else if (attack_mode
== ATTACK_MODE_BF
)
17685 if (data
.mask
== NULL
)
17687 hc_timer_set (&data
.timer_running
);
17689 data
.mask
= masks
[0];
17693 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17695 data
.devices_status
= STATUS_EXHAUSTED
;
17698 // if cracked / aborted remove last induction dictionary
17700 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17702 struct stat induct_stat
;
17704 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17706 unlink (induction_dictionaries
[file_pos
]);
17710 // wait for non-interactive threads
17712 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17714 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17717 local_free (ni_threads
);
17719 // wait for interactive threads
17721 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17723 hc_thread_wait (1, &i_thread
);
17726 // we dont need restore file anymore
17727 if (data
.restore_disable
== 0)
17729 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17731 unlink (eff_restore_file
);
17732 unlink (new_restore_file
);
17740 // finally save left hashes
17742 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17751 if (benchmark
== 1)
17753 status_benchmark ();
17755 if (machine_readable
== 0)
17762 if (quiet
== 0) clear_prompt ();
17764 if (quiet
== 0) log_info ("");
17772 if (quiet
== 0) status_display ();
17775 if (quiet
== 0) log_info ("");
17778 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17780 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17782 if (device_param
->skipped
) continue;
17784 local_free (device_param
->combs_buf
);
17786 local_free (device_param
->hooks_buf
);
17788 local_free (device_param
->device_name
);
17790 local_free (device_param
->device_name_chksum
);
17792 local_free (device_param
->device_version
);
17794 local_free (device_param
->driver_version
);
17796 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17797 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17798 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17799 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17800 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17801 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17802 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17803 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17804 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17805 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17806 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17807 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17808 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17809 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17810 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17811 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17812 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17813 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17814 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17815 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17816 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17817 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17818 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17819 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17820 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17821 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17822 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17823 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17824 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17826 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17827 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17828 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17829 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17830 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17831 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17832 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17833 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17834 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17835 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17836 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17838 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17839 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17840 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17842 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17843 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17846 // reset default fan speed
17849 if (gpu_temp_disable
== 0)
17852 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17854 hc_thread_mutex_lock (mux_adl
);
17856 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17858 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17860 if (device_param
->skipped
) continue;
17862 if (data
.hm_device
[device_id
].fan_supported
== 1)
17864 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17866 if (fanspeed
== -1) continue;
17868 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17870 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17874 hc_thread_mutex_unlock (mux_adl
);
17880 // reset power tuning
17882 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17884 hc_thread_mutex_lock (mux_adl
);
17886 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17888 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17890 if (device_param
->skipped
) continue;
17892 if (data
.hm_device
[device_id
].od_version
== 6)
17894 // check powertune capabilities first, if not available then skip device
17896 int powertune_supported
= 0;
17898 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17900 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17905 if (powertune_supported
!= 0)
17907 // powercontrol settings
17909 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, od_power_control_status
[device_id
])) != ADL_OK
)
17911 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17918 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17920 performance_state
->iNumberOfPerformanceLevels
= 2;
17922 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17923 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17924 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17925 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17927 if ((hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
17929 log_info ("ERROR: Failed to restore ADL performance state");
17934 local_free (performance_state
);
17939 hc_thread_mutex_unlock (mux_adl
);
17943 if (gpu_temp_disable
== 0)
17945 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
17948 #if defined(LINUX) && defined(HAVE_NVML)
17950 hm_NVML_nvmlShutdown (data
.hm_nv
);
17952 nvml_close (data
.hm_nv
);
17954 #elif defined(WIN) && (HAVE_NVAPI)
17956 hm_NvAPI_Unload (data
.hm_nv
);
17958 nvapi_close (data
.hm_nv
);
17969 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
17971 adl_close (data
.hm_amd
);
17972 data
.hm_amd
= NULL
;
17976 #endif // HAVE_HWMON
17980 local_free (masks
);
17982 local_free (dictstat_base
);
17984 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
17986 pot_t
*pot_ptr
= &pot
[pot_pos
];
17988 hash_t
*hash
= &pot_ptr
->hash
;
17990 local_free (hash
->digest
);
17994 local_free (hash
->salt
);
18000 local_free (all_kernel_rules_cnt
);
18001 local_free (all_kernel_rules_buf
);
18003 local_free (wl_data
->buf
);
18004 local_free (wl_data
);
18006 local_free (bitmap_s1_a
);
18007 local_free (bitmap_s1_b
);
18008 local_free (bitmap_s1_c
);
18009 local_free (bitmap_s1_d
);
18010 local_free (bitmap_s2_a
);
18011 local_free (bitmap_s2_b
);
18012 local_free (bitmap_s2_c
);
18013 local_free (bitmap_s2_d
);
18016 local_free (temp_retain_fanspeed_value
);
18018 local_free (od_clock_mem_status
);
18019 local_free (od_power_control_status
);
18023 global_free (devices_param
);
18025 global_free (kernel_rules_buf
);
18027 global_free (root_css_buf
);
18028 global_free (markov_css_buf
);
18030 global_free (digests_buf
);
18031 global_free (digests_shown
);
18032 global_free (digests_shown_tmp
);
18034 global_free (salts_buf
);
18035 global_free (salts_shown
);
18037 global_free (esalts_buf
);
18039 global_free (words_progress_done
);
18040 global_free (words_progress_rejected
);
18041 global_free (words_progress_restored
);
18043 if (pot_fp
) fclose (pot_fp
);
18045 if (data
.devices_status
== STATUS_QUIT
) break;
18048 // destroy others mutex
18050 hc_thread_mutex_delete (mux_dispatcher
);
18051 hc_thread_mutex_delete (mux_counter
);
18052 hc_thread_mutex_delete (mux_display
);
18053 hc_thread_mutex_delete (mux_adl
);
18057 local_free (eff_restore_file
);
18058 local_free (new_restore_file
);
18064 tuning_db_destroy (tuning_db
);
18068 local_free (loopback_file
);
18070 if (loopback
== 1) unlink (loopback_file
);
18072 // induction directory
18074 if (induction_dir
== NULL
)
18076 if (attack_mode
!= ATTACK_MODE_BF
)
18078 if (rmdir (induction_directory
) == -1)
18080 if (errno
== ENOENT
)
18082 // good, we can ignore
18084 else if (errno
== ENOTEMPTY
)
18086 // good, we can ignore
18090 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18096 local_free (induction_directory
);
18100 // outfile-check directory
18102 if (outfile_check_dir
== NULL
)
18104 if (rmdir (outfile_check_directory
) == -1)
18106 if (errno
== ENOENT
)
18108 // good, we can ignore
18110 else if (errno
== ENOTEMPTY
)
18112 // good, we can ignore
18116 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18122 local_free (outfile_check_directory
);
18129 logfile_top_uint (proc_start
);
18130 logfile_top_uint (proc_stop
);
18132 logfile_top_msg ("STOP");
18134 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18135 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18137 if (data
.ocl
) ocl_close (data
.ocl
);
18139 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18140 if (data
.devices_status
== STATUS_QUIT
) return 2;
18141 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18142 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18143 if (data
.devices_status
== STATUS_CRACKED
) return 0;