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
83 #define NVIDIA_SPIN_DAMP 100
84 #define GPU_TEMP_DISABLE 0
85 #define GPU_TEMP_ABORT 90
86 #define GPU_TEMP_RETAIN 75
87 #define WORKLOAD_PROFILE 2
88 #define KERNEL_ACCEL 0
89 #define KERNEL_LOOPS 0
90 #define KERNEL_RULES 1024
91 #define KERNEL_COMBS 1024
92 #define KERNEL_BFS 1024
93 #define KERNEL_THREADS_MAX 256
94 #define KERNEL_THREADS_MAX_CPU 1
95 #define POWERTUNE_ENABLE 0
96 #define LOGFILE_DISABLE 0
98 #define OPENCL_VECTOR_WIDTH 0
100 #define WL_MODE_STDIN 1
101 #define WL_MODE_FILE 2
102 #define WL_MODE_MASK 3
104 #define HL_MODE_FILE 4
105 #define HL_MODE_ARG 5
107 #define HLFMTS_CNT 11
108 #define HLFMT_HASHCAT 0
109 #define HLFMT_PWDUMP 1
110 #define HLFMT_PASSWD 2
111 #define HLFMT_SHADOW 3
114 #define HLFMT_NETNTLM1 7
115 #define HLFMT_NETNTLM2 8
116 #define HLFMT_NSLDAP 9
117 #define HLFMT_NSLDAPS 10
119 #define HLFMT_TEXT_HASHCAT "native hashcat"
120 #define HLFMT_TEXT_PWDUMP "pwdump"
121 #define HLFMT_TEXT_PASSWD "passwd"
122 #define HLFMT_TEXT_SHADOW "shadow"
123 #define HLFMT_TEXT_DCC "DCC"
124 #define HLFMT_TEXT_DCC2 "DCC 2"
125 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
126 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
127 #define HLFMT_TEXT_NSLDAP "nsldap"
128 #define HLFMT_TEXT_NSLDAPS "nsldaps"
130 #define ATTACK_MODE_STRAIGHT 0
131 #define ATTACK_MODE_COMBI 1
132 #define ATTACK_MODE_TOGGLE 2
133 #define ATTACK_MODE_BF 3
134 #define ATTACK_MODE_PERM 4
135 #define ATTACK_MODE_TABLE 5
136 #define ATTACK_MODE_HYBRID1 6
137 #define ATTACK_MODE_HYBRID2 7
138 #define ATTACK_MODE_NONE 100
140 #define ATTACK_KERN_STRAIGHT 0
141 #define ATTACK_KERN_COMBI 1
142 #define ATTACK_KERN_BF 3
143 #define ATTACK_KERN_NONE 100
145 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
146 #define ATTACK_EXEC_INSIDE_KERNEL 11
148 #define COMBINATOR_MODE_BASE_LEFT 10001
149 #define COMBINATOR_MODE_BASE_RIGHT 10002
151 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
152 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
154 #define MAX_CUT_TRIES 4
156 #define MAX_DICTSTAT 10000
158 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
160 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
162 #define global_free(attr) \
164 myfree ((void *) data.attr); \
169 #define local_free(attr) \
171 myfree ((void *) attr); \
176 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
177 #define HC_API_CALL __stdcall
182 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
333 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
339 static unsigned int full01
= 0x01010101;
340 static unsigned int full80
= 0x80808080;
342 int SUPPRESS_OUTPUT
= 0;
344 hc_thread_mutex_t mux_adl
;
345 hc_thread_mutex_t mux_counter
;
346 hc_thread_mutex_t mux_dispatcher
;
347 hc_thread_mutex_t mux_display
;
349 hc_global_data_t data
;
351 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
353 const char *USAGE_MINI
[] =
355 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
357 "Try --help for more help.",
361 const char *USAGE_BIG
[] =
363 "%s, advanced password recovery",
365 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
369 " Options Short / Long | Type | Description | Example",
370 "===============================+======+======================================================+=======================",
371 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
372 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
373 " -V, --version | | Print version |",
374 " -h, --help | | Print help |",
375 " --quiet | | Suppress output |",
376 " --hex-charset | | Assume charset is given in hex |",
377 " --hex-salt | | Assume salt is given in hex |",
378 " --hex-wordlist | | Assume words in wordlist is given in hex |",
379 " --force | | Ignore warnings |",
380 " --status | | Enable automatic update of the status-screen |",
381 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
382 " --machine-readable | | Display the status view in a machine readable format |",
383 " --loopback | | Add new plains to induct directory |",
384 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
385 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
386 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
387 " --markov-classic | | Enables classic markov-chains, no per-position |",
388 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
389 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
390 " --session | Str | Define specific session name | --session=mysession",
391 " --restore | | Restore session from --session |",
392 " --restore-disable | | Do not write restore file |",
393 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
394 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
395 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
396 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
397 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
398 " --stdout | | Do not crack a hash, instead print candidates only |",
399 " --show | | Compare hashlist with potfile; Show cracked hashes |",
400 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
401 " --username | | Enable ignoring of usernames in hashfile |",
402 " --remove | | Enable remove of hash once it is cracked |",
403 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
404 " --potfile-disable | | Do not write potfile |",
405 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
406 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
407 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
408 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
409 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
410 " --logfile-disable | | Disable the logfile |",
411 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
412 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
413 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
414 " -b, --benchmark | | Run benchmark |",
415 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
416 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
417 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
418 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
419 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
420 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
421 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
422 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
423 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
424 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
425 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
426 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
427 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
429 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
430 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
431 " --powertune-enable | | Enable power tuning, restores settings when finished |",
433 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
434 " -s, --skip | Num | Skip X words from the start | -s 1000000",
435 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
436 " --keyspace | | Show keyspace base:mod values and quit |",
437 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
438 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
439 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
440 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
441 " --generate-rules-func-min | Num | Force min X funcs per rule |",
442 " --generate-rules-func-max | Num | Force max X funcs per rule |",
443 " --generate-rules-seed | Num | Force RNG seed set to X |",
444 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
445 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
446 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
447 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
448 " -i, --increment | | Enable mask increment mode |",
449 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
450 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
451 " --mangle | | Mangle password before hashing |",
453 "- [ Hash modes ] -",
455 " # | Name | Category",
456 " ======+==================================================+======================================",
457 " 900 | MD4 | Raw Hash",
458 " 0 | MD5 | Raw Hash",
459 " 5100 | Half MD5 | Raw Hash",
460 " 100 | SHA1 | Raw Hash",
461 " 10800 | SHA-384 | Raw Hash",
462 " 1400 | SHA-256 | Raw Hash",
463 " 1700 | SHA-512 | Raw Hash",
464 " 5000 | SHA-3(Keccak) | Raw Hash",
465 " 10100 | SipHash | Raw Hash",
466 " 6000 | RipeMD160 | Raw Hash",
467 " 6100 | Whirlpool | Raw Hash",
468 " 6900 | GOST R 34.11-94 | Raw Hash",
469 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
470 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
471 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
477 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
478 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
479 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
480 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
481 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
482 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
483 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
484 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
485 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
486 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
487 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
488 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
489 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
490 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
491 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
492 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
493 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
494 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
495 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
496 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
497 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
498 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
499 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
500 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
501 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
502 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
503 " 400 | phpass | Generic KDF",
504 " 8900 | scrypt | Generic KDF",
505 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
506 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
507 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
508 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
509 " 23 | Skype | Network protocols",
510 " 2500 | WPA/WPA2 | Network protocols",
511 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
512 " 5300 | IKE-PSK MD5 | Network protocols",
513 " 5400 | IKE-PSK SHA1 | Network protocols",
514 " 5500 | NetNTLMv1 | Network protocols",
515 " 5500 | NetNTLMv1 + ESS | Network protocols",
516 " 5600 | NetNTLMv2 | Network protocols",
517 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
518 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
519 " 8300 | DNSSEC (NSEC3) | Network protocols",
520 " 10200 | Cram MD5 | Network protocols",
521 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
522 " 11200 | MySQL CRAM (SHA1) | Network protocols",
523 " 11400 | SIP digest authentication (MD5) | Network protocols",
524 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
525 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
526 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
527 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
528 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
529 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
530 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
531 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
532 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
533 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
534 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
535 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
536 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
537 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
538 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
539 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
540 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
541 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
542 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
543 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
544 " 12 | PostgreSQL | Database Server",
545 " 131 | MSSQL(2000) | Database Server",
546 " 132 | MSSQL(2005) | Database Server",
547 " 1731 | MSSQL(2012) | Database Server",
548 " 1731 | MSSQL(2014) | Database Server",
549 " 200 | MySQL323 | Database Server",
550 " 300 | MySQL4.1/MySQL5 | Database Server",
551 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
552 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
553 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
554 " 8000 | Sybase ASE | Database Server",
555 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
556 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
557 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
558 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
559 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
560 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
561 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
562 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
563 " 11500 | CRC32 | Checksums",
564 " 3000 | LM | Operating-Systems",
565 " 1000 | NTLM | Operating-Systems",
566 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
567 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
568 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
569 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
570 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
571 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
572 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
573 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
574 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
575 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
576 " 1722 | OSX v10.7 | Operating-Systems",
577 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
578 " 6300 | AIX {smd5} | Operating-Systems",
579 " 6700 | AIX {ssha1} | Operating-Systems",
580 " 6400 | AIX {ssha256} | Operating-Systems",
581 " 6500 | AIX {ssha512} | Operating-Systems",
582 " 2400 | Cisco-PIX | Operating-Systems",
583 " 2410 | Cisco-ASA | Operating-Systems",
584 " 500 | Cisco-IOS $1$ | Operating-Systems",
585 " 5700 | Cisco-IOS $4$ | Operating-Systems",
586 " 9200 | Cisco-IOS $8$ | Operating-Systems",
587 " 9300 | Cisco-IOS $9$ | Operating-Systems",
588 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
589 " 501 | Juniper IVE | Operating-Systems",
590 " 5800 | Android PIN | Operating-Systems",
591 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
592 " 8100 | Citrix Netscaler | Operating-Systems",
593 " 8500 | RACF | Operating-Systems",
594 " 7200 | GRUB 2 | Operating-Systems",
595 " 9900 | Radmin2 | Operating-Systems",
596 " 125 | ArubaOS | Operating-Systems",
597 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
598 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
599 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
600 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
601 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
602 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
603 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
604 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
605 " 11600 | 7-Zip | Archives",
606 " 12500 | RAR3-hp | Archives",
607 " 13000 | RAR5 | Archives",
608 " 13200 | AxCrypt | Archives",
609 " 13300 | AxCrypt in memory SHA1 | Archives",
610 " 13600 | WinZip | Archives",
611 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
612 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
613 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
614 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
615 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
616 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
617 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
618 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
619 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
625 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
626 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
627 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
628 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
629 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
630 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
631 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
632 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
633 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
634 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
635 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
636 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
637 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
638 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
639 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
640 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
641 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
642 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
643 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
644 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
645 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
646 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
647 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
648 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
649 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
650 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
651 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
652 " 9400 | MS Office 2007 | Documents",
653 " 9500 | MS Office 2010 | Documents",
654 " 9600 | MS Office 2013 | Documents",
655 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
656 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
657 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
658 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
659 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
660 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
661 " 9000 | Password Safe v2 | Password Managers",
662 " 5200 | Password Safe v3 | Password Managers",
663 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
664 " 6600 | 1Password, agilekeychain | Password Managers",
665 " 8200 | 1Password, cloudkeychain | Password Managers",
666 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
667 " 12700 | Blockchain, My Wallet | Password Managers",
668 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
670 "- [ Outfile Formats ] -",
676 " 3 | hash[:salt]:plain",
678 " 5 | hash[:salt]:hex_plain",
679 " 6 | plain:hex_plain",
680 " 7 | hash[:salt]:plain:hex_plain",
682 " 9 | hash[:salt]:crack_pos",
683 " 10 | plain:crack_pos",
684 " 11 | hash[:salt]:plain:crack_pos",
685 " 12 | hex_plain:crack_pos",
686 " 13 | hash[:salt]:hex_plain:crack_pos",
687 " 14 | plain:hex_plain:crack_pos",
688 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
690 "- [ Rule Debugging Modes ] -",
695 " 2 | Original-Word",
696 " 3 | Original-Word:Finding-Rule",
697 " 4 | Original-Word:Finding-Rule:Processed-Word",
699 "- [ Attack Modes ] -",
706 " 6 | Hybrid Wordlist + Mask",
707 " 7 | Hybrid Mask + Wordlist",
709 "- [ Built-in Charsets ] -",
713 " l | abcdefghijklmnopqrstuvwxyz",
714 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
716 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
720 "- [ OpenCL Device Types ] -",
723 " ===+=============",
726 " 3 | FPGA, DSP, Co-Processor",
728 "- [ Workload Profiles ] -",
730 " # | Performance | Runtime | Power Consumption | Desktop Impact",
731 " ===+=============+=========+===================+=================",
732 " 1 | Low | 2 ms | Low | Minimal",
733 " 2 | Default | 12 ms | Economic | Noticeable",
734 " 3 | High | 96 ms | High | Unresponsive",
735 " 4 | Nightmare | 480 ms | Insane | Headless",
737 "- [ Basic Examples ] -",
739 " Attack- | Hash- |",
740 " Mode | Type | Example command",
741 " ==================+=======+==================================================================",
742 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
743 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
744 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
745 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
747 "If you still have no idea what just happened try following pages:",
749 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
750 "* https://hashcat.net/wiki/#frequently_asked_questions",
755 * hashcat specific functions
758 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
760 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
762 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
764 double exec_ms_sum
= 0;
768 for (int i
= 0; i
< last_num_entries
; i
++)
770 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
774 exec_ms_sum
+= exec_ms
;
780 if (exec_ms_cnt
== 0) return 0;
782 return exec_ms_sum
/ exec_ms_cnt
;
785 void status_display_machine_readable ()
789 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
795 fprintf (out
, "SPEED\t");
797 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
799 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
801 if (device_param
->skipped
) continue;
806 for (int i
= 0; i
< SPEED_CACHE
; i
++)
808 speed_cnt
+= device_param
->speed_cnt
[i
];
809 speed_ms
+= device_param
->speed_ms
[i
];
812 speed_cnt
/= SPEED_CACHE
;
813 speed_ms
/= SPEED_CACHE
;
815 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
822 fprintf (out
, "EXEC_RUNTIME\t");
824 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
826 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
828 if (device_param
->skipped
) continue;
830 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
832 fprintf (out
, "%f\t", exec_ms_avg
);
839 u64 words_cur
= get_lowest_words_done ();
841 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
847 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
850 u64 all_rejected
= 0;
851 u64 all_restored
= 0;
853 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
855 all_done
+= data
.words_progress_done
[salt_pos
];
856 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
857 all_restored
+= data
.words_progress_restored
[salt_pos
];
860 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
861 u64 progress_end
= progress_total
;
863 u64 progress_skip
= 0;
867 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
869 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
870 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
871 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
876 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
878 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
879 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
880 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
883 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
884 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
886 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
892 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
893 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
900 if (data
.gpu_temp_disable
== 0)
902 fprintf (out
, "TEMP\t");
904 hc_thread_mutex_lock (mux_adl
);
906 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
908 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
910 if (device_param
->skipped
) continue;
912 int temp
= hm_get_temperature_with_device_id (device_id
);
914 fprintf (out
, "%d\t", temp
);
917 hc_thread_mutex_unlock (mux_adl
);
929 void status_display ()
931 if (data
.devices_status
== STATUS_INIT
) return;
932 if (data
.devices_status
== STATUS_STARTING
) return;
934 // in this case some required buffers are free'd, ascii_digest() would run into segfault
935 if (data
.shutdown_inner
== 1) return;
937 if (data
.machine_readable
== 1)
939 status_display_machine_readable ();
944 char tmp_buf
[1000] = { 0 };
948 log_info ("Session.Name...: %s", data
.session
);
950 char *status_type
= strstatus (data
.devices_status
);
952 uint hash_mode
= data
.hash_mode
;
954 char *hash_type
= strhashtype (hash_mode
); // not a bug
956 log_info ("Status.........: %s", status_type
);
962 if (data
.rp_files_cnt
)
966 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
968 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
971 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
973 log_info ("Rules.Type.....: %s", tmp_buf
);
980 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
982 if (data
.rp_gen_seed
)
984 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
992 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
994 if (data
.wordlist_mode
== WL_MODE_FILE
)
996 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
998 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
1000 log_info ("Input.Mode.....: Pipe");
1003 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1005 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1006 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1008 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1010 char *mask
= data
.mask
;
1014 uint mask_len
= data
.css_cnt
;
1016 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1020 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1022 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1024 mask_len
-= data
.salts_buf
[0].salt_len
;
1028 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1030 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1033 if (data
.maskcnt
> 1)
1035 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1037 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1040 log_info ("Input.Mode.....: %s", tmp_buf
);
1045 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1047 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1048 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1050 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1052 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1053 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1056 if (data
.digests_cnt
== 1)
1058 if (data
.hash_mode
== 2500)
1060 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1062 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1063 (char *) data
.salts_buf
[0].salt_buf
,
1077 else if (data
.hash_mode
== 5200)
1079 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1081 else if (data
.hash_mode
== 9000)
1083 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1085 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1087 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1089 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1091 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1095 char out_buf
[HCBUFSIZ
] = { 0 };
1097 ascii_digest (out_buf
, 0, 0);
1100 if (strlen (out_buf
) > 40)
1108 log_info ("Hash.Target....: %s", out_buf
);
1113 if (data
.hash_mode
== 3000)
1115 char out_buf1
[32] = { 0 };
1116 char out_buf2
[32] = { 0 };
1118 ascii_digest (out_buf1
, 0, 0);
1119 ascii_digest (out_buf2
, 0, 1);
1121 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1125 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1129 log_info ("Hash.Type......: %s", hash_type
);
1135 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1136 double speed_ms
[DEVICES_MAX
] = { 0 };
1138 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1140 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1142 if (device_param
->skipped
) continue;
1144 speed_cnt
[device_id
] = 0;
1145 speed_ms
[device_id
] = 0;
1147 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1149 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1150 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1153 speed_cnt
[device_id
] /= SPEED_CACHE
;
1154 speed_ms
[device_id
] /= SPEED_CACHE
;
1157 double hashes_all_ms
= 0;
1159 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1161 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1163 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1165 if (device_param
->skipped
) continue;
1167 hashes_dev_ms
[device_id
] = 0;
1169 if (speed_ms
[device_id
])
1171 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1173 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1181 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1183 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1185 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1187 if (device_param
->skipped
) continue;
1189 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1191 exec_all_ms
[device_id
] = exec_ms_avg
;
1198 double ms_running
= 0;
1200 hc_timer_get (data
.timer_running
, ms_running
);
1202 double ms_paused
= data
.ms_paused
;
1204 if (data
.devices_status
== STATUS_PAUSED
)
1206 double ms_paused_tmp
= 0;
1208 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1210 ms_paused
+= ms_paused_tmp
;
1215 __time64_t sec_run
= ms_running
/ 1000;
1219 time_t sec_run
= ms_running
/ 1000;
1225 char display_run
[32] = { 0 };
1229 struct tm
*tmp
= NULL
;
1233 tmp
= _gmtime64 (&sec_run
);
1237 tmp
= gmtime (&sec_run
);
1243 memset (&tm_run
, 0, sizeof (tm_run
));
1245 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1247 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1249 char *start
= ctime (&data
.proc_start
);
1251 size_t start_len
= strlen (start
);
1253 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1254 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1256 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1261 log_info ("Time.Started...: 0 secs");
1268 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1271 u64 all_rejected
= 0;
1272 u64 all_restored
= 0;
1274 u64 progress_noneed
= 0;
1276 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1278 all_done
+= data
.words_progress_done
[salt_pos
];
1279 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1280 all_restored
+= data
.words_progress_restored
[salt_pos
];
1282 // Important for ETA only
1284 if (data
.salts_shown
[salt_pos
] == 1)
1286 const u64 all
= data
.words_progress_done
[salt_pos
]
1287 + data
.words_progress_rejected
[salt_pos
]
1288 + data
.words_progress_restored
[salt_pos
];
1290 const u64 left
= data
.words_cnt
- all
;
1292 progress_noneed
+= left
;
1296 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1297 u64 progress_end
= progress_total
;
1299 u64 progress_skip
= 0;
1303 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1305 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1306 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1307 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1312 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1314 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1315 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1316 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1319 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1320 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1322 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1324 if (data
.devices_status
!= STATUS_CRACKED
)
1327 __time64_t sec_etc
= 0;
1334 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1336 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1338 sec_etc
= ms_left
/ 1000;
1343 //log_info ("Time.Estimated.: 0 secs");
1345 else if ((u64
) sec_etc
> ETC_MAX
)
1347 log_info ("Time.Estimated.: > 10 Years");
1351 char display_etc
[32] = { 0 };
1352 char display_runtime
[32] = { 0 };
1355 struct tm tm_runtime
;
1357 struct tm
*tmp
= NULL
;
1360 tmp
= _gmtime64 (&sec_etc
);
1362 tmp
= gmtime (&sec_etc
);
1367 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1369 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1377 char *etc
= ctime (&now
);
1379 size_t etc_len
= strlen (etc
);
1381 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1382 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1388 time (&runtime_cur
);
1392 __time64_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1394 tmp
= _gmtime64 (&runtime_left
);
1398 time_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1400 tmp
= gmtime (&runtime_left
);
1404 if ((tmp
!= NULL
) && (runtime_left
> 0) && (runtime_left
< sec_etc
))
1406 memcpy (&tm_runtime
, tmp
, sizeof (tm_runtime
));
1408 format_timer_display (&tm_runtime
, display_runtime
, sizeof (display_runtime
));
1410 log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc
, display_etc
, display_runtime
);
1414 log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc
, display_etc
);
1419 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1426 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1428 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1430 if (device_param
->skipped
) continue;
1432 char display_dev_cur
[16] = { 0 };
1434 strncpy (display_dev_cur
, "0.00", 4);
1436 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1438 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1441 char display_all_cur
[16] = { 0 };
1443 strncpy (display_all_cur
, "0.00", 4);
1445 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1447 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1449 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1450 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1452 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);
1456 if (data
.digests_cnt
> 100)
1458 time_t now
= time (NULL
);
1460 int cpt_cur_min
= 0;
1461 int cpt_cur_hour
= 0;
1462 int cpt_cur_day
= 0;
1464 for (int i
= 0; i
< CPT_BUF
; i
++)
1466 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1467 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1469 if ((timestamp
+ 60) > now
)
1471 cpt_cur_min
+= cracked
;
1474 if ((timestamp
+ 3600) > now
)
1476 cpt_cur_hour
+= cracked
;
1479 if ((timestamp
+ 86400) > now
)
1481 cpt_cur_day
+= cracked
;
1485 double ms_real
= ms_running
- ms_paused
;
1487 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1488 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1489 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1491 if ((data
.cpt_start
+ 86400) < now
)
1493 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1501 else if ((data
.cpt_start
+ 3600) < now
)
1503 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1510 else if ((data
.cpt_start
+ 60) < now
)
1512 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1520 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1529 u64 restore_point
= get_lowest_words_done ();
1531 u64 restore_total
= data
.words_base
;
1533 float percent_restore
= 0;
1535 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1537 if (progress_end_relative_skip
)
1539 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1541 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1542 float percent_rejected
= 0.0;
1546 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1549 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);
1550 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1552 if (data
.restore_disable
== 0)
1554 if (percent_finished
!= 1)
1556 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1563 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1565 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1566 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1568 if (data
.restore_disable
== 0)
1570 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1575 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1576 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1578 // --restore not allowed if stdin is used -- really? why?
1580 //if (data.restore_disable == 0)
1582 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1589 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1590 if (data
.devices_status
== STATUS_CRACKED
) return;
1591 if (data
.devices_status
== STATUS_ABORTED
) return;
1592 if (data
.devices_status
== STATUS_QUIT
) return;
1594 if (data
.gpu_temp_disable
== 0)
1596 hc_thread_mutex_lock (mux_adl
);
1598 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1600 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1602 if (device_param
->skipped
) continue;
1604 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1605 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1606 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1607 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1608 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1609 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1610 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1612 char output_buf
[256] = { 0 };
1616 if (num_temperature
>= 0)
1618 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1620 output_len
= strlen (output_buf
);
1623 if (num_fanspeed
>= 0)
1625 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1627 output_len
= strlen (output_buf
);
1630 if (num_utilization
>= 0)
1632 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1634 output_len
= strlen (output_buf
);
1637 if (num_corespeed
>= 0)
1639 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1641 output_len
= strlen (output_buf
);
1644 if (num_memoryspeed
>= 0)
1646 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1648 output_len
= strlen (output_buf
);
1651 if (num_buslanes
>= 0)
1653 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1655 output_len
= strlen (output_buf
);
1658 if (num_throttle
== 1)
1660 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1662 output_len
= strlen (output_buf
);
1665 if (output_len
== 0)
1667 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1669 output_len
= strlen (output_buf
);
1672 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1675 hc_thread_mutex_unlock (mux_adl
);
1678 #endif // HAVE_HWMON
1681 static void status_benchmark_automate ()
1683 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1684 double speed_ms
[DEVICES_MAX
] = { 0 };
1686 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1688 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1690 if (device_param
->skipped
) continue;
1692 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1693 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1696 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1698 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1700 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1702 if (device_param
->skipped
) continue;
1704 hashes_dev_ms
[device_id
] = 0;
1706 if (speed_ms
[device_id
])
1708 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1712 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1714 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1716 if (device_param
->skipped
) continue;
1718 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1722 static void status_benchmark ()
1724 if (data
.devices_status
== STATUS_INIT
) return;
1725 if (data
.devices_status
== STATUS_STARTING
) return;
1727 if (data
.shutdown_inner
== 1) return;
1729 if (data
.machine_readable
== 1)
1731 status_benchmark_automate ();
1736 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1737 double speed_ms
[DEVICES_MAX
] = { 0 };
1739 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1741 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1743 if (device_param
->skipped
) continue;
1745 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1746 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1749 double hashes_all_ms
= 0;
1751 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1753 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1755 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1757 if (device_param
->skipped
) continue;
1759 hashes_dev_ms
[device_id
] = 0;
1761 if (speed_ms
[device_id
])
1763 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1765 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1773 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1775 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1777 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1779 if (device_param
->skipped
) continue;
1781 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1783 exec_all_ms
[device_id
] = exec_ms_avg
;
1786 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1788 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1790 if (device_param
->skipped
) continue;
1792 char display_dev_cur
[16] = { 0 };
1794 strncpy (display_dev_cur
, "0.00", 4);
1796 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1798 if (data
.devices_active
>= 10)
1800 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1804 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1808 char display_all_cur
[16] = { 0 };
1810 strncpy (display_all_cur
, "0.00", 4);
1812 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1814 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1818 * hashcat -only- functions
1821 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, uint mangle
, char *shared_dir
, char *source_file
)
1823 char const * postfix
= "";
1829 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1831 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1832 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0%s.cl", shared_dir
, (int) kern_type
, postfix
);
1833 else if (attack_kern
== ATTACK_KERN_COMBI
)
1834 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1%s.cl", shared_dir
, (int) kern_type
, postfix
);
1835 else if (attack_kern
== ATTACK_KERN_BF
)
1836 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3%s.cl", shared_dir
, (int) kern_type
, postfix
);
1839 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1842 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, uint mangle
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1844 char const * postfix
= "";
1850 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1852 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1853 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1854 else if (attack_kern
== ATTACK_KERN_COMBI
)
1855 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1856 else if (attack_kern
== ATTACK_KERN_BF
)
1857 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1861 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1865 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1867 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1869 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1873 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1877 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
)
1879 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1881 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1885 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1889 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1891 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1894 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1896 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1899 static char *filename_from_filepath (char *filepath
)
1903 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1907 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1919 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1921 if (line_len
& 1) return (line_len
); // not in hex
1923 if (data
.hex_wordlist
== 1)
1928 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1930 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1933 memset (line_buf
+ i
, 0, line_len
- i
);
1937 else if (line_len
>= 6) // $HEX[] = 6
1939 if (line_buf
[0] != '$') return (line_len
);
1940 if (line_buf
[1] != 'H') return (line_len
);
1941 if (line_buf
[2] != 'E') return (line_len
);
1942 if (line_buf
[3] != 'X') return (line_len
);
1943 if (line_buf
[4] != '[') return (line_len
);
1944 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1949 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1951 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1954 memset (line_buf
+ i
, 0, line_len
- i
);
1962 static void clear_prompt ()
1964 fputc ('\r', stdout
);
1966 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1968 fputc (' ', stdout
);
1971 fputc ('\r', stdout
);
1976 static int gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1978 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
);
1980 if (CL_err
!= CL_SUCCESS
)
1982 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
1990 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1992 char *outfile
= data
.outfile
;
1993 uint quiet
= data
.quiet
;
1994 FILE *pot_fp
= data
.pot_fp
;
1995 uint loopback
= data
.loopback
;
1996 uint debug_mode
= data
.debug_mode
;
1997 char *debug_file
= data
.debug_file
;
1999 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
2000 int debug_rule_len
= 0; // -1 error
2001 uint debug_plain_len
= 0;
2003 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
2007 char out_buf
[HCBUFSIZ
] = { 0 };
2009 const u32 salt_pos
= plain
->salt_pos
;
2010 const u32 digest_pos
= plain
->digest_pos
; // relative
2011 const u32 gidvid
= plain
->gidvid
;
2012 const u32 il_pos
= plain
->il_pos
;
2014 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2018 u64 crackpos
= device_param
->words_off
;
2020 uint plain_buf
[16] = { 0 };
2022 u8
*plain_ptr
= (u8
*) plain_buf
;
2024 unsigned int plain_len
= 0;
2026 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2030 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2032 for (int i
= 0; i
< 16; i
++)
2034 plain_buf
[i
] = pw
.i
[i
];
2037 plain_len
= pw
.pw_len
;
2039 const uint off
= device_param
->innerloop_pos
+ il_pos
;
2046 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
2048 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
2050 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
2054 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
2056 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
2058 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
2060 debug_plain_len
= plain_len
;
2064 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2067 crackpos
*= data
.kernel_rules_cnt
;
2068 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2070 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2072 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2076 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2078 for (int i
= 0; i
< 16; i
++)
2080 plain_buf
[i
] = pw
.i
[i
];
2083 plain_len
= pw
.pw_len
;
2085 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2086 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2088 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2090 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2094 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2096 memcpy (plain_ptr
, comb_buf
, comb_len
);
2099 plain_len
+= comb_len
;
2102 crackpos
*= data
.combs_cnt
;
2103 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2105 if (data
.pw_max
!= PW_DICTMAX1
)
2107 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2110 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2112 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2113 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2115 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2116 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2118 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2119 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2121 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2122 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2124 plain_len
= data
.css_cnt
;
2127 crackpos
*= data
.bfs_cnt
;
2128 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2130 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2134 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2136 for (int i
= 0; i
< 16; i
++)
2138 plain_buf
[i
] = pw
.i
[i
];
2141 plain_len
= pw
.pw_len
;
2143 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2146 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2148 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2150 plain_len
+= start
+ stop
;
2153 crackpos
*= data
.combs_cnt
;
2154 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2156 if (data
.pw_max
!= PW_DICTMAX1
)
2158 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2161 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2165 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2167 for (int i
= 0; i
< 16; i
++)
2169 plain_buf
[i
] = pw
.i
[i
];
2172 plain_len
= pw
.pw_len
;
2174 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2177 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2179 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2181 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2183 plain_len
+= start
+ stop
;
2186 crackpos
*= data
.combs_cnt
;
2187 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2189 if (data
.pw_max
!= PW_DICTMAX1
)
2191 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2195 if (data
.attack_mode
== ATTACK_MODE_BF
)
2197 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2199 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2201 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2203 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2207 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2209 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2211 plain_ptr
[j
] = plain_ptr
[i
];
2214 plain_len
= plain_len
/ 2;
2219 // if enabled, update also the potfile
2225 fprintf (pot_fp
, "%s:", out_buf
);
2227 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2229 fputc ('\n', pot_fp
);
2233 unlock_file (pot_fp
);
2238 FILE *out_fp
= NULL
;
2240 if (outfile
!= NULL
)
2242 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2244 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2255 if (quiet
== 0) clear_prompt ();
2258 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2260 if (outfile
!= NULL
)
2262 if (out_fp
!= stdout
)
2269 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2271 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2273 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2274 if (quiet
== 0) fflush (stdout
);
2283 char *loopback_file
= data
.loopback_file
;
2287 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2291 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2293 fputc ('\n', fb_fp
);
2299 // (rule) debug mode
2301 // the next check implies that:
2302 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2305 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2307 if (debug_rule_len
< 0) debug_rule_len
= 0;
2309 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2311 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2313 if ((quiet
== 0) && (debug_file
== NULL
))
2315 fprintf (stdout
, "%s", PROMPT
);
2322 static int check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2324 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2330 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2332 if (CL_err
!= CL_SUCCESS
)
2334 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2341 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2345 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2347 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
);
2349 if (CL_err
!= CL_SUCCESS
)
2351 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2356 uint cpt_cracked
= 0;
2358 hc_thread_mutex_lock (mux_display
);
2360 for (uint i
= 0; i
< num_cracked
; i
++)
2362 const uint hash_pos
= cracked
[i
].hash_pos
;
2364 if (data
.digests_shown
[hash_pos
] == 1) continue;
2366 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2368 data
.digests_shown
[hash_pos
] = 1;
2370 data
.digests_done
++;
2374 salt_buf
->digests_done
++;
2376 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2378 data
.salts_shown
[salt_pos
] = 1;
2384 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2386 check_hash (device_param
, &cracked
[i
]);
2389 hc_thread_mutex_unlock (mux_display
);
2393 if (cpt_cracked
> 0)
2395 hc_thread_mutex_lock (mux_display
);
2397 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2398 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2402 data
.cpt_total
+= cpt_cracked
;
2404 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2406 hc_thread_mutex_unlock (mux_display
);
2409 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2411 // we need to reset cracked state on the device
2412 // otherwise host thinks again and again the hash was cracked
2413 // and returns invalid password each time
2415 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2417 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
);
2419 if (CL_err
!= CL_SUCCESS
)
2421 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2429 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2431 if (CL_err
!= CL_SUCCESS
)
2433 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2442 // stolen from princeprocessor ;)
2453 static void out_flush (out_t
*out
)
2455 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2460 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2462 char *ptr
= out
->buf
+ out
->len
;
2464 memcpy (ptr
, pw_buf
, pw_len
);
2468 out
->len
+= pw_len
+ 1;
2470 if (out
->len
>= BUFSIZ
- 100)
2476 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2483 uint plain_buf
[16] = { 0 };
2485 u8
*plain_ptr
= (u8
*) plain_buf
;
2489 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2491 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2495 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2497 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2499 const uint pos
= device_param
->innerloop_pos
;
2501 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2503 for (int i
= 0; i
< 8; i
++)
2505 plain_buf
[i
] = pw
.i
[i
];
2508 plain_len
= pw
.pw_len
;
2510 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2512 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2514 out_push (&out
, plain_ptr
, plain_len
);
2518 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2522 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2524 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2526 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2528 for (int i
= 0; i
< 8; i
++)
2530 plain_buf
[i
] = pw
.i
[i
];
2533 plain_len
= pw
.pw_len
;
2535 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2536 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2538 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2540 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2544 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2546 memcpy (plain_ptr
, comb_buf
, comb_len
);
2549 plain_len
+= comb_len
;
2551 if (data
.pw_max
!= PW_DICTMAX1
)
2553 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2556 out_push (&out
, plain_ptr
, plain_len
);
2560 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2562 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2564 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2566 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2567 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2569 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2570 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2572 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2573 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2575 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2576 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2578 plain_len
= data
.css_cnt
;
2580 out_push (&out
, plain_ptr
, plain_len
);
2584 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2588 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2590 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2592 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2594 for (int i
= 0; i
< 8; i
++)
2596 plain_buf
[i
] = pw
.i
[i
];
2599 plain_len
= pw
.pw_len
;
2601 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2604 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2606 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2608 plain_len
+= start
+ stop
;
2610 out_push (&out
, plain_ptr
, plain_len
);
2614 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2618 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2620 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2622 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2624 for (int i
= 0; i
< 8; i
++)
2626 plain_buf
[i
] = pw
.i
[i
];
2629 plain_len
= pw
.pw_len
;
2631 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2634 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2636 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2638 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2640 plain_len
+= start
+ stop
;
2642 out_push (&out
, plain_ptr
, plain_len
);
2650 static void save_hash ()
2652 char *hashfile
= data
.hashfile
;
2654 char new_hashfile
[256] = { 0 };
2655 char old_hashfile
[256] = { 0 };
2657 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2658 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2660 unlink (new_hashfile
);
2662 char separator
= data
.separator
;
2664 FILE *fp
= fopen (new_hashfile
, "wb");
2668 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2673 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2675 if (data
.salts_shown
[salt_pos
] == 1) continue;
2677 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2679 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2681 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2683 if (data
.digests_shown
[idx
] == 1) continue;
2685 if (data
.hash_mode
!= 2500)
2687 if (data
.username
== 1)
2689 user_t
*user
= data
.hash_info
[idx
]->user
;
2693 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2695 fputc (separator
, fp
);
2698 char out_buf
[HCBUFSIZ
]; // scratch buffer
2702 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2704 fputs (out_buf
, fp
);
2712 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2714 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2723 unlink (old_hashfile
);
2725 if (rename (hashfile
, old_hashfile
) != 0)
2727 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2734 if (rename (new_hashfile
, hashfile
) != 0)
2736 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2741 unlink (old_hashfile
);
2744 static int run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2746 cl_int CL_err
= CL_SUCCESS
;
2748 uint num_elements
= num
;
2750 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2751 device_param
->kernel_params_buf32
[34] = num
;
2753 uint kernel_threads
= device_param
->kernel_threads
;
2755 while (num_elements
% kernel_threads
) num_elements
++;
2757 cl_kernel kernel
= NULL
;
2761 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2762 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2763 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2764 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2765 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2768 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2769 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2770 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2771 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2772 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2773 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2774 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2775 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2776 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2777 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2778 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2780 if (CL_err
!= CL_SUCCESS
)
2782 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2789 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2791 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2792 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2794 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2796 if (CL_err
!= CL_SUCCESS
)
2798 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2805 if (kern_run
== KERN_RUN_2
)
2807 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2809 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2813 while (num_elements
% kernel_threads
) num_elements
++;
2815 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2816 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2818 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2820 if (CL_err
!= CL_SUCCESS
)
2822 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2828 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2830 if (CL_err
!= CL_SUCCESS
)
2832 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2837 if (device_param
->nvidia_spin_damp
)
2839 if (data
.devices_status
== STATUS_RUNNING
)
2841 if (iteration
< EXPECTED_ITERATIONS
)
2845 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2846 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2847 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2853 CL_err
= hc_clWaitForEvents (data
.ocl
, 1, &event
);
2855 if (CL_err
!= CL_SUCCESS
)
2857 log_error ("ERROR: clWaitForEvents(): %s\n", val2cstr_cl (CL_err
));
2862 cl_ulong time_start
;
2865 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2866 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2868 if (CL_err
!= CL_SUCCESS
)
2870 log_error ("ERROR: clGetEventProfilingInfo(): %s\n", val2cstr_cl (CL_err
));
2875 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2877 if (data
.devices_status
== STATUS_RUNNING
)
2879 if (iteration
< EXPECTED_ITERATIONS
)
2883 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2884 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2885 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2892 uint exec_pos
= device_param
->exec_pos
;
2894 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2898 if (exec_pos
== EXEC_CACHE
)
2903 device_param
->exec_pos
= exec_pos
;
2906 CL_err
= hc_clReleaseEvent (data
.ocl
, event
);
2908 if (CL_err
!= CL_SUCCESS
)
2910 log_error ("ERROR: clReleaseEvent(): %s\n", val2cstr_cl (CL_err
));
2915 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2917 if (CL_err
!= CL_SUCCESS
)
2919 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
2927 static int run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2929 cl_int CL_err
= CL_SUCCESS
;
2931 uint num_elements
= num
;
2935 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2936 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2937 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2940 // causes problems with special threads like in bcrypt
2941 // const uint kernel_threads = device_param->kernel_threads;
2943 uint kernel_threads
= device_param
->kernel_threads
;
2945 while (num_elements
% kernel_threads
) num_elements
++;
2947 cl_kernel kernel
= NULL
;
2951 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2952 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2953 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2958 case KERN_RUN_MP
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2959 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2960 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2961 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2962 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2963 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2965 case KERN_RUN_MP_R
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2966 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2967 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2968 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2969 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2970 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2972 case KERN_RUN_MP_L
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2973 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2974 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2975 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2976 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2977 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2978 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2982 if (CL_err
!= CL_SUCCESS
)
2984 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2989 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2990 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2992 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2994 if (CL_err
!= CL_SUCCESS
)
2996 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3001 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3003 if (CL_err
!= CL_SUCCESS
)
3005 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3010 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3012 if (CL_err
!= CL_SUCCESS
)
3014 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3022 static int run_kernel_tm (hc_device_param_t
*device_param
)
3024 cl_int CL_err
= CL_SUCCESS
;
3026 const uint num_elements
= 1024; // fixed
3028 uint kernel_threads
= 32;
3030 cl_kernel kernel
= device_param
->kernel_tm
;
3032 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3033 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3035 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3037 if (CL_err
!= CL_SUCCESS
)
3039 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3044 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3046 if (CL_err
!= CL_SUCCESS
)
3048 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3053 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3055 if (CL_err
!= CL_SUCCESS
)
3057 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3065 static int run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
3067 cl_int CL_err
= CL_SUCCESS
;
3069 uint num_elements
= num
;
3071 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
3072 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
3074 // causes problems with special threads like in bcrypt
3075 // const uint kernel_threads = device_param->kernel_threads;
3077 uint kernel_threads
= device_param
->kernel_threads
;
3079 while (num_elements
% kernel_threads
) num_elements
++;
3081 cl_kernel kernel
= device_param
->kernel_amp
;
3083 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
3084 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
3086 if (CL_err
!= CL_SUCCESS
)
3088 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3093 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3094 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3096 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3098 if (CL_err
!= CL_SUCCESS
)
3100 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3105 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3107 if (CL_err
!= CL_SUCCESS
)
3109 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3114 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3116 if (CL_err
!= CL_SUCCESS
)
3118 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3126 static int run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
3128 cl_int CL_err
= CL_SUCCESS
;
3130 const u32 num16d
= num
/ 16;
3131 const u32 num16m
= num
% 16;
3135 device_param
->kernel_params_memset_buf32
[1] = value
;
3136 device_param
->kernel_params_memset_buf32
[2] = num16d
;
3138 uint kernel_threads
= device_param
->kernel_threads
;
3140 uint num_elements
= num16d
;
3142 while (num_elements
% kernel_threads
) num_elements
++;
3144 cl_kernel kernel
= device_param
->kernel_memset
;
3146 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
3147 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
3148 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
3150 if (CL_err
!= CL_SUCCESS
)
3152 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3157 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3158 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3160 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3162 if (CL_err
!= CL_SUCCESS
)
3164 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3169 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3171 if (CL_err
!= CL_SUCCESS
)
3173 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3178 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3180 if (CL_err
!= CL_SUCCESS
)
3182 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3197 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
3199 if (CL_err
!= CL_SUCCESS
)
3201 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3210 static int run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
3212 return run_kernel_memset (device_param
, buf
, 0, size
);
3215 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
)
3217 cl_int CL_err
= CL_SUCCESS
;
3219 if (data
.hash_mode
== 2000)
3221 process_stdout (device_param
, pws_cnt
);
3226 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3228 if (attack_mode
== ATTACK_MODE_BF
)
3230 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
3232 const uint size_tm
= 32 * sizeof (bs_word_t
);
3234 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
3236 run_kernel_tm (device_param
);
3238 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
);
3240 if (CL_err
!= CL_SUCCESS
)
3242 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3249 if (highest_pw_len
< 16)
3251 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
3253 else if (highest_pw_len
< 32)
3255 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3259 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3264 run_kernel_amp (device_param
, pws_cnt
);
3266 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3268 if (opts_type
& OPTS_TYPE_HOOK12
)
3270 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3272 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
);
3274 if (CL_err
!= CL_SUCCESS
)
3276 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3281 // do something with data
3283 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
);
3285 if (CL_err
!= CL_SUCCESS
)
3287 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3293 uint iter
= salt_buf
->salt_iter
;
3295 uint loop_step
= device_param
->kernel_loops
;
3297 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3299 uint loop_left
= iter
- loop_pos
;
3301 loop_left
= MIN (loop_left
, loop_step
);
3303 device_param
->kernel_params_buf32
[28] = loop_pos
;
3304 device_param
->kernel_params_buf32
[29] = loop_left
;
3306 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3308 if (data
.devices_status
== STATUS_CRACKED
) break;
3309 if (data
.devices_status
== STATUS_ABORTED
) break;
3310 if (data
.devices_status
== STATUS_QUIT
) break;
3311 if (data
.devices_status
== STATUS_BYPASS
) break;
3317 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3319 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3323 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3325 const u32 speed_pos
= device_param
->speed_pos
;
3327 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3329 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3331 if (data
.benchmark
== 1)
3333 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3337 if (opts_type
& OPTS_TYPE_HOOK23
)
3339 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3341 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
);
3343 if (CL_err
!= CL_SUCCESS
)
3345 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3350 // do something with data
3352 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
);
3354 if (CL_err
!= CL_SUCCESS
)
3356 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3362 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3368 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3374 else if (rule_len
== 1)
3376 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3382 static int run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3384 cl_int CL_err
= CL_SUCCESS
;
3386 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3388 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
);
3390 if (CL_err
!= CL_SUCCESS
)
3392 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3397 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3399 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3401 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3403 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3405 for (u32 i
= 0; i
< pws_cnt
; i
++)
3407 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3409 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3414 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3416 for (u32 i
= 0; i
< pws_cnt
; i
++)
3418 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3420 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3427 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3429 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3431 for (u32 i
= 0; i
< pws_cnt
; i
++)
3433 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3435 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3440 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3442 for (u32 i
= 0; i
< pws_cnt
; i
++)
3444 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3446 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3453 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
);
3455 if (CL_err
!= CL_SUCCESS
)
3457 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3462 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3464 const u64 off
= device_param
->words_off
;
3466 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3468 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3474 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3476 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3478 device_param
->kernel_params_buf32
[28] = 0;
3479 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3480 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3482 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3484 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3488 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3491 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3493 return exec_ms_prev
;
3496 static int autotune (hc_device_param_t
*device_param
)
3498 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3500 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3501 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3503 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3504 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3506 u32 kernel_accel
= kernel_accel_min
;
3507 u32 kernel_loops
= kernel_loops_min
;
3509 // in this case the user specified a fixed -u and -n on the commandline
3510 // no way to tune anything
3511 // but we need to run a few caching rounds
3513 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3515 if (data
.hash_mode
!= 2000)
3517 try_run (device_param
, kernel_accel
, kernel_loops
);
3518 try_run (device_param
, kernel_accel
, kernel_loops
);
3519 try_run (device_param
, kernel_accel
, kernel_loops
);
3520 try_run (device_param
, kernel_accel
, kernel_loops
);
3523 device_param
->kernel_accel
= kernel_accel
;
3524 device_param
->kernel_loops
= kernel_loops
;
3526 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3528 device_param
->kernel_power
= kernel_power
;
3533 // from here it's clear we are allowed to autotune
3534 // so let's init some fake words
3536 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3538 if (data
.attack_kern
== ATTACK_KERN_BF
)
3540 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3544 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3546 device_param
->pws_buf
[i
].i
[0] = i
;
3547 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3548 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3551 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
);
3553 if (CL_err
!= CL_SUCCESS
)
3555 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3561 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3563 if (data
.kernel_rules_cnt
> 1)
3565 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
);
3567 if (CL_err
!= CL_SUCCESS
)
3569 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3577 run_kernel_amp (device_param
, kernel_power_max
);
3580 #define VERIFIER_CNT 1
3582 // first find out highest kernel-loops that stays below target_ms
3584 if (kernel_loops_min
< kernel_loops_max
)
3586 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3588 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3590 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3592 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3594 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3597 if (exec_ms
< target_ms
) break;
3601 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3603 #define STEPS_CNT 10
3605 if (kernel_accel_min
< kernel_accel_max
)
3607 for (int i
= 0; i
< STEPS_CNT
; i
++)
3609 const u32 kernel_accel_try
= 1u << i
;
3611 if (kernel_accel_try
< kernel_accel_min
) continue;
3612 if (kernel_accel_try
> kernel_accel_max
) break;
3614 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3616 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3618 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3620 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3623 if (exec_ms
> target_ms
) break;
3625 kernel_accel
= kernel_accel_try
;
3629 // at this point we want to know the actual runtime for the following reason:
3630 // we need a reference for the balancing loop following up, and this
3631 // the balancing loop can have an effect that the creates a new opportunity, for example:
3632 // if the target is 95 ms and the current runtime is 48ms the above loop
3633 // stopped the execution because the previous exec_ms was > 95ms
3634 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3635 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3637 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3639 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3641 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3643 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3646 u32 diff
= kernel_loops
- kernel_accel
;
3648 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3650 u32 kernel_accel_orig
= kernel_accel
;
3651 u32 kernel_loops_orig
= kernel_loops
;
3653 for (u32 f
= 1; f
< 1024; f
++)
3655 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3656 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3658 if (kernel_accel_try
> kernel_accel_max
) break;
3659 if (kernel_loops_try
< kernel_loops_min
) break;
3661 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3663 if (diff_new
> diff
) break;
3667 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3669 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3671 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3673 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3676 if (exec_ms
< exec_ms_pre_final
)
3678 exec_ms_pre_final
= exec_ms
;
3680 kernel_accel
= kernel_accel_try
;
3681 kernel_loops
= kernel_loops_try
;
3686 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3688 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3690 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3692 if (exec_accel_min
>= 1.0)
3694 // this is safe to not overflow kernel_accel_max because of accel_left
3696 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3699 // reset them fake words
3702 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3704 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);
3705 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);
3708 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3710 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3712 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3717 device_param
->exec_pos
= 0;
3719 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3721 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3722 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3723 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3727 device_param
->kernel_accel
= kernel_accel
;
3728 device_param
->kernel_loops
= kernel_loops
;
3730 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3732 device_param
->kernel_power
= kernel_power
;
3736 if (data
.quiet
== 0)
3740 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3741 "- Device #%u: autotuned kernel-loops to %u\n",
3742 device_param
->device_id
+ 1, kernel_accel
,
3743 device_param
->device_id
+ 1, kernel_loops
);
3745 fprintf (stdout
, "%s", PROMPT
);
3755 static int run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3757 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3761 uint speed_pos
= device_param
->speed_pos
;
3764 if (device_param
->timer_speed
.tv_sec
== 0)
3766 hc_timer_set (&device_param
->timer_speed
);
3771 if (device_param
->timer_speed
.QuadPart
== 0)
3773 hc_timer_set (&device_param
->timer_speed
);
3777 // find higest password length, this is for optimization stuff
3779 uint highest_pw_len
= 0;
3781 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3784 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3787 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3789 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3790 + device_param
->kernel_params_mp_l_buf32
[5];
3795 uint innerloop_step
= 0;
3796 uint innerloop_cnt
= 0;
3798 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3799 else innerloop_step
= 1;
3801 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3803 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3805 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3807 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3809 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3811 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3813 if (data
.devices_status
== STATUS_CRACKED
) break;
3814 if (data
.devices_status
== STATUS_ABORTED
) break;
3815 if (data
.devices_status
== STATUS_QUIT
) break;
3816 if (data
.devices_status
== STATUS_BYPASS
) break;
3818 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3820 device_param
->kernel_params_buf32
[27] = salt_pos
;
3821 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3822 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3824 FILE *combs_fp
= device_param
->combs_fp
;
3826 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3833 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3835 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3837 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3839 if (data
.devices_status
== STATUS_CRACKED
) break;
3840 if (data
.devices_status
== STATUS_ABORTED
) break;
3841 if (data
.devices_status
== STATUS_QUIT
) break;
3842 if (data
.devices_status
== STATUS_BYPASS
) break;
3844 uint fast_iteration
= 0;
3846 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3848 if (innerloop_left
> innerloop_step
)
3850 innerloop_left
= innerloop_step
;
3855 device_param
->innerloop_pos
= innerloop_pos
;
3856 device_param
->innerloop_left
= innerloop_left
;
3858 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3860 // i think we can get rid of this
3861 if (innerloop_left
== 0)
3863 puts ("bug, how should this happen????\n");
3868 if (data
.salts_shown
[salt_pos
] == 1)
3870 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3875 // initialize amplifiers
3877 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3881 while (i
< innerloop_left
)
3883 if (feof (combs_fp
)) break;
3885 int line_len
= fgetl (combs_fp
, line_buf
);
3887 if (line_len
>= PW_MAX1
) continue;
3889 line_len
= convert_from_hex (line_buf
, line_len
);
3891 char *line_buf_new
= line_buf
;
3893 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3895 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3897 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3899 if (rule_len_out
< 0)
3901 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3906 line_len
= rule_len_out
;
3908 line_buf_new
= rule_buf_out
;
3911 line_len
= MIN (line_len
, PW_DICTMAX
);
3913 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3915 memcpy (ptr
, line_buf_new
, line_len
);
3917 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3919 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3921 uppercase (ptr
, line_len
);
3924 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3926 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3928 ptr
[line_len
] = 0x80;
3931 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3933 ptr
[line_len
] = 0x01;
3937 device_param
->combs_buf
[i
].pw_len
= line_len
;
3942 for (uint j
= i
; j
< innerloop_left
; j
++)
3944 device_param
->combs_buf
[j
].i
[0] = 0;
3945 device_param
->combs_buf
[j
].i
[1] = 0;
3946 device_param
->combs_buf
[j
].i
[2] = 0;
3947 device_param
->combs_buf
[j
].i
[3] = 0;
3948 device_param
->combs_buf
[j
].i
[4] = 0;
3949 device_param
->combs_buf
[j
].i
[5] = 0;
3950 device_param
->combs_buf
[j
].i
[6] = 0;
3951 device_param
->combs_buf
[j
].i
[7] = 0;
3953 device_param
->combs_buf
[j
].pw_len
= 0;
3958 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3960 u64 off
= innerloop_pos
;
3962 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3964 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3966 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3968 u64 off
= innerloop_pos
;
3970 device_param
->kernel_params_mp_buf64
[3] = off
;
3972 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3974 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3976 u64 off
= innerloop_pos
;
3978 device_param
->kernel_params_mp_buf64
[3] = off
;
3980 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3985 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3987 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
);
3989 if (CL_err
!= CL_SUCCESS
)
3991 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3996 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3998 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
);
4000 if (CL_err
!= CL_SUCCESS
)
4002 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
4007 else if (data
.attack_mode
== ATTACK_MODE_BF
)
4009 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
);
4011 if (CL_err
!= CL_SUCCESS
)
4013 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4018 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
4020 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
);
4022 if (CL_err
!= CL_SUCCESS
)
4024 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4029 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
4031 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
);
4033 if (CL_err
!= CL_SUCCESS
)
4035 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4041 if (data
.benchmark
== 1)
4043 hc_timer_set (&device_param
->timer_speed
);
4046 int rc
= choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
4048 if (rc
== -1) return -1;
4050 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4052 if (data
.devices_status
== STATUS_CRACKED
) break;
4053 if (data
.devices_status
== STATUS_ABORTED
) break;
4054 if (data
.devices_status
== STATUS_QUIT
) break;
4055 if (data
.devices_status
== STATUS_BYPASS
) break;
4061 if (data
.benchmark
== 0)
4063 check_cracked (device_param
, salt_pos
);
4070 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
4072 hc_thread_mutex_lock (mux_counter
);
4074 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
4076 hc_thread_mutex_unlock (mux_counter
);
4084 hc_timer_get (device_param
->timer_speed
, speed_ms
);
4086 hc_timer_set (&device_param
->timer_speed
);
4090 //hc_thread_mutex_lock (mux_display);
4092 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
4094 device_param
->speed_ms
[speed_pos
] = speed_ms
;
4096 //hc_thread_mutex_unlock (mux_display);
4100 if (speed_pos
== SPEED_CACHE
)
4109 if (data
.benchmark
== 1) break;
4113 device_param
->speed_pos
= speed_pos
;
4120 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
4122 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
4126 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
4128 wl_data
->buf
[wl_data
->cnt
] = 0;
4130 if (wl_data
->cnt
== 0) return;
4132 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
4136 if (wl_data
->cnt
== wl_data
->avail
)
4138 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
4140 wl_data
->avail
+= wl_data
->incr
;
4143 const int c
= fgetc (fd
);
4145 if (c
== EOF
) break;
4147 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
4151 if (c
== '\n') break;
4154 // ensure stream ends with a newline
4156 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
4160 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
4166 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4170 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4172 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4182 if (*ptr
!= '\n') continue;
4186 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4197 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4201 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4203 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4205 if (*ptr
!= '\n') continue;
4209 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4220 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4224 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4226 if (*ptr
!= '\n') continue;
4230 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4241 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
4243 while (wl_data
->pos
< wl_data
->cnt
)
4248 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
4250 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
4252 wl_data
->pos
+= off
;
4254 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4256 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4258 int rule_len_out
= -1;
4260 if (len
< BLOCK_SIZE
)
4262 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
4265 if (rule_len_out
< 0)
4270 if (rule_len_out
> PW_MAX
)
4291 fprintf (stderr
, "BUG feof()!!\n");
4296 load_segment (wl_data
, fd
);
4298 get_next_word (wl_data
, fd
, out_buf
, out_len
);
4302 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
4306 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
4316 fstat (fileno (fd
), &d
.stat
);
4320 _fstat64 (fileno (fd
), &d
.stat
);
4324 d
.stat
.st_nlink
= 0;
4328 d
.stat
.st_atime
= 0;
4331 d
.stat
.st_blksize
= 0;
4332 d
.stat
.st_blocks
= 0;
4335 if (d
.stat
.st_size
== 0) return 0;
4337 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4339 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
4343 u64 cnt
= d_cache
->cnt
;
4347 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4349 keyspace
*= data
.kernel_rules_cnt
;
4351 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4353 keyspace
*= data
.combs_cnt
;
4356 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
);
4357 if (data
.quiet
== 0) log_info ("");
4359 hc_signal (sigHandler_default
);
4374 load_segment (wl_data
, fd
);
4376 comp
+= wl_data
->cnt
;
4380 while (i
< wl_data
->cnt
)
4385 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4387 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4389 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4391 int rule_len_out
= -1;
4393 if (len
< BLOCK_SIZE
)
4395 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4398 if (rule_len_out
< 0)
4410 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4412 cnt
+= data
.kernel_rules_cnt
;
4414 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4416 cnt
+= data
.combs_cnt
;
4429 if ((now
- prev
) == 0) continue;
4431 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4433 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
);
4438 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
);
4439 if (data
.quiet
== 0) log_info ("");
4441 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4443 hc_signal (sigHandler_default
);
4448 static void *thread_monitor (void *p
)
4450 uint runtime_check
= 0;
4451 uint remove_check
= 0;
4452 uint status_check
= 0;
4453 uint restore_check
= 0;
4455 uint restore_left
= data
.restore_timer
;
4456 uint remove_left
= data
.remove_timer
;
4457 uint status_left
= data
.status_timer
;
4460 uint hwmon_check
= 0;
4462 int slowdown_warnings
= 0;
4464 // these variables are mainly used for fan control
4466 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4468 // temperature controller "loopback" values
4470 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4471 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4473 int temp_threshold
= 1; // degrees celcius
4475 int fan_speed_min
= 15; // in percentage
4476 int fan_speed_max
= 100;
4478 time_t last_temp_check_time
;
4479 #endif // HAVE_HWMON
4481 uint sleep_time
= 1;
4488 if (data
.restore_timer
)
4493 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4498 if (data
.status
== 1)
4504 if (data
.gpu_temp_disable
== 0)
4506 time (&last_temp_check_time
);
4512 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4515 if (hwmon_check
== 0)
4520 while (data
.shutdown_inner
== 0)
4522 hc_sleep (sleep_time
);
4524 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4528 if (hwmon_check
== 1)
4530 hc_thread_mutex_lock (mux_adl
);
4532 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4534 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4536 if (device_param
->skipped
) continue;
4538 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4542 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
;
4543 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
;
4545 memset (&perfPolicies_info
, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
));
4546 memset (&perfPolicies_status
, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
));
4548 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4549 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4551 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4553 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4555 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4557 if (perfPolicies_status
.throttle
& 2)
4559 if (slowdown_warnings
< 3)
4561 if (data
.quiet
== 0) clear_prompt ();
4563 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4565 if (slowdown_warnings
== 2)
4570 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4571 if (data
.quiet
== 0) fflush (stdout
);
4573 slowdown_warnings
++;
4578 slowdown_warnings
= 0;
4584 hc_thread_mutex_unlock (mux_adl
);
4587 if (hwmon_check
== 1)
4589 hc_thread_mutex_lock (mux_adl
);
4591 time_t temp_check_time
;
4593 time (&temp_check_time
);
4595 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4597 if (Ta
== 0) Ta
= 1;
4599 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4601 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4603 if (device_param
->skipped
) continue;
4605 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4607 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4609 if (temperature
> (int) data
.gpu_temp_abort
)
4611 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4613 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4618 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4620 if (gpu_temp_retain
)
4622 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4624 int temp_cur
= temperature
;
4626 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4628 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4630 // calculate Ta value (time difference in seconds between the last check and this check)
4632 last_temp_check_time
= temp_check_time
;
4638 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4640 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
);
4642 if (abs (fan_diff_required
) >= temp_threshold
)
4644 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4646 int fan_speed_level
= fan_speed_cur
;
4648 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4650 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4652 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4653 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4655 if (fan_speed_new
!= fan_speed_cur
)
4657 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4658 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4660 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4662 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4664 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4666 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4669 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4673 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4677 fan_speed_chgd
[device_id
] = 1;
4680 temp_diff_old
[device_id
] = temp_diff_new
;
4687 hc_thread_mutex_unlock (mux_adl
);
4689 #endif // HAVE_HWMON
4691 if (restore_check
== 1)
4695 if (restore_left
== 0)
4697 if (data
.restore_disable
== 0) cycle_restore ();
4699 restore_left
= data
.restore_timer
;
4703 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4707 time (&runtime_cur
);
4709 int runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
4711 if (runtime_left
<= 0)
4713 if (data
.benchmark
== 0)
4715 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4718 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4722 if (remove_check
== 1)
4726 if (remove_left
== 0)
4728 if (data
.digests_saved
!= data
.digests_done
)
4730 data
.digests_saved
= data
.digests_done
;
4735 remove_left
= data
.remove_timer
;
4739 if (status_check
== 1)
4743 if (status_left
== 0)
4745 hc_thread_mutex_lock (mux_display
);
4747 if (data
.quiet
== 0) clear_prompt ();
4749 if (data
.quiet
== 0) log_info ("");
4753 if (data
.quiet
== 0) log_info ("");
4755 hc_thread_mutex_unlock (mux_display
);
4757 status_left
= data
.status_timer
;
4763 myfree (fan_speed_chgd
);
4765 myfree (temp_diff_old
);
4766 myfree (temp_diff_sum
);
4774 static void *thread_outfile_remove (void *p
)
4776 // some hash-dependent constants
4777 char *outfile_dir
= data
.outfile_check_directory
;
4778 uint dgst_size
= data
.dgst_size
;
4779 uint isSalted
= data
.isSalted
;
4780 uint esalt_size
= data
.esalt_size
;
4781 uint hash_mode
= data
.hash_mode
;
4783 uint outfile_check_timer
= data
.outfile_check_timer
;
4785 char separator
= data
.separator
;
4787 // some hash-dependent functions
4788 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4789 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4792 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4794 hash_buf
.digest
= mymalloc (dgst_size
);
4796 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4798 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4800 uint digest_buf
[64] = { 0 };
4802 outfile_data_t
*out_info
= NULL
;
4804 char **out_files
= NULL
;
4806 time_t folder_mtime
= 0;
4810 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4812 while (data
.shutdown_inner
== 0)
4816 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4820 if (check_left
== 0)
4822 struct stat outfile_check_stat
;
4824 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4826 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4830 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4832 char **out_files_new
= scan_directory (outfile_dir
);
4834 int out_cnt_new
= count_dictionaries (out_files_new
);
4836 outfile_data_t
*out_info_new
= NULL
;
4838 if (out_cnt_new
> 0)
4840 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4842 for (int i
= 0; i
< out_cnt_new
; i
++)
4844 out_info_new
[i
].file_name
= out_files_new
[i
];
4846 // check if there are files that we have seen/checked before (and not changed)
4848 for (int j
= 0; j
< out_cnt
; j
++)
4850 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4852 struct stat outfile_stat
;
4854 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4856 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4858 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4859 out_info_new
[i
].seek
= out_info
[j
].seek
;
4867 local_free (out_info
);
4868 local_free (out_files
);
4870 out_files
= out_files_new
;
4871 out_cnt
= out_cnt_new
;
4872 out_info
= out_info_new
;
4874 folder_mtime
= outfile_check_stat
.st_mtime
;
4877 for (int j
= 0; j
< out_cnt
; j
++)
4879 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4883 //hc_thread_mutex_lock (mux_display);
4886 struct stat outfile_stat
;
4888 fstat (fileno (fp
), &outfile_stat
);
4892 struct stat64 outfile_stat
;
4894 _fstat64 (fileno (fp
), &outfile_stat
);
4897 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4899 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4900 out_info
[j
].seek
= 0;
4903 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4905 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4909 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4911 if (ptr
== NULL
) break;
4913 int line_len
= strlen (line_buf
);
4915 if (line_len
<= 0) continue;
4917 int iter
= MAX_CUT_TRIES
;
4919 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4921 if (line_buf
[i
] != separator
) continue;
4923 int parser_status
= PARSER_OK
;
4925 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4927 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4932 if (parser_status
== PARSER_OK
)
4934 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4936 if (data
.salts_shown
[salt_pos
] == 1) continue;
4938 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4940 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4942 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4944 if (data
.digests_shown
[idx
] == 1) continue;
4948 if (hash_mode
== 6800)
4950 if (i
== salt_buf
->salt_len
)
4952 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4955 else if (hash_mode
== 2500)
4957 // BSSID : MAC1 : MAC2 (:plain)
4958 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4960 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4962 if (!cracked
) continue;
4964 // now compare MAC1 and MAC2 too, since we have this additional info
4965 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4966 char *mac2_pos
= mac1_pos
+ 12 + 1;
4968 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4969 wpa_t
*wpa
= &wpas
[salt_pos
];
4971 // compare hex string(s) vs binary MAC address(es)
4973 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4975 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4984 if (!cracked
) continue;
4986 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4988 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4999 char *digests_buf_ptr
= (char *) data
.digests_buf
;
5001 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
5003 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
5010 data
.digests_shown
[idx
] = 1;
5012 data
.digests_done
++;
5014 salt_buf
->digests_done
++;
5016 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
5018 data
.salts_shown
[salt_pos
] = 1;
5022 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
5027 if (data
.devices_status
== STATUS_CRACKED
) break;
5033 if (data
.devices_status
== STATUS_CRACKED
) break;
5038 if (data
.devices_status
== STATUS_CRACKED
) break;
5043 out_info
[j
].seek
= ftell (fp
);
5045 //hc_thread_mutex_unlock (mux_display);
5053 check_left
= outfile_check_timer
;
5057 if (esalt_size
) local_free (hash_buf
.esalt
);
5059 if (isSalted
) local_free (hash_buf
.salt
);
5061 local_free (hash_buf
.digest
);
5063 local_free (out_info
);
5065 local_free (out_files
);
5072 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
5074 //if (device_param->pws_cnt < device_param->kernel_power)
5076 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
5078 u8
*ptr
= (u8
*) pw
->i
;
5080 memcpy (ptr
, pw_buf
, pw_len
);
5082 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
5084 pw
->pw_len
= pw_len
;
5086 device_param
->pws_cnt
++;
5090 // fprintf (stderr, "BUG pw_add()!!\n");
5096 static void set_kernel_power_final (const u64 kernel_power_final
)
5098 if (data
.quiet
== 0)
5104 log_info ("INFO: approaching final keyspace, workload adjusted");
5107 fprintf (stdout
, "%s", PROMPT
);
5112 data
.kernel_power_final
= kernel_power_final
;
5115 static u32
get_power (hc_device_param_t
*device_param
)
5117 const u64 kernel_power_final
= data
.kernel_power_final
;
5119 if (kernel_power_final
)
5121 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
5123 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
5125 // work should be at least the hardware power available without any accelerator
5127 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
5132 return device_param
->kernel_power
;
5135 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
5137 hc_thread_mutex_lock (mux_dispatcher
);
5139 const u64 words_cur
= data
.words_cur
;
5140 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
5142 device_param
->words_off
= words_cur
;
5144 const u64 kernel_power_all
= data
.kernel_power_all
;
5146 const u64 words_left
= words_base
- words_cur
;
5148 if (words_left
< kernel_power_all
)
5150 if (data
.kernel_power_final
== 0)
5152 set_kernel_power_final (words_left
);
5156 const u32 kernel_power
= get_power (device_param
);
5158 uint work
= MIN (words_left
, kernel_power
);
5160 work
= MIN (work
, max
);
5162 data
.words_cur
+= work
;
5164 hc_thread_mutex_unlock (mux_dispatcher
);
5169 static void *thread_autotune (void *p
)
5171 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5173 if (device_param
->skipped
) return NULL
;
5175 autotune (device_param
);
5180 static void *thread_calc_stdin (void *p
)
5182 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5184 if (device_param
->skipped
) return NULL
;
5186 char *buf
= (char *) mymalloc (HCBUFSIZ
);
5188 const uint attack_kern
= data
.attack_kern
;
5190 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5192 hc_thread_mutex_lock (mux_dispatcher
);
5194 if (feof (stdin
) != 0)
5196 hc_thread_mutex_unlock (mux_dispatcher
);
5203 while (words_cur
< device_param
->kernel_power
)
5205 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
5207 if (line_buf
== NULL
) break;
5209 uint line_len
= in_superchop (line_buf
);
5211 line_len
= convert_from_hex (line_buf
, line_len
);
5213 // post-process rule engine
5215 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5217 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5219 int rule_len_out
= -1;
5221 if (line_len
< BLOCK_SIZE
)
5223 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5226 if (rule_len_out
< 0) continue;
5228 line_buf
= rule_buf_out
;
5229 line_len
= rule_len_out
;
5232 if (line_len
> PW_MAX
)
5237 // hmm that's always the case, or?
5239 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5241 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5243 hc_thread_mutex_lock (mux_counter
);
5245 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5247 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5250 hc_thread_mutex_unlock (mux_counter
);
5256 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5260 if (data
.devices_status
== STATUS_CRACKED
) break;
5261 if (data
.devices_status
== STATUS_ABORTED
) break;
5262 if (data
.devices_status
== STATUS_QUIT
) break;
5263 if (data
.devices_status
== STATUS_BYPASS
) break;
5266 hc_thread_mutex_unlock (mux_dispatcher
);
5268 if (data
.devices_status
== STATUS_CRACKED
) break;
5269 if (data
.devices_status
== STATUS_ABORTED
) break;
5270 if (data
.devices_status
== STATUS_QUIT
) break;
5271 if (data
.devices_status
== STATUS_BYPASS
) break;
5275 const uint pws_cnt
= device_param
->pws_cnt
;
5279 run_copy (device_param
, pws_cnt
);
5281 run_cracker (device_param
, pws_cnt
);
5283 device_param
->pws_cnt
= 0;
5287 if (attack_kern == ATTACK_KERN_STRAIGHT)
5289 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5291 else if (attack_kern == ATTACK_KERN_COMBI)
5293 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5299 device_param
->kernel_accel
= 0;
5300 device_param
->kernel_loops
= 0;
5307 static void *thread_calc (void *p
)
5309 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5311 if (device_param
->skipped
) return NULL
;
5313 const uint attack_mode
= data
.attack_mode
;
5314 const uint attack_kern
= data
.attack_kern
;
5316 if (attack_mode
== ATTACK_MODE_BF
)
5318 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5320 const uint work
= get_work (device_param
, -1);
5322 if (work
== 0) break;
5324 const u64 words_off
= device_param
->words_off
;
5325 const u64 words_fin
= words_off
+ work
;
5327 const uint pws_cnt
= work
;
5329 device_param
->pws_cnt
= pws_cnt
;
5333 run_copy (device_param
, pws_cnt
);
5335 run_cracker (device_param
, pws_cnt
);
5337 device_param
->pws_cnt
= 0;
5341 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
5345 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5347 if (data
.devices_status
== STATUS_CRACKED
) break;
5348 if (data
.devices_status
== STATUS_ABORTED
) break;
5349 if (data
.devices_status
== STATUS_QUIT
) break;
5350 if (data
.devices_status
== STATUS_BYPASS
) break;
5352 if (data
.benchmark
== 1) break;
5354 device_param
->words_done
= words_fin
;
5359 const uint segment_size
= data
.segment_size
;
5361 char *dictfile
= data
.dictfile
;
5363 if (attack_mode
== ATTACK_MODE_COMBI
)
5365 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5367 dictfile
= data
.dictfile2
;
5371 FILE *fd
= fopen (dictfile
, "rb");
5375 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5380 if (attack_mode
== ATTACK_MODE_COMBI
)
5382 const uint combs_mode
= data
.combs_mode
;
5384 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5386 const char *dictfilec
= data
.dictfile2
;
5388 FILE *combs_fp
= fopen (dictfilec
, "rb");
5390 if (combs_fp
== NULL
)
5392 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5399 device_param
->combs_fp
= combs_fp
;
5401 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5403 const char *dictfilec
= data
.dictfile
;
5405 FILE *combs_fp
= fopen (dictfilec
, "rb");
5407 if (combs_fp
== NULL
)
5409 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5416 device_param
->combs_fp
= combs_fp
;
5420 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5422 wl_data
->buf
= (char *) mymalloc (segment_size
);
5423 wl_data
->avail
= segment_size
;
5424 wl_data
->incr
= segment_size
;
5430 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5439 const uint work
= get_work (device_param
, max
);
5441 if (work
== 0) break;
5445 words_off
= device_param
->words_off
;
5446 words_fin
= words_off
+ work
;
5451 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5453 for ( ; words_cur
< words_fin
; words_cur
++)
5455 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5457 line_len
= convert_from_hex (line_buf
, line_len
);
5459 // post-process rule engine
5461 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5463 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5465 int rule_len_out
= -1;
5467 if (line_len
< BLOCK_SIZE
)
5469 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5472 if (rule_len_out
< 0) continue;
5474 line_buf
= rule_buf_out
;
5475 line_len
= rule_len_out
;
5478 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5480 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5484 hc_thread_mutex_lock (mux_counter
);
5486 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5488 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5491 hc_thread_mutex_unlock (mux_counter
);
5496 else if (attack_kern
== ATTACK_KERN_COMBI
)
5498 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5499 // since we still need to combine the plains
5501 if (line_len
> data
.pw_max
)
5505 hc_thread_mutex_lock (mux_counter
);
5507 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5509 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5512 hc_thread_mutex_unlock (mux_counter
);
5518 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5520 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5522 if (data
.devices_status
== STATUS_CRACKED
) break;
5523 if (data
.devices_status
== STATUS_ABORTED
) break;
5524 if (data
.devices_status
== STATUS_QUIT
) break;
5525 if (data
.devices_status
== STATUS_BYPASS
) break;
5528 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5530 if (data
.devices_status
== STATUS_CRACKED
) break;
5531 if (data
.devices_status
== STATUS_ABORTED
) break;
5532 if (data
.devices_status
== STATUS_QUIT
) break;
5533 if (data
.devices_status
== STATUS_BYPASS
) break;
5536 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5538 if (data
.devices_status
== STATUS_CRACKED
) break;
5539 if (data
.devices_status
== STATUS_ABORTED
) break;
5540 if (data
.devices_status
== STATUS_QUIT
) break;
5541 if (data
.devices_status
== STATUS_BYPASS
) break;
5547 const uint pws_cnt
= device_param
->pws_cnt
;
5551 run_copy (device_param
, pws_cnt
);
5553 run_cracker (device_param
, pws_cnt
);
5555 device_param
->pws_cnt
= 0;
5559 if (attack_kern == ATTACK_KERN_STRAIGHT)
5561 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5563 else if (attack_kern == ATTACK_KERN_COMBI)
5565 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5570 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5572 if (data
.devices_status
== STATUS_CRACKED
) break;
5573 if (data
.devices_status
== STATUS_ABORTED
) break;
5574 if (data
.devices_status
== STATUS_QUIT
) break;
5575 if (data
.devices_status
== STATUS_BYPASS
) break;
5577 if (words_fin
== 0) break;
5579 device_param
->words_done
= words_fin
;
5582 if (attack_mode
== ATTACK_MODE_COMBI
)
5584 fclose (device_param
->combs_fp
);
5587 free (wl_data
->buf
);
5593 device_param
->kernel_accel
= 0;
5594 device_param
->kernel_loops
= 0;
5599 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5603 log_error ("ERROR: %s : Invalid argument", __func__
);
5608 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5610 device_param
->kernel_params_buf32
[27] = salt_pos
;
5611 device_param
->kernel_params_buf32
[30] = 1;
5612 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5613 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5614 device_param
->kernel_params_buf32
[33] = 0;
5615 device_param
->kernel_params_buf32
[34] = 1;
5617 char *dictfile_old
= data
.dictfile
;
5619 const char *weak_hash_check
= "weak-hash-check";
5621 data
.dictfile
= (char *) weak_hash_check
;
5623 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5625 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5631 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5633 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5637 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5639 uint loop_step
= 16;
5641 const uint iter
= salt_buf
->salt_iter
;
5643 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5645 uint loop_left
= iter
- loop_pos
;
5647 loop_left
= MIN (loop_left
, loop_step
);
5649 device_param
->kernel_params_buf32
[28] = loop_pos
;
5650 device_param
->kernel_params_buf32
[29] = loop_left
;
5652 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5655 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5662 check_cracked (device_param
, salt_pos
);
5668 device_param
->kernel_params_buf32
[27] = 0;
5669 device_param
->kernel_params_buf32
[28] = 0;
5670 device_param
->kernel_params_buf32
[29] = 0;
5671 device_param
->kernel_params_buf32
[30] = 0;
5672 device_param
->kernel_params_buf32
[31] = 0;
5673 device_param
->kernel_params_buf32
[32] = 0;
5674 device_param
->kernel_params_buf32
[33] = 0;
5675 device_param
->kernel_params_buf32
[34] = 0;
5677 data
.dictfile
= dictfile_old
;
5679 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5684 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5686 if (data
.username
== 0)
5688 *hashbuf_pos
= line_buf
;
5689 *hashbuf_len
= line_len
;
5693 char *pos
= line_buf
;
5696 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5698 if (line_buf
[i
] == data
.separator
)
5713 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5720 for (int i
= 0; i
< line_len
; i
++)
5722 if (line_buf
[i
] == data
.separator
)
5731 if (pos
== NULL
) pos
= line_buf
+ i
;
5743 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5750 for (int i
= 0; i
< line_len
; i
++)
5752 if (line_buf
[i
] == ':')
5759 if (sep_cnt
== 2) sep2_len
++;
5760 if (sep_cnt
== 3) sep3_len
++;
5763 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5768 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5775 for (int i
= 0; i
< line_len
; i
++)
5777 if (line_buf
[i
] == ':')
5784 if (data
.hash_mode
== 1000)
5788 if (pos
== NULL
) pos
= line_buf
+ i
;
5793 else if (data
.hash_mode
== 3000)
5797 if (pos
== NULL
) pos
= line_buf
+ i
;
5808 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5815 for (int i
= 0; i
< line_len
; i
++)
5817 if (line_buf
[i
] == ':')
5826 if (pos
== NULL
) pos
= line_buf
+ i
;
5838 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5842 char sep5_first
= 0;
5843 char sep6_first
= 0;
5845 for (int i
= 0; i
< line_len
; i
++)
5847 if (line_buf
[i
] == ':')
5854 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5855 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5858 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5863 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5870 for (int i
= 0; i
< line_len
; i
++)
5872 if (line_buf
[i
] == ':')
5881 if (pos
== NULL
) pos
= line_buf
+ i
;
5891 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5898 for (int i
= 0; i
< line_len
; i
++)
5900 if (line_buf
[i
] == ':')
5909 if (pos
== NULL
) pos
= line_buf
+ i
;
5921 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5925 for (int i
= 0; i
< line_len
; i
++)
5927 if (line_buf
[i
] == ':') sep_cnt
++;
5930 if (sep_cnt
== 8) return 1;
5935 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5937 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5940 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5942 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5947 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5949 switch (hashfile_format
)
5951 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5952 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5953 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5954 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5958 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5960 switch (hashfile_format
)
5962 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5963 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5964 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5965 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5969 char *strhlfmt (const uint hashfile_format
)
5971 switch (hashfile_format
)
5973 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5974 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5975 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5976 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5977 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5978 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5979 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5980 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5981 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5982 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5985 return ((char *) "Unknown");
5988 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5990 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5992 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5993 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5995 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5999 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
6003 int line_len
= fgetl (fp
, line_buf
);
6005 if (line_len
== 0) continue;
6007 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
6008 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
6009 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
6011 if (num_check
== max_check
) break;
6018 uint hashlist_format
= HLFMT_HASHCAT
;
6020 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
6022 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
6024 hashlist_format
= i
;
6029 return hashlist_format
;
6033 * some further helper function
6036 // wrapper around mymalloc for ADL
6038 #if defined(HAVE_HWMON)
6039 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
6041 return mymalloc (iSize
);
6045 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
)
6049 const uint dgst_pos0
= data
.dgst_pos0
;
6050 const uint dgst_pos1
= data
.dgst_pos1
;
6051 const uint dgst_pos2
= data
.dgst_pos2
;
6052 const uint dgst_pos3
= data
.dgst_pos3
;
6054 memset (bitmap_a
, 0, bitmap_size
);
6055 memset (bitmap_b
, 0, bitmap_size
);
6056 memset (bitmap_c
, 0, bitmap_size
);
6057 memset (bitmap_d
, 0, bitmap_size
);
6059 for (uint i
= 0; i
< digests_cnt
; i
++)
6061 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
6063 digests_buf_ptr
+= dgst_size
;
6065 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
6066 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
6067 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
6068 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
6070 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
6071 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
6072 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
6073 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
6075 if (bitmap_a
[idx0
] & val0
) collisions
++;
6076 if (bitmap_b
[idx1
] & val1
) collisions
++;
6077 if (bitmap_c
[idx2
] & val2
) collisions
++;
6078 if (bitmap_d
[idx3
] & val3
) collisions
++;
6080 bitmap_a
[idx0
] |= val0
;
6081 bitmap_b
[idx1
] |= val1
;
6082 bitmap_c
[idx2
] |= val2
;
6083 bitmap_d
[idx3
] |= val3
;
6085 if (collisions
>= collisions_max
) return 0x7fffffff;
6096 void SetConsoleWindowSize (const int x
)
6098 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
6100 if (h
== INVALID_HANDLE_VALUE
) return;
6102 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
6104 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
6106 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
6108 sr
->Right
= MAX (sr
->Right
, x
- 1);
6112 co
.X
= sr
->Right
+ 1;
6115 if (!SetConsoleScreenBufferSize (h
, co
)) return;
6117 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
6121 int main (int argc
, char **argv
)
6124 SetConsoleWindowSize (132);
6128 * To help users a bit
6131 char *compute
= getenv ("COMPUTE");
6135 static char display
[100];
6137 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
6143 if (getenv ("DISPLAY") == NULL
)
6144 putenv ((char *) "DISPLAY=:0");
6147 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
6148 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
6150 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
6151 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
6153 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
6154 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
6156 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
6157 putenv ((char *) "CUDA_CACHE_DISABLE=1");
6159 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
6160 putenv ((char *) "POCL_KERNEL_CACHE=0");
6165 * There's some buggy OpenCL runtime that do not support -I.
6166 * A workaround is to chdir() to the OpenCL folder,
6167 * then compile the kernels,
6168 * then chdir() back to where we came from so we need to save it first
6173 if (getcwd (cwd
, sizeof (cwd
) - 1) == NULL
)
6175 log_error ("ERROR: getcwd(): %s", strerror (errno
));
6184 memset (&data
, 0, sizeof (hc_global_data_t
));
6190 data
.proc_start
= proc_start
;
6192 time_t prepare_start
;
6194 time (&prepare_start
);
6197 char **myargv
= argv
;
6199 hc_thread_mutex_init (mux_dispatcher
);
6200 hc_thread_mutex_init (mux_counter
);
6201 hc_thread_mutex_init (mux_display
);
6202 hc_thread_mutex_init (mux_adl
);
6205 * commandline parameters
6209 uint version
= VERSION
;
6211 uint benchmark
= BENCHMARK
;
6212 uint stdout_flag
= STDOUT_FLAG
;
6215 uint username
= USERNAME
;
6216 uint remove
= REMOVE
;
6217 uint remove_timer
= REMOVE_TIMER
;
6220 uint keyspace
= KEYSPACE
;
6221 uint potfile_disable
= POTFILE_DISABLE
;
6222 char *potfile_path
= NULL
;
6223 uint debug_mode
= DEBUG_MODE
;
6224 char *debug_file
= NULL
;
6225 char *induction_dir
= NULL
;
6226 char *outfile_check_dir
= NULL
;
6228 uint runtime
= RUNTIME
;
6229 uint hash_mode
= HASH_MODE
;
6230 uint attack_mode
= ATTACK_MODE
;
6231 uint markov_disable
= MARKOV_DISABLE
;
6232 uint markov_classic
= MARKOV_CLASSIC
;
6233 uint markov_threshold
= MARKOV_THRESHOLD
;
6234 char *markov_hcstat
= NULL
;
6235 char *outfile
= NULL
;
6236 uint outfile_format
= OUTFILE_FORMAT
;
6237 uint outfile_autohex
= OUTFILE_AUTOHEX
;
6238 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
6239 uint restore
= RESTORE
;
6240 uint restore_timer
= RESTORE_TIMER
;
6241 uint restore_disable
= RESTORE_DISABLE
;
6242 uint status
= STATUS
;
6243 uint status_timer
= STATUS_TIMER
;
6244 uint machine_readable
= MACHINE_READABLE
;
6245 uint loopback
= LOOPBACK
;
6246 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
6247 char *session
= NULL
;
6248 uint hex_charset
= HEX_CHARSET
;
6249 uint hex_salt
= HEX_SALT
;
6250 uint hex_wordlist
= HEX_WORDLIST
;
6251 uint rp_gen
= RP_GEN
;
6252 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
6253 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
6254 uint rp_gen_seed
= RP_GEN_SEED
;
6255 char *rule_buf_l
= (char *) RULE_BUF_L
;
6256 char *rule_buf_r
= (char *) RULE_BUF_R
;
6257 uint increment
= INCREMENT
;
6258 uint increment_min
= INCREMENT_MIN
;
6259 uint increment_max
= INCREMENT_MAX
;
6260 uint mangle
= MANGLE
;
6261 char *cpu_affinity
= NULL
;
6262 OCL_PTR
*ocl
= NULL
;
6263 char *opencl_devices
= NULL
;
6264 char *opencl_platforms
= NULL
;
6265 char *opencl_device_types
= NULL
;
6266 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
6267 char *truecrypt_keyfiles
= NULL
;
6268 char *veracrypt_keyfiles
= NULL
;
6269 uint veracrypt_pim
= 0;
6270 uint workload_profile
= WORKLOAD_PROFILE
;
6271 uint kernel_accel
= KERNEL_ACCEL
;
6272 uint kernel_loops
= KERNEL_LOOPS
;
6273 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
6274 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
6276 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
6277 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
6278 uint powertune_enable
= POWERTUNE_ENABLE
;
6280 uint logfile_disable
= LOGFILE_DISABLE
;
6281 uint segment_size
= SEGMENT_SIZE
;
6282 uint scrypt_tmto
= SCRYPT_TMTO
;
6283 char separator
= SEPARATOR
;
6284 uint bitmap_min
= BITMAP_MIN
;
6285 uint bitmap_max
= BITMAP_MAX
;
6286 char *custom_charset_1
= NULL
;
6287 char *custom_charset_2
= NULL
;
6288 char *custom_charset_3
= NULL
;
6289 char *custom_charset_4
= NULL
;
6291 #define IDX_HELP 'h'
6292 #define IDX_VERSION 'V'
6293 #define IDX_VERSION_LOWER 'v'
6294 #define IDX_QUIET 0xff02
6295 #define IDX_SHOW 0xff03
6296 #define IDX_LEFT 0xff04
6297 #define IDX_REMOVE 0xff05
6298 #define IDX_REMOVE_TIMER 0xff37
6299 #define IDX_SKIP 's'
6300 #define IDX_LIMIT 'l'
6301 #define IDX_KEYSPACE 0xff35
6302 #define IDX_POTFILE_DISABLE 0xff06
6303 #define IDX_POTFILE_PATH 0xffe0
6304 #define IDX_DEBUG_MODE 0xff43
6305 #define IDX_DEBUG_FILE 0xff44
6306 #define IDX_INDUCTION_DIR 0xff46
6307 #define IDX_OUTFILE_CHECK_DIR 0xff47
6308 #define IDX_USERNAME 0xff07
6309 #define IDX_FORCE 0xff08
6310 #define IDX_RUNTIME 0xff09
6311 #define IDX_BENCHMARK 'b'
6312 #define IDX_STDOUT_FLAG 0xff77
6313 #define IDX_HASH_MODE 'm'
6314 #define IDX_ATTACK_MODE 'a'
6315 #define IDX_RP_FILE 'r'
6316 #define IDX_RP_GEN 'g'
6317 #define IDX_RP_GEN_FUNC_MIN 0xff10
6318 #define IDX_RP_GEN_FUNC_MAX 0xff11
6319 #define IDX_RP_GEN_SEED 0xff34
6320 #define IDX_RULE_BUF_L 'j'
6321 #define IDX_RULE_BUF_R 'k'
6322 #define IDX_INCREMENT 'i'
6323 #define IDX_INCREMENT_MIN 0xff12
6324 #define IDX_INCREMENT_MAX 0xff13
6325 #define IDX_MANGLE 0xff80
6326 #define IDX_OUTFILE 'o'
6327 #define IDX_OUTFILE_FORMAT 0xff14
6328 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
6329 #define IDX_OUTFILE_CHECK_TIMER 0xff45
6330 #define IDX_RESTORE 0xff15
6331 #define IDX_RESTORE_DISABLE 0xff27
6332 #define IDX_STATUS 0xff17
6333 #define IDX_STATUS_TIMER 0xff18
6334 #define IDX_MACHINE_READABLE 0xff50
6335 #define IDX_LOOPBACK 0xff38
6336 #define IDX_WEAK_HASH_THRESHOLD 0xff42
6337 #define IDX_SESSION 0xff19
6338 #define IDX_HEX_CHARSET 0xff20
6339 #define IDX_HEX_SALT 0xff21
6340 #define IDX_HEX_WORDLIST 0xff40
6341 #define IDX_MARKOV_DISABLE 0xff22
6342 #define IDX_MARKOV_CLASSIC 0xff23
6343 #define IDX_MARKOV_THRESHOLD 't'
6344 #define IDX_MARKOV_HCSTAT 0xff24
6345 #define IDX_CPU_AFFINITY 0xff25
6346 #define IDX_OPENCL_DEVICES 'd'
6347 #define IDX_OPENCL_PLATFORMS 0xff72
6348 #define IDX_OPENCL_DEVICE_TYPES 'D'
6349 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
6350 #define IDX_WORKLOAD_PROFILE 'w'
6351 #define IDX_KERNEL_ACCEL 'n'
6352 #define IDX_KERNEL_LOOPS 'u'
6353 #define IDX_NVIDIA_SPIN_DAMP 0xff79
6354 #define IDX_GPU_TEMP_DISABLE 0xff29
6355 #define IDX_GPU_TEMP_ABORT 0xff30
6356 #define IDX_GPU_TEMP_RETAIN 0xff31
6357 #define IDX_POWERTUNE_ENABLE 0xff41
6358 #define IDX_LOGFILE_DISABLE 0xff51
6359 #define IDX_TRUECRYPT_KEYFILES 0xff52
6360 #define IDX_VERACRYPT_KEYFILES 0xff53
6361 #define IDX_VERACRYPT_PIM 0xff54
6362 #define IDX_SCRYPT_TMTO 0xff61
6363 #define IDX_SEGMENT_SIZE 'c'
6364 #define IDX_SEPARATOR 'p'
6365 #define IDX_BITMAP_MIN 0xff70
6366 #define IDX_BITMAP_MAX 0xff71
6367 #define IDX_CUSTOM_CHARSET_1 '1'
6368 #define IDX_CUSTOM_CHARSET_2 '2'
6369 #define IDX_CUSTOM_CHARSET_3 '3'
6370 #define IDX_CUSTOM_CHARSET_4 '4'
6372 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
6374 struct option long_options
[] =
6376 {"help", no_argument
, 0, IDX_HELP
},
6377 {"version", no_argument
, 0, IDX_VERSION
},
6378 {"quiet", no_argument
, 0, IDX_QUIET
},
6379 {"show", no_argument
, 0, IDX_SHOW
},
6380 {"left", no_argument
, 0, IDX_LEFT
},
6381 {"username", no_argument
, 0, IDX_USERNAME
},
6382 {"remove", no_argument
, 0, IDX_REMOVE
},
6383 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
6384 {"skip", required_argument
, 0, IDX_SKIP
},
6385 {"limit", required_argument
, 0, IDX_LIMIT
},
6386 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6387 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6388 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6389 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6390 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6391 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6392 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6393 {"force", no_argument
, 0, IDX_FORCE
},
6394 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6395 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6396 {"restore", no_argument
, 0, IDX_RESTORE
},
6397 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6398 {"status", no_argument
, 0, IDX_STATUS
},
6399 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6400 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6401 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6402 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6403 {"session", required_argument
, 0, IDX_SESSION
},
6404 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6405 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6406 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6407 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6408 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6409 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6410 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6411 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6412 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6413 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6414 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6415 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6416 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6417 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6418 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6419 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6420 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6421 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6422 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6423 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6424 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6425 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6426 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6427 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6428 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6429 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6430 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6431 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6432 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6433 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6434 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6436 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6437 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6438 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6439 #endif // HAVE_HWMON
6440 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6441 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6442 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6443 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6444 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6445 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6446 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6447 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6448 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6449 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6450 {"increment", no_argument
, 0, IDX_INCREMENT
},
6451 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6452 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6453 {"mangle", no_argument
, 0, IDX_MANGLE
},
6454 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6455 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6456 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6457 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6461 uint rp_files_cnt
= 0;
6463 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6465 int option_index
= 0;
6471 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6475 case IDX_HELP
: usage
= 1; break;
6477 case IDX_VERSION_LOWER
: version
= 1; break;
6478 case IDX_RESTORE
: restore
= 1; break;
6479 case IDX_SESSION
: session
= optarg
; break;
6480 case IDX_SHOW
: show
= 1; break;
6481 case IDX_LEFT
: left
= 1; break;
6482 case '?': return -1;
6488 log_error ("ERROR: Invalid argument specified");
6499 log_info ("%s", VERSION_TAG
);
6506 usage_big_print (PROGNAME
);
6512 * session needs to be set, always!
6515 if (session
== NULL
) session
= (char *) PROGNAME
;
6518 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6521 char *exec_path
= get_exec_path ();
6524 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
6526 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6527 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6529 if (resolved_install_folder
== NULL
)
6531 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6536 if (resolved_exec_path
== NULL
)
6538 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6543 char *install_dir
= get_install_dir (resolved_exec_path
);
6544 char *profile_dir
= NULL
;
6545 char *session_dir
= NULL
;
6546 char *shared_dir
= NULL
;
6548 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6550 struct passwd
*pw
= getpwuid (getuid ());
6552 const char *homedir
= pw
->pw_dir
;
6554 profile_dir
= get_profile_dir (homedir
);
6555 session_dir
= get_session_dir (profile_dir
);
6556 shared_dir
= strdup (SHARED_FOLDER
);
6558 mkdir (profile_dir
, 0700);
6559 mkdir (session_dir
, 0700);
6563 profile_dir
= install_dir
;
6564 session_dir
= install_dir
;
6565 shared_dir
= install_dir
;
6568 myfree (resolved_install_folder
);
6569 myfree (resolved_exec_path
);
6573 char *install_dir
= get_install_dir (exec_path
);
6574 char *profile_dir
= install_dir
;
6575 char *session_dir
= install_dir
;
6576 char *shared_dir
= install_dir
;
6580 data
.install_dir
= install_dir
;
6581 data
.profile_dir
= profile_dir
;
6582 data
.session_dir
= session_dir
;
6583 data
.shared_dir
= shared_dir
;
6588 * There's alot of problem related to bad support -I parameters when building the kernel.
6589 * Each OpenCL runtime handles it slightly different.
6590 * The most problematic is with new AMD drivers on Windows, which can not handle quote characters!
6591 * The best workaround found so far is to modify the TMP variable (only inside hashcat process) before the runtime is load
6594 char cpath
[1024] = { 0 };
6598 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
6600 char *cpath_real
= mymalloc (MAX_PATH
);
6602 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
6604 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
6611 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
6613 char *cpath_real
= mymalloc (PATH_MAX
);
6615 if (realpath (cpath
, cpath_real
) == NULL
)
6617 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
6624 //if (getenv ("TMP") == NULL)
6629 snprintf (tmp
, sizeof (tmp
) - 1, "TMP=%s", cpath_real
);
6636 naive_replace (cpath_real
, '\\', '/');
6638 // not escaping here, windows using quotes later
6639 // naive_escape (cpath_real, PATH_MAX, ' ', '\\');
6643 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
6648 * kernel cache, we need to make sure folder exist
6651 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6653 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6655 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6657 mkdir (kernels_folder
, 0700);
6659 myfree (kernels_folder
);
6665 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6667 data
.session
= session
;
6669 char *eff_restore_file
= (char *) mymalloc (session_size
);
6670 char *new_restore_file
= (char *) mymalloc (session_size
);
6672 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6673 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6675 data
.eff_restore_file
= eff_restore_file
;
6676 data
.new_restore_file
= new_restore_file
;
6678 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6680 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6681 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6686 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6687 if ((show
== 1) || (left
== 1))
6689 restore_disable
= 1;
6694 data
.restore_disable
= restore_disable
;
6696 restore_data_t
*rd
= init_restore (argc
, argv
);
6706 read_restore (eff_restore_file
, rd
);
6708 if (rd
->version_bin
< RESTORE_MIN
)
6710 log_error ("ERROR: Incompatible restore-file version");
6719 rd
->pid
= getpid ();
6721 rd
->pid
= GetCurrentProcessId ();
6725 uint hash_mode_chgd
= 0;
6726 uint runtime_chgd
= 0;
6727 uint kernel_loops_chgd
= 0;
6728 uint kernel_accel_chgd
= 0;
6729 uint nvidia_spin_damp_chgd
= 0;
6730 uint attack_mode_chgd
= 0;
6731 uint outfile_format_chgd
= 0;
6732 uint rp_gen_seed_chgd
= 0;
6733 uint remove_timer_chgd
= 0;
6734 uint increment_min_chgd
= 0;
6735 uint increment_max_chgd
= 0;
6736 uint workload_profile_chgd
= 0;
6737 uint opencl_vector_width_chgd
= 0;
6743 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6747 //case IDX_HELP: usage = 1; break;
6748 //case IDX_VERSION: version = 1; break;
6749 //case IDX_RESTORE: restore = 1; break;
6750 case IDX_QUIET
: quiet
= 1; break;
6751 //case IDX_SHOW: show = 1; break;
6752 case IDX_SHOW
: break;
6753 //case IDX_LEFT: left = 1; break;
6754 case IDX_LEFT
: break;
6755 case IDX_USERNAME
: username
= 1; break;
6756 case IDX_REMOVE
: remove
= 1; break;
6757 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6758 remove_timer_chgd
= 1; break;
6759 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6760 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6761 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6762 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6763 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6764 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6765 case IDX_FORCE
: force
= 1; break;
6766 case IDX_SKIP
: skip
= atoll (optarg
); break;
6767 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6768 case IDX_KEYSPACE
: keyspace
= 1; break;
6769 case IDX_BENCHMARK
: benchmark
= 1; break;
6770 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6771 case IDX_RESTORE
: break;
6772 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6773 case IDX_STATUS
: status
= 1; break;
6774 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6775 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6776 case IDX_LOOPBACK
: loopback
= 1; break;
6777 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6778 //case IDX_SESSION: session = optarg; break;
6779 case IDX_SESSION
: break;
6780 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6781 hash_mode_chgd
= 1; break;
6782 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6783 runtime_chgd
= 1; break;
6784 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6785 attack_mode_chgd
= 1; break;
6786 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6787 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6788 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6789 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6790 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6791 rp_gen_seed_chgd
= 1; break;
6792 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6793 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6794 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6795 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6796 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6797 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6798 case IDX_OUTFILE
: outfile
= optarg
; break;
6799 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6800 outfile_format_chgd
= 1; break;
6801 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6802 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6803 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6804 case IDX_HEX_SALT
: hex_salt
= 1; break;
6805 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6806 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6807 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6808 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6809 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6810 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6811 opencl_vector_width_chgd
= 1; break;
6812 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6813 workload_profile_chgd
= 1; break;
6814 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6815 kernel_accel_chgd
= 1; break;
6816 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6817 kernel_loops_chgd
= 1; break;
6818 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6819 nvidia_spin_damp_chgd
= 1; break;
6820 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6822 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6823 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6824 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6825 #endif // HAVE_HWMON
6826 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6827 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6828 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6829 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6830 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6831 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6832 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6833 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6834 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6835 case IDX_INCREMENT
: increment
= 1; break;
6836 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6837 increment_min_chgd
= 1; break;
6838 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6839 increment_max_chgd
= 1; break;
6840 case IDX_MANGLE
: mangle
= 1; break;
6841 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6842 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6843 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6844 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6847 log_error ("ERROR: Invalid argument specified");
6854 log_error ("ERROR: Invalid argument specified");
6860 * Inform user things getting started,
6861 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6862 * - we do not need to check algorithm_pos
6869 if (machine_readable
== 0)
6871 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6876 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6879 else if (restore
== 1)
6881 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6884 else if (stdout_flag
== 1)
6888 else if (keyspace
== 1)
6894 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6903 if (attack_mode
> 7)
6905 log_error ("ERROR: Invalid attack-mode specified");
6910 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6912 log_error ("ERROR: Invalid runtime specified");
6917 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6919 log_error ("ERROR: Invalid hash-type specified");
6924 // renamed hash modes
6938 log_error ("Old -m specified, use -m %d instead", n
);
6946 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6948 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6954 if (outfile_format
> 16)
6956 log_error ("ERROR: Invalid outfile-format specified");
6963 if (outfile_format_chgd
== 1)
6965 if (outfile_format
> 1)
6967 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6974 outfile_format
= OUTFILE_FMT_HASH
;
6980 if (outfile_format_chgd
== 1)
6982 if ((outfile_format
> 7) && (outfile_format
< 16))
6984 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6991 if (increment_min
< INCREMENT_MIN
)
6993 log_error ("ERROR: Invalid increment-min specified");
6998 if (increment_max
> INCREMENT_MAX
)
7000 log_error ("ERROR: Invalid increment-max specified");
7005 if (increment_min
> increment_max
)
7007 log_error ("ERROR: Invalid increment-min specified");
7012 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
7014 log_error ("ERROR: Increment is not allowed in attack-mode 0");
7019 if ((increment
== 0) && (increment_min_chgd
== 1))
7021 log_error ("ERROR: Increment-min is only supported combined with increment switch");
7026 if ((increment
== 0) && (increment_max_chgd
== 1))
7028 log_error ("ERROR: Increment-max is only supported combined with increment switch");
7033 if (rp_files_cnt
&& rp_gen
)
7035 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
7040 if (rp_files_cnt
|| rp_gen
)
7042 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7044 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
7050 if (rp_gen_func_min
> rp_gen_func_max
)
7052 log_error ("ERROR: Invalid rp-gen-func-min specified");
7057 if (kernel_accel_chgd
== 1)
7061 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
7062 log_info ("Please consider using the -w option instead");
7063 log_info ("You can use --force to override this but do not post error reports if you do so");
7069 if (kernel_accel
< 1)
7071 log_error ("ERROR: Invalid kernel-accel specified");
7076 if (kernel_accel
> 1024)
7078 log_error ("ERROR: Invalid kernel-accel specified");
7084 if (kernel_loops_chgd
== 1)
7088 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
7089 log_info ("Please consider using the -w option instead");
7090 log_info ("You can use --force to override this but do not post error reports if you do so");
7096 if (kernel_loops
< 1)
7098 log_error ("ERROR: Invalid kernel-loops specified");
7103 if (kernel_loops
> 1024)
7105 log_error ("ERROR: Invalid kernel-loops specified");
7111 if ((workload_profile
< 1) || (workload_profile
> 4))
7113 log_error ("ERROR: workload-profile %i not available", workload_profile
);
7118 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
7120 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
7125 if (show
== 1 || left
== 1)
7127 attack_mode
= ATTACK_MODE_NONE
;
7131 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
7136 if (potfile_disable
== 1)
7138 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
7144 uint attack_kern
= ATTACK_KERN_NONE
;
7146 switch (attack_mode
)
7148 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
7149 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
7150 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
7151 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
7152 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
7157 if (myargv
[optind
] != 0)
7159 log_error ("ERROR: Invalid argument for benchmark mode specified");
7164 if (attack_mode_chgd
== 1)
7166 if (attack_mode
!= ATTACK_MODE_BF
)
7168 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
7176 if (stdout_flag
== 1) // no hash here
7183 int num_additional_params
= 1;
7185 if (attack_kern
== ATTACK_KERN_COMBI
)
7187 num_additional_params
= 2;
7190 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
7192 if (keyspace_wordlist_specified
== 0) optind
--;
7195 if (attack_kern
== ATTACK_KERN_NONE
)
7197 if ((optind
+ 1) != myargc
)
7199 usage_mini_print (myargv
[0]);
7204 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
7206 if ((optind
+ 1) > myargc
)
7208 usage_mini_print (myargv
[0]);
7213 else if (attack_kern
== ATTACK_KERN_COMBI
)
7215 if ((optind
+ 3) != myargc
)
7217 usage_mini_print (myargv
[0]);
7222 else if (attack_kern
== ATTACK_KERN_BF
)
7224 if ((optind
+ 1) > myargc
)
7226 usage_mini_print (myargv
[0]);
7233 usage_mini_print (myargv
[0]);
7239 if (skip
!= 0 && limit
!= 0)
7248 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
7254 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
7259 potfile_disable
= 1;
7261 restore_disable
= 1;
7265 weak_hash_threshold
= 0;
7270 if (stdout_flag
== 1)
7274 restore_disable
= 1;
7276 potfile_disable
= 1;
7277 weak_hash_threshold
= 0;
7278 gpu_temp_disable
= 1;
7281 outfile_format
= OUTFILE_FMT_PLAIN
;
7282 kernel_accel
= 1024;
7283 kernel_loops
= 1024;
7285 outfile_check_timer
= 0;
7287 opencl_vector_width
= 1;
7290 if (remove_timer_chgd
== 1)
7294 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
7299 if (remove_timer
< 1)
7301 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
7309 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
7311 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7313 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
7320 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
7328 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7330 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
7335 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7337 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
7345 log_error ("ERROR: Invalid debug-mode specified");
7350 if (debug_file
!= NULL
)
7354 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
7360 if (induction_dir
!= NULL
)
7362 if (attack_mode
== ATTACK_MODE_BF
)
7364 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
7370 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7372 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
7374 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
7379 weak_hash_threshold
= 0;
7382 if (nvidia_spin_damp
> 100)
7384 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
7391 * induction directory
7394 char *induction_directory
= NULL
;
7396 if (attack_mode
!= ATTACK_MODE_BF
)
7398 if (induction_dir
== NULL
)
7400 induction_directory
= (char *) mymalloc (session_size
);
7402 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
7404 // create induction folder if it does not already exist
7408 if (rmdir (induction_directory
) == -1)
7410 if (errno
== ENOENT
)
7412 // good, we can ignore
7414 else if (errno
== ENOTEMPTY
)
7416 char *induction_directory_mv
= (char *) mymalloc (session_size
);
7418 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
7420 if (rename (induction_directory
, induction_directory_mv
) != 0)
7422 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
7429 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7435 if (mkdir (induction_directory
, 0700) == -1)
7437 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7445 induction_directory
= induction_dir
;
7449 data
.induction_directory
= induction_directory
;
7455 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7457 char *loopback_file
= (char *) mymalloc (loopback_size
);
7463 char tuning_db_file
[256] = { 0 };
7465 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7467 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7470 * outfile-check directory
7473 char *outfile_check_directory
= NULL
;
7475 if (outfile_check_dir
== NULL
)
7477 outfile_check_directory
= (char *) mymalloc (session_size
);
7479 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7483 outfile_check_directory
= outfile_check_dir
;
7486 data
.outfile_check_directory
= outfile_check_directory
;
7490 struct stat outfile_check_stat
;
7492 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7494 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7498 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7503 else if (outfile_check_dir
== NULL
)
7505 if (mkdir (outfile_check_directory
, 0700) == -1)
7507 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7515 * special other stuff
7518 if (hash_mode
== 9710)
7521 outfile_format_chgd
= 1;
7524 if (hash_mode
== 9810)
7527 outfile_format_chgd
= 1;
7530 if (hash_mode
== 10410)
7533 outfile_format_chgd
= 1;
7540 data
.hash_mode
= hash_mode
;
7541 data
.restore
= restore
;
7542 data
.restore_timer
= restore_timer
;
7543 data
.restore_disable
= restore_disable
;
7544 data
.status
= status
;
7545 data
.status_timer
= status_timer
;
7546 data
.machine_readable
= machine_readable
;
7547 data
.loopback
= loopback
;
7548 data
.runtime
= runtime
;
7549 data
.remove
= remove
;
7550 data
.remove_timer
= remove_timer
;
7551 data
.debug_mode
= debug_mode
;
7552 data
.debug_file
= debug_file
;
7553 data
.username
= username
;
7555 data
.outfile
= outfile
;
7556 data
.outfile_format
= outfile_format
;
7557 data
.outfile_autohex
= outfile_autohex
;
7558 data
.hex_charset
= hex_charset
;
7559 data
.hex_salt
= hex_salt
;
7560 data
.hex_wordlist
= hex_wordlist
;
7561 data
.separator
= separator
;
7562 data
.rp_files
= rp_files
;
7563 data
.rp_files_cnt
= rp_files_cnt
;
7564 data
.rp_gen
= rp_gen
;
7565 data
.rp_gen_seed
= rp_gen_seed
;
7567 data
.benchmark
= benchmark
;
7571 data
.powertune_enable
= powertune_enable
;
7573 data
.logfile_disable
= logfile_disable
;
7574 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7575 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7576 data
.veracrypt_pim
= veracrypt_pim
;
7577 data
.scrypt_tmto
= scrypt_tmto
;
7578 data
.workload_profile
= workload_profile
;
7586 set_cpu_affinity (cpu_affinity
);
7589 if (rp_gen_seed_chgd
== 0)
7595 srand (rp_gen_seed
);
7602 if (logfile_disable
== 0)
7604 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7606 char *logfile
= (char *) mymalloc (logfile_size
);
7608 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7610 data
.logfile
= logfile
;
7612 char *topid
= logfile_generate_topid ();
7617 // logfile_append() checks for logfile_disable internally to make it easier from here
7619 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7620 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7621 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7622 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7623 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7624 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7625 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7626 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7627 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7628 #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));
7630 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7631 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7632 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7633 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7634 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7635 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7636 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7637 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7639 logfile_top_msg ("START");
7641 logfile_top_uint (attack_mode
);
7642 logfile_top_uint (attack_kern
);
7643 logfile_top_uint (benchmark
);
7644 logfile_top_uint (stdout_flag
);
7645 logfile_top_uint (bitmap_min
);
7646 logfile_top_uint (bitmap_max
);
7647 logfile_top_uint (debug_mode
);
7648 logfile_top_uint (force
);
7649 logfile_top_uint (kernel_accel
);
7650 logfile_top_uint (kernel_loops
);
7651 logfile_top_uint (nvidia_spin_damp
);
7652 logfile_top_uint (gpu_temp_disable
);
7654 logfile_top_uint (gpu_temp_abort
);
7655 logfile_top_uint (gpu_temp_retain
);
7657 logfile_top_uint (hash_mode
);
7658 logfile_top_uint (hex_charset
);
7659 logfile_top_uint (hex_salt
);
7660 logfile_top_uint (hex_wordlist
);
7661 logfile_top_uint (increment
);
7662 logfile_top_uint (increment_max
);
7663 logfile_top_uint (increment_min
);
7664 logfile_top_uint (mangle
);
7665 logfile_top_uint (keyspace
);
7666 logfile_top_uint (left
);
7667 logfile_top_uint (logfile_disable
);
7668 logfile_top_uint (loopback
);
7669 logfile_top_uint (markov_classic
);
7670 logfile_top_uint (markov_disable
);
7671 logfile_top_uint (markov_threshold
);
7672 logfile_top_uint (outfile_autohex
);
7673 logfile_top_uint (outfile_check_timer
);
7674 logfile_top_uint (outfile_format
);
7675 logfile_top_uint (potfile_disable
);
7676 logfile_top_string (potfile_path
);
7677 #if defined(HAVE_HWMON)
7678 logfile_top_uint (powertune_enable
);
7680 logfile_top_uint (scrypt_tmto
);
7681 logfile_top_uint (quiet
);
7682 logfile_top_uint (remove
);
7683 logfile_top_uint (remove_timer
);
7684 logfile_top_uint (restore
);
7685 logfile_top_uint (restore_disable
);
7686 logfile_top_uint (restore_timer
);
7687 logfile_top_uint (rp_gen
);
7688 logfile_top_uint (rp_gen_func_max
);
7689 logfile_top_uint (rp_gen_func_min
);
7690 logfile_top_uint (rp_gen_seed
);
7691 logfile_top_uint (runtime
);
7692 logfile_top_uint (segment_size
);
7693 logfile_top_uint (show
);
7694 logfile_top_uint (status
);
7695 logfile_top_uint (machine_readable
);
7696 logfile_top_uint (status_timer
);
7697 logfile_top_uint (usage
);
7698 logfile_top_uint (username
);
7699 logfile_top_uint (version
);
7700 logfile_top_uint (weak_hash_threshold
);
7701 logfile_top_uint (workload_profile
);
7702 logfile_top_uint64 (limit
);
7703 logfile_top_uint64 (skip
);
7704 logfile_top_char (separator
);
7705 logfile_top_string (cpu_affinity
);
7706 logfile_top_string (custom_charset_1
);
7707 logfile_top_string (custom_charset_2
);
7708 logfile_top_string (custom_charset_3
);
7709 logfile_top_string (custom_charset_4
);
7710 logfile_top_string (debug_file
);
7711 logfile_top_string (opencl_devices
);
7712 logfile_top_string (opencl_platforms
);
7713 logfile_top_string (opencl_device_types
);
7714 logfile_top_uint (opencl_vector_width
);
7715 logfile_top_string (induction_dir
);
7716 logfile_top_string (markov_hcstat
);
7717 logfile_top_string (outfile
);
7718 logfile_top_string (outfile_check_dir
);
7719 logfile_top_string (rule_buf_l
);
7720 logfile_top_string (rule_buf_r
);
7721 logfile_top_string (session
);
7722 logfile_top_string (truecrypt_keyfiles
);
7723 logfile_top_string (veracrypt_keyfiles
);
7724 logfile_top_uint (veracrypt_pim
);
7727 * Init OpenCL library loader
7732 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7740 * OpenCL platform selection
7743 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7746 * OpenCL device selection
7749 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7752 * OpenCL device type selection
7755 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7764 * disable useless stuff for benchmark
7769 restore_disable
= 1;
7770 potfile_disable
= 1;
7771 weak_hash_threshold
= 0;
7772 nvidia_spin_damp
= 0;
7773 gpu_temp_disable
= 1;
7774 outfile_check_timer
= 0;
7777 if (powertune_enable
== 1)
7779 gpu_temp_disable
= 0;
7783 data
.status_timer
= status_timer
;
7784 data
.restore_timer
= restore_timer
;
7785 data
.restore_disable
= restore_disable
;
7786 data
.outfile_check_timer
= outfile_check_timer
;
7789 * force attack mode to be bruteforce
7792 attack_mode
= ATTACK_MODE_BF
;
7793 attack_kern
= ATTACK_KERN_BF
;
7795 if (workload_profile_chgd
== 0)
7797 workload_profile
= 3;
7799 data
.workload_profile
= workload_profile
;
7804 * status, monitor and outfile remove threads
7807 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7809 data
.wordlist_mode
= wordlist_mode
;
7811 if (wordlist_mode
== WL_MODE_STDIN
)
7815 data
.status
= status
;
7818 uint outer_threads_cnt
= 0;
7820 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7822 data
.shutdown_outer
= 0;
7824 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7826 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7828 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7830 outer_threads_cnt
++;
7840 uint attack_exec
= 0;
7844 uint esalt_size
= 0;
7846 uint dgst_pos0
= -1;
7847 uint dgst_pos1
= -1;
7848 uint dgst_pos2
= -1;
7849 uint dgst_pos3
= -1;
7851 int (*parse_func
) (char *, uint
, hash_t
*);
7852 int (*sort_by_digest
) (const void *, const void *);
7854 uint algorithm_pos
= 0;
7855 uint algorithm_max
= 1;
7857 uint
*algorithms
= default_benchmark_algorithms
;
7859 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7861 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7864 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7865 * the following algos are skipped entirely
7868 if (algorithm_pos
> 0)
7872 rd
= init_restore (argc
, argv
);
7878 * update hash_mode in case of multihash benchmark
7883 if (hash_mode_chgd
== 0)
7885 hash_mode
= algorithms
[algorithm_pos
];
7887 data
.hash_mode
= hash_mode
;
7897 case 0: hash_type
= HASH_TYPE_MD5
;
7898 salt_type
= SALT_TYPE_NONE
;
7899 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7901 | OPTS_TYPE_PT_ADD80
7902 | OPTS_TYPE_PT_ADDBITS14
;
7903 kern_type
= KERN_TYPE_MD5
;
7904 dgst_size
= DGST_SIZE_4_4
;
7905 parse_func
= md5_parse_hash
;
7906 sort_by_digest
= sort_by_digest_4_4
;
7907 opti_type
= OPTI_TYPE_ZERO_BYTE
7908 | OPTI_TYPE_PRECOMPUTE_INIT
7909 | OPTI_TYPE_PRECOMPUTE_MERKLE
7910 | OPTI_TYPE_MEET_IN_MIDDLE
7911 | OPTI_TYPE_EARLY_SKIP
7912 | OPTI_TYPE_NOT_ITERATED
7913 | OPTI_TYPE_NOT_SALTED
7914 | OPTI_TYPE_RAW_HASH
;
7922 case 1: hash_type
= HASH_TYPE_MD5
;
7923 salt_type
= SALT_TYPE_NONE
;
7924 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7926 | OPTS_TYPE_PT_ADD80
7927 | OPTS_TYPE_PT_ADDBITS14
;
7928 kern_type
= KERN_TYPE_MD5
;
7929 dgst_size
= DGST_SIZE_4_4
;
7930 parse_func
= md5_parse_hash
;
7931 sort_by_digest
= sort_by_digest_4_4
;
7932 opti_type
= OPTI_TYPE_ZERO_BYTE
7933 | OPTI_TYPE_PRECOMPUTE_INIT
7934 | OPTI_TYPE_PRECOMPUTE_MERKLE
7935 | OPTI_TYPE_MEET_IN_MIDDLE
7936 | OPTI_TYPE_EARLY_SKIP
7937 | OPTI_TYPE_NOT_ITERATED
7938 | OPTI_TYPE_NOT_SALTED
7939 | OPTI_TYPE_RAW_HASH
;
7947 case 10: hash_type
= HASH_TYPE_MD5
;
7948 salt_type
= SALT_TYPE_INTERN
;
7949 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7950 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7951 | OPTS_TYPE_ST_ADD80
7952 | OPTS_TYPE_ST_ADDBITS14
;
7953 kern_type
= KERN_TYPE_MD5_PWSLT
;
7954 dgst_size
= DGST_SIZE_4_4
;
7955 parse_func
= md5s_parse_hash
;
7956 sort_by_digest
= sort_by_digest_4_4
;
7957 opti_type
= OPTI_TYPE_ZERO_BYTE
7958 | OPTI_TYPE_PRECOMPUTE_INIT
7959 | OPTI_TYPE_PRECOMPUTE_MERKLE
7960 | OPTI_TYPE_MEET_IN_MIDDLE
7961 | OPTI_TYPE_EARLY_SKIP
7962 | OPTI_TYPE_NOT_ITERATED
7963 | OPTI_TYPE_APPENDED_SALT
7964 | OPTI_TYPE_RAW_HASH
;
7971 case 11: hash_type
= HASH_TYPE_MD5
;
7972 salt_type
= SALT_TYPE_INTERN
;
7973 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7974 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7975 | OPTS_TYPE_ST_ADD80
7976 | OPTS_TYPE_ST_ADDBITS14
;
7977 kern_type
= KERN_TYPE_MD5_PWSLT
;
7978 dgst_size
= DGST_SIZE_4_4
;
7979 parse_func
= joomla_parse_hash
;
7980 sort_by_digest
= sort_by_digest_4_4
;
7981 opti_type
= OPTI_TYPE_ZERO_BYTE
7982 | OPTI_TYPE_PRECOMPUTE_INIT
7983 | OPTI_TYPE_PRECOMPUTE_MERKLE
7984 | OPTI_TYPE_MEET_IN_MIDDLE
7985 | OPTI_TYPE_EARLY_SKIP
7986 | OPTI_TYPE_NOT_ITERATED
7987 | OPTI_TYPE_APPENDED_SALT
7988 | OPTI_TYPE_RAW_HASH
;
7995 case 12: hash_type
= HASH_TYPE_MD5
;
7996 salt_type
= SALT_TYPE_INTERN
;
7997 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7998 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7999 | OPTS_TYPE_ST_ADD80
8000 | OPTS_TYPE_ST_ADDBITS14
;
8001 kern_type
= KERN_TYPE_MD5_PWSLT
;
8002 dgst_size
= DGST_SIZE_4_4
;
8003 parse_func
= postgresql_parse_hash
;
8004 sort_by_digest
= sort_by_digest_4_4
;
8005 opti_type
= OPTI_TYPE_ZERO_BYTE
8006 | OPTI_TYPE_PRECOMPUTE_INIT
8007 | OPTI_TYPE_PRECOMPUTE_MERKLE
8008 | OPTI_TYPE_MEET_IN_MIDDLE
8009 | OPTI_TYPE_EARLY_SKIP
8010 | OPTI_TYPE_NOT_ITERATED
8011 | OPTI_TYPE_APPENDED_SALT
8012 | OPTI_TYPE_RAW_HASH
;
8019 case 20: hash_type
= HASH_TYPE_MD5
;
8020 salt_type
= SALT_TYPE_INTERN
;
8021 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8022 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8023 | OPTS_TYPE_PT_ADD80
8024 | OPTS_TYPE_PT_ADDBITS14
;
8025 kern_type
= KERN_TYPE_MD5_SLTPW
;
8026 dgst_size
= DGST_SIZE_4_4
;
8027 parse_func
= md5s_parse_hash
;
8028 sort_by_digest
= sort_by_digest_4_4
;
8029 opti_type
= OPTI_TYPE_ZERO_BYTE
8030 | OPTI_TYPE_PRECOMPUTE_INIT
8031 | OPTI_TYPE_PRECOMPUTE_MERKLE
8032 | OPTI_TYPE_EARLY_SKIP
8033 | OPTI_TYPE_NOT_ITERATED
8034 | OPTI_TYPE_PREPENDED_SALT
8035 | OPTI_TYPE_RAW_HASH
;
8042 case 21: hash_type
= HASH_TYPE_MD5
;
8043 salt_type
= SALT_TYPE_INTERN
;
8044 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8045 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8046 | OPTS_TYPE_PT_ADD80
8047 | OPTS_TYPE_PT_ADDBITS14
;
8048 kern_type
= KERN_TYPE_MD5_SLTPW
;
8049 dgst_size
= DGST_SIZE_4_4
;
8050 parse_func
= osc_parse_hash
;
8051 sort_by_digest
= sort_by_digest_4_4
;
8052 opti_type
= OPTI_TYPE_ZERO_BYTE
8053 | OPTI_TYPE_PRECOMPUTE_INIT
8054 | OPTI_TYPE_PRECOMPUTE_MERKLE
8055 | OPTI_TYPE_EARLY_SKIP
8056 | OPTI_TYPE_NOT_ITERATED
8057 | OPTI_TYPE_PREPENDED_SALT
8058 | OPTI_TYPE_RAW_HASH
;
8065 case 22: hash_type
= HASH_TYPE_MD5
;
8066 salt_type
= SALT_TYPE_EMBEDDED
;
8067 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8069 | OPTS_TYPE_PT_ADD80
8070 | OPTS_TYPE_PT_ADDBITS14
;
8071 kern_type
= KERN_TYPE_MD5_SLTPW
;
8072 dgst_size
= DGST_SIZE_4_4
;
8073 parse_func
= netscreen_parse_hash
;
8074 sort_by_digest
= sort_by_digest_4_4
;
8075 opti_type
= OPTI_TYPE_ZERO_BYTE
8076 | OPTI_TYPE_PRECOMPUTE_INIT
8077 | OPTI_TYPE_PRECOMPUTE_MERKLE
8078 | OPTI_TYPE_EARLY_SKIP
8079 | OPTI_TYPE_NOT_ITERATED
8080 | OPTI_TYPE_PREPENDED_SALT
8081 | OPTI_TYPE_RAW_HASH
;
8088 case 23: hash_type
= HASH_TYPE_MD5
;
8089 salt_type
= SALT_TYPE_EMBEDDED
;
8090 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8092 | OPTS_TYPE_PT_ADD80
8093 | OPTS_TYPE_PT_ADDBITS14
;
8094 kern_type
= KERN_TYPE_MD5_SLTPW
;
8095 dgst_size
= DGST_SIZE_4_4
;
8096 parse_func
= skype_parse_hash
;
8097 sort_by_digest
= sort_by_digest_4_4
;
8098 opti_type
= OPTI_TYPE_ZERO_BYTE
8099 | OPTI_TYPE_PRECOMPUTE_INIT
8100 | OPTI_TYPE_PRECOMPUTE_MERKLE
8101 | OPTI_TYPE_EARLY_SKIP
8102 | OPTI_TYPE_NOT_ITERATED
8103 | OPTI_TYPE_PREPENDED_SALT
8104 | OPTI_TYPE_RAW_HASH
;
8111 case 30: hash_type
= HASH_TYPE_MD5
;
8112 salt_type
= SALT_TYPE_INTERN
;
8113 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8115 | OPTS_TYPE_PT_UNICODE
8116 | OPTS_TYPE_ST_ADD80
8117 | OPTS_TYPE_ST_ADDBITS14
;
8118 kern_type
= KERN_TYPE_MD5_PWUSLT
;
8119 dgst_size
= DGST_SIZE_4_4
;
8120 parse_func
= md5s_parse_hash
;
8121 sort_by_digest
= sort_by_digest_4_4
;
8122 opti_type
= OPTI_TYPE_ZERO_BYTE
8123 | OPTI_TYPE_PRECOMPUTE_INIT
8124 | OPTI_TYPE_PRECOMPUTE_MERKLE
8125 | OPTI_TYPE_MEET_IN_MIDDLE
8126 | OPTI_TYPE_EARLY_SKIP
8127 | OPTI_TYPE_NOT_ITERATED
8128 | OPTI_TYPE_APPENDED_SALT
8129 | OPTI_TYPE_RAW_HASH
;
8136 case 40: hash_type
= HASH_TYPE_MD5
;
8137 salt_type
= SALT_TYPE_INTERN
;
8138 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8139 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8140 | OPTS_TYPE_PT_ADD80
8141 | OPTS_TYPE_PT_ADDBITS14
8142 | OPTS_TYPE_PT_UNICODE
;
8143 kern_type
= KERN_TYPE_MD5_SLTPWU
;
8144 dgst_size
= DGST_SIZE_4_4
;
8145 parse_func
= md5s_parse_hash
;
8146 sort_by_digest
= sort_by_digest_4_4
;
8147 opti_type
= OPTI_TYPE_ZERO_BYTE
8148 | OPTI_TYPE_PRECOMPUTE_INIT
8149 | OPTI_TYPE_PRECOMPUTE_MERKLE
8150 | OPTI_TYPE_EARLY_SKIP
8151 | OPTI_TYPE_NOT_ITERATED
8152 | OPTI_TYPE_PREPENDED_SALT
8153 | OPTI_TYPE_RAW_HASH
;
8160 case 50: hash_type
= HASH_TYPE_MD5
;
8161 salt_type
= SALT_TYPE_INTERN
;
8162 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8164 | OPTS_TYPE_ST_ADD80
8165 | OPTS_TYPE_ST_ADDBITS14
;
8166 kern_type
= KERN_TYPE_HMACMD5_PW
;
8167 dgst_size
= DGST_SIZE_4_4
;
8168 parse_func
= hmacmd5_parse_hash
;
8169 sort_by_digest
= sort_by_digest_4_4
;
8170 opti_type
= OPTI_TYPE_ZERO_BYTE
8171 | OPTI_TYPE_NOT_ITERATED
;
8178 case 60: hash_type
= HASH_TYPE_MD5
;
8179 salt_type
= SALT_TYPE_INTERN
;
8180 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8182 | OPTS_TYPE_PT_ADD80
8183 | OPTS_TYPE_PT_ADDBITS14
;
8184 kern_type
= KERN_TYPE_HMACMD5_SLT
;
8185 dgst_size
= DGST_SIZE_4_4
;
8186 parse_func
= hmacmd5_parse_hash
;
8187 sort_by_digest
= sort_by_digest_4_4
;
8188 opti_type
= OPTI_TYPE_ZERO_BYTE
8189 | OPTI_TYPE_NOT_ITERATED
;
8196 case 100: hash_type
= HASH_TYPE_SHA1
;
8197 salt_type
= SALT_TYPE_NONE
;
8198 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8199 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8200 | OPTS_TYPE_PT_ADD80
8201 | OPTS_TYPE_PT_ADDBITS15
;
8202 kern_type
= KERN_TYPE_SHA1
;
8203 dgst_size
= DGST_SIZE_4_5
;
8204 parse_func
= sha1_parse_hash
;
8205 sort_by_digest
= sort_by_digest_4_5
;
8206 opti_type
= OPTI_TYPE_ZERO_BYTE
8207 | OPTI_TYPE_PRECOMPUTE_INIT
8208 | OPTI_TYPE_PRECOMPUTE_MERKLE
8209 | OPTI_TYPE_EARLY_SKIP
8210 | OPTI_TYPE_NOT_ITERATED
8211 | OPTI_TYPE_NOT_SALTED
8212 | OPTI_TYPE_RAW_HASH
;
8219 case 101: hash_type
= HASH_TYPE_SHA1
;
8220 salt_type
= SALT_TYPE_NONE
;
8221 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8222 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8223 | OPTS_TYPE_PT_ADD80
8224 | OPTS_TYPE_PT_ADDBITS15
;
8225 kern_type
= KERN_TYPE_SHA1
;
8226 dgst_size
= DGST_SIZE_4_5
;
8227 parse_func
= sha1b64_parse_hash
;
8228 sort_by_digest
= sort_by_digest_4_5
;
8229 opti_type
= OPTI_TYPE_ZERO_BYTE
8230 | OPTI_TYPE_PRECOMPUTE_INIT
8231 | OPTI_TYPE_PRECOMPUTE_MERKLE
8232 | OPTI_TYPE_EARLY_SKIP
8233 | OPTI_TYPE_NOT_ITERATED
8234 | OPTI_TYPE_NOT_SALTED
8235 | OPTI_TYPE_RAW_HASH
;
8242 case 110: hash_type
= HASH_TYPE_SHA1
;
8243 salt_type
= SALT_TYPE_INTERN
;
8244 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8245 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8246 | OPTS_TYPE_ST_ADD80
8247 | OPTS_TYPE_ST_ADDBITS15
;
8248 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8249 dgst_size
= DGST_SIZE_4_5
;
8250 parse_func
= sha1s_parse_hash
;
8251 sort_by_digest
= sort_by_digest_4_5
;
8252 opti_type
= OPTI_TYPE_ZERO_BYTE
8253 | OPTI_TYPE_PRECOMPUTE_INIT
8254 | OPTI_TYPE_PRECOMPUTE_MERKLE
8255 | OPTI_TYPE_EARLY_SKIP
8256 | OPTI_TYPE_NOT_ITERATED
8257 | OPTI_TYPE_APPENDED_SALT
8258 | OPTI_TYPE_RAW_HASH
;
8265 case 111: hash_type
= HASH_TYPE_SHA1
;
8266 salt_type
= SALT_TYPE_EMBEDDED
;
8267 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8268 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8269 | OPTS_TYPE_ST_ADD80
8270 | OPTS_TYPE_ST_ADDBITS15
;
8271 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8272 dgst_size
= DGST_SIZE_4_5
;
8273 parse_func
= sha1b64s_parse_hash
;
8274 sort_by_digest
= sort_by_digest_4_5
;
8275 opti_type
= OPTI_TYPE_ZERO_BYTE
8276 | OPTI_TYPE_PRECOMPUTE_INIT
8277 | OPTI_TYPE_PRECOMPUTE_MERKLE
8278 | OPTI_TYPE_EARLY_SKIP
8279 | OPTI_TYPE_NOT_ITERATED
8280 | OPTI_TYPE_APPENDED_SALT
8281 | OPTI_TYPE_RAW_HASH
;
8288 case 112: hash_type
= HASH_TYPE_SHA1
;
8289 salt_type
= SALT_TYPE_INTERN
;
8290 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8291 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8292 | OPTS_TYPE_ST_ADD80
8293 | OPTS_TYPE_ST_ADDBITS15
8295 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8296 dgst_size
= DGST_SIZE_4_5
;
8297 parse_func
= oracles_parse_hash
;
8298 sort_by_digest
= sort_by_digest_4_5
;
8299 opti_type
= OPTI_TYPE_ZERO_BYTE
8300 | OPTI_TYPE_PRECOMPUTE_INIT
8301 | OPTI_TYPE_PRECOMPUTE_MERKLE
8302 | OPTI_TYPE_EARLY_SKIP
8303 | OPTI_TYPE_NOT_ITERATED
8304 | OPTI_TYPE_APPENDED_SALT
8305 | OPTI_TYPE_RAW_HASH
;
8312 case 120: hash_type
= HASH_TYPE_SHA1
;
8313 salt_type
= SALT_TYPE_INTERN
;
8314 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8315 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8316 | OPTS_TYPE_PT_ADD80
8317 | OPTS_TYPE_PT_ADDBITS15
;
8318 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8319 dgst_size
= DGST_SIZE_4_5
;
8320 parse_func
= sha1s_parse_hash
;
8321 sort_by_digest
= sort_by_digest_4_5
;
8322 opti_type
= OPTI_TYPE_ZERO_BYTE
8323 | OPTI_TYPE_PRECOMPUTE_INIT
8324 | OPTI_TYPE_PRECOMPUTE_MERKLE
8325 | OPTI_TYPE_EARLY_SKIP
8326 | OPTI_TYPE_NOT_ITERATED
8327 | OPTI_TYPE_PREPENDED_SALT
8328 | OPTI_TYPE_RAW_HASH
;
8335 case 121: hash_type
= HASH_TYPE_SHA1
;
8336 salt_type
= SALT_TYPE_INTERN
;
8337 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8338 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8339 | OPTS_TYPE_PT_ADD80
8340 | OPTS_TYPE_PT_ADDBITS15
8341 | OPTS_TYPE_ST_LOWER
;
8342 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8343 dgst_size
= DGST_SIZE_4_5
;
8344 parse_func
= smf_parse_hash
;
8345 sort_by_digest
= sort_by_digest_4_5
;
8346 opti_type
= OPTI_TYPE_ZERO_BYTE
8347 | OPTI_TYPE_PRECOMPUTE_INIT
8348 | OPTI_TYPE_PRECOMPUTE_MERKLE
8349 | OPTI_TYPE_EARLY_SKIP
8350 | OPTI_TYPE_NOT_ITERATED
8351 | OPTI_TYPE_PREPENDED_SALT
8352 | OPTI_TYPE_RAW_HASH
;
8359 case 122: hash_type
= HASH_TYPE_SHA1
;
8360 salt_type
= SALT_TYPE_EMBEDDED
;
8361 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8363 | OPTS_TYPE_PT_ADD80
8364 | OPTS_TYPE_PT_ADDBITS15
8366 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8367 dgst_size
= DGST_SIZE_4_5
;
8368 parse_func
= osx1_parse_hash
;
8369 sort_by_digest
= sort_by_digest_4_5
;
8370 opti_type
= OPTI_TYPE_ZERO_BYTE
8371 | OPTI_TYPE_PRECOMPUTE_INIT
8372 | OPTI_TYPE_PRECOMPUTE_MERKLE
8373 | OPTI_TYPE_EARLY_SKIP
8374 | OPTI_TYPE_NOT_ITERATED
8375 | OPTI_TYPE_PREPENDED_SALT
8376 | OPTI_TYPE_RAW_HASH
;
8383 case 124: hash_type
= HASH_TYPE_SHA1
;
8384 salt_type
= SALT_TYPE_EMBEDDED
;
8385 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8386 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8387 | OPTS_TYPE_PT_ADD80
8388 | OPTS_TYPE_PT_ADDBITS15
;
8389 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8390 dgst_size
= DGST_SIZE_4_5
;
8391 parse_func
= djangosha1_parse_hash
;
8392 sort_by_digest
= sort_by_digest_4_5
;
8393 opti_type
= OPTI_TYPE_ZERO_BYTE
8394 | OPTI_TYPE_PRECOMPUTE_INIT
8395 | OPTI_TYPE_PRECOMPUTE_MERKLE
8396 | OPTI_TYPE_EARLY_SKIP
8397 | OPTI_TYPE_NOT_ITERATED
8398 | OPTI_TYPE_PREPENDED_SALT
8399 | OPTI_TYPE_RAW_HASH
;
8406 case 125: hash_type
= HASH_TYPE_SHA1
;
8407 salt_type
= SALT_TYPE_EMBEDDED
;
8408 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8409 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8410 | OPTS_TYPE_PT_ADD80
8411 | OPTS_TYPE_PT_ADDBITS15
8413 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8414 dgst_size
= DGST_SIZE_4_5
;
8415 parse_func
= arubaos_parse_hash
;
8416 sort_by_digest
= sort_by_digest_4_5
;
8417 opti_type
= OPTI_TYPE_ZERO_BYTE
8418 | OPTI_TYPE_PRECOMPUTE_INIT
8419 | OPTI_TYPE_PRECOMPUTE_MERKLE
8420 | OPTI_TYPE_EARLY_SKIP
8421 | OPTI_TYPE_NOT_ITERATED
8422 | OPTI_TYPE_PREPENDED_SALT
8423 | OPTI_TYPE_RAW_HASH
;
8430 case 130: hash_type
= HASH_TYPE_SHA1
;
8431 salt_type
= SALT_TYPE_INTERN
;
8432 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8433 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8434 | OPTS_TYPE_PT_UNICODE
8435 | OPTS_TYPE_ST_ADD80
8436 | OPTS_TYPE_ST_ADDBITS15
;
8437 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8438 dgst_size
= DGST_SIZE_4_5
;
8439 parse_func
= sha1s_parse_hash
;
8440 sort_by_digest
= sort_by_digest_4_5
;
8441 opti_type
= OPTI_TYPE_ZERO_BYTE
8442 | OPTI_TYPE_PRECOMPUTE_INIT
8443 | OPTI_TYPE_PRECOMPUTE_MERKLE
8444 | OPTI_TYPE_EARLY_SKIP
8445 | OPTI_TYPE_NOT_ITERATED
8446 | OPTI_TYPE_APPENDED_SALT
8447 | OPTI_TYPE_RAW_HASH
;
8454 case 131: hash_type
= HASH_TYPE_SHA1
;
8455 salt_type
= SALT_TYPE_EMBEDDED
;
8456 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8457 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8458 | OPTS_TYPE_PT_UNICODE
8459 | OPTS_TYPE_PT_UPPER
8460 | OPTS_TYPE_ST_ADD80
8461 | OPTS_TYPE_ST_ADDBITS15
8463 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8464 dgst_size
= DGST_SIZE_4_5
;
8465 parse_func
= mssql2000_parse_hash
;
8466 sort_by_digest
= sort_by_digest_4_5
;
8467 opti_type
= OPTI_TYPE_ZERO_BYTE
8468 | OPTI_TYPE_PRECOMPUTE_INIT
8469 | OPTI_TYPE_PRECOMPUTE_MERKLE
8470 | OPTI_TYPE_EARLY_SKIP
8471 | OPTI_TYPE_NOT_ITERATED
8472 | OPTI_TYPE_APPENDED_SALT
8473 | OPTI_TYPE_RAW_HASH
;
8480 case 132: hash_type
= HASH_TYPE_SHA1
;
8481 salt_type
= SALT_TYPE_EMBEDDED
;
8482 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8483 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8484 | OPTS_TYPE_PT_UNICODE
8485 | OPTS_TYPE_ST_ADD80
8486 | OPTS_TYPE_ST_ADDBITS15
8488 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8489 dgst_size
= DGST_SIZE_4_5
;
8490 parse_func
= mssql2005_parse_hash
;
8491 sort_by_digest
= sort_by_digest_4_5
;
8492 opti_type
= OPTI_TYPE_ZERO_BYTE
8493 | OPTI_TYPE_PRECOMPUTE_INIT
8494 | OPTI_TYPE_PRECOMPUTE_MERKLE
8495 | OPTI_TYPE_EARLY_SKIP
8496 | OPTI_TYPE_NOT_ITERATED
8497 | OPTI_TYPE_APPENDED_SALT
8498 | OPTI_TYPE_RAW_HASH
;
8505 case 133: hash_type
= HASH_TYPE_SHA1
;
8506 salt_type
= SALT_TYPE_EMBEDDED
;
8507 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8508 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8509 | OPTS_TYPE_PT_UNICODE
8510 | OPTS_TYPE_ST_ADD80
8511 | OPTS_TYPE_ST_ADDBITS15
;
8512 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8513 dgst_size
= DGST_SIZE_4_5
;
8514 parse_func
= peoplesoft_parse_hash
;
8515 sort_by_digest
= sort_by_digest_4_5
;
8516 opti_type
= OPTI_TYPE_ZERO_BYTE
8517 | OPTI_TYPE_PRECOMPUTE_INIT
8518 | OPTI_TYPE_PRECOMPUTE_MERKLE
8519 | OPTI_TYPE_EARLY_SKIP
8520 | OPTI_TYPE_NOT_ITERATED
8521 | OPTI_TYPE_APPENDED_SALT
8522 | OPTI_TYPE_RAW_HASH
;
8529 case 140: hash_type
= HASH_TYPE_SHA1
;
8530 salt_type
= SALT_TYPE_INTERN
;
8531 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8532 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8533 | OPTS_TYPE_PT_ADD80
8534 | OPTS_TYPE_PT_ADDBITS15
8535 | OPTS_TYPE_PT_UNICODE
;
8536 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8537 dgst_size
= DGST_SIZE_4_5
;
8538 parse_func
= sha1s_parse_hash
;
8539 sort_by_digest
= sort_by_digest_4_5
;
8540 opti_type
= OPTI_TYPE_ZERO_BYTE
8541 | OPTI_TYPE_PRECOMPUTE_INIT
8542 | OPTI_TYPE_PRECOMPUTE_MERKLE
8543 | OPTI_TYPE_EARLY_SKIP
8544 | OPTI_TYPE_NOT_ITERATED
8545 | OPTI_TYPE_PREPENDED_SALT
8546 | OPTI_TYPE_RAW_HASH
;
8553 case 141: hash_type
= HASH_TYPE_SHA1
;
8554 salt_type
= SALT_TYPE_EMBEDDED
;
8555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8557 | OPTS_TYPE_PT_ADD80
8558 | OPTS_TYPE_PT_ADDBITS15
8559 | OPTS_TYPE_PT_UNICODE
8560 | OPTS_TYPE_ST_BASE64
;
8561 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8562 dgst_size
= DGST_SIZE_4_5
;
8563 parse_func
= episerver_parse_hash
;
8564 sort_by_digest
= sort_by_digest_4_5
;
8565 opti_type
= OPTI_TYPE_ZERO_BYTE
8566 | OPTI_TYPE_PRECOMPUTE_INIT
8567 | OPTI_TYPE_PRECOMPUTE_MERKLE
8568 | OPTI_TYPE_EARLY_SKIP
8569 | OPTI_TYPE_NOT_ITERATED
8570 | OPTI_TYPE_PREPENDED_SALT
8571 | OPTI_TYPE_RAW_HASH
;
8578 case 150: hash_type
= HASH_TYPE_SHA1
;
8579 salt_type
= SALT_TYPE_INTERN
;
8580 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8581 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8582 | OPTS_TYPE_ST_ADD80
8583 | OPTS_TYPE_ST_ADDBITS15
;
8584 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8585 dgst_size
= DGST_SIZE_4_5
;
8586 parse_func
= hmacsha1_parse_hash
;
8587 sort_by_digest
= sort_by_digest_4_5
;
8588 opti_type
= OPTI_TYPE_ZERO_BYTE
8589 | OPTI_TYPE_NOT_ITERATED
;
8596 case 160: hash_type
= HASH_TYPE_SHA1
;
8597 salt_type
= SALT_TYPE_INTERN
;
8598 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8599 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8600 | OPTS_TYPE_PT_ADD80
8601 | OPTS_TYPE_PT_ADDBITS15
;
8602 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8603 dgst_size
= DGST_SIZE_4_5
;
8604 parse_func
= hmacsha1_parse_hash
;
8605 sort_by_digest
= sort_by_digest_4_5
;
8606 opti_type
= OPTI_TYPE_ZERO_BYTE
8607 | OPTI_TYPE_NOT_ITERATED
;
8614 case 200: hash_type
= HASH_TYPE_MYSQL
;
8615 salt_type
= SALT_TYPE_NONE
;
8616 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8618 kern_type
= KERN_TYPE_MYSQL
;
8619 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8620 parse_func
= mysql323_parse_hash
;
8621 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8622 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8629 case 300: hash_type
= HASH_TYPE_SHA1
;
8630 salt_type
= SALT_TYPE_NONE
;
8631 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8632 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8633 | OPTS_TYPE_PT_ADD80
8634 | OPTS_TYPE_PT_ADDBITS15
;
8635 kern_type
= KERN_TYPE_MYSQL41
;
8636 dgst_size
= DGST_SIZE_4_5
;
8637 parse_func
= sha1_parse_hash
;
8638 sort_by_digest
= sort_by_digest_4_5
;
8639 opti_type
= OPTI_TYPE_ZERO_BYTE
8640 | OPTI_TYPE_PRECOMPUTE_INIT
8641 | OPTI_TYPE_PRECOMPUTE_MERKLE
8642 | OPTI_TYPE_EARLY_SKIP
8643 | OPTI_TYPE_NOT_ITERATED
8644 | OPTI_TYPE_NOT_SALTED
;
8651 case 400: hash_type
= HASH_TYPE_MD5
;
8652 salt_type
= SALT_TYPE_EMBEDDED
;
8653 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8654 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8655 kern_type
= KERN_TYPE_PHPASS
;
8656 dgst_size
= DGST_SIZE_4_4
;
8657 parse_func
= phpass_parse_hash
;
8658 sort_by_digest
= sort_by_digest_4_4
;
8659 opti_type
= OPTI_TYPE_ZERO_BYTE
8660 | OPTI_TYPE_SLOW_HASH_SIMD
;
8667 case 500: hash_type
= HASH_TYPE_MD5
;
8668 salt_type
= SALT_TYPE_EMBEDDED
;
8669 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8670 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8671 kern_type
= KERN_TYPE_MD5CRYPT
;
8672 dgst_size
= DGST_SIZE_4_4
;
8673 parse_func
= md5crypt_parse_hash
;
8674 sort_by_digest
= sort_by_digest_4_4
;
8675 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8682 case 501: hash_type
= HASH_TYPE_MD5
;
8683 salt_type
= SALT_TYPE_EMBEDDED
;
8684 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8685 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8686 | OPTS_TYPE_HASH_COPY
;
8687 kern_type
= KERN_TYPE_MD5CRYPT
;
8688 dgst_size
= DGST_SIZE_4_4
;
8689 parse_func
= juniper_parse_hash
;
8690 sort_by_digest
= sort_by_digest_4_4
;
8691 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8698 case 900: hash_type
= HASH_TYPE_MD4
;
8699 salt_type
= SALT_TYPE_NONE
;
8700 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8701 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8702 | OPTS_TYPE_PT_ADD80
8703 | OPTS_TYPE_PT_ADDBITS14
;
8704 kern_type
= KERN_TYPE_MD4
;
8705 dgst_size
= DGST_SIZE_4_4
;
8706 parse_func
= md4_parse_hash
;
8707 sort_by_digest
= sort_by_digest_4_4
;
8708 opti_type
= OPTI_TYPE_ZERO_BYTE
8709 | OPTI_TYPE_PRECOMPUTE_INIT
8710 | OPTI_TYPE_PRECOMPUTE_MERKLE
8711 | OPTI_TYPE_MEET_IN_MIDDLE
8712 | OPTI_TYPE_EARLY_SKIP
8713 | OPTI_TYPE_NOT_ITERATED
8714 | OPTI_TYPE_NOT_SALTED
8715 | OPTI_TYPE_RAW_HASH
;
8722 case 1000: hash_type
= HASH_TYPE_MD4
;
8723 salt_type
= SALT_TYPE_NONE
;
8724 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8725 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8726 | OPTS_TYPE_PT_ADD80
8727 | OPTS_TYPE_PT_ADDBITS14
8728 | OPTS_TYPE_PT_UNICODE
;
8729 kern_type
= KERN_TYPE_MD4_PWU
;
8730 dgst_size
= DGST_SIZE_4_4
;
8731 parse_func
= md4_parse_hash
;
8732 sort_by_digest
= sort_by_digest_4_4
;
8733 opti_type
= OPTI_TYPE_ZERO_BYTE
8734 | OPTI_TYPE_PRECOMPUTE_INIT
8735 | OPTI_TYPE_PRECOMPUTE_MERKLE
8736 | OPTI_TYPE_MEET_IN_MIDDLE
8737 | OPTI_TYPE_EARLY_SKIP
8738 | OPTI_TYPE_NOT_ITERATED
8739 | OPTI_TYPE_NOT_SALTED
8740 | OPTI_TYPE_RAW_HASH
;
8747 case 1100: hash_type
= HASH_TYPE_MD4
;
8748 salt_type
= SALT_TYPE_INTERN
;
8749 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8750 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8751 | OPTS_TYPE_PT_ADD80
8752 | OPTS_TYPE_PT_ADDBITS14
8753 | OPTS_TYPE_PT_UNICODE
8754 | OPTS_TYPE_ST_ADD80
8755 | OPTS_TYPE_ST_UNICODE
8756 | OPTS_TYPE_ST_LOWER
;
8757 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8758 dgst_size
= DGST_SIZE_4_4
;
8759 parse_func
= dcc_parse_hash
;
8760 sort_by_digest
= sort_by_digest_4_4
;
8761 opti_type
= OPTI_TYPE_ZERO_BYTE
8762 | OPTI_TYPE_PRECOMPUTE_INIT
8763 | OPTI_TYPE_PRECOMPUTE_MERKLE
8764 | OPTI_TYPE_EARLY_SKIP
8765 | OPTI_TYPE_NOT_ITERATED
;
8772 case 1400: hash_type
= HASH_TYPE_SHA256
;
8773 salt_type
= SALT_TYPE_NONE
;
8774 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8775 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8776 | OPTS_TYPE_PT_ADD80
8777 | OPTS_TYPE_PT_ADDBITS15
;
8778 kern_type
= KERN_TYPE_SHA256
;
8779 dgst_size
= DGST_SIZE_4_8
;
8780 parse_func
= sha256_parse_hash
;
8781 sort_by_digest
= sort_by_digest_4_8
;
8782 opti_type
= OPTI_TYPE_ZERO_BYTE
8783 | OPTI_TYPE_PRECOMPUTE_INIT
8784 | OPTI_TYPE_PRECOMPUTE_MERKLE
8785 | OPTI_TYPE_EARLY_SKIP
8786 | OPTI_TYPE_NOT_ITERATED
8787 | OPTI_TYPE_NOT_SALTED
8788 | OPTI_TYPE_RAW_HASH
;
8795 case 1410: hash_type
= HASH_TYPE_SHA256
;
8796 salt_type
= SALT_TYPE_INTERN
;
8797 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8798 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8799 | OPTS_TYPE_ST_ADD80
8800 | OPTS_TYPE_ST_ADDBITS15
;
8801 kern_type
= KERN_TYPE_SHA256_PWSLT
;
8802 dgst_size
= DGST_SIZE_4_8
;
8803 parse_func
= sha256s_parse_hash
;
8804 sort_by_digest
= sort_by_digest_4_8
;
8805 opti_type
= OPTI_TYPE_ZERO_BYTE
8806 | OPTI_TYPE_PRECOMPUTE_INIT
8807 | OPTI_TYPE_PRECOMPUTE_MERKLE
8808 | OPTI_TYPE_EARLY_SKIP
8809 | OPTI_TYPE_NOT_ITERATED
8810 | OPTI_TYPE_APPENDED_SALT
8811 | OPTI_TYPE_RAW_HASH
;
8818 case 1420: hash_type
= HASH_TYPE_SHA256
;
8819 salt_type
= SALT_TYPE_INTERN
;
8820 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8821 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8822 | OPTS_TYPE_PT_ADD80
8823 | OPTS_TYPE_PT_ADDBITS15
;
8824 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8825 dgst_size
= DGST_SIZE_4_8
;
8826 parse_func
= sha256s_parse_hash
;
8827 sort_by_digest
= sort_by_digest_4_8
;
8828 opti_type
= OPTI_TYPE_ZERO_BYTE
8829 | OPTI_TYPE_PRECOMPUTE_INIT
8830 | OPTI_TYPE_PRECOMPUTE_MERKLE
8831 | OPTI_TYPE_EARLY_SKIP
8832 | OPTI_TYPE_NOT_ITERATED
8833 | OPTI_TYPE_PREPENDED_SALT
8834 | OPTI_TYPE_RAW_HASH
;
8841 case 1421: hash_type
= HASH_TYPE_SHA256
;
8842 salt_type
= SALT_TYPE_EMBEDDED
;
8843 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8844 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8845 | OPTS_TYPE_PT_ADD80
8846 | OPTS_TYPE_PT_ADDBITS15
;
8847 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8848 dgst_size
= DGST_SIZE_4_8
;
8849 parse_func
= hmailserver_parse_hash
;
8850 sort_by_digest
= sort_by_digest_4_8
;
8851 opti_type
= OPTI_TYPE_ZERO_BYTE
8852 | OPTI_TYPE_PRECOMPUTE_INIT
8853 | OPTI_TYPE_PRECOMPUTE_MERKLE
8854 | OPTI_TYPE_EARLY_SKIP
8855 | OPTI_TYPE_NOT_ITERATED
8856 | OPTI_TYPE_PREPENDED_SALT
8857 | OPTI_TYPE_RAW_HASH
;
8864 case 1430: hash_type
= HASH_TYPE_SHA256
;
8865 salt_type
= SALT_TYPE_INTERN
;
8866 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8867 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8868 | OPTS_TYPE_PT_UNICODE
8869 | OPTS_TYPE_ST_ADD80
8870 | OPTS_TYPE_ST_ADDBITS15
;
8871 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8872 dgst_size
= DGST_SIZE_4_8
;
8873 parse_func
= sha256s_parse_hash
;
8874 sort_by_digest
= sort_by_digest_4_8
;
8875 opti_type
= OPTI_TYPE_ZERO_BYTE
8876 | OPTI_TYPE_PRECOMPUTE_INIT
8877 | OPTI_TYPE_PRECOMPUTE_MERKLE
8878 | OPTI_TYPE_EARLY_SKIP
8879 | OPTI_TYPE_NOT_ITERATED
8880 | OPTI_TYPE_APPENDED_SALT
8881 | OPTI_TYPE_RAW_HASH
;
8888 case 1440: hash_type
= HASH_TYPE_SHA256
;
8889 salt_type
= SALT_TYPE_INTERN
;
8890 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8891 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8892 | OPTS_TYPE_PT_ADD80
8893 | OPTS_TYPE_PT_ADDBITS15
8894 | OPTS_TYPE_PT_UNICODE
;
8895 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8896 dgst_size
= DGST_SIZE_4_8
;
8897 parse_func
= sha256s_parse_hash
;
8898 sort_by_digest
= sort_by_digest_4_8
;
8899 opti_type
= OPTI_TYPE_ZERO_BYTE
8900 | OPTI_TYPE_PRECOMPUTE_INIT
8901 | OPTI_TYPE_PRECOMPUTE_MERKLE
8902 | OPTI_TYPE_EARLY_SKIP
8903 | OPTI_TYPE_NOT_ITERATED
8904 | OPTI_TYPE_PREPENDED_SALT
8905 | OPTI_TYPE_RAW_HASH
;
8912 case 1441: hash_type
= HASH_TYPE_SHA256
;
8913 salt_type
= SALT_TYPE_EMBEDDED
;
8914 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8915 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8916 | OPTS_TYPE_PT_ADD80
8917 | OPTS_TYPE_PT_ADDBITS15
8918 | OPTS_TYPE_PT_UNICODE
8919 | OPTS_TYPE_ST_BASE64
;
8920 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8921 dgst_size
= DGST_SIZE_4_8
;
8922 parse_func
= episerver4_parse_hash
;
8923 sort_by_digest
= sort_by_digest_4_8
;
8924 opti_type
= OPTI_TYPE_ZERO_BYTE
8925 | OPTI_TYPE_PRECOMPUTE_INIT
8926 | OPTI_TYPE_PRECOMPUTE_MERKLE
8927 | OPTI_TYPE_EARLY_SKIP
8928 | OPTI_TYPE_NOT_ITERATED
8929 | OPTI_TYPE_PREPENDED_SALT
8930 | OPTI_TYPE_RAW_HASH
;
8937 case 1450: hash_type
= HASH_TYPE_SHA256
;
8938 salt_type
= SALT_TYPE_INTERN
;
8939 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8940 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8941 | OPTS_TYPE_ST_ADD80
;
8942 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8943 dgst_size
= DGST_SIZE_4_8
;
8944 parse_func
= hmacsha256_parse_hash
;
8945 sort_by_digest
= sort_by_digest_4_8
;
8946 opti_type
= OPTI_TYPE_ZERO_BYTE
8947 | OPTI_TYPE_NOT_ITERATED
;
8954 case 1460: hash_type
= HASH_TYPE_SHA256
;
8955 salt_type
= SALT_TYPE_INTERN
;
8956 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8957 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8958 | OPTS_TYPE_PT_ADD80
8959 | OPTS_TYPE_PT_ADDBITS15
;
8960 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8961 dgst_size
= DGST_SIZE_4_8
;
8962 parse_func
= hmacsha256_parse_hash
;
8963 sort_by_digest
= sort_by_digest_4_8
;
8964 opti_type
= OPTI_TYPE_ZERO_BYTE
8965 | OPTI_TYPE_NOT_ITERATED
;
8972 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8973 salt_type
= SALT_TYPE_EMBEDDED
;
8974 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8975 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8976 | OPTS_TYPE_PT_BITSLICE
;
8977 kern_type
= KERN_TYPE_DESCRYPT
;
8978 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8979 parse_func
= descrypt_parse_hash
;
8980 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8981 opti_type
= OPTI_TYPE_ZERO_BYTE
8982 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8989 case 1600: hash_type
= HASH_TYPE_MD5
;
8990 salt_type
= SALT_TYPE_EMBEDDED
;
8991 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8992 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8993 kern_type
= KERN_TYPE_APR1CRYPT
;
8994 dgst_size
= DGST_SIZE_4_4
;
8995 parse_func
= md5apr1_parse_hash
;
8996 sort_by_digest
= sort_by_digest_4_4
;
8997 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9004 case 1700: hash_type
= HASH_TYPE_SHA512
;
9005 salt_type
= SALT_TYPE_NONE
;
9006 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9007 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9008 | OPTS_TYPE_PT_ADD80
9009 | OPTS_TYPE_PT_ADDBITS15
;
9010 kern_type
= KERN_TYPE_SHA512
;
9011 dgst_size
= DGST_SIZE_8_8
;
9012 parse_func
= sha512_parse_hash
;
9013 sort_by_digest
= sort_by_digest_8_8
;
9014 opti_type
= OPTI_TYPE_ZERO_BYTE
9015 | OPTI_TYPE_PRECOMPUTE_INIT
9016 | OPTI_TYPE_PRECOMPUTE_MERKLE
9017 | OPTI_TYPE_EARLY_SKIP
9018 | OPTI_TYPE_NOT_ITERATED
9019 | OPTI_TYPE_NOT_SALTED
9020 | OPTI_TYPE_USES_BITS_64
9021 | OPTI_TYPE_RAW_HASH
;
9028 case 1710: hash_type
= HASH_TYPE_SHA512
;
9029 salt_type
= SALT_TYPE_INTERN
;
9030 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9031 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9032 | OPTS_TYPE_ST_ADD80
9033 | OPTS_TYPE_ST_ADDBITS15
;
9034 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9035 dgst_size
= DGST_SIZE_8_8
;
9036 parse_func
= sha512s_parse_hash
;
9037 sort_by_digest
= sort_by_digest_8_8
;
9038 opti_type
= OPTI_TYPE_ZERO_BYTE
9039 | OPTI_TYPE_PRECOMPUTE_INIT
9040 | OPTI_TYPE_PRECOMPUTE_MERKLE
9041 | OPTI_TYPE_EARLY_SKIP
9042 | OPTI_TYPE_NOT_ITERATED
9043 | OPTI_TYPE_APPENDED_SALT
9044 | OPTI_TYPE_USES_BITS_64
9045 | OPTI_TYPE_RAW_HASH
;
9052 case 1711: hash_type
= HASH_TYPE_SHA512
;
9053 salt_type
= SALT_TYPE_EMBEDDED
;
9054 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9055 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9056 | OPTS_TYPE_ST_ADD80
9057 | OPTS_TYPE_ST_ADDBITS15
;
9058 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9059 dgst_size
= DGST_SIZE_8_8
;
9060 parse_func
= sha512b64s_parse_hash
;
9061 sort_by_digest
= sort_by_digest_8_8
;
9062 opti_type
= OPTI_TYPE_ZERO_BYTE
9063 | OPTI_TYPE_PRECOMPUTE_INIT
9064 | OPTI_TYPE_PRECOMPUTE_MERKLE
9065 | OPTI_TYPE_EARLY_SKIP
9066 | OPTI_TYPE_NOT_ITERATED
9067 | OPTI_TYPE_APPENDED_SALT
9068 | OPTI_TYPE_USES_BITS_64
9069 | OPTI_TYPE_RAW_HASH
;
9076 case 1720: hash_type
= HASH_TYPE_SHA512
;
9077 salt_type
= SALT_TYPE_INTERN
;
9078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9079 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9080 | OPTS_TYPE_PT_ADD80
9081 | OPTS_TYPE_PT_ADDBITS15
;
9082 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9083 dgst_size
= DGST_SIZE_8_8
;
9084 parse_func
= sha512s_parse_hash
;
9085 sort_by_digest
= sort_by_digest_8_8
;
9086 opti_type
= OPTI_TYPE_ZERO_BYTE
9087 | OPTI_TYPE_PRECOMPUTE_INIT
9088 | OPTI_TYPE_PRECOMPUTE_MERKLE
9089 | OPTI_TYPE_EARLY_SKIP
9090 | OPTI_TYPE_NOT_ITERATED
9091 | OPTI_TYPE_PREPENDED_SALT
9092 | OPTI_TYPE_USES_BITS_64
9093 | OPTI_TYPE_RAW_HASH
;
9100 case 1722: hash_type
= HASH_TYPE_SHA512
;
9101 salt_type
= SALT_TYPE_EMBEDDED
;
9102 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9103 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9104 | OPTS_TYPE_PT_ADD80
9105 | OPTS_TYPE_PT_ADDBITS15
9107 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9108 dgst_size
= DGST_SIZE_8_8
;
9109 parse_func
= osx512_parse_hash
;
9110 sort_by_digest
= sort_by_digest_8_8
;
9111 opti_type
= OPTI_TYPE_ZERO_BYTE
9112 | OPTI_TYPE_PRECOMPUTE_INIT
9113 | OPTI_TYPE_PRECOMPUTE_MERKLE
9114 | OPTI_TYPE_EARLY_SKIP
9115 | OPTI_TYPE_NOT_ITERATED
9116 | OPTI_TYPE_PREPENDED_SALT
9117 | OPTI_TYPE_USES_BITS_64
9118 | OPTI_TYPE_RAW_HASH
;
9125 case 1730: hash_type
= HASH_TYPE_SHA512
;
9126 salt_type
= SALT_TYPE_INTERN
;
9127 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9128 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9129 | OPTS_TYPE_PT_UNICODE
9130 | OPTS_TYPE_ST_ADD80
9131 | OPTS_TYPE_ST_ADDBITS15
;
9132 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9133 dgst_size
= DGST_SIZE_8_8
;
9134 parse_func
= sha512s_parse_hash
;
9135 sort_by_digest
= sort_by_digest_8_8
;
9136 opti_type
= OPTI_TYPE_ZERO_BYTE
9137 | OPTI_TYPE_PRECOMPUTE_INIT
9138 | OPTI_TYPE_PRECOMPUTE_MERKLE
9139 | OPTI_TYPE_EARLY_SKIP
9140 | OPTI_TYPE_NOT_ITERATED
9141 | OPTI_TYPE_APPENDED_SALT
9142 | OPTI_TYPE_USES_BITS_64
9143 | OPTI_TYPE_RAW_HASH
;
9150 case 1731: hash_type
= HASH_TYPE_SHA512
;
9151 salt_type
= SALT_TYPE_EMBEDDED
;
9152 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9153 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9154 | OPTS_TYPE_PT_UNICODE
9155 | OPTS_TYPE_ST_ADD80
9156 | OPTS_TYPE_ST_ADDBITS15
9158 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9159 dgst_size
= DGST_SIZE_8_8
;
9160 parse_func
= mssql2012_parse_hash
;
9161 sort_by_digest
= sort_by_digest_8_8
;
9162 opti_type
= OPTI_TYPE_ZERO_BYTE
9163 | OPTI_TYPE_PRECOMPUTE_INIT
9164 | OPTI_TYPE_PRECOMPUTE_MERKLE
9165 | OPTI_TYPE_EARLY_SKIP
9166 | OPTI_TYPE_NOT_ITERATED
9167 | OPTI_TYPE_APPENDED_SALT
9168 | OPTI_TYPE_USES_BITS_64
9169 | OPTI_TYPE_RAW_HASH
;
9176 case 1740: hash_type
= HASH_TYPE_SHA512
;
9177 salt_type
= SALT_TYPE_INTERN
;
9178 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9179 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9180 | OPTS_TYPE_PT_ADD80
9181 | OPTS_TYPE_PT_ADDBITS15
9182 | OPTS_TYPE_PT_UNICODE
;
9183 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
9184 dgst_size
= DGST_SIZE_8_8
;
9185 parse_func
= sha512s_parse_hash
;
9186 sort_by_digest
= sort_by_digest_8_8
;
9187 opti_type
= OPTI_TYPE_ZERO_BYTE
9188 | OPTI_TYPE_PRECOMPUTE_INIT
9189 | OPTI_TYPE_PRECOMPUTE_MERKLE
9190 | OPTI_TYPE_EARLY_SKIP
9191 | OPTI_TYPE_NOT_ITERATED
9192 | OPTI_TYPE_PREPENDED_SALT
9193 | OPTI_TYPE_USES_BITS_64
9194 | OPTI_TYPE_RAW_HASH
;
9201 case 1750: hash_type
= HASH_TYPE_SHA512
;
9202 salt_type
= SALT_TYPE_INTERN
;
9203 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9204 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9205 | OPTS_TYPE_ST_ADD80
;
9206 kern_type
= KERN_TYPE_HMACSHA512_PW
;
9207 dgst_size
= DGST_SIZE_8_8
;
9208 parse_func
= hmacsha512_parse_hash
;
9209 sort_by_digest
= sort_by_digest_8_8
;
9210 opti_type
= OPTI_TYPE_ZERO_BYTE
9211 | OPTI_TYPE_USES_BITS_64
9212 | OPTI_TYPE_NOT_ITERATED
;
9219 case 1760: hash_type
= HASH_TYPE_SHA512
;
9220 salt_type
= SALT_TYPE_INTERN
;
9221 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9222 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9223 | OPTS_TYPE_PT_ADD80
9224 | OPTS_TYPE_PT_ADDBITS15
;
9225 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
9226 dgst_size
= DGST_SIZE_8_8
;
9227 parse_func
= hmacsha512_parse_hash
;
9228 sort_by_digest
= sort_by_digest_8_8
;
9229 opti_type
= OPTI_TYPE_ZERO_BYTE
9230 | OPTI_TYPE_USES_BITS_64
9231 | OPTI_TYPE_NOT_ITERATED
;
9238 case 1800: hash_type
= HASH_TYPE_SHA512
;
9239 salt_type
= SALT_TYPE_EMBEDDED
;
9240 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9242 kern_type
= KERN_TYPE_SHA512CRYPT
;
9243 dgst_size
= DGST_SIZE_8_8
;
9244 parse_func
= sha512crypt_parse_hash
;
9245 sort_by_digest
= sort_by_digest_8_8
;
9246 opti_type
= OPTI_TYPE_ZERO_BYTE
9247 | OPTI_TYPE_USES_BITS_64
;
9254 case 2000: hash_type
= HASH_TYPE_STDOUT
;
9255 salt_type
= SALT_TYPE_NONE
;
9256 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9257 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9258 kern_type
= KERN_TYPE_STDOUT
;
9259 dgst_size
= DGST_SIZE_4_4
;
9261 sort_by_digest
= NULL
;
9269 case 2100: hash_type
= HASH_TYPE_DCC2
;
9270 salt_type
= SALT_TYPE_EMBEDDED
;
9271 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9272 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9273 | OPTS_TYPE_ST_LOWER
9274 | OPTS_TYPE_ST_UNICODE
;
9275 kern_type
= KERN_TYPE_DCC2
;
9276 dgst_size
= DGST_SIZE_4_4
;
9277 parse_func
= dcc2_parse_hash
;
9278 sort_by_digest
= sort_by_digest_4_4
;
9279 opti_type
= OPTI_TYPE_ZERO_BYTE
9280 | OPTI_TYPE_SLOW_HASH_SIMD
;
9287 case 2400: hash_type
= HASH_TYPE_MD5
;
9288 salt_type
= SALT_TYPE_NONE
;
9289 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9290 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9291 kern_type
= KERN_TYPE_MD5PIX
;
9292 dgst_size
= DGST_SIZE_4_4
;
9293 parse_func
= md5pix_parse_hash
;
9294 sort_by_digest
= sort_by_digest_4_4
;
9295 opti_type
= OPTI_TYPE_ZERO_BYTE
9296 | OPTI_TYPE_PRECOMPUTE_INIT
9297 | OPTI_TYPE_PRECOMPUTE_MERKLE
9298 | OPTI_TYPE_EARLY_SKIP
9299 | OPTI_TYPE_NOT_ITERATED
9300 | OPTI_TYPE_NOT_SALTED
;
9307 case 2410: hash_type
= HASH_TYPE_MD5
;
9308 salt_type
= SALT_TYPE_INTERN
;
9309 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9310 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9311 kern_type
= KERN_TYPE_MD5ASA
;
9312 dgst_size
= DGST_SIZE_4_4
;
9313 parse_func
= md5asa_parse_hash
;
9314 sort_by_digest
= sort_by_digest_4_4
;
9315 opti_type
= OPTI_TYPE_ZERO_BYTE
9316 | OPTI_TYPE_PRECOMPUTE_INIT
9317 | OPTI_TYPE_PRECOMPUTE_MERKLE
9318 | OPTI_TYPE_EARLY_SKIP
9319 | OPTI_TYPE_NOT_ITERATED
;
9326 case 2500: hash_type
= HASH_TYPE_WPA
;
9327 salt_type
= SALT_TYPE_EMBEDDED
;
9328 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9329 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9330 kern_type
= KERN_TYPE_WPA
;
9331 dgst_size
= DGST_SIZE_4_4
;
9332 parse_func
= wpa_parse_hash
;
9333 sort_by_digest
= sort_by_digest_4_4
;
9334 opti_type
= OPTI_TYPE_ZERO_BYTE
9335 | OPTI_TYPE_SLOW_HASH_SIMD
;
9342 case 2600: hash_type
= HASH_TYPE_MD5
;
9343 salt_type
= SALT_TYPE_VIRTUAL
;
9344 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9345 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9346 | OPTS_TYPE_PT_ADD80
9347 | OPTS_TYPE_PT_ADDBITS14
9348 | OPTS_TYPE_ST_ADD80
;
9349 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9350 dgst_size
= DGST_SIZE_4_4
;
9351 parse_func
= md5md5_parse_hash
;
9352 sort_by_digest
= sort_by_digest_4_4
;
9353 opti_type
= OPTI_TYPE_ZERO_BYTE
9354 | OPTI_TYPE_PRECOMPUTE_INIT
9355 | OPTI_TYPE_PRECOMPUTE_MERKLE
9356 | OPTI_TYPE_EARLY_SKIP
;
9363 case 2611: hash_type
= HASH_TYPE_MD5
;
9364 salt_type
= SALT_TYPE_INTERN
;
9365 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9366 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9367 | OPTS_TYPE_PT_ADD80
9368 | OPTS_TYPE_PT_ADDBITS14
9369 | OPTS_TYPE_ST_ADD80
;
9370 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9371 dgst_size
= DGST_SIZE_4_4
;
9372 parse_func
= vb3_parse_hash
;
9373 sort_by_digest
= sort_by_digest_4_4
;
9374 opti_type
= OPTI_TYPE_ZERO_BYTE
9375 | OPTI_TYPE_PRECOMPUTE_INIT
9376 | OPTI_TYPE_PRECOMPUTE_MERKLE
9377 | OPTI_TYPE_EARLY_SKIP
;
9384 case 2612: hash_type
= HASH_TYPE_MD5
;
9385 salt_type
= SALT_TYPE_EMBEDDED
;
9386 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9387 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9388 | OPTS_TYPE_PT_ADD80
9389 | OPTS_TYPE_PT_ADDBITS14
9390 | OPTS_TYPE_ST_ADD80
9392 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9393 dgst_size
= DGST_SIZE_4_4
;
9394 parse_func
= phps_parse_hash
;
9395 sort_by_digest
= sort_by_digest_4_4
;
9396 opti_type
= OPTI_TYPE_ZERO_BYTE
9397 | OPTI_TYPE_PRECOMPUTE_INIT
9398 | OPTI_TYPE_PRECOMPUTE_MERKLE
9399 | OPTI_TYPE_EARLY_SKIP
;
9406 case 2711: hash_type
= HASH_TYPE_MD5
;
9407 salt_type
= SALT_TYPE_INTERN
;
9408 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9409 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9410 | OPTS_TYPE_PT_ADD80
9411 | OPTS_TYPE_PT_ADDBITS14
9412 | OPTS_TYPE_ST_ADD80
;
9413 kern_type
= KERN_TYPE_MD55_PWSLT2
;
9414 dgst_size
= DGST_SIZE_4_4
;
9415 parse_func
= vb30_parse_hash
;
9416 sort_by_digest
= sort_by_digest_4_4
;
9417 opti_type
= OPTI_TYPE_ZERO_BYTE
9418 | OPTI_TYPE_PRECOMPUTE_INIT
9419 | OPTI_TYPE_EARLY_SKIP
;
9426 case 2811: hash_type
= HASH_TYPE_MD5
;
9427 salt_type
= SALT_TYPE_INTERN
;
9428 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9429 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9430 | OPTS_TYPE_PT_ADD80
9431 | OPTS_TYPE_PT_ADDBITS14
;
9432 kern_type
= KERN_TYPE_MD55_SLTPW
;
9433 dgst_size
= DGST_SIZE_4_4
;
9434 parse_func
= ipb2_parse_hash
;
9435 sort_by_digest
= sort_by_digest_4_4
;
9436 opti_type
= OPTI_TYPE_ZERO_BYTE
9437 | OPTI_TYPE_PRECOMPUTE_INIT
9438 | OPTI_TYPE_EARLY_SKIP
;
9445 case 3000: hash_type
= HASH_TYPE_LM
;
9446 salt_type
= SALT_TYPE_NONE
;
9447 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9448 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9449 | OPTS_TYPE_PT_UPPER
9450 | OPTS_TYPE_PT_BITSLICE
;
9451 kern_type
= KERN_TYPE_LM
;
9452 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9453 parse_func
= lm_parse_hash
;
9454 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9455 opti_type
= OPTI_TYPE_ZERO_BYTE
9456 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9463 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
9464 salt_type
= SALT_TYPE_INTERN
;
9465 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9466 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9467 | OPTS_TYPE_PT_UPPER
9468 | OPTS_TYPE_ST_UPPER
;
9469 kern_type
= KERN_TYPE_ORACLEH
;
9470 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9471 parse_func
= oracleh_parse_hash
;
9472 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9473 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9480 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9481 salt_type
= SALT_TYPE_EMBEDDED
;
9482 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9483 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9484 | OPTS_TYPE_ST_GENERATE_LE
;
9485 kern_type
= KERN_TYPE_BCRYPT
;
9486 dgst_size
= DGST_SIZE_4_6
;
9487 parse_func
= bcrypt_parse_hash
;
9488 sort_by_digest
= sort_by_digest_4_6
;
9489 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9496 case 3710: hash_type
= HASH_TYPE_MD5
;
9497 salt_type
= SALT_TYPE_INTERN
;
9498 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9500 | OPTS_TYPE_PT_ADD80
9501 | OPTS_TYPE_PT_ADDBITS14
;
9502 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9503 dgst_size
= DGST_SIZE_4_4
;
9504 parse_func
= md5s_parse_hash
;
9505 sort_by_digest
= sort_by_digest_4_4
;
9506 opti_type
= OPTI_TYPE_ZERO_BYTE
9507 | OPTI_TYPE_PRECOMPUTE_INIT
9508 | OPTI_TYPE_PRECOMPUTE_MERKLE
9509 | OPTI_TYPE_EARLY_SKIP
;
9516 case 3711: hash_type
= HASH_TYPE_MD5
;
9517 salt_type
= SALT_TYPE_EMBEDDED
;
9518 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9519 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9520 | OPTS_TYPE_PT_ADD80
9521 | OPTS_TYPE_PT_ADDBITS14
;
9522 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9523 dgst_size
= DGST_SIZE_4_4
;
9524 parse_func
= mediawiki_b_parse_hash
;
9525 sort_by_digest
= sort_by_digest_4_4
;
9526 opti_type
= OPTI_TYPE_ZERO_BYTE
9527 | OPTI_TYPE_PRECOMPUTE_INIT
9528 | OPTI_TYPE_PRECOMPUTE_MERKLE
9529 | OPTI_TYPE_EARLY_SKIP
;
9536 case 3800: hash_type
= HASH_TYPE_MD5
;
9537 salt_type
= SALT_TYPE_INTERN
;
9538 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9540 | OPTS_TYPE_ST_ADDBITS14
;
9541 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9542 dgst_size
= DGST_SIZE_4_4
;
9543 parse_func
= md5s_parse_hash
;
9544 sort_by_digest
= sort_by_digest_4_4
;
9545 opti_type
= OPTI_TYPE_ZERO_BYTE
9546 | OPTI_TYPE_PRECOMPUTE_INIT
9547 | OPTI_TYPE_PRECOMPUTE_MERKLE
9548 | OPTI_TYPE_EARLY_SKIP
9549 | OPTI_TYPE_NOT_ITERATED
9550 | OPTI_TYPE_RAW_HASH
;
9557 case 4300: hash_type
= HASH_TYPE_MD5
;
9558 salt_type
= SALT_TYPE_VIRTUAL
;
9559 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9560 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9561 | OPTS_TYPE_PT_ADD80
9562 | OPTS_TYPE_PT_ADDBITS14
9563 | OPTS_TYPE_ST_ADD80
;
9564 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9565 dgst_size
= DGST_SIZE_4_4
;
9566 parse_func
= md5md5_parse_hash
;
9567 sort_by_digest
= sort_by_digest_4_4
;
9568 opti_type
= OPTI_TYPE_ZERO_BYTE
9569 | OPTI_TYPE_PRECOMPUTE_INIT
9570 | OPTI_TYPE_PRECOMPUTE_MERKLE
9571 | OPTI_TYPE_EARLY_SKIP
;
9579 case 4400: hash_type
= HASH_TYPE_MD5
;
9580 salt_type
= SALT_TYPE_NONE
;
9581 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9582 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9583 | OPTS_TYPE_PT_ADD80
9584 | OPTS_TYPE_PT_ADDBITS15
;
9585 kern_type
= KERN_TYPE_MD5_SHA1
;
9586 dgst_size
= DGST_SIZE_4_4
;
9587 parse_func
= md5_parse_hash
;
9588 sort_by_digest
= sort_by_digest_4_4
;
9589 opti_type
= OPTI_TYPE_ZERO_BYTE
9590 | OPTI_TYPE_PRECOMPUTE_INIT
9591 | OPTI_TYPE_PRECOMPUTE_MERKLE
9592 | OPTI_TYPE_EARLY_SKIP
9593 | OPTI_TYPE_NOT_ITERATED
9594 | OPTI_TYPE_NOT_SALTED
9595 | OPTI_TYPE_RAW_HASH
;
9602 case 4500: hash_type
= HASH_TYPE_SHA1
;
9603 salt_type
= SALT_TYPE_NONE
;
9604 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9605 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9606 | OPTS_TYPE_PT_ADD80
9607 | OPTS_TYPE_PT_ADDBITS15
;
9608 kern_type
= KERN_TYPE_SHA11
;
9609 dgst_size
= DGST_SIZE_4_5
;
9610 parse_func
= sha1_parse_hash
;
9611 sort_by_digest
= sort_by_digest_4_5
;
9612 opti_type
= OPTI_TYPE_ZERO_BYTE
9613 | OPTI_TYPE_PRECOMPUTE_INIT
9614 | OPTI_TYPE_PRECOMPUTE_MERKLE
9615 | OPTI_TYPE_EARLY_SKIP
9616 | OPTI_TYPE_NOT_SALTED
;
9623 case 4700: hash_type
= HASH_TYPE_SHA1
;
9624 salt_type
= SALT_TYPE_NONE
;
9625 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9627 | OPTS_TYPE_PT_ADD80
9628 | OPTS_TYPE_PT_ADDBITS14
;
9629 kern_type
= KERN_TYPE_SHA1_MD5
;
9630 dgst_size
= DGST_SIZE_4_5
;
9631 parse_func
= sha1_parse_hash
;
9632 sort_by_digest
= sort_by_digest_4_5
;
9633 opti_type
= OPTI_TYPE_ZERO_BYTE
9634 | OPTI_TYPE_PRECOMPUTE_INIT
9635 | OPTI_TYPE_PRECOMPUTE_MERKLE
9636 | OPTI_TYPE_EARLY_SKIP
9637 | OPTI_TYPE_NOT_ITERATED
9638 | OPTI_TYPE_NOT_SALTED
9639 | OPTI_TYPE_RAW_HASH
;
9646 case 4800: hash_type
= HASH_TYPE_MD5
;
9647 salt_type
= SALT_TYPE_EMBEDDED
;
9648 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9649 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9650 | OPTS_TYPE_PT_ADDBITS14
;
9651 kern_type
= KERN_TYPE_MD5_CHAP
;
9652 dgst_size
= DGST_SIZE_4_4
;
9653 parse_func
= chap_parse_hash
;
9654 sort_by_digest
= sort_by_digest_4_4
;
9655 opti_type
= OPTI_TYPE_ZERO_BYTE
9656 | OPTI_TYPE_PRECOMPUTE_INIT
9657 | OPTI_TYPE_PRECOMPUTE_MERKLE
9658 | OPTI_TYPE_MEET_IN_MIDDLE
9659 | OPTI_TYPE_EARLY_SKIP
9660 | OPTI_TYPE_NOT_ITERATED
9661 | OPTI_TYPE_RAW_HASH
;
9668 case 4900: hash_type
= HASH_TYPE_SHA1
;
9669 salt_type
= SALT_TYPE_INTERN
;
9670 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9671 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9672 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9673 dgst_size
= DGST_SIZE_4_5
;
9674 parse_func
= sha1s_parse_hash
;
9675 sort_by_digest
= sort_by_digest_4_5
;
9676 opti_type
= OPTI_TYPE_ZERO_BYTE
9677 | OPTI_TYPE_PRECOMPUTE_INIT
9678 | OPTI_TYPE_PRECOMPUTE_MERKLE
9679 | OPTI_TYPE_EARLY_SKIP
;
9686 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9687 salt_type
= SALT_TYPE_EMBEDDED
;
9688 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9689 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9690 | OPTS_TYPE_PT_ADD01
;
9691 kern_type
= KERN_TYPE_KECCAK
;
9692 dgst_size
= DGST_SIZE_8_25
;
9693 parse_func
= keccak_parse_hash
;
9694 sort_by_digest
= sort_by_digest_8_25
;
9695 opti_type
= OPTI_TYPE_ZERO_BYTE
9696 | OPTI_TYPE_USES_BITS_64
9697 | OPTI_TYPE_RAW_HASH
;
9704 case 5100: hash_type
= HASH_TYPE_MD5H
;
9705 salt_type
= SALT_TYPE_NONE
;
9706 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9707 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9708 | OPTS_TYPE_PT_ADD80
9709 | OPTS_TYPE_PT_ADDBITS14
;
9710 kern_type
= KERN_TYPE_MD5H
;
9711 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9712 parse_func
= md5half_parse_hash
;
9713 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9714 opti_type
= OPTI_TYPE_ZERO_BYTE
9715 | OPTI_TYPE_RAW_HASH
;
9722 case 5200: hash_type
= HASH_TYPE_SHA256
;
9723 salt_type
= SALT_TYPE_EMBEDDED
;
9724 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9725 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9726 kern_type
= KERN_TYPE_PSAFE3
;
9727 dgst_size
= DGST_SIZE_4_8
;
9728 parse_func
= psafe3_parse_hash
;
9729 sort_by_digest
= sort_by_digest_4_8
;
9730 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9737 case 5300: hash_type
= HASH_TYPE_MD5
;
9738 salt_type
= SALT_TYPE_EMBEDDED
;
9739 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9740 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9741 | OPTS_TYPE_ST_ADD80
;
9742 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9743 dgst_size
= DGST_SIZE_4_4
;
9744 parse_func
= ikepsk_md5_parse_hash
;
9745 sort_by_digest
= sort_by_digest_4_4
;
9746 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9753 case 5400: hash_type
= HASH_TYPE_SHA1
;
9754 salt_type
= SALT_TYPE_EMBEDDED
;
9755 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9756 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9757 | OPTS_TYPE_ST_ADD80
;
9758 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9759 dgst_size
= DGST_SIZE_4_5
;
9760 parse_func
= ikepsk_sha1_parse_hash
;
9761 sort_by_digest
= sort_by_digest_4_5
;
9762 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9769 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9770 salt_type
= SALT_TYPE_EMBEDDED
;
9771 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9772 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9773 | OPTS_TYPE_PT_ADD80
9774 | OPTS_TYPE_PT_ADDBITS14
9775 | OPTS_TYPE_PT_UNICODE
9777 kern_type
= KERN_TYPE_NETNTLMv1
;
9778 dgst_size
= DGST_SIZE_4_4
;
9779 parse_func
= netntlmv1_parse_hash
;
9780 sort_by_digest
= sort_by_digest_4_4
;
9781 opti_type
= OPTI_TYPE_ZERO_BYTE
9782 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9789 case 5600: hash_type
= HASH_TYPE_MD5
;
9790 salt_type
= SALT_TYPE_EMBEDDED
;
9791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9793 | OPTS_TYPE_PT_ADD80
9794 | OPTS_TYPE_PT_ADDBITS14
9795 | OPTS_TYPE_PT_UNICODE
;
9796 kern_type
= KERN_TYPE_NETNTLMv2
;
9797 dgst_size
= DGST_SIZE_4_4
;
9798 parse_func
= netntlmv2_parse_hash
;
9799 sort_by_digest
= sort_by_digest_4_4
;
9800 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9807 case 5700: hash_type
= HASH_TYPE_SHA256
;
9808 salt_type
= SALT_TYPE_NONE
;
9809 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9810 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9811 | OPTS_TYPE_PT_ADD80
9812 | OPTS_TYPE_PT_ADDBITS15
;
9813 kern_type
= KERN_TYPE_SHA256
;
9814 dgst_size
= DGST_SIZE_4_8
;
9815 parse_func
= cisco4_parse_hash
;
9816 sort_by_digest
= sort_by_digest_4_8
;
9817 opti_type
= OPTI_TYPE_ZERO_BYTE
9818 | OPTI_TYPE_PRECOMPUTE_INIT
9819 | OPTI_TYPE_PRECOMPUTE_MERKLE
9820 | OPTI_TYPE_EARLY_SKIP
9821 | OPTI_TYPE_NOT_ITERATED
9822 | OPTI_TYPE_NOT_SALTED
9823 | OPTI_TYPE_RAW_HASH
;
9830 case 5800: hash_type
= HASH_TYPE_SHA1
;
9831 salt_type
= SALT_TYPE_INTERN
;
9832 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9833 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9834 | OPTS_TYPE_ST_ADD80
;
9835 kern_type
= KERN_TYPE_ANDROIDPIN
;
9836 dgst_size
= DGST_SIZE_4_5
;
9837 parse_func
= androidpin_parse_hash
;
9838 sort_by_digest
= sort_by_digest_4_5
;
9839 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9846 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9847 salt_type
= SALT_TYPE_NONE
;
9848 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9849 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9850 | OPTS_TYPE_PT_ADD80
;
9851 kern_type
= KERN_TYPE_RIPEMD160
;
9852 dgst_size
= DGST_SIZE_4_5
;
9853 parse_func
= ripemd160_parse_hash
;
9854 sort_by_digest
= sort_by_digest_4_5
;
9855 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9862 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9863 salt_type
= SALT_TYPE_NONE
;
9864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9865 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9866 | OPTS_TYPE_PT_ADD80
;
9867 kern_type
= KERN_TYPE_WHIRLPOOL
;
9868 dgst_size
= DGST_SIZE_4_16
;
9869 parse_func
= whirlpool_parse_hash
;
9870 sort_by_digest
= sort_by_digest_4_16
;
9871 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9878 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9879 salt_type
= SALT_TYPE_EMBEDDED
;
9880 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9882 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9883 dgst_size
= DGST_SIZE_4_5
;
9884 parse_func
= truecrypt_parse_hash_2k
;
9885 sort_by_digest
= sort_by_digest_4_5
;
9886 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9893 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9894 salt_type
= SALT_TYPE_EMBEDDED
;
9895 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9896 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9897 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9898 dgst_size
= DGST_SIZE_4_5
;
9899 parse_func
= truecrypt_parse_hash_2k
;
9900 sort_by_digest
= sort_by_digest_4_5
;
9901 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9908 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9909 salt_type
= SALT_TYPE_EMBEDDED
;
9910 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9911 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9912 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9913 dgst_size
= DGST_SIZE_4_5
;
9914 parse_func
= truecrypt_parse_hash_2k
;
9915 sort_by_digest
= sort_by_digest_4_5
;
9916 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9923 case 6221: hash_type
= HASH_TYPE_SHA512
;
9924 salt_type
= SALT_TYPE_EMBEDDED
;
9925 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9926 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9927 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9928 dgst_size
= DGST_SIZE_8_8
;
9929 parse_func
= truecrypt_parse_hash_1k
;
9930 sort_by_digest
= sort_by_digest_8_8
;
9931 opti_type
= OPTI_TYPE_ZERO_BYTE
9932 | OPTI_TYPE_USES_BITS_64
;
9939 case 6222: hash_type
= HASH_TYPE_SHA512
;
9940 salt_type
= SALT_TYPE_EMBEDDED
;
9941 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9942 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9943 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9944 dgst_size
= DGST_SIZE_8_8
;
9945 parse_func
= truecrypt_parse_hash_1k
;
9946 sort_by_digest
= sort_by_digest_8_8
;
9947 opti_type
= OPTI_TYPE_ZERO_BYTE
9948 | OPTI_TYPE_USES_BITS_64
;
9955 case 6223: hash_type
= HASH_TYPE_SHA512
;
9956 salt_type
= SALT_TYPE_EMBEDDED
;
9957 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9958 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9959 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9960 dgst_size
= DGST_SIZE_8_8
;
9961 parse_func
= truecrypt_parse_hash_1k
;
9962 sort_by_digest
= sort_by_digest_8_8
;
9963 opti_type
= OPTI_TYPE_ZERO_BYTE
9964 | OPTI_TYPE_USES_BITS_64
;
9971 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS512
;
9976 dgst_size
= DGST_SIZE_4_8
;
9977 parse_func
= truecrypt_parse_hash_1k
;
9978 sort_by_digest
= sort_by_digest_4_8
;
9979 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9986 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS1024
;
9991 dgst_size
= DGST_SIZE_4_8
;
9992 parse_func
= truecrypt_parse_hash_1k
;
9993 sort_by_digest
= sort_by_digest_4_8
;
9994 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10001 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS1536
;
10006 dgst_size
= DGST_SIZE_4_8
;
10007 parse_func
= truecrypt_parse_hash_1k
;
10008 sort_by_digest
= sort_by_digest_4_8
;
10009 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10016 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
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_TCRIPEMD160_XTS512
;
10021 dgst_size
= DGST_SIZE_4_5
;
10022 parse_func
= truecrypt_parse_hash_1k
;
10023 sort_by_digest
= sort_by_digest_4_5
;
10024 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10031 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
10032 salt_type
= SALT_TYPE_EMBEDDED
;
10033 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10034 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10035 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10036 dgst_size
= DGST_SIZE_4_5
;
10037 parse_func
= truecrypt_parse_hash_1k
;
10038 sort_by_digest
= sort_by_digest_4_5
;
10039 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10046 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
10047 salt_type
= SALT_TYPE_EMBEDDED
;
10048 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10049 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10050 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10051 dgst_size
= DGST_SIZE_4_5
;
10052 parse_func
= truecrypt_parse_hash_1k
;
10053 sort_by_digest
= sort_by_digest_4_5
;
10054 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10061 case 6300: hash_type
= HASH_TYPE_MD5
;
10062 salt_type
= SALT_TYPE_EMBEDDED
;
10063 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10064 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10065 kern_type
= KERN_TYPE_MD5AIX
;
10066 dgst_size
= DGST_SIZE_4_4
;
10067 parse_func
= md5aix_parse_hash
;
10068 sort_by_digest
= sort_by_digest_4_4
;
10069 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10076 case 6400: hash_type
= HASH_TYPE_SHA256
;
10077 salt_type
= SALT_TYPE_EMBEDDED
;
10078 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10079 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10080 kern_type
= KERN_TYPE_SHA256AIX
;
10081 dgst_size
= DGST_SIZE_4_8
;
10082 parse_func
= sha256aix_parse_hash
;
10083 sort_by_digest
= sort_by_digest_4_8
;
10084 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10091 case 6500: hash_type
= HASH_TYPE_SHA512
;
10092 salt_type
= SALT_TYPE_EMBEDDED
;
10093 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10094 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10095 kern_type
= KERN_TYPE_SHA512AIX
;
10096 dgst_size
= DGST_SIZE_8_8
;
10097 parse_func
= sha512aix_parse_hash
;
10098 sort_by_digest
= sort_by_digest_8_8
;
10099 opti_type
= OPTI_TYPE_ZERO_BYTE
10100 | OPTI_TYPE_USES_BITS_64
;
10107 case 6600: hash_type
= HASH_TYPE_AES
;
10108 salt_type
= SALT_TYPE_EMBEDDED
;
10109 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10110 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10111 kern_type
= KERN_TYPE_AGILEKEY
;
10112 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10113 parse_func
= agilekey_parse_hash
;
10114 sort_by_digest
= sort_by_digest_4_5
;
10115 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10122 case 6700: hash_type
= HASH_TYPE_SHA1
;
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_SHA1AIX
;
10127 dgst_size
= DGST_SIZE_4_5
;
10128 parse_func
= sha1aix_parse_hash
;
10129 sort_by_digest
= sort_by_digest_4_5
;
10130 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10137 case 6800: hash_type
= HASH_TYPE_AES
;
10138 salt_type
= SALT_TYPE_EMBEDDED
;
10139 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10140 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10141 kern_type
= KERN_TYPE_LASTPASS
;
10142 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
10143 parse_func
= lastpass_parse_hash
;
10144 sort_by_digest
= sort_by_digest_4_8
;
10145 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10152 case 6900: hash_type
= HASH_TYPE_GOST
;
10153 salt_type
= SALT_TYPE_NONE
;
10154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10156 kern_type
= KERN_TYPE_GOST
;
10157 dgst_size
= DGST_SIZE_4_8
;
10158 parse_func
= gost_parse_hash
;
10159 sort_by_digest
= sort_by_digest_4_8
;
10160 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10167 case 7100: hash_type
= HASH_TYPE_SHA512
;
10168 salt_type
= SALT_TYPE_EMBEDDED
;
10169 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10170 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10171 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10172 dgst_size
= DGST_SIZE_8_16
;
10173 parse_func
= sha512osx_parse_hash
;
10174 sort_by_digest
= sort_by_digest_8_16
;
10175 opti_type
= OPTI_TYPE_ZERO_BYTE
10176 | OPTI_TYPE_USES_BITS_64
10177 | OPTI_TYPE_SLOW_HASH_SIMD
;
10184 case 7200: hash_type
= HASH_TYPE_SHA512
;
10185 salt_type
= SALT_TYPE_EMBEDDED
;
10186 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10187 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10188 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10189 dgst_size
= DGST_SIZE_8_16
;
10190 parse_func
= sha512grub_parse_hash
;
10191 sort_by_digest
= sort_by_digest_8_16
;
10192 opti_type
= OPTI_TYPE_ZERO_BYTE
10193 | OPTI_TYPE_USES_BITS_64
10194 | OPTI_TYPE_SLOW_HASH_SIMD
;
10201 case 7300: hash_type
= HASH_TYPE_SHA1
;
10202 salt_type
= SALT_TYPE_EMBEDDED
;
10203 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10204 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10205 | OPTS_TYPE_ST_ADD80
10206 | OPTS_TYPE_ST_ADDBITS15
;
10207 kern_type
= KERN_TYPE_RAKP
;
10208 dgst_size
= DGST_SIZE_4_5
;
10209 parse_func
= rakp_parse_hash
;
10210 sort_by_digest
= sort_by_digest_4_5
;
10211 opti_type
= OPTI_TYPE_ZERO_BYTE
10212 | OPTI_TYPE_NOT_ITERATED
;
10219 case 7400: hash_type
= HASH_TYPE_SHA256
;
10220 salt_type
= SALT_TYPE_EMBEDDED
;
10221 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10222 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10223 kern_type
= KERN_TYPE_SHA256CRYPT
;
10224 dgst_size
= DGST_SIZE_4_8
;
10225 parse_func
= sha256crypt_parse_hash
;
10226 sort_by_digest
= sort_by_digest_4_8
;
10227 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10234 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
10235 salt_type
= SALT_TYPE_EMBEDDED
;
10236 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10237 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10238 kern_type
= KERN_TYPE_KRB5PA
;
10239 dgst_size
= DGST_SIZE_4_4
;
10240 parse_func
= krb5pa_parse_hash
;
10241 sort_by_digest
= sort_by_digest_4_4
;
10242 opti_type
= OPTI_TYPE_ZERO_BYTE
10243 | OPTI_TYPE_NOT_ITERATED
;
10250 case 7600: hash_type
= HASH_TYPE_SHA1
;
10251 salt_type
= SALT_TYPE_INTERN
;
10252 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10253 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10254 | OPTS_TYPE_PT_ADD80
10255 | OPTS_TYPE_PT_ADDBITS15
;
10256 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
10257 dgst_size
= DGST_SIZE_4_5
;
10258 parse_func
= redmine_parse_hash
;
10259 sort_by_digest
= sort_by_digest_4_5
;
10260 opti_type
= OPTI_TYPE_ZERO_BYTE
10261 | OPTI_TYPE_PRECOMPUTE_INIT
10262 | OPTI_TYPE_EARLY_SKIP
10263 | OPTI_TYPE_NOT_ITERATED
10264 | OPTI_TYPE_PREPENDED_SALT
;
10271 case 7700: hash_type
= HASH_TYPE_SAPB
;
10272 salt_type
= SALT_TYPE_EMBEDDED
;
10273 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10274 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10275 | OPTS_TYPE_PT_UPPER
10276 | OPTS_TYPE_ST_UPPER
;
10277 kern_type
= KERN_TYPE_SAPB
;
10278 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10279 parse_func
= sapb_parse_hash
;
10280 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10281 opti_type
= OPTI_TYPE_ZERO_BYTE
10282 | OPTI_TYPE_PRECOMPUTE_INIT
10283 | OPTI_TYPE_NOT_ITERATED
;
10290 case 7800: hash_type
= HASH_TYPE_SAPG
;
10291 salt_type
= SALT_TYPE_EMBEDDED
;
10292 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10293 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10294 | OPTS_TYPE_ST_ADD80
10295 | OPTS_TYPE_ST_UPPER
;
10296 kern_type
= KERN_TYPE_SAPG
;
10297 dgst_size
= DGST_SIZE_4_5
;
10298 parse_func
= sapg_parse_hash
;
10299 sort_by_digest
= sort_by_digest_4_5
;
10300 opti_type
= OPTI_TYPE_ZERO_BYTE
10301 | OPTI_TYPE_PRECOMPUTE_INIT
10302 | OPTI_TYPE_NOT_ITERATED
;
10309 case 7900: hash_type
= HASH_TYPE_SHA512
;
10310 salt_type
= SALT_TYPE_EMBEDDED
;
10311 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10313 kern_type
= KERN_TYPE_DRUPAL7
;
10314 dgst_size
= DGST_SIZE_8_8
;
10315 parse_func
= drupal7_parse_hash
;
10316 sort_by_digest
= sort_by_digest_8_8
;
10317 opti_type
= OPTI_TYPE_ZERO_BYTE
10318 | OPTI_TYPE_USES_BITS_64
;
10325 case 8000: hash_type
= HASH_TYPE_SHA256
;
10326 salt_type
= SALT_TYPE_EMBEDDED
;
10327 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10328 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10329 | OPTS_TYPE_PT_UNICODE
10330 | OPTS_TYPE_ST_ADD80
10331 | OPTS_TYPE_ST_HEX
;
10332 kern_type
= KERN_TYPE_SYBASEASE
;
10333 dgst_size
= DGST_SIZE_4_8
;
10334 parse_func
= sybasease_parse_hash
;
10335 sort_by_digest
= sort_by_digest_4_8
;
10336 opti_type
= OPTI_TYPE_ZERO_BYTE
10337 | OPTI_TYPE_PRECOMPUTE_INIT
10338 | OPTI_TYPE_EARLY_SKIP
10339 | OPTI_TYPE_NOT_ITERATED
10340 | OPTI_TYPE_RAW_HASH
;
10347 case 8100: hash_type
= HASH_TYPE_SHA1
;
10348 salt_type
= SALT_TYPE_EMBEDDED
;
10349 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10350 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
10351 kern_type
= KERN_TYPE_NETSCALER
;
10352 dgst_size
= DGST_SIZE_4_5
;
10353 parse_func
= netscaler_parse_hash
;
10354 sort_by_digest
= sort_by_digest_4_5
;
10355 opti_type
= OPTI_TYPE_ZERO_BYTE
10356 | OPTI_TYPE_PRECOMPUTE_INIT
10357 | OPTI_TYPE_PRECOMPUTE_MERKLE
10358 | OPTI_TYPE_EARLY_SKIP
10359 | OPTI_TYPE_NOT_ITERATED
10360 | OPTI_TYPE_PREPENDED_SALT
10361 | OPTI_TYPE_RAW_HASH
;
10368 case 8200: hash_type
= HASH_TYPE_SHA256
;
10369 salt_type
= SALT_TYPE_EMBEDDED
;
10370 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10371 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10372 kern_type
= KERN_TYPE_CLOUDKEY
;
10373 dgst_size
= DGST_SIZE_4_8
;
10374 parse_func
= cloudkey_parse_hash
;
10375 sort_by_digest
= sort_by_digest_4_8
;
10376 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10383 case 8300: hash_type
= HASH_TYPE_SHA1
;
10384 salt_type
= SALT_TYPE_EMBEDDED
;
10385 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10386 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10388 | OPTS_TYPE_ST_ADD80
;
10389 kern_type
= KERN_TYPE_NSEC3
;
10390 dgst_size
= DGST_SIZE_4_5
;
10391 parse_func
= nsec3_parse_hash
;
10392 sort_by_digest
= sort_by_digest_4_5
;
10393 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10400 case 8400: hash_type
= HASH_TYPE_SHA1
;
10401 salt_type
= SALT_TYPE_INTERN
;
10402 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10403 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10404 | OPTS_TYPE_PT_ADD80
10405 | OPTS_TYPE_PT_ADDBITS15
;
10406 kern_type
= KERN_TYPE_WBB3
;
10407 dgst_size
= DGST_SIZE_4_5
;
10408 parse_func
= wbb3_parse_hash
;
10409 sort_by_digest
= sort_by_digest_4_5
;
10410 opti_type
= OPTI_TYPE_ZERO_BYTE
10411 | OPTI_TYPE_PRECOMPUTE_INIT
10412 | OPTI_TYPE_NOT_ITERATED
;
10419 case 8500: hash_type
= HASH_TYPE_DESRACF
;
10420 salt_type
= SALT_TYPE_EMBEDDED
;
10421 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10422 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10423 | OPTS_TYPE_ST_UPPER
;
10424 kern_type
= KERN_TYPE_RACF
;
10425 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10426 parse_func
= racf_parse_hash
;
10427 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10428 opti_type
= OPTI_TYPE_ZERO_BYTE
10429 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10436 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
10437 salt_type
= SALT_TYPE_NONE
;
10438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10440 kern_type
= KERN_TYPE_LOTUS5
;
10441 dgst_size
= DGST_SIZE_4_4
;
10442 parse_func
= lotus5_parse_hash
;
10443 sort_by_digest
= sort_by_digest_4_4
;
10444 opti_type
= OPTI_TYPE_EARLY_SKIP
10445 | OPTI_TYPE_NOT_ITERATED
10446 | OPTI_TYPE_NOT_SALTED
10447 | OPTI_TYPE_RAW_HASH
;
10454 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
10455 salt_type
= SALT_TYPE_EMBEDDED
;
10456 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10458 kern_type
= KERN_TYPE_LOTUS6
;
10459 dgst_size
= DGST_SIZE_4_4
;
10460 parse_func
= lotus6_parse_hash
;
10461 sort_by_digest
= sort_by_digest_4_4
;
10462 opti_type
= OPTI_TYPE_EARLY_SKIP
10463 | OPTI_TYPE_NOT_ITERATED
10464 | OPTI_TYPE_RAW_HASH
;
10471 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
10472 salt_type
= SALT_TYPE_EMBEDDED
;
10473 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10474 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10475 kern_type
= KERN_TYPE_ANDROIDFDE
;
10476 dgst_size
= DGST_SIZE_4_4
;
10477 parse_func
= androidfde_parse_hash
;
10478 sort_by_digest
= sort_by_digest_4_4
;
10479 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10486 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10487 salt_type
= SALT_TYPE_EMBEDDED
;
10488 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10489 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10490 kern_type
= KERN_TYPE_SCRYPT
;
10491 dgst_size
= DGST_SIZE_4_8
;
10492 parse_func
= scrypt_parse_hash
;
10493 sort_by_digest
= sort_by_digest_4_8
;
10494 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10501 case 9000: hash_type
= HASH_TYPE_SHA1
;
10502 salt_type
= SALT_TYPE_EMBEDDED
;
10503 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10504 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10505 | OPTS_TYPE_ST_GENERATE_LE
;
10506 kern_type
= KERN_TYPE_PSAFE2
;
10507 dgst_size
= DGST_SIZE_4_5
;
10508 parse_func
= psafe2_parse_hash
;
10509 sort_by_digest
= sort_by_digest_4_5
;
10510 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10517 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10518 salt_type
= SALT_TYPE_EMBEDDED
;
10519 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10520 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10521 kern_type
= KERN_TYPE_LOTUS8
;
10522 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10523 parse_func
= lotus8_parse_hash
;
10524 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10525 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10532 case 9200: hash_type
= HASH_TYPE_SHA256
;
10533 salt_type
= SALT_TYPE_EMBEDDED
;
10534 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10535 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10536 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10537 dgst_size
= DGST_SIZE_4_32
;
10538 parse_func
= cisco8_parse_hash
;
10539 sort_by_digest
= sort_by_digest_4_32
;
10540 opti_type
= OPTI_TYPE_ZERO_BYTE
10541 | OPTI_TYPE_SLOW_HASH_SIMD
;
10548 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
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_SCRYPT
;
10553 dgst_size
= DGST_SIZE_4_8
;
10554 parse_func
= cisco9_parse_hash
;
10555 sort_by_digest
= sort_by_digest_4_8
;
10556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10563 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10564 salt_type
= SALT_TYPE_EMBEDDED
;
10565 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10567 kern_type
= KERN_TYPE_OFFICE2007
;
10568 dgst_size
= DGST_SIZE_4_4
;
10569 parse_func
= office2007_parse_hash
;
10570 sort_by_digest
= sort_by_digest_4_4
;
10571 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10578 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10579 salt_type
= SALT_TYPE_EMBEDDED
;
10580 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10582 kern_type
= KERN_TYPE_OFFICE2010
;
10583 dgst_size
= DGST_SIZE_4_4
;
10584 parse_func
= office2010_parse_hash
;
10585 sort_by_digest
= sort_by_digest_4_4
;
10586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10593 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10594 salt_type
= SALT_TYPE_EMBEDDED
;
10595 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10597 kern_type
= KERN_TYPE_OFFICE2013
;
10598 dgst_size
= DGST_SIZE_4_4
;
10599 parse_func
= office2013_parse_hash
;
10600 sort_by_digest
= sort_by_digest_4_4
;
10601 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10608 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10609 salt_type
= SALT_TYPE_EMBEDDED
;
10610 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10611 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10612 | OPTS_TYPE_PT_ADD80
10613 | OPTS_TYPE_PT_UNICODE
;
10614 kern_type
= KERN_TYPE_OLDOFFICE01
;
10615 dgst_size
= DGST_SIZE_4_4
;
10616 parse_func
= oldoffice01_parse_hash
;
10617 sort_by_digest
= sort_by_digest_4_4
;
10618 opti_type
= OPTI_TYPE_ZERO_BYTE
10619 | OPTI_TYPE_PRECOMPUTE_INIT
10620 | OPTI_TYPE_NOT_ITERATED
;
10627 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10628 salt_type
= SALT_TYPE_EMBEDDED
;
10629 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10630 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10631 | OPTS_TYPE_PT_ADD80
;
10632 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10633 dgst_size
= DGST_SIZE_4_4
;
10634 parse_func
= oldoffice01cm1_parse_hash
;
10635 sort_by_digest
= sort_by_digest_4_4
;
10636 opti_type
= OPTI_TYPE_ZERO_BYTE
10637 | OPTI_TYPE_PRECOMPUTE_INIT
10638 | OPTI_TYPE_NOT_ITERATED
;
10645 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10646 salt_type
= SALT_TYPE_EMBEDDED
;
10647 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10648 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10649 | OPTS_TYPE_PT_ADD80
10650 | OPTS_TYPE_PT_UNICODE
10651 | OPTS_TYPE_PT_NEVERCRACK
;
10652 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10653 dgst_size
= DGST_SIZE_4_4
;
10654 parse_func
= oldoffice01cm2_parse_hash
;
10655 sort_by_digest
= sort_by_digest_4_4
;
10656 opti_type
= OPTI_TYPE_ZERO_BYTE
10657 | OPTI_TYPE_PRECOMPUTE_INIT
10658 | OPTI_TYPE_NOT_ITERATED
;
10665 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10666 salt_type
= SALT_TYPE_EMBEDDED
;
10667 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10668 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10669 | OPTS_TYPE_PT_ADD80
10670 | OPTS_TYPE_PT_UNICODE
;
10671 kern_type
= KERN_TYPE_OLDOFFICE34
;
10672 dgst_size
= DGST_SIZE_4_4
;
10673 parse_func
= oldoffice34_parse_hash
;
10674 sort_by_digest
= sort_by_digest_4_4
;
10675 opti_type
= OPTI_TYPE_ZERO_BYTE
10676 | OPTI_TYPE_PRECOMPUTE_INIT
10677 | OPTI_TYPE_NOT_ITERATED
;
10684 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10685 salt_type
= SALT_TYPE_EMBEDDED
;
10686 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10687 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10688 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10689 dgst_size
= DGST_SIZE_4_4
;
10690 parse_func
= oldoffice34cm1_parse_hash
;
10691 sort_by_digest
= sort_by_digest_4_4
;
10692 opti_type
= OPTI_TYPE_ZERO_BYTE
10693 | OPTI_TYPE_PRECOMPUTE_INIT
10694 | OPTI_TYPE_NOT_ITERATED
;
10701 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10702 salt_type
= SALT_TYPE_EMBEDDED
;
10703 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10704 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10705 | OPTS_TYPE_PT_ADD80
10706 | OPTS_TYPE_PT_UNICODE
10707 | OPTS_TYPE_PT_NEVERCRACK
;
10708 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10709 dgst_size
= DGST_SIZE_4_4
;
10710 parse_func
= oldoffice34cm2_parse_hash
;
10711 sort_by_digest
= sort_by_digest_4_4
;
10712 opti_type
= OPTI_TYPE_ZERO_BYTE
10713 | OPTI_TYPE_PRECOMPUTE_INIT
10714 | OPTI_TYPE_NOT_ITERATED
;
10721 case 9900: hash_type
= HASH_TYPE_MD5
;
10722 salt_type
= SALT_TYPE_NONE
;
10723 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10724 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10725 kern_type
= KERN_TYPE_RADMIN2
;
10726 dgst_size
= DGST_SIZE_4_4
;
10727 parse_func
= radmin2_parse_hash
;
10728 sort_by_digest
= sort_by_digest_4_4
;
10729 opti_type
= OPTI_TYPE_ZERO_BYTE
10730 | OPTI_TYPE_PRECOMPUTE_INIT
10731 | OPTI_TYPE_EARLY_SKIP
10732 | OPTI_TYPE_NOT_ITERATED
10733 | OPTI_TYPE_NOT_SALTED
;
10740 case 10000: hash_type
= HASH_TYPE_SHA256
;
10741 salt_type
= SALT_TYPE_EMBEDDED
;
10742 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10744 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10745 dgst_size
= DGST_SIZE_4_32
;
10746 parse_func
= djangopbkdf2_parse_hash
;
10747 sort_by_digest
= sort_by_digest_4_32
;
10748 opti_type
= OPTI_TYPE_ZERO_BYTE
10749 | OPTI_TYPE_SLOW_HASH_SIMD
;
10756 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10757 salt_type
= SALT_TYPE_EMBEDDED
;
10758 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10759 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10760 kern_type
= KERN_TYPE_SIPHASH
;
10761 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10762 parse_func
= siphash_parse_hash
;
10763 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10764 opti_type
= OPTI_TYPE_ZERO_BYTE
10765 | OPTI_TYPE_NOT_ITERATED
10766 | OPTI_TYPE_RAW_HASH
;
10773 case 10200: hash_type
= HASH_TYPE_MD5
;
10774 salt_type
= SALT_TYPE_EMBEDDED
;
10775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10777 | OPTS_TYPE_ST_ADD80
10778 | OPTS_TYPE_ST_ADDBITS14
;
10779 kern_type
= KERN_TYPE_HMACMD5_PW
;
10780 dgst_size
= DGST_SIZE_4_4
;
10781 parse_func
= crammd5_parse_hash
;
10782 sort_by_digest
= sort_by_digest_4_4
;
10783 opti_type
= OPTI_TYPE_ZERO_BYTE
10784 | OPTI_TYPE_NOT_ITERATED
;
10791 case 10300: hash_type
= HASH_TYPE_SHA1
;
10792 salt_type
= SALT_TYPE_EMBEDDED
;
10793 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10794 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10795 kern_type
= KERN_TYPE_SAPH_SHA1
;
10796 dgst_size
= DGST_SIZE_4_5
;
10797 parse_func
= saph_sha1_parse_hash
;
10798 sort_by_digest
= sort_by_digest_4_5
;
10799 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10806 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10807 salt_type
= SALT_TYPE_EMBEDDED
;
10808 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10810 kern_type
= KERN_TYPE_PDF11
;
10811 dgst_size
= DGST_SIZE_4_4
;
10812 parse_func
= pdf11_parse_hash
;
10813 sort_by_digest
= sort_by_digest_4_4
;
10814 opti_type
= OPTI_TYPE_ZERO_BYTE
10815 | OPTI_TYPE_NOT_ITERATED
;
10822 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10823 salt_type
= SALT_TYPE_EMBEDDED
;
10824 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10825 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10826 kern_type
= KERN_TYPE_PDF11CM1
;
10827 dgst_size
= DGST_SIZE_4_4
;
10828 parse_func
= pdf11cm1_parse_hash
;
10829 sort_by_digest
= sort_by_digest_4_4
;
10830 opti_type
= OPTI_TYPE_ZERO_BYTE
10831 | OPTI_TYPE_NOT_ITERATED
;
10838 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10839 salt_type
= SALT_TYPE_EMBEDDED
;
10840 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10841 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10842 kern_type
= KERN_TYPE_PDF11CM2
;
10843 dgst_size
= DGST_SIZE_4_4
;
10844 parse_func
= pdf11cm2_parse_hash
;
10845 sort_by_digest
= sort_by_digest_4_4
;
10846 opti_type
= OPTI_TYPE_ZERO_BYTE
10847 | OPTI_TYPE_NOT_ITERATED
;
10854 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10855 salt_type
= SALT_TYPE_EMBEDDED
;
10856 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10857 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10858 kern_type
= KERN_TYPE_PDF14
;
10859 dgst_size
= DGST_SIZE_4_4
;
10860 parse_func
= pdf14_parse_hash
;
10861 sort_by_digest
= sort_by_digest_4_4
;
10862 opti_type
= OPTI_TYPE_ZERO_BYTE
10863 | OPTI_TYPE_NOT_ITERATED
;
10870 case 10600: hash_type
= HASH_TYPE_SHA256
;
10871 salt_type
= SALT_TYPE_EMBEDDED
;
10872 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10873 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10874 | OPTS_TYPE_ST_ADD80
10875 | OPTS_TYPE_ST_ADDBITS15
10876 | OPTS_TYPE_HASH_COPY
;
10877 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10878 dgst_size
= DGST_SIZE_4_8
;
10879 parse_func
= pdf17l3_parse_hash
;
10880 sort_by_digest
= sort_by_digest_4_8
;
10881 opti_type
= OPTI_TYPE_ZERO_BYTE
10882 | OPTI_TYPE_PRECOMPUTE_INIT
10883 | OPTI_TYPE_PRECOMPUTE_MERKLE
10884 | OPTI_TYPE_EARLY_SKIP
10885 | OPTI_TYPE_NOT_ITERATED
10886 | OPTI_TYPE_APPENDED_SALT
10887 | OPTI_TYPE_RAW_HASH
;
10894 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10895 salt_type
= SALT_TYPE_EMBEDDED
;
10896 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10897 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10898 | OPTS_TYPE_HASH_COPY
;
10899 kern_type
= KERN_TYPE_PDF17L8
;
10900 dgst_size
= DGST_SIZE_4_8
;
10901 parse_func
= pdf17l8_parse_hash
;
10902 sort_by_digest
= sort_by_digest_4_8
;
10903 opti_type
= OPTI_TYPE_ZERO_BYTE
10904 | OPTI_TYPE_NOT_ITERATED
;
10911 case 10800: hash_type
= HASH_TYPE_SHA384
;
10912 salt_type
= SALT_TYPE_NONE
;
10913 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10914 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10915 | OPTS_TYPE_PT_ADD80
10916 | OPTS_TYPE_PT_ADDBITS15
;
10917 kern_type
= KERN_TYPE_SHA384
;
10918 dgst_size
= DGST_SIZE_8_8
;
10919 parse_func
= sha384_parse_hash
;
10920 sort_by_digest
= sort_by_digest_8_8
;
10921 opti_type
= OPTI_TYPE_ZERO_BYTE
10922 | OPTI_TYPE_PRECOMPUTE_INIT
10923 | OPTI_TYPE_PRECOMPUTE_MERKLE
10924 | OPTI_TYPE_EARLY_SKIP
10925 | OPTI_TYPE_NOT_ITERATED
10926 | OPTI_TYPE_NOT_SALTED
10927 | OPTI_TYPE_USES_BITS_64
10928 | OPTI_TYPE_RAW_HASH
;
10935 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10936 salt_type
= SALT_TYPE_EMBEDDED
;
10937 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10938 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10939 | OPTS_TYPE_ST_BASE64
10940 | OPTS_TYPE_HASH_COPY
;
10941 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10942 dgst_size
= DGST_SIZE_4_32
;
10943 parse_func
= pbkdf2_sha256_parse_hash
;
10944 sort_by_digest
= sort_by_digest_4_32
;
10945 opti_type
= OPTI_TYPE_ZERO_BYTE
10946 | OPTI_TYPE_SLOW_HASH_SIMD
;
10953 case 11000: hash_type
= HASH_TYPE_MD5
;
10954 salt_type
= SALT_TYPE_INTERN
;
10955 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10956 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10957 | OPTS_TYPE_PT_ADD80
;
10958 kern_type
= KERN_TYPE_PRESTASHOP
;
10959 dgst_size
= DGST_SIZE_4_4
;
10960 parse_func
= prestashop_parse_hash
;
10961 sort_by_digest
= sort_by_digest_4_4
;
10962 opti_type
= OPTI_TYPE_ZERO_BYTE
10963 | OPTI_TYPE_PRECOMPUTE_INIT
10964 | OPTI_TYPE_NOT_ITERATED
10965 | OPTI_TYPE_PREPENDED_SALT
;
10972 case 11100: hash_type
= HASH_TYPE_MD5
;
10973 salt_type
= SALT_TYPE_EMBEDDED
;
10974 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10975 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10976 | OPTS_TYPE_ST_ADD80
;
10977 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10978 dgst_size
= DGST_SIZE_4_4
;
10979 parse_func
= postgresql_auth_parse_hash
;
10980 sort_by_digest
= sort_by_digest_4_4
;
10981 opti_type
= OPTI_TYPE_ZERO_BYTE
10982 | OPTI_TYPE_PRECOMPUTE_INIT
10983 | OPTI_TYPE_PRECOMPUTE_MERKLE
10984 | OPTI_TYPE_EARLY_SKIP
;
10991 case 11200: hash_type
= HASH_TYPE_SHA1
;
10992 salt_type
= SALT_TYPE_EMBEDDED
;
10993 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10994 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10995 | OPTS_TYPE_PT_ADD80
10996 | OPTS_TYPE_ST_HEX
;
10997 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10998 dgst_size
= DGST_SIZE_4_5
;
10999 parse_func
= mysql_auth_parse_hash
;
11000 sort_by_digest
= sort_by_digest_4_5
;
11001 opti_type
= OPTI_TYPE_ZERO_BYTE
11002 | OPTI_TYPE_EARLY_SKIP
;
11009 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
11010 salt_type
= SALT_TYPE_EMBEDDED
;
11011 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11012 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11014 | OPTS_TYPE_ST_ADD80
;
11015 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
11016 dgst_size
= DGST_SIZE_4_4
;
11017 parse_func
= bitcoin_wallet_parse_hash
;
11018 sort_by_digest
= sort_by_digest_4_4
;
11019 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11026 case 11400: hash_type
= HASH_TYPE_MD5
;
11027 salt_type
= SALT_TYPE_EMBEDDED
;
11028 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11029 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11030 | OPTS_TYPE_PT_ADD80
11031 | OPTS_TYPE_HASH_COPY
;
11032 kern_type
= KERN_TYPE_SIP_AUTH
;
11033 dgst_size
= DGST_SIZE_4_4
;
11034 parse_func
= sip_auth_parse_hash
;
11035 sort_by_digest
= sort_by_digest_4_4
;
11036 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11043 case 11500: hash_type
= HASH_TYPE_CRC32
;
11044 salt_type
= SALT_TYPE_INTERN
;
11045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11047 | OPTS_TYPE_ST_GENERATE_LE
11048 | OPTS_TYPE_ST_HEX
;
11049 kern_type
= KERN_TYPE_CRC32
;
11050 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11051 parse_func
= crc32_parse_hash
;
11052 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11053 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11060 case 11600: hash_type
= HASH_TYPE_AES
;
11061 salt_type
= SALT_TYPE_EMBEDDED
;
11062 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11063 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11064 | OPTS_TYPE_PT_NEVERCRACK
;
11065 kern_type
= KERN_TYPE_SEVEN_ZIP
;
11066 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11067 parse_func
= seven_zip_parse_hash
;
11068 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11069 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11076 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
11077 salt_type
= SALT_TYPE_NONE
;
11078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11079 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11080 | OPTS_TYPE_PT_ADD01
;
11081 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
11082 dgst_size
= DGST_SIZE_4_8
;
11083 parse_func
= gost2012sbog_256_parse_hash
;
11084 sort_by_digest
= sort_by_digest_4_8
;
11085 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11092 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
11093 salt_type
= SALT_TYPE_NONE
;
11094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11095 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11096 | OPTS_TYPE_PT_ADD01
;
11097 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
11098 dgst_size
= DGST_SIZE_4_16
;
11099 parse_func
= gost2012sbog_512_parse_hash
;
11100 sort_by_digest
= sort_by_digest_4_16
;
11101 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11108 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
11109 salt_type
= SALT_TYPE_EMBEDDED
;
11110 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11111 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11112 | OPTS_TYPE_ST_BASE64
11113 | OPTS_TYPE_HASH_COPY
;
11114 kern_type
= KERN_TYPE_PBKDF2_MD5
;
11115 dgst_size
= DGST_SIZE_4_32
;
11116 parse_func
= pbkdf2_md5_parse_hash
;
11117 sort_by_digest
= sort_by_digest_4_32
;
11118 opti_type
= OPTI_TYPE_ZERO_BYTE
11119 | OPTI_TYPE_SLOW_HASH_SIMD
;
11126 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11127 salt_type
= SALT_TYPE_EMBEDDED
;
11128 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11129 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11130 | OPTS_TYPE_ST_BASE64
11131 | OPTS_TYPE_HASH_COPY
;
11132 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
11133 dgst_size
= DGST_SIZE_4_32
;
11134 parse_func
= pbkdf2_sha1_parse_hash
;
11135 sort_by_digest
= sort_by_digest_4_32
;
11136 opti_type
= OPTI_TYPE_ZERO_BYTE
11137 | OPTI_TYPE_SLOW_HASH_SIMD
;
11144 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
11145 salt_type
= SALT_TYPE_EMBEDDED
;
11146 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11147 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11148 | OPTS_TYPE_ST_BASE64
11149 | OPTS_TYPE_HASH_COPY
;
11150 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
11151 dgst_size
= DGST_SIZE_8_16
;
11152 parse_func
= pbkdf2_sha512_parse_hash
;
11153 sort_by_digest
= sort_by_digest_8_16
;
11154 opti_type
= OPTI_TYPE_ZERO_BYTE
11155 | OPTI_TYPE_USES_BITS_64
11156 | OPTI_TYPE_SLOW_HASH_SIMD
;
11163 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
11164 salt_type
= SALT_TYPE_EMBEDDED
;
11165 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11166 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11167 kern_type
= KERN_TYPE_ECRYPTFS
;
11168 dgst_size
= DGST_SIZE_8_8
;
11169 parse_func
= ecryptfs_parse_hash
;
11170 sort_by_digest
= sort_by_digest_8_8
;
11171 opti_type
= OPTI_TYPE_ZERO_BYTE
11172 | OPTI_TYPE_USES_BITS_64
;
11179 case 12300: hash_type
= HASH_TYPE_ORACLET
;
11180 salt_type
= SALT_TYPE_EMBEDDED
;
11181 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11182 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11183 kern_type
= KERN_TYPE_ORACLET
;
11184 dgst_size
= DGST_SIZE_8_16
;
11185 parse_func
= oraclet_parse_hash
;
11186 sort_by_digest
= sort_by_digest_8_16
;
11187 opti_type
= OPTI_TYPE_ZERO_BYTE
11188 | OPTI_TYPE_USES_BITS_64
;
11195 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
11196 salt_type
= SALT_TYPE_EMBEDDED
;
11197 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11198 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11199 kern_type
= KERN_TYPE_BSDICRYPT
;
11200 dgst_size
= DGST_SIZE_4_4
;
11201 parse_func
= bsdicrypt_parse_hash
;
11202 sort_by_digest
= sort_by_digest_4_4
;
11203 opti_type
= OPTI_TYPE_ZERO_BYTE
11204 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
11211 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
11212 salt_type
= SALT_TYPE_EMBEDDED
;
11213 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11214 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11215 kern_type
= KERN_TYPE_RAR3
;
11216 dgst_size
= DGST_SIZE_4_4
;
11217 parse_func
= rar3hp_parse_hash
;
11218 sort_by_digest
= sort_by_digest_4_4
;
11219 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11226 case 12600: hash_type
= HASH_TYPE_SHA256
;
11227 salt_type
= SALT_TYPE_INTERN
;
11228 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11229 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11230 | OPTS_TYPE_PT_ADD80
;
11231 kern_type
= KERN_TYPE_CF10
;
11232 dgst_size
= DGST_SIZE_4_8
;
11233 parse_func
= cf10_parse_hash
;
11234 sort_by_digest
= sort_by_digest_4_8
;
11235 opti_type
= OPTI_TYPE_ZERO_BYTE
11236 | OPTI_TYPE_PRECOMPUTE_INIT
11237 | OPTI_TYPE_EARLY_SKIP
11238 | OPTI_TYPE_NOT_ITERATED
;
11245 case 12700: hash_type
= HASH_TYPE_AES
;
11246 salt_type
= SALT_TYPE_EMBEDDED
;
11247 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11248 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11249 | OPTS_TYPE_HASH_COPY
;
11250 kern_type
= KERN_TYPE_MYWALLET
;
11251 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
11252 parse_func
= mywallet_parse_hash
;
11253 sort_by_digest
= sort_by_digest_4_5
;
11254 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11261 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11262 salt_type
= SALT_TYPE_EMBEDDED
;
11263 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11264 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11265 kern_type
= KERN_TYPE_MS_DRSR
;
11266 dgst_size
= DGST_SIZE_4_8
;
11267 parse_func
= ms_drsr_parse_hash
;
11268 sort_by_digest
= sort_by_digest_4_8
;
11269 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11276 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11277 salt_type
= SALT_TYPE_EMBEDDED
;
11278 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11279 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11280 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
11281 dgst_size
= DGST_SIZE_4_8
;
11282 parse_func
= androidfde_samsung_parse_hash
;
11283 sort_by_digest
= sort_by_digest_4_8
;
11284 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11291 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11292 salt_type
= SALT_TYPE_EMBEDDED
;
11293 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11294 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11295 kern_type
= KERN_TYPE_RAR5
;
11296 dgst_size
= DGST_SIZE_4_4
;
11297 parse_func
= rar5_parse_hash
;
11298 sort_by_digest
= sort_by_digest_4_4
;
11299 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11306 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
11307 salt_type
= SALT_TYPE_EMBEDDED
;
11308 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11309 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11310 kern_type
= KERN_TYPE_KRB5TGS
;
11311 dgst_size
= DGST_SIZE_4_4
;
11312 parse_func
= krb5tgs_parse_hash
;
11313 sort_by_digest
= sort_by_digest_4_4
;
11314 opti_type
= OPTI_TYPE_ZERO_BYTE
11315 | OPTI_TYPE_NOT_ITERATED
;
11322 case 13200: hash_type
= HASH_TYPE_AES
;
11323 salt_type
= SALT_TYPE_EMBEDDED
;
11324 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11325 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11326 kern_type
= KERN_TYPE_AXCRYPT
;
11327 dgst_size
= DGST_SIZE_4_4
;
11328 parse_func
= axcrypt_parse_hash
;
11329 sort_by_digest
= sort_by_digest_4_4
;
11330 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11337 case 13300: hash_type
= HASH_TYPE_SHA1
;
11338 salt_type
= SALT_TYPE_NONE
;
11339 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11340 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11341 | OPTS_TYPE_PT_ADD80
11342 | OPTS_TYPE_PT_ADDBITS15
;
11343 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
11344 dgst_size
= DGST_SIZE_4_5
;
11345 parse_func
= sha1axcrypt_parse_hash
;
11346 sort_by_digest
= sort_by_digest_4_5
;
11347 opti_type
= OPTI_TYPE_ZERO_BYTE
11348 | OPTI_TYPE_PRECOMPUTE_INIT
11349 | OPTI_TYPE_EARLY_SKIP
11350 | OPTI_TYPE_NOT_ITERATED
11351 | OPTI_TYPE_NOT_SALTED
;
11358 case 13400: hash_type
= HASH_TYPE_AES
;
11359 salt_type
= SALT_TYPE_EMBEDDED
;
11360 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11362 kern_type
= KERN_TYPE_KEEPASS
;
11363 dgst_size
= DGST_SIZE_4_4
;
11364 parse_func
= keepass_parse_hash
;
11365 sort_by_digest
= sort_by_digest_4_4
;
11366 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11373 case 13500: hash_type
= HASH_TYPE_SHA1
;
11374 salt_type
= SALT_TYPE_EMBEDDED
;
11375 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11376 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11377 | OPTS_TYPE_PT_UNICODE
11378 | OPTS_TYPE_PT_ADD80
;
11379 kern_type
= KERN_TYPE_PSTOKEN
;
11380 dgst_size
= DGST_SIZE_4_5
;
11381 parse_func
= pstoken_parse_hash
;
11382 sort_by_digest
= sort_by_digest_4_5
;
11383 opti_type
= OPTI_TYPE_ZERO_BYTE
11384 | OPTI_TYPE_PRECOMPUTE_INIT
11385 | OPTI_TYPE_EARLY_SKIP
11386 | OPTI_TYPE_NOT_ITERATED
11387 | OPTI_TYPE_PREPENDED_SALT
11388 | OPTI_TYPE_RAW_HASH
;
11395 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
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_ZIP2
;
11400 dgst_size
= DGST_SIZE_4_4
;
11401 parse_func
= zip2_parse_hash
;
11402 sort_by_digest
= sort_by_digest_4_4
;
11403 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11410 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
11411 salt_type
= SALT_TYPE_EMBEDDED
;
11412 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11414 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11415 dgst_size
= DGST_SIZE_4_5
;
11416 parse_func
= veracrypt_parse_hash_655331
;
11417 sort_by_digest
= sort_by_digest_4_5
;
11418 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11425 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
11426 salt_type
= SALT_TYPE_EMBEDDED
;
11427 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11428 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11429 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11430 dgst_size
= DGST_SIZE_4_5
;
11431 parse_func
= veracrypt_parse_hash_655331
;
11432 sort_by_digest
= sort_by_digest_4_5
;
11433 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11440 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
11441 salt_type
= SALT_TYPE_EMBEDDED
;
11442 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11443 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11444 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11445 dgst_size
= DGST_SIZE_4_5
;
11446 parse_func
= veracrypt_parse_hash_655331
;
11447 sort_by_digest
= sort_by_digest_4_5
;
11448 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11455 case 13721: hash_type
= HASH_TYPE_SHA512
;
11456 salt_type
= SALT_TYPE_EMBEDDED
;
11457 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11458 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11459 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
11460 dgst_size
= DGST_SIZE_8_8
;
11461 parse_func
= veracrypt_parse_hash_500000
;
11462 sort_by_digest
= sort_by_digest_8_8
;
11463 opti_type
= OPTI_TYPE_ZERO_BYTE
11464 | OPTI_TYPE_USES_BITS_64
;
11471 case 13722: hash_type
= HASH_TYPE_SHA512
;
11472 salt_type
= SALT_TYPE_EMBEDDED
;
11473 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11474 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11475 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11476 dgst_size
= DGST_SIZE_8_8
;
11477 parse_func
= veracrypt_parse_hash_500000
;
11478 sort_by_digest
= sort_by_digest_8_8
;
11479 opti_type
= OPTI_TYPE_ZERO_BYTE
11480 | OPTI_TYPE_USES_BITS_64
;
11487 case 13723: hash_type
= HASH_TYPE_SHA512
;
11488 salt_type
= SALT_TYPE_EMBEDDED
;
11489 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11491 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11492 dgst_size
= DGST_SIZE_8_8
;
11493 parse_func
= veracrypt_parse_hash_500000
;
11494 sort_by_digest
= sort_by_digest_8_8
;
11495 opti_type
= OPTI_TYPE_ZERO_BYTE
11496 | OPTI_TYPE_USES_BITS_64
;
11503 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS512
;
11508 dgst_size
= DGST_SIZE_4_8
;
11509 parse_func
= veracrypt_parse_hash_500000
;
11510 sort_by_digest
= sort_by_digest_4_8
;
11511 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11518 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS1024
;
11523 dgst_size
= DGST_SIZE_4_8
;
11524 parse_func
= veracrypt_parse_hash_500000
;
11525 sort_by_digest
= sort_by_digest_4_8
;
11526 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11533 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
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_TCWHIRLPOOL_XTS1536
;
11538 dgst_size
= DGST_SIZE_4_8
;
11539 parse_func
= veracrypt_parse_hash_500000
;
11540 sort_by_digest
= sort_by_digest_4_8
;
11541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11548 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11549 salt_type
= SALT_TYPE_EMBEDDED
;
11550 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11551 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11552 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11553 dgst_size
= DGST_SIZE_4_5
;
11554 parse_func
= veracrypt_parse_hash_327661
;
11555 sort_by_digest
= sort_by_digest_4_5
;
11556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11563 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11564 salt_type
= SALT_TYPE_EMBEDDED
;
11565 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11567 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11568 dgst_size
= DGST_SIZE_4_5
;
11569 parse_func
= veracrypt_parse_hash_327661
;
11570 sort_by_digest
= sort_by_digest_4_5
;
11571 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11578 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11579 salt_type
= SALT_TYPE_EMBEDDED
;
11580 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11582 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11583 dgst_size
= DGST_SIZE_4_5
;
11584 parse_func
= veracrypt_parse_hash_327661
;
11585 sort_by_digest
= sort_by_digest_4_5
;
11586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11593 case 13751: 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_500000
;
11600 sort_by_digest
= sort_by_digest_4_8
;
11601 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11608 case 13752: 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_500000
;
11615 sort_by_digest
= sort_by_digest_4_8
;
11616 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11623 case 13753: 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_500000
;
11630 sort_by_digest
= sort_by_digest_4_8
;
11631 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11638 case 13761: hash_type
= HASH_TYPE_SHA256
;
11639 salt_type
= SALT_TYPE_EMBEDDED
;
11640 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11641 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11642 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11643 dgst_size
= DGST_SIZE_4_8
;
11644 parse_func
= veracrypt_parse_hash_200000
;
11645 sort_by_digest
= sort_by_digest_4_8
;
11646 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11653 case 13762: hash_type
= HASH_TYPE_SHA256
;
11654 salt_type
= SALT_TYPE_EMBEDDED
;
11655 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11656 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11657 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11658 dgst_size
= DGST_SIZE_4_8
;
11659 parse_func
= veracrypt_parse_hash_200000
;
11660 sort_by_digest
= sort_by_digest_4_8
;
11661 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11668 case 13763: hash_type
= HASH_TYPE_SHA256
;
11669 salt_type
= SALT_TYPE_EMBEDDED
;
11670 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11671 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11672 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11673 dgst_size
= DGST_SIZE_4_8
;
11674 parse_func
= veracrypt_parse_hash_200000
;
11675 sort_by_digest
= sort_by_digest_4_8
;
11676 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11683 case 13800: hash_type
= HASH_TYPE_SHA256
;
11684 salt_type
= SALT_TYPE_EMBEDDED
;
11685 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11686 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11687 | OPTS_TYPE_PT_UNICODE
;
11688 kern_type
= KERN_TYPE_WIN8PHONE
;
11689 dgst_size
= DGST_SIZE_4_8
;
11690 parse_func
= win8phone_parse_hash
;
11691 sort_by_digest
= sort_by_digest_4_8
;
11692 opti_type
= OPTI_TYPE_ZERO_BYTE
11693 | OPTI_TYPE_PRECOMPUTE_INIT
11694 | OPTI_TYPE_EARLY_SKIP
11695 | OPTI_TYPE_NOT_ITERATED
11696 | OPTI_TYPE_RAW_HASH
;
11703 default: usage_mini_print (PROGNAME
); return -1;
11710 data
.parse_func
= parse_func
;
11718 if (salt_type
== SALT_TYPE_INTERN
)
11720 opts_type
|= OPTS_TYPE_ST_HEX
;
11724 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11730 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11731 | (salt_type
== SALT_TYPE_EXTERN
)
11732 | (salt_type
== SALT_TYPE_EMBEDDED
)
11733 | (salt_type
== SALT_TYPE_VIRTUAL
));
11735 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11737 data
.hash_type
= hash_type
;
11738 data
.attack_mode
= attack_mode
;
11739 data
.attack_kern
= attack_kern
;
11740 data
.attack_exec
= attack_exec
;
11741 data
.kern_type
= kern_type
;
11742 data
.opts_type
= opts_type
;
11743 data
.dgst_size
= dgst_size
;
11744 data
.salt_type
= salt_type
;
11745 data
.isSalted
= isSalted
;
11746 data
.sort_by_digest
= sort_by_digest
;
11747 data
.dgst_pos0
= dgst_pos0
;
11748 data
.dgst_pos1
= dgst_pos1
;
11749 data
.dgst_pos2
= dgst_pos2
;
11750 data
.dgst_pos3
= dgst_pos3
;
11756 case 2500: esalt_size
= sizeof (wpa_t
); break;
11757 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11758 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11759 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11760 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11761 case 6211: esalt_size
= sizeof (tc_t
); break;
11762 case 6212: esalt_size
= sizeof (tc_t
); break;
11763 case 6213: esalt_size
= sizeof (tc_t
); break;
11764 case 6221: esalt_size
= sizeof (tc_t
); break;
11765 case 6222: esalt_size
= sizeof (tc_t
); break;
11766 case 6223: esalt_size
= sizeof (tc_t
); break;
11767 case 6231: esalt_size
= sizeof (tc_t
); break;
11768 case 6232: esalt_size
= sizeof (tc_t
); break;
11769 case 6233: esalt_size
= sizeof (tc_t
); break;
11770 case 6241: esalt_size
= sizeof (tc_t
); break;
11771 case 6242: esalt_size
= sizeof (tc_t
); break;
11772 case 6243: esalt_size
= sizeof (tc_t
); break;
11773 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11774 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11775 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11776 case 7300: esalt_size
= sizeof (rakp_t
); break;
11777 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11778 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11779 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11780 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11781 case 9400: esalt_size
= sizeof (office2007_t
); break;
11782 case 9500: esalt_size
= sizeof (office2010_t
); break;
11783 case 9600: esalt_size
= sizeof (office2013_t
); break;
11784 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11785 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11786 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11787 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11788 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11789 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11790 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11791 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11792 case 10400: esalt_size
= sizeof (pdf_t
); break;
11793 case 10410: esalt_size
= sizeof (pdf_t
); break;
11794 case 10420: esalt_size
= sizeof (pdf_t
); break;
11795 case 10500: esalt_size
= sizeof (pdf_t
); break;
11796 case 10600: esalt_size
= sizeof (pdf_t
); break;
11797 case 10700: esalt_size
= sizeof (pdf_t
); break;
11798 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11799 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11800 case 11400: esalt_size
= sizeof (sip_t
); break;
11801 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11802 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11803 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11804 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11805 case 13000: esalt_size
= sizeof (rar5_t
); break;
11806 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11807 case 13400: esalt_size
= sizeof (keepass_t
); break;
11808 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11809 case 13600: esalt_size
= sizeof (zip2_t
); break;
11810 case 13711: esalt_size
= sizeof (tc_t
); break;
11811 case 13712: esalt_size
= sizeof (tc_t
); break;
11812 case 13713: esalt_size
= sizeof (tc_t
); break;
11813 case 13721: esalt_size
= sizeof (tc_t
); break;
11814 case 13722: esalt_size
= sizeof (tc_t
); break;
11815 case 13723: esalt_size
= sizeof (tc_t
); break;
11816 case 13731: esalt_size
= sizeof (tc_t
); break;
11817 case 13732: esalt_size
= sizeof (tc_t
); break;
11818 case 13733: esalt_size
= sizeof (tc_t
); break;
11819 case 13741: esalt_size
= sizeof (tc_t
); break;
11820 case 13742: esalt_size
= sizeof (tc_t
); break;
11821 case 13743: esalt_size
= sizeof (tc_t
); break;
11822 case 13751: esalt_size
= sizeof (tc_t
); break;
11823 case 13752: esalt_size
= sizeof (tc_t
); break;
11824 case 13753: esalt_size
= sizeof (tc_t
); break;
11825 case 13761: esalt_size
= sizeof (tc_t
); break;
11826 case 13762: esalt_size
= sizeof (tc_t
); break;
11827 case 13763: esalt_size
= sizeof (tc_t
); break;
11828 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11831 data
.esalt_size
= esalt_size
;
11834 * choose dictionary parser
11837 if (hash_type
== HASH_TYPE_LM
)
11839 get_next_word_func
= get_next_word_lm
;
11841 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11843 get_next_word_func
= get_next_word_uc
;
11847 get_next_word_func
= get_next_word_std
;
11854 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11857 size_t dictstat_nmemb
= 0;
11861 uint dictstat_nmemb
= 0;
11864 char dictstat
[256] = { 0 };
11866 FILE *dictstat_fp
= NULL
;
11870 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11872 dictstat_fp
= fopen (dictstat
, "rb");
11877 struct stat tmpstat
;
11879 fstat (fileno (dictstat_fp
), &tmpstat
);
11883 struct stat64 tmpstat
;
11885 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11888 if (tmpstat
.st_mtime
< COMPTIME
)
11890 /* with v0.15 the format changed so we have to ensure user is using a good version
11891 since there is no version-header in the dictstat file */
11893 fclose (dictstat_fp
);
11899 while (!feof (dictstat_fp
))
11903 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11905 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11907 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11909 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11915 fclose (dictstat_fp
);
11924 char potfile
[256] = { 0 };
11926 if (potfile_path
== NULL
)
11928 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11932 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11935 data
.pot_fp
= NULL
;
11937 FILE *out_fp
= NULL
;
11938 FILE *pot_fp
= NULL
;
11940 if (show
== 1 || left
== 1)
11942 pot_fp
= fopen (potfile
, "rb");
11944 if (pot_fp
== NULL
)
11946 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11951 if (outfile
!= NULL
)
11953 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11955 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11969 if (potfile_disable
== 0)
11971 pot_fp
= fopen (potfile
, "ab");
11973 if (pot_fp
== NULL
)
11975 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11980 data
.pot_fp
= pot_fp
;
11987 uint pot_avail
= 0;
11989 if (show
== 1 || left
== 1)
11991 SUPPRESS_OUTPUT
= 1;
11993 pot_avail
= count_lines (pot_fp
);
11997 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11999 uint pot_hashes_avail
= 0;
12003 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12005 while (!feof (pot_fp
))
12009 int line_len
= fgetl (pot_fp
, line_buf
);
12011 if (line_len
== 0) continue;
12013 char *plain_buf
= line_buf
+ line_len
;
12015 pot_t
*pot_ptr
= &pot
[pot_cnt
];
12017 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12019 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
12020 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
12022 if (pot_cnt
== pot_hashes_avail
)
12026 for (pos
= 0; pos
< INCR_POT
; pos
++)
12028 if ((pot_cnt
+ pos
) >= pot_avail
) break;
12030 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
12032 hash_t
*tmp_hash
= &tmp_pot
->hash
;
12034 tmp_hash
->digest
= mymalloc (dgst_size
);
12038 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12043 tmp_hash
->esalt
= mymalloc (esalt_size
);
12046 pot_hashes_avail
++;
12054 int iter
= MAX_CUT_TRIES
;
12058 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
12060 if (line_buf
[i
] == ':')
12068 if (data
.hash_mode
!= 2500)
12070 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
12074 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
12076 if (line_len
> max_salt_size
)
12078 parser_status
= PARSER_GLOBAL_LENGTH
;
12082 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
12084 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
12086 hashes_buf
->salt
->salt_len
= line_len
;
12088 parser_status
= PARSER_OK
;
12092 // if NOT parsed without error, we add the ":" to the plain
12094 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
12100 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
12102 if (parser_status
< PARSER_GLOBAL_ZERO
)
12104 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
12109 if (plain_len
>= 255) continue;
12111 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
12113 pot_ptr
->plain_len
= plain_len
;
12122 SUPPRESS_OUTPUT
= 0;
12124 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
12131 uint pw_min
= PW_MIN
;
12132 uint pw_max
= PW_MAX
;
12136 case 125: if (pw_max
> 32) pw_max
= 32;
12138 case 400: if (pw_max
> 40) pw_max
= 40;
12140 case 500: if (pw_max
> 16) pw_max
= 16;
12142 case 1500: if (pw_max
> 8) pw_max
= 8;
12144 case 1600: if (pw_max
> 16) pw_max
= 16;
12146 case 1800: if (pw_max
> 16) pw_max
= 16;
12148 case 2100: if (pw_max
> 16) pw_max
= 16;
12150 case 2500: if (pw_min
< 8) pw_min
= 8;
12152 case 3000: if (pw_max
> 7) pw_max
= 7;
12154 case 5200: if (pw_max
> 24) pw_max
= 24;
12156 case 5800: if (pw_max
> 16) pw_max
= 16;
12158 case 6300: if (pw_max
> 16) pw_max
= 16;
12160 case 7400: if (pw_max
> 16) pw_max
= 16;
12162 case 7700: if (pw_max
> 8) pw_max
= 8;
12164 case 7900: if (pw_max
> 48) pw_max
= 48;
12166 case 8500: if (pw_max
> 8) pw_max
= 8;
12168 case 8600: if (pw_max
> 16) pw_max
= 16;
12170 case 9710: pw_min
= 5;
12173 case 9810: pw_min
= 5;
12176 case 10410: pw_min
= 5;
12179 case 10300: if (pw_max
< 3) pw_min
= 3;
12180 if (pw_max
> 40) pw_max
= 40;
12182 case 10500: if (pw_max
< 3) pw_min
= 3;
12183 if (pw_max
> 40) pw_max
= 40;
12185 case 10700: if (pw_max
> 16) pw_max
= 16;
12187 case 11300: if (pw_max
> 40) pw_max
= 40;
12189 case 11600: if (pw_max
> 32) pw_max
= 32;
12191 case 12500: if (pw_max
> 20) pw_max
= 20;
12193 case 12800: if (pw_max
> 24) pw_max
= 24;
12197 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12199 switch (attack_kern
)
12201 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12203 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12209 * charsets : keep them together for more easy maintainnce
12212 cs_t mp_sys
[6] = { { { 0 }, 0 } };
12213 cs_t mp_usr
[4] = { { { 0 }, 0 } };
12215 mp_setup_sys (mp_sys
);
12217 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
12218 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
12219 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
12220 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
12223 * load hashes, part I: find input mode, count hashes
12226 uint hashlist_mode
= 0;
12227 uint hashlist_format
= HLFMT_HASHCAT
;
12229 uint hashes_avail
= 0;
12231 if ((benchmark
== 0) && (stdout_flag
== 0))
12235 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
12237 if ((hash_mode
== 2500) ||
12238 (hash_mode
== 5200) ||
12239 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
12240 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
12241 (hash_mode
== 9000))
12243 hashlist_mode
= HL_MODE_ARG
;
12245 char *hashfile
= myargv
[optind
];
12247 data
.hashfile
= hashfile
;
12249 logfile_top_var_string ("target", hashfile
);
12252 if (hashlist_mode
== HL_MODE_ARG
)
12254 if (hash_mode
== 2500)
12258 if (stat (data
.hashfile
, &st
) == -1)
12260 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
12265 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
12272 else if (hashlist_mode
== HL_MODE_FILE
)
12274 char *hashfile
= myargv
[optind
];
12276 data
.hashfile
= hashfile
;
12278 logfile_top_var_string ("target", hashfile
);
12282 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12284 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12289 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
12291 hashes_avail
= count_lines (fp
);
12295 if (hashes_avail
== 0)
12297 log_error ("ERROR: hashfile is empty or corrupt");
12304 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
12306 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
12308 log_error ("ERROR: remove not supported in native hashfile-format mode");
12320 hashlist_mode
= HL_MODE_ARG
;
12325 if (hash_mode
== 3000) hashes_avail
*= 2;
12327 data
.hashlist_mode
= hashlist_mode
;
12328 data
.hashlist_format
= hashlist_format
;
12330 logfile_top_uint (hashlist_mode
);
12331 logfile_top_uint (hashlist_format
);
12334 * load hashes, part II: allocate required memory, set pointers
12337 hash_t
*hashes_buf
= NULL
;
12338 void *digests_buf
= NULL
;
12339 salt_t
*salts_buf
= NULL
;
12340 void *esalts_buf
= NULL
;
12342 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
12344 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
12346 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12350 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12352 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
12354 hashes_buf
[hash_pos
].hash_info
= hash_info
;
12356 if (username
&& (remove
|| show
|| left
))
12358 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
12363 hash_info
->orighash
= (char *) mymalloc (256);
12370 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12374 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
12379 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12382 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12384 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
12388 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
12392 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
12397 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
12402 * load hashes, part III: parse hashes or generate them if benchmark
12405 uint hashes_cnt
= 0;
12407 if (benchmark
== 0)
12411 // useless to read hash file for keyspace, cheat a little bit w/ optind
12413 else if (stdout_flag
== 1)
12415 // useless to read hash file for stdout, cheat a little bit w/ optind
12417 else if (hashes_avail
== 0)
12420 else if (hashlist_mode
== HL_MODE_ARG
)
12422 char *input_buf
= myargv
[optind
];
12424 uint input_len
= strlen (input_buf
);
12426 logfile_top_var_string ("target", input_buf
);
12428 char *hash_buf
= NULL
;
12431 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
12433 bool hash_fmt_error
= 0;
12435 if (hash_len
< 1) hash_fmt_error
= 1;
12436 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12438 if (hash_fmt_error
)
12440 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12444 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12446 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12448 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12453 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
12456 int parser_status
= PARSER_OK
;
12458 if (hash_mode
== 2500)
12462 log_error ("ERROR: hccap file not specified");
12467 hashlist_mode
= HL_MODE_FILE
;
12469 data
.hashlist_mode
= hashlist_mode
;
12471 FILE *fp
= fopen (hash_buf
, "rb");
12475 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12480 if (hashes_avail
< 1)
12482 log_error ("ERROR: hccap file is empty or corrupt");
12489 uint hccap_size
= sizeof (hccap_t
);
12491 char *in
= (char *) mymalloc (hccap_size
);
12495 int n
= fread (in
, hccap_size
, 1, fp
);
12499 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12504 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12506 if (parser_status
!= PARSER_OK
)
12508 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12513 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12515 if ((show
== 1) || (left
== 1))
12517 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12519 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12521 int cur_pos
= tmp_salt
->salt_len
;
12522 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12524 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12526 // do the appending task
12528 snprintf (salt_ptr
+ cur_pos
,
12530 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12542 wpa
->orig_mac2
[5]);
12544 // memset () the remaining part of the salt
12546 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12547 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12549 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12551 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12554 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
);
12555 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
);
12564 else if (hash_mode
== 3000)
12566 if (hash_len
== 32)
12568 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12570 hash_t
*lm_hash_left
= NULL
;
12572 if (parser_status
== PARSER_OK
)
12574 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12580 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12583 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12585 hash_t
*lm_hash_right
= NULL
;
12587 if (parser_status
== PARSER_OK
)
12589 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12595 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12600 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12602 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
);
12603 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
);
12608 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12610 if (parser_status
== PARSER_OK
)
12612 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12613 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12616 if (parser_status
== PARSER_OK
)
12622 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12628 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12630 if (parser_status
== PARSER_OK
)
12632 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12633 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12636 if (parser_status
== PARSER_OK
)
12642 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12647 else if (hashlist_mode
== HL_MODE_FILE
)
12649 char *hashfile
= data
.hashfile
;
12653 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12655 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12662 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12668 int line_len
= fgetl (fp
, line_buf
);
12670 if (line_len
== 0) continue;
12672 char *hash_buf
= NULL
;
12675 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12677 bool hash_fmt_error
= 0;
12679 if (hash_len
< 1) hash_fmt_error
= 1;
12680 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12682 if (hash_fmt_error
)
12684 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12691 char *user_buf
= NULL
;
12694 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12696 if (remove
|| show
)
12698 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12700 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12702 user_t
*user_ptr
= *user
;
12704 if (user_buf
!= NULL
)
12706 user_ptr
->user_name
= mystrdup (user_buf
);
12710 user_ptr
->user_name
= mystrdup ("");
12713 user_ptr
->user_len
= user_len
;
12717 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12719 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12721 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12726 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12729 if (hash_mode
== 3000)
12731 if (hash_len
== 32)
12733 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12735 if (parser_status
< PARSER_GLOBAL_ZERO
)
12737 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12742 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12746 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12748 if (parser_status
< PARSER_GLOBAL_ZERO
)
12750 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12755 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12757 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);
12763 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
);
12764 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
);
12768 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12770 if (parser_status
< PARSER_GLOBAL_ZERO
)
12772 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12777 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);
12779 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12780 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12787 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12789 if (parser_status
< PARSER_GLOBAL_ZERO
)
12791 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12796 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);
12798 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12799 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12809 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12811 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12818 hashes_buf
[0].salt
->salt_len
= 8;
12820 // special salt handling
12824 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12825 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12827 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12829 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12831 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12833 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12835 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12837 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12839 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12841 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12843 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12845 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12846 hashes_buf
[0].salt
->scrypt_N
= 1024;
12847 hashes_buf
[0].salt
->scrypt_r
= 1;
12848 hashes_buf
[0].salt
->scrypt_p
= 1;
12850 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12852 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12853 hashes_buf
[0].salt
->scrypt_N
= 16384;
12854 hashes_buf
[0].salt
->scrypt_r
= 1;
12855 hashes_buf
[0].salt
->scrypt_p
= 1;
12857 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12859 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12861 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12863 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12865 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12867 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12869 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12871 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12873 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12875 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12877 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12879 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12881 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12883 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12885 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12889 // special esalt handling
12893 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12895 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12896 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12898 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12899 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12901 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12902 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12903 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12904 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12906 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12907 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12908 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12909 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12911 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12913 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12914 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12915 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12917 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12918 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12919 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12921 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12922 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12923 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12925 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12926 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12927 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12929 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12930 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12931 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12933 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12934 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12935 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12937 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12938 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12939 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12941 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12943 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12945 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12946 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12947 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12956 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12958 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12960 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12962 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12964 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12966 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12968 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12970 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12972 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12974 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12976 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12978 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12980 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12982 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12984 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12986 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12988 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12990 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12992 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12994 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12996 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12998 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
13000 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
13002 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
13004 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
13006 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
13008 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
13010 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
13012 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
13014 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
13016 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
13018 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
13020 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
13022 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
13024 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
13026 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
13030 // set default iterations
13034 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
13036 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13038 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13040 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13042 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
13044 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
13046 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
13048 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
13050 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
13052 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
13054 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13056 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13058 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13060 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13062 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13064 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13066 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13068 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13070 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13072 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13074 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13076 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13078 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13080 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
13082 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
13084 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
13086 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
13088 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
13090 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
13092 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
13094 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
13096 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
13098 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
13100 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
13102 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
13104 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
13106 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
13108 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
13110 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
13112 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
13114 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
13116 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
13118 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
13120 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
13122 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
13124 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
13126 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
13128 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
13130 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
13132 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
13134 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
13136 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
13138 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
13140 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
13142 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
13144 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
13146 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
13148 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
13150 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
13152 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
13154 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
13156 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
13158 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
13160 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
13162 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13164 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13166 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13168 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13170 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13172 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13174 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13176 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13178 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13180 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13182 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13184 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13186 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13188 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13190 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13192 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13194 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13196 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13203 if (show
== 1 || left
== 1)
13205 for (uint i
= 0; i
< pot_cnt
; i
++)
13207 pot_t
*pot_ptr
= &pot
[i
];
13209 hash_t
*hashes_buf
= &pot_ptr
->hash
;
13211 local_free (hashes_buf
->digest
);
13215 local_free (hashes_buf
->salt
);
13221 if (data
.quiet
== 0) log_info_nn ("");
13226 if ((keyspace
== 0) && (stdout_flag
== 0))
13228 if (hashes_cnt
== 0)
13230 log_error ("ERROR: No hashes loaded");
13237 * Sanity check for hashfile vs outfile (should not point to the same physical file)
13240 if (data
.outfile
!= NULL
)
13242 if (data
.hashfile
!= NULL
)
13245 struct stat tmpstat_outfile
;
13246 struct stat tmpstat_hashfile
;
13250 struct stat64 tmpstat_outfile
;
13251 struct stat64 tmpstat_hashfile
;
13254 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
13256 if (tmp_outfile_fp
)
13259 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13263 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13266 fclose (tmp_outfile_fp
);
13269 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
13271 if (tmp_hashfile_fp
)
13274 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13278 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13281 fclose (tmp_hashfile_fp
);
13284 if (tmp_outfile_fp
&& tmp_outfile_fp
)
13286 tmpstat_outfile
.st_mode
= 0;
13287 tmpstat_outfile
.st_nlink
= 0;
13288 tmpstat_outfile
.st_uid
= 0;
13289 tmpstat_outfile
.st_gid
= 0;
13290 tmpstat_outfile
.st_rdev
= 0;
13291 tmpstat_outfile
.st_atime
= 0;
13293 tmpstat_hashfile
.st_mode
= 0;
13294 tmpstat_hashfile
.st_nlink
= 0;
13295 tmpstat_hashfile
.st_uid
= 0;
13296 tmpstat_hashfile
.st_gid
= 0;
13297 tmpstat_hashfile
.st_rdev
= 0;
13298 tmpstat_hashfile
.st_atime
= 0;
13301 tmpstat_outfile
.st_blksize
= 0;
13302 tmpstat_outfile
.st_blocks
= 0;
13304 tmpstat_hashfile
.st_blksize
= 0;
13305 tmpstat_hashfile
.st_blocks
= 0;
13309 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
13311 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13318 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
13320 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13330 * Remove duplicates
13333 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
13337 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13341 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13344 uint hashes_cnt_orig
= hashes_cnt
;
13348 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
13352 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
13354 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13359 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13362 if (hashes_pos
> hashes_cnt
)
13364 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
13374 uint potfile_remove_cracks
= 0;
13376 if (potfile_disable
== 0)
13380 hash_buf
.digest
= mymalloc (dgst_size
);
13381 hash_buf
.salt
= NULL
;
13382 hash_buf
.esalt
= NULL
;
13383 hash_buf
.hash_info
= NULL
;
13384 hash_buf
.cracked
= 0;
13388 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
13393 hash_buf
.esalt
= mymalloc (esalt_size
);
13396 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
13398 // no solution for these special hash types (for instane because they use hashfile in output etc)
13399 if ((hash_mode
!= 5200) &&
13400 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
13401 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
13402 (hash_mode
!= 9000))
13404 FILE *fp
= fopen (potfile
, "rb");
13408 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
13410 // to be safe work with a copy (because of line_len loop, i etc)
13411 // moved up here because it's easier to handle continue case
13414 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
13418 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
13420 if (ptr
== NULL
) break;
13422 int line_len
= strlen (line_buf
);
13424 if (line_len
== 0) continue;
13426 int iter
= MAX_CUT_TRIES
;
13428 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
13430 if (line_buf
[i
] != ':') continue;
13434 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
13437 hash_t
*found
= NULL
;
13439 if (hash_mode
== 6800)
13441 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13443 // manipulate salt_buf
13444 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
13446 hash_buf
.salt
->salt_len
= i
;
13448 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
13451 else if (hash_mode
== 2500)
13453 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13455 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
13456 // manipulate salt_buf
13458 memset (line_buf_cpy
, 0, HCBUFSIZ
);
13459 memcpy (line_buf_cpy
, line_buf
, i
);
13461 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
13463 if (mac2_pos
== NULL
) continue;
13468 if (strlen (mac2_pos
) != 12) continue;
13470 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
13472 if (mac1_pos
== NULL
) continue;
13477 if (strlen (mac1_pos
) != 12) continue;
13479 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13481 // here we need the ESSID
13482 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13484 hash_buf
.salt
->salt_len
= essid_length
;
13486 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13490 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13492 // compare hex string(s) vs binary MAC address(es)
13494 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13496 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13505 if (!found
) continue;
13507 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13509 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13521 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13523 if (parser_status
== PARSER_OK
)
13527 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13531 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13536 if (found
== NULL
) continue;
13538 if (!found
->cracked
) potfile_remove_cracks
++;
13540 found
->cracked
= 1;
13548 myfree (line_buf_cpy
);
13558 local_free (hash_buf
.esalt
);
13563 local_free (hash_buf
.salt
);
13566 local_free (hash_buf
.digest
);
13570 * Now generate all the buffers required for later
13573 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13575 salt_t
*salts_buf_new
= NULL
;
13576 void *esalts_buf_new
= NULL
;
13580 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13584 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13589 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13592 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13594 uint digests_cnt
= hashes_cnt
;
13595 uint digests_done
= 0;
13597 size_t size_digests
= digests_cnt
* dgst_size
;
13598 size_t size_shown
= digests_cnt
* sizeof (uint
);
13600 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13601 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13603 uint salts_cnt
= 0;
13604 uint salts_done
= 0;
13606 hashinfo_t
**hash_info
= NULL
;
13608 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13610 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13612 if (username
&& (remove
|| show
))
13616 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13618 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13620 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13625 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13630 // copied from inner loop
13632 salt_buf
= &salts_buf_new
[salts_cnt
];
13634 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13638 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13641 salt_buf
->digests_cnt
= 0;
13642 salt_buf
->digests_done
= 0;
13643 salt_buf
->digests_offset
= 0;
13648 if (hashes_buf
[0].cracked
== 1)
13650 digests_shown
[0] = 1;
13654 salt_buf
->digests_done
++;
13657 salt_buf
->digests_cnt
++;
13659 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13661 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13663 hash_info
[0] = hashes_buf
[0].hash_info
;
13666 // copy from inner loop
13668 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13672 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13674 salt_buf
= &salts_buf_new
[salts_cnt
];
13676 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13680 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13683 salt_buf
->digests_cnt
= 0;
13684 salt_buf
->digests_done
= 0;
13685 salt_buf
->digests_offset
= hashes_pos
;
13691 if (hashes_buf
[hashes_pos
].cracked
== 1)
13693 digests_shown
[hashes_pos
] = 1;
13697 salt_buf
->digests_done
++;
13700 salt_buf
->digests_cnt
++;
13702 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13704 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13706 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13710 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13712 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13714 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13716 salts_shown
[salt_pos
] = 1;
13721 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13724 local_free (digests_buf
);
13725 local_free (salts_buf
);
13726 local_free (esalts_buf
);
13728 digests_buf
= digests_buf_new
;
13729 salts_buf
= salts_buf_new
;
13730 esalts_buf
= esalts_buf_new
;
13732 local_free (hashes_buf
);
13735 * special modification not set from parser
13740 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13741 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13742 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13743 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13744 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13745 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13746 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13747 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13748 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13749 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13750 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13751 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13752 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13753 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13754 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13755 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13756 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13757 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13758 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13759 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13760 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13761 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13762 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13763 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13764 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13765 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13766 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13767 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13768 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13769 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13772 if (truecrypt_keyfiles
)
13774 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13776 char *keyfiles
= strdup (truecrypt_keyfiles
);
13778 char *keyfile
= strtok (keyfiles
, ",");
13782 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13784 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13789 if (veracrypt_keyfiles
)
13791 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13793 char *keyfiles
= strdup (veracrypt_keyfiles
);
13795 char *keyfile
= strtok (keyfiles
, ",");
13799 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13801 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13806 data
.digests_cnt
= digests_cnt
;
13807 data
.digests_done
= digests_done
;
13808 data
.digests_buf
= digests_buf
;
13809 data
.digests_shown
= digests_shown
;
13810 data
.digests_shown_tmp
= digests_shown_tmp
;
13812 data
.salts_cnt
= salts_cnt
;
13813 data
.salts_done
= salts_done
;
13814 data
.salts_buf
= salts_buf
;
13815 data
.salts_shown
= salts_shown
;
13817 data
.esalts_buf
= esalts_buf
;
13818 data
.hash_info
= hash_info
;
13821 * Automatic Optimizers
13824 if (salts_cnt
== 1)
13825 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13827 if (digests_cnt
== 1)
13828 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13830 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13831 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13833 if (attack_mode
== ATTACK_MODE_BF
)
13834 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13836 data
.opti_type
= opti_type
;
13838 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13840 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13842 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13844 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13846 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13847 opts_type
|= OPTS_TYPE_PT_ADD80
;
13850 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13852 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13853 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13856 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13858 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13859 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13866 * Some algorithm, like descrypt, can benefit from JIT compilation
13869 int force_jit_compilation
= -1;
13871 if (hash_mode
== 8900)
13873 force_jit_compilation
= 8900;
13875 else if (hash_mode
== 9300)
13877 force_jit_compilation
= 8900;
13879 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13881 force_jit_compilation
= 1500;
13885 * generate bitmap tables
13888 const uint bitmap_shift1
= 5;
13889 const uint bitmap_shift2
= 13;
13891 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13893 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13894 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13895 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13896 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13897 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13898 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13899 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13900 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13907 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13909 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13911 bitmap_nums
= 1u << bitmap_bits
;
13913 bitmap_mask
= bitmap_nums
- 1;
13915 bitmap_size
= bitmap_nums
* sizeof (uint
);
13917 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13919 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;
13920 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;
13925 bitmap_nums
= 1u << bitmap_bits
;
13927 bitmap_mask
= bitmap_nums
- 1;
13929 bitmap_size
= bitmap_nums
* sizeof (uint
);
13931 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);
13932 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);
13935 * prepare quick rule
13938 data
.rule_buf_l
= rule_buf_l
;
13939 data
.rule_buf_r
= rule_buf_r
;
13941 int rule_len_l
= (int) strlen (rule_buf_l
);
13942 int rule_len_r
= (int) strlen (rule_buf_r
);
13944 data
.rule_len_l
= rule_len_l
;
13945 data
.rule_len_r
= rule_len_r
;
13951 uint
*all_kernel_rules_cnt
= NULL
;
13953 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13957 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13959 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13962 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13966 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13968 uint kernel_rules_avail
= 0;
13970 uint kernel_rules_cnt
= 0;
13972 kernel_rule_t
*kernel_rules_buf
= NULL
;
13974 char *rp_file
= rp_files
[i
];
13976 char in
[BLOCK_SIZE
] = { 0 };
13977 char out
[BLOCK_SIZE
] = { 0 };
13981 uint rule_line
= 0;
13983 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13985 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13992 memset (rule_buf
, 0, HCBUFSIZ
);
13994 rule_len
= fgetl (fp
, rule_buf
);
13998 if (rule_len
== 0) continue;
14000 if (rule_buf
[0] == '#') continue;
14002 if (kernel_rules_avail
== kernel_rules_cnt
)
14004 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14006 kernel_rules_avail
+= INCR_RULES
;
14009 memset (in
, 0, BLOCK_SIZE
);
14010 memset (out
, 0, BLOCK_SIZE
);
14012 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
14016 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
14021 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
14023 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
14025 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
14031 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
14033 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
14039 kernel_rules_cnt
++;
14044 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
14046 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
14050 * merge rules or automatic rule generator
14053 uint kernel_rules_cnt
= 0;
14055 kernel_rule_t
*kernel_rules_buf
= NULL
;
14057 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14061 kernel_rules_cnt
= 1;
14063 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
14065 repeats
[0] = kernel_rules_cnt
;
14067 for (uint i
= 0; i
< rp_files_cnt
; i
++)
14069 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
14071 repeats
[i
+ 1] = kernel_rules_cnt
;
14074 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
14076 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
14078 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
14082 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
14084 for (uint j
= 0; j
< rp_files_cnt
; j
++)
14086 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
14089 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
14091 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
14093 if (out_pos
== RULES_MAX
- 1)
14095 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
14100 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
14105 local_free (repeats
);
14109 uint kernel_rules_avail
= 0;
14111 while (kernel_rules_cnt
< rp_gen
)
14113 if (kernel_rules_avail
== kernel_rules_cnt
)
14115 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14117 kernel_rules_avail
+= INCR_RULES
;
14120 memset (rule_buf
, 0, HCBUFSIZ
);
14122 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
14124 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
14126 kernel_rules_cnt
++;
14134 * generate NOP rules
14137 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
14139 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
14141 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
14143 kernel_rules_cnt
++;
14146 data
.kernel_rules_cnt
= kernel_rules_cnt
;
14147 data
.kernel_rules_buf
= kernel_rules_buf
;
14149 if (kernel_rules_cnt
== 0)
14151 log_error ("ERROR: No valid rules left");
14157 * OpenCL platforms: detect
14160 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
14161 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
14163 cl_uint platforms_cnt
= 0;
14164 cl_uint platform_devices_cnt
= 0;
14168 cl_int CL_err
= hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
14170 if (CL_err
!= CL_SUCCESS
)
14172 log_error ("ERROR: clGetPlatformIDs(): %s\n", val2cstr_cl (CL_err
));
14177 if (platforms_cnt
== 0)
14180 log_info ("ATTENTION! No OpenCL compatible platform found");
14182 log_info ("You're probably missing the OpenCL runtime installation");
14183 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
14184 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
14185 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
14191 if (opencl_platforms_filter
!= (uint
) -1)
14193 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
14195 if (opencl_platforms_filter
> platform_cnt_mask
)
14197 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
14204 if (opencl_device_types
== NULL
)
14207 * OpenCL device types:
14208 * 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.
14211 cl_device_type device_types_all
= 0;
14213 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14215 if ((opencl_platforms_filter
& (1u << platform_id
)) == 0) continue;
14217 cl_platform_id platform
= platforms
[platform_id
];
14219 cl_int CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14221 if (CL_err
!= CL_SUCCESS
)
14223 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14227 // Silently ignore at this point, it will be reused later and create a note for the user at that point
14232 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14234 cl_device_id device
= platform_devices
[platform_devices_id
];
14236 cl_device_type device_type
;
14238 cl_int CL_err
= hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14240 if (CL_err
!= CL_SUCCESS
)
14242 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14247 device_types_all
|= device_type
;
14251 // In such a case, automatically enable CPU device type support, since it's disabled by default.
14253 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
14255 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
14258 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
14259 // If we have a CPU device, force it to be used
14261 if (stdout_flag
== 1)
14263 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
14265 device_types_filter
= CL_DEVICE_TYPE_CPU
;
14271 * OpenCL devices: simply push all devices from all platforms into the same device array
14275 int need_nvapi
= 0;
14277 int need_xnvctrl
= 0;
14279 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
14281 data
.devices_param
= devices_param
;
14283 uint devices_cnt
= 0;
14285 uint devices_active
= 0;
14287 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14289 cl_int CL_err
= CL_SUCCESS
;
14291 cl_platform_id platform
= platforms
[platform_id
];
14293 char platform_vendor
[INFOSZ
] = { 0 };
14295 CL_err
= hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
14297 if (CL_err
!= CL_SUCCESS
)
14299 log_error ("ERROR: clGetPlatformInfo(): %s\n", val2cstr_cl (CL_err
));
14304 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
14305 // this causes trouble with vendor id based macros
14306 // we'll assign generic to those without special optimization available
14308 cl_uint platform_vendor_id
= 0;
14310 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
14312 platform_vendor_id
= VENDOR_ID_AMD
;
14314 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14316 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14318 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
14320 platform_vendor_id
= VENDOR_ID_APPLE
;
14322 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14324 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14326 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14328 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
14330 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
14332 platform_vendor_id
= VENDOR_ID_MESA
;
14334 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
14336 platform_vendor_id
= VENDOR_ID_NV
;
14338 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
14340 platform_vendor_id
= VENDOR_ID_POCL
;
14344 platform_vendor_id
= VENDOR_ID_GENERIC
;
14347 uint platform_skipped
= ((opencl_platforms_filter
& (1u << platform_id
)) == 0);
14349 CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14351 if (CL_err
!= CL_SUCCESS
)
14353 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14357 platform_skipped
= 2;
14360 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14362 if (machine_readable
== 0)
14364 if (platform_skipped
== 0)
14366 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
14368 char line
[256] = { 0 };
14370 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
14374 else if (platform_skipped
== 1)
14376 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
14379 else if (platform_skipped
== 2)
14381 log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id
+ 1, platform_vendor
);
14387 if (platform_skipped
== 1) continue;
14388 if (platform_skipped
== 2) continue;
14390 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14392 size_t param_value_size
= 0;
14394 const uint device_id
= devices_cnt
;
14396 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14398 device_param
->platform_vendor_id
= platform_vendor_id
;
14400 device_param
->device
= platform_devices
[platform_devices_id
];
14402 device_param
->device_id
= device_id
;
14404 device_param
->platform_devices_id
= platform_devices_id
;
14406 device_param
->platform
= platform
;
14410 cl_device_type device_type
;
14412 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14414 if (CL_err
!= CL_SUCCESS
)
14416 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14421 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
14423 device_param
->device_type
= device_type
;
14427 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
14429 if (CL_err
!= CL_SUCCESS
)
14431 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14436 char *device_name
= (char *) mymalloc (param_value_size
);
14438 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
14440 if (CL_err
!= CL_SUCCESS
)
14442 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14447 device_param
->device_name
= device_name
;
14451 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
14453 if (CL_err
!= CL_SUCCESS
)
14455 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14460 char *device_vendor
= (char *) mymalloc (param_value_size
);
14462 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
14464 if (CL_err
!= CL_SUCCESS
)
14466 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14471 device_param
->device_vendor
= device_vendor
;
14473 cl_uint device_vendor_id
= 0;
14475 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
14477 device_vendor_id
= VENDOR_ID_AMD
;
14479 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14481 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14483 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
14485 device_vendor_id
= VENDOR_ID_APPLE
;
14487 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14489 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14491 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14493 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
14495 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
14497 device_vendor_id
= VENDOR_ID_MESA
;
14499 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
14501 device_vendor_id
= VENDOR_ID_NV
;
14503 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
14505 device_vendor_id
= VENDOR_ID_POCL
;
14509 device_vendor_id
= VENDOR_ID_GENERIC
;
14512 device_param
->device_vendor_id
= device_vendor_id
;
14516 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14520 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
14522 if (CL_err
!= CL_SUCCESS
)
14524 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14529 char *device_version
= (char *) mymalloc (param_value_size
);
14531 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
14533 if (CL_err
!= CL_SUCCESS
)
14535 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14540 device_param
->device_version
= device_version
;
14542 // device_opencl_version
14544 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
14546 if (CL_err
!= CL_SUCCESS
)
14548 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14553 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
14555 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
14557 if (CL_err
!= CL_SUCCESS
)
14559 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14564 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
14566 myfree (device_opencl_version
);
14570 cl_uint vector_width
;
14572 if (opencl_vector_width_chgd
== 0)
14574 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
14576 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
14578 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
14580 if (CL_err
!= CL_SUCCESS
)
14582 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14589 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
14591 if (CL_err
!= CL_SUCCESS
)
14593 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14601 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14606 vector_width
= opencl_vector_width
;
14609 if (vector_width
> 16) vector_width
= 16;
14611 device_param
->vector_width
= vector_width
;
14613 // max_compute_units
14615 cl_uint device_processors
;
14617 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14619 if (CL_err
!= CL_SUCCESS
)
14621 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14626 device_param
->device_processors
= device_processors
;
14628 // device_maxmem_alloc
14629 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14631 cl_ulong device_maxmem_alloc
;
14633 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14635 if (CL_err
!= CL_SUCCESS
)
14637 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14642 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14644 // device_global_mem
14646 cl_ulong device_global_mem
;
14648 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14650 if (CL_err
!= CL_SUCCESS
)
14652 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14657 device_param
->device_global_mem
= device_global_mem
;
14659 // max_work_group_size
14661 size_t device_maxworkgroup_size
;
14663 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14665 if (CL_err
!= CL_SUCCESS
)
14667 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14672 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14674 // max_clock_frequency
14676 cl_uint device_maxclock_frequency
;
14678 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14680 if (CL_err
!= CL_SUCCESS
)
14682 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14687 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14689 // device_endian_little
14691 cl_bool device_endian_little
;
14693 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14695 if (CL_err
!= CL_SUCCESS
)
14697 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14702 if (device_endian_little
== CL_FALSE
)
14704 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14706 device_param
->skipped
= 1;
14709 // device_available
14711 cl_bool device_available
;
14713 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14715 if (CL_err
!= CL_SUCCESS
)
14717 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14722 if (device_available
== CL_FALSE
)
14724 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14726 device_param
->skipped
= 1;
14729 // device_compiler_available
14731 cl_bool device_compiler_available
;
14733 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14735 if (CL_err
!= CL_SUCCESS
)
14737 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14742 if (device_compiler_available
== CL_FALSE
)
14744 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14746 device_param
->skipped
= 1;
14749 // device_execution_capabilities
14751 cl_device_exec_capabilities device_execution_capabilities
;
14753 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14755 if (CL_err
!= CL_SUCCESS
)
14757 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14762 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14764 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14766 device_param
->skipped
= 1;
14769 // device_extensions
14771 size_t device_extensions_size
;
14773 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14775 if (CL_err
!= CL_SUCCESS
)
14777 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14782 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14784 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14786 if (CL_err
!= CL_SUCCESS
)
14788 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14793 if (strstr (device_extensions
, "base_atomics") == 0)
14795 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14797 device_param
->skipped
= 1;
14800 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14802 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14804 device_param
->skipped
= 1;
14807 myfree (device_extensions
);
14809 // device_local_mem_size
14811 cl_ulong device_local_mem_size
;
14813 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14815 if (CL_err
!= CL_SUCCESS
)
14817 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14822 if (device_local_mem_size
< 32768)
14824 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14826 device_param
->skipped
= 1;
14829 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14830 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14831 // This results in both utilizing it for 50%
14832 // However, Intel has much better SIMD control over their own hardware
14833 // It makes sense to give them full control over their own hardware
14835 if (device_type
& CL_DEVICE_TYPE_CPU
)
14837 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14839 if (data
.force
== 0)
14841 if (algorithm_pos
== 0)
14843 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14844 log_info (" You can use --force to override this but do not post error reports if you do so");
14847 device_param
->skipped
= 1;
14854 device_param
->skipped
|= ((devices_filter
& (1u << device_id
)) == 0);
14855 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14859 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14861 if (CL_err
!= CL_SUCCESS
)
14863 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14868 char *driver_version
= (char *) mymalloc (param_value_size
);
14870 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14872 if (CL_err
!= CL_SUCCESS
)
14874 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14879 device_param
->driver_version
= driver_version
;
14881 // device_name_chksum
14883 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14886 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
);
14888 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
);
14891 uint device_name_digest
[4] = { 0 };
14893 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14895 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14897 device_param
->device_name_chksum
= device_name_chksum
;
14901 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14903 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14908 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14922 if (device_type
& CL_DEVICE_TYPE_GPU
)
14924 if (device_vendor_id
== VENDOR_ID_NV
)
14926 cl_uint kernel_exec_timeout
= 0;
14928 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14930 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14932 if (CL_err
!= CL_SUCCESS
)
14934 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14939 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14941 cl_uint sm_minor
= 0;
14942 cl_uint sm_major
= 0;
14944 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14945 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14947 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14949 if (CL_err
!= CL_SUCCESS
)
14951 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14956 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14958 if (CL_err
!= CL_SUCCESS
)
14960 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14965 device_param
->sm_minor
= sm_minor
;
14966 device_param
->sm_major
= sm_major
;
14968 // CPU burning loop damper
14969 // Value is given as number between 0-100
14972 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14974 if (nvidia_spin_damp_chgd
== 0)
14976 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14979 * the workaround is not a friend of rule based attacks
14980 * the words from the wordlist combined with fast and slow rules cause
14981 * fluctuations which cause inaccurate wait time estimations
14982 * using a reduced damping percentage almost compensates this
14985 device_param
->nvidia_spin_damp
= 64;
14989 device_param
->nvidia_spin_damp
/= 100;
14995 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14997 if (machine_readable
== 0)
14999 if (device_param
->skipped
== 0)
15001 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
15004 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
15005 (unsigned int) (device_global_mem
/ 1024 / 1024),
15006 (unsigned int) device_processors
);
15010 log_info ("- Device #%u: %s, skipped",
15017 // common driver check
15019 if (device_param
->skipped
== 0)
15021 if (device_type
& CL_DEVICE_TYPE_GPU
)
15023 if (platform_vendor_id
== VENDOR_ID_AMD
)
15025 int catalyst_check
= (force
== 1) ? 0 : 1;
15027 int catalyst_warn
= 0;
15029 int catalyst_broken
= 0;
15031 if (catalyst_check
== 1)
15035 // v14.9 and higher
15036 if (atoi (device_param
->driver_version
) >= 1573)
15041 catalyst_check
= 0;
15044 if (catalyst_broken
== 1)
15047 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
15048 log_info ("It passes over cracked hashes and will not report them as cracked");
15049 log_info ("You are STRONGLY encouraged not to use it");
15050 log_info ("You can use --force to override this but do not post error reports if you do so");
15056 if (catalyst_warn
== 1)
15059 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
15060 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
15061 log_info ("See hashcat's homepage for official supported catalyst drivers");
15063 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
15065 log_info ("You can use --force to override this but do not post error reports if you do so");
15071 else if (platform_vendor_id
== VENDOR_ID_NV
)
15073 if (device_param
->kernel_exec_timeout
!= 0)
15075 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);
15076 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
15081 /* turns out pocl still creates segfaults (because of llvm)
15082 if (device_type & CL_DEVICE_TYPE_CPU)
15084 if (platform_vendor_id == VENDOR_ID_AMD)
15089 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
15090 log_info ("You are STRONGLY encouraged not to use it");
15091 log_info ("You can use --force to override this but do not post error reports if you do so");
15092 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
15102 * kernel accel and loops tuning db adjustment
15105 device_param
->kernel_accel_min
= 1;
15106 device_param
->kernel_accel_max
= 1024;
15108 device_param
->kernel_loops_min
= 1;
15109 device_param
->kernel_loops_max
= 1024;
15111 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
15113 if (tuningdb_entry
)
15115 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
15116 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
15120 device_param
->kernel_accel_min
= _kernel_accel
;
15121 device_param
->kernel_accel_max
= _kernel_accel
;
15126 if (workload_profile
== 1)
15128 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
15130 else if (workload_profile
== 2)
15132 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
15135 device_param
->kernel_loops_min
= _kernel_loops
;
15136 device_param
->kernel_loops_max
= _kernel_loops
;
15140 // commandline parameters overwrite tuningdb entries
15144 device_param
->kernel_accel_min
= kernel_accel
;
15145 device_param
->kernel_accel_max
= kernel_accel
;
15150 device_param
->kernel_loops_min
= kernel_loops
;
15151 device_param
->kernel_loops_max
= kernel_loops
;
15166 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
15168 if (machine_readable
== 0)
15175 if (keyspace
== 0 && devices_active
== 0)
15177 log_error ("ERROR: No devices found/left");
15182 // 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)
15184 if (devices_filter
!= (uint
) -1)
15186 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
15188 if (devices_filter
> devices_cnt_mask
)
15190 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
15196 data
.devices_cnt
= devices_cnt
;
15198 data
.devices_active
= devices_active
;
15205 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
];
15206 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
];
15207 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
];
15208 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
];
15210 memset (hm_adapters_adl
, 0, sizeof (hm_adapters_adl
));
15211 memset (hm_adapters_nvapi
, 0, sizeof (hm_adapters_nvapi
));
15212 memset (hm_adapters_nvml
, 0, sizeof (hm_adapters_nvml
));
15213 memset (hm_adapters_xnvctrl
, 0, sizeof (hm_adapters_xnvctrl
));
15215 if (gpu_temp_disable
== 0)
15217 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
15218 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
15219 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
15220 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
15222 data
.hm_adl
= NULL
;
15223 data
.hm_nvapi
= NULL
;
15224 data
.hm_nvml
= NULL
;
15225 data
.hm_xnvctrl
= NULL
;
15227 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
15229 data
.hm_nvml
= nvml
;
15234 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
15236 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
15238 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
15242 for (int i
= 0; i
< tmp_in
; i
++)
15244 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
15247 for (int i
= 0; i
< tmp_out
; i
++)
15249 unsigned int speed
;
15251 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
15253 // doesn't seem to create any advantages
15254 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
15255 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
15260 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
15262 data
.hm_nvapi
= nvapi
;
15267 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
15269 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
15271 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
15275 for (int i
= 0; i
< tmp_in
; i
++)
15277 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
15282 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
15284 data
.hm_xnvctrl
= xnvctrl
;
15287 if (data
.hm_xnvctrl
)
15289 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
15291 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15293 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15295 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15297 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
15301 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
15306 if ((need_adl
== 1) && (adl_init (adl
) == 0))
15313 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
15315 // total number of adapters
15317 int hm_adapters_num
;
15319 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return -1;
15323 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
15325 if (lpAdapterInfo
== NULL
) return -1;
15327 // get a list (of ids of) valid/usable adapters
15329 int num_adl_adapters
= 0;
15331 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
15333 if (num_adl_adapters
> 0)
15335 hc_thread_mutex_lock (mux_adl
);
15337 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
15339 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15341 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15342 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15344 hc_thread_mutex_unlock (mux_adl
);
15347 myfree (valid_adl_device_list
);
15348 myfree (lpAdapterInfo
);
15352 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15354 gpu_temp_disable
= 1;
15359 * OpenCL devices: allocate buffer for device specific information
15362 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
15364 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
15366 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
15369 * User-defined GPU temp handling
15372 if (gpu_temp_disable
== 1)
15374 gpu_temp_abort
= 0;
15375 gpu_temp_retain
= 0;
15378 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
15380 if (gpu_temp_abort
< gpu_temp_retain
)
15382 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
15388 data
.gpu_temp_disable
= gpu_temp_disable
;
15389 data
.gpu_temp_abort
= gpu_temp_abort
;
15390 data
.gpu_temp_retain
= gpu_temp_retain
;
15394 * enable custom signal handler(s)
15397 if (benchmark
== 0)
15399 hc_signal (sigHandler_default
);
15403 hc_signal (sigHandler_benchmark
);
15410 if (data
.quiet
== 0)
15412 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
15414 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
);
15416 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15418 log_info ("Rules: %u", kernel_rules_cnt
);
15421 log_info ("Mangle: %d", mangle
);
15425 log_info ("Applicable Optimizers:");
15427 for (uint i
= 0; i
< 32; i
++)
15429 const uint opti_bit
= 1u << i
;
15431 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
15436 * Watchdog and Temperature balance
15440 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15442 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
15445 if (gpu_temp_abort
== 0)
15447 log_info ("Watchdog: Temperature abort trigger disabled");
15451 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
15454 if (gpu_temp_retain
== 0)
15456 log_info ("Watchdog: Temperature retain trigger disabled");
15460 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
15463 if (data
.quiet
== 0) log_info ("");
15473 if (gpu_temp_disable
== 0)
15475 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15477 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15479 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15481 if (device_param
->skipped
) continue;
15483 const uint platform_devices_id
= device_param
->platform_devices_id
;
15485 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15487 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
15488 data
.hm_device
[device_id
].nvapi
= 0;
15489 data
.hm_device
[device_id
].nvml
= 0;
15490 data
.hm_device
[device_id
].xnvctrl
= 0;
15491 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
15492 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
15493 data
.hm_device
[device_id
].fan_set_supported
= 0;
15496 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15498 data
.hm_device
[device_id
].adl
= 0;
15499 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
15500 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
15501 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
15502 data
.hm_device
[device_id
].od_version
= 0;
15503 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
15504 data
.hm_device
[device_id
].fan_set_supported
= 0;
15510 * powertune on user request
15513 if (powertune_enable
== 1)
15515 hc_thread_mutex_lock (mux_adl
);
15517 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15519 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15521 if (device_param
->skipped
) continue;
15523 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
15527 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
15528 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
15529 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
15530 * Driver / ADL bug?
15533 if (data
.hm_device
[device_id
].od_version
== 6)
15537 // check powertune capabilities first, if not available then skip device
15539 int powertune_supported
= 0;
15541 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
15543 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15548 // first backup current value, we will restore it later
15550 if (powertune_supported
!= 0)
15552 // powercontrol settings
15554 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15556 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
15558 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
15561 if (ADL_rc
!= ADL_OK
)
15563 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15568 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15570 log_error ("ERROR: Failed to set new ADL PowerControl values");
15577 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15579 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15581 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
)
15583 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15588 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15590 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15592 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
15594 log_error ("ERROR: Failed to get ADL device capabilities");
15599 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15600 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15602 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15603 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15605 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15606 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15608 // warning if profile has too low max values
15610 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15612 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15615 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15617 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15620 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15622 performance_state
->iNumberOfPerformanceLevels
= 2;
15624 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15625 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15626 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15627 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15629 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
)
15631 log_info ("ERROR: Failed to set ADL performance state");
15636 local_free (performance_state
);
15639 // set powertune value only
15641 if (powertune_supported
!= 0)
15644 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15646 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
15648 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15653 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15655 log_error ("ERROR: Failed to set new ADL PowerControl values");
15663 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
15665 // first backup current value, we will restore it later
15667 unsigned int limit
;
15669 int powertune_supported
= 0;
15671 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
15673 powertune_supported
= 1;
15676 // if backup worked, activate the maximum allowed
15678 if (powertune_supported
!= 0)
15680 unsigned int minLimit
;
15681 unsigned int maxLimit
;
15683 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
15687 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
15689 // now we can be sure we need to reset later
15691 nvml_power_limit
[device_id
] = limit
;
15699 hc_thread_mutex_unlock (mux_adl
);
15702 #endif // HAVE_HWMON
15705 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
15708 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
15710 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15712 cl_int CL_err
= CL_SUCCESS
;
15718 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15720 if (device_param
->skipped
) continue;
15723 * device properties
15726 const char *device_name_chksum
= device_param
->device_name_chksum
;
15727 const u32 device_processors
= device_param
->device_processors
;
15730 * create context for each device
15733 cl_context_properties properties
[3];
15735 properties
[0] = CL_CONTEXT_PLATFORM
;
15736 properties
[1] = (cl_context_properties
) device_param
->platform
;
15739 CL_err
= hc_clCreateContext (data
.ocl
, properties
, 1, &device_param
->device
, NULL
, NULL
, &device_param
->context
);
15741 if (CL_err
!= CL_SUCCESS
)
15743 log_error ("ERROR: clCreateContext(): %s\n", val2cstr_cl (CL_err
));
15749 * create command-queue
15752 // not supported with NV
15753 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15755 CL_err
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
, &device_param
->command_queue
);
15757 if (CL_err
!= CL_SUCCESS
)
15759 log_error ("ERROR: clCreateCommandQueue(): %s\n", val2cstr_cl (CL_err
));
15765 * kernel threads: some algorithms need a fixed kernel-threads count
15766 * because of shared memory usage or bitslice
15767 * there needs to be some upper limit, otherwise there's too much overhead
15770 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15772 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15773 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15775 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15777 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15780 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15781 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15782 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15783 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15784 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15785 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15786 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15787 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15788 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15789 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15790 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15791 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15792 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15794 device_param
->kernel_threads
= kernel_threads
;
15796 device_param
->hardware_power
= device_processors
* kernel_threads
;
15799 * create input buffers on device : calculate size of fixed memory buffers
15802 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15803 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15805 device_param
->size_root_css
= size_root_css
;
15806 device_param
->size_markov_css
= size_markov_css
;
15808 size_t size_results
= sizeof (uint
);
15810 device_param
->size_results
= size_results
;
15812 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15813 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15815 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15816 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15817 size_t size_esalts
= salts_cnt
* esalt_size
;
15819 device_param
->size_plains
= size_plains
;
15820 device_param
->size_digests
= size_digests
;
15821 device_param
->size_shown
= size_shown
;
15822 device_param
->size_salts
= size_salts
;
15824 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15825 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15826 size_t size_tm
= 32 * sizeof (bs_word_t
);
15830 size_t size_scrypt
= 4;
15832 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15834 // we need to check that all hashes have the same scrypt settings
15836 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15837 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15838 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15840 for (uint i
= 1; i
< salts_cnt
; i
++)
15842 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15843 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15844 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15846 log_error ("ERROR: Mixed scrypt settings not supported");
15852 uint tmto_start
= 0;
15853 uint tmto_stop
= 10;
15857 tmto_start
= scrypt_tmto
;
15861 // in case the user did not specify the tmto manually
15862 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15864 if (hash_mode
== 8900)
15866 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15870 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15875 else if (hash_mode
== 9300)
15877 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15881 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15888 data
.scrypt_tmp_size
= (128 * scrypt_r
* scrypt_p
);
15890 device_param
->kernel_accel_min
= 1;
15891 device_param
->kernel_accel_max
= 8;
15895 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15897 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15899 size_scrypt
/= 1u << tmto
;
15901 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15903 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15905 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15910 if (size_scrypt
> device_param
->device_global_mem
)
15912 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15917 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15919 data
.scrypt_tmto_final
= tmto
;
15925 if (tmto
== tmto_stop
)
15927 log_error ("ERROR: Can't allocate enough device memory");
15932 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
);
15935 size_t size_scrypt4
= size_scrypt
/ 4;
15938 * some algorithms need a fixed kernel-loops count
15941 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15943 const u32 kernel_loops_fixed
= 1024;
15945 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15946 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15949 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15951 const u32 kernel_loops_fixed
= 1024;
15953 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15954 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15957 if (hash_mode
== 8900)
15959 const u32 kernel_loops_fixed
= 1;
15961 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15962 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15965 if (hash_mode
== 9300)
15967 const u32 kernel_loops_fixed
= 1;
15969 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15970 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15973 if (hash_mode
== 12500)
15975 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15977 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15978 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15982 * some algorithms have a maximum kernel-loops count
15985 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15987 u32 innerloop_cnt
= 0;
15989 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15991 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15992 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15993 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15997 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
16000 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
16001 (innerloop_cnt
<= device_param
->kernel_loops_max
))
16003 device_param
->kernel_loops_max
= innerloop_cnt
;
16007 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
16008 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
16010 // find out if we would request too much memory on memory blocks which are based on kernel_accel
16012 size_t size_pws
= 4;
16013 size_t size_tmps
= 4;
16014 size_t size_hooks
= 4;
16016 while (kernel_accel_max
>= kernel_accel_min
)
16018 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
16022 size_pws
= kernel_power_max
* sizeof (pw_t
);
16028 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
16029 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16030 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16031 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16032 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
16033 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
16034 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
16035 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
16036 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
16037 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
16038 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16039 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16040 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16041 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16042 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16043 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16044 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16045 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16046 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16047 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16048 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16049 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16050 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16051 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
16052 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
16053 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
16054 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
16055 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
16056 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16057 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16058 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
16059 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
16060 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16061 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
16062 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16063 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
16064 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
16065 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16066 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16067 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
16068 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
16069 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
16070 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16071 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
16072 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
16073 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
16074 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
16075 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16076 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
16077 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
16078 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
16079 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16080 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16081 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
16082 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
16083 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
16084 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
16085 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
16086 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16087 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16088 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16089 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
16090 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
16091 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16092 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16093 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16094 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16095 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16096 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16097 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16098 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16099 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16100 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16101 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16102 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16103 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16104 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16105 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16106 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16107 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16108 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16109 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16114 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
16121 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
16122 // if not, decrease amplifier and try again
16124 int memory_limit_hit
= 0;
16126 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16127 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16128 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16130 const u64 size_total
16147 + size_pws
// not a bug
16161 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
16163 if (memory_limit_hit
== 1)
16165 kernel_accel_max
--;
16173 if (kernel_accel_max
< kernel_accel_min
)
16175 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
16180 device_param
->kernel_accel_min
= kernel_accel_min
;
16181 device_param
->kernel_accel_max
= kernel_accel_max
;
16184 if (kernel_accel_max < kernel_accel)
16186 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
16188 device_param->kernel_accel = kernel_accel_max;
16192 device_param
->size_bfs
= size_bfs
;
16193 device_param
->size_combs
= size_combs
;
16194 device_param
->size_rules
= size_rules
;
16195 device_param
->size_rules_c
= size_rules_c
;
16196 device_param
->size_pws
= size_pws
;
16197 device_param
->size_tmps
= size_tmps
;
16198 device_param
->size_hooks
= size_hooks
;
16201 * default building options
16204 if (chdir (cpath_real
) == -1)
16206 log_error ("ERROR: %s: %s", cpath_real
, strerror (errno
));
16211 char build_opts
[1024] = { 0 };
16214 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
16216 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
16220 // this test needs to be done manually because of osx opencl runtime
16221 // if there's a problem with permission, its not reporting back and erroring out silently
16223 #define files_cnt 15
16225 const char *files_names
[files_cnt
] =
16227 "inc_cipher_aes256.cl",
16228 "inc_cipher_serpent256.cl",
16229 "inc_cipher_twofish256.cl",
16231 "inc_comp_multi_bs.cl",
16232 "inc_comp_multi.cl",
16233 "inc_comp_single_bs.cl",
16234 "inc_comp_single.cl",
16235 "inc_hash_constants.h",
16236 "inc_hash_functions.cl",
16244 for (int i
= 0; i
< files_cnt
; i
++)
16246 FILE *fd
= fopen (files_names
[i
], "r");
16250 log_error ("ERROR: %s: fopen(): %s", files_names
[i
], strerror (errno
));
16257 size_t n
= fread (buf
, 1, 1, fd
);
16261 log_error ("ERROR: %s: fread(): %s", files_names
[i
], strerror (errno
));
16269 // we don't have sm_* on vendors not NV but it doesn't matter
16271 char build_opts_new
[1024] = { 0 };
16273 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
);
16275 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
16278 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
16287 * kernel source filename
16290 char source_file
[256] = { 0 };
16292 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, mangle
, shared_dir
, source_file
);
16296 if (stat (source_file
, &sst
) == -1)
16298 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16304 * kernel cached filename
16307 char cached_file
[256] = { 0 };
16309 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, mangle
, profile_dir
, device_name_chksum
, cached_file
);
16315 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
16321 * kernel compile or load
16324 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16326 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16328 if (force_jit_compilation
== -1)
16332 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
));
16334 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16336 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16338 if (CL_err
!= CL_SUCCESS
)
16340 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16345 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16347 if (CL_err
!= CL_SUCCESS
)
16349 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16355 size_t build_log_size
= 0;
16357 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16359 if (CL_err
!= CL_SUCCESS
)
16361 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16366 if (build_log_size
> 1)
16368 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16370 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16372 if (CL_err
!= CL_SUCCESS
)
16374 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16381 myfree (build_log
);
16385 if (CL_err
!= CL_SUCCESS
)
16387 device_param
->skipped
= true;
16389 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16394 size_t binary_size
;
16396 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16398 if (CL_err
!= CL_SUCCESS
)
16400 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16405 u8
*binary
= (u8
*) mymalloc (binary_size
);
16407 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16409 if (CL_err
!= CL_SUCCESS
)
16411 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16416 writeProgramBin (cached_file
, binary
, binary_size
);
16418 local_free (binary
);
16423 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16426 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16428 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program
);
16430 if (CL_err
!= CL_SUCCESS
)
16432 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16437 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16439 if (CL_err
!= CL_SUCCESS
)
16441 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16450 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
16453 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16455 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16457 if (CL_err
!= CL_SUCCESS
)
16459 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16464 char build_opts_update
[1024] = { 0 };
16466 if (force_jit_compilation
== 1500)
16468 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
16470 else if (force_jit_compilation
== 8900)
16472 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);
16476 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
16479 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
);
16481 if (CL_err
!= CL_SUCCESS
)
16483 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16489 size_t build_log_size
= 0;
16491 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16493 if (CL_err
!= CL_SUCCESS
)
16495 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16500 if (build_log_size
> 1)
16502 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16504 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16506 if (CL_err
!= CL_SUCCESS
)
16508 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16515 myfree (build_log
);
16519 if (CL_err
!= CL_SUCCESS
)
16521 device_param
->skipped
= true;
16523 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16527 local_free (kernel_lengths
);
16528 local_free (kernel_sources
[0]);
16529 local_free (kernel_sources
);
16533 * word generator kernel
16536 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
16539 * kernel mp source filename
16542 char source_file
[256] = { 0 };
16544 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
16548 if (stat (source_file
, &sst
) == -1)
16550 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16556 * kernel mp cached filename
16559 char cached_file
[256] = { 0 };
16561 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
16567 if (stat (cached_file
, &cst
) == -1)
16573 * kernel compile or load
16576 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16578 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16582 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
));
16583 if (quiet
== 0) log_info ("");
16585 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16587 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_mp
);
16589 if (CL_err
!= CL_SUCCESS
)
16591 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16596 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16598 if (CL_err
!= CL_SUCCESS
)
16600 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16605 if (CL_err
!= CL_SUCCESS
)
16607 device_param
->skipped
= true;
16609 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16614 size_t binary_size
;
16616 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16618 if (CL_err
!= CL_SUCCESS
)
16620 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16625 u8
*binary
= (u8
*) mymalloc (binary_size
);
16627 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16629 if (CL_err
!= CL_SUCCESS
)
16631 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16636 writeProgramBin (cached_file
, binary
, binary_size
);
16638 local_free (binary
);
16643 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16646 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16648 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_mp
);
16650 if (CL_err
!= CL_SUCCESS
)
16652 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16657 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16659 if (CL_err
!= CL_SUCCESS
)
16661 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16667 local_free (kernel_lengths
);
16668 local_free (kernel_sources
[0]);
16669 local_free (kernel_sources
);
16676 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16683 * kernel amp source filename
16686 char source_file
[256] = { 0 };
16688 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
16692 if (stat (source_file
, &sst
) == -1)
16694 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16700 * kernel amp cached filename
16703 char cached_file
[256] = { 0 };
16705 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
16711 if (stat (cached_file
, &cst
) == -1)
16717 * kernel compile or load
16720 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16722 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16726 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
));
16727 if (quiet
== 0) log_info ("");
16729 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16731 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_amp
);
16733 if (CL_err
!= CL_SUCCESS
)
16735 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16740 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16742 if (CL_err
!= CL_SUCCESS
)
16744 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16749 if (CL_err
!= CL_SUCCESS
)
16751 device_param
->skipped
= true;
16753 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
16758 size_t binary_size
;
16760 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16762 if (CL_err
!= CL_SUCCESS
)
16764 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16769 u8
*binary
= (u8
*) mymalloc (binary_size
);
16771 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16773 if (CL_err
!= CL_SUCCESS
)
16775 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16780 writeProgramBin (cached_file
, binary
, binary_size
);
16782 local_free (binary
);
16787 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16790 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16792 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_amp
);
16794 if (CL_err
!= CL_SUCCESS
)
16796 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16801 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16803 if (CL_err
!= CL_SUCCESS
)
16805 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16811 local_free (kernel_lengths
);
16812 local_free (kernel_sources
[0]);
16813 local_free (kernel_sources
);
16816 // return back to the folder we came from initially (workaround)
16818 if (chdir (cwd
) == -1)
16820 log_error ("ERROR: %s: %s", cwd
, strerror (errno
));
16825 // some algorithm collide too fast, make that impossible
16827 if (benchmark
== 1)
16829 ((uint
*) digests_buf
)[0] = -1;
16830 ((uint
*) digests_buf
)[1] = -1;
16831 ((uint
*) digests_buf
)[2] = -1;
16832 ((uint
*) digests_buf
)[3] = -1;
16839 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_buf
);
16840 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_amp_buf
);
16841 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
, &device_param
->d_tmps
);
16842 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
, &device_param
->d_hooks
);
16843 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_a
);
16844 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_b
);
16845 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_c
);
16846 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_d
);
16847 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_a
);
16848 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_b
);
16849 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_c
);
16850 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_d
);
16851 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
, &device_param
->d_plain_bufs
);
16852 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
, &device_param
->d_digests_buf
);
16853 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
, &device_param
->d_digests_shown
);
16854 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
, &device_param
->d_salt_bufs
);
16855 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
, &device_param
->d_result
);
16856 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV0_buf
);
16857 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV1_buf
);
16858 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV2_buf
);
16859 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV3_buf
);
16861 if (CL_err
!= CL_SUCCESS
)
16863 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16868 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
);
16869 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
);
16870 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
);
16871 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
);
16872 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
);
16873 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
);
16874 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
);
16875 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
);
16876 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
);
16877 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
);
16878 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
);
16880 if (CL_err
!= CL_SUCCESS
)
16882 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16891 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16893 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
, &device_param
->d_rules
);
16894 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
, &device_param
->d_rules_c
);
16896 if (CL_err
!= CL_SUCCESS
)
16898 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16903 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
);
16905 if (CL_err
!= CL_SUCCESS
)
16907 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16912 else if (attack_kern
== ATTACK_KERN_COMBI
)
16914 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs
);
16915 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs_c
);
16916 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16917 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16919 if (CL_err
!= CL_SUCCESS
)
16921 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16926 else if (attack_kern
== ATTACK_KERN_BF
)
16928 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs
);
16929 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs_c
);
16930 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
, &device_param
->d_tm_c
);
16931 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16932 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16934 if (CL_err
!= CL_SUCCESS
)
16936 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16944 CL_err
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
, &device_param
->d_esalt_bufs
);
16946 if (CL_err
!= CL_SUCCESS
)
16948 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16953 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
);
16955 if (CL_err
!= CL_SUCCESS
)
16957 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16967 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16969 device_param
->pws_buf
= pws_buf
;
16971 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16973 device_param
->combs_buf
= combs_buf
;
16975 void *hooks_buf
= mymalloc (size_hooks
);
16977 device_param
->hooks_buf
= hooks_buf
;
16983 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16984 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16985 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16986 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16987 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16988 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16989 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16990 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16991 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16992 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16993 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16995 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16996 ? &device_param
->d_pws_buf
16997 : &device_param
->d_pws_amp_buf
;
16998 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16999 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
17000 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
17001 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
17002 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
17003 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
17004 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
17005 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
17006 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
17007 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
17008 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
17009 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
17010 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
17011 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
17012 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
17013 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
17014 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
17015 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
17016 device_param
->kernel_params
[19] = &device_param
->d_result
;
17017 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
17018 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
17019 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
17020 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
17021 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
17022 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
17023 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
17024 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
17025 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
17026 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
17027 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
17028 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
17029 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
17030 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
17031 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
17033 device_param
->kernel_params_mp_buf64
[3] = 0;
17034 device_param
->kernel_params_mp_buf32
[4] = 0;
17035 device_param
->kernel_params_mp_buf32
[5] = 0;
17036 device_param
->kernel_params_mp_buf32
[6] = 0;
17037 device_param
->kernel_params_mp_buf32
[7] = 0;
17038 device_param
->kernel_params_mp_buf32
[8] = 0;
17040 device_param
->kernel_params_mp
[0] = NULL
;
17041 device_param
->kernel_params_mp
[1] = NULL
;
17042 device_param
->kernel_params_mp
[2] = NULL
;
17043 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
17044 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
17045 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
17046 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
17047 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
17048 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
17050 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17051 device_param
->kernel_params_mp_l_buf32
[4] = 0;
17052 device_param
->kernel_params_mp_l_buf32
[5] = 0;
17053 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17054 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17055 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17056 device_param
->kernel_params_mp_l_buf32
[9] = 0;
17058 device_param
->kernel_params_mp_l
[0] = NULL
;
17059 device_param
->kernel_params_mp_l
[1] = NULL
;
17060 device_param
->kernel_params_mp_l
[2] = NULL
;
17061 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
17062 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
17063 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
17064 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
17065 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
17066 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
17067 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
17069 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17070 device_param
->kernel_params_mp_r_buf32
[4] = 0;
17071 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17072 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17073 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17074 device_param
->kernel_params_mp_r_buf32
[8] = 0;
17076 device_param
->kernel_params_mp_r
[0] = NULL
;
17077 device_param
->kernel_params_mp_r
[1] = NULL
;
17078 device_param
->kernel_params_mp_r
[2] = NULL
;
17079 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
17080 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
17081 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
17082 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
17083 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
17084 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
17086 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
17087 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
17089 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
17090 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
17091 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
17092 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
17093 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
17094 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
17095 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
17097 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
17098 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
17100 device_param
->kernel_params_memset_buf32
[1] = 0; // value
17101 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
17103 device_param
->kernel_params_memset
[0] = NULL
;
17104 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
17105 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
17111 size_t kernel_wgs_tmp
;
17113 char kernel_name
[64] = { 0 };
17115 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17117 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17119 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
17121 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17123 if (CL_err
!= CL_SUCCESS
)
17125 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17130 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
17132 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17134 if (CL_err
!= CL_SUCCESS
)
17136 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17141 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
17143 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17145 if (CL_err
!= CL_SUCCESS
)
17147 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17154 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
17156 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17158 if (CL_err
!= CL_SUCCESS
)
17160 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17165 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
17167 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17169 if (CL_err
!= CL_SUCCESS
)
17171 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17176 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
17178 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17180 if (CL_err
!= CL_SUCCESS
)
17182 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17188 if (data
.attack_mode
== ATTACK_MODE_BF
)
17190 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17192 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
17194 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel_tm
);
17196 if (CL_err
!= CL_SUCCESS
)
17198 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17203 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
);
17205 if (CL_err
!= CL_SUCCESS
)
17207 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17216 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
17218 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17220 if (CL_err
!= CL_SUCCESS
)
17222 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17227 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
17229 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17231 if (CL_err
!= CL_SUCCESS
)
17233 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17238 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
17240 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17242 if (CL_err
!= CL_SUCCESS
)
17244 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17249 if (opts_type
& OPTS_TYPE_HOOK12
)
17251 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
17253 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel12
);
17255 if (CL_err
!= CL_SUCCESS
)
17257 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17262 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
);
17264 if (CL_err
!= CL_SUCCESS
)
17266 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17272 if (opts_type
& OPTS_TYPE_HOOK23
)
17274 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
17276 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel23
);
17278 if (CL_err
!= CL_SUCCESS
)
17280 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17285 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
);
17287 if (CL_err
!= CL_SUCCESS
)
17289 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17296 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
);
17297 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
);
17298 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
);
17300 if (CL_err
!= CL_SUCCESS
)
17302 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17307 for (uint i
= 0; i
<= 23; i
++)
17309 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17310 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17311 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17313 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17314 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17316 if (CL_err
!= CL_SUCCESS
)
17318 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17324 for (uint i
= 24; i
<= 34; i
++)
17326 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17327 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17328 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17330 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17331 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17333 if (CL_err
!= CL_SUCCESS
)
17335 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17343 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset", &device_param
->kernel_memset
);
17345 if (CL_err
!= CL_SUCCESS
)
17347 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17352 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
);
17354 if (CL_err
!= CL_SUCCESS
)
17356 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17361 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
17362 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
17363 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
17365 if (CL_err
!= CL_SUCCESS
)
17367 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17374 if (attack_mode
== ATTACK_MODE_BF
)
17376 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov", &device_param
->kernel_mp_l
);
17377 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov", &device_param
->kernel_mp_r
);
17379 if (CL_err
!= CL_SUCCESS
)
17381 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17386 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
);
17387 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
);
17389 if (CL_err
!= CL_SUCCESS
)
17391 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17396 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17398 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
17399 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
17401 if (CL_err
!= CL_SUCCESS
)
17403 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17409 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
17411 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17413 if (CL_err
!= CL_SUCCESS
)
17415 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17420 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
);
17422 if (CL_err
!= CL_SUCCESS
)
17424 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17429 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17431 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17433 if (CL_err
!= CL_SUCCESS
)
17435 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17440 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
);
17442 if (CL_err
!= CL_SUCCESS
)
17444 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17450 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17456 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp", &device_param
->kernel_amp
);
17458 if (CL_err
!= CL_SUCCESS
)
17460 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17465 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
);
17467 if (CL_err
!= CL_SUCCESS
)
17469 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17475 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17481 for (uint i
= 0; i
< 5; i
++)
17483 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
17485 if (CL_err
!= CL_SUCCESS
)
17487 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17493 for (uint i
= 5; i
< 7; i
++)
17495 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
17497 if (CL_err
!= CL_SUCCESS
)
17499 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17506 // maybe this has been updated by clGetKernelWorkGroupInfo()
17507 // value can only be decreased, so we don't need to reallocate buffers
17509 device_param
->kernel_threads
= kernel_threads
;
17511 // zero some data buffers
17513 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
17514 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
17515 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
17516 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
17517 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
17518 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
17524 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
17526 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
17528 else if (attack_kern
== ATTACK_KERN_COMBI
)
17530 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
17531 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
17532 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17533 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17535 else if (attack_kern
== ATTACK_KERN_BF
)
17537 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
17538 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
17539 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
17540 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17541 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17544 #if defined(HAVE_HWMON)
17547 * Store initial fanspeed if gpu_temp_retain is enabled
17550 if (gpu_temp_disable
== 0)
17552 if (gpu_temp_retain
!= 0)
17554 hc_thread_mutex_lock (mux_adl
);
17556 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
17558 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
17559 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
17561 // we also set it to tell the OS we take control over the fan and it's automatic controller
17562 // if it was set to automatic. we do not control user-defined fanspeeds.
17564 if (fanpolicy
== 1)
17566 data
.hm_device
[device_id
].fan_set_supported
= 1;
17570 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17572 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
17574 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17577 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
17581 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
17587 data
.hm_device
[device_id
].fan_set_supported
= 1;
17591 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
17593 data
.hm_device
[device_id
].fan_set_supported
= 0;
17598 data
.hm_device
[device_id
].fan_set_supported
= 0;
17602 hc_thread_mutex_unlock (mux_adl
);
17606 #endif // HAVE_HWMON
17609 if (data
.quiet
== 0) log_info_nn ("");
17612 * In benchmark-mode, inform user which algorithm is checked
17615 if (benchmark
== 1)
17617 if (machine_readable
== 0)
17621 data
.quiet
= quiet
;
17623 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
17625 log_info ("Hashtype: %s", hash_type
);
17626 log_info ("Mangle: %d", mangle
);
17632 * keep track of the progress
17635 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17636 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17637 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17644 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
17646 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
17651 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
17653 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
17658 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
17660 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
17670 segment_size
*= (1024 * 1024);
17672 data
.segment_size
= segment_size
;
17674 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
17676 wl_data
->buf
= (char *) mymalloc (segment_size
);
17677 wl_data
->avail
= segment_size
;
17678 wl_data
->incr
= segment_size
;
17682 cs_t
*css_buf
= NULL
;
17686 char **masks
= NULL
;
17687 char **dictfiles
= NULL
;
17689 uint mask_from_file
= 0;
17691 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17693 if (wordlist_mode
== WL_MODE_FILE
)
17695 int wls_left
= myargc
- (optind
+ 1);
17697 for (int i
= 0; i
< wls_left
; i
++)
17699 char *l0_filename
= myargv
[optind
+ 1 + i
];
17701 struct stat l0_stat
;
17703 if (stat (l0_filename
, &l0_stat
) == -1)
17705 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
17710 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
17714 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17718 dictfiles
[dictcnt
- 1] = l0_filename
;
17722 // do not allow --keyspace w/ a directory
17726 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17731 char **dictionary_files
= NULL
;
17733 dictionary_files
= scan_directory (l0_filename
);
17735 if (dictionary_files
!= NULL
)
17737 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17739 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17741 char *l1_filename
= dictionary_files
[d
];
17743 struct stat l1_stat
;
17745 if (stat (l1_filename
, &l1_stat
) == -1)
17747 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17752 if (S_ISREG (l1_stat
.st_mode
))
17754 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17758 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17763 local_free (dictionary_files
);
17769 log_error ("ERROR: No usable dictionary file found.");
17774 else if (wordlist_mode
== WL_MODE_STDIN
)
17779 else if (attack_mode
== ATTACK_MODE_COMBI
)
17783 char *dictfile1
= myargv
[optind
+ 1 + 0];
17784 char *dictfile2
= myargv
[optind
+ 1 + 1];
17786 // find the bigger dictionary and use as base
17791 struct stat tmp_stat
;
17793 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
17795 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17800 if (stat (dictfile1
, &tmp_stat
) == -1)
17802 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17809 if (S_ISDIR (tmp_stat
.st_mode
))
17811 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
17818 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
17820 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17827 if (stat (dictfile2
, &tmp_stat
) == -1)
17829 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17837 if (S_ISDIR (tmp_stat
.st_mode
))
17839 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
17847 data
.combs_cnt
= 1;
17851 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
17853 data
.quiet
= quiet
;
17855 if (words1_cnt
== 0)
17857 log_error ("ERROR: %s: empty file", dictfile1
);
17865 data
.combs_cnt
= 1;
17869 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17871 data
.quiet
= quiet
;
17873 if (words2_cnt
== 0)
17875 log_error ("ERROR: %s: empty file", dictfile2
);
17886 data
.dictfile
= dictfile1
;
17887 data
.dictfile2
= dictfile2
;
17889 if (words1_cnt
>= words2_cnt
)
17891 data
.combs_cnt
= words2_cnt
;
17892 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
17894 dictfiles
= &data
.dictfile
;
17900 data
.combs_cnt
= words1_cnt
;
17901 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17903 dictfiles
= &data
.dictfile2
;
17907 // we also have to switch wordlist related rules!
17909 char *tmpc
= data
.rule_buf_l
;
17911 data
.rule_buf_l
= data
.rule_buf_r
;
17912 data
.rule_buf_r
= tmpc
;
17914 int tmpi
= data
.rule_len_l
;
17916 data
.rule_len_l
= data
.rule_len_r
;
17917 data
.rule_len_r
= tmpi
;
17920 else if (attack_mode
== ATTACK_MODE_BF
)
17926 if (benchmark
== 0)
17928 mask
= myargv
[optind
+ 1];
17930 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
17932 if ((optind
+ 2) <= myargc
)
17934 struct stat file_stat
;
17936 if (stat (mask
, &file_stat
) == -1)
17940 masks
[maskcnt
- 1] = mystrdup (mask
);
17944 int wls_left
= myargc
- (optind
+ 1);
17946 uint masks_avail
= INCR_MASKS
;
17948 for (int i
= 0; i
< wls_left
; i
++)
17952 mask
= myargv
[optind
+ 1 + i
];
17954 if (stat (mask
, &file_stat
) == -1)
17956 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17962 uint is_file
= S_ISREG (file_stat
.st_mode
);
17968 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17970 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17975 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17977 while (!feof (mask_fp
))
17979 memset (line_buf
, 0, HCBUFSIZ
);
17981 int line_len
= fgetl (mask_fp
, line_buf
);
17983 if (line_len
== 0) continue;
17985 if (line_buf
[0] == '#') continue;
17987 if (masks_avail
== maskcnt
)
17989 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17991 masks_avail
+= INCR_MASKS
;
17994 masks
[maskcnt
] = mystrdup (line_buf
);
18005 log_error ("ERROR: %s: unsupported file-type", mask
);
18011 mask_from_file
= 1;
18016 custom_charset_1
= (char *) "?l?d?u";
18017 custom_charset_2
= (char *) "?l?d";
18018 custom_charset_3
= (char *) "?l?d*!$@_";
18020 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18021 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18022 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18024 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
18026 wordlist_mode
= WL_MODE_MASK
;
18028 data
.wordlist_mode
= wordlist_mode
;
18038 * generate full masks and charsets
18041 masks
= (char **) mymalloc (sizeof (char *));
18045 case 1731: pw_min
= 5;
18047 mask
= mystrdup ("?b?b?b?b?b");
18049 case 12500: pw_min
= 5;
18051 mask
= mystrdup ("?b?b?b?b?b");
18053 default: pw_min
= 7;
18055 mask
= mystrdup ("?b?b?b?b?b?b?b");
18061 masks
[maskcnt
- 1] = mystrdup (mask
);
18063 wordlist_mode
= WL_MODE_MASK
;
18065 data
.wordlist_mode
= wordlist_mode
;
18070 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
18074 if (increment_min
> pw_min
) pw_min
= increment_min
;
18076 if (increment_max
< pw_max
) pw_max
= increment_max
;
18079 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
18081 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
18085 char *mask
= myargv
[myargc
- 1];
18089 masks
= (char **) mymalloc (1 * sizeof (char *));
18093 struct stat file_stat
;
18095 if (stat (mask
, &file_stat
) == -1)
18099 masks
[maskcnt
- 1] = mystrdup (mask
);
18103 uint is_file
= S_ISREG (file_stat
.st_mode
);
18109 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18111 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18116 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18118 uint masks_avail
= 1;
18120 while (!feof (mask_fp
))
18122 memset (line_buf
, 0, HCBUFSIZ
);
18124 int line_len
= fgetl (mask_fp
, line_buf
);
18126 if (line_len
== 0) continue;
18128 if (line_buf
[0] == '#') continue;
18130 if (masks_avail
== maskcnt
)
18132 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18134 masks_avail
+= INCR_MASKS
;
18137 masks
[maskcnt
] = mystrdup (line_buf
);
18146 mask_from_file
= 1;
18152 masks
[maskcnt
- 1] = mystrdup (mask
);
18158 int wls_left
= myargc
- (optind
+ 2);
18160 for (int i
= 0; i
< wls_left
; i
++)
18162 char *filename
= myargv
[optind
+ 1 + i
];
18164 struct stat file_stat
;
18166 if (stat (filename
, &file_stat
) == -1)
18168 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18173 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18177 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18181 dictfiles
[dictcnt
- 1] = filename
;
18185 // do not allow --keyspace w/ a directory
18189 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18194 char **dictionary_files
= NULL
;
18196 dictionary_files
= scan_directory (filename
);
18198 if (dictionary_files
!= NULL
)
18200 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18202 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18204 char *l1_filename
= dictionary_files
[d
];
18206 struct stat l1_stat
;
18208 if (stat (l1_filename
, &l1_stat
) == -1)
18210 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18215 if (S_ISREG (l1_stat
.st_mode
))
18217 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18221 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18226 local_free (dictionary_files
);
18232 log_error ("ERROR: No usable dictionary file found.");
18241 uint mask_min
= increment_min
; // we can't reject smaller masks here
18242 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18244 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18246 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18248 if (cur_mask
== NULL
) break;
18250 masks
[maskcnt
] = cur_mask
;
18254 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18258 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18260 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
18264 char *mask
= myargv
[optind
+ 1 + 0];
18268 masks
= (char **) mymalloc (1 * sizeof (char *));
18272 struct stat file_stat
;
18274 if (stat (mask
, &file_stat
) == -1)
18278 masks
[maskcnt
- 1] = mystrdup (mask
);
18282 uint is_file
= S_ISREG (file_stat
.st_mode
);
18288 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18290 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18295 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18297 uint masks_avail
= 1;
18299 while (!feof (mask_fp
))
18301 memset (line_buf
, 0, HCBUFSIZ
);
18303 int line_len
= fgetl (mask_fp
, line_buf
);
18305 if (line_len
== 0) continue;
18307 if (line_buf
[0] == '#') continue;
18309 if (masks_avail
== maskcnt
)
18311 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18313 masks_avail
+= INCR_MASKS
;
18316 masks
[maskcnt
] = mystrdup (line_buf
);
18325 mask_from_file
= 1;
18331 masks
[maskcnt
- 1] = mystrdup (mask
);
18337 int wls_left
= myargc
- (optind
+ 2);
18339 for (int i
= 0; i
< wls_left
; i
++)
18341 char *filename
= myargv
[optind
+ 2 + i
];
18343 struct stat file_stat
;
18345 if (stat (filename
, &file_stat
) == -1)
18347 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18352 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18356 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18360 dictfiles
[dictcnt
- 1] = filename
;
18364 // do not allow --keyspace w/ a directory
18368 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18373 char **dictionary_files
= NULL
;
18375 dictionary_files
= scan_directory (filename
);
18377 if (dictionary_files
!= NULL
)
18379 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18381 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18383 char *l1_filename
= dictionary_files
[d
];
18385 struct stat l1_stat
;
18387 if (stat (l1_filename
, &l1_stat
) == -1)
18389 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18394 if (S_ISREG (l1_stat
.st_mode
))
18396 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18400 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18405 local_free (dictionary_files
);
18411 log_error ("ERROR: No usable dictionary file found.");
18420 uint mask_min
= increment_min
; // we can't reject smaller masks here
18421 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18423 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18425 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18427 if (cur_mask
== NULL
) break;
18429 masks
[maskcnt
] = cur_mask
;
18433 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18438 data
.pw_min
= pw_min
;
18439 data
.pw_max
= pw_max
;
18445 if (weak_hash_threshold
>= salts_cnt
)
18447 hc_device_param_t
*device_param
= NULL
;
18449 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18451 device_param
= &data
.devices_param
[device_id
];
18453 if (device_param
->skipped
) continue;
18458 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
18460 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
18462 weak_hash_check (device_param
, salt_pos
);
18465 // Display hack, guarantee that there is at least one \r before real start
18467 //if (data.quiet == 0) log_info ("");
18471 * status and monitor threads
18474 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18476 data
.devices_status
= STATUS_STARTING
;
18479 uint inner_threads_cnt
= 0;
18481 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
18483 data
.shutdown_inner
= 0;
18489 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
18491 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
18493 inner_threads_cnt
++;
18495 if (outfile_check_timer
!= 0)
18497 if (data
.outfile_check_directory
!= NULL
)
18499 if ((hash_mode
!= 5200) &&
18500 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
18501 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
18502 (hash_mode
!= 9000))
18504 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
18506 inner_threads_cnt
++;
18510 outfile_check_timer
= 0;
18515 outfile_check_timer
= 0;
18521 * Inform the user if we got some hashes remove because of the pot file remove feature
18524 if (data
.quiet
== 0)
18526 if (potfile_remove_cracks
> 0)
18528 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
18529 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
18533 data
.outfile_check_timer
= outfile_check_timer
;
18539 char **induction_dictionaries
= NULL
;
18541 int induction_dictionaries_cnt
= 0;
18543 hcstat_table_t
*root_table_buf
= NULL
;
18544 hcstat_table_t
*markov_table_buf
= NULL
;
18546 uint initial_restore_done
= 0;
18548 data
.maskcnt
= maskcnt
;
18550 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
18552 if (data
.devices_status
== STATUS_CRACKED
) continue;
18553 if (data
.devices_status
== STATUS_ABORTED
) continue;
18554 if (data
.devices_status
== STATUS_QUIT
) continue;
18556 if (maskpos
> rd
->maskpos
)
18561 rd
->maskpos
= maskpos
;
18562 data
.maskpos
= maskpos
;
18564 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
18566 char *mask
= masks
[maskpos
];
18568 if (mask_from_file
== 1)
18570 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
18575 uint mask_offset
= 0;
18577 uint separator_cnt
;
18579 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
18581 str_ptr
= strstr (mask
+ mask_offset
, ",");
18583 if (str_ptr
== NULL
) break;
18585 str_pos
= str_ptr
- mask
;
18587 // escaped separator, i.e. "\,"
18591 if (mask
[str_pos
- 1] == '\\')
18595 mask_offset
= str_pos
+ 1;
18601 // reset the offset
18605 mask
[str_pos
] = '\0';
18607 switch (separator_cnt
)
18610 mp_reset_usr (mp_usr
, 0);
18612 custom_charset_1
= mask
;
18613 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18617 mp_reset_usr (mp_usr
, 1);
18619 custom_charset_2
= mask
;
18620 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18624 mp_reset_usr (mp_usr
, 2);
18626 custom_charset_3
= mask
;
18627 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18631 mp_reset_usr (mp_usr
, 3);
18633 custom_charset_4
= mask
;
18634 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
18638 mask
= mask
+ str_pos
+ 1;
18642 * 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 "\")
18643 * it would be interpreted as a custom charset definition.
18645 * We need to replace all "\," with just "," within the mask (but allow the special case "\\," which means "\" followed by ",")
18646 * 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 ","
18649 uint mask_len_cur
= strlen (mask
);
18651 uint mask_out_pos
= 0;
18652 char mask_prev
= 0;
18654 for (uint mask_iter
= 0; mask_iter
< mask_len_cur
; mask_iter
++, mask_out_pos
++)
18656 if (mask
[mask_iter
] == ',')
18658 if (mask_prev
== '\\')
18660 mask_out_pos
-= 1; // this means: skip the previous "\"
18664 mask_prev
= mask
[mask_iter
];
18666 mask
[mask_out_pos
] = mask
[mask_iter
];
18669 mask
[mask_out_pos
] = '\0';
18672 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18676 local_free (css_buf
);
18677 local_free (data
.root_css_buf
);
18678 local_free (data
.markov_css_buf
);
18680 local_free (masks
[maskpos
- 1]);
18683 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18686 data
.css_cnt
= css_cnt
;
18687 data
.css_buf
= css_buf
;
18689 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
18691 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
18693 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
18694 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
18696 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
18698 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
18700 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
18701 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
18703 data
.root_css_buf
= root_css_buf
;
18704 data
.markov_css_buf
= markov_css_buf
;
18706 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
18708 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
18710 local_free (root_table_buf
);
18711 local_free (markov_table_buf
);
18715 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18717 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18719 if (device_param
->skipped
) continue;
18721 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
18722 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
18723 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
18725 device_param
->kernel_params_mp_buf64
[3] = 0;
18726 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
18727 device_param
->kernel_params_mp_buf32
[5] = 0;
18728 device_param
->kernel_params_mp_buf32
[6] = 0;
18729 device_param
->kernel_params_mp_buf32
[7] = 0;
18731 if (attack_mode
== ATTACK_MODE_HYBRID1
)
18733 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
18734 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
18735 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
18736 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
18738 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18740 device_param
->kernel_params_mp_buf32
[5] = 0;
18741 device_param
->kernel_params_mp_buf32
[6] = 0;
18742 device_param
->kernel_params_mp_buf32
[7] = 0;
18745 cl_int CL_err
= CL_SUCCESS
;
18747 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
]);
18748 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
]);
18749 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
]);
18751 if (CL_err
!= CL_SUCCESS
)
18753 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
18758 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
);
18759 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
);
18761 if (CL_err
!= CL_SUCCESS
)
18763 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
18769 else if (attack_mode
== ATTACK_MODE_BF
)
18771 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
18775 for (uint i
= 0; i
< dictcnt
; i
++)
18777 local_free (dictfiles
[i
]);
18780 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
18782 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
18784 if (l1_filename
== NULL
) break;
18788 dictfiles
[dictcnt
- 1] = l1_filename
;
18795 dictfiles
[dictcnt
- 1] = mask
;
18800 log_error ("ERROR: Mask is too small");
18807 free (induction_dictionaries
);
18809 // induction_dictionaries_cnt = 0; // implied
18811 if (attack_mode
!= ATTACK_MODE_BF
)
18815 induction_dictionaries
= scan_directory (induction_directory
);
18817 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18821 if (induction_dictionaries_cnt
)
18823 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18827 * prevent the user from using --keyspace together w/ maskfile and or dictfile
18831 if ((maskcnt
> 1) || (dictcnt
> 1))
18833 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
18839 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
18841 if (data
.devices_status
== STATUS_CRACKED
) continue;
18842 if (data
.devices_status
== STATUS_ABORTED
) continue;
18843 if (data
.devices_status
== STATUS_QUIT
) continue;
18845 rd
->dictpos
= dictpos
;
18847 char *subid
= logfile_generate_subid ();
18849 data
.subid
= subid
;
18851 logfile_sub_msg ("START");
18853 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18855 data
.devices_status
= STATUS_INIT
;
18858 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
18859 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
18860 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
18862 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
18866 data
.cpt_start
= time (NULL
);
18868 data
.cpt_total
= 0;
18870 if (data
.restore
== 0)
18872 rd
->words_cur
= skip
;
18879 data
.ms_paused
= 0;
18881 data
.kernel_power_final
= 0;
18883 data
.words_cur
= rd
->words_cur
;
18885 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18887 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18889 if (device_param
->skipped
) continue;
18891 device_param
->speed_pos
= 0;
18893 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
18894 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
18896 device_param
->exec_pos
= 0;
18898 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
18900 device_param
->outerloop_pos
= 0;
18901 device_param
->outerloop_left
= 0;
18902 device_param
->innerloop_pos
= 0;
18903 device_param
->innerloop_left
= 0;
18905 // some more resets:
18907 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
18909 device_param
->pws_cnt
= 0;
18911 device_param
->words_off
= 0;
18912 device_param
->words_done
= 0;
18915 // figure out some workload
18917 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18919 if (data
.wordlist_mode
== WL_MODE_FILE
)
18921 char *dictfile
= NULL
;
18923 if (induction_dictionaries_cnt
)
18925 dictfile
= induction_dictionaries
[0];
18929 dictfile
= dictfiles
[dictpos
];
18932 data
.dictfile
= dictfile
;
18934 logfile_sub_string (dictfile
);
18936 for (uint i
= 0; i
< rp_files_cnt
; i
++)
18938 logfile_sub_var_string ("rulefile", rp_files
[i
]);
18941 FILE *fd2
= fopen (dictfile
, "rb");
18945 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18950 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18954 if (data
.words_cnt
== 0)
18956 logfile_sub_msg ("STOP");
18962 else if (attack_mode
== ATTACK_MODE_COMBI
)
18964 char *dictfile
= data
.dictfile
;
18965 char *dictfile2
= data
.dictfile2
;
18967 logfile_sub_string (dictfile
);
18968 logfile_sub_string (dictfile2
);
18970 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
18972 FILE *fd2
= fopen (dictfile
, "rb");
18976 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18981 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18985 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
18987 FILE *fd2
= fopen (dictfile2
, "rb");
18991 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
18996 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
19001 if (data
.words_cnt
== 0)
19003 logfile_sub_msg ("STOP");
19008 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
19010 char *dictfile
= NULL
;
19012 if (induction_dictionaries_cnt
)
19014 dictfile
= induction_dictionaries
[0];
19018 dictfile
= dictfiles
[dictpos
];
19021 data
.dictfile
= dictfile
;
19023 char *mask
= data
.mask
;
19025 logfile_sub_string (dictfile
);
19026 logfile_sub_string (mask
);
19028 FILE *fd2
= fopen (dictfile
, "rb");
19032 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
19037 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
19041 if (data
.words_cnt
== 0)
19043 logfile_sub_msg ("STOP");
19048 else if (attack_mode
== ATTACK_MODE_BF
)
19050 local_free (css_buf
);
19051 local_free (data
.root_css_buf
);
19052 local_free (data
.markov_css_buf
);
19054 char *mask
= dictfiles
[dictpos
];
19056 logfile_sub_string (mask
);
19060 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
19062 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19064 uint css_cnt_unicode
= css_cnt
* 2;
19066 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
19068 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
19070 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
19072 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
19073 css_buf_unicode
[j
+ 1].cs_len
= 1;
19078 css_buf
= css_buf_unicode
;
19079 css_cnt
= css_cnt_unicode
;
19082 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
19084 uint mask_min
= pw_min
;
19085 uint mask_max
= pw_max
;
19087 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19093 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
19095 if (css_cnt
< mask_min
)
19097 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
19100 if (css_cnt
> mask_max
)
19102 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
19105 // skip to next mask
19107 logfile_sub_msg ("STOP");
19112 uint save_css_cnt
= css_cnt
;
19114 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
19116 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
19118 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
19119 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
19121 uint css_cnt_salt
= css_cnt
+ salt_len
;
19123 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
19125 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
19127 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
19129 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
19130 css_buf_salt
[j
].cs_len
= 1;
19135 css_buf
= css_buf_salt
;
19136 css_cnt
= css_cnt_salt
;
19141 data
.css_cnt
= css_cnt
;
19142 data
.css_buf
= css_buf
;
19144 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
19146 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
19148 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
19150 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
19151 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
19153 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
19155 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
19157 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
19158 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
19160 data
.root_css_buf
= root_css_buf
;
19161 data
.markov_css_buf
= markov_css_buf
;
19163 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
19165 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
19167 local_free (root_table_buf
);
19168 local_free (markov_table_buf
);
19172 uint css_cnt_l
= css_cnt
;
19175 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
19177 if (save_css_cnt
< 6)
19181 else if (save_css_cnt
== 6)
19187 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19189 if (save_css_cnt
== 8 || save_css_cnt
== 10)
19200 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
19215 /* unfinished code?
19216 int sum = css_buf[css_cnt_r - 1].cs_len;
19218 for (uint i = 1; i < 4 && i < css_cnt; i++)
19220 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
19224 sum *= css_buf[css_cnt_r - 1].cs_len;
19229 css_cnt_l
-= css_cnt_r
;
19231 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
19233 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19235 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19237 if (device_param
->skipped
) continue;
19239 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
19240 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
19241 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
19243 device_param
->kernel_params_mp_l_buf64
[3] = 0;
19244 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
19245 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
19246 device_param
->kernel_params_mp_l_buf32
[6] = 0;
19247 device_param
->kernel_params_mp_l_buf32
[7] = 0;
19248 device_param
->kernel_params_mp_l_buf32
[8] = 0;
19250 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
19251 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
19252 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
19253 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
19255 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
19256 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
19257 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
19259 device_param
->kernel_params_mp_r_buf64
[3] = 0;
19260 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
19261 device_param
->kernel_params_mp_r_buf32
[5] = 0;
19262 device_param
->kernel_params_mp_r_buf32
[6] = 0;
19263 device_param
->kernel_params_mp_r_buf32
[7] = 0;
19265 cl_int CL_err
= CL_SUCCESS
;
19267 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
]);
19268 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
]);
19269 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
]);
19271 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
]);
19272 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
]);
19273 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
]);
19275 if (CL_err
!= CL_SUCCESS
)
19277 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
19282 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
);
19283 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
);
19285 if (CL_err
!= CL_SUCCESS
)
19287 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
19294 u64 words_base
= data
.words_cnt
;
19296 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19298 if (data
.kernel_rules_cnt
)
19300 words_base
/= data
.kernel_rules_cnt
;
19303 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19305 if (data
.combs_cnt
)
19307 words_base
/= data
.combs_cnt
;
19310 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19314 words_base
/= data
.bfs_cnt
;
19318 data
.words_base
= words_base
;
19322 log_info ("%llu", (unsigned long long int) words_base
);
19327 if (data
.words_cur
> data
.words_base
)
19329 log_error ("ERROR: Restore value greater keyspace");
19334 if (data
.words_cur
)
19336 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19338 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19340 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
19343 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19345 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19347 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
19350 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19352 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19354 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
19360 * Update loopback file
19369 uint random_num
= get_random_num (0, 9999);
19371 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
19373 data
.loopback_file
= loopback_file
;
19377 * Update dictionary statistic
19382 dictstat_fp
= fopen (dictstat
, "wb");
19386 lock_file (dictstat_fp
);
19388 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
19390 fclose (dictstat_fp
);
19395 * create autotune threads
19398 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
19400 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19402 data
.devices_status
= STATUS_AUTOTUNE
;
19405 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19407 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19409 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
19412 hc_thread_wait (data
.devices_cnt
, c_threads
);
19415 * Inform user about possible slow speeds
19418 uint hardware_power_all
= 0;
19420 uint kernel_power_all
= 0;
19422 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19424 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19426 hardware_power_all
+= device_param
->hardware_power
;
19428 kernel_power_all
+= device_param
->kernel_power
;
19431 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
19433 data
.kernel_power_all
= kernel_power_all
;
19435 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19437 if (data
.words_base
< kernel_power_all
)
19443 log_info ("ATTENTION!");
19444 log_info (" The wordlist or mask you are using is too small.");
19445 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
19446 log_info (" The cracking speed will drop.");
19447 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
19454 * create cracker threads
19457 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19459 data
.devices_status
= STATUS_RUNNING
;
19462 if (initial_restore_done
== 0)
19464 if (data
.restore_disable
== 0) cycle_restore ();
19466 initial_restore_done
= 1;
19469 hc_timer_set (&data
.timer_running
);
19471 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19473 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
19475 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
19476 if (quiet
== 0) fflush (stdout
);
19479 else if (wordlist_mode
== WL_MODE_STDIN
)
19481 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
19482 if (data
.quiet
== 0) log_info ("");
19485 time_t runtime_start
;
19487 time (&runtime_start
);
19489 data
.runtime_start
= runtime_start
;
19491 data
.prepare_time
+= runtime_start
- prepare_start
;
19493 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19495 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19497 if (wordlist_mode
== WL_MODE_STDIN
)
19499 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
19503 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
19507 hc_thread_wait (data
.devices_cnt
, c_threads
);
19509 local_free (c_threads
);
19511 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19513 data
.devices_status
= STATUS_EXHAUSTED
;
19516 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
19520 if (induction_dictionaries_cnt
)
19522 unlink (induction_dictionaries
[0]);
19525 free (induction_dictionaries
);
19527 if (attack_mode
!= ATTACK_MODE_BF
)
19529 induction_dictionaries
= scan_directory (induction_directory
);
19531 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
19534 if (benchmark
== 1)
19536 status_benchmark ();
19538 if (machine_readable
== 0)
19564 if (induction_dictionaries_cnt
)
19566 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
19568 // 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)
19573 time_t runtime_stop
;
19575 time (&runtime_stop
);
19577 data
.runtime_stop
= runtime_stop
;
19579 logfile_sub_uint (runtime_start
);
19580 logfile_sub_uint (runtime_stop
);
19582 time (&prepare_start
);
19584 logfile_sub_msg ("STOP");
19586 global_free (subid
);
19588 // from this point we handle bypass as running
19590 if (data
.devices_status
== STATUS_BYPASS
)
19592 data
.devices_status
= STATUS_RUNNING
;
19595 // and overwrite benchmark aborts as well
19597 if (data
.benchmark
== 1)
19599 if (data
.devices_status
== STATUS_ABORTED
)
19601 data
.devices_status
= STATUS_RUNNING
;
19607 if (data
.devices_status
== STATUS_CRACKED
) break;
19608 if (data
.devices_status
== STATUS_ABORTED
) break;
19609 if (data
.devices_status
== STATUS_QUIT
) break;
19612 if (data
.devices_status
== STATUS_CRACKED
) break;
19613 if (data
.devices_status
== STATUS_ABORTED
) break;
19614 if (data
.devices_status
== STATUS_QUIT
) break;
19617 // 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
19618 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
19620 if (data
.wordlist_mode
== WL_MODE_FILE
)
19622 if (data
.dictfile
== NULL
)
19624 if (dictfiles
!= NULL
)
19626 data
.dictfile
= dictfiles
[0];
19628 hc_timer_set (&data
.timer_running
);
19633 // NOTE: combi is okay because it is already set beforehand
19634 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
19636 if (data
.dictfile
== NULL
)
19638 if (dictfiles
!= NULL
)
19640 hc_timer_set (&data
.timer_running
);
19642 data
.dictfile
= dictfiles
[0];
19646 else if (attack_mode
== ATTACK_MODE_BF
)
19648 if (data
.mask
== NULL
)
19650 hc_timer_set (&data
.timer_running
);
19652 data
.mask
= masks
[0];
19656 // if cracked / aborted remove last induction dictionary
19658 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
19660 struct stat induct_stat
;
19662 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
19664 unlink (induction_dictionaries
[file_pos
]);
19668 // wait for inner threads
19670 data
.shutdown_inner
= 1;
19672 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
19674 hc_thread_wait (1, &inner_threads
[thread_idx
]);
19677 local_free (inner_threads
);
19679 // we dont need restore file anymore
19680 if (data
.restore_disable
== 0)
19682 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
19684 unlink (eff_restore_file
);
19685 unlink (new_restore_file
);
19693 // finally save left hashes
19695 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
19704 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19706 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19708 if (device_param
->skipped
) continue;
19710 cl_int CL_err
= CL_SUCCESS
;
19712 local_free (device_param
->combs_buf
);
19713 local_free (device_param
->hooks_buf
);
19714 local_free (device_param
->device_name
);
19715 local_free (device_param
->device_name_chksum
);
19716 local_free (device_param
->device_version
);
19717 local_free (device_param
->driver_version
);
19719 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
19721 if (device_param
->d_pws_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
19722 if (device_param
->d_pws_amp_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
19723 if (device_param
->d_rules
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
19724 if (device_param
->d_rules_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
19725 if (device_param
->d_combs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
19726 if (device_param
->d_combs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
19727 if (device_param
->d_bfs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
19728 if (device_param
->d_bfs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
19729 if (device_param
->d_bitmap_s1_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
19730 if (device_param
->d_bitmap_s1_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
19731 if (device_param
->d_bitmap_s1_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
19732 if (device_param
->d_bitmap_s1_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
19733 if (device_param
->d_bitmap_s2_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
19734 if (device_param
->d_bitmap_s2_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
19735 if (device_param
->d_bitmap_s2_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
19736 if (device_param
->d_bitmap_s2_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
19737 if (device_param
->d_plain_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
19738 if (device_param
->d_digests_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
19739 if (device_param
->d_digests_shown
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
19740 if (device_param
->d_salt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
19741 if (device_param
->d_esalt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
19742 if (device_param
->d_tmps
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
19743 if (device_param
->d_hooks
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
19744 if (device_param
->d_result
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
19745 if (device_param
->d_scryptV0_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
19746 if (device_param
->d_scryptV1_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
19747 if (device_param
->d_scryptV2_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
19748 if (device_param
->d_scryptV3_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
19749 if (device_param
->d_root_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
19750 if (device_param
->d_markov_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
19751 if (device_param
->d_tm_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
19753 if (CL_err
!= CL_SUCCESS
)
19755 log_error ("ERROR: clReleaseMemObject(): %s\n", val2cstr_cl (CL_err
));
19760 if (device_param
->kernel1
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
19761 if (device_param
->kernel12
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
19762 if (device_param
->kernel2
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
19763 if (device_param
->kernel23
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
19764 if (device_param
->kernel3
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
19765 if (device_param
->kernel_mp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
19766 if (device_param
->kernel_mp_l
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
19767 if (device_param
->kernel_mp_r
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
19768 if (device_param
->kernel_tm
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
19769 if (device_param
->kernel_amp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
19770 if (device_param
->kernel_memset
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
19772 if (CL_err
!= CL_SUCCESS
)
19774 log_error ("ERROR: clReleaseKernel(): %s\n", val2cstr_cl (CL_err
));
19779 if (device_param
->program
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program
);
19780 if (device_param
->program_mp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
19781 if (device_param
->program_amp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
19783 if (CL_err
!= CL_SUCCESS
)
19785 log_error ("ERROR: clReleaseProgram(): %s\n", val2cstr_cl (CL_err
));
19790 if (device_param
->command_queue
) CL_err
|= hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
19792 if (CL_err
!= CL_SUCCESS
)
19794 log_error ("ERROR: clReleaseCommandQueue(): %s\n", val2cstr_cl (CL_err
));
19799 if (device_param
->context
) CL_err
|= hc_clReleaseContext (data
.ocl
, device_param
->context
);
19801 if (CL_err
!= CL_SUCCESS
)
19803 log_error ("ERROR: hc_clReleaseContext(): %s\n", val2cstr_cl (CL_err
));
19809 // reset default fan speed
19812 if (gpu_temp_disable
== 0)
19814 if (gpu_temp_retain
!= 0)
19816 hc_thread_mutex_lock (mux_adl
);
19818 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19820 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19822 if (device_param
->skipped
) continue;
19824 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
19828 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
19830 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
19832 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
19835 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
19839 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
19843 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
19847 hc_thread_mutex_unlock (mux_adl
);
19851 // reset power tuning
19853 if (powertune_enable
== 1)
19855 hc_thread_mutex_lock (mux_adl
);
19857 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19859 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19861 if (device_param
->skipped
) continue;
19863 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
19865 if (data
.hm_device
[device_id
].od_version
== 6)
19867 // check powertune capabilities first, if not available then skip device
19869 int powertune_supported
= 0;
19871 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
19873 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
19878 if (powertune_supported
!= 0)
19880 // powercontrol settings
19882 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
19884 log_info ("ERROR: Failed to restore the ADL PowerControl values");
19891 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
19893 performance_state
->iNumberOfPerformanceLevels
= 2;
19895 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
19896 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
19897 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
19898 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
19900 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
19902 log_info ("ERROR: Failed to restore ADL performance state");
19907 local_free (performance_state
);
19912 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
19914 unsigned int limit
= nvml_power_limit
[device_id
];
19918 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
19923 hc_thread_mutex_unlock (mux_adl
);
19926 if (gpu_temp_disable
== 0)
19930 hm_NVML_nvmlShutdown (data
.hm_nvml
);
19932 nvml_close (data
.hm_nvml
);
19934 data
.hm_nvml
= NULL
;
19939 hm_NvAPI_Unload (data
.hm_nvapi
);
19941 nvapi_close (data
.hm_nvapi
);
19943 data
.hm_nvapi
= NULL
;
19946 if (data
.hm_xnvctrl
)
19948 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
19950 xnvctrl_close (data
.hm_xnvctrl
);
19952 data
.hm_xnvctrl
= NULL
;
19957 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
19959 adl_close (data
.hm_adl
);
19961 data
.hm_adl
= NULL
;
19964 #endif // HAVE_HWMON
19968 local_free (masks
);
19970 local_free (dictstat_base
);
19972 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
19974 pot_t
*pot_ptr
= &pot
[pot_pos
];
19976 hash_t
*hash
= &pot_ptr
->hash
;
19978 local_free (hash
->digest
);
19982 local_free (hash
->salt
);
19988 local_free (all_kernel_rules_cnt
);
19989 local_free (all_kernel_rules_buf
);
19991 local_free (wl_data
->buf
);
19992 local_free (wl_data
);
19994 local_free (bitmap_s1_a
);
19995 local_free (bitmap_s1_b
);
19996 local_free (bitmap_s1_c
);
19997 local_free (bitmap_s1_d
);
19998 local_free (bitmap_s2_a
);
19999 local_free (bitmap_s2_b
);
20000 local_free (bitmap_s2_c
);
20001 local_free (bitmap_s2_d
);
20004 local_free (od_clock_mem_status
);
20005 local_free (od_power_control_status
);
20006 local_free (nvml_power_limit
);
20009 global_free (devices_param
);
20011 global_free (kernel_rules_buf
);
20013 global_free (root_css_buf
);
20014 global_free (markov_css_buf
);
20016 global_free (digests_buf
);
20017 global_free (digests_shown
);
20018 global_free (digests_shown_tmp
);
20020 global_free (salts_buf
);
20021 global_free (salts_shown
);
20023 global_free (esalts_buf
);
20025 global_free (words_progress_done
);
20026 global_free (words_progress_rejected
);
20027 global_free (words_progress_restored
);
20029 if (pot_fp
) fclose (pot_fp
);
20031 if (data
.devices_status
== STATUS_QUIT
) break;
20034 // wait for outer threads
20036 data
.shutdown_outer
= 1;
20038 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
20040 hc_thread_wait (1, &outer_threads
[thread_idx
]);
20043 local_free (outer_threads
);
20045 // destroy others mutex
20047 hc_thread_mutex_delete (mux_dispatcher
);
20048 hc_thread_mutex_delete (mux_counter
);
20049 hc_thread_mutex_delete (mux_display
);
20050 hc_thread_mutex_delete (mux_adl
);
20054 local_free (eff_restore_file
);
20055 local_free (new_restore_file
);
20061 tuning_db_destroy (tuning_db
);
20065 local_free (loopback_file
);
20067 if (loopback
== 1) unlink (loopback_file
);
20069 // induction directory
20071 if (induction_dir
== NULL
)
20073 if (attack_mode
!= ATTACK_MODE_BF
)
20075 if (rmdir (induction_directory
) == -1)
20077 if (errno
== ENOENT
)
20079 // good, we can ignore
20081 else if (errno
== ENOTEMPTY
)
20083 // good, we can ignore
20087 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
20093 local_free (induction_directory
);
20097 // outfile-check directory
20099 if (outfile_check_dir
== NULL
)
20101 if (rmdir (outfile_check_directory
) == -1)
20103 if (errno
== ENOENT
)
20105 // good, we can ignore
20107 else if (errno
== ENOTEMPTY
)
20109 // good, we can ignore
20113 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
20119 local_free (outfile_check_directory
);
20126 logfile_top_uint (proc_start
);
20127 logfile_top_uint (proc_stop
);
20129 logfile_top_msg ("STOP");
20131 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
20132 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
20134 if (data
.ocl
) ocl_close (data
.ocl
);
20136 if (data
.devices_status
== STATUS_ABORTED
) return 2;
20137 if (data
.devices_status
== STATUS_QUIT
) return 2;
20138 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
20139 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
20140 if (data
.devices_status
== STATUS_CRACKED
) return 0;