2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
19 #include <rp_kernel_on_cpu.h>
22 const char *PROGNAME
= "hashcat";
23 const uint VERSION_BIN
= 300;
24 const uint RESTORE_MIN
= 300;
26 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
28 #define INCR_RULES 10000
29 #define INCR_SALTS 100000
30 #define INCR_MASKS 1000
36 #define MARKOV_THRESHOLD 0
37 #define MARKOV_DISABLE 0
38 #define MARKOV_CLASSIC 0
42 #define RESTORE_TIMER 60
43 #define RESTORE_DISABLE 0
45 #define STATUS_TIMER 10
46 #define MACHINE_READABLE 0
48 #define WEAK_HASH_THRESHOLD 100
53 #define REMOVE_TIMER 60
57 #define POTFILE_DISABLE 0
60 #define RP_GEN_FUNC_MIN 1
61 #define RP_GEN_FUNC_MAX 4
63 #define RULE_BUF_L ":"
64 #define RULE_BUF_R ":"
69 #define HEX_WORDLIST 0
70 #define OUTFILE_FORMAT 3
71 #define OUTFILE_AUTOHEX 1
72 #define OUTFILE_CHECK_TIMER 5
75 #define SEGMENT_SIZE 32
77 #define INCREMENT_MIN 1
78 #define INCREMENT_MAX PW_MAX
82 #define NVIDIA_SPIN_DAMP 100
83 #define GPU_TEMP_DISABLE 0
84 #define GPU_TEMP_ABORT 90
85 #define GPU_TEMP_RETAIN 75
86 #define WORKLOAD_PROFILE 2
87 #define KERNEL_ACCEL 0
88 #define KERNEL_LOOPS 0
89 #define KERNEL_RULES 1024
90 #define KERNEL_COMBS 1024
91 #define KERNEL_BFS 1024
92 #define KERNEL_THREADS_MAX 256
93 #define KERNEL_THREADS_MAX_CPU 1
94 #define POWERTUNE_ENABLE 0
95 #define LOGFILE_DISABLE 0
97 #define OPENCL_VECTOR_WIDTH 0
99 #define WL_MODE_STDIN 1
100 #define WL_MODE_FILE 2
101 #define WL_MODE_MASK 3
103 #define HL_MODE_FILE 4
104 #define HL_MODE_ARG 5
106 #define HLFMTS_CNT 11
107 #define HLFMT_HASHCAT 0
108 #define HLFMT_PWDUMP 1
109 #define HLFMT_PASSWD 2
110 #define HLFMT_SHADOW 3
113 #define HLFMT_NETNTLM1 7
114 #define HLFMT_NETNTLM2 8
115 #define HLFMT_NSLDAP 9
116 #define HLFMT_NSLDAPS 10
118 #define HLFMT_TEXT_HASHCAT "native hashcat"
119 #define HLFMT_TEXT_PWDUMP "pwdump"
120 #define HLFMT_TEXT_PASSWD "passwd"
121 #define HLFMT_TEXT_SHADOW "shadow"
122 #define HLFMT_TEXT_DCC "DCC"
123 #define HLFMT_TEXT_DCC2 "DCC 2"
124 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
125 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
126 #define HLFMT_TEXT_NSLDAP "nsldap"
127 #define HLFMT_TEXT_NSLDAPS "nsldaps"
129 #define ATTACK_MODE_STRAIGHT 0
130 #define ATTACK_MODE_COMBI 1
131 #define ATTACK_MODE_TOGGLE 2
132 #define ATTACK_MODE_BF 3
133 #define ATTACK_MODE_PERM 4
134 #define ATTACK_MODE_TABLE 5
135 #define ATTACK_MODE_HYBRID1 6
136 #define ATTACK_MODE_HYBRID2 7
137 #define ATTACK_MODE_NONE 100
139 #define ATTACK_KERN_STRAIGHT 0
140 #define ATTACK_KERN_COMBI 1
141 #define ATTACK_KERN_BF 3
142 #define ATTACK_KERN_NONE 100
144 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
145 #define ATTACK_EXEC_INSIDE_KERNEL 11
147 #define COMBINATOR_MODE_BASE_LEFT 10001
148 #define COMBINATOR_MODE_BASE_RIGHT 10002
150 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
151 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
153 #define MAX_CUT_TRIES 4
155 #define MAX_DICTSTAT 10000
157 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
159 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
161 #define global_free(attr) \
163 myfree ((void *) data.attr); \
168 #define local_free(attr) \
170 myfree ((void *) attr); \
175 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
176 #define HC_API_CALL __stdcall
181 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
332 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
338 static unsigned int full01
= 0x01010101;
339 static unsigned int full80
= 0x80808080;
341 int SUPPRESS_OUTPUT
= 0;
343 hc_thread_mutex_t mux_adl
;
344 hc_thread_mutex_t mux_counter
;
345 hc_thread_mutex_t mux_dispatcher
;
346 hc_thread_mutex_t mux_display
;
348 hc_global_data_t data
;
350 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
352 const char *USAGE_MINI
[] =
354 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
356 "Try --help for more help.",
360 const char *USAGE_BIG
[] =
362 "%s, advanced password recovery",
364 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
368 " Options Short / Long | Type | Description | Example",
369 "===============================+======+======================================================+=======================",
370 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
371 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
372 " -V, --version | | Print version |",
373 " -h, --help | | Print help |",
374 " --quiet | | Suppress output |",
375 " --hex-charset | | Assume charset is given in hex |",
376 " --hex-salt | | Assume salt is given in hex |",
377 " --hex-wordlist | | Assume words in wordlist is given in hex |",
378 " --force | | Ignore warnings |",
379 " --status | | Enable automatic update of the status-screen |",
380 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
381 " --machine-readable | | Display the status view in a machine readable format |",
382 " --loopback | | Add new plains to induct directory |",
383 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
384 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
385 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
386 " --markov-classic | | Enables classic markov-chains, no per-position |",
387 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
388 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
389 " --session | Str | Define specific session name | --session=mysession",
390 " --restore | | Restore session from --session |",
391 " --restore-disable | | Do not write restore file |",
392 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
393 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
394 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
395 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
396 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
397 " --stdout | | Do not crack a hash, instead print candidates only |",
398 " --show | | Compare hashlist with potfile; Show cracked hashes |",
399 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
400 " --username | | Enable ignoring of usernames in hashfile |",
401 " --remove | | Enable remove of hash once it is cracked |",
402 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
403 " --potfile-disable | | Do not write potfile |",
404 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
405 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
406 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
407 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
408 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
409 " --logfile-disable | | Disable the logfile |",
410 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
411 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
412 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
413 " -b, --benchmark | | Run benchmark |",
414 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
415 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
416 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
417 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
418 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
419 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
420 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
421 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
422 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
423 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
424 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
425 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
426 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
428 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
429 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
430 " --powertune-enable | | Enable power tuning, restores settings when finished |",
432 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
433 " -s, --skip | Num | Skip X words from the start | -s 1000000",
434 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
435 " --keyspace | | Show keyspace base:mod values and quit |",
436 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
437 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
438 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
439 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
440 " --generate-rules-func-min | Num | Force min X funcs per rule |",
441 " --generate-rules-func-max | Num | Force max X funcs per rule |",
442 " --generate-rules-seed | Num | Force RNG seed set to X |",
443 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
444 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
445 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
446 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
447 " -i, --increment | | Enable mask increment mode |",
448 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
449 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
451 "- [ Hash modes ] -",
453 " # | Name | Category",
454 " ======+==================================================+======================================",
455 " 900 | MD4 | Raw Hash",
456 " 0 | MD5 | Raw Hash",
457 " 5100 | Half MD5 | Raw Hash",
458 " 100 | SHA1 | Raw Hash",
459 " 10800 | SHA-384 | Raw Hash",
460 " 1400 | SHA-256 | Raw Hash",
461 " 1700 | SHA-512 | Raw Hash",
462 " 5000 | SHA-3(Keccak) | Raw Hash",
463 " 10100 | SipHash | Raw Hash",
464 " 6000 | RipeMD160 | Raw Hash",
465 " 6100 | Whirlpool | Raw Hash",
466 " 6900 | GOST R 34.11-94 | Raw Hash",
467 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
468 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
469 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
471 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
472 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
473 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
474 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
475 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
476 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
477 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
478 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
479 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
480 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
481 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
482 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
483 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
484 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
485 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
486 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
487 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
488 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
489 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
490 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
491 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
492 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
493 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
494 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
495 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
496 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
497 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
498 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
499 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
500 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
501 " 400 | phpass | Generic KDF",
502 " 8900 | scrypt | Generic KDF",
503 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
504 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
505 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
506 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
507 " 23 | Skype | Network protocols",
508 " 2500 | WPA/WPA2 | Network protocols",
509 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
510 " 5300 | IKE-PSK MD5 | Network protocols",
511 " 5400 | IKE-PSK SHA1 | Network protocols",
512 " 5500 | NetNTLMv1 | Network protocols",
513 " 5500 | NetNTLMv1 + ESS | Network protocols",
514 " 5600 | NetNTLMv2 | Network protocols",
515 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
516 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
517 " 8300 | DNSSEC (NSEC3) | Network protocols",
518 " 10200 | Cram MD5 | Network protocols",
519 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
520 " 11200 | MySQL CRAM (SHA1) | Network protocols",
521 " 11400 | SIP digest authentication (MD5) | Network protocols",
522 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
523 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
524 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
525 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
526 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
527 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
528 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
529 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
530 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
531 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
532 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
533 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
534 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
535 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
536 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
537 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
538 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
539 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
540 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
541 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
542 " 12 | PostgreSQL | Database Server",
543 " 131 | MSSQL(2000) | Database Server",
544 " 132 | MSSQL(2005) | Database Server",
545 " 1731 | MSSQL(2012) | Database Server",
546 " 1731 | MSSQL(2014) | Database Server",
547 " 200 | MySQL323 | Database Server",
548 " 300 | MySQL4.1/MySQL5 | Database Server",
549 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
550 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
551 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
552 " 8000 | Sybase ASE | Database Server",
553 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
554 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
555 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
556 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
557 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
558 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
559 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
560 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
561 " 11500 | CRC32 | Checksums",
562 " 3000 | LM | Operating-Systems",
563 " 1000 | NTLM | Operating-Systems",
564 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
565 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
566 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
567 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
568 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
569 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
570 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
571 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
572 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
573 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
574 " 1722 | OSX v10.7 | Operating-Systems",
575 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
576 " 6300 | AIX {smd5} | Operating-Systems",
577 " 6700 | AIX {ssha1} | Operating-Systems",
578 " 6400 | AIX {ssha256} | Operating-Systems",
579 " 6500 | AIX {ssha512} | Operating-Systems",
580 " 2400 | Cisco-PIX | Operating-Systems",
581 " 2410 | Cisco-ASA | Operating-Systems",
582 " 500 | Cisco-IOS $1$ | Operating-Systems",
583 " 5700 | Cisco-IOS $4$ | Operating-Systems",
584 " 9200 | Cisco-IOS $8$ | Operating-Systems",
585 " 9300 | Cisco-IOS $9$ | Operating-Systems",
586 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
587 " 501 | Juniper IVE | Operating-Systems",
588 " 5800 | Android PIN | Operating-Systems",
589 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
590 " 8100 | Citrix Netscaler | Operating-Systems",
591 " 8500 | RACF | Operating-Systems",
592 " 7200 | GRUB 2 | Operating-Systems",
593 " 9900 | Radmin2 | Operating-Systems",
594 " 125 | ArubaOS | Operating-Systems",
595 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
596 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
597 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
598 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
599 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
600 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
601 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
602 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
603 " 11600 | 7-Zip | Archives",
604 " 12500 | RAR3-hp | Archives",
605 " 13000 | RAR5 | Archives",
606 " 13200 | AxCrypt | Archives",
607 " 13300 | AxCrypt in memory SHA1 | Archives",
608 " 13600 | WinZip | Archives",
609 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
610 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
611 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
612 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
613 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
614 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
615 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
616 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
617 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
618 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
619 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
623 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
624 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
625 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
626 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
627 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
628 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
629 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
630 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
631 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
632 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
633 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
634 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
635 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
636 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
637 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
638 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
639 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
640 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
641 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
642 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
643 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
644 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
645 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
646 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
647 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
648 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
649 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
650 " 9400 | MS Office 2007 | Documents",
651 " 9500 | MS Office 2010 | Documents",
652 " 9600 | MS Office 2013 | Documents",
653 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
654 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
655 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
656 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
657 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
658 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
659 " 9000 | Password Safe v2 | Password Managers",
660 " 5200 | Password Safe v3 | Password Managers",
661 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
662 " 6600 | 1Password, agilekeychain | Password Managers",
663 " 8200 | 1Password, cloudkeychain | Password Managers",
664 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
665 " 12700 | Blockchain, My Wallet | Password Managers",
666 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
668 "- [ Outfile Formats ] -",
674 " 3 | hash[:salt]:plain",
676 " 5 | hash[:salt]:hex_plain",
677 " 6 | plain:hex_plain",
678 " 7 | hash[:salt]:plain:hex_plain",
680 " 9 | hash[:salt]:crack_pos",
681 " 10 | plain:crack_pos",
682 " 11 | hash[:salt]:plain:crack_pos",
683 " 12 | hex_plain:crack_pos",
684 " 13 | hash[:salt]:hex_plain:crack_pos",
685 " 14 | plain:hex_plain:crack_pos",
686 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
688 "- [ Rule Debugging Modes ] -",
693 " 2 | Original-Word",
694 " 3 | Original-Word:Finding-Rule",
695 " 4 | Original-Word:Finding-Rule:Processed-Word",
697 "- [ Attack Modes ] -",
704 " 6 | Hybrid Wordlist + Mask",
705 " 7 | Hybrid Mask + Wordlist",
707 "- [ Built-in Charsets ] -",
711 " l | abcdefghijklmnopqrstuvwxyz",
712 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
714 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
718 "- [ OpenCL Device Types ] -",
721 " ===+=============",
724 " 3 | FPGA, DSP, Co-Processor",
726 "- [ Workload Profiles ] -",
728 " # | Performance | Runtime | Power Consumption | Desktop Impact",
729 " ===+=============+=========+===================+=================",
730 " 1 | Low | 2 ms | Low | Minimal",
731 " 2 | Default | 12 ms | Economic | Noticeable",
732 " 3 | High | 96 ms | High | Unresponsive",
733 " 4 | Nightmare | 480 ms | Insane | Headless",
735 "- [ Basic Examples ] -",
737 " Attack- | Hash- |",
738 " Mode | Type | Example command",
739 " ==================+=======+==================================================================",
740 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
741 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
742 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
743 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
745 "If you still have no idea what just happened try following pages:",
747 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
748 "* https://hashcat.net/wiki/#frequently_asked_questions",
753 * hashcat specific functions
756 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
758 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
760 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
762 double exec_ms_sum
= 0;
766 for (int i
= 0; i
< last_num_entries
; i
++)
768 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
772 exec_ms_sum
+= exec_ms
;
778 if (exec_ms_cnt
== 0) return 0;
780 return exec_ms_sum
/ exec_ms_cnt
;
783 void status_display_machine_readable ()
787 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
793 fprintf (out
, "SPEED\t");
795 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
797 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
799 if (device_param
->skipped
) continue;
804 for (int i
= 0; i
< SPEED_CACHE
; i
++)
806 speed_cnt
+= device_param
->speed_cnt
[i
];
807 speed_ms
+= device_param
->speed_ms
[i
];
810 speed_cnt
/= SPEED_CACHE
;
811 speed_ms
/= SPEED_CACHE
;
813 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
820 fprintf (out
, "EXEC_RUNTIME\t");
822 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
824 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
826 if (device_param
->skipped
) continue;
828 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
830 fprintf (out
, "%f\t", exec_ms_avg
);
837 u64 words_cur
= get_lowest_words_done ();
839 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
845 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
848 u64 all_rejected
= 0;
849 u64 all_restored
= 0;
851 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
853 all_done
+= data
.words_progress_done
[salt_pos
];
854 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
855 all_restored
+= data
.words_progress_restored
[salt_pos
];
858 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
859 u64 progress_end
= progress_total
;
861 u64 progress_skip
= 0;
865 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
867 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
868 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
869 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
874 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
876 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
877 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
878 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
881 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
882 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
884 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
890 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
891 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
898 if (data
.gpu_temp_disable
== 0)
900 fprintf (out
, "TEMP\t");
902 hc_thread_mutex_lock (mux_adl
);
904 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
906 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
908 if (device_param
->skipped
) continue;
910 int temp
= hm_get_temperature_with_device_id (device_id
);
912 fprintf (out
, "%d\t", temp
);
915 hc_thread_mutex_unlock (mux_adl
);
927 void status_display ()
929 if (data
.devices_status
== STATUS_INIT
) return;
930 if (data
.devices_status
== STATUS_STARTING
) return;
932 // in this case some required buffers are free'd, ascii_digest() would run into segfault
933 if (data
.shutdown_inner
== 1) return;
935 if (data
.machine_readable
== 1)
937 status_display_machine_readable ();
942 char tmp_buf
[1000] = { 0 };
946 log_info ("Session.Name...: %s", data
.session
);
948 char *status_type
= strstatus (data
.devices_status
);
950 uint hash_mode
= data
.hash_mode
;
952 char *hash_type
= strhashtype (hash_mode
); // not a bug
954 log_info ("Status.........: %s", status_type
);
960 if (data
.rp_files_cnt
)
964 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
966 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
969 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
971 log_info ("Rules.Type.....: %s", tmp_buf
);
978 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
980 if (data
.rp_gen_seed
)
982 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
990 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
992 if (data
.wordlist_mode
== WL_MODE_FILE
)
994 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
996 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
998 log_info ("Input.Mode.....: Pipe");
1001 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1003 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1004 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1006 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1008 char *mask
= data
.mask
;
1012 uint mask_len
= data
.css_cnt
;
1014 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1018 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1020 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1022 mask_len
-= data
.salts_buf
[0].salt_len
;
1026 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1028 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1031 if (data
.maskcnt
> 1)
1033 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1035 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1038 log_info ("Input.Mode.....: %s", tmp_buf
);
1043 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1045 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1046 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1048 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1050 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1051 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1054 if (data
.digests_cnt
== 1)
1056 if (data
.hash_mode
== 2500)
1058 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1060 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1061 (char *) data
.salts_buf
[0].salt_buf
,
1075 else if (data
.hash_mode
== 5200)
1077 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1079 else if (data
.hash_mode
== 9000)
1081 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1083 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1085 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1087 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1089 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1093 char out_buf
[HCBUFSIZ
] = { 0 };
1095 ascii_digest (out_buf
, 0, 0);
1098 if (strlen (out_buf
) > 40)
1106 log_info ("Hash.Target....: %s", out_buf
);
1111 if (data
.hash_mode
== 3000)
1113 char out_buf1
[32] = { 0 };
1114 char out_buf2
[32] = { 0 };
1116 ascii_digest (out_buf1
, 0, 0);
1117 ascii_digest (out_buf2
, 0, 1);
1119 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1123 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1127 log_info ("Hash.Type......: %s", hash_type
);
1133 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1134 double speed_ms
[DEVICES_MAX
] = { 0 };
1136 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1138 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1140 if (device_param
->skipped
) continue;
1142 speed_cnt
[device_id
] = 0;
1143 speed_ms
[device_id
] = 0;
1145 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1147 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1148 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1151 speed_cnt
[device_id
] /= SPEED_CACHE
;
1152 speed_ms
[device_id
] /= SPEED_CACHE
;
1155 double hashes_all_ms
= 0;
1157 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1159 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1161 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1163 if (device_param
->skipped
) continue;
1165 hashes_dev_ms
[device_id
] = 0;
1167 if (speed_ms
[device_id
])
1169 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1171 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1179 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1181 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1183 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1185 if (device_param
->skipped
) continue;
1187 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1189 exec_all_ms
[device_id
] = exec_ms_avg
;
1196 double ms_running
= 0;
1198 hc_timer_get (data
.timer_running
, ms_running
);
1200 double ms_paused
= data
.ms_paused
;
1202 if (data
.devices_status
== STATUS_PAUSED
)
1204 double ms_paused_tmp
= 0;
1206 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1208 ms_paused
+= ms_paused_tmp
;
1213 __time64_t sec_run
= ms_running
/ 1000;
1217 time_t sec_run
= ms_running
/ 1000;
1223 char display_run
[32] = { 0 };
1227 struct tm
*tmp
= NULL
;
1231 tmp
= _gmtime64 (&sec_run
);
1235 tmp
= gmtime (&sec_run
);
1241 memset (&tm_run
, 0, sizeof (tm_run
));
1243 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1245 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1247 char *start
= ctime (&data
.proc_start
);
1249 size_t start_len
= strlen (start
);
1251 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1252 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1254 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1259 log_info ("Time.Started...: 0 secs");
1266 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1269 u64 all_rejected
= 0;
1270 u64 all_restored
= 0;
1272 u64 progress_noneed
= 0;
1274 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1276 all_done
+= data
.words_progress_done
[salt_pos
];
1277 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1278 all_restored
+= data
.words_progress_restored
[salt_pos
];
1280 // Important for ETA only
1282 if (data
.salts_shown
[salt_pos
] == 1)
1284 const u64 all
= data
.words_progress_done
[salt_pos
]
1285 + data
.words_progress_rejected
[salt_pos
]
1286 + data
.words_progress_restored
[salt_pos
];
1288 const u64 left
= data
.words_cnt
- all
;
1290 progress_noneed
+= left
;
1294 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1295 u64 progress_end
= progress_total
;
1297 u64 progress_skip
= 0;
1301 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1303 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1304 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1305 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1310 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1312 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1313 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1314 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1317 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1318 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1320 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1322 if (data
.devices_status
!= STATUS_CRACKED
)
1325 __time64_t sec_etc
= 0;
1332 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1334 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1336 sec_etc
= ms_left
/ 1000;
1341 //log_info ("Time.Estimated.: 0 secs");
1343 else if ((u64
) sec_etc
> ETC_MAX
)
1345 log_info ("Time.Estimated.: > 10 Years");
1349 char display_etc
[32] = { 0 };
1350 char display_runtime
[32] = { 0 };
1353 struct tm tm_runtime
;
1355 struct tm
*tmp
= NULL
;
1358 tmp
= _gmtime64 (&sec_etc
);
1360 tmp
= gmtime (&sec_etc
);
1365 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1367 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1375 char *etc
= ctime (&now
);
1377 size_t etc_len
= strlen (etc
);
1379 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1380 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1386 time (&runtime_cur
);
1390 __time64_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1392 tmp
= _gmtime64 (&runtime_left
);
1396 time_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1398 tmp
= gmtime (&runtime_left
);
1402 if ((tmp
!= NULL
) && (runtime_left
> 0) && (runtime_left
< sec_etc
))
1404 memcpy (&tm_runtime
, tmp
, sizeof (tm_runtime
));
1406 format_timer_display (&tm_runtime
, display_runtime
, sizeof (display_runtime
));
1408 log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc
, display_etc
, display_runtime
);
1412 log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc
, display_etc
);
1417 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1424 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1426 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1428 if (device_param
->skipped
) continue;
1430 char display_dev_cur
[16] = { 0 };
1432 strncpy (display_dev_cur
, "0.00", 4);
1434 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1436 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1439 char display_all_cur
[16] = { 0 };
1441 strncpy (display_all_cur
, "0.00", 4);
1443 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1445 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1447 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1448 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1450 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);
1454 if (data
.digests_cnt
> 100)
1456 time_t now
= time (NULL
);
1458 int cpt_cur_min
= 0;
1459 int cpt_cur_hour
= 0;
1460 int cpt_cur_day
= 0;
1462 for (int i
= 0; i
< CPT_BUF
; i
++)
1464 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1465 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1467 if ((timestamp
+ 60) > now
)
1469 cpt_cur_min
+= cracked
;
1472 if ((timestamp
+ 3600) > now
)
1474 cpt_cur_hour
+= cracked
;
1477 if ((timestamp
+ 86400) > now
)
1479 cpt_cur_day
+= cracked
;
1483 double ms_real
= ms_running
- ms_paused
;
1485 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1486 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1487 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1489 if ((data
.cpt_start
+ 86400) < now
)
1491 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1499 else if ((data
.cpt_start
+ 3600) < now
)
1501 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1508 else if ((data
.cpt_start
+ 60) < now
)
1510 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1518 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1527 u64 restore_point
= get_lowest_words_done ();
1529 u64 restore_total
= data
.words_base
;
1531 float percent_restore
= 0;
1533 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1535 if (progress_end_relative_skip
)
1537 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1539 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1540 float percent_rejected
= 0.0;
1544 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1547 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);
1548 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1550 if (data
.restore_disable
== 0)
1552 if (percent_finished
!= 1)
1554 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1561 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1563 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1564 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1566 if (data
.restore_disable
== 0)
1568 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1573 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1574 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1576 // --restore not allowed if stdin is used -- really? why?
1578 //if (data.restore_disable == 0)
1580 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1587 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1588 if (data
.devices_status
== STATUS_CRACKED
) return;
1589 if (data
.devices_status
== STATUS_ABORTED
) return;
1590 if (data
.devices_status
== STATUS_QUIT
) return;
1592 if (data
.gpu_temp_disable
== 0)
1594 hc_thread_mutex_lock (mux_adl
);
1596 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1598 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1600 if (device_param
->skipped
) continue;
1602 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1603 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1604 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1605 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1606 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1607 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1608 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1610 char output_buf
[256] = { 0 };
1614 if (num_temperature
>= 0)
1616 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1618 output_len
= strlen (output_buf
);
1621 if (num_fanspeed
>= 0)
1623 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1625 output_len
= strlen (output_buf
);
1628 if (num_utilization
>= 0)
1630 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1632 output_len
= strlen (output_buf
);
1635 if (num_corespeed
>= 0)
1637 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1639 output_len
= strlen (output_buf
);
1642 if (num_memoryspeed
>= 0)
1644 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1646 output_len
= strlen (output_buf
);
1649 if (num_buslanes
>= 0)
1651 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1653 output_len
= strlen (output_buf
);
1656 if (num_throttle
== 1)
1658 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1660 output_len
= strlen (output_buf
);
1663 if (output_len
== 0)
1665 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1667 output_len
= strlen (output_buf
);
1670 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1673 hc_thread_mutex_unlock (mux_adl
);
1676 #endif // HAVE_HWMON
1679 static void status_benchmark_automate ()
1681 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1682 double speed_ms
[DEVICES_MAX
] = { 0 };
1684 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1686 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1688 if (device_param
->skipped
) continue;
1690 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1691 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1694 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1696 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1698 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1700 if (device_param
->skipped
) continue;
1702 hashes_dev_ms
[device_id
] = 0;
1704 if (speed_ms
[device_id
])
1706 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1710 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1712 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1714 if (device_param
->skipped
) continue;
1716 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1720 static void status_benchmark ()
1722 if (data
.devices_status
== STATUS_INIT
) return;
1723 if (data
.devices_status
== STATUS_STARTING
) return;
1725 if (data
.shutdown_inner
== 1) return;
1727 if (data
.machine_readable
== 1)
1729 status_benchmark_automate ();
1734 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1735 double speed_ms
[DEVICES_MAX
] = { 0 };
1737 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1739 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1741 if (device_param
->skipped
) continue;
1743 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1744 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1747 double hashes_all_ms
= 0;
1749 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1751 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1753 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1755 if (device_param
->skipped
) continue;
1757 hashes_dev_ms
[device_id
] = 0;
1759 if (speed_ms
[device_id
])
1761 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1763 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1771 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1773 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1775 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1777 if (device_param
->skipped
) continue;
1779 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1781 exec_all_ms
[device_id
] = exec_ms_avg
;
1784 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1786 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1788 if (device_param
->skipped
) continue;
1790 char display_dev_cur
[16] = { 0 };
1792 strncpy (display_dev_cur
, "0.00", 4);
1794 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1796 if (data
.devices_active
>= 10)
1798 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1802 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1806 char display_all_cur
[16] = { 0 };
1808 strncpy (display_all_cur
, "0.00", 4);
1810 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1812 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1816 * hashcat -only- functions
1819 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1821 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1823 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1824 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1825 else if (attack_kern
== ATTACK_KERN_COMBI
)
1826 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1827 else if (attack_kern
== ATTACK_KERN_BF
)
1828 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1831 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1834 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
)
1836 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1838 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1839 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1840 else if (attack_kern
== ATTACK_KERN_COMBI
)
1841 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1842 else if (attack_kern
== ATTACK_KERN_BF
)
1843 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1847 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1851 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1853 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1855 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1859 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1863 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
)
1865 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1867 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1871 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1875 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1877 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1880 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1882 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1885 static char *filename_from_filepath (char *filepath
)
1889 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1893 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1905 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1907 if (line_len
& 1) return (line_len
); // not in hex
1909 if (data
.hex_wordlist
== 1)
1914 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1916 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1919 memset (line_buf
+ i
, 0, line_len
- i
);
1923 else if (line_len
>= 6) // $HEX[] = 6
1925 if (line_buf
[0] != '$') return (line_len
);
1926 if (line_buf
[1] != 'H') return (line_len
);
1927 if (line_buf
[2] != 'E') return (line_len
);
1928 if (line_buf
[3] != 'X') return (line_len
);
1929 if (line_buf
[4] != '[') return (line_len
);
1930 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1935 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1937 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1940 memset (line_buf
+ i
, 0, line_len
- i
);
1948 static void clear_prompt ()
1950 fputc ('\r', stdout
);
1952 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1954 fputc (' ', stdout
);
1957 fputc ('\r', stdout
);
1962 static int gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1964 cl_int CL_err
= 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
);
1966 if (CL_err
!= CL_SUCCESS
)
1968 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
1976 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1978 char *outfile
= data
.outfile
;
1979 uint quiet
= data
.quiet
;
1980 FILE *pot_fp
= data
.pot_fp
;
1981 uint loopback
= data
.loopback
;
1982 uint debug_mode
= data
.debug_mode
;
1983 char *debug_file
= data
.debug_file
;
1985 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1986 int debug_rule_len
= 0; // -1 error
1987 uint debug_plain_len
= 0;
1989 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1993 char out_buf
[HCBUFSIZ
] = { 0 };
1995 const u32 salt_pos
= plain
->salt_pos
;
1996 const u32 digest_pos
= plain
->digest_pos
; // relative
1997 const u32 gidvid
= plain
->gidvid
;
1998 const u32 il_pos
= plain
->il_pos
;
2000 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2004 u64 crackpos
= device_param
->words_off
;
2006 uint plain_buf
[16] = { 0 };
2008 u8
*plain_ptr
= (u8
*) plain_buf
;
2010 unsigned int plain_len
= 0;
2012 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2016 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2018 for (int i
= 0; i
< 16; i
++)
2020 plain_buf
[i
] = pw
.i
[i
];
2023 plain_len
= pw
.pw_len
;
2025 const uint off
= device_param
->innerloop_pos
+ il_pos
;
2032 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
2034 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
2036 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
2040 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
2042 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
2044 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
2046 debug_plain_len
= plain_len
;
2050 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2053 crackpos
*= data
.kernel_rules_cnt
;
2054 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2056 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2058 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2062 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2064 for (int i
= 0; i
< 16; i
++)
2066 plain_buf
[i
] = pw
.i
[i
];
2069 plain_len
= pw
.pw_len
;
2071 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2072 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2074 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2076 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2080 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2082 memcpy (plain_ptr
, comb_buf
, comb_len
);
2085 plain_len
+= comb_len
;
2088 crackpos
*= data
.combs_cnt
;
2089 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2091 if (data
.pw_max
!= PW_DICTMAX1
)
2093 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2096 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2098 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2099 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2101 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2102 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2104 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2105 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2107 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2108 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2110 plain_len
= data
.css_cnt
;
2113 crackpos
*= data
.bfs_cnt
;
2114 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2116 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2120 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2122 for (int i
= 0; i
< 16; i
++)
2124 plain_buf
[i
] = pw
.i
[i
];
2127 plain_len
= pw
.pw_len
;
2129 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2132 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2134 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2136 plain_len
+= start
+ stop
;
2139 crackpos
*= data
.combs_cnt
;
2140 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2142 if (data
.pw_max
!= PW_DICTMAX1
)
2144 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2147 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2151 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2153 for (int i
= 0; i
< 16; i
++)
2155 plain_buf
[i
] = pw
.i
[i
];
2158 plain_len
= pw
.pw_len
;
2160 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2163 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2165 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2167 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2169 plain_len
+= start
+ stop
;
2172 crackpos
*= data
.combs_cnt
;
2173 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2175 if (data
.pw_max
!= PW_DICTMAX1
)
2177 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2181 if (data
.attack_mode
== ATTACK_MODE_BF
)
2183 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2185 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2187 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2189 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2193 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2195 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2197 plain_ptr
[j
] = plain_ptr
[i
];
2200 plain_len
= plain_len
/ 2;
2205 // if enabled, update also the potfile
2211 fprintf (pot_fp
, "%s:", out_buf
);
2213 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2215 fputc ('\n', pot_fp
);
2219 unlock_file (pot_fp
);
2224 FILE *out_fp
= NULL
;
2226 if (outfile
!= NULL
)
2228 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2230 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2241 if (quiet
== 0) clear_prompt ();
2244 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2246 if (outfile
!= NULL
)
2248 if (out_fp
!= stdout
)
2255 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2257 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2259 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2260 if (quiet
== 0) fflush (stdout
);
2269 char *loopback_file
= data
.loopback_file
;
2273 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2277 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2279 fputc ('\n', fb_fp
);
2285 // (rule) debug mode
2287 // the next check implies that:
2288 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2291 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2293 if (debug_rule_len
< 0) debug_rule_len
= 0;
2295 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2297 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2299 if ((quiet
== 0) && (debug_file
== NULL
))
2301 fprintf (stdout
, "%s", PROMPT
);
2308 static int check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2310 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2316 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2318 if (CL_err
!= CL_SUCCESS
)
2320 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2327 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2331 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2333 CL_err
= 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
);
2335 if (CL_err
!= CL_SUCCESS
)
2337 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2342 uint cpt_cracked
= 0;
2344 hc_thread_mutex_lock (mux_display
);
2346 for (uint i
= 0; i
< num_cracked
; i
++)
2348 const uint hash_pos
= cracked
[i
].hash_pos
;
2350 if (data
.digests_shown
[hash_pos
] == 1) continue;
2352 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2354 data
.digests_shown
[hash_pos
] = 1;
2356 data
.digests_done
++;
2360 salt_buf
->digests_done
++;
2362 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2364 data
.salts_shown
[salt_pos
] = 1;
2370 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2372 check_hash (device_param
, &cracked
[i
]);
2375 hc_thread_mutex_unlock (mux_display
);
2379 if (cpt_cracked
> 0)
2381 hc_thread_mutex_lock (mux_display
);
2383 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2384 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2388 data
.cpt_total
+= cpt_cracked
;
2390 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2392 hc_thread_mutex_unlock (mux_display
);
2395 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2397 // we need to reset cracked state on the device
2398 // otherwise host thinks again and again the hash was cracked
2399 // and returns invalid password each time
2401 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2403 CL_err
= 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
);
2405 if (CL_err
!= CL_SUCCESS
)
2407 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2415 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2417 if (CL_err
!= CL_SUCCESS
)
2419 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2428 // stolen from princeprocessor ;)
2439 static void out_flush (out_t
*out
)
2441 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2446 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2448 char *ptr
= out
->buf
+ out
->len
;
2450 memcpy (ptr
, pw_buf
, pw_len
);
2454 out
->len
+= pw_len
+ 1;
2456 if (out
->len
>= BUFSIZ
- 100)
2462 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2469 uint plain_buf
[16] = { 0 };
2471 u8
*plain_ptr
= (u8
*) plain_buf
;
2475 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2477 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2481 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2483 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2485 const uint pos
= device_param
->innerloop_pos
;
2487 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2489 for (int i
= 0; i
< 8; i
++)
2491 plain_buf
[i
] = pw
.i
[i
];
2494 plain_len
= pw
.pw_len
;
2496 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2498 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2500 out_push (&out
, plain_ptr
, plain_len
);
2504 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2508 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2510 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2512 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2514 for (int i
= 0; i
< 8; i
++)
2516 plain_buf
[i
] = pw
.i
[i
];
2519 plain_len
= pw
.pw_len
;
2521 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2522 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2524 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2526 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2530 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2532 memcpy (plain_ptr
, comb_buf
, comb_len
);
2535 plain_len
+= comb_len
;
2537 if (data
.pw_max
!= PW_DICTMAX1
)
2539 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2542 out_push (&out
, plain_ptr
, plain_len
);
2546 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2548 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2550 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2552 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2553 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2555 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2556 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2558 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2559 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2561 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2562 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2564 plain_len
= data
.css_cnt
;
2566 out_push (&out
, plain_ptr
, plain_len
);
2570 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2574 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2576 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2578 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2580 for (int i
= 0; i
< 8; i
++)
2582 plain_buf
[i
] = pw
.i
[i
];
2585 plain_len
= pw
.pw_len
;
2587 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2590 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2592 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2594 plain_len
+= start
+ stop
;
2596 out_push (&out
, plain_ptr
, plain_len
);
2600 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2604 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2606 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2608 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2610 for (int i
= 0; i
< 8; i
++)
2612 plain_buf
[i
] = pw
.i
[i
];
2615 plain_len
= pw
.pw_len
;
2617 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2620 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2622 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2624 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2626 plain_len
+= start
+ stop
;
2628 out_push (&out
, plain_ptr
, plain_len
);
2636 static void save_hash ()
2638 char *hashfile
= data
.hashfile
;
2640 char new_hashfile
[256] = { 0 };
2641 char old_hashfile
[256] = { 0 };
2643 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2644 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2646 unlink (new_hashfile
);
2648 char separator
= data
.separator
;
2650 FILE *fp
= fopen (new_hashfile
, "wb");
2654 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2659 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2661 if (data
.salts_shown
[salt_pos
] == 1) continue;
2663 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2665 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2667 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2669 if (data
.digests_shown
[idx
] == 1) continue;
2671 if (data
.hash_mode
!= 2500)
2673 if (data
.username
== 1)
2675 user_t
*user
= data
.hash_info
[idx
]->user
;
2679 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2681 fputc (separator
, fp
);
2684 char out_buf
[HCBUFSIZ
]; // scratch buffer
2688 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2690 fputs (out_buf
, fp
);
2698 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2700 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2709 unlink (old_hashfile
);
2711 if (rename (hashfile
, old_hashfile
) != 0)
2713 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2720 if (rename (new_hashfile
, hashfile
) != 0)
2722 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2727 unlink (old_hashfile
);
2730 static int run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2732 cl_int CL_err
= CL_SUCCESS
;
2734 uint num_elements
= num
;
2736 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2737 device_param
->kernel_params_buf32
[34] = num
;
2739 uint kernel_threads
= device_param
->kernel_threads
;
2741 while (num_elements
% kernel_threads
) num_elements
++;
2743 cl_kernel kernel
= NULL
;
2747 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2748 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2749 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2750 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2751 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2754 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2755 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2756 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2757 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2758 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2759 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2760 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2761 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2762 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2763 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2764 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2766 if (CL_err
!= CL_SUCCESS
)
2768 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2775 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2777 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2778 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2780 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2782 if (CL_err
!= CL_SUCCESS
)
2784 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2791 if (kern_run
== KERN_RUN_2
)
2793 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2795 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2799 while (num_elements
% kernel_threads
) num_elements
++;
2801 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2802 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2804 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2806 if (CL_err
!= CL_SUCCESS
)
2808 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2814 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2816 if (CL_err
!= CL_SUCCESS
)
2818 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2823 if (device_param
->nvidia_spin_damp
)
2825 if (data
.devices_status
== STATUS_RUNNING
)
2827 if (iteration
< EXPECTED_ITERATIONS
)
2831 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2832 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2833 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2839 CL_err
= hc_clWaitForEvents (data
.ocl
, 1, &event
);
2841 if (CL_err
!= CL_SUCCESS
)
2843 log_error ("ERROR: clWaitForEvents(): %s\n", val2cstr_cl (CL_err
));
2848 cl_ulong time_start
;
2851 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2852 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2854 if (CL_err
!= CL_SUCCESS
)
2856 log_error ("ERROR: clGetEventProfilingInfo(): %s\n", val2cstr_cl (CL_err
));
2861 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2863 if (data
.devices_status
== STATUS_RUNNING
)
2865 if (iteration
< EXPECTED_ITERATIONS
)
2869 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2870 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2871 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2878 uint exec_pos
= device_param
->exec_pos
;
2880 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2884 if (exec_pos
== EXEC_CACHE
)
2889 device_param
->exec_pos
= exec_pos
;
2892 CL_err
= hc_clReleaseEvent (data
.ocl
, event
);
2894 if (CL_err
!= CL_SUCCESS
)
2896 log_error ("ERROR: clReleaseEvent(): %s\n", val2cstr_cl (CL_err
));
2901 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2903 if (CL_err
!= CL_SUCCESS
)
2905 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
2913 static int run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2915 cl_int CL_err
= CL_SUCCESS
;
2917 uint num_elements
= num
;
2921 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2922 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2923 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2926 // causes problems with special threads like in bcrypt
2927 // const uint kernel_threads = device_param->kernel_threads;
2929 uint kernel_threads
= device_param
->kernel_threads
;
2931 while (num_elements
% kernel_threads
) num_elements
++;
2933 cl_kernel kernel
= NULL
;
2937 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2938 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2939 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2944 case KERN_RUN_MP
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2945 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2946 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2947 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2948 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2949 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2951 case KERN_RUN_MP_R
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2952 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2953 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2954 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2955 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2956 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2958 case KERN_RUN_MP_L
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2959 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2960 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2961 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2962 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2963 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2964 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2968 if (CL_err
!= CL_SUCCESS
)
2970 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2975 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2976 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2978 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2980 if (CL_err
!= CL_SUCCESS
)
2982 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2987 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2989 if (CL_err
!= CL_SUCCESS
)
2991 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2996 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2998 if (CL_err
!= CL_SUCCESS
)
3000 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3008 static int run_kernel_tm (hc_device_param_t
*device_param
)
3010 cl_int CL_err
= CL_SUCCESS
;
3012 const uint num_elements
= 1024; // fixed
3014 uint kernel_threads
= 32;
3016 cl_kernel kernel
= device_param
->kernel_tm
;
3018 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3019 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3021 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3023 if (CL_err
!= CL_SUCCESS
)
3025 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3030 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3032 if (CL_err
!= CL_SUCCESS
)
3034 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3039 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3041 if (CL_err
!= CL_SUCCESS
)
3043 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3051 static int run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
3053 cl_int CL_err
= CL_SUCCESS
;
3055 uint num_elements
= num
;
3057 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
3058 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
3060 // causes problems with special threads like in bcrypt
3061 // const uint kernel_threads = device_param->kernel_threads;
3063 uint kernel_threads
= device_param
->kernel_threads
;
3065 while (num_elements
% kernel_threads
) num_elements
++;
3067 cl_kernel kernel
= device_param
->kernel_amp
;
3069 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
3070 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
3072 if (CL_err
!= CL_SUCCESS
)
3074 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3079 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3080 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3082 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3084 if (CL_err
!= CL_SUCCESS
)
3086 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3091 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3093 if (CL_err
!= CL_SUCCESS
)
3095 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3100 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3102 if (CL_err
!= CL_SUCCESS
)
3104 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3112 static int run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
3114 cl_int CL_err
= CL_SUCCESS
;
3116 const u32 num16d
= num
/ 16;
3117 const u32 num16m
= num
% 16;
3121 device_param
->kernel_params_memset_buf32
[1] = value
;
3122 device_param
->kernel_params_memset_buf32
[2] = num16d
;
3124 uint kernel_threads
= device_param
->kernel_threads
;
3126 uint num_elements
= num16d
;
3128 while (num_elements
% kernel_threads
) num_elements
++;
3130 cl_kernel kernel
= device_param
->kernel_memset
;
3132 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
3133 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
3134 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
3136 if (CL_err
!= CL_SUCCESS
)
3138 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3143 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3144 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3146 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3148 if (CL_err
!= CL_SUCCESS
)
3150 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3155 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3157 if (CL_err
!= CL_SUCCESS
)
3159 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3164 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3166 if (CL_err
!= CL_SUCCESS
)
3168 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3183 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
3185 if (CL_err
!= CL_SUCCESS
)
3187 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3196 static int run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
3198 return run_kernel_memset (device_param
, buf
, 0, size
);
3201 static int 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
, const uint fast_iteration
)
3203 cl_int CL_err
= CL_SUCCESS
;
3205 if (data
.hash_mode
== 2000)
3207 process_stdout (device_param
, pws_cnt
);
3212 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3214 if (attack_mode
== ATTACK_MODE_BF
)
3216 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
3218 const uint size_tm
= 32 * sizeof (bs_word_t
);
3220 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
3222 run_kernel_tm (device_param
);
3224 CL_err
= 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
);
3226 if (CL_err
!= CL_SUCCESS
)
3228 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3235 if (highest_pw_len
< 16)
3237 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
3239 else if (highest_pw_len
< 32)
3241 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3245 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3250 run_kernel_amp (device_param
, pws_cnt
);
3252 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3254 if (opts_type
& OPTS_TYPE_HOOK12
)
3256 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3258 CL_err
= 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
);
3260 if (CL_err
!= CL_SUCCESS
)
3262 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3267 // do something with data
3269 CL_err
= 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
);
3271 if (CL_err
!= CL_SUCCESS
)
3273 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3279 uint iter
= salt_buf
->salt_iter
;
3281 uint loop_step
= device_param
->kernel_loops
;
3283 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3285 uint loop_left
= iter
- loop_pos
;
3287 loop_left
= MIN (loop_left
, loop_step
);
3289 device_param
->kernel_params_buf32
[28] = loop_pos
;
3290 device_param
->kernel_params_buf32
[29] = loop_left
;
3292 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3294 if (data
.devices_status
== STATUS_CRACKED
) break;
3295 if (data
.devices_status
== STATUS_ABORTED
) break;
3296 if (data
.devices_status
== STATUS_QUIT
) break;
3297 if (data
.devices_status
== STATUS_BYPASS
) break;
3303 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3305 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3309 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3311 const u32 speed_pos
= device_param
->speed_pos
;
3313 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3315 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3317 if (data
.benchmark
== 1)
3319 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3323 if (opts_type
& OPTS_TYPE_HOOK23
)
3325 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3327 CL_err
= 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
);
3329 if (CL_err
!= CL_SUCCESS
)
3331 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3336 // do something with data
3338 CL_err
= 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
);
3340 if (CL_err
!= CL_SUCCESS
)
3342 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3348 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3354 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3360 else if (rule_len
== 1)
3362 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3368 static int run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3370 cl_int CL_err
= CL_SUCCESS
;
3372 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3374 CL_err
= 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
);
3376 if (CL_err
!= CL_SUCCESS
)
3378 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3383 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3385 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3387 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3389 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3391 for (u32 i
= 0; i
< pws_cnt
; i
++)
3393 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3395 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3400 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3402 for (u32 i
= 0; i
< pws_cnt
; i
++)
3404 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3406 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3413 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3415 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3417 for (u32 i
= 0; i
< pws_cnt
; i
++)
3419 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3421 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3426 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3428 for (u32 i
= 0; i
< pws_cnt
; i
++)
3430 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3432 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3439 CL_err
= 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
);
3441 if (CL_err
!= CL_SUCCESS
)
3443 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3448 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3450 const u64 off
= device_param
->words_off
;
3452 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3454 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3460 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3462 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3464 device_param
->kernel_params_buf32
[28] = 0;
3465 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3466 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3468 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3470 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3474 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3477 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3479 return exec_ms_prev
;
3482 static int autotune (hc_device_param_t
*device_param
)
3484 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3486 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3487 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3489 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3490 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3492 u32 kernel_accel
= kernel_accel_min
;
3493 u32 kernel_loops
= kernel_loops_min
;
3495 // in this case the user specified a fixed -u and -n on the commandline
3496 // no way to tune anything
3497 // but we need to run a few caching rounds
3499 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3501 if (data
.hash_mode
!= 2000)
3503 try_run (device_param
, kernel_accel
, kernel_loops
);
3504 try_run (device_param
, kernel_accel
, kernel_loops
);
3505 try_run (device_param
, kernel_accel
, kernel_loops
);
3506 try_run (device_param
, kernel_accel
, kernel_loops
);
3509 device_param
->kernel_accel
= kernel_accel
;
3510 device_param
->kernel_loops
= kernel_loops
;
3512 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3514 device_param
->kernel_power
= kernel_power
;
3519 // from here it's clear we are allowed to autotune
3520 // so let's init some fake words
3522 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3524 if (data
.attack_kern
== ATTACK_KERN_BF
)
3526 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3530 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3532 device_param
->pws_buf
[i
].i
[0] = i
;
3533 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3534 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3537 cl_int CL_err
= 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
);
3539 if (CL_err
!= CL_SUCCESS
)
3541 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3547 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3549 if (data
.kernel_rules_cnt
> 1)
3551 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3553 if (CL_err
!= CL_SUCCESS
)
3555 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3563 run_kernel_amp (device_param
, kernel_power_max
);
3566 #define VERIFIER_CNT 1
3568 // first find out highest kernel-loops that stays below target_ms
3570 if (kernel_loops_min
< kernel_loops_max
)
3572 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3574 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3576 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3578 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3580 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3583 if (exec_ms
< target_ms
) break;
3587 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3589 #define STEPS_CNT 10
3591 if (kernel_accel_min
< kernel_accel_max
)
3593 for (int i
= 0; i
< STEPS_CNT
; i
++)
3595 const u32 kernel_accel_try
= 1u << i
;
3597 if (kernel_accel_try
< kernel_accel_min
) continue;
3598 if (kernel_accel_try
> kernel_accel_max
) break;
3600 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3602 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3604 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3606 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3609 if (exec_ms
> target_ms
) break;
3611 kernel_accel
= kernel_accel_try
;
3615 // at this point we want to know the actual runtime for the following reason:
3616 // we need a reference for the balancing loop following up, and this
3617 // the balancing loop can have an effect that the creates a new opportunity, for example:
3618 // if the target is 95 ms and the current runtime is 48ms the above loop
3619 // stopped the execution because the previous exec_ms was > 95ms
3620 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3621 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3623 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3625 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3627 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3629 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3632 u32 diff
= kernel_loops
- kernel_accel
;
3634 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3636 u32 kernel_accel_orig
= kernel_accel
;
3637 u32 kernel_loops_orig
= kernel_loops
;
3639 for (u32 f
= 1; f
< 1024; f
++)
3641 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3642 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3644 if (kernel_accel_try
> kernel_accel_max
) break;
3645 if (kernel_loops_try
< kernel_loops_min
) break;
3647 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3649 if (diff_new
> diff
) break;
3653 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3655 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3657 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3659 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3662 if (exec_ms
< exec_ms_pre_final
)
3664 exec_ms_pre_final
= exec_ms
;
3666 kernel_accel
= kernel_accel_try
;
3667 kernel_loops
= kernel_loops_try
;
3672 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3674 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3676 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3678 if (exec_accel_min
>= 1.0)
3680 // this is safe to not overflow kernel_accel_max because of accel_left
3682 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3685 // reset them fake words
3688 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3690 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);
3691 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);
3694 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3696 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3698 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3703 device_param
->exec_pos
= 0;
3705 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3707 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3708 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3709 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3713 device_param
->kernel_accel
= kernel_accel
;
3714 device_param
->kernel_loops
= kernel_loops
;
3716 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3718 device_param
->kernel_power
= kernel_power
;
3722 if (data
.quiet
== 0)
3726 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3727 "- Device #%u: autotuned kernel-loops to %u\n",
3728 device_param
->device_id
+ 1, kernel_accel
,
3729 device_param
->device_id
+ 1, kernel_loops
);
3731 fprintf (stdout
, "%s", PROMPT
);
3741 static int run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3743 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3747 uint speed_pos
= device_param
->speed_pos
;
3750 if (device_param
->timer_speed
.tv_sec
== 0)
3752 hc_timer_set (&device_param
->timer_speed
);
3757 if (device_param
->timer_speed
.QuadPart
== 0)
3759 hc_timer_set (&device_param
->timer_speed
);
3763 // find higest password length, this is for optimization stuff
3765 uint highest_pw_len
= 0;
3767 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3770 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3773 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3775 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3776 + device_param
->kernel_params_mp_l_buf32
[5];
3781 uint innerloop_step
= 0;
3782 uint innerloop_cnt
= 0;
3784 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3785 else innerloop_step
= 1;
3787 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3788 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3789 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3791 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3793 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3795 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3797 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3799 if (data
.devices_status
== STATUS_CRACKED
) break;
3800 if (data
.devices_status
== STATUS_ABORTED
) break;
3801 if (data
.devices_status
== STATUS_QUIT
) break;
3802 if (data
.devices_status
== STATUS_BYPASS
) break;
3804 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3806 device_param
->kernel_params_buf32
[27] = salt_pos
;
3807 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3808 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3810 FILE *combs_fp
= device_param
->combs_fp
;
3812 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3819 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3821 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3823 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3825 if (data
.devices_status
== STATUS_CRACKED
) break;
3826 if (data
.devices_status
== STATUS_ABORTED
) break;
3827 if (data
.devices_status
== STATUS_QUIT
) break;
3828 if (data
.devices_status
== STATUS_BYPASS
) break;
3830 uint fast_iteration
= 0;
3832 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3834 if (innerloop_left
> innerloop_step
)
3836 innerloop_left
= innerloop_step
;
3841 device_param
->innerloop_pos
= innerloop_pos
;
3842 device_param
->innerloop_left
= innerloop_left
;
3844 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3846 // i think we can get rid of this
3847 if (innerloop_left
== 0)
3849 puts ("bug, how should this happen????\n");
3854 if (data
.salts_shown
[salt_pos
] == 1)
3856 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3861 // initialize amplifiers
3863 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3867 while (i
< innerloop_left
)
3869 if (feof (combs_fp
)) break;
3871 int line_len
= fgetl (combs_fp
, line_buf
);
3873 if (line_len
>= PW_MAX1
) continue;
3875 line_len
= convert_from_hex (line_buf
, line_len
);
3877 char *line_buf_new
= line_buf
;
3879 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3881 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3883 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3885 if (rule_len_out
< 0)
3887 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3892 line_len
= rule_len_out
;
3894 line_buf_new
= rule_buf_out
;
3897 line_len
= MIN (line_len
, PW_DICTMAX
);
3899 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3901 memcpy (ptr
, line_buf_new
, line_len
);
3903 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3905 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3907 uppercase (ptr
, line_len
);
3910 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3912 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3914 ptr
[line_len
] = 0x80;
3917 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3919 ptr
[line_len
] = 0x01;
3923 device_param
->combs_buf
[i
].pw_len
= line_len
;
3928 for (uint j
= i
; j
< innerloop_left
; j
++)
3930 device_param
->combs_buf
[j
].i
[0] = 0;
3931 device_param
->combs_buf
[j
].i
[1] = 0;
3932 device_param
->combs_buf
[j
].i
[2] = 0;
3933 device_param
->combs_buf
[j
].i
[3] = 0;
3934 device_param
->combs_buf
[j
].i
[4] = 0;
3935 device_param
->combs_buf
[j
].i
[5] = 0;
3936 device_param
->combs_buf
[j
].i
[6] = 0;
3937 device_param
->combs_buf
[j
].i
[7] = 0;
3939 device_param
->combs_buf
[j
].pw_len
= 0;
3944 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3946 u64 off
= innerloop_pos
;
3948 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3950 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3952 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3954 u64 off
= innerloop_pos
;
3956 device_param
->kernel_params_mp_buf64
[3] = off
;
3958 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3960 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3962 u64 off
= innerloop_pos
;
3964 device_param
->kernel_params_mp_buf64
[3] = off
;
3966 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3971 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3973 cl_int CL_err
= 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
);
3975 if (CL_err
!= CL_SUCCESS
)
3977 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3982 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3984 cl_int CL_err
= 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
);
3986 if (CL_err
!= CL_SUCCESS
)
3988 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3993 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3995 cl_int CL_err
= 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
);
3997 if (CL_err
!= CL_SUCCESS
)
3999 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4004 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
4006 cl_int CL_err
= 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
);
4008 if (CL_err
!= CL_SUCCESS
)
4010 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4015 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
4017 cl_int CL_err
= 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
);
4019 if (CL_err
!= CL_SUCCESS
)
4021 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4027 if (data
.benchmark
== 1)
4029 hc_timer_set (&device_param
->timer_speed
);
4032 int rc
= choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
4034 if (rc
== -1) return -1;
4036 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4038 if (data
.devices_status
== STATUS_CRACKED
) break;
4039 if (data
.devices_status
== STATUS_ABORTED
) break;
4040 if (data
.devices_status
== STATUS_QUIT
) break;
4041 if (data
.devices_status
== STATUS_BYPASS
) break;
4047 if (data
.benchmark
== 0)
4049 check_cracked (device_param
, salt_pos
);
4056 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
4058 hc_thread_mutex_lock (mux_counter
);
4060 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
4062 hc_thread_mutex_unlock (mux_counter
);
4070 hc_timer_get (device_param
->timer_speed
, speed_ms
);
4072 hc_timer_set (&device_param
->timer_speed
);
4076 //hc_thread_mutex_lock (mux_display);
4078 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
4080 device_param
->speed_ms
[speed_pos
] = speed_ms
;
4082 //hc_thread_mutex_unlock (mux_display);
4086 if (speed_pos
== SPEED_CACHE
)
4095 if (data
.benchmark
== 1) break;
4099 device_param
->speed_pos
= speed_pos
;
4106 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
4108 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
4112 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
4114 wl_data
->buf
[wl_data
->cnt
] = 0;
4116 if (wl_data
->cnt
== 0) return;
4118 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
4122 if (wl_data
->cnt
== wl_data
->avail
)
4124 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
4126 wl_data
->avail
+= wl_data
->incr
;
4129 const int c
= fgetc (fd
);
4131 if (c
== EOF
) break;
4133 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
4137 if (c
== '\n') break;
4140 // ensure stream ends with a newline
4142 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
4146 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
4152 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4156 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4158 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4168 if (*ptr
!= '\n') continue;
4172 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4183 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4187 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4189 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4191 if (*ptr
!= '\n') continue;
4195 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4206 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4210 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4212 if (*ptr
!= '\n') continue;
4216 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4227 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
4229 while (wl_data
->pos
< wl_data
->cnt
)
4234 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
4236 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
4238 wl_data
->pos
+= off
;
4240 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4242 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4244 int rule_len_out
= -1;
4246 if (len
< BLOCK_SIZE
)
4248 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
4251 if (rule_len_out
< 0)
4256 if (rule_len_out
> PW_MAX
)
4277 fprintf (stderr
, "BUG feof()!!\n");
4282 load_segment (wl_data
, fd
);
4284 get_next_word (wl_data
, fd
, out_buf
, out_len
);
4288 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
4292 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
4302 fstat (fileno (fd
), &d
.stat
);
4306 _fstat64 (fileno (fd
), &d
.stat
);
4310 d
.stat
.st_nlink
= 0;
4314 d
.stat
.st_atime
= 0;
4317 d
.stat
.st_blksize
= 0;
4318 d
.stat
.st_blocks
= 0;
4321 if (d
.stat
.st_size
== 0) return 0;
4323 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4325 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
4329 u64 cnt
= d_cache
->cnt
;
4333 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4335 keyspace
*= data
.kernel_rules_cnt
;
4337 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4339 keyspace
*= data
.combs_cnt
;
4342 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
);
4343 if (data
.quiet
== 0) log_info ("");
4345 hc_signal (sigHandler_default
);
4360 load_segment (wl_data
, fd
);
4362 comp
+= wl_data
->cnt
;
4366 while (i
< wl_data
->cnt
)
4371 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4373 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4375 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4377 int rule_len_out
= -1;
4379 if (len
< BLOCK_SIZE
)
4381 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4384 if (rule_len_out
< 0)
4396 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4398 cnt
+= data
.kernel_rules_cnt
;
4400 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4402 cnt
+= data
.combs_cnt
;
4415 if ((now
- prev
) == 0) continue;
4417 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4419 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
);
4424 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
);
4425 if (data
.quiet
== 0) log_info ("");
4427 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4429 hc_signal (sigHandler_default
);
4434 static void *thread_monitor (void *p
)
4436 uint runtime_check
= 0;
4437 uint remove_check
= 0;
4438 uint status_check
= 0;
4439 uint restore_check
= 0;
4441 uint restore_left
= data
.restore_timer
;
4442 uint remove_left
= data
.remove_timer
;
4443 uint status_left
= data
.status_timer
;
4446 uint hwmon_check
= 0;
4448 int slowdown_warnings
= 0;
4450 // these variables are mainly used for fan control
4452 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4454 // temperature controller "loopback" values
4456 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4457 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4459 int temp_threshold
= 1; // degrees celcius
4461 int fan_speed_min
= 15; // in percentage
4462 int fan_speed_max
= 100;
4464 time_t last_temp_check_time
;
4465 #endif // HAVE_HWMON
4467 uint sleep_time
= 1;
4474 if (data
.restore_timer
)
4479 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4484 if (data
.status
== 1)
4490 if (data
.gpu_temp_disable
== 0)
4492 time (&last_temp_check_time
);
4498 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4501 if (hwmon_check
== 0)
4506 while (data
.shutdown_inner
== 0)
4508 hc_sleep (sleep_time
);
4510 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4514 if (hwmon_check
== 1)
4516 hc_thread_mutex_lock (mux_adl
);
4518 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4520 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4522 if (device_param
->skipped
) continue;
4524 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4528 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
;
4529 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
;
4531 memset (&perfPolicies_info
, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
));
4532 memset (&perfPolicies_status
, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
));
4534 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4535 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4537 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4539 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4541 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4543 if (perfPolicies_status
.throttle
& 2)
4545 if (slowdown_warnings
< 3)
4547 if (data
.quiet
== 0) clear_prompt ();
4549 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4551 if (slowdown_warnings
== 2)
4556 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4557 if (data
.quiet
== 0) fflush (stdout
);
4559 slowdown_warnings
++;
4564 slowdown_warnings
= 0;
4570 hc_thread_mutex_unlock (mux_adl
);
4573 if (hwmon_check
== 1)
4575 hc_thread_mutex_lock (mux_adl
);
4577 time_t temp_check_time
;
4579 time (&temp_check_time
);
4581 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4583 if (Ta
== 0) Ta
= 1;
4585 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4587 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4589 if (device_param
->skipped
) continue;
4591 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4593 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4595 if (temperature
> (int) data
.gpu_temp_abort
)
4597 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4599 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4604 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4606 if (gpu_temp_retain
)
4608 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4610 int temp_cur
= temperature
;
4612 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4614 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4616 // calculate Ta value (time difference in seconds between the last check and this check)
4618 last_temp_check_time
= temp_check_time
;
4624 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4626 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
);
4628 if (abs (fan_diff_required
) >= temp_threshold
)
4630 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4632 int fan_speed_level
= fan_speed_cur
;
4634 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4636 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4638 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4639 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4641 if (fan_speed_new
!= fan_speed_cur
)
4643 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4644 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4646 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4648 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4650 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4652 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4655 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4659 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4663 fan_speed_chgd
[device_id
] = 1;
4666 temp_diff_old
[device_id
] = temp_diff_new
;
4673 hc_thread_mutex_unlock (mux_adl
);
4675 #endif // HAVE_HWMON
4677 if (restore_check
== 1)
4681 if (restore_left
== 0)
4683 if (data
.restore_disable
== 0) cycle_restore ();
4685 restore_left
= data
.restore_timer
;
4689 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4693 time (&runtime_cur
);
4695 int runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
4697 if (runtime_left
<= 0)
4699 if (data
.benchmark
== 0)
4701 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4704 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4708 if (remove_check
== 1)
4712 if (remove_left
== 0)
4714 if (data
.digests_saved
!= data
.digests_done
)
4716 data
.digests_saved
= data
.digests_done
;
4721 remove_left
= data
.remove_timer
;
4725 if (status_check
== 1)
4729 if (status_left
== 0)
4731 hc_thread_mutex_lock (mux_display
);
4733 if (data
.quiet
== 0) clear_prompt ();
4735 if (data
.quiet
== 0) log_info ("");
4739 if (data
.quiet
== 0) log_info ("");
4741 hc_thread_mutex_unlock (mux_display
);
4743 status_left
= data
.status_timer
;
4749 myfree (fan_speed_chgd
);
4751 myfree (temp_diff_old
);
4752 myfree (temp_diff_sum
);
4760 static void *thread_outfile_remove (void *p
)
4762 // some hash-dependent constants
4763 char *outfile_dir
= data
.outfile_check_directory
;
4764 uint dgst_size
= data
.dgst_size
;
4765 uint isSalted
= data
.isSalted
;
4766 uint esalt_size
= data
.esalt_size
;
4767 uint hash_mode
= data
.hash_mode
;
4769 uint outfile_check_timer
= data
.outfile_check_timer
;
4771 char separator
= data
.separator
;
4773 // some hash-dependent functions
4774 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4775 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4778 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4780 hash_buf
.digest
= mymalloc (dgst_size
);
4782 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4784 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4786 uint digest_buf
[64] = { 0 };
4788 outfile_data_t
*out_info
= NULL
;
4790 char **out_files
= NULL
;
4792 time_t folder_mtime
= 0;
4796 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4798 while (data
.shutdown_inner
== 0)
4802 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4806 if (check_left
== 0)
4808 struct stat outfile_check_stat
;
4810 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4812 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4816 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4818 char **out_files_new
= scan_directory (outfile_dir
);
4820 int out_cnt_new
= count_dictionaries (out_files_new
);
4822 outfile_data_t
*out_info_new
= NULL
;
4824 if (out_cnt_new
> 0)
4826 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4828 for (int i
= 0; i
< out_cnt_new
; i
++)
4830 out_info_new
[i
].file_name
= out_files_new
[i
];
4832 // check if there are files that we have seen/checked before (and not changed)
4834 for (int j
= 0; j
< out_cnt
; j
++)
4836 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4838 struct stat outfile_stat
;
4840 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4842 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4844 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4845 out_info_new
[i
].seek
= out_info
[j
].seek
;
4853 local_free (out_info
);
4854 local_free (out_files
);
4856 out_files
= out_files_new
;
4857 out_cnt
= out_cnt_new
;
4858 out_info
= out_info_new
;
4860 folder_mtime
= outfile_check_stat
.st_mtime
;
4863 for (int j
= 0; j
< out_cnt
; j
++)
4865 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4869 //hc_thread_mutex_lock (mux_display);
4872 struct stat outfile_stat
;
4874 fstat (fileno (fp
), &outfile_stat
);
4878 struct stat64 outfile_stat
;
4880 _fstat64 (fileno (fp
), &outfile_stat
);
4883 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4885 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4886 out_info
[j
].seek
= 0;
4889 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4891 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4895 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4897 if (ptr
== NULL
) break;
4899 int line_len
= strlen (line_buf
);
4901 if (line_len
<= 0) continue;
4903 int iter
= MAX_CUT_TRIES
;
4905 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4907 if (line_buf
[i
] != separator
) continue;
4909 int parser_status
= PARSER_OK
;
4911 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4913 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4918 if (parser_status
== PARSER_OK
)
4920 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4922 if (data
.salts_shown
[salt_pos
] == 1) continue;
4924 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4926 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4928 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4930 if (data
.digests_shown
[idx
] == 1) continue;
4934 if (hash_mode
== 6800)
4936 if (i
== salt_buf
->salt_len
)
4938 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4941 else if (hash_mode
== 2500)
4943 // BSSID : MAC1 : MAC2 (:plain)
4944 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4946 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4948 if (!cracked
) continue;
4950 // now compare MAC1 and MAC2 too, since we have this additional info
4951 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4952 char *mac2_pos
= mac1_pos
+ 12 + 1;
4954 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4955 wpa_t
*wpa
= &wpas
[salt_pos
];
4957 // compare hex string(s) vs binary MAC address(es)
4959 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4961 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4970 if (!cracked
) continue;
4972 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4974 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4985 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4987 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4989 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4996 data
.digests_shown
[idx
] = 1;
4998 data
.digests_done
++;
5000 salt_buf
->digests_done
++;
5002 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
5004 data
.salts_shown
[salt_pos
] = 1;
5008 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
5013 if (data
.devices_status
== STATUS_CRACKED
) break;
5019 if (data
.devices_status
== STATUS_CRACKED
) break;
5024 if (data
.devices_status
== STATUS_CRACKED
) break;
5029 out_info
[j
].seek
= ftell (fp
);
5031 //hc_thread_mutex_unlock (mux_display);
5039 check_left
= outfile_check_timer
;
5043 if (esalt_size
) local_free (hash_buf
.esalt
);
5045 if (isSalted
) local_free (hash_buf
.salt
);
5047 local_free (hash_buf
.digest
);
5049 local_free (out_info
);
5051 local_free (out_files
);
5058 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
5060 //if (device_param->pws_cnt < device_param->kernel_power)
5062 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
5064 u8
*ptr
= (u8
*) pw
->i
;
5066 memcpy (ptr
, pw_buf
, pw_len
);
5068 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
5070 pw
->pw_len
= pw_len
;
5072 device_param
->pws_cnt
++;
5076 // fprintf (stderr, "BUG pw_add()!!\n");
5082 static void set_kernel_power_final (const u64 kernel_power_final
)
5084 if (data
.quiet
== 0)
5090 log_info ("INFO: approaching final keyspace, workload adjusted");
5093 fprintf (stdout
, "%s", PROMPT
);
5098 data
.kernel_power_final
= kernel_power_final
;
5101 static u32
get_power (hc_device_param_t
*device_param
)
5103 const u64 kernel_power_final
= data
.kernel_power_final
;
5105 if (kernel_power_final
)
5107 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
5109 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
5111 // work should be at least the hardware power available without any accelerator
5113 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
5118 return device_param
->kernel_power
;
5121 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
5123 hc_thread_mutex_lock (mux_dispatcher
);
5125 const u64 words_cur
= data
.words_cur
;
5126 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
5128 device_param
->words_off
= words_cur
;
5130 const u64 kernel_power_all
= data
.kernel_power_all
;
5132 const u64 words_left
= words_base
- words_cur
;
5134 if (words_left
< kernel_power_all
)
5136 if (data
.kernel_power_final
== 0)
5138 set_kernel_power_final (words_left
);
5142 const u32 kernel_power
= get_power (device_param
);
5144 uint work
= MIN (words_left
, kernel_power
);
5146 work
= MIN (work
, max
);
5148 data
.words_cur
+= work
;
5150 hc_thread_mutex_unlock (mux_dispatcher
);
5155 static void *thread_autotune (void *p
)
5157 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5159 if (device_param
->skipped
) return NULL
;
5161 autotune (device_param
);
5166 static void *thread_calc_stdin (void *p
)
5168 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5170 if (device_param
->skipped
) return NULL
;
5172 char *buf
= (char *) mymalloc (HCBUFSIZ
);
5174 const uint attack_kern
= data
.attack_kern
;
5176 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5178 hc_thread_mutex_lock (mux_dispatcher
);
5180 if (feof (stdin
) != 0)
5182 hc_thread_mutex_unlock (mux_dispatcher
);
5189 while (words_cur
< device_param
->kernel_power
)
5191 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
5193 if (line_buf
== NULL
) break;
5195 uint line_len
= in_superchop (line_buf
);
5197 line_len
= convert_from_hex (line_buf
, line_len
);
5199 // post-process rule engine
5201 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5203 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5205 int rule_len_out
= -1;
5207 if (line_len
< BLOCK_SIZE
)
5209 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5212 if (rule_len_out
< 0) continue;
5214 line_buf
= rule_buf_out
;
5215 line_len
= rule_len_out
;
5218 if (line_len
> PW_MAX
)
5223 // hmm that's always the case, or?
5225 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5227 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5229 hc_thread_mutex_lock (mux_counter
);
5231 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5233 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5236 hc_thread_mutex_unlock (mux_counter
);
5242 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5246 if (data
.devices_status
== STATUS_CRACKED
) break;
5247 if (data
.devices_status
== STATUS_ABORTED
) break;
5248 if (data
.devices_status
== STATUS_QUIT
) break;
5249 if (data
.devices_status
== STATUS_BYPASS
) break;
5252 hc_thread_mutex_unlock (mux_dispatcher
);
5254 if (data
.devices_status
== STATUS_CRACKED
) break;
5255 if (data
.devices_status
== STATUS_ABORTED
) break;
5256 if (data
.devices_status
== STATUS_QUIT
) break;
5257 if (data
.devices_status
== STATUS_BYPASS
) break;
5261 const uint pws_cnt
= device_param
->pws_cnt
;
5265 run_copy (device_param
, pws_cnt
);
5267 run_cracker (device_param
, pws_cnt
);
5269 device_param
->pws_cnt
= 0;
5273 if (attack_kern == ATTACK_KERN_STRAIGHT)
5275 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5277 else if (attack_kern == ATTACK_KERN_COMBI)
5279 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5285 device_param
->kernel_accel
= 0;
5286 device_param
->kernel_loops
= 0;
5293 static void *thread_calc (void *p
)
5295 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5297 if (device_param
->skipped
) return NULL
;
5299 const uint attack_mode
= data
.attack_mode
;
5300 const uint attack_kern
= data
.attack_kern
;
5302 if (attack_mode
== ATTACK_MODE_BF
)
5304 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5306 const uint work
= get_work (device_param
, -1);
5308 if (work
== 0) break;
5310 const u64 words_off
= device_param
->words_off
;
5311 const u64 words_fin
= words_off
+ work
;
5313 const uint pws_cnt
= work
;
5315 device_param
->pws_cnt
= pws_cnt
;
5319 run_copy (device_param
, pws_cnt
);
5321 run_cracker (device_param
, pws_cnt
);
5323 device_param
->pws_cnt
= 0;
5327 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
5331 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5333 if (data
.devices_status
== STATUS_CRACKED
) break;
5334 if (data
.devices_status
== STATUS_ABORTED
) break;
5335 if (data
.devices_status
== STATUS_QUIT
) break;
5336 if (data
.devices_status
== STATUS_BYPASS
) break;
5338 if (data
.benchmark
== 1) break;
5340 device_param
->words_done
= words_fin
;
5345 const uint segment_size
= data
.segment_size
;
5347 char *dictfile
= data
.dictfile
;
5349 if (attack_mode
== ATTACK_MODE_COMBI
)
5351 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5353 dictfile
= data
.dictfile2
;
5357 FILE *fd
= fopen (dictfile
, "rb");
5361 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5366 if (attack_mode
== ATTACK_MODE_COMBI
)
5368 const uint combs_mode
= data
.combs_mode
;
5370 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5372 const char *dictfilec
= data
.dictfile2
;
5374 FILE *combs_fp
= fopen (dictfilec
, "rb");
5376 if (combs_fp
== NULL
)
5378 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5385 device_param
->combs_fp
= combs_fp
;
5387 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5389 const char *dictfilec
= data
.dictfile
;
5391 FILE *combs_fp
= fopen (dictfilec
, "rb");
5393 if (combs_fp
== NULL
)
5395 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5402 device_param
->combs_fp
= combs_fp
;
5406 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5408 wl_data
->buf
= (char *) mymalloc (segment_size
);
5409 wl_data
->avail
= segment_size
;
5410 wl_data
->incr
= segment_size
;
5416 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5425 const uint work
= get_work (device_param
, max
);
5427 if (work
== 0) break;
5431 words_off
= device_param
->words_off
;
5432 words_fin
= words_off
+ work
;
5437 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5439 for ( ; words_cur
< words_fin
; words_cur
++)
5441 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5443 line_len
= convert_from_hex (line_buf
, line_len
);
5445 // post-process rule engine
5447 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5449 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5451 int rule_len_out
= -1;
5453 if (line_len
< BLOCK_SIZE
)
5455 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5458 if (rule_len_out
< 0) continue;
5460 line_buf
= rule_buf_out
;
5461 line_len
= rule_len_out
;
5464 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5466 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5470 hc_thread_mutex_lock (mux_counter
);
5472 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5474 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5477 hc_thread_mutex_unlock (mux_counter
);
5482 else if (attack_kern
== ATTACK_KERN_COMBI
)
5484 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5485 // since we still need to combine the plains
5487 if (line_len
> data
.pw_max
)
5491 hc_thread_mutex_lock (mux_counter
);
5493 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5495 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5498 hc_thread_mutex_unlock (mux_counter
);
5504 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5506 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5508 if (data
.devices_status
== STATUS_CRACKED
) break;
5509 if (data
.devices_status
== STATUS_ABORTED
) break;
5510 if (data
.devices_status
== STATUS_QUIT
) break;
5511 if (data
.devices_status
== STATUS_BYPASS
) break;
5514 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5516 if (data
.devices_status
== STATUS_CRACKED
) break;
5517 if (data
.devices_status
== STATUS_ABORTED
) break;
5518 if (data
.devices_status
== STATUS_QUIT
) break;
5519 if (data
.devices_status
== STATUS_BYPASS
) break;
5522 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5524 if (data
.devices_status
== STATUS_CRACKED
) break;
5525 if (data
.devices_status
== STATUS_ABORTED
) break;
5526 if (data
.devices_status
== STATUS_QUIT
) break;
5527 if (data
.devices_status
== STATUS_BYPASS
) break;
5533 const uint pws_cnt
= device_param
->pws_cnt
;
5537 run_copy (device_param
, pws_cnt
);
5539 run_cracker (device_param
, pws_cnt
);
5541 device_param
->pws_cnt
= 0;
5545 if (attack_kern == ATTACK_KERN_STRAIGHT)
5547 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5549 else if (attack_kern == ATTACK_KERN_COMBI)
5551 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5556 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5558 if (data
.devices_status
== STATUS_CRACKED
) break;
5559 if (data
.devices_status
== STATUS_ABORTED
) break;
5560 if (data
.devices_status
== STATUS_QUIT
) break;
5561 if (data
.devices_status
== STATUS_BYPASS
) break;
5563 if (words_fin
== 0) break;
5565 device_param
->words_done
= words_fin
;
5568 if (attack_mode
== ATTACK_MODE_COMBI
)
5570 fclose (device_param
->combs_fp
);
5573 free (wl_data
->buf
);
5579 device_param
->kernel_accel
= 0;
5580 device_param
->kernel_loops
= 0;
5585 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5589 log_error ("ERROR: %s : Invalid argument", __func__
);
5594 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5596 device_param
->kernel_params_buf32
[27] = salt_pos
;
5597 device_param
->kernel_params_buf32
[30] = 1;
5598 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5599 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5600 device_param
->kernel_params_buf32
[33] = 0;
5601 device_param
->kernel_params_buf32
[34] = 1;
5603 char *dictfile_old
= data
.dictfile
;
5605 const char *weak_hash_check
= "weak-hash-check";
5607 data
.dictfile
= (char *) weak_hash_check
;
5609 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5611 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5617 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5619 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5623 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5625 uint loop_step
= 16;
5627 const uint iter
= salt_buf
->salt_iter
;
5629 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5631 uint loop_left
= iter
- loop_pos
;
5633 loop_left
= MIN (loop_left
, loop_step
);
5635 device_param
->kernel_params_buf32
[28] = loop_pos
;
5636 device_param
->kernel_params_buf32
[29] = loop_left
;
5638 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5641 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5648 check_cracked (device_param
, salt_pos
);
5654 device_param
->kernel_params_buf32
[27] = 0;
5655 device_param
->kernel_params_buf32
[28] = 0;
5656 device_param
->kernel_params_buf32
[29] = 0;
5657 device_param
->kernel_params_buf32
[30] = 0;
5658 device_param
->kernel_params_buf32
[31] = 0;
5659 device_param
->kernel_params_buf32
[32] = 0;
5660 device_param
->kernel_params_buf32
[33] = 0;
5661 device_param
->kernel_params_buf32
[34] = 0;
5663 data
.dictfile
= dictfile_old
;
5665 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5670 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5672 if (data
.username
== 0)
5674 *hashbuf_pos
= line_buf
;
5675 *hashbuf_len
= line_len
;
5679 char *pos
= line_buf
;
5682 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5684 if (line_buf
[i
] == data
.separator
)
5699 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5706 for (int i
= 0; i
< line_len
; i
++)
5708 if (line_buf
[i
] == data
.separator
)
5717 if (pos
== NULL
) pos
= line_buf
+ i
;
5729 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5736 for (int i
= 0; i
< line_len
; i
++)
5738 if (line_buf
[i
] == ':')
5745 if (sep_cnt
== 2) sep2_len
++;
5746 if (sep_cnt
== 3) sep3_len
++;
5749 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5754 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5761 for (int i
= 0; i
< line_len
; i
++)
5763 if (line_buf
[i
] == ':')
5770 if (data
.hash_mode
== 1000)
5774 if (pos
== NULL
) pos
= line_buf
+ i
;
5779 else if (data
.hash_mode
== 3000)
5783 if (pos
== NULL
) pos
= line_buf
+ i
;
5794 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5801 for (int i
= 0; i
< line_len
; i
++)
5803 if (line_buf
[i
] == ':')
5812 if (pos
== NULL
) pos
= line_buf
+ i
;
5824 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5828 char sep5_first
= 0;
5829 char sep6_first
= 0;
5831 for (int i
= 0; i
< line_len
; i
++)
5833 if (line_buf
[i
] == ':')
5840 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5841 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5844 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5849 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5856 for (int i
= 0; i
< line_len
; i
++)
5858 if (line_buf
[i
] == ':')
5867 if (pos
== NULL
) pos
= line_buf
+ i
;
5877 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5884 for (int i
= 0; i
< line_len
; i
++)
5886 if (line_buf
[i
] == ':')
5895 if (pos
== NULL
) pos
= line_buf
+ i
;
5907 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5911 for (int i
= 0; i
< line_len
; i
++)
5913 if (line_buf
[i
] == ':') sep_cnt
++;
5916 if (sep_cnt
== 8) return 1;
5921 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5923 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5926 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5928 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5933 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5935 switch (hashfile_format
)
5937 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5938 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5939 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5940 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5944 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5946 switch (hashfile_format
)
5948 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5949 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5950 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5951 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5955 char *strhlfmt (const uint hashfile_format
)
5957 switch (hashfile_format
)
5959 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5960 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5961 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5962 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5963 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5964 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5965 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5966 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5967 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5968 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5971 return ((char *) "Unknown");
5974 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5976 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5978 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5979 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5981 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5985 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5989 int line_len
= fgetl (fp
, line_buf
);
5991 if (line_len
== 0) continue;
5993 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5994 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5995 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5997 if (num_check
== max_check
) break;
6004 uint hashlist_format
= HLFMT_HASHCAT
;
6006 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
6008 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
6010 hashlist_format
= i
;
6015 return hashlist_format
;
6019 * some further helper function
6022 // wrapper around mymalloc for ADL
6024 #if defined(HAVE_HWMON)
6025 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
6027 return mymalloc (iSize
);
6031 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
)
6035 const uint dgst_pos0
= data
.dgst_pos0
;
6036 const uint dgst_pos1
= data
.dgst_pos1
;
6037 const uint dgst_pos2
= data
.dgst_pos2
;
6038 const uint dgst_pos3
= data
.dgst_pos3
;
6040 memset (bitmap_a
, 0, bitmap_size
);
6041 memset (bitmap_b
, 0, bitmap_size
);
6042 memset (bitmap_c
, 0, bitmap_size
);
6043 memset (bitmap_d
, 0, bitmap_size
);
6045 for (uint i
= 0; i
< digests_cnt
; i
++)
6047 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
6049 digests_buf_ptr
+= dgst_size
;
6051 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
6052 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
6053 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
6054 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
6056 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
6057 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
6058 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
6059 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
6061 if (bitmap_a
[idx0
] & val0
) collisions
++;
6062 if (bitmap_b
[idx1
] & val1
) collisions
++;
6063 if (bitmap_c
[idx2
] & val2
) collisions
++;
6064 if (bitmap_d
[idx3
] & val3
) collisions
++;
6066 bitmap_a
[idx0
] |= val0
;
6067 bitmap_b
[idx1
] |= val1
;
6068 bitmap_c
[idx2
] |= val2
;
6069 bitmap_d
[idx3
] |= val3
;
6071 if (collisions
>= collisions_max
) return 0x7fffffff;
6082 void SetConsoleWindowSize (const int x
)
6084 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
6086 if (h
== INVALID_HANDLE_VALUE
) return;
6088 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
6090 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
6092 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
6094 sr
->Right
= MAX (sr
->Right
, x
- 1);
6098 co
.X
= sr
->Right
+ 1;
6101 if (!SetConsoleScreenBufferSize (h
, co
)) return;
6103 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
6107 int main (int argc
, char **argv
)
6110 SetConsoleWindowSize (132);
6114 * To help users a bit
6117 char *compute
= getenv ("COMPUTE");
6121 static char display
[100];
6123 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
6129 if (getenv ("DISPLAY") == NULL
)
6130 putenv ((char *) "DISPLAY=:0");
6133 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
6134 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
6136 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
6137 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
6139 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
6140 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
6142 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
6143 putenv ((char *) "CUDA_CACHE_DISABLE=1");
6145 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
6146 putenv ((char *) "POCL_KERNEL_CACHE=0");
6151 * There's some buggy OpenCL runtime that do not support -I.
6152 * A workaround is to chdir() to the OpenCL folder,
6153 * then compile the kernels,
6154 * then chdir() back to where we came from so we need to save it first
6159 if (getcwd (cwd
, sizeof (cwd
) - 1) == NULL
)
6161 log_error ("ERROR: getcwd(): %s", strerror (errno
));
6170 memset (&data
, 0, sizeof (hc_global_data_t
));
6176 data
.proc_start
= proc_start
;
6178 time_t prepare_start
;
6180 time (&prepare_start
);
6183 char **myargv
= argv
;
6185 hc_thread_mutex_init (mux_dispatcher
);
6186 hc_thread_mutex_init (mux_counter
);
6187 hc_thread_mutex_init (mux_display
);
6188 hc_thread_mutex_init (mux_adl
);
6191 * commandline parameters
6195 uint version
= VERSION
;
6197 uint benchmark
= BENCHMARK
;
6198 uint stdout_flag
= STDOUT_FLAG
;
6201 uint username
= USERNAME
;
6202 uint remove
= REMOVE
;
6203 uint remove_timer
= REMOVE_TIMER
;
6206 uint keyspace
= KEYSPACE
;
6207 uint potfile_disable
= POTFILE_DISABLE
;
6208 char *potfile_path
= NULL
;
6209 uint debug_mode
= DEBUG_MODE
;
6210 char *debug_file
= NULL
;
6211 char *induction_dir
= NULL
;
6212 char *outfile_check_dir
= NULL
;
6214 uint runtime
= RUNTIME
;
6215 uint hash_mode
= HASH_MODE
;
6216 uint attack_mode
= ATTACK_MODE
;
6217 uint markov_disable
= MARKOV_DISABLE
;
6218 uint markov_classic
= MARKOV_CLASSIC
;
6219 uint markov_threshold
= MARKOV_THRESHOLD
;
6220 char *markov_hcstat
= NULL
;
6221 char *outfile
= NULL
;
6222 uint outfile_format
= OUTFILE_FORMAT
;
6223 uint outfile_autohex
= OUTFILE_AUTOHEX
;
6224 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
6225 uint restore
= RESTORE
;
6226 uint restore_timer
= RESTORE_TIMER
;
6227 uint restore_disable
= RESTORE_DISABLE
;
6228 uint status
= STATUS
;
6229 uint status_timer
= STATUS_TIMER
;
6230 uint machine_readable
= MACHINE_READABLE
;
6231 uint loopback
= LOOPBACK
;
6232 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
6233 char *session
= NULL
;
6234 uint hex_charset
= HEX_CHARSET
;
6235 uint hex_salt
= HEX_SALT
;
6236 uint hex_wordlist
= HEX_WORDLIST
;
6237 uint rp_gen
= RP_GEN
;
6238 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
6239 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
6240 uint rp_gen_seed
= RP_GEN_SEED
;
6241 char *rule_buf_l
= (char *) RULE_BUF_L
;
6242 char *rule_buf_r
= (char *) RULE_BUF_R
;
6243 uint increment
= INCREMENT
;
6244 uint increment_min
= INCREMENT_MIN
;
6245 uint increment_max
= INCREMENT_MAX
;
6246 char *cpu_affinity
= NULL
;
6247 OCL_PTR
*ocl
= NULL
;
6248 char *opencl_devices
= NULL
;
6249 char *opencl_platforms
= NULL
;
6250 char *opencl_device_types
= NULL
;
6251 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
6252 char *truecrypt_keyfiles
= NULL
;
6253 char *veracrypt_keyfiles
= NULL
;
6254 uint veracrypt_pim
= 0;
6255 uint workload_profile
= WORKLOAD_PROFILE
;
6256 uint kernel_accel
= KERNEL_ACCEL
;
6257 uint kernel_loops
= KERNEL_LOOPS
;
6258 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
6259 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
6261 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
6262 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
6263 uint powertune_enable
= POWERTUNE_ENABLE
;
6265 uint logfile_disable
= LOGFILE_DISABLE
;
6266 uint segment_size
= SEGMENT_SIZE
;
6267 uint scrypt_tmto
= SCRYPT_TMTO
;
6268 char separator
= SEPARATOR
;
6269 uint bitmap_min
= BITMAP_MIN
;
6270 uint bitmap_max
= BITMAP_MAX
;
6271 char *custom_charset_1
= NULL
;
6272 char *custom_charset_2
= NULL
;
6273 char *custom_charset_3
= NULL
;
6274 char *custom_charset_4
= NULL
;
6276 #define IDX_HELP 'h'
6277 #define IDX_VERSION 'V'
6278 #define IDX_VERSION_LOWER 'v'
6279 #define IDX_QUIET 0xff02
6280 #define IDX_SHOW 0xff03
6281 #define IDX_LEFT 0xff04
6282 #define IDX_REMOVE 0xff05
6283 #define IDX_REMOVE_TIMER 0xff37
6284 #define IDX_SKIP 's'
6285 #define IDX_LIMIT 'l'
6286 #define IDX_KEYSPACE 0xff35
6287 #define IDX_POTFILE_DISABLE 0xff06
6288 #define IDX_POTFILE_PATH 0xffe0
6289 #define IDX_DEBUG_MODE 0xff43
6290 #define IDX_DEBUG_FILE 0xff44
6291 #define IDX_INDUCTION_DIR 0xff46
6292 #define IDX_OUTFILE_CHECK_DIR 0xff47
6293 #define IDX_USERNAME 0xff07
6294 #define IDX_FORCE 0xff08
6295 #define IDX_RUNTIME 0xff09
6296 #define IDX_BENCHMARK 'b'
6297 #define IDX_STDOUT_FLAG 0xff77
6298 #define IDX_HASH_MODE 'm'
6299 #define IDX_ATTACK_MODE 'a'
6300 #define IDX_RP_FILE 'r'
6301 #define IDX_RP_GEN 'g'
6302 #define IDX_RP_GEN_FUNC_MIN 0xff10
6303 #define IDX_RP_GEN_FUNC_MAX 0xff11
6304 #define IDX_RP_GEN_SEED 0xff34
6305 #define IDX_RULE_BUF_L 'j'
6306 #define IDX_RULE_BUF_R 'k'
6307 #define IDX_INCREMENT 'i'
6308 #define IDX_INCREMENT_MIN 0xff12
6309 #define IDX_INCREMENT_MAX 0xff13
6310 #define IDX_OUTFILE 'o'
6311 #define IDX_OUTFILE_FORMAT 0xff14
6312 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
6313 #define IDX_OUTFILE_CHECK_TIMER 0xff45
6314 #define IDX_RESTORE 0xff15
6315 #define IDX_RESTORE_DISABLE 0xff27
6316 #define IDX_STATUS 0xff17
6317 #define IDX_STATUS_TIMER 0xff18
6318 #define IDX_MACHINE_READABLE 0xff50
6319 #define IDX_LOOPBACK 0xff38
6320 #define IDX_WEAK_HASH_THRESHOLD 0xff42
6321 #define IDX_SESSION 0xff19
6322 #define IDX_HEX_CHARSET 0xff20
6323 #define IDX_HEX_SALT 0xff21
6324 #define IDX_HEX_WORDLIST 0xff40
6325 #define IDX_MARKOV_DISABLE 0xff22
6326 #define IDX_MARKOV_CLASSIC 0xff23
6327 #define IDX_MARKOV_THRESHOLD 't'
6328 #define IDX_MARKOV_HCSTAT 0xff24
6329 #define IDX_CPU_AFFINITY 0xff25
6330 #define IDX_OPENCL_DEVICES 'd'
6331 #define IDX_OPENCL_PLATFORMS 0xff72
6332 #define IDX_OPENCL_DEVICE_TYPES 'D'
6333 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
6334 #define IDX_WORKLOAD_PROFILE 'w'
6335 #define IDX_KERNEL_ACCEL 'n'
6336 #define IDX_KERNEL_LOOPS 'u'
6337 #define IDX_NVIDIA_SPIN_DAMP 0xff79
6338 #define IDX_GPU_TEMP_DISABLE 0xff29
6339 #define IDX_GPU_TEMP_ABORT 0xff30
6340 #define IDX_GPU_TEMP_RETAIN 0xff31
6341 #define IDX_POWERTUNE_ENABLE 0xff41
6342 #define IDX_LOGFILE_DISABLE 0xff51
6343 #define IDX_TRUECRYPT_KEYFILES 0xff52
6344 #define IDX_VERACRYPT_KEYFILES 0xff53
6345 #define IDX_VERACRYPT_PIM 0xff54
6346 #define IDX_SCRYPT_TMTO 0xff61
6347 #define IDX_SEGMENT_SIZE 'c'
6348 #define IDX_SEPARATOR 'p'
6349 #define IDX_BITMAP_MIN 0xff70
6350 #define IDX_BITMAP_MAX 0xff71
6351 #define IDX_CUSTOM_CHARSET_1 '1'
6352 #define IDX_CUSTOM_CHARSET_2 '2'
6353 #define IDX_CUSTOM_CHARSET_3 '3'
6354 #define IDX_CUSTOM_CHARSET_4 '4'
6356 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
6358 struct option long_options
[] =
6360 {"help", no_argument
, 0, IDX_HELP
},
6361 {"version", no_argument
, 0, IDX_VERSION
},
6362 {"quiet", no_argument
, 0, IDX_QUIET
},
6363 {"show", no_argument
, 0, IDX_SHOW
},
6364 {"left", no_argument
, 0, IDX_LEFT
},
6365 {"username", no_argument
, 0, IDX_USERNAME
},
6366 {"remove", no_argument
, 0, IDX_REMOVE
},
6367 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
6368 {"skip", required_argument
, 0, IDX_SKIP
},
6369 {"limit", required_argument
, 0, IDX_LIMIT
},
6370 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6371 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6372 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6373 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6374 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6375 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6376 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6377 {"force", no_argument
, 0, IDX_FORCE
},
6378 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6379 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6380 {"restore", no_argument
, 0, IDX_RESTORE
},
6381 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6382 {"status", no_argument
, 0, IDX_STATUS
},
6383 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6384 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6385 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6386 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6387 {"session", required_argument
, 0, IDX_SESSION
},
6388 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6389 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6390 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6391 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6392 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6393 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6394 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6395 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6396 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6397 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6398 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6399 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6400 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6401 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6402 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6403 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6404 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6405 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6406 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6407 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6408 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6409 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6410 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6411 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6412 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6413 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6414 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6415 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6416 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6417 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6418 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6420 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6421 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6422 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6423 #endif // HAVE_HWMON
6424 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6425 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6426 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6427 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6428 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6429 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6430 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6431 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6432 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6433 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6434 {"increment", no_argument
, 0, IDX_INCREMENT
},
6435 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6436 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6437 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6438 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6439 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6440 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6444 uint rp_files_cnt
= 0;
6446 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6448 int option_index
= 0;
6454 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6458 case IDX_HELP
: usage
= 1; break;
6460 case IDX_VERSION_LOWER
: version
= 1; break;
6461 case IDX_RESTORE
: restore
= 1; break;
6462 case IDX_SESSION
: session
= optarg
; break;
6463 case IDX_SHOW
: show
= 1; break;
6464 case IDX_LEFT
: left
= 1; break;
6465 case '?': return -1;
6471 log_error ("ERROR: Invalid argument specified");
6482 log_info ("%s", VERSION_TAG
);
6489 usage_big_print (PROGNAME
);
6495 * session needs to be set, always!
6498 if (session
== NULL
) session
= (char *) PROGNAME
;
6501 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6504 char *exec_path
= get_exec_path ();
6507 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
6509 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6510 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6512 if (resolved_install_folder
== NULL
)
6514 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6519 if (resolved_exec_path
== NULL
)
6521 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6526 char *install_dir
= get_install_dir (resolved_exec_path
);
6527 char *profile_dir
= NULL
;
6528 char *session_dir
= NULL
;
6529 char *shared_dir
= NULL
;
6531 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6533 struct passwd
*pw
= getpwuid (getuid ());
6535 const char *homedir
= pw
->pw_dir
;
6537 profile_dir
= get_profile_dir (homedir
);
6538 session_dir
= get_session_dir (profile_dir
);
6539 shared_dir
= strdup (SHARED_FOLDER
);
6541 mkdir (profile_dir
, 0700);
6542 mkdir (session_dir
, 0700);
6546 profile_dir
= install_dir
;
6547 session_dir
= install_dir
;
6548 shared_dir
= install_dir
;
6551 myfree (resolved_install_folder
);
6552 myfree (resolved_exec_path
);
6556 char *install_dir
= get_install_dir (exec_path
);
6557 char *profile_dir
= install_dir
;
6558 char *session_dir
= install_dir
;
6559 char *shared_dir
= install_dir
;
6563 data
.install_dir
= install_dir
;
6564 data
.profile_dir
= profile_dir
;
6565 data
.session_dir
= session_dir
;
6566 data
.shared_dir
= shared_dir
;
6571 * There's alot of problem related to bad support -I parameters when building the kernel.
6572 * Each OpenCL runtime handles it slightly different.
6573 * The most problematic is with new AMD drivers on Windows, which can not handle quote characters!
6574 * The best workaround found so far is to modify the TMP variable (only inside hashcat process) before the runtime is load
6577 char cpath
[1024] = { 0 };
6581 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
6583 char *cpath_real
= mymalloc (MAX_PATH
);
6585 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
6587 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
6594 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
6596 char *cpath_real
= mymalloc (PATH_MAX
);
6598 if (realpath (cpath
, cpath_real
) == NULL
)
6600 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
6607 //if (getenv ("TMP") == NULL)
6612 snprintf (tmp
, sizeof (tmp
) - 1, "TMP=%s", cpath_real
);
6619 naive_replace (cpath_real
, '\\', '/');
6621 // not escaping here, windows using quotes later
6622 // naive_escape (cpath_real, PATH_MAX, ' ', '\\');
6626 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
6631 * kernel cache, we need to make sure folder exist
6634 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6636 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6638 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6640 mkdir (kernels_folder
, 0700);
6642 myfree (kernels_folder
);
6648 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6650 data
.session
= session
;
6652 char *eff_restore_file
= (char *) mymalloc (session_size
);
6653 char *new_restore_file
= (char *) mymalloc (session_size
);
6655 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6656 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6658 data
.eff_restore_file
= eff_restore_file
;
6659 data
.new_restore_file
= new_restore_file
;
6661 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6663 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6664 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6669 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6670 if ((show
== 1) || (left
== 1))
6672 restore_disable
= 1;
6677 data
.restore_disable
= restore_disable
;
6679 restore_data_t
*rd
= init_restore (argc
, argv
);
6689 read_restore (eff_restore_file
, rd
);
6691 if (rd
->version_bin
< RESTORE_MIN
)
6693 log_error ("ERROR: Incompatible restore-file version");
6702 rd
->pid
= getpid ();
6704 rd
->pid
= GetCurrentProcessId ();
6708 uint hash_mode_chgd
= 0;
6709 uint runtime_chgd
= 0;
6710 uint kernel_loops_chgd
= 0;
6711 uint kernel_accel_chgd
= 0;
6712 uint nvidia_spin_damp_chgd
= 0;
6713 uint attack_mode_chgd
= 0;
6714 uint outfile_format_chgd
= 0;
6715 uint rp_gen_seed_chgd
= 0;
6716 uint remove_timer_chgd
= 0;
6717 uint increment_min_chgd
= 0;
6718 uint increment_max_chgd
= 0;
6719 uint workload_profile_chgd
= 0;
6720 uint opencl_vector_width_chgd
= 0;
6726 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6730 //case IDX_HELP: usage = 1; break;
6731 //case IDX_VERSION: version = 1; break;
6732 //case IDX_RESTORE: restore = 1; break;
6733 case IDX_QUIET
: quiet
= 1; break;
6734 //case IDX_SHOW: show = 1; break;
6735 case IDX_SHOW
: break;
6736 //case IDX_LEFT: left = 1; break;
6737 case IDX_LEFT
: break;
6738 case IDX_USERNAME
: username
= 1; break;
6739 case IDX_REMOVE
: remove
= 1; break;
6740 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6741 remove_timer_chgd
= 1; break;
6742 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6743 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6744 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6745 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6746 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6747 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6748 case IDX_FORCE
: force
= 1; break;
6749 case IDX_SKIP
: skip
= atoll (optarg
); break;
6750 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6751 case IDX_KEYSPACE
: keyspace
= 1; break;
6752 case IDX_BENCHMARK
: benchmark
= 1; break;
6753 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6754 case IDX_RESTORE
: break;
6755 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6756 case IDX_STATUS
: status
= 1; break;
6757 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6758 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6759 case IDX_LOOPBACK
: loopback
= 1; break;
6760 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6761 //case IDX_SESSION: session = optarg; break;
6762 case IDX_SESSION
: break;
6763 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6764 hash_mode_chgd
= 1; break;
6765 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6766 runtime_chgd
= 1; break;
6767 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6768 attack_mode_chgd
= 1; break;
6769 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6770 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6771 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6772 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6773 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6774 rp_gen_seed_chgd
= 1; break;
6775 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6776 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6777 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6778 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6779 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6780 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6781 case IDX_OUTFILE
: outfile
= optarg
; break;
6782 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6783 outfile_format_chgd
= 1; break;
6784 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6785 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6786 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6787 case IDX_HEX_SALT
: hex_salt
= 1; break;
6788 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6789 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6790 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6791 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6792 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6793 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6794 opencl_vector_width_chgd
= 1; break;
6795 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6796 workload_profile_chgd
= 1; break;
6797 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6798 kernel_accel_chgd
= 1; break;
6799 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6800 kernel_loops_chgd
= 1; break;
6801 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6802 nvidia_spin_damp_chgd
= 1; break;
6803 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6805 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6806 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6807 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6808 #endif // HAVE_HWMON
6809 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6810 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6811 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6812 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6813 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6814 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6815 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6816 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6817 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6818 case IDX_INCREMENT
: increment
= 1; break;
6819 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6820 increment_min_chgd
= 1; break;
6821 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6822 increment_max_chgd
= 1; break;
6823 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6824 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6825 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6826 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6829 log_error ("ERROR: Invalid argument specified");
6836 log_error ("ERROR: Invalid argument specified");
6842 * Inform user things getting started,
6843 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6844 * - we do not need to check algorithm_pos
6851 if (machine_readable
== 0)
6853 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6858 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6861 else if (restore
== 1)
6863 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6866 else if (stdout_flag
== 1)
6870 else if (keyspace
== 1)
6876 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6885 if (attack_mode
> 7)
6887 log_error ("ERROR: Invalid attack-mode specified");
6892 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6894 log_error ("ERROR: Invalid runtime specified");
6899 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6901 log_error ("ERROR: Invalid hash-type specified");
6906 // renamed hash modes
6920 log_error ("Old -m specified, use -m %d instead", n
);
6928 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6930 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6936 if (outfile_format
> 16)
6938 log_error ("ERROR: Invalid outfile-format specified");
6945 if (outfile_format_chgd
== 1)
6947 if (outfile_format
> 1)
6949 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6956 outfile_format
= OUTFILE_FMT_HASH
;
6962 if (outfile_format_chgd
== 1)
6964 if ((outfile_format
> 7) && (outfile_format
< 16))
6966 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6973 if (increment_min
< INCREMENT_MIN
)
6975 log_error ("ERROR: Invalid increment-min specified");
6980 if (increment_max
> INCREMENT_MAX
)
6982 log_error ("ERROR: Invalid increment-max specified");
6987 if (increment_min
> increment_max
)
6989 log_error ("ERROR: Invalid increment-min specified");
6994 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6996 log_error ("ERROR: Increment is not allowed in attack-mode 0");
7001 if ((increment
== 0) && (increment_min_chgd
== 1))
7003 log_error ("ERROR: Increment-min is only supported combined with increment switch");
7008 if ((increment
== 0) && (increment_max_chgd
== 1))
7010 log_error ("ERROR: Increment-max is only supported combined with increment switch");
7015 if (rp_files_cnt
&& rp_gen
)
7017 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
7022 if (rp_files_cnt
|| rp_gen
)
7024 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7026 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
7032 if (rp_gen_func_min
> rp_gen_func_max
)
7034 log_error ("ERROR: Invalid rp-gen-func-min specified");
7039 if (kernel_accel_chgd
== 1)
7043 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
7044 log_info ("Please consider using the -w option instead");
7045 log_info ("You can use --force to override this but do not post error reports if you do so");
7051 if (kernel_accel
< 1)
7053 log_error ("ERROR: Invalid kernel-accel specified");
7058 if (kernel_accel
> 1024)
7060 log_error ("ERROR: Invalid kernel-accel specified");
7066 if (kernel_loops_chgd
== 1)
7070 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
7071 log_info ("Please consider using the -w option instead");
7072 log_info ("You can use --force to override this but do not post error reports if you do so");
7078 if (kernel_loops
< 1)
7080 log_error ("ERROR: Invalid kernel-loops specified");
7085 if (kernel_loops
> 1024)
7087 log_error ("ERROR: Invalid kernel-loops specified");
7093 if ((workload_profile
< 1) || (workload_profile
> 4))
7095 log_error ("ERROR: workload-profile %i not available", workload_profile
);
7100 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
7102 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
7107 if (show
== 1 || left
== 1)
7109 attack_mode
= ATTACK_MODE_NONE
;
7113 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
7118 if (potfile_disable
== 1)
7120 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
7126 uint attack_kern
= ATTACK_KERN_NONE
;
7128 switch (attack_mode
)
7130 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
7131 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
7132 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
7133 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
7134 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
7139 if (myargv
[optind
] != 0)
7141 log_error ("ERROR: Invalid argument for benchmark mode specified");
7146 if (attack_mode_chgd
== 1)
7148 if (attack_mode
!= ATTACK_MODE_BF
)
7150 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
7158 if (stdout_flag
== 1) // no hash here
7165 int num_additional_params
= 1;
7167 if (attack_kern
== ATTACK_KERN_COMBI
)
7169 num_additional_params
= 2;
7172 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
7174 if (keyspace_wordlist_specified
== 0) optind
--;
7177 if (attack_kern
== ATTACK_KERN_NONE
)
7179 if ((optind
+ 1) != myargc
)
7181 usage_mini_print (myargv
[0]);
7186 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
7188 if ((optind
+ 1) > myargc
)
7190 usage_mini_print (myargv
[0]);
7195 else if (attack_kern
== ATTACK_KERN_COMBI
)
7197 if ((optind
+ 3) != myargc
)
7199 usage_mini_print (myargv
[0]);
7204 else if (attack_kern
== ATTACK_KERN_BF
)
7206 if ((optind
+ 1) > myargc
)
7208 usage_mini_print (myargv
[0]);
7215 usage_mini_print (myargv
[0]);
7221 if (skip
!= 0 && limit
!= 0)
7230 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
7236 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
7241 potfile_disable
= 1;
7243 restore_disable
= 1;
7247 weak_hash_threshold
= 0;
7252 if (stdout_flag
== 1)
7256 restore_disable
= 1;
7258 potfile_disable
= 1;
7259 weak_hash_threshold
= 0;
7260 gpu_temp_disable
= 1;
7263 outfile_format
= OUTFILE_FMT_PLAIN
;
7264 kernel_accel
= 1024;
7265 kernel_loops
= 1024;
7267 outfile_check_timer
= 0;
7269 opencl_vector_width
= 1;
7272 if (remove_timer_chgd
== 1)
7276 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
7281 if (remove_timer
< 1)
7283 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
7291 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
7293 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7295 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
7302 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
7310 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7312 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
7317 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7319 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
7327 log_error ("ERROR: Invalid debug-mode specified");
7332 if (debug_file
!= NULL
)
7336 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
7342 if (induction_dir
!= NULL
)
7344 if (attack_mode
== ATTACK_MODE_BF
)
7346 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
7352 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7354 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
7356 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
7361 weak_hash_threshold
= 0;
7364 if (nvidia_spin_damp
> 100)
7366 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
7373 * induction directory
7376 char *induction_directory
= NULL
;
7378 if (attack_mode
!= ATTACK_MODE_BF
)
7380 if (induction_dir
== NULL
)
7382 induction_directory
= (char *) mymalloc (session_size
);
7384 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
7386 // create induction folder if it does not already exist
7390 if (rmdir (induction_directory
) == -1)
7392 if (errno
== ENOENT
)
7394 // good, we can ignore
7396 else if (errno
== ENOTEMPTY
)
7398 char *induction_directory_mv
= (char *) mymalloc (session_size
);
7400 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
7402 if (rename (induction_directory
, induction_directory_mv
) != 0)
7404 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
7411 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7417 if (mkdir (induction_directory
, 0700) == -1)
7419 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7427 induction_directory
= induction_dir
;
7431 data
.induction_directory
= induction_directory
;
7437 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7439 char *loopback_file
= (char *) mymalloc (loopback_size
);
7445 char tuning_db_file
[256] = { 0 };
7447 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7449 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7452 * outfile-check directory
7455 char *outfile_check_directory
= NULL
;
7457 if (outfile_check_dir
== NULL
)
7459 outfile_check_directory
= (char *) mymalloc (session_size
);
7461 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7465 outfile_check_directory
= outfile_check_dir
;
7468 data
.outfile_check_directory
= outfile_check_directory
;
7472 struct stat outfile_check_stat
;
7474 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7476 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7480 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7485 else if (outfile_check_dir
== NULL
)
7487 if (mkdir (outfile_check_directory
, 0700) == -1)
7489 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7497 * special other stuff
7500 if (hash_mode
== 9710)
7503 outfile_format_chgd
= 1;
7506 if (hash_mode
== 9810)
7509 outfile_format_chgd
= 1;
7512 if (hash_mode
== 10410)
7515 outfile_format_chgd
= 1;
7522 data
.hash_mode
= hash_mode
;
7523 data
.restore
= restore
;
7524 data
.restore_timer
= restore_timer
;
7525 data
.restore_disable
= restore_disable
;
7526 data
.status
= status
;
7527 data
.status_timer
= status_timer
;
7528 data
.machine_readable
= machine_readable
;
7529 data
.loopback
= loopback
;
7530 data
.runtime
= runtime
;
7531 data
.remove
= remove
;
7532 data
.remove_timer
= remove_timer
;
7533 data
.debug_mode
= debug_mode
;
7534 data
.debug_file
= debug_file
;
7535 data
.username
= username
;
7537 data
.outfile
= outfile
;
7538 data
.outfile_format
= outfile_format
;
7539 data
.outfile_autohex
= outfile_autohex
;
7540 data
.hex_charset
= hex_charset
;
7541 data
.hex_salt
= hex_salt
;
7542 data
.hex_wordlist
= hex_wordlist
;
7543 data
.separator
= separator
;
7544 data
.rp_files
= rp_files
;
7545 data
.rp_files_cnt
= rp_files_cnt
;
7546 data
.rp_gen
= rp_gen
;
7547 data
.rp_gen_seed
= rp_gen_seed
;
7549 data
.benchmark
= benchmark
;
7553 data
.powertune_enable
= powertune_enable
;
7555 data
.logfile_disable
= logfile_disable
;
7556 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7557 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7558 data
.veracrypt_pim
= veracrypt_pim
;
7559 data
.scrypt_tmto
= scrypt_tmto
;
7560 data
.workload_profile
= workload_profile
;
7568 set_cpu_affinity (cpu_affinity
);
7571 if (rp_gen_seed_chgd
== 0)
7577 srand (rp_gen_seed
);
7584 if (logfile_disable
== 0)
7586 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7588 char *logfile
= (char *) mymalloc (logfile_size
);
7590 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7592 data
.logfile
= logfile
;
7594 char *topid
= logfile_generate_topid ();
7599 // logfile_append() checks for logfile_disable internally to make it easier from here
7601 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7602 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7603 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7604 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7605 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7606 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7607 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7608 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7609 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7610 #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));
7612 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7613 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7614 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7615 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7616 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7617 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7618 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7619 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7621 logfile_top_msg ("START");
7623 logfile_top_uint (attack_mode
);
7624 logfile_top_uint (attack_kern
);
7625 logfile_top_uint (benchmark
);
7626 logfile_top_uint (stdout_flag
);
7627 logfile_top_uint (bitmap_min
);
7628 logfile_top_uint (bitmap_max
);
7629 logfile_top_uint (debug_mode
);
7630 logfile_top_uint (force
);
7631 logfile_top_uint (kernel_accel
);
7632 logfile_top_uint (kernel_loops
);
7633 logfile_top_uint (nvidia_spin_damp
);
7634 logfile_top_uint (gpu_temp_disable
);
7636 logfile_top_uint (gpu_temp_abort
);
7637 logfile_top_uint (gpu_temp_retain
);
7639 logfile_top_uint (hash_mode
);
7640 logfile_top_uint (hex_charset
);
7641 logfile_top_uint (hex_salt
);
7642 logfile_top_uint (hex_wordlist
);
7643 logfile_top_uint (increment
);
7644 logfile_top_uint (increment_max
);
7645 logfile_top_uint (increment_min
);
7646 logfile_top_uint (keyspace
);
7647 logfile_top_uint (left
);
7648 logfile_top_uint (logfile_disable
);
7649 logfile_top_uint (loopback
);
7650 logfile_top_uint (markov_classic
);
7651 logfile_top_uint (markov_disable
);
7652 logfile_top_uint (markov_threshold
);
7653 logfile_top_uint (outfile_autohex
);
7654 logfile_top_uint (outfile_check_timer
);
7655 logfile_top_uint (outfile_format
);
7656 logfile_top_uint (potfile_disable
);
7657 logfile_top_string (potfile_path
);
7658 #if defined(HAVE_HWMON)
7659 logfile_top_uint (powertune_enable
);
7661 logfile_top_uint (scrypt_tmto
);
7662 logfile_top_uint (quiet
);
7663 logfile_top_uint (remove
);
7664 logfile_top_uint (remove_timer
);
7665 logfile_top_uint (restore
);
7666 logfile_top_uint (restore_disable
);
7667 logfile_top_uint (restore_timer
);
7668 logfile_top_uint (rp_gen
);
7669 logfile_top_uint (rp_gen_func_max
);
7670 logfile_top_uint (rp_gen_func_min
);
7671 logfile_top_uint (rp_gen_seed
);
7672 logfile_top_uint (runtime
);
7673 logfile_top_uint (segment_size
);
7674 logfile_top_uint (show
);
7675 logfile_top_uint (status
);
7676 logfile_top_uint (machine_readable
);
7677 logfile_top_uint (status_timer
);
7678 logfile_top_uint (usage
);
7679 logfile_top_uint (username
);
7680 logfile_top_uint (version
);
7681 logfile_top_uint (weak_hash_threshold
);
7682 logfile_top_uint (workload_profile
);
7683 logfile_top_uint64 (limit
);
7684 logfile_top_uint64 (skip
);
7685 logfile_top_char (separator
);
7686 logfile_top_string (cpu_affinity
);
7687 logfile_top_string (custom_charset_1
);
7688 logfile_top_string (custom_charset_2
);
7689 logfile_top_string (custom_charset_3
);
7690 logfile_top_string (custom_charset_4
);
7691 logfile_top_string (debug_file
);
7692 logfile_top_string (opencl_devices
);
7693 logfile_top_string (opencl_platforms
);
7694 logfile_top_string (opencl_device_types
);
7695 logfile_top_uint (opencl_vector_width
);
7696 logfile_top_string (induction_dir
);
7697 logfile_top_string (markov_hcstat
);
7698 logfile_top_string (outfile
);
7699 logfile_top_string (outfile_check_dir
);
7700 logfile_top_string (rule_buf_l
);
7701 logfile_top_string (rule_buf_r
);
7702 logfile_top_string (session
);
7703 logfile_top_string (truecrypt_keyfiles
);
7704 logfile_top_string (veracrypt_keyfiles
);
7705 logfile_top_uint (veracrypt_pim
);
7708 * Init OpenCL library loader
7713 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7721 * OpenCL platform selection
7724 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7727 * OpenCL device selection
7730 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7733 * OpenCL device type selection
7736 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7745 * disable useless stuff for benchmark
7750 restore_disable
= 1;
7751 potfile_disable
= 1;
7752 weak_hash_threshold
= 0;
7753 nvidia_spin_damp
= 0;
7754 gpu_temp_disable
= 1;
7755 outfile_check_timer
= 0;
7758 if (powertune_enable
== 1)
7760 gpu_temp_disable
= 0;
7764 data
.status_timer
= status_timer
;
7765 data
.restore_timer
= restore_timer
;
7766 data
.restore_disable
= restore_disable
;
7767 data
.outfile_check_timer
= outfile_check_timer
;
7770 * force attack mode to be bruteforce
7773 attack_mode
= ATTACK_MODE_BF
;
7774 attack_kern
= ATTACK_KERN_BF
;
7776 if (workload_profile_chgd
== 0)
7778 workload_profile
= 3;
7780 data
.workload_profile
= workload_profile
;
7785 * status, monitor and outfile remove threads
7788 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7790 data
.wordlist_mode
= wordlist_mode
;
7792 if (wordlist_mode
== WL_MODE_STDIN
)
7796 data
.status
= status
;
7799 uint outer_threads_cnt
= 0;
7801 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7803 data
.shutdown_outer
= 0;
7805 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7807 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7809 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7811 outer_threads_cnt
++;
7821 uint attack_exec
= 0;
7825 uint esalt_size
= 0;
7827 uint dgst_pos0
= -1;
7828 uint dgst_pos1
= -1;
7829 uint dgst_pos2
= -1;
7830 uint dgst_pos3
= -1;
7832 int (*parse_func
) (char *, uint
, hash_t
*);
7833 int (*sort_by_digest
) (const void *, const void *);
7835 uint algorithm_pos
= 0;
7836 uint algorithm_max
= 1;
7838 uint
*algorithms
= default_benchmark_algorithms
;
7840 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7842 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7845 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7846 * the following algos are skipped entirely
7849 if (algorithm_pos
> 0)
7853 rd
= init_restore (argc
, argv
);
7859 * update hash_mode in case of multihash benchmark
7864 if (hash_mode_chgd
== 0)
7866 hash_mode
= algorithms
[algorithm_pos
];
7868 data
.hash_mode
= hash_mode
;
7878 case 0: hash_type
= HASH_TYPE_MD5
;
7879 salt_type
= SALT_TYPE_NONE
;
7880 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7882 | OPTS_TYPE_PT_ADD80
7883 | OPTS_TYPE_PT_ADDBITS14
;
7884 kern_type
= KERN_TYPE_MD5
;
7885 dgst_size
= DGST_SIZE_4_4
;
7886 parse_func
= md5_parse_hash
;
7887 sort_by_digest
= sort_by_digest_4_4
;
7888 opti_type
= OPTI_TYPE_ZERO_BYTE
7889 | OPTI_TYPE_PRECOMPUTE_INIT
7890 | OPTI_TYPE_PRECOMPUTE_MERKLE
7891 | OPTI_TYPE_MEET_IN_MIDDLE
7892 | OPTI_TYPE_EARLY_SKIP
7893 | OPTI_TYPE_NOT_ITERATED
7894 | OPTI_TYPE_NOT_SALTED
7895 | OPTI_TYPE_RAW_HASH
;
7902 case 10: hash_type
= HASH_TYPE_MD5
;
7903 salt_type
= SALT_TYPE_INTERN
;
7904 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7905 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7906 | OPTS_TYPE_ST_ADD80
7907 | OPTS_TYPE_ST_ADDBITS14
;
7908 kern_type
= KERN_TYPE_MD5_PWSLT
;
7909 dgst_size
= DGST_SIZE_4_4
;
7910 parse_func
= md5s_parse_hash
;
7911 sort_by_digest
= sort_by_digest_4_4
;
7912 opti_type
= OPTI_TYPE_ZERO_BYTE
7913 | OPTI_TYPE_PRECOMPUTE_INIT
7914 | OPTI_TYPE_PRECOMPUTE_MERKLE
7915 | OPTI_TYPE_MEET_IN_MIDDLE
7916 | OPTI_TYPE_EARLY_SKIP
7917 | OPTI_TYPE_NOT_ITERATED
7918 | OPTI_TYPE_APPENDED_SALT
7919 | OPTI_TYPE_RAW_HASH
;
7926 case 11: hash_type
= HASH_TYPE_MD5
;
7927 salt_type
= SALT_TYPE_INTERN
;
7928 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7929 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7930 | OPTS_TYPE_ST_ADD80
7931 | OPTS_TYPE_ST_ADDBITS14
;
7932 kern_type
= KERN_TYPE_MD5_PWSLT
;
7933 dgst_size
= DGST_SIZE_4_4
;
7934 parse_func
= joomla_parse_hash
;
7935 sort_by_digest
= sort_by_digest_4_4
;
7936 opti_type
= OPTI_TYPE_ZERO_BYTE
7937 | OPTI_TYPE_PRECOMPUTE_INIT
7938 | OPTI_TYPE_PRECOMPUTE_MERKLE
7939 | OPTI_TYPE_MEET_IN_MIDDLE
7940 | OPTI_TYPE_EARLY_SKIP
7941 | OPTI_TYPE_NOT_ITERATED
7942 | OPTI_TYPE_APPENDED_SALT
7943 | OPTI_TYPE_RAW_HASH
;
7950 case 12: hash_type
= HASH_TYPE_MD5
;
7951 salt_type
= SALT_TYPE_INTERN
;
7952 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7953 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7954 | OPTS_TYPE_ST_ADD80
7955 | OPTS_TYPE_ST_ADDBITS14
;
7956 kern_type
= KERN_TYPE_MD5_PWSLT
;
7957 dgst_size
= DGST_SIZE_4_4
;
7958 parse_func
= postgresql_parse_hash
;
7959 sort_by_digest
= sort_by_digest_4_4
;
7960 opti_type
= OPTI_TYPE_ZERO_BYTE
7961 | OPTI_TYPE_PRECOMPUTE_INIT
7962 | OPTI_TYPE_PRECOMPUTE_MERKLE
7963 | OPTI_TYPE_MEET_IN_MIDDLE
7964 | OPTI_TYPE_EARLY_SKIP
7965 | OPTI_TYPE_NOT_ITERATED
7966 | OPTI_TYPE_APPENDED_SALT
7967 | OPTI_TYPE_RAW_HASH
;
7974 case 20: hash_type
= HASH_TYPE_MD5
;
7975 salt_type
= SALT_TYPE_INTERN
;
7976 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7977 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7978 | OPTS_TYPE_PT_ADD80
7979 | OPTS_TYPE_PT_ADDBITS14
;
7980 kern_type
= KERN_TYPE_MD5_SLTPW
;
7981 dgst_size
= DGST_SIZE_4_4
;
7982 parse_func
= md5s_parse_hash
;
7983 sort_by_digest
= sort_by_digest_4_4
;
7984 opti_type
= OPTI_TYPE_ZERO_BYTE
7985 | OPTI_TYPE_PRECOMPUTE_INIT
7986 | OPTI_TYPE_PRECOMPUTE_MERKLE
7987 | OPTI_TYPE_EARLY_SKIP
7988 | OPTI_TYPE_NOT_ITERATED
7989 | OPTI_TYPE_PREPENDED_SALT
7990 | OPTI_TYPE_RAW_HASH
;
7997 case 21: hash_type
= HASH_TYPE_MD5
;
7998 salt_type
= SALT_TYPE_INTERN
;
7999 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8000 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8001 | OPTS_TYPE_PT_ADD80
8002 | OPTS_TYPE_PT_ADDBITS14
;
8003 kern_type
= KERN_TYPE_MD5_SLTPW
;
8004 dgst_size
= DGST_SIZE_4_4
;
8005 parse_func
= osc_parse_hash
;
8006 sort_by_digest
= sort_by_digest_4_4
;
8007 opti_type
= OPTI_TYPE_ZERO_BYTE
8008 | OPTI_TYPE_PRECOMPUTE_INIT
8009 | OPTI_TYPE_PRECOMPUTE_MERKLE
8010 | OPTI_TYPE_EARLY_SKIP
8011 | OPTI_TYPE_NOT_ITERATED
8012 | OPTI_TYPE_PREPENDED_SALT
8013 | OPTI_TYPE_RAW_HASH
;
8020 case 22: hash_type
= HASH_TYPE_MD5
;
8021 salt_type
= SALT_TYPE_EMBEDDED
;
8022 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8023 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8024 | OPTS_TYPE_PT_ADD80
8025 | OPTS_TYPE_PT_ADDBITS14
;
8026 kern_type
= KERN_TYPE_MD5_SLTPW
;
8027 dgst_size
= DGST_SIZE_4_4
;
8028 parse_func
= netscreen_parse_hash
;
8029 sort_by_digest
= sort_by_digest_4_4
;
8030 opti_type
= OPTI_TYPE_ZERO_BYTE
8031 | OPTI_TYPE_PRECOMPUTE_INIT
8032 | OPTI_TYPE_PRECOMPUTE_MERKLE
8033 | OPTI_TYPE_EARLY_SKIP
8034 | OPTI_TYPE_NOT_ITERATED
8035 | OPTI_TYPE_PREPENDED_SALT
8036 | OPTI_TYPE_RAW_HASH
;
8043 case 23: hash_type
= HASH_TYPE_MD5
;
8044 salt_type
= SALT_TYPE_EMBEDDED
;
8045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8047 | OPTS_TYPE_PT_ADD80
8048 | OPTS_TYPE_PT_ADDBITS14
;
8049 kern_type
= KERN_TYPE_MD5_SLTPW
;
8050 dgst_size
= DGST_SIZE_4_4
;
8051 parse_func
= skype_parse_hash
;
8052 sort_by_digest
= sort_by_digest_4_4
;
8053 opti_type
= OPTI_TYPE_ZERO_BYTE
8054 | OPTI_TYPE_PRECOMPUTE_INIT
8055 | OPTI_TYPE_PRECOMPUTE_MERKLE
8056 | OPTI_TYPE_EARLY_SKIP
8057 | OPTI_TYPE_NOT_ITERATED
8058 | OPTI_TYPE_PREPENDED_SALT
8059 | OPTI_TYPE_RAW_HASH
;
8066 case 30: hash_type
= HASH_TYPE_MD5
;
8067 salt_type
= SALT_TYPE_INTERN
;
8068 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8069 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8070 | OPTS_TYPE_PT_UNICODE
8071 | OPTS_TYPE_ST_ADD80
8072 | OPTS_TYPE_ST_ADDBITS14
;
8073 kern_type
= KERN_TYPE_MD5_PWUSLT
;
8074 dgst_size
= DGST_SIZE_4_4
;
8075 parse_func
= md5s_parse_hash
;
8076 sort_by_digest
= sort_by_digest_4_4
;
8077 opti_type
= OPTI_TYPE_ZERO_BYTE
8078 | OPTI_TYPE_PRECOMPUTE_INIT
8079 | OPTI_TYPE_PRECOMPUTE_MERKLE
8080 | OPTI_TYPE_MEET_IN_MIDDLE
8081 | OPTI_TYPE_EARLY_SKIP
8082 | OPTI_TYPE_NOT_ITERATED
8083 | OPTI_TYPE_APPENDED_SALT
8084 | OPTI_TYPE_RAW_HASH
;
8091 case 40: hash_type
= HASH_TYPE_MD5
;
8092 salt_type
= SALT_TYPE_INTERN
;
8093 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8094 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8095 | OPTS_TYPE_PT_ADD80
8096 | OPTS_TYPE_PT_ADDBITS14
8097 | OPTS_TYPE_PT_UNICODE
;
8098 kern_type
= KERN_TYPE_MD5_SLTPWU
;
8099 dgst_size
= DGST_SIZE_4_4
;
8100 parse_func
= md5s_parse_hash
;
8101 sort_by_digest
= sort_by_digest_4_4
;
8102 opti_type
= OPTI_TYPE_ZERO_BYTE
8103 | OPTI_TYPE_PRECOMPUTE_INIT
8104 | OPTI_TYPE_PRECOMPUTE_MERKLE
8105 | OPTI_TYPE_EARLY_SKIP
8106 | OPTI_TYPE_NOT_ITERATED
8107 | OPTI_TYPE_PREPENDED_SALT
8108 | OPTI_TYPE_RAW_HASH
;
8115 case 50: hash_type
= HASH_TYPE_MD5
;
8116 salt_type
= SALT_TYPE_INTERN
;
8117 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8118 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8119 | OPTS_TYPE_ST_ADD80
8120 | OPTS_TYPE_ST_ADDBITS14
;
8121 kern_type
= KERN_TYPE_HMACMD5_PW
;
8122 dgst_size
= DGST_SIZE_4_4
;
8123 parse_func
= hmacmd5_parse_hash
;
8124 sort_by_digest
= sort_by_digest_4_4
;
8125 opti_type
= OPTI_TYPE_ZERO_BYTE
8126 | OPTI_TYPE_NOT_ITERATED
;
8133 case 60: hash_type
= HASH_TYPE_MD5
;
8134 salt_type
= SALT_TYPE_INTERN
;
8135 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8137 | OPTS_TYPE_PT_ADD80
8138 | OPTS_TYPE_PT_ADDBITS14
;
8139 kern_type
= KERN_TYPE_HMACMD5_SLT
;
8140 dgst_size
= DGST_SIZE_4_4
;
8141 parse_func
= hmacmd5_parse_hash
;
8142 sort_by_digest
= sort_by_digest_4_4
;
8143 opti_type
= OPTI_TYPE_ZERO_BYTE
8144 | OPTI_TYPE_NOT_ITERATED
;
8151 case 100: hash_type
= HASH_TYPE_SHA1
;
8152 salt_type
= SALT_TYPE_NONE
;
8153 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8154 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8155 | OPTS_TYPE_PT_ADD80
8156 | OPTS_TYPE_PT_ADDBITS15
;
8157 kern_type
= KERN_TYPE_SHA1
;
8158 dgst_size
= DGST_SIZE_4_5
;
8159 parse_func
= sha1_parse_hash
;
8160 sort_by_digest
= sort_by_digest_4_5
;
8161 opti_type
= OPTI_TYPE_ZERO_BYTE
8162 | OPTI_TYPE_PRECOMPUTE_INIT
8163 | OPTI_TYPE_PRECOMPUTE_MERKLE
8164 | OPTI_TYPE_EARLY_SKIP
8165 | OPTI_TYPE_NOT_ITERATED
8166 | OPTI_TYPE_NOT_SALTED
8167 | OPTI_TYPE_RAW_HASH
;
8174 case 101: hash_type
= HASH_TYPE_SHA1
;
8175 salt_type
= SALT_TYPE_NONE
;
8176 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8177 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8178 | OPTS_TYPE_PT_ADD80
8179 | OPTS_TYPE_PT_ADDBITS15
;
8180 kern_type
= KERN_TYPE_SHA1
;
8181 dgst_size
= DGST_SIZE_4_5
;
8182 parse_func
= sha1b64_parse_hash
;
8183 sort_by_digest
= sort_by_digest_4_5
;
8184 opti_type
= OPTI_TYPE_ZERO_BYTE
8185 | OPTI_TYPE_PRECOMPUTE_INIT
8186 | OPTI_TYPE_PRECOMPUTE_MERKLE
8187 | OPTI_TYPE_EARLY_SKIP
8188 | OPTI_TYPE_NOT_ITERATED
8189 | OPTI_TYPE_NOT_SALTED
8190 | OPTI_TYPE_RAW_HASH
;
8197 case 110: hash_type
= HASH_TYPE_SHA1
;
8198 salt_type
= SALT_TYPE_INTERN
;
8199 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8200 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8201 | OPTS_TYPE_ST_ADD80
8202 | OPTS_TYPE_ST_ADDBITS15
;
8203 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8204 dgst_size
= DGST_SIZE_4_5
;
8205 parse_func
= sha1s_parse_hash
;
8206 sort_by_digest
= sort_by_digest_4_5
;
8207 opti_type
= OPTI_TYPE_ZERO_BYTE
8208 | OPTI_TYPE_PRECOMPUTE_INIT
8209 | OPTI_TYPE_PRECOMPUTE_MERKLE
8210 | OPTI_TYPE_EARLY_SKIP
8211 | OPTI_TYPE_NOT_ITERATED
8212 | OPTI_TYPE_APPENDED_SALT
8213 | OPTI_TYPE_RAW_HASH
;
8220 case 111: hash_type
= HASH_TYPE_SHA1
;
8221 salt_type
= SALT_TYPE_EMBEDDED
;
8222 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8223 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8224 | OPTS_TYPE_ST_ADD80
8225 | OPTS_TYPE_ST_ADDBITS15
;
8226 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8227 dgst_size
= DGST_SIZE_4_5
;
8228 parse_func
= sha1b64s_parse_hash
;
8229 sort_by_digest
= sort_by_digest_4_5
;
8230 opti_type
= OPTI_TYPE_ZERO_BYTE
8231 | OPTI_TYPE_PRECOMPUTE_INIT
8232 | OPTI_TYPE_PRECOMPUTE_MERKLE
8233 | OPTI_TYPE_EARLY_SKIP
8234 | OPTI_TYPE_NOT_ITERATED
8235 | OPTI_TYPE_APPENDED_SALT
8236 | OPTI_TYPE_RAW_HASH
;
8243 case 112: hash_type
= HASH_TYPE_SHA1
;
8244 salt_type
= SALT_TYPE_INTERN
;
8245 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8246 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8247 | OPTS_TYPE_ST_ADD80
8248 | OPTS_TYPE_ST_ADDBITS15
8250 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8251 dgst_size
= DGST_SIZE_4_5
;
8252 parse_func
= oracles_parse_hash
;
8253 sort_by_digest
= sort_by_digest_4_5
;
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_APPENDED_SALT
8260 | OPTI_TYPE_RAW_HASH
;
8267 case 120: hash_type
= HASH_TYPE_SHA1
;
8268 salt_type
= SALT_TYPE_INTERN
;
8269 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8270 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8271 | OPTS_TYPE_PT_ADD80
8272 | OPTS_TYPE_PT_ADDBITS15
;
8273 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8274 dgst_size
= DGST_SIZE_4_5
;
8275 parse_func
= sha1s_parse_hash
;
8276 sort_by_digest
= sort_by_digest_4_5
;
8277 opti_type
= OPTI_TYPE_ZERO_BYTE
8278 | OPTI_TYPE_PRECOMPUTE_INIT
8279 | OPTI_TYPE_PRECOMPUTE_MERKLE
8280 | OPTI_TYPE_EARLY_SKIP
8281 | OPTI_TYPE_NOT_ITERATED
8282 | OPTI_TYPE_PREPENDED_SALT
8283 | OPTI_TYPE_RAW_HASH
;
8290 case 121: hash_type
= HASH_TYPE_SHA1
;
8291 salt_type
= SALT_TYPE_INTERN
;
8292 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8293 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8294 | OPTS_TYPE_PT_ADD80
8295 | OPTS_TYPE_PT_ADDBITS15
8296 | OPTS_TYPE_ST_LOWER
;
8297 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8298 dgst_size
= DGST_SIZE_4_5
;
8299 parse_func
= smf_parse_hash
;
8300 sort_by_digest
= sort_by_digest_4_5
;
8301 opti_type
= OPTI_TYPE_ZERO_BYTE
8302 | OPTI_TYPE_PRECOMPUTE_INIT
8303 | OPTI_TYPE_PRECOMPUTE_MERKLE
8304 | OPTI_TYPE_EARLY_SKIP
8305 | OPTI_TYPE_NOT_ITERATED
8306 | OPTI_TYPE_PREPENDED_SALT
8307 | OPTI_TYPE_RAW_HASH
;
8314 case 122: hash_type
= HASH_TYPE_SHA1
;
8315 salt_type
= SALT_TYPE_EMBEDDED
;
8316 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8317 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8318 | OPTS_TYPE_PT_ADD80
8319 | OPTS_TYPE_PT_ADDBITS15
8321 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8322 dgst_size
= DGST_SIZE_4_5
;
8323 parse_func
= osx1_parse_hash
;
8324 sort_by_digest
= sort_by_digest_4_5
;
8325 opti_type
= OPTI_TYPE_ZERO_BYTE
8326 | OPTI_TYPE_PRECOMPUTE_INIT
8327 | OPTI_TYPE_PRECOMPUTE_MERKLE
8328 | OPTI_TYPE_EARLY_SKIP
8329 | OPTI_TYPE_NOT_ITERATED
8330 | OPTI_TYPE_PREPENDED_SALT
8331 | OPTI_TYPE_RAW_HASH
;
8338 case 124: hash_type
= HASH_TYPE_SHA1
;
8339 salt_type
= SALT_TYPE_EMBEDDED
;
8340 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8341 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8342 | OPTS_TYPE_PT_ADD80
8343 | OPTS_TYPE_PT_ADDBITS15
;
8344 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8345 dgst_size
= DGST_SIZE_4_5
;
8346 parse_func
= djangosha1_parse_hash
;
8347 sort_by_digest
= sort_by_digest_4_5
;
8348 opti_type
= OPTI_TYPE_ZERO_BYTE
8349 | OPTI_TYPE_PRECOMPUTE_INIT
8350 | OPTI_TYPE_PRECOMPUTE_MERKLE
8351 | OPTI_TYPE_EARLY_SKIP
8352 | OPTI_TYPE_NOT_ITERATED
8353 | OPTI_TYPE_PREPENDED_SALT
8354 | OPTI_TYPE_RAW_HASH
;
8361 case 125: hash_type
= HASH_TYPE_SHA1
;
8362 salt_type
= SALT_TYPE_EMBEDDED
;
8363 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8364 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8365 | OPTS_TYPE_PT_ADD80
8366 | OPTS_TYPE_PT_ADDBITS15
8368 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8369 dgst_size
= DGST_SIZE_4_5
;
8370 parse_func
= arubaos_parse_hash
;
8371 sort_by_digest
= sort_by_digest_4_5
;
8372 opti_type
= OPTI_TYPE_ZERO_BYTE
8373 | OPTI_TYPE_PRECOMPUTE_INIT
8374 | OPTI_TYPE_PRECOMPUTE_MERKLE
8375 | OPTI_TYPE_EARLY_SKIP
8376 | OPTI_TYPE_NOT_ITERATED
8377 | OPTI_TYPE_PREPENDED_SALT
8378 | OPTI_TYPE_RAW_HASH
;
8385 case 130: hash_type
= HASH_TYPE_SHA1
;
8386 salt_type
= SALT_TYPE_INTERN
;
8387 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8388 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8389 | OPTS_TYPE_PT_UNICODE
8390 | OPTS_TYPE_ST_ADD80
8391 | OPTS_TYPE_ST_ADDBITS15
;
8392 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8393 dgst_size
= DGST_SIZE_4_5
;
8394 parse_func
= sha1s_parse_hash
;
8395 sort_by_digest
= sort_by_digest_4_5
;
8396 opti_type
= OPTI_TYPE_ZERO_BYTE
8397 | OPTI_TYPE_PRECOMPUTE_INIT
8398 | OPTI_TYPE_PRECOMPUTE_MERKLE
8399 | OPTI_TYPE_EARLY_SKIP
8400 | OPTI_TYPE_NOT_ITERATED
8401 | OPTI_TYPE_APPENDED_SALT
8402 | OPTI_TYPE_RAW_HASH
;
8409 case 131: hash_type
= HASH_TYPE_SHA1
;
8410 salt_type
= SALT_TYPE_EMBEDDED
;
8411 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8412 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8413 | OPTS_TYPE_PT_UNICODE
8414 | OPTS_TYPE_PT_UPPER
8415 | OPTS_TYPE_ST_ADD80
8416 | OPTS_TYPE_ST_ADDBITS15
8418 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8419 dgst_size
= DGST_SIZE_4_5
;
8420 parse_func
= mssql2000_parse_hash
;
8421 sort_by_digest
= sort_by_digest_4_5
;
8422 opti_type
= OPTI_TYPE_ZERO_BYTE
8423 | OPTI_TYPE_PRECOMPUTE_INIT
8424 | OPTI_TYPE_PRECOMPUTE_MERKLE
8425 | OPTI_TYPE_EARLY_SKIP
8426 | OPTI_TYPE_NOT_ITERATED
8427 | OPTI_TYPE_APPENDED_SALT
8428 | OPTI_TYPE_RAW_HASH
;
8435 case 132: hash_type
= HASH_TYPE_SHA1
;
8436 salt_type
= SALT_TYPE_EMBEDDED
;
8437 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8438 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8439 | OPTS_TYPE_PT_UNICODE
8440 | OPTS_TYPE_ST_ADD80
8441 | OPTS_TYPE_ST_ADDBITS15
8443 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8444 dgst_size
= DGST_SIZE_4_5
;
8445 parse_func
= mssql2005_parse_hash
;
8446 sort_by_digest
= sort_by_digest_4_5
;
8447 opti_type
= OPTI_TYPE_ZERO_BYTE
8448 | OPTI_TYPE_PRECOMPUTE_INIT
8449 | OPTI_TYPE_PRECOMPUTE_MERKLE
8450 | OPTI_TYPE_EARLY_SKIP
8451 | OPTI_TYPE_NOT_ITERATED
8452 | OPTI_TYPE_APPENDED_SALT
8453 | OPTI_TYPE_RAW_HASH
;
8460 case 133: hash_type
= HASH_TYPE_SHA1
;
8461 salt_type
= SALT_TYPE_EMBEDDED
;
8462 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8463 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8464 | OPTS_TYPE_PT_UNICODE
8465 | OPTS_TYPE_ST_ADD80
8466 | OPTS_TYPE_ST_ADDBITS15
;
8467 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8468 dgst_size
= DGST_SIZE_4_5
;
8469 parse_func
= peoplesoft_parse_hash
;
8470 sort_by_digest
= sort_by_digest_4_5
;
8471 opti_type
= OPTI_TYPE_ZERO_BYTE
8472 | OPTI_TYPE_PRECOMPUTE_INIT
8473 | OPTI_TYPE_PRECOMPUTE_MERKLE
8474 | OPTI_TYPE_EARLY_SKIP
8475 | OPTI_TYPE_NOT_ITERATED
8476 | OPTI_TYPE_APPENDED_SALT
8477 | OPTI_TYPE_RAW_HASH
;
8484 case 140: hash_type
= HASH_TYPE_SHA1
;
8485 salt_type
= SALT_TYPE_INTERN
;
8486 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8487 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8488 | OPTS_TYPE_PT_ADD80
8489 | OPTS_TYPE_PT_ADDBITS15
8490 | OPTS_TYPE_PT_UNICODE
;
8491 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8492 dgst_size
= DGST_SIZE_4_5
;
8493 parse_func
= sha1s_parse_hash
;
8494 sort_by_digest
= sort_by_digest_4_5
;
8495 opti_type
= OPTI_TYPE_ZERO_BYTE
8496 | OPTI_TYPE_PRECOMPUTE_INIT
8497 | OPTI_TYPE_PRECOMPUTE_MERKLE
8498 | OPTI_TYPE_EARLY_SKIP
8499 | OPTI_TYPE_NOT_ITERATED
8500 | OPTI_TYPE_PREPENDED_SALT
8501 | OPTI_TYPE_RAW_HASH
;
8508 case 141: hash_type
= HASH_TYPE_SHA1
;
8509 salt_type
= SALT_TYPE_EMBEDDED
;
8510 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8511 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8512 | OPTS_TYPE_PT_ADD80
8513 | OPTS_TYPE_PT_ADDBITS15
8514 | OPTS_TYPE_PT_UNICODE
8515 | OPTS_TYPE_ST_BASE64
;
8516 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8517 dgst_size
= DGST_SIZE_4_5
;
8518 parse_func
= episerver_parse_hash
;
8519 sort_by_digest
= sort_by_digest_4_5
;
8520 opti_type
= OPTI_TYPE_ZERO_BYTE
8521 | OPTI_TYPE_PRECOMPUTE_INIT
8522 | OPTI_TYPE_PRECOMPUTE_MERKLE
8523 | OPTI_TYPE_EARLY_SKIP
8524 | OPTI_TYPE_NOT_ITERATED
8525 | OPTI_TYPE_PREPENDED_SALT
8526 | OPTI_TYPE_RAW_HASH
;
8533 case 150: hash_type
= HASH_TYPE_SHA1
;
8534 salt_type
= SALT_TYPE_INTERN
;
8535 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8536 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8537 | OPTS_TYPE_ST_ADD80
8538 | OPTS_TYPE_ST_ADDBITS15
;
8539 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8540 dgst_size
= DGST_SIZE_4_5
;
8541 parse_func
= hmacsha1_parse_hash
;
8542 sort_by_digest
= sort_by_digest_4_5
;
8543 opti_type
= OPTI_TYPE_ZERO_BYTE
8544 | OPTI_TYPE_NOT_ITERATED
;
8551 case 160: hash_type
= HASH_TYPE_SHA1
;
8552 salt_type
= SALT_TYPE_INTERN
;
8553 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8554 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8555 | OPTS_TYPE_PT_ADD80
8556 | OPTS_TYPE_PT_ADDBITS15
;
8557 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8558 dgst_size
= DGST_SIZE_4_5
;
8559 parse_func
= hmacsha1_parse_hash
;
8560 sort_by_digest
= sort_by_digest_4_5
;
8561 opti_type
= OPTI_TYPE_ZERO_BYTE
8562 | OPTI_TYPE_NOT_ITERATED
;
8569 case 200: hash_type
= HASH_TYPE_MYSQL
;
8570 salt_type
= SALT_TYPE_NONE
;
8571 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8573 kern_type
= KERN_TYPE_MYSQL
;
8574 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8575 parse_func
= mysql323_parse_hash
;
8576 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8577 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8584 case 300: hash_type
= HASH_TYPE_SHA1
;
8585 salt_type
= SALT_TYPE_NONE
;
8586 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8587 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8588 | OPTS_TYPE_PT_ADD80
8589 | OPTS_TYPE_PT_ADDBITS15
;
8590 kern_type
= KERN_TYPE_MYSQL41
;
8591 dgst_size
= DGST_SIZE_4_5
;
8592 parse_func
= sha1_parse_hash
;
8593 sort_by_digest
= sort_by_digest_4_5
;
8594 opti_type
= OPTI_TYPE_ZERO_BYTE
8595 | OPTI_TYPE_PRECOMPUTE_INIT
8596 | OPTI_TYPE_PRECOMPUTE_MERKLE
8597 | OPTI_TYPE_EARLY_SKIP
8598 | OPTI_TYPE_NOT_ITERATED
8599 | OPTI_TYPE_NOT_SALTED
;
8606 case 400: hash_type
= HASH_TYPE_MD5
;
8607 salt_type
= SALT_TYPE_EMBEDDED
;
8608 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8609 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8610 kern_type
= KERN_TYPE_PHPASS
;
8611 dgst_size
= DGST_SIZE_4_4
;
8612 parse_func
= phpass_parse_hash
;
8613 sort_by_digest
= sort_by_digest_4_4
;
8614 opti_type
= OPTI_TYPE_ZERO_BYTE
8615 | OPTI_TYPE_SLOW_HASH_SIMD
;
8622 case 500: hash_type
= HASH_TYPE_MD5
;
8623 salt_type
= SALT_TYPE_EMBEDDED
;
8624 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8625 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8626 kern_type
= KERN_TYPE_MD5CRYPT
;
8627 dgst_size
= DGST_SIZE_4_4
;
8628 parse_func
= md5crypt_parse_hash
;
8629 sort_by_digest
= sort_by_digest_4_4
;
8630 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8637 case 501: hash_type
= HASH_TYPE_MD5
;
8638 salt_type
= SALT_TYPE_EMBEDDED
;
8639 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8640 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8641 | OPTS_TYPE_HASH_COPY
;
8642 kern_type
= KERN_TYPE_MD5CRYPT
;
8643 dgst_size
= DGST_SIZE_4_4
;
8644 parse_func
= juniper_parse_hash
;
8645 sort_by_digest
= sort_by_digest_4_4
;
8646 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8653 case 900: hash_type
= HASH_TYPE_MD4
;
8654 salt_type
= SALT_TYPE_NONE
;
8655 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8656 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8657 | OPTS_TYPE_PT_ADD80
8658 | OPTS_TYPE_PT_ADDBITS14
;
8659 kern_type
= KERN_TYPE_MD4
;
8660 dgst_size
= DGST_SIZE_4_4
;
8661 parse_func
= md4_parse_hash
;
8662 sort_by_digest
= sort_by_digest_4_4
;
8663 opti_type
= OPTI_TYPE_ZERO_BYTE
8664 | OPTI_TYPE_PRECOMPUTE_INIT
8665 | OPTI_TYPE_PRECOMPUTE_MERKLE
8666 | OPTI_TYPE_MEET_IN_MIDDLE
8667 | OPTI_TYPE_EARLY_SKIP
8668 | OPTI_TYPE_NOT_ITERATED
8669 | OPTI_TYPE_NOT_SALTED
8670 | OPTI_TYPE_RAW_HASH
;
8677 case 1000: hash_type
= HASH_TYPE_MD4
;
8678 salt_type
= SALT_TYPE_NONE
;
8679 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8681 | OPTS_TYPE_PT_ADD80
8682 | OPTS_TYPE_PT_ADDBITS14
8683 | OPTS_TYPE_PT_UNICODE
;
8684 kern_type
= KERN_TYPE_MD4_PWU
;
8685 dgst_size
= DGST_SIZE_4_4
;
8686 parse_func
= md4_parse_hash
;
8687 sort_by_digest
= sort_by_digest_4_4
;
8688 opti_type
= OPTI_TYPE_ZERO_BYTE
8689 | OPTI_TYPE_PRECOMPUTE_INIT
8690 | OPTI_TYPE_PRECOMPUTE_MERKLE
8691 | OPTI_TYPE_MEET_IN_MIDDLE
8692 | OPTI_TYPE_EARLY_SKIP
8693 | OPTI_TYPE_NOT_ITERATED
8694 | OPTI_TYPE_NOT_SALTED
8695 | OPTI_TYPE_RAW_HASH
;
8702 case 1100: hash_type
= HASH_TYPE_MD4
;
8703 salt_type
= SALT_TYPE_INTERN
;
8704 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8705 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8706 | OPTS_TYPE_PT_ADD80
8707 | OPTS_TYPE_PT_ADDBITS14
8708 | OPTS_TYPE_PT_UNICODE
8709 | OPTS_TYPE_ST_ADD80
8710 | OPTS_TYPE_ST_UNICODE
8711 | OPTS_TYPE_ST_LOWER
;
8712 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8713 dgst_size
= DGST_SIZE_4_4
;
8714 parse_func
= dcc_parse_hash
;
8715 sort_by_digest
= sort_by_digest_4_4
;
8716 opti_type
= OPTI_TYPE_ZERO_BYTE
8717 | OPTI_TYPE_PRECOMPUTE_INIT
8718 | OPTI_TYPE_PRECOMPUTE_MERKLE
8719 | OPTI_TYPE_EARLY_SKIP
8720 | OPTI_TYPE_NOT_ITERATED
;
8727 case 1400: hash_type
= HASH_TYPE_SHA256
;
8728 salt_type
= SALT_TYPE_NONE
;
8729 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8730 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8731 | OPTS_TYPE_PT_ADD80
8732 | OPTS_TYPE_PT_ADDBITS15
;
8733 kern_type
= KERN_TYPE_SHA256
;
8734 dgst_size
= DGST_SIZE_4_8
;
8735 parse_func
= sha256_parse_hash
;
8736 sort_by_digest
= sort_by_digest_4_8
;
8737 opti_type
= OPTI_TYPE_ZERO_BYTE
8738 | OPTI_TYPE_PRECOMPUTE_INIT
8739 | OPTI_TYPE_PRECOMPUTE_MERKLE
8740 | OPTI_TYPE_EARLY_SKIP
8741 | OPTI_TYPE_NOT_ITERATED
8742 | OPTI_TYPE_NOT_SALTED
8743 | OPTI_TYPE_RAW_HASH
;
8750 case 1410: hash_type
= HASH_TYPE_SHA256
;
8751 salt_type
= SALT_TYPE_INTERN
;
8752 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8753 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8754 | OPTS_TYPE_ST_ADD80
8755 | OPTS_TYPE_ST_ADDBITS15
;
8756 kern_type
= KERN_TYPE_SHA256_PWSLT
;
8757 dgst_size
= DGST_SIZE_4_8
;
8758 parse_func
= sha256s_parse_hash
;
8759 sort_by_digest
= sort_by_digest_4_8
;
8760 opti_type
= OPTI_TYPE_ZERO_BYTE
8761 | OPTI_TYPE_PRECOMPUTE_INIT
8762 | OPTI_TYPE_PRECOMPUTE_MERKLE
8763 | OPTI_TYPE_EARLY_SKIP
8764 | OPTI_TYPE_NOT_ITERATED
8765 | OPTI_TYPE_APPENDED_SALT
8766 | OPTI_TYPE_RAW_HASH
;
8773 case 1420: hash_type
= HASH_TYPE_SHA256
;
8774 salt_type
= SALT_TYPE_INTERN
;
8775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8776 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8777 | OPTS_TYPE_PT_ADD80
8778 | OPTS_TYPE_PT_ADDBITS15
;
8779 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8780 dgst_size
= DGST_SIZE_4_8
;
8781 parse_func
= sha256s_parse_hash
;
8782 sort_by_digest
= sort_by_digest_4_8
;
8783 opti_type
= OPTI_TYPE_ZERO_BYTE
8784 | OPTI_TYPE_PRECOMPUTE_INIT
8785 | OPTI_TYPE_PRECOMPUTE_MERKLE
8786 | OPTI_TYPE_EARLY_SKIP
8787 | OPTI_TYPE_NOT_ITERATED
8788 | OPTI_TYPE_PREPENDED_SALT
8789 | OPTI_TYPE_RAW_HASH
;
8796 case 1421: hash_type
= HASH_TYPE_SHA256
;
8797 salt_type
= SALT_TYPE_EMBEDDED
;
8798 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8799 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8800 | OPTS_TYPE_PT_ADD80
8801 | OPTS_TYPE_PT_ADDBITS15
;
8802 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8803 dgst_size
= DGST_SIZE_4_8
;
8804 parse_func
= hmailserver_parse_hash
;
8805 sort_by_digest
= sort_by_digest_4_8
;
8806 opti_type
= OPTI_TYPE_ZERO_BYTE
8807 | OPTI_TYPE_PRECOMPUTE_INIT
8808 | OPTI_TYPE_PRECOMPUTE_MERKLE
8809 | OPTI_TYPE_EARLY_SKIP
8810 | OPTI_TYPE_NOT_ITERATED
8811 | OPTI_TYPE_PREPENDED_SALT
8812 | OPTI_TYPE_RAW_HASH
;
8819 case 1430: hash_type
= HASH_TYPE_SHA256
;
8820 salt_type
= SALT_TYPE_INTERN
;
8821 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8822 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8823 | OPTS_TYPE_PT_UNICODE
8824 | OPTS_TYPE_ST_ADD80
8825 | OPTS_TYPE_ST_ADDBITS15
;
8826 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8827 dgst_size
= DGST_SIZE_4_8
;
8828 parse_func
= sha256s_parse_hash
;
8829 sort_by_digest
= sort_by_digest_4_8
;
8830 opti_type
= OPTI_TYPE_ZERO_BYTE
8831 | OPTI_TYPE_PRECOMPUTE_INIT
8832 | OPTI_TYPE_PRECOMPUTE_MERKLE
8833 | OPTI_TYPE_EARLY_SKIP
8834 | OPTI_TYPE_NOT_ITERATED
8835 | OPTI_TYPE_APPENDED_SALT
8836 | OPTI_TYPE_RAW_HASH
;
8843 case 1440: hash_type
= HASH_TYPE_SHA256
;
8844 salt_type
= SALT_TYPE_INTERN
;
8845 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8846 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8847 | OPTS_TYPE_PT_ADD80
8848 | OPTS_TYPE_PT_ADDBITS15
8849 | OPTS_TYPE_PT_UNICODE
;
8850 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8851 dgst_size
= DGST_SIZE_4_8
;
8852 parse_func
= sha256s_parse_hash
;
8853 sort_by_digest
= sort_by_digest_4_8
;
8854 opti_type
= OPTI_TYPE_ZERO_BYTE
8855 | OPTI_TYPE_PRECOMPUTE_INIT
8856 | OPTI_TYPE_PRECOMPUTE_MERKLE
8857 | OPTI_TYPE_EARLY_SKIP
8858 | OPTI_TYPE_NOT_ITERATED
8859 | OPTI_TYPE_PREPENDED_SALT
8860 | OPTI_TYPE_RAW_HASH
;
8867 case 1441: hash_type
= HASH_TYPE_SHA256
;
8868 salt_type
= SALT_TYPE_EMBEDDED
;
8869 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8870 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8871 | OPTS_TYPE_PT_ADD80
8872 | OPTS_TYPE_PT_ADDBITS15
8873 | OPTS_TYPE_PT_UNICODE
8874 | OPTS_TYPE_ST_BASE64
;
8875 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8876 dgst_size
= DGST_SIZE_4_8
;
8877 parse_func
= episerver4_parse_hash
;
8878 sort_by_digest
= sort_by_digest_4_8
;
8879 opti_type
= OPTI_TYPE_ZERO_BYTE
8880 | OPTI_TYPE_PRECOMPUTE_INIT
8881 | OPTI_TYPE_PRECOMPUTE_MERKLE
8882 | OPTI_TYPE_EARLY_SKIP
8883 | OPTI_TYPE_NOT_ITERATED
8884 | OPTI_TYPE_PREPENDED_SALT
8885 | OPTI_TYPE_RAW_HASH
;
8892 case 1450: hash_type
= HASH_TYPE_SHA256
;
8893 salt_type
= SALT_TYPE_INTERN
;
8894 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8895 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8896 | OPTS_TYPE_ST_ADD80
;
8897 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8898 dgst_size
= DGST_SIZE_4_8
;
8899 parse_func
= hmacsha256_parse_hash
;
8900 sort_by_digest
= sort_by_digest_4_8
;
8901 opti_type
= OPTI_TYPE_ZERO_BYTE
8902 | OPTI_TYPE_NOT_ITERATED
;
8909 case 1460: hash_type
= HASH_TYPE_SHA256
;
8910 salt_type
= SALT_TYPE_INTERN
;
8911 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8912 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8913 | OPTS_TYPE_PT_ADD80
8914 | OPTS_TYPE_PT_ADDBITS15
;
8915 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8916 dgst_size
= DGST_SIZE_4_8
;
8917 parse_func
= hmacsha256_parse_hash
;
8918 sort_by_digest
= sort_by_digest_4_8
;
8919 opti_type
= OPTI_TYPE_ZERO_BYTE
8920 | OPTI_TYPE_NOT_ITERATED
;
8927 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8928 salt_type
= SALT_TYPE_EMBEDDED
;
8929 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8931 | OPTS_TYPE_PT_BITSLICE
;
8932 kern_type
= KERN_TYPE_DESCRYPT
;
8933 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8934 parse_func
= descrypt_parse_hash
;
8935 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8936 opti_type
= OPTI_TYPE_ZERO_BYTE
8937 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8944 case 1600: hash_type
= HASH_TYPE_MD5
;
8945 salt_type
= SALT_TYPE_EMBEDDED
;
8946 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8947 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8948 kern_type
= KERN_TYPE_APR1CRYPT
;
8949 dgst_size
= DGST_SIZE_4_4
;
8950 parse_func
= md5apr1_parse_hash
;
8951 sort_by_digest
= sort_by_digest_4_4
;
8952 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8959 case 1700: hash_type
= HASH_TYPE_SHA512
;
8960 salt_type
= SALT_TYPE_NONE
;
8961 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8962 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8963 | OPTS_TYPE_PT_ADD80
8964 | OPTS_TYPE_PT_ADDBITS15
;
8965 kern_type
= KERN_TYPE_SHA512
;
8966 dgst_size
= DGST_SIZE_8_8
;
8967 parse_func
= sha512_parse_hash
;
8968 sort_by_digest
= sort_by_digest_8_8
;
8969 opti_type
= OPTI_TYPE_ZERO_BYTE
8970 | OPTI_TYPE_PRECOMPUTE_INIT
8971 | OPTI_TYPE_PRECOMPUTE_MERKLE
8972 | OPTI_TYPE_EARLY_SKIP
8973 | OPTI_TYPE_NOT_ITERATED
8974 | OPTI_TYPE_NOT_SALTED
8975 | OPTI_TYPE_USES_BITS_64
8976 | OPTI_TYPE_RAW_HASH
;
8983 case 1710: hash_type
= HASH_TYPE_SHA512
;
8984 salt_type
= SALT_TYPE_INTERN
;
8985 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8986 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8987 | OPTS_TYPE_ST_ADD80
8988 | OPTS_TYPE_ST_ADDBITS15
;
8989 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8990 dgst_size
= DGST_SIZE_8_8
;
8991 parse_func
= sha512s_parse_hash
;
8992 sort_by_digest
= sort_by_digest_8_8
;
8993 opti_type
= OPTI_TYPE_ZERO_BYTE
8994 | OPTI_TYPE_PRECOMPUTE_INIT
8995 | OPTI_TYPE_PRECOMPUTE_MERKLE
8996 | OPTI_TYPE_EARLY_SKIP
8997 | OPTI_TYPE_NOT_ITERATED
8998 | OPTI_TYPE_APPENDED_SALT
8999 | OPTI_TYPE_USES_BITS_64
9000 | OPTI_TYPE_RAW_HASH
;
9007 case 1711: hash_type
= HASH_TYPE_SHA512
;
9008 salt_type
= SALT_TYPE_EMBEDDED
;
9009 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9010 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9011 | OPTS_TYPE_ST_ADD80
9012 | OPTS_TYPE_ST_ADDBITS15
;
9013 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9014 dgst_size
= DGST_SIZE_8_8
;
9015 parse_func
= sha512b64s_parse_hash
;
9016 sort_by_digest
= sort_by_digest_8_8
;
9017 opti_type
= OPTI_TYPE_ZERO_BYTE
9018 | OPTI_TYPE_PRECOMPUTE_INIT
9019 | OPTI_TYPE_PRECOMPUTE_MERKLE
9020 | OPTI_TYPE_EARLY_SKIP
9021 | OPTI_TYPE_NOT_ITERATED
9022 | OPTI_TYPE_APPENDED_SALT
9023 | OPTI_TYPE_USES_BITS_64
9024 | OPTI_TYPE_RAW_HASH
;
9031 case 1720: hash_type
= HASH_TYPE_SHA512
;
9032 salt_type
= SALT_TYPE_INTERN
;
9033 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9034 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9035 | OPTS_TYPE_PT_ADD80
9036 | OPTS_TYPE_PT_ADDBITS15
;
9037 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9038 dgst_size
= DGST_SIZE_8_8
;
9039 parse_func
= sha512s_parse_hash
;
9040 sort_by_digest
= sort_by_digest_8_8
;
9041 opti_type
= OPTI_TYPE_ZERO_BYTE
9042 | OPTI_TYPE_PRECOMPUTE_INIT
9043 | OPTI_TYPE_PRECOMPUTE_MERKLE
9044 | OPTI_TYPE_EARLY_SKIP
9045 | OPTI_TYPE_NOT_ITERATED
9046 | OPTI_TYPE_PREPENDED_SALT
9047 | OPTI_TYPE_USES_BITS_64
9048 | OPTI_TYPE_RAW_HASH
;
9055 case 1722: hash_type
= HASH_TYPE_SHA512
;
9056 salt_type
= SALT_TYPE_EMBEDDED
;
9057 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9058 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9059 | OPTS_TYPE_PT_ADD80
9060 | OPTS_TYPE_PT_ADDBITS15
9062 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9063 dgst_size
= DGST_SIZE_8_8
;
9064 parse_func
= osx512_parse_hash
;
9065 sort_by_digest
= sort_by_digest_8_8
;
9066 opti_type
= OPTI_TYPE_ZERO_BYTE
9067 | OPTI_TYPE_PRECOMPUTE_INIT
9068 | OPTI_TYPE_PRECOMPUTE_MERKLE
9069 | OPTI_TYPE_EARLY_SKIP
9070 | OPTI_TYPE_NOT_ITERATED
9071 | OPTI_TYPE_PREPENDED_SALT
9072 | OPTI_TYPE_USES_BITS_64
9073 | OPTI_TYPE_RAW_HASH
;
9080 case 1730: hash_type
= HASH_TYPE_SHA512
;
9081 salt_type
= SALT_TYPE_INTERN
;
9082 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9083 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9084 | OPTS_TYPE_PT_UNICODE
9085 | OPTS_TYPE_ST_ADD80
9086 | OPTS_TYPE_ST_ADDBITS15
;
9087 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9088 dgst_size
= DGST_SIZE_8_8
;
9089 parse_func
= sha512s_parse_hash
;
9090 sort_by_digest
= sort_by_digest_8_8
;
9091 opti_type
= OPTI_TYPE_ZERO_BYTE
9092 | OPTI_TYPE_PRECOMPUTE_INIT
9093 | OPTI_TYPE_PRECOMPUTE_MERKLE
9094 | OPTI_TYPE_EARLY_SKIP
9095 | OPTI_TYPE_NOT_ITERATED
9096 | OPTI_TYPE_APPENDED_SALT
9097 | OPTI_TYPE_USES_BITS_64
9098 | OPTI_TYPE_RAW_HASH
;
9105 case 1731: hash_type
= HASH_TYPE_SHA512
;
9106 salt_type
= SALT_TYPE_EMBEDDED
;
9107 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9108 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9109 | OPTS_TYPE_PT_UNICODE
9110 | OPTS_TYPE_ST_ADD80
9111 | OPTS_TYPE_ST_ADDBITS15
9113 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9114 dgst_size
= DGST_SIZE_8_8
;
9115 parse_func
= mssql2012_parse_hash
;
9116 sort_by_digest
= sort_by_digest_8_8
;
9117 opti_type
= OPTI_TYPE_ZERO_BYTE
9118 | OPTI_TYPE_PRECOMPUTE_INIT
9119 | OPTI_TYPE_PRECOMPUTE_MERKLE
9120 | OPTI_TYPE_EARLY_SKIP
9121 | OPTI_TYPE_NOT_ITERATED
9122 | OPTI_TYPE_APPENDED_SALT
9123 | OPTI_TYPE_USES_BITS_64
9124 | OPTI_TYPE_RAW_HASH
;
9131 case 1740: hash_type
= HASH_TYPE_SHA512
;
9132 salt_type
= SALT_TYPE_INTERN
;
9133 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9134 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9135 | OPTS_TYPE_PT_ADD80
9136 | OPTS_TYPE_PT_ADDBITS15
9137 | OPTS_TYPE_PT_UNICODE
;
9138 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
9139 dgst_size
= DGST_SIZE_8_8
;
9140 parse_func
= sha512s_parse_hash
;
9141 sort_by_digest
= sort_by_digest_8_8
;
9142 opti_type
= OPTI_TYPE_ZERO_BYTE
9143 | OPTI_TYPE_PRECOMPUTE_INIT
9144 | OPTI_TYPE_PRECOMPUTE_MERKLE
9145 | OPTI_TYPE_EARLY_SKIP
9146 | OPTI_TYPE_NOT_ITERATED
9147 | OPTI_TYPE_PREPENDED_SALT
9148 | OPTI_TYPE_USES_BITS_64
9149 | OPTI_TYPE_RAW_HASH
;
9156 case 1750: hash_type
= HASH_TYPE_SHA512
;
9157 salt_type
= SALT_TYPE_INTERN
;
9158 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9159 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9160 | OPTS_TYPE_ST_ADD80
;
9161 kern_type
= KERN_TYPE_HMACSHA512_PW
;
9162 dgst_size
= DGST_SIZE_8_8
;
9163 parse_func
= hmacsha512_parse_hash
;
9164 sort_by_digest
= sort_by_digest_8_8
;
9165 opti_type
= OPTI_TYPE_ZERO_BYTE
9166 | OPTI_TYPE_USES_BITS_64
9167 | OPTI_TYPE_NOT_ITERATED
;
9174 case 1760: hash_type
= HASH_TYPE_SHA512
;
9175 salt_type
= SALT_TYPE_INTERN
;
9176 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9177 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9178 | OPTS_TYPE_PT_ADD80
9179 | OPTS_TYPE_PT_ADDBITS15
;
9180 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
9181 dgst_size
= DGST_SIZE_8_8
;
9182 parse_func
= hmacsha512_parse_hash
;
9183 sort_by_digest
= sort_by_digest_8_8
;
9184 opti_type
= OPTI_TYPE_ZERO_BYTE
9185 | OPTI_TYPE_USES_BITS_64
9186 | OPTI_TYPE_NOT_ITERATED
;
9193 case 1800: hash_type
= HASH_TYPE_SHA512
;
9194 salt_type
= SALT_TYPE_EMBEDDED
;
9195 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9197 kern_type
= KERN_TYPE_SHA512CRYPT
;
9198 dgst_size
= DGST_SIZE_8_8
;
9199 parse_func
= sha512crypt_parse_hash
;
9200 sort_by_digest
= sort_by_digest_8_8
;
9201 opti_type
= OPTI_TYPE_ZERO_BYTE
9202 | OPTI_TYPE_USES_BITS_64
;
9209 case 2000: hash_type
= HASH_TYPE_STDOUT
;
9210 salt_type
= SALT_TYPE_NONE
;
9211 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9212 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9213 kern_type
= KERN_TYPE_STDOUT
;
9214 dgst_size
= DGST_SIZE_4_4
;
9216 sort_by_digest
= NULL
;
9224 case 2100: hash_type
= HASH_TYPE_DCC2
;
9225 salt_type
= SALT_TYPE_EMBEDDED
;
9226 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9227 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9228 | OPTS_TYPE_ST_LOWER
9229 | OPTS_TYPE_ST_UNICODE
;
9230 kern_type
= KERN_TYPE_DCC2
;
9231 dgst_size
= DGST_SIZE_4_4
;
9232 parse_func
= dcc2_parse_hash
;
9233 sort_by_digest
= sort_by_digest_4_4
;
9234 opti_type
= OPTI_TYPE_ZERO_BYTE
9235 | OPTI_TYPE_SLOW_HASH_SIMD
;
9242 case 2400: hash_type
= HASH_TYPE_MD5
;
9243 salt_type
= SALT_TYPE_NONE
;
9244 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9245 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9246 kern_type
= KERN_TYPE_MD5PIX
;
9247 dgst_size
= DGST_SIZE_4_4
;
9248 parse_func
= md5pix_parse_hash
;
9249 sort_by_digest
= sort_by_digest_4_4
;
9250 opti_type
= OPTI_TYPE_ZERO_BYTE
9251 | OPTI_TYPE_PRECOMPUTE_INIT
9252 | OPTI_TYPE_PRECOMPUTE_MERKLE
9253 | OPTI_TYPE_EARLY_SKIP
9254 | OPTI_TYPE_NOT_ITERATED
9255 | OPTI_TYPE_NOT_SALTED
;
9262 case 2410: hash_type
= HASH_TYPE_MD5
;
9263 salt_type
= SALT_TYPE_INTERN
;
9264 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9265 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9266 kern_type
= KERN_TYPE_MD5ASA
;
9267 dgst_size
= DGST_SIZE_4_4
;
9268 parse_func
= md5asa_parse_hash
;
9269 sort_by_digest
= sort_by_digest_4_4
;
9270 opti_type
= OPTI_TYPE_ZERO_BYTE
9271 | OPTI_TYPE_PRECOMPUTE_INIT
9272 | OPTI_TYPE_PRECOMPUTE_MERKLE
9273 | OPTI_TYPE_EARLY_SKIP
9274 | OPTI_TYPE_NOT_ITERATED
;
9281 case 2500: hash_type
= HASH_TYPE_WPA
;
9282 salt_type
= SALT_TYPE_EMBEDDED
;
9283 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9284 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9285 kern_type
= KERN_TYPE_WPA
;
9286 dgst_size
= DGST_SIZE_4_4
;
9287 parse_func
= wpa_parse_hash
;
9288 sort_by_digest
= sort_by_digest_4_4
;
9289 opti_type
= OPTI_TYPE_ZERO_BYTE
9290 | OPTI_TYPE_SLOW_HASH_SIMD
;
9297 case 2600: hash_type
= HASH_TYPE_MD5
;
9298 salt_type
= SALT_TYPE_VIRTUAL
;
9299 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9301 | OPTS_TYPE_PT_ADD80
9302 | OPTS_TYPE_PT_ADDBITS14
9303 | OPTS_TYPE_ST_ADD80
;
9304 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9305 dgst_size
= DGST_SIZE_4_4
;
9306 parse_func
= md5md5_parse_hash
;
9307 sort_by_digest
= sort_by_digest_4_4
;
9308 opti_type
= OPTI_TYPE_ZERO_BYTE
9309 | OPTI_TYPE_PRECOMPUTE_INIT
9310 | OPTI_TYPE_PRECOMPUTE_MERKLE
9311 | OPTI_TYPE_EARLY_SKIP
;
9318 case 2611: hash_type
= HASH_TYPE_MD5
;
9319 salt_type
= SALT_TYPE_INTERN
;
9320 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9321 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9322 | OPTS_TYPE_PT_ADD80
9323 | OPTS_TYPE_PT_ADDBITS14
9324 | OPTS_TYPE_ST_ADD80
;
9325 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9326 dgst_size
= DGST_SIZE_4_4
;
9327 parse_func
= vb3_parse_hash
;
9328 sort_by_digest
= sort_by_digest_4_4
;
9329 opti_type
= OPTI_TYPE_ZERO_BYTE
9330 | OPTI_TYPE_PRECOMPUTE_INIT
9331 | OPTI_TYPE_PRECOMPUTE_MERKLE
9332 | OPTI_TYPE_EARLY_SKIP
;
9339 case 2612: hash_type
= HASH_TYPE_MD5
;
9340 salt_type
= SALT_TYPE_EMBEDDED
;
9341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9343 | OPTS_TYPE_PT_ADD80
9344 | OPTS_TYPE_PT_ADDBITS14
9345 | OPTS_TYPE_ST_ADD80
9347 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9348 dgst_size
= DGST_SIZE_4_4
;
9349 parse_func
= phps_parse_hash
;
9350 sort_by_digest
= sort_by_digest_4_4
;
9351 opti_type
= OPTI_TYPE_ZERO_BYTE
9352 | OPTI_TYPE_PRECOMPUTE_INIT
9353 | OPTI_TYPE_PRECOMPUTE_MERKLE
9354 | OPTI_TYPE_EARLY_SKIP
;
9361 case 2711: hash_type
= HASH_TYPE_MD5
;
9362 salt_type
= SALT_TYPE_INTERN
;
9363 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9365 | OPTS_TYPE_PT_ADD80
9366 | OPTS_TYPE_PT_ADDBITS14
9367 | OPTS_TYPE_ST_ADD80
;
9368 kern_type
= KERN_TYPE_MD55_PWSLT2
;
9369 dgst_size
= DGST_SIZE_4_4
;
9370 parse_func
= vb30_parse_hash
;
9371 sort_by_digest
= sort_by_digest_4_4
;
9372 opti_type
= OPTI_TYPE_ZERO_BYTE
9373 | OPTI_TYPE_PRECOMPUTE_INIT
9374 | OPTI_TYPE_EARLY_SKIP
;
9381 case 2811: hash_type
= HASH_TYPE_MD5
;
9382 salt_type
= SALT_TYPE_INTERN
;
9383 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9384 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9385 | OPTS_TYPE_PT_ADD80
9386 | OPTS_TYPE_PT_ADDBITS14
;
9387 kern_type
= KERN_TYPE_MD55_SLTPW
;
9388 dgst_size
= DGST_SIZE_4_4
;
9389 parse_func
= ipb2_parse_hash
;
9390 sort_by_digest
= sort_by_digest_4_4
;
9391 opti_type
= OPTI_TYPE_ZERO_BYTE
9392 | OPTI_TYPE_PRECOMPUTE_INIT
9393 | OPTI_TYPE_EARLY_SKIP
;
9400 case 3000: hash_type
= HASH_TYPE_LM
;
9401 salt_type
= SALT_TYPE_NONE
;
9402 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9403 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9404 | OPTS_TYPE_PT_UPPER
9405 | OPTS_TYPE_PT_BITSLICE
;
9406 kern_type
= KERN_TYPE_LM
;
9407 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9408 parse_func
= lm_parse_hash
;
9409 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9410 opti_type
= OPTI_TYPE_ZERO_BYTE
9411 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9418 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
9419 salt_type
= SALT_TYPE_INTERN
;
9420 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9421 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9422 | OPTS_TYPE_PT_UPPER
9423 | OPTS_TYPE_ST_UPPER
;
9424 kern_type
= KERN_TYPE_ORACLEH
;
9425 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9426 parse_func
= oracleh_parse_hash
;
9427 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9428 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9435 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9436 salt_type
= SALT_TYPE_EMBEDDED
;
9437 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9438 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9439 | OPTS_TYPE_ST_GENERATE_LE
;
9440 kern_type
= KERN_TYPE_BCRYPT
;
9441 dgst_size
= DGST_SIZE_4_6
;
9442 parse_func
= bcrypt_parse_hash
;
9443 sort_by_digest
= sort_by_digest_4_6
;
9444 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9451 case 3710: hash_type
= HASH_TYPE_MD5
;
9452 salt_type
= SALT_TYPE_INTERN
;
9453 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9454 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9455 | OPTS_TYPE_PT_ADD80
9456 | OPTS_TYPE_PT_ADDBITS14
;
9457 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9458 dgst_size
= DGST_SIZE_4_4
;
9459 parse_func
= md5s_parse_hash
;
9460 sort_by_digest
= sort_by_digest_4_4
;
9461 opti_type
= OPTI_TYPE_ZERO_BYTE
9462 | OPTI_TYPE_PRECOMPUTE_INIT
9463 | OPTI_TYPE_PRECOMPUTE_MERKLE
9464 | OPTI_TYPE_EARLY_SKIP
;
9471 case 3711: hash_type
= HASH_TYPE_MD5
;
9472 salt_type
= SALT_TYPE_EMBEDDED
;
9473 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9474 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9475 | OPTS_TYPE_PT_ADD80
9476 | OPTS_TYPE_PT_ADDBITS14
;
9477 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9478 dgst_size
= DGST_SIZE_4_4
;
9479 parse_func
= mediawiki_b_parse_hash
;
9480 sort_by_digest
= sort_by_digest_4_4
;
9481 opti_type
= OPTI_TYPE_ZERO_BYTE
9482 | OPTI_TYPE_PRECOMPUTE_INIT
9483 | OPTI_TYPE_PRECOMPUTE_MERKLE
9484 | OPTI_TYPE_EARLY_SKIP
;
9491 case 3800: hash_type
= HASH_TYPE_MD5
;
9492 salt_type
= SALT_TYPE_INTERN
;
9493 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9494 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9495 | OPTS_TYPE_ST_ADDBITS14
;
9496 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9497 dgst_size
= DGST_SIZE_4_4
;
9498 parse_func
= md5s_parse_hash
;
9499 sort_by_digest
= sort_by_digest_4_4
;
9500 opti_type
= OPTI_TYPE_ZERO_BYTE
9501 | OPTI_TYPE_PRECOMPUTE_INIT
9502 | OPTI_TYPE_PRECOMPUTE_MERKLE
9503 | OPTI_TYPE_EARLY_SKIP
9504 | OPTI_TYPE_NOT_ITERATED
9505 | OPTI_TYPE_RAW_HASH
;
9512 case 4300: hash_type
= HASH_TYPE_MD5
;
9513 salt_type
= SALT_TYPE_VIRTUAL
;
9514 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9515 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9516 | OPTS_TYPE_PT_ADD80
9517 | OPTS_TYPE_PT_ADDBITS14
9518 | OPTS_TYPE_ST_ADD80
;
9519 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9520 dgst_size
= DGST_SIZE_4_4
;
9521 parse_func
= md5md5_parse_hash
;
9522 sort_by_digest
= sort_by_digest_4_4
;
9523 opti_type
= OPTI_TYPE_ZERO_BYTE
9524 | OPTI_TYPE_PRECOMPUTE_INIT
9525 | OPTI_TYPE_PRECOMPUTE_MERKLE
9526 | OPTI_TYPE_EARLY_SKIP
;
9534 case 4400: hash_type
= HASH_TYPE_MD5
;
9535 salt_type
= SALT_TYPE_NONE
;
9536 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9537 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9538 | OPTS_TYPE_PT_ADD80
9539 | OPTS_TYPE_PT_ADDBITS15
;
9540 kern_type
= KERN_TYPE_MD5_SHA1
;
9541 dgst_size
= DGST_SIZE_4_4
;
9542 parse_func
= md5_parse_hash
;
9543 sort_by_digest
= sort_by_digest_4_4
;
9544 opti_type
= OPTI_TYPE_ZERO_BYTE
9545 | OPTI_TYPE_PRECOMPUTE_INIT
9546 | OPTI_TYPE_PRECOMPUTE_MERKLE
9547 | OPTI_TYPE_EARLY_SKIP
9548 | OPTI_TYPE_NOT_ITERATED
9549 | OPTI_TYPE_NOT_SALTED
9550 | OPTI_TYPE_RAW_HASH
;
9557 case 4500: hash_type
= HASH_TYPE_SHA1
;
9558 salt_type
= SALT_TYPE_NONE
;
9559 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9560 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9561 | OPTS_TYPE_PT_ADD80
9562 | OPTS_TYPE_PT_ADDBITS15
;
9563 kern_type
= KERN_TYPE_SHA11
;
9564 dgst_size
= DGST_SIZE_4_5
;
9565 parse_func
= sha1_parse_hash
;
9566 sort_by_digest
= sort_by_digest_4_5
;
9567 opti_type
= OPTI_TYPE_ZERO_BYTE
9568 | OPTI_TYPE_PRECOMPUTE_INIT
9569 | OPTI_TYPE_PRECOMPUTE_MERKLE
9570 | OPTI_TYPE_EARLY_SKIP
9571 | OPTI_TYPE_NOT_SALTED
;
9578 case 4700: hash_type
= HASH_TYPE_SHA1
;
9579 salt_type
= SALT_TYPE_NONE
;
9580 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9582 | OPTS_TYPE_PT_ADD80
9583 | OPTS_TYPE_PT_ADDBITS14
;
9584 kern_type
= KERN_TYPE_SHA1_MD5
;
9585 dgst_size
= DGST_SIZE_4_5
;
9586 parse_func
= sha1_parse_hash
;
9587 sort_by_digest
= sort_by_digest_4_5
;
9588 opti_type
= OPTI_TYPE_ZERO_BYTE
9589 | OPTI_TYPE_PRECOMPUTE_INIT
9590 | OPTI_TYPE_PRECOMPUTE_MERKLE
9591 | OPTI_TYPE_EARLY_SKIP
9592 | OPTI_TYPE_NOT_ITERATED
9593 | OPTI_TYPE_NOT_SALTED
9594 | OPTI_TYPE_RAW_HASH
;
9601 case 4800: hash_type
= HASH_TYPE_MD5
;
9602 salt_type
= SALT_TYPE_EMBEDDED
;
9603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9605 | OPTS_TYPE_PT_ADDBITS14
;
9606 kern_type
= KERN_TYPE_MD5_CHAP
;
9607 dgst_size
= DGST_SIZE_4_4
;
9608 parse_func
= chap_parse_hash
;
9609 sort_by_digest
= sort_by_digest_4_4
;
9610 opti_type
= OPTI_TYPE_ZERO_BYTE
9611 | OPTI_TYPE_PRECOMPUTE_INIT
9612 | OPTI_TYPE_PRECOMPUTE_MERKLE
9613 | OPTI_TYPE_MEET_IN_MIDDLE
9614 | OPTI_TYPE_EARLY_SKIP
9615 | OPTI_TYPE_NOT_ITERATED
9616 | OPTI_TYPE_RAW_HASH
;
9623 case 4900: hash_type
= HASH_TYPE_SHA1
;
9624 salt_type
= SALT_TYPE_INTERN
;
9625 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9627 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9628 dgst_size
= DGST_SIZE_4_5
;
9629 parse_func
= sha1s_parse_hash
;
9630 sort_by_digest
= sort_by_digest_4_5
;
9631 opti_type
= OPTI_TYPE_ZERO_BYTE
9632 | OPTI_TYPE_PRECOMPUTE_INIT
9633 | OPTI_TYPE_PRECOMPUTE_MERKLE
9634 | OPTI_TYPE_EARLY_SKIP
;
9641 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9642 salt_type
= SALT_TYPE_EMBEDDED
;
9643 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9645 | OPTS_TYPE_PT_ADD01
;
9646 kern_type
= KERN_TYPE_KECCAK
;
9647 dgst_size
= DGST_SIZE_8_25
;
9648 parse_func
= keccak_parse_hash
;
9649 sort_by_digest
= sort_by_digest_8_25
;
9650 opti_type
= OPTI_TYPE_ZERO_BYTE
9651 | OPTI_TYPE_USES_BITS_64
9652 | OPTI_TYPE_RAW_HASH
;
9659 case 5100: hash_type
= HASH_TYPE_MD5H
;
9660 salt_type
= SALT_TYPE_NONE
;
9661 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9662 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9663 | OPTS_TYPE_PT_ADD80
9664 | OPTS_TYPE_PT_ADDBITS14
;
9665 kern_type
= KERN_TYPE_MD5H
;
9666 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9667 parse_func
= md5half_parse_hash
;
9668 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9669 opti_type
= OPTI_TYPE_ZERO_BYTE
9670 | OPTI_TYPE_RAW_HASH
;
9677 case 5200: hash_type
= HASH_TYPE_SHA256
;
9678 salt_type
= SALT_TYPE_EMBEDDED
;
9679 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9681 kern_type
= KERN_TYPE_PSAFE3
;
9682 dgst_size
= DGST_SIZE_4_8
;
9683 parse_func
= psafe3_parse_hash
;
9684 sort_by_digest
= sort_by_digest_4_8
;
9685 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9692 case 5300: hash_type
= HASH_TYPE_MD5
;
9693 salt_type
= SALT_TYPE_EMBEDDED
;
9694 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9695 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9696 | OPTS_TYPE_ST_ADD80
;
9697 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9698 dgst_size
= DGST_SIZE_4_4
;
9699 parse_func
= ikepsk_md5_parse_hash
;
9700 sort_by_digest
= sort_by_digest_4_4
;
9701 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9708 case 5400: hash_type
= HASH_TYPE_SHA1
;
9709 salt_type
= SALT_TYPE_EMBEDDED
;
9710 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9711 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9712 | OPTS_TYPE_ST_ADD80
;
9713 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9714 dgst_size
= DGST_SIZE_4_5
;
9715 parse_func
= ikepsk_sha1_parse_hash
;
9716 sort_by_digest
= sort_by_digest_4_5
;
9717 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9724 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9725 salt_type
= SALT_TYPE_EMBEDDED
;
9726 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9728 | OPTS_TYPE_PT_ADD80
9729 | OPTS_TYPE_PT_ADDBITS14
9730 | OPTS_TYPE_PT_UNICODE
9732 kern_type
= KERN_TYPE_NETNTLMv1
;
9733 dgst_size
= DGST_SIZE_4_4
;
9734 parse_func
= netntlmv1_parse_hash
;
9735 sort_by_digest
= sort_by_digest_4_4
;
9736 opti_type
= OPTI_TYPE_ZERO_BYTE
9737 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9744 case 5600: hash_type
= HASH_TYPE_MD5
;
9745 salt_type
= SALT_TYPE_EMBEDDED
;
9746 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9747 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9748 | OPTS_TYPE_PT_ADD80
9749 | OPTS_TYPE_PT_ADDBITS14
9750 | OPTS_TYPE_PT_UNICODE
;
9751 kern_type
= KERN_TYPE_NETNTLMv2
;
9752 dgst_size
= DGST_SIZE_4_4
;
9753 parse_func
= netntlmv2_parse_hash
;
9754 sort_by_digest
= sort_by_digest_4_4
;
9755 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9762 case 5700: hash_type
= HASH_TYPE_SHA256
;
9763 salt_type
= SALT_TYPE_NONE
;
9764 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9765 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9766 | OPTS_TYPE_PT_ADD80
9767 | OPTS_TYPE_PT_ADDBITS15
;
9768 kern_type
= KERN_TYPE_SHA256
;
9769 dgst_size
= DGST_SIZE_4_8
;
9770 parse_func
= cisco4_parse_hash
;
9771 sort_by_digest
= sort_by_digest_4_8
;
9772 opti_type
= OPTI_TYPE_ZERO_BYTE
9773 | OPTI_TYPE_PRECOMPUTE_INIT
9774 | OPTI_TYPE_PRECOMPUTE_MERKLE
9775 | OPTI_TYPE_EARLY_SKIP
9776 | OPTI_TYPE_NOT_ITERATED
9777 | OPTI_TYPE_NOT_SALTED
9778 | OPTI_TYPE_RAW_HASH
;
9785 case 5800: hash_type
= HASH_TYPE_SHA1
;
9786 salt_type
= SALT_TYPE_INTERN
;
9787 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9788 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9789 | OPTS_TYPE_ST_ADD80
;
9790 kern_type
= KERN_TYPE_ANDROIDPIN
;
9791 dgst_size
= DGST_SIZE_4_5
;
9792 parse_func
= androidpin_parse_hash
;
9793 sort_by_digest
= sort_by_digest_4_5
;
9794 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9801 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9802 salt_type
= SALT_TYPE_NONE
;
9803 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9804 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9805 | OPTS_TYPE_PT_ADD80
;
9806 kern_type
= KERN_TYPE_RIPEMD160
;
9807 dgst_size
= DGST_SIZE_4_5
;
9808 parse_func
= ripemd160_parse_hash
;
9809 sort_by_digest
= sort_by_digest_4_5
;
9810 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9817 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9818 salt_type
= SALT_TYPE_NONE
;
9819 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9820 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9821 | OPTS_TYPE_PT_ADD80
;
9822 kern_type
= KERN_TYPE_WHIRLPOOL
;
9823 dgst_size
= DGST_SIZE_4_16
;
9824 parse_func
= whirlpool_parse_hash
;
9825 sort_by_digest
= sort_by_digest_4_16
;
9826 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9833 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9834 salt_type
= SALT_TYPE_EMBEDDED
;
9835 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9836 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9837 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9838 dgst_size
= DGST_SIZE_4_5
;
9839 parse_func
= truecrypt_parse_hash_2k
;
9840 sort_by_digest
= sort_by_digest_4_5
;
9841 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9848 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9849 salt_type
= SALT_TYPE_EMBEDDED
;
9850 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9851 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9852 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9853 dgst_size
= DGST_SIZE_4_5
;
9854 parse_func
= truecrypt_parse_hash_2k
;
9855 sort_by_digest
= sort_by_digest_4_5
;
9856 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9863 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9864 salt_type
= SALT_TYPE_EMBEDDED
;
9865 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9867 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9868 dgst_size
= DGST_SIZE_4_5
;
9869 parse_func
= truecrypt_parse_hash_2k
;
9870 sort_by_digest
= sort_by_digest_4_5
;
9871 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9878 case 6221: hash_type
= HASH_TYPE_SHA512
;
9879 salt_type
= SALT_TYPE_EMBEDDED
;
9880 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9882 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9883 dgst_size
= DGST_SIZE_8_8
;
9884 parse_func
= truecrypt_parse_hash_1k
;
9885 sort_by_digest
= sort_by_digest_8_8
;
9886 opti_type
= OPTI_TYPE_ZERO_BYTE
9887 | OPTI_TYPE_USES_BITS_64
;
9894 case 6222: hash_type
= HASH_TYPE_SHA512
;
9895 salt_type
= SALT_TYPE_EMBEDDED
;
9896 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9897 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9898 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9899 dgst_size
= DGST_SIZE_8_8
;
9900 parse_func
= truecrypt_parse_hash_1k
;
9901 sort_by_digest
= sort_by_digest_8_8
;
9902 opti_type
= OPTI_TYPE_ZERO_BYTE
9903 | OPTI_TYPE_USES_BITS_64
;
9910 case 6223: hash_type
= HASH_TYPE_SHA512
;
9911 salt_type
= SALT_TYPE_EMBEDDED
;
9912 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9913 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9914 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9915 dgst_size
= DGST_SIZE_8_8
;
9916 parse_func
= truecrypt_parse_hash_1k
;
9917 sort_by_digest
= sort_by_digest_8_8
;
9918 opti_type
= OPTI_TYPE_ZERO_BYTE
9919 | OPTI_TYPE_USES_BITS_64
;
9926 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9927 salt_type
= SALT_TYPE_EMBEDDED
;
9928 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9929 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9930 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9931 dgst_size
= DGST_SIZE_4_8
;
9932 parse_func
= truecrypt_parse_hash_1k
;
9933 sort_by_digest
= sort_by_digest_4_8
;
9934 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9941 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9942 salt_type
= SALT_TYPE_EMBEDDED
;
9943 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9944 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9945 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9946 dgst_size
= DGST_SIZE_4_8
;
9947 parse_func
= truecrypt_parse_hash_1k
;
9948 sort_by_digest
= sort_by_digest_4_8
;
9949 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9956 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9957 salt_type
= SALT_TYPE_EMBEDDED
;
9958 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9959 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9960 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9961 dgst_size
= DGST_SIZE_4_8
;
9962 parse_func
= truecrypt_parse_hash_1k
;
9963 sort_by_digest
= sort_by_digest_4_8
;
9964 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9971 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9972 salt_type
= SALT_TYPE_EMBEDDED
;
9973 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9974 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9975 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9976 dgst_size
= DGST_SIZE_4_5
;
9977 parse_func
= truecrypt_parse_hash_1k
;
9978 sort_by_digest
= sort_by_digest_4_5
;
9979 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9986 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9987 salt_type
= SALT_TYPE_EMBEDDED
;
9988 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9989 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9990 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9991 dgst_size
= DGST_SIZE_4_5
;
9992 parse_func
= truecrypt_parse_hash_1k
;
9993 sort_by_digest
= sort_by_digest_4_5
;
9994 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10001 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
10002 salt_type
= SALT_TYPE_EMBEDDED
;
10003 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10004 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10005 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10006 dgst_size
= DGST_SIZE_4_5
;
10007 parse_func
= truecrypt_parse_hash_1k
;
10008 sort_by_digest
= sort_by_digest_4_5
;
10009 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10016 case 6300: hash_type
= HASH_TYPE_MD5
;
10017 salt_type
= SALT_TYPE_EMBEDDED
;
10018 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10019 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10020 kern_type
= KERN_TYPE_MD5AIX
;
10021 dgst_size
= DGST_SIZE_4_4
;
10022 parse_func
= md5aix_parse_hash
;
10023 sort_by_digest
= sort_by_digest_4_4
;
10024 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10031 case 6400: hash_type
= HASH_TYPE_SHA256
;
10032 salt_type
= SALT_TYPE_EMBEDDED
;
10033 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10034 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10035 kern_type
= KERN_TYPE_SHA256AIX
;
10036 dgst_size
= DGST_SIZE_4_8
;
10037 parse_func
= sha256aix_parse_hash
;
10038 sort_by_digest
= sort_by_digest_4_8
;
10039 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10046 case 6500: hash_type
= HASH_TYPE_SHA512
;
10047 salt_type
= SALT_TYPE_EMBEDDED
;
10048 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10049 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10050 kern_type
= KERN_TYPE_SHA512AIX
;
10051 dgst_size
= DGST_SIZE_8_8
;
10052 parse_func
= sha512aix_parse_hash
;
10053 sort_by_digest
= sort_by_digest_8_8
;
10054 opti_type
= OPTI_TYPE_ZERO_BYTE
10055 | OPTI_TYPE_USES_BITS_64
;
10062 case 6600: hash_type
= HASH_TYPE_AES
;
10063 salt_type
= SALT_TYPE_EMBEDDED
;
10064 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10065 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10066 kern_type
= KERN_TYPE_AGILEKEY
;
10067 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10068 parse_func
= agilekey_parse_hash
;
10069 sort_by_digest
= sort_by_digest_4_5
;
10070 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10077 case 6700: hash_type
= HASH_TYPE_SHA1
;
10078 salt_type
= SALT_TYPE_EMBEDDED
;
10079 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10081 kern_type
= KERN_TYPE_SHA1AIX
;
10082 dgst_size
= DGST_SIZE_4_5
;
10083 parse_func
= sha1aix_parse_hash
;
10084 sort_by_digest
= sort_by_digest_4_5
;
10085 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10092 case 6800: hash_type
= HASH_TYPE_AES
;
10093 salt_type
= SALT_TYPE_EMBEDDED
;
10094 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10095 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10096 kern_type
= KERN_TYPE_LASTPASS
;
10097 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
10098 parse_func
= lastpass_parse_hash
;
10099 sort_by_digest
= sort_by_digest_4_8
;
10100 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10107 case 6900: hash_type
= HASH_TYPE_GOST
;
10108 salt_type
= SALT_TYPE_NONE
;
10109 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10110 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10111 kern_type
= KERN_TYPE_GOST
;
10112 dgst_size
= DGST_SIZE_4_8
;
10113 parse_func
= gost_parse_hash
;
10114 sort_by_digest
= sort_by_digest_4_8
;
10115 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10122 case 7100: hash_type
= HASH_TYPE_SHA512
;
10123 salt_type
= SALT_TYPE_EMBEDDED
;
10124 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10125 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10126 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10127 dgst_size
= DGST_SIZE_8_16
;
10128 parse_func
= sha512osx_parse_hash
;
10129 sort_by_digest
= sort_by_digest_8_16
;
10130 opti_type
= OPTI_TYPE_ZERO_BYTE
10131 | OPTI_TYPE_USES_BITS_64
10132 | OPTI_TYPE_SLOW_HASH_SIMD
;
10139 case 7200: hash_type
= HASH_TYPE_SHA512
;
10140 salt_type
= SALT_TYPE_EMBEDDED
;
10141 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10142 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10143 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10144 dgst_size
= DGST_SIZE_8_16
;
10145 parse_func
= sha512grub_parse_hash
;
10146 sort_by_digest
= sort_by_digest_8_16
;
10147 opti_type
= OPTI_TYPE_ZERO_BYTE
10148 | OPTI_TYPE_USES_BITS_64
10149 | OPTI_TYPE_SLOW_HASH_SIMD
;
10156 case 7300: hash_type
= HASH_TYPE_SHA1
;
10157 salt_type
= SALT_TYPE_EMBEDDED
;
10158 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10159 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10160 | OPTS_TYPE_ST_ADD80
10161 | OPTS_TYPE_ST_ADDBITS15
;
10162 kern_type
= KERN_TYPE_RAKP
;
10163 dgst_size
= DGST_SIZE_4_5
;
10164 parse_func
= rakp_parse_hash
;
10165 sort_by_digest
= sort_by_digest_4_5
;
10166 opti_type
= OPTI_TYPE_ZERO_BYTE
10167 | OPTI_TYPE_NOT_ITERATED
;
10174 case 7400: hash_type
= HASH_TYPE_SHA256
;
10175 salt_type
= SALT_TYPE_EMBEDDED
;
10176 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10177 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10178 kern_type
= KERN_TYPE_SHA256CRYPT
;
10179 dgst_size
= DGST_SIZE_4_8
;
10180 parse_func
= sha256crypt_parse_hash
;
10181 sort_by_digest
= sort_by_digest_4_8
;
10182 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10189 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
10190 salt_type
= SALT_TYPE_EMBEDDED
;
10191 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10192 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10193 kern_type
= KERN_TYPE_KRB5PA
;
10194 dgst_size
= DGST_SIZE_4_4
;
10195 parse_func
= krb5pa_parse_hash
;
10196 sort_by_digest
= sort_by_digest_4_4
;
10197 opti_type
= OPTI_TYPE_ZERO_BYTE
10198 | OPTI_TYPE_NOT_ITERATED
;
10205 case 7600: hash_type
= HASH_TYPE_SHA1
;
10206 salt_type
= SALT_TYPE_INTERN
;
10207 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10208 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10209 | OPTS_TYPE_PT_ADD80
10210 | OPTS_TYPE_PT_ADDBITS15
;
10211 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
10212 dgst_size
= DGST_SIZE_4_5
;
10213 parse_func
= redmine_parse_hash
;
10214 sort_by_digest
= sort_by_digest_4_5
;
10215 opti_type
= OPTI_TYPE_ZERO_BYTE
10216 | OPTI_TYPE_PRECOMPUTE_INIT
10217 | OPTI_TYPE_EARLY_SKIP
10218 | OPTI_TYPE_NOT_ITERATED
10219 | OPTI_TYPE_PREPENDED_SALT
;
10226 case 7700: hash_type
= HASH_TYPE_SAPB
;
10227 salt_type
= SALT_TYPE_EMBEDDED
;
10228 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10229 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10230 | OPTS_TYPE_PT_UPPER
10231 | OPTS_TYPE_ST_UPPER
;
10232 kern_type
= KERN_TYPE_SAPB
;
10233 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10234 parse_func
= sapb_parse_hash
;
10235 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10236 opti_type
= OPTI_TYPE_ZERO_BYTE
10237 | OPTI_TYPE_PRECOMPUTE_INIT
10238 | OPTI_TYPE_NOT_ITERATED
;
10245 case 7800: hash_type
= HASH_TYPE_SAPG
;
10246 salt_type
= SALT_TYPE_EMBEDDED
;
10247 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10248 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10249 | OPTS_TYPE_ST_ADD80
10250 | OPTS_TYPE_ST_UPPER
;
10251 kern_type
= KERN_TYPE_SAPG
;
10252 dgst_size
= DGST_SIZE_4_5
;
10253 parse_func
= sapg_parse_hash
;
10254 sort_by_digest
= sort_by_digest_4_5
;
10255 opti_type
= OPTI_TYPE_ZERO_BYTE
10256 | OPTI_TYPE_PRECOMPUTE_INIT
10257 | OPTI_TYPE_NOT_ITERATED
;
10264 case 7900: hash_type
= HASH_TYPE_SHA512
;
10265 salt_type
= SALT_TYPE_EMBEDDED
;
10266 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10267 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10268 kern_type
= KERN_TYPE_DRUPAL7
;
10269 dgst_size
= DGST_SIZE_8_8
;
10270 parse_func
= drupal7_parse_hash
;
10271 sort_by_digest
= sort_by_digest_8_8
;
10272 opti_type
= OPTI_TYPE_ZERO_BYTE
10273 | OPTI_TYPE_USES_BITS_64
;
10280 case 8000: hash_type
= HASH_TYPE_SHA256
;
10281 salt_type
= SALT_TYPE_EMBEDDED
;
10282 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10283 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10284 | OPTS_TYPE_PT_UNICODE
10285 | OPTS_TYPE_ST_ADD80
10286 | OPTS_TYPE_ST_HEX
;
10287 kern_type
= KERN_TYPE_SYBASEASE
;
10288 dgst_size
= DGST_SIZE_4_8
;
10289 parse_func
= sybasease_parse_hash
;
10290 sort_by_digest
= sort_by_digest_4_8
;
10291 opti_type
= OPTI_TYPE_ZERO_BYTE
10292 | OPTI_TYPE_PRECOMPUTE_INIT
10293 | OPTI_TYPE_EARLY_SKIP
10294 | OPTI_TYPE_NOT_ITERATED
10295 | OPTI_TYPE_RAW_HASH
;
10302 case 8100: hash_type
= HASH_TYPE_SHA1
;
10303 salt_type
= SALT_TYPE_EMBEDDED
;
10304 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10305 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
10306 kern_type
= KERN_TYPE_NETSCALER
;
10307 dgst_size
= DGST_SIZE_4_5
;
10308 parse_func
= netscaler_parse_hash
;
10309 sort_by_digest
= sort_by_digest_4_5
;
10310 opti_type
= OPTI_TYPE_ZERO_BYTE
10311 | OPTI_TYPE_PRECOMPUTE_INIT
10312 | OPTI_TYPE_PRECOMPUTE_MERKLE
10313 | OPTI_TYPE_EARLY_SKIP
10314 | OPTI_TYPE_NOT_ITERATED
10315 | OPTI_TYPE_PREPENDED_SALT
10316 | OPTI_TYPE_RAW_HASH
;
10323 case 8200: hash_type
= HASH_TYPE_SHA256
;
10324 salt_type
= SALT_TYPE_EMBEDDED
;
10325 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10326 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10327 kern_type
= KERN_TYPE_CLOUDKEY
;
10328 dgst_size
= DGST_SIZE_4_8
;
10329 parse_func
= cloudkey_parse_hash
;
10330 sort_by_digest
= sort_by_digest_4_8
;
10331 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10338 case 8300: hash_type
= HASH_TYPE_SHA1
;
10339 salt_type
= SALT_TYPE_EMBEDDED
;
10340 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10341 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10343 | OPTS_TYPE_ST_ADD80
;
10344 kern_type
= KERN_TYPE_NSEC3
;
10345 dgst_size
= DGST_SIZE_4_5
;
10346 parse_func
= nsec3_parse_hash
;
10347 sort_by_digest
= sort_by_digest_4_5
;
10348 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10355 case 8400: hash_type
= HASH_TYPE_SHA1
;
10356 salt_type
= SALT_TYPE_INTERN
;
10357 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10358 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10359 | OPTS_TYPE_PT_ADD80
10360 | OPTS_TYPE_PT_ADDBITS15
;
10361 kern_type
= KERN_TYPE_WBB3
;
10362 dgst_size
= DGST_SIZE_4_5
;
10363 parse_func
= wbb3_parse_hash
;
10364 sort_by_digest
= sort_by_digest_4_5
;
10365 opti_type
= OPTI_TYPE_ZERO_BYTE
10366 | OPTI_TYPE_PRECOMPUTE_INIT
10367 | OPTI_TYPE_NOT_ITERATED
;
10374 case 8500: hash_type
= HASH_TYPE_DESRACF
;
10375 salt_type
= SALT_TYPE_EMBEDDED
;
10376 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10378 | OPTS_TYPE_ST_UPPER
;
10379 kern_type
= KERN_TYPE_RACF
;
10380 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10381 parse_func
= racf_parse_hash
;
10382 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10383 opti_type
= OPTI_TYPE_ZERO_BYTE
10384 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10391 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
10392 salt_type
= SALT_TYPE_NONE
;
10393 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10395 kern_type
= KERN_TYPE_LOTUS5
;
10396 dgst_size
= DGST_SIZE_4_4
;
10397 parse_func
= lotus5_parse_hash
;
10398 sort_by_digest
= sort_by_digest_4_4
;
10399 opti_type
= OPTI_TYPE_EARLY_SKIP
10400 | OPTI_TYPE_NOT_ITERATED
10401 | OPTI_TYPE_NOT_SALTED
10402 | OPTI_TYPE_RAW_HASH
;
10409 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
10410 salt_type
= SALT_TYPE_EMBEDDED
;
10411 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10412 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10413 kern_type
= KERN_TYPE_LOTUS6
;
10414 dgst_size
= DGST_SIZE_4_4
;
10415 parse_func
= lotus6_parse_hash
;
10416 sort_by_digest
= sort_by_digest_4_4
;
10417 opti_type
= OPTI_TYPE_EARLY_SKIP
10418 | OPTI_TYPE_NOT_ITERATED
10419 | OPTI_TYPE_RAW_HASH
;
10426 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
10427 salt_type
= SALT_TYPE_EMBEDDED
;
10428 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10429 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10430 kern_type
= KERN_TYPE_ANDROIDFDE
;
10431 dgst_size
= DGST_SIZE_4_4
;
10432 parse_func
= androidfde_parse_hash
;
10433 sort_by_digest
= sort_by_digest_4_4
;
10434 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10441 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10442 salt_type
= SALT_TYPE_EMBEDDED
;
10443 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10444 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10445 kern_type
= KERN_TYPE_SCRYPT
;
10446 dgst_size
= DGST_SIZE_4_8
;
10447 parse_func
= scrypt_parse_hash
;
10448 sort_by_digest
= sort_by_digest_4_8
;
10449 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10456 case 9000: hash_type
= HASH_TYPE_SHA1
;
10457 salt_type
= SALT_TYPE_EMBEDDED
;
10458 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10459 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10460 | OPTS_TYPE_ST_GENERATE_LE
;
10461 kern_type
= KERN_TYPE_PSAFE2
;
10462 dgst_size
= DGST_SIZE_4_5
;
10463 parse_func
= psafe2_parse_hash
;
10464 sort_by_digest
= sort_by_digest_4_5
;
10465 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10472 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10473 salt_type
= SALT_TYPE_EMBEDDED
;
10474 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10476 kern_type
= KERN_TYPE_LOTUS8
;
10477 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10478 parse_func
= lotus8_parse_hash
;
10479 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10480 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10487 case 9200: hash_type
= HASH_TYPE_SHA256
;
10488 salt_type
= SALT_TYPE_EMBEDDED
;
10489 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10491 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10492 dgst_size
= DGST_SIZE_4_32
;
10493 parse_func
= cisco8_parse_hash
;
10494 sort_by_digest
= sort_by_digest_4_32
;
10495 opti_type
= OPTI_TYPE_ZERO_BYTE
10496 | OPTI_TYPE_SLOW_HASH_SIMD
;
10503 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
10504 salt_type
= SALT_TYPE_EMBEDDED
;
10505 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10506 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10507 kern_type
= KERN_TYPE_SCRYPT
;
10508 dgst_size
= DGST_SIZE_4_8
;
10509 parse_func
= cisco9_parse_hash
;
10510 sort_by_digest
= sort_by_digest_4_8
;
10511 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10518 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10519 salt_type
= SALT_TYPE_EMBEDDED
;
10520 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10522 kern_type
= KERN_TYPE_OFFICE2007
;
10523 dgst_size
= DGST_SIZE_4_4
;
10524 parse_func
= office2007_parse_hash
;
10525 sort_by_digest
= sort_by_digest_4_4
;
10526 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10533 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10534 salt_type
= SALT_TYPE_EMBEDDED
;
10535 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10537 kern_type
= KERN_TYPE_OFFICE2010
;
10538 dgst_size
= DGST_SIZE_4_4
;
10539 parse_func
= office2010_parse_hash
;
10540 sort_by_digest
= sort_by_digest_4_4
;
10541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10548 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10549 salt_type
= SALT_TYPE_EMBEDDED
;
10550 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10551 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10552 kern_type
= KERN_TYPE_OFFICE2013
;
10553 dgst_size
= DGST_SIZE_4_4
;
10554 parse_func
= office2013_parse_hash
;
10555 sort_by_digest
= sort_by_digest_4_4
;
10556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10563 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10564 salt_type
= SALT_TYPE_EMBEDDED
;
10565 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10567 | OPTS_TYPE_PT_ADD80
10568 | OPTS_TYPE_PT_UNICODE
;
10569 kern_type
= KERN_TYPE_OLDOFFICE01
;
10570 dgst_size
= DGST_SIZE_4_4
;
10571 parse_func
= oldoffice01_parse_hash
;
10572 sort_by_digest
= sort_by_digest_4_4
;
10573 opti_type
= OPTI_TYPE_ZERO_BYTE
10574 | OPTI_TYPE_PRECOMPUTE_INIT
10575 | OPTI_TYPE_NOT_ITERATED
;
10582 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10583 salt_type
= SALT_TYPE_EMBEDDED
;
10584 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10585 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10586 | OPTS_TYPE_PT_ADD80
;
10587 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10588 dgst_size
= DGST_SIZE_4_4
;
10589 parse_func
= oldoffice01cm1_parse_hash
;
10590 sort_by_digest
= sort_by_digest_4_4
;
10591 opti_type
= OPTI_TYPE_ZERO_BYTE
10592 | OPTI_TYPE_PRECOMPUTE_INIT
10593 | OPTI_TYPE_NOT_ITERATED
;
10600 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10601 salt_type
= SALT_TYPE_EMBEDDED
;
10602 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10603 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10604 | OPTS_TYPE_PT_ADD80
10605 | OPTS_TYPE_PT_UNICODE
10606 | OPTS_TYPE_PT_NEVERCRACK
;
10607 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10608 dgst_size
= DGST_SIZE_4_4
;
10609 parse_func
= oldoffice01cm2_parse_hash
;
10610 sort_by_digest
= sort_by_digest_4_4
;
10611 opti_type
= OPTI_TYPE_ZERO_BYTE
10612 | OPTI_TYPE_PRECOMPUTE_INIT
10613 | OPTI_TYPE_NOT_ITERATED
;
10620 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10621 salt_type
= SALT_TYPE_EMBEDDED
;
10622 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10623 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10624 | OPTS_TYPE_PT_ADD80
10625 | OPTS_TYPE_PT_UNICODE
;
10626 kern_type
= KERN_TYPE_OLDOFFICE34
;
10627 dgst_size
= DGST_SIZE_4_4
;
10628 parse_func
= oldoffice34_parse_hash
;
10629 sort_by_digest
= sort_by_digest_4_4
;
10630 opti_type
= OPTI_TYPE_ZERO_BYTE
10631 | OPTI_TYPE_PRECOMPUTE_INIT
10632 | OPTI_TYPE_NOT_ITERATED
;
10639 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10640 salt_type
= SALT_TYPE_EMBEDDED
;
10641 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10642 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10643 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10644 dgst_size
= DGST_SIZE_4_4
;
10645 parse_func
= oldoffice34cm1_parse_hash
;
10646 sort_by_digest
= sort_by_digest_4_4
;
10647 opti_type
= OPTI_TYPE_ZERO_BYTE
10648 | OPTI_TYPE_PRECOMPUTE_INIT
10649 | OPTI_TYPE_NOT_ITERATED
;
10656 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10657 salt_type
= SALT_TYPE_EMBEDDED
;
10658 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10659 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10660 | OPTS_TYPE_PT_ADD80
10661 | OPTS_TYPE_PT_UNICODE
10662 | OPTS_TYPE_PT_NEVERCRACK
;
10663 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10664 dgst_size
= DGST_SIZE_4_4
;
10665 parse_func
= oldoffice34cm2_parse_hash
;
10666 sort_by_digest
= sort_by_digest_4_4
;
10667 opti_type
= OPTI_TYPE_ZERO_BYTE
10668 | OPTI_TYPE_PRECOMPUTE_INIT
10669 | OPTI_TYPE_NOT_ITERATED
;
10676 case 9900: hash_type
= HASH_TYPE_MD5
;
10677 salt_type
= SALT_TYPE_NONE
;
10678 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10679 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10680 kern_type
= KERN_TYPE_RADMIN2
;
10681 dgst_size
= DGST_SIZE_4_4
;
10682 parse_func
= radmin2_parse_hash
;
10683 sort_by_digest
= sort_by_digest_4_4
;
10684 opti_type
= OPTI_TYPE_ZERO_BYTE
10685 | OPTI_TYPE_PRECOMPUTE_INIT
10686 | OPTI_TYPE_EARLY_SKIP
10687 | OPTI_TYPE_NOT_ITERATED
10688 | OPTI_TYPE_NOT_SALTED
;
10695 case 10000: hash_type
= HASH_TYPE_SHA256
;
10696 salt_type
= SALT_TYPE_EMBEDDED
;
10697 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10698 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10699 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10700 dgst_size
= DGST_SIZE_4_32
;
10701 parse_func
= djangopbkdf2_parse_hash
;
10702 sort_by_digest
= sort_by_digest_4_32
;
10703 opti_type
= OPTI_TYPE_ZERO_BYTE
10704 | OPTI_TYPE_SLOW_HASH_SIMD
;
10711 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10712 salt_type
= SALT_TYPE_EMBEDDED
;
10713 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10714 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10715 kern_type
= KERN_TYPE_SIPHASH
;
10716 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10717 parse_func
= siphash_parse_hash
;
10718 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10719 opti_type
= OPTI_TYPE_ZERO_BYTE
10720 | OPTI_TYPE_NOT_ITERATED
10721 | OPTI_TYPE_RAW_HASH
;
10728 case 10200: hash_type
= HASH_TYPE_MD5
;
10729 salt_type
= SALT_TYPE_EMBEDDED
;
10730 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10731 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10732 | OPTS_TYPE_ST_ADD80
10733 | OPTS_TYPE_ST_ADDBITS14
;
10734 kern_type
= KERN_TYPE_HMACMD5_PW
;
10735 dgst_size
= DGST_SIZE_4_4
;
10736 parse_func
= crammd5_parse_hash
;
10737 sort_by_digest
= sort_by_digest_4_4
;
10738 opti_type
= OPTI_TYPE_ZERO_BYTE
10739 | OPTI_TYPE_NOT_ITERATED
;
10746 case 10300: hash_type
= HASH_TYPE_SHA1
;
10747 salt_type
= SALT_TYPE_EMBEDDED
;
10748 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10749 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10750 kern_type
= KERN_TYPE_SAPH_SHA1
;
10751 dgst_size
= DGST_SIZE_4_5
;
10752 parse_func
= saph_sha1_parse_hash
;
10753 sort_by_digest
= sort_by_digest_4_5
;
10754 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10761 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10762 salt_type
= SALT_TYPE_EMBEDDED
;
10763 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10764 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10765 kern_type
= KERN_TYPE_PDF11
;
10766 dgst_size
= DGST_SIZE_4_4
;
10767 parse_func
= pdf11_parse_hash
;
10768 sort_by_digest
= sort_by_digest_4_4
;
10769 opti_type
= OPTI_TYPE_ZERO_BYTE
10770 | OPTI_TYPE_NOT_ITERATED
;
10777 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10778 salt_type
= SALT_TYPE_EMBEDDED
;
10779 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10780 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10781 kern_type
= KERN_TYPE_PDF11CM1
;
10782 dgst_size
= DGST_SIZE_4_4
;
10783 parse_func
= pdf11cm1_parse_hash
;
10784 sort_by_digest
= sort_by_digest_4_4
;
10785 opti_type
= OPTI_TYPE_ZERO_BYTE
10786 | OPTI_TYPE_NOT_ITERATED
;
10793 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10794 salt_type
= SALT_TYPE_EMBEDDED
;
10795 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10796 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10797 kern_type
= KERN_TYPE_PDF11CM2
;
10798 dgst_size
= DGST_SIZE_4_4
;
10799 parse_func
= pdf11cm2_parse_hash
;
10800 sort_by_digest
= sort_by_digest_4_4
;
10801 opti_type
= OPTI_TYPE_ZERO_BYTE
10802 | OPTI_TYPE_NOT_ITERATED
;
10809 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10810 salt_type
= SALT_TYPE_EMBEDDED
;
10811 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10812 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10813 kern_type
= KERN_TYPE_PDF14
;
10814 dgst_size
= DGST_SIZE_4_4
;
10815 parse_func
= pdf14_parse_hash
;
10816 sort_by_digest
= sort_by_digest_4_4
;
10817 opti_type
= OPTI_TYPE_ZERO_BYTE
10818 | OPTI_TYPE_NOT_ITERATED
;
10825 case 10600: hash_type
= HASH_TYPE_SHA256
;
10826 salt_type
= SALT_TYPE_EMBEDDED
;
10827 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10828 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10829 | OPTS_TYPE_ST_ADD80
10830 | OPTS_TYPE_ST_ADDBITS15
10831 | OPTS_TYPE_HASH_COPY
;
10832 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10833 dgst_size
= DGST_SIZE_4_8
;
10834 parse_func
= pdf17l3_parse_hash
;
10835 sort_by_digest
= sort_by_digest_4_8
;
10836 opti_type
= OPTI_TYPE_ZERO_BYTE
10837 | OPTI_TYPE_PRECOMPUTE_INIT
10838 | OPTI_TYPE_PRECOMPUTE_MERKLE
10839 | OPTI_TYPE_EARLY_SKIP
10840 | OPTI_TYPE_NOT_ITERATED
10841 | OPTI_TYPE_APPENDED_SALT
10842 | OPTI_TYPE_RAW_HASH
;
10849 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10850 salt_type
= SALT_TYPE_EMBEDDED
;
10851 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10852 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10853 | OPTS_TYPE_HASH_COPY
;
10854 kern_type
= KERN_TYPE_PDF17L8
;
10855 dgst_size
= DGST_SIZE_4_8
;
10856 parse_func
= pdf17l8_parse_hash
;
10857 sort_by_digest
= sort_by_digest_4_8
;
10858 opti_type
= OPTI_TYPE_ZERO_BYTE
10859 | OPTI_TYPE_NOT_ITERATED
;
10866 case 10800: hash_type
= HASH_TYPE_SHA384
;
10867 salt_type
= SALT_TYPE_NONE
;
10868 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10869 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10870 | OPTS_TYPE_PT_ADD80
10871 | OPTS_TYPE_PT_ADDBITS15
;
10872 kern_type
= KERN_TYPE_SHA384
;
10873 dgst_size
= DGST_SIZE_8_8
;
10874 parse_func
= sha384_parse_hash
;
10875 sort_by_digest
= sort_by_digest_8_8
;
10876 opti_type
= OPTI_TYPE_ZERO_BYTE
10877 | OPTI_TYPE_PRECOMPUTE_INIT
10878 | OPTI_TYPE_PRECOMPUTE_MERKLE
10879 | OPTI_TYPE_EARLY_SKIP
10880 | OPTI_TYPE_NOT_ITERATED
10881 | OPTI_TYPE_NOT_SALTED
10882 | OPTI_TYPE_USES_BITS_64
10883 | OPTI_TYPE_RAW_HASH
;
10890 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10891 salt_type
= SALT_TYPE_EMBEDDED
;
10892 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10893 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10894 | OPTS_TYPE_ST_BASE64
10895 | OPTS_TYPE_HASH_COPY
;
10896 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10897 dgst_size
= DGST_SIZE_4_32
;
10898 parse_func
= pbkdf2_sha256_parse_hash
;
10899 sort_by_digest
= sort_by_digest_4_32
;
10900 opti_type
= OPTI_TYPE_ZERO_BYTE
10901 | OPTI_TYPE_SLOW_HASH_SIMD
;
10908 case 11000: hash_type
= HASH_TYPE_MD5
;
10909 salt_type
= SALT_TYPE_INTERN
;
10910 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10911 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10912 | OPTS_TYPE_PT_ADD80
;
10913 kern_type
= KERN_TYPE_PRESTASHOP
;
10914 dgst_size
= DGST_SIZE_4_4
;
10915 parse_func
= prestashop_parse_hash
;
10916 sort_by_digest
= sort_by_digest_4_4
;
10917 opti_type
= OPTI_TYPE_ZERO_BYTE
10918 | OPTI_TYPE_PRECOMPUTE_INIT
10919 | OPTI_TYPE_NOT_ITERATED
10920 | OPTI_TYPE_PREPENDED_SALT
;
10927 case 11100: hash_type
= HASH_TYPE_MD5
;
10928 salt_type
= SALT_TYPE_EMBEDDED
;
10929 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10931 | OPTS_TYPE_ST_ADD80
;
10932 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10933 dgst_size
= DGST_SIZE_4_4
;
10934 parse_func
= postgresql_auth_parse_hash
;
10935 sort_by_digest
= sort_by_digest_4_4
;
10936 opti_type
= OPTI_TYPE_ZERO_BYTE
10937 | OPTI_TYPE_PRECOMPUTE_INIT
10938 | OPTI_TYPE_PRECOMPUTE_MERKLE
10939 | OPTI_TYPE_EARLY_SKIP
;
10946 case 11200: hash_type
= HASH_TYPE_SHA1
;
10947 salt_type
= SALT_TYPE_EMBEDDED
;
10948 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10949 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10950 | OPTS_TYPE_PT_ADD80
10951 | OPTS_TYPE_ST_HEX
;
10952 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10953 dgst_size
= DGST_SIZE_4_5
;
10954 parse_func
= mysql_auth_parse_hash
;
10955 sort_by_digest
= sort_by_digest_4_5
;
10956 opti_type
= OPTI_TYPE_ZERO_BYTE
10957 | OPTI_TYPE_EARLY_SKIP
;
10964 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10965 salt_type
= SALT_TYPE_EMBEDDED
;
10966 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10967 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10969 | OPTS_TYPE_ST_ADD80
;
10970 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10971 dgst_size
= DGST_SIZE_4_4
;
10972 parse_func
= bitcoin_wallet_parse_hash
;
10973 sort_by_digest
= sort_by_digest_4_4
;
10974 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10981 case 11400: hash_type
= HASH_TYPE_MD5
;
10982 salt_type
= SALT_TYPE_EMBEDDED
;
10983 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10984 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10985 | OPTS_TYPE_PT_ADD80
10986 | OPTS_TYPE_HASH_COPY
;
10987 kern_type
= KERN_TYPE_SIP_AUTH
;
10988 dgst_size
= DGST_SIZE_4_4
;
10989 parse_func
= sip_auth_parse_hash
;
10990 sort_by_digest
= sort_by_digest_4_4
;
10991 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10998 case 11500: hash_type
= HASH_TYPE_CRC32
;
10999 salt_type
= SALT_TYPE_INTERN
;
11000 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11001 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11002 | OPTS_TYPE_ST_GENERATE_LE
11003 | OPTS_TYPE_ST_HEX
;
11004 kern_type
= KERN_TYPE_CRC32
;
11005 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11006 parse_func
= crc32_parse_hash
;
11007 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11008 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11015 case 11600: hash_type
= HASH_TYPE_AES
;
11016 salt_type
= SALT_TYPE_EMBEDDED
;
11017 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11018 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11019 | OPTS_TYPE_PT_NEVERCRACK
;
11020 kern_type
= KERN_TYPE_SEVEN_ZIP
;
11021 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11022 parse_func
= seven_zip_parse_hash
;
11023 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11024 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11031 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
11032 salt_type
= SALT_TYPE_NONE
;
11033 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11034 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11035 | OPTS_TYPE_PT_ADD01
;
11036 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
11037 dgst_size
= DGST_SIZE_4_8
;
11038 parse_func
= gost2012sbog_256_parse_hash
;
11039 sort_by_digest
= sort_by_digest_4_8
;
11040 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11047 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
11048 salt_type
= SALT_TYPE_NONE
;
11049 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11050 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11051 | OPTS_TYPE_PT_ADD01
;
11052 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
11053 dgst_size
= DGST_SIZE_4_16
;
11054 parse_func
= gost2012sbog_512_parse_hash
;
11055 sort_by_digest
= sort_by_digest_4_16
;
11056 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11063 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
11064 salt_type
= SALT_TYPE_EMBEDDED
;
11065 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11066 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11067 | OPTS_TYPE_ST_BASE64
11068 | OPTS_TYPE_HASH_COPY
;
11069 kern_type
= KERN_TYPE_PBKDF2_MD5
;
11070 dgst_size
= DGST_SIZE_4_32
;
11071 parse_func
= pbkdf2_md5_parse_hash
;
11072 sort_by_digest
= sort_by_digest_4_32
;
11073 opti_type
= OPTI_TYPE_ZERO_BYTE
11074 | OPTI_TYPE_SLOW_HASH_SIMD
;
11081 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11082 salt_type
= SALT_TYPE_EMBEDDED
;
11083 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11084 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11085 | OPTS_TYPE_ST_BASE64
11086 | OPTS_TYPE_HASH_COPY
;
11087 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
11088 dgst_size
= DGST_SIZE_4_32
;
11089 parse_func
= pbkdf2_sha1_parse_hash
;
11090 sort_by_digest
= sort_by_digest_4_32
;
11091 opti_type
= OPTI_TYPE_ZERO_BYTE
11092 | OPTI_TYPE_SLOW_HASH_SIMD
;
11099 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
11100 salt_type
= SALT_TYPE_EMBEDDED
;
11101 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11102 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11103 | OPTS_TYPE_ST_BASE64
11104 | OPTS_TYPE_HASH_COPY
;
11105 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
11106 dgst_size
= DGST_SIZE_8_16
;
11107 parse_func
= pbkdf2_sha512_parse_hash
;
11108 sort_by_digest
= sort_by_digest_8_16
;
11109 opti_type
= OPTI_TYPE_ZERO_BYTE
11110 | OPTI_TYPE_USES_BITS_64
11111 | OPTI_TYPE_SLOW_HASH_SIMD
;
11118 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
11119 salt_type
= SALT_TYPE_EMBEDDED
;
11120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11122 kern_type
= KERN_TYPE_ECRYPTFS
;
11123 dgst_size
= DGST_SIZE_8_8
;
11124 parse_func
= ecryptfs_parse_hash
;
11125 sort_by_digest
= sort_by_digest_8_8
;
11126 opti_type
= OPTI_TYPE_ZERO_BYTE
11127 | OPTI_TYPE_USES_BITS_64
;
11134 case 12300: hash_type
= HASH_TYPE_ORACLET
;
11135 salt_type
= SALT_TYPE_EMBEDDED
;
11136 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11137 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11138 kern_type
= KERN_TYPE_ORACLET
;
11139 dgst_size
= DGST_SIZE_8_16
;
11140 parse_func
= oraclet_parse_hash
;
11141 sort_by_digest
= sort_by_digest_8_16
;
11142 opti_type
= OPTI_TYPE_ZERO_BYTE
11143 | OPTI_TYPE_USES_BITS_64
;
11150 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
11151 salt_type
= SALT_TYPE_EMBEDDED
;
11152 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11153 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11154 kern_type
= KERN_TYPE_BSDICRYPT
;
11155 dgst_size
= DGST_SIZE_4_4
;
11156 parse_func
= bsdicrypt_parse_hash
;
11157 sort_by_digest
= sort_by_digest_4_4
;
11158 opti_type
= OPTI_TYPE_ZERO_BYTE
11159 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
11166 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
11167 salt_type
= SALT_TYPE_EMBEDDED
;
11168 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11169 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11170 kern_type
= KERN_TYPE_RAR3
;
11171 dgst_size
= DGST_SIZE_4_4
;
11172 parse_func
= rar3hp_parse_hash
;
11173 sort_by_digest
= sort_by_digest_4_4
;
11174 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11181 case 12600: hash_type
= HASH_TYPE_SHA256
;
11182 salt_type
= SALT_TYPE_INTERN
;
11183 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11184 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11185 | OPTS_TYPE_PT_ADD80
;
11186 kern_type
= KERN_TYPE_CF10
;
11187 dgst_size
= DGST_SIZE_4_8
;
11188 parse_func
= cf10_parse_hash
;
11189 sort_by_digest
= sort_by_digest_4_8
;
11190 opti_type
= OPTI_TYPE_ZERO_BYTE
11191 | OPTI_TYPE_PRECOMPUTE_INIT
11192 | OPTI_TYPE_EARLY_SKIP
11193 | OPTI_TYPE_NOT_ITERATED
;
11200 case 12700: hash_type
= HASH_TYPE_AES
;
11201 salt_type
= SALT_TYPE_EMBEDDED
;
11202 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11204 | OPTS_TYPE_HASH_COPY
;
11205 kern_type
= KERN_TYPE_MYWALLET
;
11206 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
11207 parse_func
= mywallet_parse_hash
;
11208 sort_by_digest
= sort_by_digest_4_5
;
11209 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11216 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11217 salt_type
= SALT_TYPE_EMBEDDED
;
11218 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11219 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11220 kern_type
= KERN_TYPE_MS_DRSR
;
11221 dgst_size
= DGST_SIZE_4_8
;
11222 parse_func
= ms_drsr_parse_hash
;
11223 sort_by_digest
= sort_by_digest_4_8
;
11224 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11231 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11232 salt_type
= SALT_TYPE_EMBEDDED
;
11233 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11235 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
11236 dgst_size
= DGST_SIZE_4_8
;
11237 parse_func
= androidfde_samsung_parse_hash
;
11238 sort_by_digest
= sort_by_digest_4_8
;
11239 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11246 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11247 salt_type
= SALT_TYPE_EMBEDDED
;
11248 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11249 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11250 kern_type
= KERN_TYPE_RAR5
;
11251 dgst_size
= DGST_SIZE_4_4
;
11252 parse_func
= rar5_parse_hash
;
11253 sort_by_digest
= sort_by_digest_4_4
;
11254 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11261 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
11262 salt_type
= SALT_TYPE_EMBEDDED
;
11263 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11264 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11265 kern_type
= KERN_TYPE_KRB5TGS
;
11266 dgst_size
= DGST_SIZE_4_4
;
11267 parse_func
= krb5tgs_parse_hash
;
11268 sort_by_digest
= sort_by_digest_4_4
;
11269 opti_type
= OPTI_TYPE_ZERO_BYTE
11270 | OPTI_TYPE_NOT_ITERATED
;
11277 case 13200: hash_type
= HASH_TYPE_AES
;
11278 salt_type
= SALT_TYPE_EMBEDDED
;
11279 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11280 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11281 kern_type
= KERN_TYPE_AXCRYPT
;
11282 dgst_size
= DGST_SIZE_4_4
;
11283 parse_func
= axcrypt_parse_hash
;
11284 sort_by_digest
= sort_by_digest_4_4
;
11285 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11292 case 13300: hash_type
= HASH_TYPE_SHA1
;
11293 salt_type
= SALT_TYPE_NONE
;
11294 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11295 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11296 | OPTS_TYPE_PT_ADD80
11297 | OPTS_TYPE_PT_ADDBITS15
;
11298 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
11299 dgst_size
= DGST_SIZE_4_5
;
11300 parse_func
= sha1axcrypt_parse_hash
;
11301 sort_by_digest
= sort_by_digest_4_5
;
11302 opti_type
= OPTI_TYPE_ZERO_BYTE
11303 | OPTI_TYPE_PRECOMPUTE_INIT
11304 | OPTI_TYPE_EARLY_SKIP
11305 | OPTI_TYPE_NOT_ITERATED
11306 | OPTI_TYPE_NOT_SALTED
;
11313 case 13400: hash_type
= HASH_TYPE_AES
;
11314 salt_type
= SALT_TYPE_EMBEDDED
;
11315 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11316 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11317 kern_type
= KERN_TYPE_KEEPASS
;
11318 dgst_size
= DGST_SIZE_4_4
;
11319 parse_func
= keepass_parse_hash
;
11320 sort_by_digest
= sort_by_digest_4_4
;
11321 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11328 case 13500: hash_type
= HASH_TYPE_SHA1
;
11329 salt_type
= SALT_TYPE_EMBEDDED
;
11330 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11331 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11332 | OPTS_TYPE_PT_UNICODE
11333 | OPTS_TYPE_PT_ADD80
;
11334 kern_type
= KERN_TYPE_PSTOKEN
;
11335 dgst_size
= DGST_SIZE_4_5
;
11336 parse_func
= pstoken_parse_hash
;
11337 sort_by_digest
= sort_by_digest_4_5
;
11338 opti_type
= OPTI_TYPE_ZERO_BYTE
11339 | OPTI_TYPE_PRECOMPUTE_INIT
11340 | OPTI_TYPE_EARLY_SKIP
11341 | OPTI_TYPE_NOT_ITERATED
11342 | OPTI_TYPE_PREPENDED_SALT
11343 | OPTI_TYPE_RAW_HASH
;
11350 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11351 salt_type
= SALT_TYPE_EMBEDDED
;
11352 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11353 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11354 kern_type
= KERN_TYPE_ZIP2
;
11355 dgst_size
= DGST_SIZE_4_4
;
11356 parse_func
= zip2_parse_hash
;
11357 sort_by_digest
= sort_by_digest_4_4
;
11358 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11365 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
11366 salt_type
= SALT_TYPE_EMBEDDED
;
11367 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11368 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11369 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11370 dgst_size
= DGST_SIZE_4_5
;
11371 parse_func
= veracrypt_parse_hash_655331
;
11372 sort_by_digest
= sort_by_digest_4_5
;
11373 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11380 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
11381 salt_type
= SALT_TYPE_EMBEDDED
;
11382 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11383 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11384 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11385 dgst_size
= DGST_SIZE_4_5
;
11386 parse_func
= veracrypt_parse_hash_655331
;
11387 sort_by_digest
= sort_by_digest_4_5
;
11388 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11395 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
11396 salt_type
= SALT_TYPE_EMBEDDED
;
11397 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11398 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11399 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11400 dgst_size
= DGST_SIZE_4_5
;
11401 parse_func
= veracrypt_parse_hash_655331
;
11402 sort_by_digest
= sort_by_digest_4_5
;
11403 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11410 case 13721: hash_type
= HASH_TYPE_SHA512
;
11411 salt_type
= SALT_TYPE_EMBEDDED
;
11412 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11414 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
11415 dgst_size
= DGST_SIZE_8_8
;
11416 parse_func
= veracrypt_parse_hash_500000
;
11417 sort_by_digest
= sort_by_digest_8_8
;
11418 opti_type
= OPTI_TYPE_ZERO_BYTE
11419 | OPTI_TYPE_USES_BITS_64
;
11426 case 13722: hash_type
= HASH_TYPE_SHA512
;
11427 salt_type
= SALT_TYPE_EMBEDDED
;
11428 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11429 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11430 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11431 dgst_size
= DGST_SIZE_8_8
;
11432 parse_func
= veracrypt_parse_hash_500000
;
11433 sort_by_digest
= sort_by_digest_8_8
;
11434 opti_type
= OPTI_TYPE_ZERO_BYTE
11435 | OPTI_TYPE_USES_BITS_64
;
11442 case 13723: hash_type
= HASH_TYPE_SHA512
;
11443 salt_type
= SALT_TYPE_EMBEDDED
;
11444 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11445 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11446 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11447 dgst_size
= DGST_SIZE_8_8
;
11448 parse_func
= veracrypt_parse_hash_500000
;
11449 sort_by_digest
= sort_by_digest_8_8
;
11450 opti_type
= OPTI_TYPE_ZERO_BYTE
11451 | OPTI_TYPE_USES_BITS_64
;
11458 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
11459 salt_type
= SALT_TYPE_EMBEDDED
;
11460 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11462 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
11463 dgst_size
= DGST_SIZE_4_8
;
11464 parse_func
= veracrypt_parse_hash_500000
;
11465 sort_by_digest
= sort_by_digest_4_8
;
11466 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11473 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
11474 salt_type
= SALT_TYPE_EMBEDDED
;
11475 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11477 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
11478 dgst_size
= DGST_SIZE_4_8
;
11479 parse_func
= veracrypt_parse_hash_500000
;
11480 sort_by_digest
= sort_by_digest_4_8
;
11481 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11488 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
11489 salt_type
= SALT_TYPE_EMBEDDED
;
11490 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11492 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
11493 dgst_size
= DGST_SIZE_4_8
;
11494 parse_func
= veracrypt_parse_hash_500000
;
11495 sort_by_digest
= sort_by_digest_4_8
;
11496 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11503 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11504 salt_type
= SALT_TYPE_EMBEDDED
;
11505 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11506 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11507 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11508 dgst_size
= DGST_SIZE_4_5
;
11509 parse_func
= veracrypt_parse_hash_327661
;
11510 sort_by_digest
= sort_by_digest_4_5
;
11511 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11518 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11519 salt_type
= SALT_TYPE_EMBEDDED
;
11520 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11522 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11523 dgst_size
= DGST_SIZE_4_5
;
11524 parse_func
= veracrypt_parse_hash_327661
;
11525 sort_by_digest
= sort_by_digest_4_5
;
11526 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11533 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11534 salt_type
= SALT_TYPE_EMBEDDED
;
11535 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11537 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11538 dgst_size
= DGST_SIZE_4_5
;
11539 parse_func
= veracrypt_parse_hash_327661
;
11540 sort_by_digest
= sort_by_digest_4_5
;
11541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11548 case 13751: hash_type
= HASH_TYPE_SHA256
;
11549 salt_type
= SALT_TYPE_EMBEDDED
;
11550 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11551 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11552 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11553 dgst_size
= DGST_SIZE_4_8
;
11554 parse_func
= veracrypt_parse_hash_500000
;
11555 sort_by_digest
= sort_by_digest_4_8
;
11556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11563 case 13752: hash_type
= HASH_TYPE_SHA256
;
11564 salt_type
= SALT_TYPE_EMBEDDED
;
11565 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11567 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11568 dgst_size
= DGST_SIZE_4_8
;
11569 parse_func
= veracrypt_parse_hash_500000
;
11570 sort_by_digest
= sort_by_digest_4_8
;
11571 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11578 case 13753: hash_type
= HASH_TYPE_SHA256
;
11579 salt_type
= SALT_TYPE_EMBEDDED
;
11580 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11582 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11583 dgst_size
= DGST_SIZE_4_8
;
11584 parse_func
= veracrypt_parse_hash_500000
;
11585 sort_by_digest
= sort_by_digest_4_8
;
11586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11593 case 13761: hash_type
= HASH_TYPE_SHA256
;
11594 salt_type
= SALT_TYPE_EMBEDDED
;
11595 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11597 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11598 dgst_size
= DGST_SIZE_4_8
;
11599 parse_func
= veracrypt_parse_hash_200000
;
11600 sort_by_digest
= sort_by_digest_4_8
;
11601 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11608 case 13762: hash_type
= HASH_TYPE_SHA256
;
11609 salt_type
= SALT_TYPE_EMBEDDED
;
11610 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11611 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11612 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11613 dgst_size
= DGST_SIZE_4_8
;
11614 parse_func
= veracrypt_parse_hash_200000
;
11615 sort_by_digest
= sort_by_digest_4_8
;
11616 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11623 case 13763: hash_type
= HASH_TYPE_SHA256
;
11624 salt_type
= SALT_TYPE_EMBEDDED
;
11625 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11627 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11628 dgst_size
= DGST_SIZE_4_8
;
11629 parse_func
= veracrypt_parse_hash_200000
;
11630 sort_by_digest
= sort_by_digest_4_8
;
11631 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11638 case 13800: hash_type
= HASH_TYPE_SHA256
;
11639 salt_type
= SALT_TYPE_EMBEDDED
;
11640 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11641 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11642 | OPTS_TYPE_PT_UNICODE
;
11643 kern_type
= KERN_TYPE_WIN8PHONE
;
11644 dgst_size
= DGST_SIZE_4_8
;
11645 parse_func
= win8phone_parse_hash
;
11646 sort_by_digest
= sort_by_digest_4_8
;
11647 opti_type
= OPTI_TYPE_ZERO_BYTE
11648 | OPTI_TYPE_PRECOMPUTE_INIT
11649 | OPTI_TYPE_EARLY_SKIP
11650 | OPTI_TYPE_NOT_ITERATED
11651 | OPTI_TYPE_RAW_HASH
;
11658 default: usage_mini_print (PROGNAME
); return -1;
11665 data
.parse_func
= parse_func
;
11673 if (salt_type
== SALT_TYPE_INTERN
)
11675 opts_type
|= OPTS_TYPE_ST_HEX
;
11679 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11685 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11686 | (salt_type
== SALT_TYPE_EXTERN
)
11687 | (salt_type
== SALT_TYPE_EMBEDDED
)
11688 | (salt_type
== SALT_TYPE_VIRTUAL
));
11690 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11692 data
.hash_type
= hash_type
;
11693 data
.attack_mode
= attack_mode
;
11694 data
.attack_kern
= attack_kern
;
11695 data
.attack_exec
= attack_exec
;
11696 data
.kern_type
= kern_type
;
11697 data
.opts_type
= opts_type
;
11698 data
.dgst_size
= dgst_size
;
11699 data
.salt_type
= salt_type
;
11700 data
.isSalted
= isSalted
;
11701 data
.sort_by_digest
= sort_by_digest
;
11702 data
.dgst_pos0
= dgst_pos0
;
11703 data
.dgst_pos1
= dgst_pos1
;
11704 data
.dgst_pos2
= dgst_pos2
;
11705 data
.dgst_pos3
= dgst_pos3
;
11711 case 2500: esalt_size
= sizeof (wpa_t
); break;
11712 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11713 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11714 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11715 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11716 case 6211: esalt_size
= sizeof (tc_t
); break;
11717 case 6212: esalt_size
= sizeof (tc_t
); break;
11718 case 6213: esalt_size
= sizeof (tc_t
); break;
11719 case 6221: esalt_size
= sizeof (tc_t
); break;
11720 case 6222: esalt_size
= sizeof (tc_t
); break;
11721 case 6223: esalt_size
= sizeof (tc_t
); break;
11722 case 6231: esalt_size
= sizeof (tc_t
); break;
11723 case 6232: esalt_size
= sizeof (tc_t
); break;
11724 case 6233: esalt_size
= sizeof (tc_t
); break;
11725 case 6241: esalt_size
= sizeof (tc_t
); break;
11726 case 6242: esalt_size
= sizeof (tc_t
); break;
11727 case 6243: esalt_size
= sizeof (tc_t
); break;
11728 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11729 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11730 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11731 case 7300: esalt_size
= sizeof (rakp_t
); break;
11732 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11733 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11734 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11735 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11736 case 9400: esalt_size
= sizeof (office2007_t
); break;
11737 case 9500: esalt_size
= sizeof (office2010_t
); break;
11738 case 9600: esalt_size
= sizeof (office2013_t
); break;
11739 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11740 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11741 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11742 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11743 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11744 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11745 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11746 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11747 case 10400: esalt_size
= sizeof (pdf_t
); break;
11748 case 10410: esalt_size
= sizeof (pdf_t
); break;
11749 case 10420: esalt_size
= sizeof (pdf_t
); break;
11750 case 10500: esalt_size
= sizeof (pdf_t
); break;
11751 case 10600: esalt_size
= sizeof (pdf_t
); break;
11752 case 10700: esalt_size
= sizeof (pdf_t
); break;
11753 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11754 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11755 case 11400: esalt_size
= sizeof (sip_t
); break;
11756 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11757 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11758 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11759 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11760 case 13000: esalt_size
= sizeof (rar5_t
); break;
11761 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11762 case 13400: esalt_size
= sizeof (keepass_t
); break;
11763 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11764 case 13600: esalt_size
= sizeof (zip2_t
); break;
11765 case 13711: esalt_size
= sizeof (tc_t
); break;
11766 case 13712: esalt_size
= sizeof (tc_t
); break;
11767 case 13713: esalt_size
= sizeof (tc_t
); break;
11768 case 13721: esalt_size
= sizeof (tc_t
); break;
11769 case 13722: esalt_size
= sizeof (tc_t
); break;
11770 case 13723: esalt_size
= sizeof (tc_t
); break;
11771 case 13731: esalt_size
= sizeof (tc_t
); break;
11772 case 13732: esalt_size
= sizeof (tc_t
); break;
11773 case 13733: esalt_size
= sizeof (tc_t
); break;
11774 case 13741: esalt_size
= sizeof (tc_t
); break;
11775 case 13742: esalt_size
= sizeof (tc_t
); break;
11776 case 13743: esalt_size
= sizeof (tc_t
); break;
11777 case 13751: esalt_size
= sizeof (tc_t
); break;
11778 case 13752: esalt_size
= sizeof (tc_t
); break;
11779 case 13753: esalt_size
= sizeof (tc_t
); break;
11780 case 13761: esalt_size
= sizeof (tc_t
); break;
11781 case 13762: esalt_size
= sizeof (tc_t
); break;
11782 case 13763: esalt_size
= sizeof (tc_t
); break;
11783 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11786 data
.esalt_size
= esalt_size
;
11789 * choose dictionary parser
11792 if (hash_type
== HASH_TYPE_LM
)
11794 get_next_word_func
= get_next_word_lm
;
11796 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11798 get_next_word_func
= get_next_word_uc
;
11802 get_next_word_func
= get_next_word_std
;
11809 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11812 size_t dictstat_nmemb
= 0;
11816 uint dictstat_nmemb
= 0;
11819 char dictstat
[256] = { 0 };
11821 FILE *dictstat_fp
= NULL
;
11825 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11827 dictstat_fp
= fopen (dictstat
, "rb");
11832 struct stat tmpstat
;
11834 fstat (fileno (dictstat_fp
), &tmpstat
);
11838 struct stat64 tmpstat
;
11840 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11843 if (tmpstat
.st_mtime
< COMPTIME
)
11845 /* with v0.15 the format changed so we have to ensure user is using a good version
11846 since there is no version-header in the dictstat file */
11848 fclose (dictstat_fp
);
11854 while (!feof (dictstat_fp
))
11858 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11860 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11862 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11864 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11870 fclose (dictstat_fp
);
11879 char potfile
[256] = { 0 };
11881 if (potfile_path
== NULL
)
11883 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11887 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11890 data
.pot_fp
= NULL
;
11892 FILE *out_fp
= NULL
;
11893 FILE *pot_fp
= NULL
;
11895 if (show
== 1 || left
== 1)
11897 pot_fp
= fopen (potfile
, "rb");
11899 if (pot_fp
== NULL
)
11901 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11906 if (outfile
!= NULL
)
11908 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11910 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11924 if (potfile_disable
== 0)
11926 pot_fp
= fopen (potfile
, "ab");
11928 if (pot_fp
== NULL
)
11930 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11935 data
.pot_fp
= pot_fp
;
11942 uint pot_avail
= 0;
11944 if (show
== 1 || left
== 1)
11946 SUPPRESS_OUTPUT
= 1;
11948 pot_avail
= count_lines (pot_fp
);
11952 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11954 uint pot_hashes_avail
= 0;
11958 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11960 while (!feof (pot_fp
))
11964 int line_len
= fgetl (pot_fp
, line_buf
);
11966 if (line_len
== 0) continue;
11968 char *plain_buf
= line_buf
+ line_len
;
11970 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11972 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11974 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11975 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11977 if (pot_cnt
== pot_hashes_avail
)
11981 for (pos
= 0; pos
< INCR_POT
; pos
++)
11983 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11985 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11987 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11989 tmp_hash
->digest
= mymalloc (dgst_size
);
11993 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11998 tmp_hash
->esalt
= mymalloc (esalt_size
);
12001 pot_hashes_avail
++;
12009 int iter
= MAX_CUT_TRIES
;
12013 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
12015 if (line_buf
[i
] == ':')
12023 if (data
.hash_mode
!= 2500)
12025 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
12029 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
12031 if (line_len
> max_salt_size
)
12033 parser_status
= PARSER_GLOBAL_LENGTH
;
12037 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
12039 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
12041 hashes_buf
->salt
->salt_len
= line_len
;
12043 parser_status
= PARSER_OK
;
12047 // if NOT parsed without error, we add the ":" to the plain
12049 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
12055 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
12057 if (parser_status
< PARSER_GLOBAL_ZERO
)
12059 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
12064 if (plain_len
>= 255) continue;
12066 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
12068 pot_ptr
->plain_len
= plain_len
;
12077 SUPPRESS_OUTPUT
= 0;
12079 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
12086 uint pw_min
= PW_MIN
;
12087 uint pw_max
= PW_MAX
;
12091 case 125: if (pw_max
> 32) pw_max
= 32;
12093 case 400: if (pw_max
> 40) pw_max
= 40;
12095 case 500: if (pw_max
> 16) pw_max
= 16;
12097 case 1500: if (pw_max
> 8) pw_max
= 8;
12099 case 1600: if (pw_max
> 16) pw_max
= 16;
12101 case 1800: if (pw_max
> 16) pw_max
= 16;
12103 case 2100: if (pw_max
> 16) pw_max
= 16;
12105 case 2500: if (pw_min
< 8) pw_min
= 8;
12107 case 3000: if (pw_max
> 7) pw_max
= 7;
12109 case 5200: if (pw_max
> 24) pw_max
= 24;
12111 case 5800: if (pw_max
> 16) pw_max
= 16;
12113 case 6300: if (pw_max
> 16) pw_max
= 16;
12115 case 7400: if (pw_max
> 16) pw_max
= 16;
12117 case 7700: if (pw_max
> 8) pw_max
= 8;
12119 case 7900: if (pw_max
> 48) pw_max
= 48;
12121 case 8500: if (pw_max
> 8) pw_max
= 8;
12123 case 8600: if (pw_max
> 16) pw_max
= 16;
12125 case 9710: pw_min
= 5;
12128 case 9810: pw_min
= 5;
12131 case 10410: pw_min
= 5;
12134 case 10300: if (pw_max
< 3) pw_min
= 3;
12135 if (pw_max
> 40) pw_max
= 40;
12137 case 10500: if (pw_max
< 3) pw_min
= 3;
12138 if (pw_max
> 40) pw_max
= 40;
12140 case 10700: if (pw_max
> 16) pw_max
= 16;
12142 case 11300: if (pw_max
> 40) pw_max
= 40;
12144 case 11600: if (pw_max
> 32) pw_max
= 32;
12146 case 12500: if (pw_max
> 20) pw_max
= 20;
12148 case 12800: if (pw_max
> 24) pw_max
= 24;
12152 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12154 switch (attack_kern
)
12156 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12158 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12164 * charsets : keep them together for more easy maintainnce
12167 cs_t mp_sys
[6] = { { { 0 }, 0 } };
12168 cs_t mp_usr
[4] = { { { 0 }, 0 } };
12170 mp_setup_sys (mp_sys
);
12172 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
12173 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
12174 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
12175 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
12178 * load hashes, part I: find input mode, count hashes
12181 uint hashlist_mode
= 0;
12182 uint hashlist_format
= HLFMT_HASHCAT
;
12184 uint hashes_avail
= 0;
12186 if ((benchmark
== 0) && (stdout_flag
== 0))
12190 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
12192 if ((hash_mode
== 2500) ||
12193 (hash_mode
== 5200) ||
12194 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
12195 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
12196 (hash_mode
== 9000))
12198 hashlist_mode
= HL_MODE_ARG
;
12200 char *hashfile
= myargv
[optind
];
12202 data
.hashfile
= hashfile
;
12204 logfile_top_var_string ("target", hashfile
);
12207 if (hashlist_mode
== HL_MODE_ARG
)
12209 if (hash_mode
== 2500)
12213 if (stat (data
.hashfile
, &st
) == -1)
12215 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
12220 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
12227 else if (hashlist_mode
== HL_MODE_FILE
)
12229 char *hashfile
= myargv
[optind
];
12231 data
.hashfile
= hashfile
;
12233 logfile_top_var_string ("target", hashfile
);
12237 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12239 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12244 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
12246 hashes_avail
= count_lines (fp
);
12250 if (hashes_avail
== 0)
12252 log_error ("ERROR: hashfile is empty or corrupt");
12259 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
12261 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
12263 log_error ("ERROR: remove not supported in native hashfile-format mode");
12275 hashlist_mode
= HL_MODE_ARG
;
12280 if (hash_mode
== 3000) hashes_avail
*= 2;
12282 data
.hashlist_mode
= hashlist_mode
;
12283 data
.hashlist_format
= hashlist_format
;
12285 logfile_top_uint (hashlist_mode
);
12286 logfile_top_uint (hashlist_format
);
12289 * load hashes, part II: allocate required memory, set pointers
12292 hash_t
*hashes_buf
= NULL
;
12293 void *digests_buf
= NULL
;
12294 salt_t
*salts_buf
= NULL
;
12295 void *esalts_buf
= NULL
;
12297 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
12299 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
12301 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12305 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12307 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
12309 hashes_buf
[hash_pos
].hash_info
= hash_info
;
12311 if (username
&& (remove
|| show
|| left
))
12313 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
12318 hash_info
->orighash
= (char *) mymalloc (256);
12325 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12329 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
12334 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12337 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12339 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
12343 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
12347 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
12352 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
12357 * load hashes, part III: parse hashes or generate them if benchmark
12360 uint hashes_cnt
= 0;
12362 if (benchmark
== 0)
12366 // useless to read hash file for keyspace, cheat a little bit w/ optind
12368 else if (stdout_flag
== 1)
12370 // useless to read hash file for stdout, cheat a little bit w/ optind
12372 else if (hashes_avail
== 0)
12375 else if (hashlist_mode
== HL_MODE_ARG
)
12377 char *input_buf
= myargv
[optind
];
12379 uint input_len
= strlen (input_buf
);
12381 logfile_top_var_string ("target", input_buf
);
12383 char *hash_buf
= NULL
;
12386 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
12388 bool hash_fmt_error
= 0;
12390 if (hash_len
< 1) hash_fmt_error
= 1;
12391 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12393 if (hash_fmt_error
)
12395 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12399 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12401 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12403 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12408 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
12411 int parser_status
= PARSER_OK
;
12413 if (hash_mode
== 2500)
12417 log_error ("ERROR: hccap file not specified");
12422 hashlist_mode
= HL_MODE_FILE
;
12424 data
.hashlist_mode
= hashlist_mode
;
12426 FILE *fp
= fopen (hash_buf
, "rb");
12430 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12435 if (hashes_avail
< 1)
12437 log_error ("ERROR: hccap file is empty or corrupt");
12444 uint hccap_size
= sizeof (hccap_t
);
12446 char *in
= (char *) mymalloc (hccap_size
);
12450 int n
= fread (in
, hccap_size
, 1, fp
);
12454 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12459 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12461 if (parser_status
!= PARSER_OK
)
12463 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12468 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12470 if ((show
== 1) || (left
== 1))
12472 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12474 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12476 int cur_pos
= tmp_salt
->salt_len
;
12477 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12479 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12481 // do the appending task
12483 snprintf (salt_ptr
+ cur_pos
,
12485 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12497 wpa
->orig_mac2
[5]);
12499 // memset () the remaining part of the salt
12501 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12502 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12504 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12506 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12509 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
);
12510 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
);
12519 else if (hash_mode
== 3000)
12521 if (hash_len
== 32)
12523 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12525 hash_t
*lm_hash_left
= NULL
;
12527 if (parser_status
== PARSER_OK
)
12529 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12535 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12538 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12540 hash_t
*lm_hash_right
= NULL
;
12542 if (parser_status
== PARSER_OK
)
12544 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12550 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12555 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12557 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
);
12558 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
);
12563 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12565 if (parser_status
== PARSER_OK
)
12567 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12568 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12571 if (parser_status
== PARSER_OK
)
12577 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12583 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12585 if (parser_status
== PARSER_OK
)
12587 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12588 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12591 if (parser_status
== PARSER_OK
)
12597 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12602 else if (hashlist_mode
== HL_MODE_FILE
)
12604 char *hashfile
= data
.hashfile
;
12608 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12610 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12617 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12623 int line_len
= fgetl (fp
, line_buf
);
12625 if (line_len
== 0) continue;
12627 char *hash_buf
= NULL
;
12630 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12632 bool hash_fmt_error
= 0;
12634 if (hash_len
< 1) hash_fmt_error
= 1;
12635 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12637 if (hash_fmt_error
)
12639 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12646 char *user_buf
= NULL
;
12649 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12651 if (remove
|| show
)
12653 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12655 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12657 user_t
*user_ptr
= *user
;
12659 if (user_buf
!= NULL
)
12661 user_ptr
->user_name
= mystrdup (user_buf
);
12665 user_ptr
->user_name
= mystrdup ("");
12668 user_ptr
->user_len
= user_len
;
12672 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12674 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12676 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12681 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12684 if (hash_mode
== 3000)
12686 if (hash_len
== 32)
12688 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12690 if (parser_status
< PARSER_GLOBAL_ZERO
)
12692 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12697 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12701 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12703 if (parser_status
< PARSER_GLOBAL_ZERO
)
12705 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12710 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12712 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);
12718 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
);
12719 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
);
12723 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12725 if (parser_status
< PARSER_GLOBAL_ZERO
)
12727 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12732 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);
12734 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12735 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12742 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12744 if (parser_status
< PARSER_GLOBAL_ZERO
)
12746 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12751 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);
12753 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12754 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12764 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12766 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12773 hashes_buf
[0].salt
->salt_len
= 8;
12775 // special salt handling
12779 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12780 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12782 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12784 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12786 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12788 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12790 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12792 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12794 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12796 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12798 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12800 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12801 hashes_buf
[0].salt
->scrypt_N
= 1024;
12802 hashes_buf
[0].salt
->scrypt_r
= 1;
12803 hashes_buf
[0].salt
->scrypt_p
= 1;
12805 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12807 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12808 hashes_buf
[0].salt
->scrypt_N
= 16384;
12809 hashes_buf
[0].salt
->scrypt_r
= 1;
12810 hashes_buf
[0].salt
->scrypt_p
= 1;
12812 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12814 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12816 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12818 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12820 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12822 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12824 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12826 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12828 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12830 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12832 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12834 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12836 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12838 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12840 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12844 // special esalt handling
12848 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12850 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12851 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12853 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12854 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12856 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12857 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12858 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12859 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12861 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12862 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12863 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12864 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12866 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12868 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12869 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12870 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12872 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12873 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12874 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12876 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12877 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12878 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12880 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12881 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12882 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12884 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12885 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12886 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12888 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12889 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12890 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12892 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12893 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12894 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12896 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12898 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12900 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12901 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12902 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12911 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12913 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12915 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12917 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12919 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12921 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12923 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12925 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12927 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12929 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12931 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12933 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12935 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12937 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12939 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12941 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12943 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12945 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12947 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12949 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12951 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12953 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12955 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12957 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12959 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12961 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12963 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12965 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12967 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12969 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12971 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12973 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12975 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12977 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12979 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12981 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12985 // set default iterations
12989 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12991 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12993 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12995 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12997 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12999 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
13001 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
13003 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
13005 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
13007 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
13009 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13011 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13013 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13015 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13017 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13019 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13021 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13023 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13025 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13027 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13029 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13031 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13033 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13035 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
13037 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
13039 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
13041 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
13043 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
13045 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
13047 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
13049 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
13051 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
13053 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
13055 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
13057 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
13059 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
13061 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
13063 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
13065 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
13067 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
13069 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
13071 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
13073 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
13075 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
13077 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
13079 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
13081 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
13083 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
13085 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
13087 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
13089 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
13091 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
13093 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
13095 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
13097 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
13099 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
13101 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
13103 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
13105 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
13107 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
13109 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
13111 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
13113 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
13115 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
13117 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13119 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13121 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13123 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13125 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13127 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13129 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13131 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13133 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13135 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13137 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13139 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13141 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13143 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13145 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13147 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13149 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13151 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13158 if (show
== 1 || left
== 1)
13160 for (uint i
= 0; i
< pot_cnt
; i
++)
13162 pot_t
*pot_ptr
= &pot
[i
];
13164 hash_t
*hashes_buf
= &pot_ptr
->hash
;
13166 local_free (hashes_buf
->digest
);
13170 local_free (hashes_buf
->salt
);
13176 if (data
.quiet
== 0) log_info_nn ("");
13181 if ((keyspace
== 0) && (stdout_flag
== 0))
13183 if (hashes_cnt
== 0)
13185 log_error ("ERROR: No hashes loaded");
13192 * Sanity check for hashfile vs outfile (should not point to the same physical file)
13195 if (data
.outfile
!= NULL
)
13197 if (data
.hashfile
!= NULL
)
13200 struct stat tmpstat_outfile
;
13201 struct stat tmpstat_hashfile
;
13205 struct stat64 tmpstat_outfile
;
13206 struct stat64 tmpstat_hashfile
;
13209 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
13211 if (tmp_outfile_fp
)
13214 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13218 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13221 fclose (tmp_outfile_fp
);
13224 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
13226 if (tmp_hashfile_fp
)
13229 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13233 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13236 fclose (tmp_hashfile_fp
);
13239 if (tmp_outfile_fp
&& tmp_outfile_fp
)
13241 tmpstat_outfile
.st_mode
= 0;
13242 tmpstat_outfile
.st_nlink
= 0;
13243 tmpstat_outfile
.st_uid
= 0;
13244 tmpstat_outfile
.st_gid
= 0;
13245 tmpstat_outfile
.st_rdev
= 0;
13246 tmpstat_outfile
.st_atime
= 0;
13248 tmpstat_hashfile
.st_mode
= 0;
13249 tmpstat_hashfile
.st_nlink
= 0;
13250 tmpstat_hashfile
.st_uid
= 0;
13251 tmpstat_hashfile
.st_gid
= 0;
13252 tmpstat_hashfile
.st_rdev
= 0;
13253 tmpstat_hashfile
.st_atime
= 0;
13256 tmpstat_outfile
.st_blksize
= 0;
13257 tmpstat_outfile
.st_blocks
= 0;
13259 tmpstat_hashfile
.st_blksize
= 0;
13260 tmpstat_hashfile
.st_blocks
= 0;
13264 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
13266 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13273 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
13275 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13285 * Remove duplicates
13288 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
13292 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13296 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13299 uint hashes_cnt_orig
= hashes_cnt
;
13303 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
13307 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
13309 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13314 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13317 if (hashes_pos
> hashes_cnt
)
13319 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
13329 uint potfile_remove_cracks
= 0;
13331 if (potfile_disable
== 0)
13335 hash_buf
.digest
= mymalloc (dgst_size
);
13336 hash_buf
.salt
= NULL
;
13337 hash_buf
.esalt
= NULL
;
13338 hash_buf
.hash_info
= NULL
;
13339 hash_buf
.cracked
= 0;
13343 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
13348 hash_buf
.esalt
= mymalloc (esalt_size
);
13351 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
13353 // no solution for these special hash types (for instane because they use hashfile in output etc)
13354 if ((hash_mode
!= 5200) &&
13355 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
13356 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
13357 (hash_mode
!= 9000))
13359 FILE *fp
= fopen (potfile
, "rb");
13363 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
13365 // to be safe work with a copy (because of line_len loop, i etc)
13366 // moved up here because it's easier to handle continue case
13369 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
13373 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
13375 if (ptr
== NULL
) break;
13377 int line_len
= strlen (line_buf
);
13379 if (line_len
== 0) continue;
13381 int iter
= MAX_CUT_TRIES
;
13383 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
13385 if (line_buf
[i
] != ':') continue;
13389 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
13392 hash_t
*found
= NULL
;
13394 if (hash_mode
== 6800)
13396 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13398 // manipulate salt_buf
13399 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
13401 hash_buf
.salt
->salt_len
= i
;
13403 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
13406 else if (hash_mode
== 2500)
13408 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13410 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
13411 // manipulate salt_buf
13413 memset (line_buf_cpy
, 0, HCBUFSIZ
);
13414 memcpy (line_buf_cpy
, line_buf
, i
);
13416 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
13418 if (mac2_pos
== NULL
) continue;
13423 if (strlen (mac2_pos
) != 12) continue;
13425 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
13427 if (mac1_pos
== NULL
) continue;
13432 if (strlen (mac1_pos
) != 12) continue;
13434 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13436 // here we need the ESSID
13437 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13439 hash_buf
.salt
->salt_len
= essid_length
;
13441 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13445 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13447 // compare hex string(s) vs binary MAC address(es)
13449 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13451 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13460 if (!found
) continue;
13462 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13464 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13476 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13478 if (parser_status
== PARSER_OK
)
13482 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13486 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13491 if (found
== NULL
) continue;
13493 if (!found
->cracked
) potfile_remove_cracks
++;
13495 found
->cracked
= 1;
13503 myfree (line_buf_cpy
);
13513 local_free (hash_buf
.esalt
);
13518 local_free (hash_buf
.salt
);
13521 local_free (hash_buf
.digest
);
13525 * Now generate all the buffers required for later
13528 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13530 salt_t
*salts_buf_new
= NULL
;
13531 void *esalts_buf_new
= NULL
;
13535 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13539 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13544 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13547 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13549 uint digests_cnt
= hashes_cnt
;
13550 uint digests_done
= 0;
13552 size_t size_digests
= digests_cnt
* dgst_size
;
13553 size_t size_shown
= digests_cnt
* sizeof (uint
);
13555 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13556 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13558 uint salts_cnt
= 0;
13559 uint salts_done
= 0;
13561 hashinfo_t
**hash_info
= NULL
;
13563 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13565 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13567 if (username
&& (remove
|| show
))
13571 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13573 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13575 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13580 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13585 // copied from inner loop
13587 salt_buf
= &salts_buf_new
[salts_cnt
];
13589 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13593 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13596 salt_buf
->digests_cnt
= 0;
13597 salt_buf
->digests_done
= 0;
13598 salt_buf
->digests_offset
= 0;
13603 if (hashes_buf
[0].cracked
== 1)
13605 digests_shown
[0] = 1;
13609 salt_buf
->digests_done
++;
13612 salt_buf
->digests_cnt
++;
13614 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13616 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13618 hash_info
[0] = hashes_buf
[0].hash_info
;
13621 // copy from inner loop
13623 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13627 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13629 salt_buf
= &salts_buf_new
[salts_cnt
];
13631 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13635 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13638 salt_buf
->digests_cnt
= 0;
13639 salt_buf
->digests_done
= 0;
13640 salt_buf
->digests_offset
= hashes_pos
;
13646 if (hashes_buf
[hashes_pos
].cracked
== 1)
13648 digests_shown
[hashes_pos
] = 1;
13652 salt_buf
->digests_done
++;
13655 salt_buf
->digests_cnt
++;
13657 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13659 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13661 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13665 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13667 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13669 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13671 salts_shown
[salt_pos
] = 1;
13676 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13679 local_free (digests_buf
);
13680 local_free (salts_buf
);
13681 local_free (esalts_buf
);
13683 digests_buf
= digests_buf_new
;
13684 salts_buf
= salts_buf_new
;
13685 esalts_buf
= esalts_buf_new
;
13687 local_free (hashes_buf
);
13690 * special modification not set from parser
13695 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13696 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13697 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13698 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13699 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13700 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13701 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13702 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13703 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13704 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13705 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13706 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13707 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13708 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13709 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13710 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13711 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13712 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13713 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13714 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13715 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13716 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13717 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13718 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13719 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13720 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13721 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13722 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13723 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13724 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13727 if (truecrypt_keyfiles
)
13729 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13731 char *keyfiles
= strdup (truecrypt_keyfiles
);
13733 char *keyfile
= strtok (keyfiles
, ",");
13737 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13739 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13744 if (veracrypt_keyfiles
)
13746 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13748 char *keyfiles
= strdup (veracrypt_keyfiles
);
13750 char *keyfile
= strtok (keyfiles
, ",");
13754 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13756 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13761 data
.digests_cnt
= digests_cnt
;
13762 data
.digests_done
= digests_done
;
13763 data
.digests_buf
= digests_buf
;
13764 data
.digests_shown
= digests_shown
;
13765 data
.digests_shown_tmp
= digests_shown_tmp
;
13767 data
.salts_cnt
= salts_cnt
;
13768 data
.salts_done
= salts_done
;
13769 data
.salts_buf
= salts_buf
;
13770 data
.salts_shown
= salts_shown
;
13772 data
.esalts_buf
= esalts_buf
;
13773 data
.hash_info
= hash_info
;
13776 * Automatic Optimizers
13779 if (salts_cnt
== 1)
13780 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13782 if (digests_cnt
== 1)
13783 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13785 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13786 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13788 if (attack_mode
== ATTACK_MODE_BF
)
13789 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13791 data
.opti_type
= opti_type
;
13793 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13795 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13797 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13799 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13801 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13802 opts_type
|= OPTS_TYPE_PT_ADD80
;
13805 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13807 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13808 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13811 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13813 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13814 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13821 * Some algorithm, like descrypt, can benefit from JIT compilation
13824 int force_jit_compilation
= -1;
13826 if (hash_mode
== 8900)
13828 force_jit_compilation
= 8900;
13830 else if (hash_mode
== 9300)
13832 force_jit_compilation
= 8900;
13834 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13836 force_jit_compilation
= 1500;
13840 * generate bitmap tables
13843 const uint bitmap_shift1
= 5;
13844 const uint bitmap_shift2
= 13;
13846 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13848 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13849 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13850 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13851 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13852 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13853 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13854 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13855 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13862 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13864 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13866 bitmap_nums
= 1u << bitmap_bits
;
13868 bitmap_mask
= bitmap_nums
- 1;
13870 bitmap_size
= bitmap_nums
* sizeof (uint
);
13872 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13874 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;
13875 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;
13880 bitmap_nums
= 1u << bitmap_bits
;
13882 bitmap_mask
= bitmap_nums
- 1;
13884 bitmap_size
= bitmap_nums
* sizeof (uint
);
13886 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);
13887 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);
13890 * prepare quick rule
13893 data
.rule_buf_l
= rule_buf_l
;
13894 data
.rule_buf_r
= rule_buf_r
;
13896 int rule_len_l
= (int) strlen (rule_buf_l
);
13897 int rule_len_r
= (int) strlen (rule_buf_r
);
13899 data
.rule_len_l
= rule_len_l
;
13900 data
.rule_len_r
= rule_len_r
;
13906 uint
*all_kernel_rules_cnt
= NULL
;
13908 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13912 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13914 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13917 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13921 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13923 uint kernel_rules_avail
= 0;
13925 uint kernel_rules_cnt
= 0;
13927 kernel_rule_t
*kernel_rules_buf
= NULL
;
13929 char *rp_file
= rp_files
[i
];
13931 char in
[BLOCK_SIZE
] = { 0 };
13932 char out
[BLOCK_SIZE
] = { 0 };
13936 uint rule_line
= 0;
13938 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13940 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13947 memset (rule_buf
, 0, HCBUFSIZ
);
13949 rule_len
= fgetl (fp
, rule_buf
);
13953 if (rule_len
== 0) continue;
13955 if (rule_buf
[0] == '#') continue;
13957 if (kernel_rules_avail
== kernel_rules_cnt
)
13959 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13961 kernel_rules_avail
+= INCR_RULES
;
13964 memset (in
, 0, BLOCK_SIZE
);
13965 memset (out
, 0, BLOCK_SIZE
);
13967 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13971 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13976 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13978 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13980 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13986 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13988 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13994 kernel_rules_cnt
++;
13999 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
14001 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
14005 * merge rules or automatic rule generator
14008 uint kernel_rules_cnt
= 0;
14010 kernel_rule_t
*kernel_rules_buf
= NULL
;
14012 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14016 kernel_rules_cnt
= 1;
14018 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
14020 repeats
[0] = kernel_rules_cnt
;
14022 for (uint i
= 0; i
< rp_files_cnt
; i
++)
14024 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
14026 repeats
[i
+ 1] = kernel_rules_cnt
;
14029 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
14031 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
14033 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
14037 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
14039 for (uint j
= 0; j
< rp_files_cnt
; j
++)
14041 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
14044 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
14046 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
14048 if (out_pos
== RULES_MAX
- 1)
14050 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
14055 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
14060 local_free (repeats
);
14064 uint kernel_rules_avail
= 0;
14066 while (kernel_rules_cnt
< rp_gen
)
14068 if (kernel_rules_avail
== kernel_rules_cnt
)
14070 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14072 kernel_rules_avail
+= INCR_RULES
;
14075 memset (rule_buf
, 0, HCBUFSIZ
);
14077 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
14079 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
14081 kernel_rules_cnt
++;
14089 * generate NOP rules
14092 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
14094 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
14096 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
14098 kernel_rules_cnt
++;
14101 data
.kernel_rules_cnt
= kernel_rules_cnt
;
14102 data
.kernel_rules_buf
= kernel_rules_buf
;
14104 if (kernel_rules_cnt
== 0)
14106 log_error ("ERROR: No valid rules left");
14112 * OpenCL platforms: detect
14115 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
14116 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
14118 cl_uint platforms_cnt
= 0;
14119 cl_uint platform_devices_cnt
= 0;
14123 cl_int CL_err
= hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
14125 if (CL_err
!= CL_SUCCESS
)
14127 log_error ("ERROR: clGetPlatformIDs(): %s\n", val2cstr_cl (CL_err
));
14132 if (platforms_cnt
== 0)
14135 log_info ("ATTENTION! No OpenCL compatible platform found");
14137 log_info ("You're probably missing the OpenCL runtime installation");
14138 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
14139 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
14140 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
14146 if (opencl_platforms_filter
!= (uint
) -1)
14148 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
14150 if (opencl_platforms_filter
> platform_cnt_mask
)
14152 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
14159 if (opencl_device_types
== NULL
)
14162 * OpenCL device types:
14163 * 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.
14166 cl_device_type device_types_all
= 0;
14168 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14170 if ((opencl_platforms_filter
& (1u << platform_id
)) == 0) continue;
14172 cl_platform_id platform
= platforms
[platform_id
];
14174 cl_int CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14176 if (CL_err
!= CL_SUCCESS
)
14178 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14182 // Silently ignore at this point, it will be reused later and create a note for the user at that point
14187 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14189 cl_device_id device
= platform_devices
[platform_devices_id
];
14191 cl_device_type device_type
;
14193 cl_int CL_err
= hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14195 if (CL_err
!= CL_SUCCESS
)
14197 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14202 device_types_all
|= device_type
;
14206 // In such a case, automatically enable CPU device type support, since it's disabled by default.
14208 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
14210 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
14213 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
14214 // If we have a CPU device, force it to be used
14216 if (stdout_flag
== 1)
14218 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
14220 device_types_filter
= CL_DEVICE_TYPE_CPU
;
14226 * OpenCL devices: simply push all devices from all platforms into the same device array
14230 int need_nvapi
= 0;
14232 int need_xnvctrl
= 0;
14234 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
14236 data
.devices_param
= devices_param
;
14238 uint devices_cnt
= 0;
14240 uint devices_active
= 0;
14242 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14244 cl_int CL_err
= CL_SUCCESS
;
14246 cl_platform_id platform
= platforms
[platform_id
];
14248 char platform_vendor
[INFOSZ
] = { 0 };
14250 CL_err
= hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
14252 if (CL_err
!= CL_SUCCESS
)
14254 log_error ("ERROR: clGetPlatformInfo(): %s\n", val2cstr_cl (CL_err
));
14259 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
14260 // this causes trouble with vendor id based macros
14261 // we'll assign generic to those without special optimization available
14263 cl_uint platform_vendor_id
= 0;
14265 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
14267 platform_vendor_id
= VENDOR_ID_AMD
;
14269 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14271 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14273 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
14275 platform_vendor_id
= VENDOR_ID_APPLE
;
14277 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14279 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14281 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14283 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
14285 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
14287 platform_vendor_id
= VENDOR_ID_MESA
;
14289 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
14291 platform_vendor_id
= VENDOR_ID_NV
;
14293 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
14295 platform_vendor_id
= VENDOR_ID_POCL
;
14299 platform_vendor_id
= VENDOR_ID_GENERIC
;
14302 uint platform_skipped
= ((opencl_platforms_filter
& (1u << platform_id
)) == 0);
14304 CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14306 if (CL_err
!= CL_SUCCESS
)
14308 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14312 platform_skipped
= 2;
14315 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14317 if (machine_readable
== 0)
14319 if (platform_skipped
== 0)
14321 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
14323 char line
[256] = { 0 };
14325 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
14329 else if (platform_skipped
== 1)
14331 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
14334 else if (platform_skipped
== 2)
14336 log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id
+ 1, platform_vendor
);
14342 if (platform_skipped
== 1) continue;
14343 if (platform_skipped
== 2) continue;
14345 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14347 size_t param_value_size
= 0;
14349 const uint device_id
= devices_cnt
;
14351 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14353 device_param
->platform_vendor_id
= platform_vendor_id
;
14355 device_param
->device
= platform_devices
[platform_devices_id
];
14357 device_param
->device_id
= device_id
;
14359 device_param
->platform_devices_id
= platform_devices_id
;
14361 device_param
->platform
= platform
;
14365 cl_device_type device_type
;
14367 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14369 if (CL_err
!= CL_SUCCESS
)
14371 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14376 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
14378 device_param
->device_type
= device_type
;
14382 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
14384 if (CL_err
!= CL_SUCCESS
)
14386 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14391 char *device_name
= (char *) mymalloc (param_value_size
);
14393 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
14395 if (CL_err
!= CL_SUCCESS
)
14397 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14402 device_param
->device_name
= device_name
;
14406 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
14408 if (CL_err
!= CL_SUCCESS
)
14410 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14415 char *device_vendor
= (char *) mymalloc (param_value_size
);
14417 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
14419 if (CL_err
!= CL_SUCCESS
)
14421 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14426 device_param
->device_vendor
= device_vendor
;
14428 cl_uint device_vendor_id
= 0;
14430 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
14432 device_vendor_id
= VENDOR_ID_AMD
;
14434 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14436 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14438 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
14440 device_vendor_id
= VENDOR_ID_APPLE
;
14442 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14444 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14446 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14448 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
14450 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
14452 device_vendor_id
= VENDOR_ID_MESA
;
14454 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
14456 device_vendor_id
= VENDOR_ID_NV
;
14458 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
14460 device_vendor_id
= VENDOR_ID_POCL
;
14464 device_vendor_id
= VENDOR_ID_GENERIC
;
14467 device_param
->device_vendor_id
= device_vendor_id
;
14471 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14475 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
14477 if (CL_err
!= CL_SUCCESS
)
14479 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14484 char *device_version
= (char *) mymalloc (param_value_size
);
14486 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
14488 if (CL_err
!= CL_SUCCESS
)
14490 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14495 device_param
->device_version
= device_version
;
14497 // device_opencl_version
14499 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
14501 if (CL_err
!= CL_SUCCESS
)
14503 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14508 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
14510 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
14512 if (CL_err
!= CL_SUCCESS
)
14514 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14519 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
14521 myfree (device_opencl_version
);
14525 cl_uint vector_width
;
14527 if (opencl_vector_width_chgd
== 0)
14529 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
14531 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
14533 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
14535 if (CL_err
!= CL_SUCCESS
)
14537 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14544 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
14546 if (CL_err
!= CL_SUCCESS
)
14548 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14556 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14561 vector_width
= opencl_vector_width
;
14564 if (vector_width
> 16) vector_width
= 16;
14566 device_param
->vector_width
= vector_width
;
14568 // max_compute_units
14570 cl_uint device_processors
;
14572 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14574 if (CL_err
!= CL_SUCCESS
)
14576 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14581 device_param
->device_processors
= device_processors
;
14583 // device_maxmem_alloc
14584 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14586 cl_ulong device_maxmem_alloc
;
14588 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14590 if (CL_err
!= CL_SUCCESS
)
14592 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14597 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14599 // device_global_mem
14601 cl_ulong device_global_mem
;
14603 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14605 if (CL_err
!= CL_SUCCESS
)
14607 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14612 device_param
->device_global_mem
= device_global_mem
;
14614 // max_work_group_size
14616 size_t device_maxworkgroup_size
;
14618 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14620 if (CL_err
!= CL_SUCCESS
)
14622 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14627 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14629 // max_clock_frequency
14631 cl_uint device_maxclock_frequency
;
14633 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14635 if (CL_err
!= CL_SUCCESS
)
14637 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14642 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14644 // device_endian_little
14646 cl_bool device_endian_little
;
14648 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14650 if (CL_err
!= CL_SUCCESS
)
14652 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14657 if (device_endian_little
== CL_FALSE
)
14659 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14661 device_param
->skipped
= 1;
14664 // device_available
14666 cl_bool device_available
;
14668 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14670 if (CL_err
!= CL_SUCCESS
)
14672 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14677 if (device_available
== CL_FALSE
)
14679 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14681 device_param
->skipped
= 1;
14684 // device_compiler_available
14686 cl_bool device_compiler_available
;
14688 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14690 if (CL_err
!= CL_SUCCESS
)
14692 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14697 if (device_compiler_available
== CL_FALSE
)
14699 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14701 device_param
->skipped
= 1;
14704 // device_execution_capabilities
14706 cl_device_exec_capabilities device_execution_capabilities
;
14708 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14710 if (CL_err
!= CL_SUCCESS
)
14712 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14717 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14719 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14721 device_param
->skipped
= 1;
14724 // device_extensions
14726 size_t device_extensions_size
;
14728 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14730 if (CL_err
!= CL_SUCCESS
)
14732 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14737 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14739 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14741 if (CL_err
!= CL_SUCCESS
)
14743 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14748 if (strstr (device_extensions
, "base_atomics") == 0)
14750 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14752 device_param
->skipped
= 1;
14755 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14757 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14759 device_param
->skipped
= 1;
14762 myfree (device_extensions
);
14764 // device_local_mem_size
14766 cl_ulong device_local_mem_size
;
14768 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14770 if (CL_err
!= CL_SUCCESS
)
14772 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14777 if (device_local_mem_size
< 32768)
14779 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14781 device_param
->skipped
= 1;
14784 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14785 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14786 // This results in both utilizing it for 50%
14787 // However, Intel has much better SIMD control over their own hardware
14788 // It makes sense to give them full control over their own hardware
14790 if (device_type
& CL_DEVICE_TYPE_CPU
)
14792 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14794 if (data
.force
== 0)
14796 if (algorithm_pos
== 0)
14798 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14799 log_info (" You can use --force to override this but do not post error reports if you do so");
14802 device_param
->skipped
= 1;
14809 device_param
->skipped
|= ((devices_filter
& (1u << device_id
)) == 0);
14810 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14814 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14816 if (CL_err
!= CL_SUCCESS
)
14818 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14823 char *driver_version
= (char *) mymalloc (param_value_size
);
14825 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14827 if (CL_err
!= CL_SUCCESS
)
14829 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14834 device_param
->driver_version
= driver_version
;
14836 // device_name_chksum
14838 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14841 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
);
14843 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
);
14846 uint device_name_digest
[4] = { 0 };
14848 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14850 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14852 device_param
->device_name_chksum
= device_name_chksum
;
14856 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14858 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14863 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14877 if (device_type
& CL_DEVICE_TYPE_GPU
)
14879 if (device_vendor_id
== VENDOR_ID_NV
)
14881 cl_uint kernel_exec_timeout
= 0;
14883 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14885 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14887 if (CL_err
!= CL_SUCCESS
)
14889 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14894 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14896 cl_uint sm_minor
= 0;
14897 cl_uint sm_major
= 0;
14899 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14900 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14902 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14904 if (CL_err
!= CL_SUCCESS
)
14906 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14911 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14913 if (CL_err
!= CL_SUCCESS
)
14915 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14920 device_param
->sm_minor
= sm_minor
;
14921 device_param
->sm_major
= sm_major
;
14923 // CPU burning loop damper
14924 // Value is given as number between 0-100
14927 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14929 if (nvidia_spin_damp_chgd
== 0)
14931 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14934 * the workaround is not a friend of rule based attacks
14935 * the words from the wordlist combined with fast and slow rules cause
14936 * fluctuations which cause inaccurate wait time estimations
14937 * using a reduced damping percentage almost compensates this
14940 device_param
->nvidia_spin_damp
= 64;
14944 device_param
->nvidia_spin_damp
/= 100;
14950 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14952 if (machine_readable
== 0)
14954 if (device_param
->skipped
== 0)
14956 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
14959 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
14960 (unsigned int) (device_global_mem
/ 1024 / 1024),
14961 (unsigned int) device_processors
);
14965 log_info ("- Device #%u: %s, skipped",
14972 // common driver check
14974 if (device_param
->skipped
== 0)
14976 if (device_type
& CL_DEVICE_TYPE_GPU
)
14978 if (platform_vendor_id
== VENDOR_ID_AMD
)
14980 int catalyst_check
= (force
== 1) ? 0 : 1;
14982 int catalyst_warn
= 0;
14984 int catalyst_broken
= 0;
14986 if (catalyst_check
== 1)
14990 // v14.9 and higher
14991 if (atoi (device_param
->driver_version
) >= 1573)
14996 catalyst_check
= 0;
14999 if (catalyst_broken
== 1)
15002 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
15003 log_info ("It passes over cracked hashes and will not report them as cracked");
15004 log_info ("You are STRONGLY encouraged not to use it");
15005 log_info ("You can use --force to override this but do not post error reports if you do so");
15011 if (catalyst_warn
== 1)
15014 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
15015 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
15016 log_info ("See hashcat's homepage for official supported catalyst drivers");
15018 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
15020 log_info ("You can use --force to override this but do not post error reports if you do so");
15026 else if (platform_vendor_id
== VENDOR_ID_NV
)
15028 if (device_param
->kernel_exec_timeout
!= 0)
15030 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);
15031 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
15036 /* turns out pocl still creates segfaults (because of llvm)
15037 if (device_type & CL_DEVICE_TYPE_CPU)
15039 if (platform_vendor_id == VENDOR_ID_AMD)
15044 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
15045 log_info ("You are STRONGLY encouraged not to use it");
15046 log_info ("You can use --force to override this but do not post error reports if you do so");
15047 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
15057 * kernel accel and loops tuning db adjustment
15060 device_param
->kernel_accel_min
= 1;
15061 device_param
->kernel_accel_max
= 1024;
15063 device_param
->kernel_loops_min
= 1;
15064 device_param
->kernel_loops_max
= 1024;
15066 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
15068 if (tuningdb_entry
)
15070 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
15071 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
15075 device_param
->kernel_accel_min
= _kernel_accel
;
15076 device_param
->kernel_accel_max
= _kernel_accel
;
15081 if (workload_profile
== 1)
15083 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
15085 else if (workload_profile
== 2)
15087 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
15090 device_param
->kernel_loops_min
= _kernel_loops
;
15091 device_param
->kernel_loops_max
= _kernel_loops
;
15095 // commandline parameters overwrite tuningdb entries
15099 device_param
->kernel_accel_min
= kernel_accel
;
15100 device_param
->kernel_accel_max
= kernel_accel
;
15105 device_param
->kernel_loops_min
= kernel_loops
;
15106 device_param
->kernel_loops_max
= kernel_loops
;
15121 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
15123 if (machine_readable
== 0)
15130 if (keyspace
== 0 && devices_active
== 0)
15132 log_error ("ERROR: No devices found/left");
15137 // 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)
15139 if (devices_filter
!= (uint
) -1)
15141 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
15143 if (devices_filter
> devices_cnt_mask
)
15145 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
15151 data
.devices_cnt
= devices_cnt
;
15153 data
.devices_active
= devices_active
;
15160 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
];
15161 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
];
15162 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
];
15163 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
];
15165 memset (hm_adapters_adl
, 0, sizeof (hm_adapters_adl
));
15166 memset (hm_adapters_nvapi
, 0, sizeof (hm_adapters_nvapi
));
15167 memset (hm_adapters_nvml
, 0, sizeof (hm_adapters_nvml
));
15168 memset (hm_adapters_xnvctrl
, 0, sizeof (hm_adapters_xnvctrl
));
15170 if (gpu_temp_disable
== 0)
15172 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
15173 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
15174 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
15175 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
15177 data
.hm_adl
= NULL
;
15178 data
.hm_nvapi
= NULL
;
15179 data
.hm_nvml
= NULL
;
15180 data
.hm_xnvctrl
= NULL
;
15182 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
15184 data
.hm_nvml
= nvml
;
15189 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
15191 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
15193 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
15197 for (int i
= 0; i
< tmp_in
; i
++)
15199 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
15202 for (int i
= 0; i
< tmp_out
; i
++)
15204 unsigned int speed
;
15206 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
15208 // doesn't seem to create any advantages
15209 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
15210 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
15215 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
15217 data
.hm_nvapi
= nvapi
;
15222 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
15224 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
15226 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
15230 for (int i
= 0; i
< tmp_in
; i
++)
15232 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
15237 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
15239 data
.hm_xnvctrl
= xnvctrl
;
15242 if (data
.hm_xnvctrl
)
15244 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
15246 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15248 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15250 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15252 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
15256 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
15261 if ((need_adl
== 1) && (adl_init (adl
) == 0))
15268 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
15270 // total number of adapters
15272 int hm_adapters_num
;
15274 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return -1;
15278 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
15280 if (lpAdapterInfo
== NULL
) return -1;
15282 // get a list (of ids of) valid/usable adapters
15284 int num_adl_adapters
= 0;
15286 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
15288 if (num_adl_adapters
> 0)
15290 hc_thread_mutex_lock (mux_adl
);
15292 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
15294 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15296 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15297 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15299 hc_thread_mutex_unlock (mux_adl
);
15302 myfree (valid_adl_device_list
);
15303 myfree (lpAdapterInfo
);
15307 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15309 gpu_temp_disable
= 1;
15314 * OpenCL devices: allocate buffer for device specific information
15317 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
15319 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
15321 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
15324 * User-defined GPU temp handling
15327 if (gpu_temp_disable
== 1)
15329 gpu_temp_abort
= 0;
15330 gpu_temp_retain
= 0;
15333 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
15335 if (gpu_temp_abort
< gpu_temp_retain
)
15337 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
15343 data
.gpu_temp_disable
= gpu_temp_disable
;
15344 data
.gpu_temp_abort
= gpu_temp_abort
;
15345 data
.gpu_temp_retain
= gpu_temp_retain
;
15349 * enable custom signal handler(s)
15352 if (benchmark
== 0)
15354 hc_signal (sigHandler_default
);
15358 hc_signal (sigHandler_benchmark
);
15365 if (data
.quiet
== 0)
15367 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
15369 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
);
15371 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15373 log_info ("Rules: %u", kernel_rules_cnt
);
15378 log_info ("Applicable Optimizers:");
15380 for (uint i
= 0; i
< 32; i
++)
15382 const uint opti_bit
= 1u << i
;
15384 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
15389 * Watchdog and Temperature balance
15393 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15395 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
15398 if (gpu_temp_abort
== 0)
15400 log_info ("Watchdog: Temperature abort trigger disabled");
15404 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
15407 if (gpu_temp_retain
== 0)
15409 log_info ("Watchdog: Temperature retain trigger disabled");
15413 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
15416 if (data
.quiet
== 0) log_info ("");
15426 if (gpu_temp_disable
== 0)
15428 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15430 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15432 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15434 if (device_param
->skipped
) continue;
15436 const uint platform_devices_id
= device_param
->platform_devices_id
;
15438 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15440 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
15441 data
.hm_device
[device_id
].nvapi
= 0;
15442 data
.hm_device
[device_id
].nvml
= 0;
15443 data
.hm_device
[device_id
].xnvctrl
= 0;
15444 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
15445 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
15446 data
.hm_device
[device_id
].fan_set_supported
= 0;
15449 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15451 data
.hm_device
[device_id
].adl
= 0;
15452 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
15453 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
15454 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
15455 data
.hm_device
[device_id
].od_version
= 0;
15456 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
15457 data
.hm_device
[device_id
].fan_set_supported
= 0;
15463 * powertune on user request
15466 if (powertune_enable
== 1)
15468 hc_thread_mutex_lock (mux_adl
);
15470 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15472 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15474 if (device_param
->skipped
) continue;
15476 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
15480 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
15481 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
15482 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
15483 * Driver / ADL bug?
15486 if (data
.hm_device
[device_id
].od_version
== 6)
15490 // check powertune capabilities first, if not available then skip device
15492 int powertune_supported
= 0;
15494 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
15496 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15501 // first backup current value, we will restore it later
15503 if (powertune_supported
!= 0)
15505 // powercontrol settings
15507 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15509 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
15511 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
15514 if (ADL_rc
!= ADL_OK
)
15516 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15521 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15523 log_error ("ERROR: Failed to set new ADL PowerControl values");
15530 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15532 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15534 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15536 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15541 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15543 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15545 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
15547 log_error ("ERROR: Failed to get ADL device capabilities");
15552 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15553 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15555 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15556 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15558 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15559 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15561 // warning if profile has too low max values
15563 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15565 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15568 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15570 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15573 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15575 performance_state
->iNumberOfPerformanceLevels
= 2;
15577 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15578 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15579 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15580 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15582 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15584 log_info ("ERROR: Failed to set ADL performance state");
15589 local_free (performance_state
);
15592 // set powertune value only
15594 if (powertune_supported
!= 0)
15597 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15599 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
15601 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15606 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15608 log_error ("ERROR: Failed to set new ADL PowerControl values");
15616 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
15618 // first backup current value, we will restore it later
15620 unsigned int limit
;
15622 int powertune_supported
= 0;
15624 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
15626 powertune_supported
= 1;
15629 // if backup worked, activate the maximum allowed
15631 if (powertune_supported
!= 0)
15633 unsigned int minLimit
;
15634 unsigned int maxLimit
;
15636 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
15640 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
15642 // now we can be sure we need to reset later
15644 nvml_power_limit
[device_id
] = limit
;
15652 hc_thread_mutex_unlock (mux_adl
);
15655 #endif // HAVE_HWMON
15658 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
15661 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
15663 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15665 cl_int CL_err
= CL_SUCCESS
;
15671 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15673 if (device_param
->skipped
) continue;
15676 * device properties
15679 const char *device_name_chksum
= device_param
->device_name_chksum
;
15680 const u32 device_processors
= device_param
->device_processors
;
15683 * create context for each device
15686 cl_context_properties properties
[3];
15688 properties
[0] = CL_CONTEXT_PLATFORM
;
15689 properties
[1] = (cl_context_properties
) device_param
->platform
;
15692 CL_err
= hc_clCreateContext (data
.ocl
, properties
, 1, &device_param
->device
, NULL
, NULL
, &device_param
->context
);
15694 if (CL_err
!= CL_SUCCESS
)
15696 log_error ("ERROR: clCreateContext(): %s\n", val2cstr_cl (CL_err
));
15702 * create command-queue
15705 // not supported with NV
15706 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15708 CL_err
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
, &device_param
->command_queue
);
15710 if (CL_err
!= CL_SUCCESS
)
15712 log_error ("ERROR: clCreateCommandQueue(): %s\n", val2cstr_cl (CL_err
));
15718 * kernel threads: some algorithms need a fixed kernel-threads count
15719 * because of shared memory usage or bitslice
15720 * there needs to be some upper limit, otherwise there's too much overhead
15723 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15725 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15726 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15728 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15730 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15733 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15734 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15735 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15736 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15737 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15738 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15739 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15740 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15741 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15742 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15743 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15744 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15745 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15747 device_param
->kernel_threads
= kernel_threads
;
15749 device_param
->hardware_power
= device_processors
* kernel_threads
;
15752 * create input buffers on device : calculate size of fixed memory buffers
15755 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15756 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15758 device_param
->size_root_css
= size_root_css
;
15759 device_param
->size_markov_css
= size_markov_css
;
15761 size_t size_results
= sizeof (uint
);
15763 device_param
->size_results
= size_results
;
15765 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15766 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15768 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15769 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15770 size_t size_esalts
= salts_cnt
* esalt_size
;
15772 device_param
->size_plains
= size_plains
;
15773 device_param
->size_digests
= size_digests
;
15774 device_param
->size_shown
= size_shown
;
15775 device_param
->size_salts
= size_salts
;
15777 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15778 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15779 size_t size_tm
= 32 * sizeof (bs_word_t
);
15783 size_t size_scrypt
= 4;
15785 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15787 // we need to check that all hashes have the same scrypt settings
15789 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15790 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15791 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15793 for (uint i
= 1; i
< salts_cnt
; i
++)
15795 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15796 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15797 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15799 log_error ("ERROR: Mixed scrypt settings not supported");
15805 uint tmto_start
= 0;
15806 uint tmto_stop
= 10;
15810 tmto_start
= scrypt_tmto
;
15814 // in case the user did not specify the tmto manually
15815 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15817 if (hash_mode
== 8900)
15819 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15823 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15828 else if (hash_mode
== 9300)
15830 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15834 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15841 data
.scrypt_tmp_size
= (128 * scrypt_r
* scrypt_p
);
15843 device_param
->kernel_accel_min
= 1;
15844 device_param
->kernel_accel_max
= 8;
15848 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15850 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15852 size_scrypt
/= 1u << tmto
;
15854 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15856 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15858 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15863 if (size_scrypt
> device_param
->device_global_mem
)
15865 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15870 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15872 data
.scrypt_tmto_final
= tmto
;
15878 if (tmto
== tmto_stop
)
15880 log_error ("ERROR: Can't allocate enough device memory");
15885 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %llu\n", data
.scrypt_tmto_final
, (unsigned long long int) size_scrypt
);
15888 size_t size_scrypt4
= size_scrypt
/ 4;
15891 * some algorithms need a fixed kernel-loops count
15894 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15896 const u32 kernel_loops_fixed
= 1024;
15898 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15899 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15902 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15904 const u32 kernel_loops_fixed
= 1024;
15906 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15907 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15910 if (hash_mode
== 8900)
15912 const u32 kernel_loops_fixed
= 1;
15914 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15915 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15918 if (hash_mode
== 9300)
15920 const u32 kernel_loops_fixed
= 1;
15922 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15923 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15926 if (hash_mode
== 12500)
15928 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15930 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15931 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15935 * some algorithms have a maximum kernel-loops count
15938 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15940 u32 innerloop_cnt
= 0;
15942 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15944 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15945 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15946 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15950 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
15953 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
15954 (innerloop_cnt
<= device_param
->kernel_loops_max
))
15956 device_param
->kernel_loops_max
= innerloop_cnt
;
15960 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
15961 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
15963 // find out if we would request too much memory on memory blocks which are based on kernel_accel
15965 size_t size_pws
= 4;
15966 size_t size_tmps
= 4;
15967 size_t size_hooks
= 4;
15969 while (kernel_accel_max
>= kernel_accel_min
)
15971 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
15975 size_pws
= kernel_power_max
* sizeof (pw_t
);
15981 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
15982 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15983 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15984 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15985 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
15986 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
15987 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
15988 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
15989 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
15990 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
15991 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15992 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15993 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15994 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15995 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15996 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15997 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15998 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15999 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16000 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16001 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16002 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16003 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16004 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
16005 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
16006 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
16007 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
16008 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
16009 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16010 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16011 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
16012 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
16013 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16014 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
16015 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16016 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
16017 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
16018 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16019 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16020 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
16021 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
16022 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
16023 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16024 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
16025 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
16026 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
16027 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
16028 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16029 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
16030 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
16031 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
16032 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16033 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16034 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
16035 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
16036 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
16037 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
16038 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
16039 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16040 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16041 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16042 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
16043 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
16044 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16045 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16046 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16047 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16048 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16049 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16050 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16051 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16052 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16053 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16054 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16055 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16056 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16057 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16058 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16059 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16060 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16061 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16062 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16067 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
16074 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
16075 // if not, decrease amplifier and try again
16077 int memory_limit_hit
= 0;
16079 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16080 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16081 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16083 const u64 size_total
16100 + size_pws
// not a bug
16114 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
16116 if (memory_limit_hit
== 1)
16118 kernel_accel_max
--;
16126 if (kernel_accel_max
< kernel_accel_min
)
16128 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
16133 device_param
->kernel_accel_min
= kernel_accel_min
;
16134 device_param
->kernel_accel_max
= kernel_accel_max
;
16137 if (kernel_accel_max < kernel_accel)
16139 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
16141 device_param->kernel_accel = kernel_accel_max;
16145 device_param
->size_bfs
= size_bfs
;
16146 device_param
->size_combs
= size_combs
;
16147 device_param
->size_rules
= size_rules
;
16148 device_param
->size_rules_c
= size_rules_c
;
16149 device_param
->size_pws
= size_pws
;
16150 device_param
->size_tmps
= size_tmps
;
16151 device_param
->size_hooks
= size_hooks
;
16154 * default building options
16157 if (chdir (cpath_real
) == -1)
16159 log_error ("ERROR: %s: %s", cpath_real
, strerror (errno
));
16164 char build_opts
[1024] = { 0 };
16167 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
16169 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
16173 // this test needs to be done manually because of osx opencl runtime
16174 // if there's a problem with permission, its not reporting back and erroring out silently
16176 #define files_cnt 15
16178 const char *files_names
[files_cnt
] =
16180 "inc_cipher_aes256.cl",
16181 "inc_cipher_serpent256.cl",
16182 "inc_cipher_twofish256.cl",
16184 "inc_comp_multi_bs.cl",
16185 "inc_comp_multi.cl",
16186 "inc_comp_single_bs.cl",
16187 "inc_comp_single.cl",
16188 "inc_hash_constants.h",
16189 "inc_hash_functions.cl",
16197 for (int i
= 0; i
< files_cnt
; i
++)
16199 FILE *fd
= fopen (files_names
[i
], "r");
16203 log_error ("ERROR: %s: fopen(): %s", files_names
[i
], strerror (errno
));
16210 size_t n
= fread (buf
, 1, 1, fd
);
16214 log_error ("ERROR: %s: fread(): %s", files_names
[i
], strerror (errno
));
16222 // we don't have sm_* on vendors not NV but it doesn't matter
16224 char build_opts_new
[1024] = { 0 };
16226 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -D VENDOR_ID=%u -D CUDA_ARCH=%d -D VECT_SIZE=%u -D DEVICE_TYPE=%u -D DGST_R0=%u -D DGST_R1=%u -D DGST_R2=%u -D DGST_R3=%u -D DGST_ELEM=%u -D KERN_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
, data
.dgst_pos0
, data
.dgst_pos1
, data
.dgst_pos2
, data
.dgst_pos3
, data
.dgst_size
/ 4, kern_type
);
16228 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
16231 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
16240 * kernel source filename
16243 char source_file
[256] = { 0 };
16245 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
16249 if (stat (source_file
, &sst
) == -1)
16251 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16257 * kernel cached filename
16260 char cached_file
[256] = { 0 };
16262 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
16268 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
16274 * kernel compile or load
16277 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16279 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16281 if (force_jit_compilation
== -1)
16285 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16287 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16289 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16291 if (CL_err
!= CL_SUCCESS
)
16293 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16298 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16300 if (CL_err
!= CL_SUCCESS
)
16302 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16308 size_t build_log_size
= 0;
16310 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16312 if (CL_err
!= CL_SUCCESS
)
16314 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16319 if (build_log_size
> 1)
16321 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16323 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16325 if (CL_err
!= CL_SUCCESS
)
16327 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16334 myfree (build_log
);
16338 if (CL_err
!= CL_SUCCESS
)
16340 device_param
->skipped
= true;
16342 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16347 size_t binary_size
;
16349 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16351 if (CL_err
!= CL_SUCCESS
)
16353 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16358 u8
*binary
= (u8
*) mymalloc (binary_size
);
16360 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16362 if (CL_err
!= CL_SUCCESS
)
16364 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16369 writeProgramBin (cached_file
, binary
, binary_size
);
16371 local_free (binary
);
16376 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16379 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16381 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program
);
16383 if (CL_err
!= CL_SUCCESS
)
16385 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16390 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16392 if (CL_err
!= CL_SUCCESS
)
16394 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16403 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
16406 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16408 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16410 if (CL_err
!= CL_SUCCESS
)
16412 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16417 char build_opts_update
[1024] = { 0 };
16419 if (force_jit_compilation
== 1500)
16421 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
16423 else if (force_jit_compilation
== 8900)
16425 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%u -DSCRYPT_TMP_ELEM=%u", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.scrypt_tmto_final
, data
.scrypt_tmp_size
/ 16);
16429 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
16432 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
);
16434 if (CL_err
!= CL_SUCCESS
)
16436 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16442 size_t build_log_size
= 0;
16444 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16446 if (CL_err
!= CL_SUCCESS
)
16448 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16453 if (build_log_size
> 1)
16455 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16457 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16459 if (CL_err
!= CL_SUCCESS
)
16461 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16468 myfree (build_log
);
16472 if (CL_err
!= CL_SUCCESS
)
16474 device_param
->skipped
= true;
16476 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16480 local_free (kernel_lengths
);
16481 local_free (kernel_sources
[0]);
16482 local_free (kernel_sources
);
16486 * word generator kernel
16489 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
16492 * kernel mp source filename
16495 char source_file
[256] = { 0 };
16497 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
16501 if (stat (source_file
, &sst
) == -1)
16503 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16509 * kernel mp cached filename
16512 char cached_file
[256] = { 0 };
16514 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
16520 if (stat (cached_file
, &cst
) == -1)
16526 * kernel compile or load
16529 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16531 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16535 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16536 if (quiet
== 0) log_info ("");
16538 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16540 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_mp
);
16542 if (CL_err
!= CL_SUCCESS
)
16544 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16549 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16551 if (CL_err
!= CL_SUCCESS
)
16553 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16558 if (CL_err
!= CL_SUCCESS
)
16560 device_param
->skipped
= true;
16562 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16567 size_t binary_size
;
16569 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16571 if (CL_err
!= CL_SUCCESS
)
16573 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16578 u8
*binary
= (u8
*) mymalloc (binary_size
);
16580 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16582 if (CL_err
!= CL_SUCCESS
)
16584 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16589 writeProgramBin (cached_file
, binary
, binary_size
);
16591 local_free (binary
);
16596 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16599 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16601 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_mp
);
16603 if (CL_err
!= CL_SUCCESS
)
16605 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16610 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16612 if (CL_err
!= CL_SUCCESS
)
16614 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16620 local_free (kernel_lengths
);
16621 local_free (kernel_sources
[0]);
16622 local_free (kernel_sources
);
16629 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16636 * kernel amp source filename
16639 char source_file
[256] = { 0 };
16641 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
16645 if (stat (source_file
, &sst
) == -1)
16647 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16653 * kernel amp cached filename
16656 char cached_file
[256] = { 0 };
16658 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
16664 if (stat (cached_file
, &cst
) == -1)
16670 * kernel compile or load
16673 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16675 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16679 if (quiet
== 0) log_info ("- Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, filename_from_filepath (cached_file
));
16680 if (quiet
== 0) log_info ("");
16682 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16684 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_amp
);
16686 if (CL_err
!= CL_SUCCESS
)
16688 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16693 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16695 if (CL_err
!= CL_SUCCESS
)
16697 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16702 if (CL_err
!= CL_SUCCESS
)
16704 device_param
->skipped
= true;
16706 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
16711 size_t binary_size
;
16713 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16715 if (CL_err
!= CL_SUCCESS
)
16717 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16722 u8
*binary
= (u8
*) mymalloc (binary_size
);
16724 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16726 if (CL_err
!= CL_SUCCESS
)
16728 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16733 writeProgramBin (cached_file
, binary
, binary_size
);
16735 local_free (binary
);
16740 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16743 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16745 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_amp
);
16747 if (CL_err
!= CL_SUCCESS
)
16749 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16754 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16756 if (CL_err
!= CL_SUCCESS
)
16758 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16764 local_free (kernel_lengths
);
16765 local_free (kernel_sources
[0]);
16766 local_free (kernel_sources
);
16769 // return back to the folder we came from initially (workaround)
16771 if (chdir (cwd
) == -1)
16773 log_error ("ERROR: %s: %s", cwd
, strerror (errno
));
16778 // some algorithm collide too fast, make that impossible
16780 if (benchmark
== 1)
16782 ((uint
*) digests_buf
)[0] = -1;
16783 ((uint
*) digests_buf
)[1] = -1;
16784 ((uint
*) digests_buf
)[2] = -1;
16785 ((uint
*) digests_buf
)[3] = -1;
16792 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_buf
);
16793 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_amp_buf
);
16794 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
, &device_param
->d_tmps
);
16795 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
, &device_param
->d_hooks
);
16796 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_a
);
16797 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_b
);
16798 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_c
);
16799 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_d
);
16800 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_a
);
16801 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_b
);
16802 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_c
);
16803 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_d
);
16804 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
, &device_param
->d_plain_bufs
);
16805 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
, &device_param
->d_digests_buf
);
16806 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
, &device_param
->d_digests_shown
);
16807 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
, &device_param
->d_salt_bufs
);
16808 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
, &device_param
->d_result
);
16809 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV0_buf
);
16810 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV1_buf
);
16811 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV2_buf
);
16812 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV3_buf
);
16814 if (CL_err
!= CL_SUCCESS
)
16816 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16821 CL_err
|= 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
);
16822 CL_err
|= 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
);
16823 CL_err
|= 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
);
16824 CL_err
|= 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
);
16825 CL_err
|= 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
);
16826 CL_err
|= 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
);
16827 CL_err
|= 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
);
16828 CL_err
|= 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
);
16829 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
16830 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
16831 CL_err
|= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
16833 if (CL_err
!= CL_SUCCESS
)
16835 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16844 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16846 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
, &device_param
->d_rules
);
16847 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
, &device_param
->d_rules_c
);
16849 if (CL_err
!= CL_SUCCESS
)
16851 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16856 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
16858 if (CL_err
!= CL_SUCCESS
)
16860 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16865 else if (attack_kern
== ATTACK_KERN_COMBI
)
16867 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs
);
16868 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs_c
);
16869 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16870 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16872 if (CL_err
!= CL_SUCCESS
)
16874 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16879 else if (attack_kern
== ATTACK_KERN_BF
)
16881 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs
);
16882 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs_c
);
16883 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
, &device_param
->d_tm_c
);
16884 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16885 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16887 if (CL_err
!= CL_SUCCESS
)
16889 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16897 CL_err
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
, &device_param
->d_esalt_bufs
);
16899 if (CL_err
!= CL_SUCCESS
)
16901 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16906 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
16908 if (CL_err
!= CL_SUCCESS
)
16910 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16920 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16922 device_param
->pws_buf
= pws_buf
;
16924 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16926 device_param
->combs_buf
= combs_buf
;
16928 void *hooks_buf
= mymalloc (size_hooks
);
16930 device_param
->hooks_buf
= hooks_buf
;
16936 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16937 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16938 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16939 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16940 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16941 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16942 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16943 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16944 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16945 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16946 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16948 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16949 ? &device_param
->d_pws_buf
16950 : &device_param
->d_pws_amp_buf
;
16951 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16952 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
16953 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
16954 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
16955 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
16956 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
16957 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
16958 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
16959 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
16960 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
16961 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
16962 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
16963 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
16964 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
16965 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
16966 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
16967 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
16968 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
16969 device_param
->kernel_params
[19] = &device_param
->d_result
;
16970 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
16971 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
16972 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
16973 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
16974 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
16975 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
16976 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
16977 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
16978 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
16979 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
16980 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
16981 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
16982 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
16983 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
16984 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
16986 device_param
->kernel_params_mp_buf64
[3] = 0;
16987 device_param
->kernel_params_mp_buf32
[4] = 0;
16988 device_param
->kernel_params_mp_buf32
[5] = 0;
16989 device_param
->kernel_params_mp_buf32
[6] = 0;
16990 device_param
->kernel_params_mp_buf32
[7] = 0;
16991 device_param
->kernel_params_mp_buf32
[8] = 0;
16993 device_param
->kernel_params_mp
[0] = NULL
;
16994 device_param
->kernel_params_mp
[1] = NULL
;
16995 device_param
->kernel_params_mp
[2] = NULL
;
16996 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
16997 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
16998 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
16999 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
17000 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
17001 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
17003 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17004 device_param
->kernel_params_mp_l_buf32
[4] = 0;
17005 device_param
->kernel_params_mp_l_buf32
[5] = 0;
17006 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17007 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17008 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17009 device_param
->kernel_params_mp_l_buf32
[9] = 0;
17011 device_param
->kernel_params_mp_l
[0] = NULL
;
17012 device_param
->kernel_params_mp_l
[1] = NULL
;
17013 device_param
->kernel_params_mp_l
[2] = NULL
;
17014 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
17015 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
17016 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
17017 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
17018 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
17019 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
17020 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
17022 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17023 device_param
->kernel_params_mp_r_buf32
[4] = 0;
17024 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17025 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17026 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17027 device_param
->kernel_params_mp_r_buf32
[8] = 0;
17029 device_param
->kernel_params_mp_r
[0] = NULL
;
17030 device_param
->kernel_params_mp_r
[1] = NULL
;
17031 device_param
->kernel_params_mp_r
[2] = NULL
;
17032 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
17033 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
17034 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
17035 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
17036 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
17037 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
17039 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
17040 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
17042 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
17043 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
17044 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
17045 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
17046 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
17047 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
17048 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
17050 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
17051 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
17053 device_param
->kernel_params_memset_buf32
[1] = 0; // value
17054 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
17056 device_param
->kernel_params_memset
[0] = NULL
;
17057 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
17058 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
17064 size_t kernel_wgs_tmp
;
17066 char kernel_name
[64] = { 0 };
17068 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17070 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17072 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
17074 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17076 if (CL_err
!= CL_SUCCESS
)
17078 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17083 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
17085 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17087 if (CL_err
!= CL_SUCCESS
)
17089 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17094 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
17096 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17098 if (CL_err
!= CL_SUCCESS
)
17100 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17107 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
17109 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17111 if (CL_err
!= CL_SUCCESS
)
17113 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17118 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
17120 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17122 if (CL_err
!= CL_SUCCESS
)
17124 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17129 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
17131 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17133 if (CL_err
!= CL_SUCCESS
)
17135 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17141 if (data
.attack_mode
== ATTACK_MODE_BF
)
17143 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17145 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
17147 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel_tm
);
17149 if (CL_err
!= CL_SUCCESS
)
17151 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17156 CL_err
= 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
);
17158 if (CL_err
!= CL_SUCCESS
)
17160 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17169 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
17171 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17173 if (CL_err
!= CL_SUCCESS
)
17175 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17180 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
17182 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17184 if (CL_err
!= CL_SUCCESS
)
17186 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17191 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
17193 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17195 if (CL_err
!= CL_SUCCESS
)
17197 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17202 if (opts_type
& OPTS_TYPE_HOOK12
)
17204 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
17206 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel12
);
17208 if (CL_err
!= CL_SUCCESS
)
17210 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17215 CL_err
= 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
);
17217 if (CL_err
!= CL_SUCCESS
)
17219 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17225 if (opts_type
& OPTS_TYPE_HOOK23
)
17227 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
17229 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel23
);
17231 if (CL_err
!= CL_SUCCESS
)
17233 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17238 CL_err
= 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
);
17240 if (CL_err
!= CL_SUCCESS
)
17242 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17249 CL_err
|= 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
);
17250 CL_err
|= 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
);
17251 CL_err
|= 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
);
17253 if (CL_err
!= CL_SUCCESS
)
17255 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17260 for (uint i
= 0; i
<= 23; i
++)
17262 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17263 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17264 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17266 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17267 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17269 if (CL_err
!= CL_SUCCESS
)
17271 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17277 for (uint i
= 24; i
<= 34; i
++)
17279 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17280 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17281 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17283 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17284 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17286 if (CL_err
!= CL_SUCCESS
)
17288 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17296 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset", &device_param
->kernel_memset
);
17298 if (CL_err
!= CL_SUCCESS
)
17300 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17305 CL_err
= 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
);
17307 if (CL_err
!= CL_SUCCESS
)
17309 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17314 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
17315 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
17316 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
17318 if (CL_err
!= CL_SUCCESS
)
17320 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17327 if (attack_mode
== ATTACK_MODE_BF
)
17329 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov", &device_param
->kernel_mp_l
);
17330 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov", &device_param
->kernel_mp_r
);
17332 if (CL_err
!= CL_SUCCESS
)
17334 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17339 CL_err
|= 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
);
17340 CL_err
|= 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
);
17342 if (CL_err
!= CL_SUCCESS
)
17344 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17349 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17351 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
17352 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
17354 if (CL_err
!= CL_SUCCESS
)
17356 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17362 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
17364 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17366 if (CL_err
!= CL_SUCCESS
)
17368 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17373 CL_err
= 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
);
17375 if (CL_err
!= CL_SUCCESS
)
17377 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17382 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17384 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17386 if (CL_err
!= CL_SUCCESS
)
17388 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17393 CL_err
= 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
);
17395 if (CL_err
!= CL_SUCCESS
)
17397 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17403 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17409 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp", &device_param
->kernel_amp
);
17411 if (CL_err
!= CL_SUCCESS
)
17413 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17418 CL_err
= 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
);
17420 if (CL_err
!= CL_SUCCESS
)
17422 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17428 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17434 for (uint i
= 0; i
< 5; i
++)
17436 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
17438 if (CL_err
!= CL_SUCCESS
)
17440 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17446 for (uint i
= 5; i
< 7; i
++)
17448 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
17450 if (CL_err
!= CL_SUCCESS
)
17452 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17459 // maybe this has been updated by clGetKernelWorkGroupInfo()
17460 // value can only be decreased, so we don't need to reallocate buffers
17462 device_param
->kernel_threads
= kernel_threads
;
17464 // zero some data buffers
17466 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
17467 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
17468 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
17469 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
17470 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
17471 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
17477 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
17479 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
17481 else if (attack_kern
== ATTACK_KERN_COMBI
)
17483 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
17484 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
17485 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17486 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17488 else if (attack_kern
== ATTACK_KERN_BF
)
17490 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
17491 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
17492 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
17493 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17494 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17497 #if defined(HAVE_HWMON)
17500 * Store initial fanspeed if gpu_temp_retain is enabled
17503 if (gpu_temp_disable
== 0)
17505 if (gpu_temp_retain
!= 0)
17507 hc_thread_mutex_lock (mux_adl
);
17509 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
17511 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
17512 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
17514 // we also set it to tell the OS we take control over the fan and it's automatic controller
17515 // if it was set to automatic. we do not control user-defined fanspeeds.
17517 if (fanpolicy
== 1)
17519 data
.hm_device
[device_id
].fan_set_supported
= 1;
17523 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17525 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
17527 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17530 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
17534 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
17540 data
.hm_device
[device_id
].fan_set_supported
= 1;
17544 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
17546 data
.hm_device
[device_id
].fan_set_supported
= 0;
17551 data
.hm_device
[device_id
].fan_set_supported
= 0;
17555 hc_thread_mutex_unlock (mux_adl
);
17559 #endif // HAVE_HWMON
17562 if (data
.quiet
== 0) log_info_nn ("");
17565 * In benchmark-mode, inform user which algorithm is checked
17568 if (benchmark
== 1)
17570 if (machine_readable
== 0)
17574 data
.quiet
= quiet
;
17576 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
17578 log_info ("Hashtype: %s", hash_type
);
17584 * keep track of the progress
17587 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17588 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17589 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17596 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
17598 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
17603 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
17605 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
17610 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
17612 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
17622 segment_size
*= (1024 * 1024);
17624 data
.segment_size
= segment_size
;
17626 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
17628 wl_data
->buf
= (char *) mymalloc (segment_size
);
17629 wl_data
->avail
= segment_size
;
17630 wl_data
->incr
= segment_size
;
17634 cs_t
*css_buf
= NULL
;
17638 char **masks
= NULL
;
17639 char **dictfiles
= NULL
;
17641 uint mask_from_file
= 0;
17643 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17645 if (wordlist_mode
== WL_MODE_FILE
)
17647 int wls_left
= myargc
- (optind
+ 1);
17649 for (int i
= 0; i
< wls_left
; i
++)
17651 char *l0_filename
= myargv
[optind
+ 1 + i
];
17653 struct stat l0_stat
;
17655 if (stat (l0_filename
, &l0_stat
) == -1)
17657 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
17662 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
17666 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17670 dictfiles
[dictcnt
- 1] = l0_filename
;
17674 // do not allow --keyspace w/ a directory
17678 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17683 char **dictionary_files
= NULL
;
17685 dictionary_files
= scan_directory (l0_filename
);
17687 if (dictionary_files
!= NULL
)
17689 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17691 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17693 char *l1_filename
= dictionary_files
[d
];
17695 struct stat l1_stat
;
17697 if (stat (l1_filename
, &l1_stat
) == -1)
17699 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17704 if (S_ISREG (l1_stat
.st_mode
))
17706 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17710 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17715 local_free (dictionary_files
);
17721 log_error ("ERROR: No usable dictionary file found.");
17726 else if (wordlist_mode
== WL_MODE_STDIN
)
17731 else if (attack_mode
== ATTACK_MODE_COMBI
)
17735 char *dictfile1
= myargv
[optind
+ 1 + 0];
17736 char *dictfile2
= myargv
[optind
+ 1 + 1];
17738 // find the bigger dictionary and use as base
17743 struct stat tmp_stat
;
17745 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
17747 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17752 if (stat (dictfile1
, &tmp_stat
) == -1)
17754 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17761 if (S_ISDIR (tmp_stat
.st_mode
))
17763 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
17770 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
17772 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17779 if (stat (dictfile2
, &tmp_stat
) == -1)
17781 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17789 if (S_ISDIR (tmp_stat
.st_mode
))
17791 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
17799 data
.combs_cnt
= 1;
17803 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
17805 data
.quiet
= quiet
;
17807 if (words1_cnt
== 0)
17809 log_error ("ERROR: %s: empty file", dictfile1
);
17817 data
.combs_cnt
= 1;
17821 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17823 data
.quiet
= quiet
;
17825 if (words2_cnt
== 0)
17827 log_error ("ERROR: %s: empty file", dictfile2
);
17838 data
.dictfile
= dictfile1
;
17839 data
.dictfile2
= dictfile2
;
17841 if (words1_cnt
>= words2_cnt
)
17843 data
.combs_cnt
= words2_cnt
;
17844 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
17846 dictfiles
= &data
.dictfile
;
17852 data
.combs_cnt
= words1_cnt
;
17853 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17855 dictfiles
= &data
.dictfile2
;
17859 // we also have to switch wordlist related rules!
17861 char *tmpc
= data
.rule_buf_l
;
17863 data
.rule_buf_l
= data
.rule_buf_r
;
17864 data
.rule_buf_r
= tmpc
;
17866 int tmpi
= data
.rule_len_l
;
17868 data
.rule_len_l
= data
.rule_len_r
;
17869 data
.rule_len_r
= tmpi
;
17872 else if (attack_mode
== ATTACK_MODE_BF
)
17878 if (benchmark
== 0)
17880 mask
= myargv
[optind
+ 1];
17882 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
17884 if ((optind
+ 2) <= myargc
)
17886 struct stat file_stat
;
17888 if (stat (mask
, &file_stat
) == -1)
17892 masks
[maskcnt
- 1] = mystrdup (mask
);
17896 int wls_left
= myargc
- (optind
+ 1);
17898 uint masks_avail
= INCR_MASKS
;
17900 for (int i
= 0; i
< wls_left
; i
++)
17904 mask
= myargv
[optind
+ 1 + i
];
17906 if (stat (mask
, &file_stat
) == -1)
17908 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17914 uint is_file
= S_ISREG (file_stat
.st_mode
);
17920 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17922 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17927 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17929 while (!feof (mask_fp
))
17931 memset (line_buf
, 0, HCBUFSIZ
);
17933 int line_len
= fgetl (mask_fp
, line_buf
);
17935 if (line_len
== 0) continue;
17937 if (line_buf
[0] == '#') continue;
17939 if (masks_avail
== maskcnt
)
17941 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17943 masks_avail
+= INCR_MASKS
;
17946 masks
[maskcnt
] = mystrdup (line_buf
);
17957 log_error ("ERROR: %s: unsupported file-type", mask
);
17963 mask_from_file
= 1;
17968 custom_charset_1
= (char *) "?l?d?u";
17969 custom_charset_2
= (char *) "?l?d";
17970 custom_charset_3
= (char *) "?l?d*!$@_";
17972 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
17973 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
17974 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
17976 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
17978 wordlist_mode
= WL_MODE_MASK
;
17980 data
.wordlist_mode
= wordlist_mode
;
17990 * generate full masks and charsets
17993 masks
= (char **) mymalloc (sizeof (char *));
17997 case 1731: pw_min
= 5;
17999 mask
= mystrdup ("?b?b?b?b?b");
18001 case 12500: pw_min
= 5;
18003 mask
= mystrdup ("?b?b?b?b?b");
18005 default: pw_min
= 7;
18007 mask
= mystrdup ("?b?b?b?b?b?b?b");
18013 masks
[maskcnt
- 1] = mystrdup (mask
);
18015 wordlist_mode
= WL_MODE_MASK
;
18017 data
.wordlist_mode
= wordlist_mode
;
18022 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
18026 if (increment_min
> pw_min
) pw_min
= increment_min
;
18028 if (increment_max
< pw_max
) pw_max
= increment_max
;
18031 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
18033 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
18037 char *mask
= myargv
[myargc
- 1];
18041 masks
= (char **) mymalloc (1 * sizeof (char *));
18045 struct stat file_stat
;
18047 if (stat (mask
, &file_stat
) == -1)
18051 masks
[maskcnt
- 1] = mystrdup (mask
);
18055 uint is_file
= S_ISREG (file_stat
.st_mode
);
18061 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18063 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18068 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18070 uint masks_avail
= 1;
18072 while (!feof (mask_fp
))
18074 memset (line_buf
, 0, HCBUFSIZ
);
18076 int line_len
= fgetl (mask_fp
, line_buf
);
18078 if (line_len
== 0) continue;
18080 if (line_buf
[0] == '#') continue;
18082 if (masks_avail
== maskcnt
)
18084 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18086 masks_avail
+= INCR_MASKS
;
18089 masks
[maskcnt
] = mystrdup (line_buf
);
18098 mask_from_file
= 1;
18104 masks
[maskcnt
- 1] = mystrdup (mask
);
18110 int wls_left
= myargc
- (optind
+ 2);
18112 for (int i
= 0; i
< wls_left
; i
++)
18114 char *filename
= myargv
[optind
+ 1 + i
];
18116 struct stat file_stat
;
18118 if (stat (filename
, &file_stat
) == -1)
18120 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18125 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18129 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18133 dictfiles
[dictcnt
- 1] = filename
;
18137 // do not allow --keyspace w/ a directory
18141 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18146 char **dictionary_files
= NULL
;
18148 dictionary_files
= scan_directory (filename
);
18150 if (dictionary_files
!= NULL
)
18152 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18154 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18156 char *l1_filename
= dictionary_files
[d
];
18158 struct stat l1_stat
;
18160 if (stat (l1_filename
, &l1_stat
) == -1)
18162 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18167 if (S_ISREG (l1_stat
.st_mode
))
18169 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18173 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18178 local_free (dictionary_files
);
18184 log_error ("ERROR: No usable dictionary file found.");
18193 uint mask_min
= increment_min
; // we can't reject smaller masks here
18194 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18196 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18198 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18200 if (cur_mask
== NULL
) break;
18202 masks
[maskcnt
] = cur_mask
;
18206 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18210 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18212 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
18216 char *mask
= myargv
[optind
+ 1 + 0];
18220 masks
= (char **) mymalloc (1 * sizeof (char *));
18224 struct stat file_stat
;
18226 if (stat (mask
, &file_stat
) == -1)
18230 masks
[maskcnt
- 1] = mystrdup (mask
);
18234 uint is_file
= S_ISREG (file_stat
.st_mode
);
18240 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18242 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18247 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18249 uint masks_avail
= 1;
18251 while (!feof (mask_fp
))
18253 memset (line_buf
, 0, HCBUFSIZ
);
18255 int line_len
= fgetl (mask_fp
, line_buf
);
18257 if (line_len
== 0) continue;
18259 if (line_buf
[0] == '#') continue;
18261 if (masks_avail
== maskcnt
)
18263 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18265 masks_avail
+= INCR_MASKS
;
18268 masks
[maskcnt
] = mystrdup (line_buf
);
18277 mask_from_file
= 1;
18283 masks
[maskcnt
- 1] = mystrdup (mask
);
18289 int wls_left
= myargc
- (optind
+ 2);
18291 for (int i
= 0; i
< wls_left
; i
++)
18293 char *filename
= myargv
[optind
+ 2 + i
];
18295 struct stat file_stat
;
18297 if (stat (filename
, &file_stat
) == -1)
18299 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18304 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18308 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18312 dictfiles
[dictcnt
- 1] = filename
;
18316 // do not allow --keyspace w/ a directory
18320 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18325 char **dictionary_files
= NULL
;
18327 dictionary_files
= scan_directory (filename
);
18329 if (dictionary_files
!= NULL
)
18331 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18333 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18335 char *l1_filename
= dictionary_files
[d
];
18337 struct stat l1_stat
;
18339 if (stat (l1_filename
, &l1_stat
) == -1)
18341 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18346 if (S_ISREG (l1_stat
.st_mode
))
18348 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18352 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18357 local_free (dictionary_files
);
18363 log_error ("ERROR: No usable dictionary file found.");
18372 uint mask_min
= increment_min
; // we can't reject smaller masks here
18373 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18375 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18377 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18379 if (cur_mask
== NULL
) break;
18381 masks
[maskcnt
] = cur_mask
;
18385 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18390 data
.pw_min
= pw_min
;
18391 data
.pw_max
= pw_max
;
18397 if (weak_hash_threshold
>= salts_cnt
)
18399 hc_device_param_t
*device_param
= NULL
;
18401 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18403 device_param
= &data
.devices_param
[device_id
];
18405 if (device_param
->skipped
) continue;
18410 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
18412 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
18414 weak_hash_check (device_param
, salt_pos
);
18417 // Display hack, guarantee that there is at least one \r before real start
18419 //if (data.quiet == 0) log_info ("");
18423 * status and monitor threads
18426 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18428 data
.devices_status
= STATUS_STARTING
;
18431 uint inner_threads_cnt
= 0;
18433 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
18435 data
.shutdown_inner
= 0;
18441 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
18443 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
18445 inner_threads_cnt
++;
18447 if (outfile_check_timer
!= 0)
18449 if (data
.outfile_check_directory
!= NULL
)
18451 if ((hash_mode
!= 5200) &&
18452 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
18453 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
18454 (hash_mode
!= 9000))
18456 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
18458 inner_threads_cnt
++;
18462 outfile_check_timer
= 0;
18467 outfile_check_timer
= 0;
18473 * Inform the user if we got some hashes remove because of the pot file remove feature
18476 if (data
.quiet
== 0)
18478 if (potfile_remove_cracks
> 0)
18480 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
18481 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
18485 data
.outfile_check_timer
= outfile_check_timer
;
18491 char **induction_dictionaries
= NULL
;
18493 int induction_dictionaries_cnt
= 0;
18495 hcstat_table_t
*root_table_buf
= NULL
;
18496 hcstat_table_t
*markov_table_buf
= NULL
;
18498 uint initial_restore_done
= 0;
18500 data
.maskcnt
= maskcnt
;
18502 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
18504 if (data
.devices_status
== STATUS_CRACKED
) continue;
18505 if (data
.devices_status
== STATUS_ABORTED
) continue;
18506 if (data
.devices_status
== STATUS_QUIT
) continue;
18508 if (maskpos
> rd
->maskpos
)
18513 rd
->maskpos
= maskpos
;
18514 data
.maskpos
= maskpos
;
18516 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
18518 char *mask
= masks
[maskpos
];
18520 if (mask_from_file
== 1)
18522 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
18527 uint mask_offset
= 0;
18529 uint separator_cnt
;
18531 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
18533 str_ptr
= strstr (mask
+ mask_offset
, ",");
18535 if (str_ptr
== NULL
) break;
18537 str_pos
= str_ptr
- mask
;
18539 // escaped separator, i.e. "\,"
18543 if (mask
[str_pos
- 1] == '\\')
18547 mask_offset
= str_pos
+ 1;
18553 // reset the offset
18557 mask
[str_pos
] = '\0';
18559 switch (separator_cnt
)
18562 mp_reset_usr (mp_usr
, 0);
18564 custom_charset_1
= mask
;
18565 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18569 mp_reset_usr (mp_usr
, 1);
18571 custom_charset_2
= mask
;
18572 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18576 mp_reset_usr (mp_usr
, 2);
18578 custom_charset_3
= mask
;
18579 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18583 mp_reset_usr (mp_usr
, 3);
18585 custom_charset_4
= mask
;
18586 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
18590 mask
= mask
+ str_pos
+ 1;
18594 * What follows is a very special case where "\," is within the mask field of a line in a .hcmask file only because otherwise (without the "\")
18595 * it would be interpreted as a custom charset definition.
18597 * We need to replace all "\," with just "," within the mask (but allow the special case "\\," which means "\" followed by ",")
18598 * Note: "\\" is not needed to replace all "\" within the mask! The meaning of "\\" within a line containing the string "\\," is just to allow "\" followed by ","
18601 uint mask_len_cur
= strlen (mask
);
18603 uint mask_out_pos
= 0;
18604 char mask_prev
= 0;
18606 for (uint mask_iter
= 0; mask_iter
< mask_len_cur
; mask_iter
++, mask_out_pos
++)
18608 if (mask
[mask_iter
] == ',')
18610 if (mask_prev
== '\\')
18612 mask_out_pos
-= 1; // this means: skip the previous "\"
18616 mask_prev
= mask
[mask_iter
];
18618 mask
[mask_out_pos
] = mask
[mask_iter
];
18621 mask
[mask_out_pos
] = '\0';
18624 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18628 local_free (css_buf
);
18629 local_free (data
.root_css_buf
);
18630 local_free (data
.markov_css_buf
);
18632 local_free (masks
[maskpos
- 1]);
18635 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18638 data
.css_cnt
= css_cnt
;
18639 data
.css_buf
= css_buf
;
18641 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
18643 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
18645 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
18646 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
18648 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
18650 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
18652 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
18653 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
18655 data
.root_css_buf
= root_css_buf
;
18656 data
.markov_css_buf
= markov_css_buf
;
18658 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
18660 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
18662 local_free (root_table_buf
);
18663 local_free (markov_table_buf
);
18667 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18669 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18671 if (device_param
->skipped
) continue;
18673 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
18674 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
18675 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
18677 device_param
->kernel_params_mp_buf64
[3] = 0;
18678 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
18679 device_param
->kernel_params_mp_buf32
[5] = 0;
18680 device_param
->kernel_params_mp_buf32
[6] = 0;
18681 device_param
->kernel_params_mp_buf32
[7] = 0;
18683 if (attack_mode
== ATTACK_MODE_HYBRID1
)
18685 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
18686 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
18687 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
18688 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
18690 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18692 device_param
->kernel_params_mp_buf32
[5] = 0;
18693 device_param
->kernel_params_mp_buf32
[6] = 0;
18694 device_param
->kernel_params_mp_buf32
[7] = 0;
18697 cl_int CL_err
= CL_SUCCESS
;
18699 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
18700 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
18701 for (uint i
= 4; i
< 8; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
18703 if (CL_err
!= CL_SUCCESS
)
18705 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
18710 CL_err
|= 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
);
18711 CL_err
|= 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
);
18713 if (CL_err
!= CL_SUCCESS
)
18715 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
18721 else if (attack_mode
== ATTACK_MODE_BF
)
18723 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
18727 for (uint i
= 0; i
< dictcnt
; i
++)
18729 local_free (dictfiles
[i
]);
18732 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
18734 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
18736 if (l1_filename
== NULL
) break;
18740 dictfiles
[dictcnt
- 1] = l1_filename
;
18747 dictfiles
[dictcnt
- 1] = mask
;
18752 log_error ("ERROR: Mask is too small");
18759 free (induction_dictionaries
);
18761 // induction_dictionaries_cnt = 0; // implied
18763 if (attack_mode
!= ATTACK_MODE_BF
)
18767 induction_dictionaries
= scan_directory (induction_directory
);
18769 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18773 if (induction_dictionaries_cnt
)
18775 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18779 * prevent the user from using --keyspace together w/ maskfile and or dictfile
18783 if ((maskcnt
> 1) || (dictcnt
> 1))
18785 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
18791 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
18793 if (data
.devices_status
== STATUS_CRACKED
) continue;
18794 if (data
.devices_status
== STATUS_ABORTED
) continue;
18795 if (data
.devices_status
== STATUS_QUIT
) continue;
18797 rd
->dictpos
= dictpos
;
18799 char *subid
= logfile_generate_subid ();
18801 data
.subid
= subid
;
18803 logfile_sub_msg ("START");
18805 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18807 data
.devices_status
= STATUS_INIT
;
18810 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
18811 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
18812 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
18814 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
18818 data
.cpt_start
= time (NULL
);
18820 data
.cpt_total
= 0;
18822 if (data
.restore
== 0)
18824 rd
->words_cur
= skip
;
18831 data
.ms_paused
= 0;
18833 data
.kernel_power_final
= 0;
18835 data
.words_cur
= rd
->words_cur
;
18837 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18839 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18841 if (device_param
->skipped
) continue;
18843 device_param
->speed_pos
= 0;
18845 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
18846 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
18848 device_param
->exec_pos
= 0;
18850 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
18852 device_param
->outerloop_pos
= 0;
18853 device_param
->outerloop_left
= 0;
18854 device_param
->innerloop_pos
= 0;
18855 device_param
->innerloop_left
= 0;
18857 // some more resets:
18859 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
18861 device_param
->pws_cnt
= 0;
18863 device_param
->words_off
= 0;
18864 device_param
->words_done
= 0;
18867 // figure out some workload
18869 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18871 if (data
.wordlist_mode
== WL_MODE_FILE
)
18873 char *dictfile
= NULL
;
18875 if (induction_dictionaries_cnt
)
18877 dictfile
= induction_dictionaries
[0];
18881 dictfile
= dictfiles
[dictpos
];
18884 data
.dictfile
= dictfile
;
18886 logfile_sub_string (dictfile
);
18888 for (uint i
= 0; i
< rp_files_cnt
; i
++)
18890 logfile_sub_var_string ("rulefile", rp_files
[i
]);
18893 FILE *fd2
= fopen (dictfile
, "rb");
18897 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18902 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18906 if (data
.words_cnt
== 0)
18908 logfile_sub_msg ("STOP");
18914 else if (attack_mode
== ATTACK_MODE_COMBI
)
18916 char *dictfile
= data
.dictfile
;
18917 char *dictfile2
= data
.dictfile2
;
18919 logfile_sub_string (dictfile
);
18920 logfile_sub_string (dictfile2
);
18922 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
18924 FILE *fd2
= fopen (dictfile
, "rb");
18928 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18933 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18937 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
18939 FILE *fd2
= fopen (dictfile2
, "rb");
18943 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
18948 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
18953 if (data
.words_cnt
== 0)
18955 logfile_sub_msg ("STOP");
18960 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18962 char *dictfile
= NULL
;
18964 if (induction_dictionaries_cnt
)
18966 dictfile
= induction_dictionaries
[0];
18970 dictfile
= dictfiles
[dictpos
];
18973 data
.dictfile
= dictfile
;
18975 char *mask
= data
.mask
;
18977 logfile_sub_string (dictfile
);
18978 logfile_sub_string (mask
);
18980 FILE *fd2
= fopen (dictfile
, "rb");
18984 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18989 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18993 if (data
.words_cnt
== 0)
18995 logfile_sub_msg ("STOP");
19000 else if (attack_mode
== ATTACK_MODE_BF
)
19002 local_free (css_buf
);
19003 local_free (data
.root_css_buf
);
19004 local_free (data
.markov_css_buf
);
19006 char *mask
= dictfiles
[dictpos
];
19008 logfile_sub_string (mask
);
19012 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
19014 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19016 uint css_cnt_unicode
= css_cnt
* 2;
19018 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
19020 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
19022 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
19024 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
19025 css_buf_unicode
[j
+ 1].cs_len
= 1;
19030 css_buf
= css_buf_unicode
;
19031 css_cnt
= css_cnt_unicode
;
19034 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
19036 uint mask_min
= pw_min
;
19037 uint mask_max
= pw_max
;
19039 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19045 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
19047 if (css_cnt
< mask_min
)
19049 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
19052 if (css_cnt
> mask_max
)
19054 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
19057 // skip to next mask
19059 logfile_sub_msg ("STOP");
19064 uint save_css_cnt
= css_cnt
;
19066 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
19068 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
19070 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
19071 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
19073 uint css_cnt_salt
= css_cnt
+ salt_len
;
19075 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
19077 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
19079 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
19081 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
19082 css_buf_salt
[j
].cs_len
= 1;
19087 css_buf
= css_buf_salt
;
19088 css_cnt
= css_cnt_salt
;
19093 data
.css_cnt
= css_cnt
;
19094 data
.css_buf
= css_buf
;
19096 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
19098 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
19100 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
19102 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
19103 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
19105 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
19107 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
19109 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
19110 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
19112 data
.root_css_buf
= root_css_buf
;
19113 data
.markov_css_buf
= markov_css_buf
;
19115 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
19117 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
19119 local_free (root_table_buf
);
19120 local_free (markov_table_buf
);
19124 uint css_cnt_l
= css_cnt
;
19127 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
19129 if (save_css_cnt
< 6)
19133 else if (save_css_cnt
== 6)
19139 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19141 if (save_css_cnt
== 8 || save_css_cnt
== 10)
19152 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
19167 /* unfinished code?
19168 int sum = css_buf[css_cnt_r - 1].cs_len;
19170 for (uint i = 1; i < 4 && i < css_cnt; i++)
19172 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
19176 sum *= css_buf[css_cnt_r - 1].cs_len;
19181 css_cnt_l
-= css_cnt_r
;
19183 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
19185 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19187 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19189 if (device_param
->skipped
) continue;
19191 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
19192 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
19193 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
19195 device_param
->kernel_params_mp_l_buf64
[3] = 0;
19196 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
19197 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
19198 device_param
->kernel_params_mp_l_buf32
[6] = 0;
19199 device_param
->kernel_params_mp_l_buf32
[7] = 0;
19200 device_param
->kernel_params_mp_l_buf32
[8] = 0;
19202 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
19203 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
19204 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
19205 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
19207 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
19208 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
19209 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
19211 device_param
->kernel_params_mp_r_buf64
[3] = 0;
19212 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
19213 device_param
->kernel_params_mp_r_buf32
[5] = 0;
19214 device_param
->kernel_params_mp_r_buf32
[6] = 0;
19215 device_param
->kernel_params_mp_r_buf32
[7] = 0;
19217 cl_int CL_err
= CL_SUCCESS
;
19219 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
19220 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
19221 for (uint i
= 4; i
< 9; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
19223 for (uint i
= 0; i
< 3; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
19224 for (uint i
= 3; i
< 4; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
19225 for (uint i
= 4; i
< 8; i
++) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
19227 if (CL_err
!= CL_SUCCESS
)
19229 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
19234 CL_err
|= 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
);
19235 CL_err
|= 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
);
19237 if (CL_err
!= CL_SUCCESS
)
19239 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
19246 u64 words_base
= data
.words_cnt
;
19248 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19250 if (data
.kernel_rules_cnt
)
19252 words_base
/= data
.kernel_rules_cnt
;
19255 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19257 if (data
.combs_cnt
)
19259 words_base
/= data
.combs_cnt
;
19262 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19266 words_base
/= data
.bfs_cnt
;
19270 data
.words_base
= words_base
;
19274 log_info ("%llu", (unsigned long long int) words_base
);
19279 if (data
.words_cur
> data
.words_base
)
19281 log_error ("ERROR: Restore value greater keyspace");
19286 if (data
.words_cur
)
19288 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19290 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19292 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
19295 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19297 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19299 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
19302 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19304 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19306 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
19312 * Update loopback file
19321 uint random_num
= get_random_num (0, 9999);
19323 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
19325 data
.loopback_file
= loopback_file
;
19329 * Update dictionary statistic
19334 dictstat_fp
= fopen (dictstat
, "wb");
19338 lock_file (dictstat_fp
);
19340 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
19342 fclose (dictstat_fp
);
19347 * create autotune threads
19350 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
19352 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19354 data
.devices_status
= STATUS_AUTOTUNE
;
19357 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19359 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19361 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
19364 hc_thread_wait (data
.devices_cnt
, c_threads
);
19367 * Inform user about possible slow speeds
19370 uint hardware_power_all
= 0;
19372 uint kernel_power_all
= 0;
19374 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19376 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19378 hardware_power_all
+= device_param
->hardware_power
;
19380 kernel_power_all
+= device_param
->kernel_power
;
19383 data
.hardware_power_all
= hardware_power_all
; // hardware_power_all is the same as kernel_power_all but without the influence of kernel_accel on the devices
19385 data
.kernel_power_all
= kernel_power_all
;
19387 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19389 if (data
.words_base
< kernel_power_all
)
19395 log_info ("ATTENTION!");
19396 log_info (" The wordlist or mask you are using is too small.");
19397 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
19398 log_info (" The cracking speed will drop.");
19399 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
19406 * create cracker threads
19409 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19411 data
.devices_status
= STATUS_RUNNING
;
19414 if (initial_restore_done
== 0)
19416 if (data
.restore_disable
== 0) cycle_restore ();
19418 initial_restore_done
= 1;
19421 hc_timer_set (&data
.timer_running
);
19423 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19425 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
19427 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
19428 if (quiet
== 0) fflush (stdout
);
19431 else if (wordlist_mode
== WL_MODE_STDIN
)
19433 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
19434 if (data
.quiet
== 0) log_info ("");
19437 time_t runtime_start
;
19439 time (&runtime_start
);
19441 data
.runtime_start
= runtime_start
;
19443 data
.prepare_time
+= runtime_start
- prepare_start
;
19445 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19447 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19449 if (wordlist_mode
== WL_MODE_STDIN
)
19451 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
19455 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
19459 hc_thread_wait (data
.devices_cnt
, c_threads
);
19461 local_free (c_threads
);
19463 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19465 data
.devices_status
= STATUS_EXHAUSTED
;
19468 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
19472 if (induction_dictionaries_cnt
)
19474 unlink (induction_dictionaries
[0]);
19477 free (induction_dictionaries
);
19479 if (attack_mode
!= ATTACK_MODE_BF
)
19481 induction_dictionaries
= scan_directory (induction_directory
);
19483 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
19486 if (benchmark
== 1)
19488 status_benchmark ();
19490 if (machine_readable
== 0)
19516 if (induction_dictionaries_cnt
)
19518 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
19520 // yeah, this next statement is a little hack to make sure that --loopback runs correctly (because with it we guarantee that the loop iterates one more time)
19525 time_t runtime_stop
;
19527 time (&runtime_stop
);
19529 data
.runtime_stop
= runtime_stop
;
19531 logfile_sub_uint (runtime_start
);
19532 logfile_sub_uint (runtime_stop
);
19534 time (&prepare_start
);
19536 logfile_sub_msg ("STOP");
19538 global_free (subid
);
19540 // from this point we handle bypass as running
19542 if (data
.devices_status
== STATUS_BYPASS
)
19544 data
.devices_status
= STATUS_RUNNING
;
19547 // and overwrite benchmark aborts as well
19549 if (data
.benchmark
== 1)
19551 if (data
.devices_status
== STATUS_ABORTED
)
19553 data
.devices_status
= STATUS_RUNNING
;
19559 if (data
.devices_status
== STATUS_CRACKED
) break;
19560 if (data
.devices_status
== STATUS_ABORTED
) break;
19561 if (data
.devices_status
== STATUS_QUIT
) break;
19564 if (data
.devices_status
== STATUS_CRACKED
) break;
19565 if (data
.devices_status
== STATUS_ABORTED
) break;
19566 if (data
.devices_status
== STATUS_QUIT
) break;
19569 // 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
19570 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
19572 if (data
.wordlist_mode
== WL_MODE_FILE
)
19574 if (data
.dictfile
== NULL
)
19576 if (dictfiles
!= NULL
)
19578 data
.dictfile
= dictfiles
[0];
19580 hc_timer_set (&data
.timer_running
);
19585 // NOTE: combi is okay because it is already set beforehand
19586 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
19588 if (data
.dictfile
== NULL
)
19590 if (dictfiles
!= NULL
)
19592 hc_timer_set (&data
.timer_running
);
19594 data
.dictfile
= dictfiles
[0];
19598 else if (attack_mode
== ATTACK_MODE_BF
)
19600 if (data
.mask
== NULL
)
19602 hc_timer_set (&data
.timer_running
);
19604 data
.mask
= masks
[0];
19608 // if cracked / aborted remove last induction dictionary
19610 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
19612 struct stat induct_stat
;
19614 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
19616 unlink (induction_dictionaries
[file_pos
]);
19620 // wait for inner threads
19622 data
.shutdown_inner
= 1;
19624 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
19626 hc_thread_wait (1, &inner_threads
[thread_idx
]);
19629 local_free (inner_threads
);
19631 // we dont need restore file anymore
19632 if (data
.restore_disable
== 0)
19634 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
19636 unlink (eff_restore_file
);
19637 unlink (new_restore_file
);
19645 // finally save left hashes
19647 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
19656 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19658 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19660 if (device_param
->skipped
) continue;
19662 cl_int CL_err
= CL_SUCCESS
;
19664 local_free (device_param
->combs_buf
);
19665 local_free (device_param
->hooks_buf
);
19666 local_free (device_param
->device_name
);
19667 local_free (device_param
->device_name_chksum
);
19668 local_free (device_param
->device_version
);
19669 local_free (device_param
->driver_version
);
19671 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
19673 if (device_param
->d_pws_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
19674 if (device_param
->d_pws_amp_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
19675 if (device_param
->d_rules
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
19676 if (device_param
->d_rules_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
19677 if (device_param
->d_combs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
19678 if (device_param
->d_combs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
19679 if (device_param
->d_bfs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
19680 if (device_param
->d_bfs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
19681 if (device_param
->d_bitmap_s1_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
19682 if (device_param
->d_bitmap_s1_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
19683 if (device_param
->d_bitmap_s1_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
19684 if (device_param
->d_bitmap_s1_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
19685 if (device_param
->d_bitmap_s2_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
19686 if (device_param
->d_bitmap_s2_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
19687 if (device_param
->d_bitmap_s2_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
19688 if (device_param
->d_bitmap_s2_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
19689 if (device_param
->d_plain_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
19690 if (device_param
->d_digests_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
19691 if (device_param
->d_digests_shown
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
19692 if (device_param
->d_salt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
19693 if (device_param
->d_esalt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
19694 if (device_param
->d_tmps
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
19695 if (device_param
->d_hooks
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
19696 if (device_param
->d_result
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
19697 if (device_param
->d_scryptV0_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
19698 if (device_param
->d_scryptV1_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
19699 if (device_param
->d_scryptV2_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
19700 if (device_param
->d_scryptV3_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
19701 if (device_param
->d_root_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
19702 if (device_param
->d_markov_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
19703 if (device_param
->d_tm_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
19705 if (CL_err
!= CL_SUCCESS
)
19707 log_error ("ERROR: clReleaseMemObject(): %s\n", val2cstr_cl (CL_err
));
19712 if (device_param
->kernel1
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
19713 if (device_param
->kernel12
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
19714 if (device_param
->kernel2
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
19715 if (device_param
->kernel23
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
19716 if (device_param
->kernel3
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
19717 if (device_param
->kernel_mp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
19718 if (device_param
->kernel_mp_l
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
19719 if (device_param
->kernel_mp_r
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
19720 if (device_param
->kernel_tm
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
19721 if (device_param
->kernel_amp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
19722 if (device_param
->kernel_memset
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
19724 if (CL_err
!= CL_SUCCESS
)
19726 log_error ("ERROR: clReleaseKernel(): %s\n", val2cstr_cl (CL_err
));
19731 if (device_param
->program
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program
);
19732 if (device_param
->program_mp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
19733 if (device_param
->program_amp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
19735 if (CL_err
!= CL_SUCCESS
)
19737 log_error ("ERROR: clReleaseProgram(): %s\n", val2cstr_cl (CL_err
));
19742 if (device_param
->command_queue
) CL_err
|= hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
19744 if (CL_err
!= CL_SUCCESS
)
19746 log_error ("ERROR: clReleaseCommandQueue(): %s\n", val2cstr_cl (CL_err
));
19751 if (device_param
->context
) CL_err
|= hc_clReleaseContext (data
.ocl
, device_param
->context
);
19753 if (CL_err
!= CL_SUCCESS
)
19755 log_error ("ERROR: hc_clReleaseContext(): %s\n", val2cstr_cl (CL_err
));
19761 // reset default fan speed
19764 if (gpu_temp_disable
== 0)
19766 if (gpu_temp_retain
!= 0)
19768 hc_thread_mutex_lock (mux_adl
);
19770 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19772 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19774 if (device_param
->skipped
) continue;
19776 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
19780 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
19782 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
19784 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
19787 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
19791 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
19795 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
19799 hc_thread_mutex_unlock (mux_adl
);
19803 // reset power tuning
19805 if (powertune_enable
== 1)
19807 hc_thread_mutex_lock (mux_adl
);
19809 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19811 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19813 if (device_param
->skipped
) continue;
19815 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
19817 if (data
.hm_device
[device_id
].od_version
== 6)
19819 // check powertune capabilities first, if not available then skip device
19821 int powertune_supported
= 0;
19823 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
19825 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
19830 if (powertune_supported
!= 0)
19832 // powercontrol settings
19834 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
19836 log_info ("ERROR: Failed to restore the ADL PowerControl values");
19843 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
19845 performance_state
->iNumberOfPerformanceLevels
= 2;
19847 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
19848 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
19849 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
19850 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
19852 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
19854 log_info ("ERROR: Failed to restore ADL performance state");
19859 local_free (performance_state
);
19864 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
19866 unsigned int limit
= nvml_power_limit
[device_id
];
19870 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
19875 hc_thread_mutex_unlock (mux_adl
);
19878 if (gpu_temp_disable
== 0)
19882 hm_NVML_nvmlShutdown (data
.hm_nvml
);
19884 nvml_close (data
.hm_nvml
);
19886 data
.hm_nvml
= NULL
;
19891 hm_NvAPI_Unload (data
.hm_nvapi
);
19893 nvapi_close (data
.hm_nvapi
);
19895 data
.hm_nvapi
= NULL
;
19898 if (data
.hm_xnvctrl
)
19900 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
19902 xnvctrl_close (data
.hm_xnvctrl
);
19904 data
.hm_xnvctrl
= NULL
;
19909 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
19911 adl_close (data
.hm_adl
);
19913 data
.hm_adl
= NULL
;
19916 #endif // HAVE_HWMON
19920 local_free (masks
);
19922 local_free (dictstat_base
);
19924 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
19926 pot_t
*pot_ptr
= &pot
[pot_pos
];
19928 hash_t
*hash
= &pot_ptr
->hash
;
19930 local_free (hash
->digest
);
19934 local_free (hash
->salt
);
19940 local_free (all_kernel_rules_cnt
);
19941 local_free (all_kernel_rules_buf
);
19943 local_free (wl_data
->buf
);
19944 local_free (wl_data
);
19946 local_free (bitmap_s1_a
);
19947 local_free (bitmap_s1_b
);
19948 local_free (bitmap_s1_c
);
19949 local_free (bitmap_s1_d
);
19950 local_free (bitmap_s2_a
);
19951 local_free (bitmap_s2_b
);
19952 local_free (bitmap_s2_c
);
19953 local_free (bitmap_s2_d
);
19956 local_free (od_clock_mem_status
);
19957 local_free (od_power_control_status
);
19958 local_free (nvml_power_limit
);
19961 global_free (devices_param
);
19963 global_free (kernel_rules_buf
);
19965 global_free (root_css_buf
);
19966 global_free (markov_css_buf
);
19968 global_free (digests_buf
);
19969 global_free (digests_shown
);
19970 global_free (digests_shown_tmp
);
19972 global_free (salts_buf
);
19973 global_free (salts_shown
);
19975 global_free (esalts_buf
);
19977 global_free (words_progress_done
);
19978 global_free (words_progress_rejected
);
19979 global_free (words_progress_restored
);
19981 if (pot_fp
) fclose (pot_fp
);
19983 if (data
.devices_status
== STATUS_QUIT
) break;
19986 // wait for outer threads
19988 data
.shutdown_outer
= 1;
19990 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
19992 hc_thread_wait (1, &outer_threads
[thread_idx
]);
19995 local_free (outer_threads
);
19997 // destroy others mutex
19999 hc_thread_mutex_delete (mux_dispatcher
);
20000 hc_thread_mutex_delete (mux_counter
);
20001 hc_thread_mutex_delete (mux_display
);
20002 hc_thread_mutex_delete (mux_adl
);
20006 local_free (eff_restore_file
);
20007 local_free (new_restore_file
);
20013 tuning_db_destroy (tuning_db
);
20017 local_free (loopback_file
);
20019 if (loopback
== 1) unlink (loopback_file
);
20021 // induction directory
20023 if (induction_dir
== NULL
)
20025 if (attack_mode
!= ATTACK_MODE_BF
)
20027 if (rmdir (induction_directory
) == -1)
20029 if (errno
== ENOENT
)
20031 // good, we can ignore
20033 else if (errno
== ENOTEMPTY
)
20035 // good, we can ignore
20039 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
20045 local_free (induction_directory
);
20049 // outfile-check directory
20051 if (outfile_check_dir
== NULL
)
20053 if (rmdir (outfile_check_directory
) == -1)
20055 if (errno
== ENOENT
)
20057 // good, we can ignore
20059 else if (errno
== ENOTEMPTY
)
20061 // good, we can ignore
20065 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
20071 local_free (outfile_check_directory
);
20078 logfile_top_uint (proc_start
);
20079 logfile_top_uint (proc_stop
);
20081 logfile_top_msg ("STOP");
20083 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
20084 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
20086 if (data
.ocl
) ocl_close (data
.ocl
);
20088 if (data
.devices_status
== STATUS_ABORTED
) return 2;
20089 if (data
.devices_status
== STATUS_QUIT
) return 2;
20090 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
20091 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
20092 if (data
.devices_status
== STATUS_CRACKED
) return 0;