2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
19 #include <rp_kernel_on_cpu.h>
22 const char *PROGNAME
= "hashcat";
23 const uint VERSION_BIN
= 300;
24 const uint RESTORE_MIN
= 300;
26 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
28 #define INCR_RULES 10000
29 #define INCR_SALTS 100000
30 #define INCR_MASKS 1000
36 #define MARKOV_THRESHOLD 0
37 #define MARKOV_DISABLE 0
38 #define MARKOV_CLASSIC 0
42 #define RESTORE_TIMER 60
43 #define RESTORE_DISABLE 0
45 #define STATUS_TIMER 10
46 #define MACHINE_READABLE 0
48 #define WEAK_HASH_THRESHOLD 100
53 #define REMOVE_TIMER 60
57 #define POTFILE_DISABLE 0
60 #define RP_GEN_FUNC_MIN 1
61 #define RP_GEN_FUNC_MAX 4
63 #define RULE_BUF_L ":"
64 #define RULE_BUF_R ":"
69 #define HEX_WORDLIST 0
70 #define OUTFILE_FORMAT 3
71 #define OUTFILE_AUTOHEX 1
72 #define OUTFILE_CHECK_TIMER 5
75 #define SEGMENT_SIZE 32
77 #define INCREMENT_MIN 1
78 #define INCREMENT_MAX PW_MAX
82 #define NVIDIA_SPIN_DAMP 100
83 #define GPU_TEMP_DISABLE 0
84 #define GPU_TEMP_ABORT 90
85 #define GPU_TEMP_RETAIN 75
86 #define WORKLOAD_PROFILE 2
87 #define KERNEL_ACCEL 0
88 #define KERNEL_LOOPS 0
89 #define KERNEL_RULES 1024
90 #define KERNEL_COMBS 1024
91 #define KERNEL_BFS 1024
92 #define KERNEL_THREADS_MAX 256
93 #define KERNEL_THREADS_MAX_CPU 1
94 #define POWERTUNE_ENABLE 0
95 #define LOGFILE_DISABLE 0
97 #define OPENCL_VECTOR_WIDTH 0
99 #define WL_MODE_STDIN 1
100 #define WL_MODE_FILE 2
101 #define WL_MODE_MASK 3
103 #define HL_MODE_FILE 4
104 #define HL_MODE_ARG 5
106 #define HLFMTS_CNT 11
107 #define HLFMT_HASHCAT 0
108 #define HLFMT_PWDUMP 1
109 #define HLFMT_PASSWD 2
110 #define HLFMT_SHADOW 3
113 #define HLFMT_NETNTLM1 7
114 #define HLFMT_NETNTLM2 8
115 #define HLFMT_NSLDAP 9
116 #define HLFMT_NSLDAPS 10
118 #define HLFMT_TEXT_HASHCAT "native hashcat"
119 #define HLFMT_TEXT_PWDUMP "pwdump"
120 #define HLFMT_TEXT_PASSWD "passwd"
121 #define HLFMT_TEXT_SHADOW "shadow"
122 #define HLFMT_TEXT_DCC "DCC"
123 #define HLFMT_TEXT_DCC2 "DCC 2"
124 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
125 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
126 #define HLFMT_TEXT_NSLDAP "nsldap"
127 #define HLFMT_TEXT_NSLDAPS "nsldaps"
129 #define ATTACK_MODE_STRAIGHT 0
130 #define ATTACK_MODE_COMBI 1
131 #define ATTACK_MODE_TOGGLE 2
132 #define ATTACK_MODE_BF 3
133 #define ATTACK_MODE_PERM 4
134 #define ATTACK_MODE_TABLE 5
135 #define ATTACK_MODE_HYBRID1 6
136 #define ATTACK_MODE_HYBRID2 7
137 #define ATTACK_MODE_NONE 100
139 #define ATTACK_KERN_STRAIGHT 0
140 #define ATTACK_KERN_COMBI 1
141 #define ATTACK_KERN_BF 3
142 #define ATTACK_KERN_NONE 100
144 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
145 #define ATTACK_EXEC_INSIDE_KERNEL 11
147 #define COMBINATOR_MODE_BASE_LEFT 10001
148 #define COMBINATOR_MODE_BASE_RIGHT 10002
150 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
151 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
153 #define MAX_CUT_TRIES 4
155 #define MAX_DICTSTAT 10000
157 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
159 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
161 #define global_free(attr) \
163 myfree ((void *) data.attr); \
168 #define local_free(attr) \
170 myfree ((void *) attr); \
175 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
176 #define HC_API_CALL __stdcall
181 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
332 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
338 static unsigned int full01
= 0x01010101;
339 static unsigned int full80
= 0x80808080;
341 int SUPPRESS_OUTPUT
= 0;
343 hc_thread_mutex_t mux_adl
;
344 hc_thread_mutex_t mux_counter
;
345 hc_thread_mutex_t mux_dispatcher
;
346 hc_thread_mutex_t mux_display
;
348 hc_global_data_t data
;
350 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
352 const char *USAGE_MINI
[] =
354 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
356 "Try --help for more help.",
360 const char *USAGE_BIG
[] =
362 "%s, advanced password recovery",
364 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
368 " Options Short / Long | Type | Description | Example",
369 "===============================+======+======================================================+=======================",
370 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
371 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
372 " -V, --version | | Print version |",
373 " -h, --help | | Print help |",
374 " --quiet | | Suppress output |",
375 " --hex-charset | | Assume charset is given in hex |",
376 " --hex-salt | | Assume salt is given in hex |",
377 " --hex-wordlist | | Assume words in wordlist is given in hex |",
378 " --force | | Ignore warnings |",
379 " --status | | Enable automatic update of the status-screen |",
380 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
381 " --machine-readable | | Display the status view in a machine readable format |",
382 " --loopback | | Add new plains to induct directory |",
383 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
384 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
385 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
386 " --markov-classic | | Enables classic markov-chains, no per-position |",
387 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
388 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
389 " --session | Str | Define specific session name | --session=mysession",
390 " --restore | | Restore session from --session |",
391 " --restore-disable | | Do not write restore file |",
392 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
393 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
394 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
395 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
396 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
397 " --stdout | | Do not crack a hash, instead print candidates only |",
398 " --show | | Compare hashlist with potfile; Show cracked hashes |",
399 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
400 " --username | | Enable ignoring of usernames in hashfile |",
401 " --remove | | Enable remove of hash once it is cracked |",
402 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
403 " --potfile-disable | | Do not write potfile |",
404 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
405 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
406 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
407 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
408 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
409 " --logfile-disable | | Disable the logfile |",
410 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
411 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
412 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
413 " -b, --benchmark | | Run benchmark |",
414 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
415 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
416 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
417 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
418 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
419 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
420 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
421 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
422 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
423 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
424 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
425 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
426 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
428 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
429 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
430 " --powertune-enable | | Enable power tuning, restores settings when finished |",
432 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
433 " -s, --skip | Num | Skip X words from the start | -s 1000000",
434 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
435 " --keyspace | | Show keyspace base:mod values and quit |",
436 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
437 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
438 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
439 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
440 " --generate-rules-func-min | Num | Force min X funcs per rule |",
441 " --generate-rules-func-max | Num | Force max X funcs per rule |",
442 " --generate-rules-seed | Num | Force RNG seed set to X |",
443 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
444 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
445 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
446 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
447 " -i, --increment | | Enable mask increment mode |",
448 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
449 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
451 "- [ Hash modes ] -",
453 " # | Name | Category",
454 " ======+==================================================+======================================",
455 " 900 | MD4 | Raw Hash",
456 " 0 | MD5 | Raw Hash",
457 " 5100 | Half MD5 | Raw Hash",
458 " 100 | SHA1 | Raw Hash",
459 " 10800 | SHA-384 | Raw Hash",
460 " 1400 | SHA-256 | Raw Hash",
461 " 1700 | SHA-512 | Raw Hash",
462 " 5000 | SHA-3(Keccak) | Raw Hash",
463 " 10100 | SipHash | Raw Hash",
464 " 6000 | RipeMD160 | Raw Hash",
465 " 6100 | Whirlpool | Raw Hash",
466 " 6900 | GOST R 34.11-94 | Raw Hash",
467 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
468 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
469 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
470 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
471 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
472 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
473 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
474 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
475 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
476 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
477 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
478 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
479 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
480 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
481 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
482 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
483 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
484 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
485 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
486 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
487 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
488 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
489 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
490 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
491 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
492 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
493 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
494 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
495 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
496 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
497 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
498 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
499 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
500 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
501 " 400 | phpass | Generic KDF",
502 " 8900 | scrypt | Generic KDF",
503 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
504 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
505 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
506 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
507 " 23 | Skype | Network protocols",
508 " 2500 | WPA/WPA2 | Network protocols",
509 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
510 " 5300 | IKE-PSK MD5 | Network protocols",
511 " 5400 | IKE-PSK SHA1 | Network protocols",
512 " 5500 | NetNTLMv1 | Network protocols",
513 " 5500 | NetNTLMv1 + ESS | Network protocols",
514 " 5600 | NetNTLMv2 | Network protocols",
515 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
516 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
517 " 8300 | DNSSEC (NSEC3) | Network protocols",
518 " 10200 | Cram MD5 | Network protocols",
519 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
520 " 11200 | MySQL CRAM (SHA1) | Network protocols",
521 " 11400 | SIP digest authentication (MD5) | Network protocols",
522 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
523 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
524 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
525 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
526 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
527 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
528 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
529 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
530 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
531 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
532 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
533 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
534 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
535 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
536 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
537 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
538 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
539 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
540 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
541 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
542 " 12 | PostgreSQL | Database Server",
543 " 131 | MSSQL(2000) | Database Server",
544 " 132 | MSSQL(2005) | Database Server",
545 " 1731 | MSSQL(2012) | Database Server",
546 " 1731 | MSSQL(2014) | Database Server",
547 " 200 | MySQL323 | Database Server",
548 " 300 | MySQL4.1/MySQL5 | Database Server",
549 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
550 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
551 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
552 " 8000 | Sybase ASE | Database Server",
553 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
554 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
555 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
556 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
557 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
558 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
559 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
560 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
561 " 11500 | CRC32 | Checksums",
562 " 3000 | LM | Operating-Systems",
563 " 1000 | NTLM | Operating-Systems",
564 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
565 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
566 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
567 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
568 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
569 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
570 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
571 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
572 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
573 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
574 " 1722 | OSX v10.7 | Operating-Systems",
575 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
576 " 6300 | AIX {smd5} | Operating-Systems",
577 " 6700 | AIX {ssha1} | Operating-Systems",
578 " 6400 | AIX {ssha256} | Operating-Systems",
579 " 6500 | AIX {ssha512} | Operating-Systems",
580 " 2400 | Cisco-PIX | Operating-Systems",
581 " 2410 | Cisco-ASA | Operating-Systems",
582 " 500 | Cisco-IOS $1$ | Operating-Systems",
583 " 5700 | Cisco-IOS $4$ | Operating-Systems",
584 " 9200 | Cisco-IOS $8$ | Operating-Systems",
585 " 9300 | Cisco-IOS $9$ | Operating-Systems",
586 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
587 " 501 | Juniper IVE | Operating-Systems",
588 " 5800 | Android PIN | Operating-Systems",
589 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
590 " 8100 | Citrix Netscaler | Operating-Systems",
591 " 8500 | RACF | Operating-Systems",
592 " 7200 | GRUB 2 | Operating-Systems",
593 " 9900 | Radmin2 | Operating-Systems",
594 " 125 | ArubaOS | Operating-Systems",
595 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
596 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
597 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
598 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
599 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
600 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
601 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
602 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
603 " 11600 | 7-Zip | Archives",
604 " 12500 | RAR3-hp | Archives",
605 " 13000 | RAR5 | Archives",
606 " 13200 | AxCrypt | Archives",
607 " 13300 | AxCrypt in memory SHA1 | Archives",
608 " 13600 | WinZip | Archives",
609 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
610 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
611 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
612 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
613 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
614 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
615 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
616 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
617 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
618 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
619 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
623 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
624 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
625 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
626 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
627 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
628 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
629 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
630 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
631 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
632 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
633 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
634 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
635 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
636 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
637 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
638 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
639 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
640 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
641 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
642 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
643 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
644 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
645 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
646 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
647 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
648 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
649 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
650 " 9400 | MS Office 2007 | Documents",
651 " 9500 | MS Office 2010 | Documents",
652 " 9600 | MS Office 2013 | Documents",
653 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
654 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
655 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
656 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
657 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
658 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
659 " 9000 | Password Safe v2 | Password Managers",
660 " 5200 | Password Safe v3 | Password Managers",
661 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
662 " 6600 | 1Password, agilekeychain | Password Managers",
663 " 8200 | 1Password, cloudkeychain | Password Managers",
664 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
665 " 12700 | Blockchain, My Wallet | Password Managers",
666 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
668 "- [ Outfile Formats ] -",
674 " 3 | hash[:salt]:plain",
676 " 5 | hash[:salt]:hex_plain",
677 " 6 | plain:hex_plain",
678 " 7 | hash[:salt]:plain:hex_plain",
680 " 9 | hash[:salt]:crack_pos",
681 " 10 | plain:crack_pos",
682 " 11 | hash[:salt]:plain:crack_pos",
683 " 12 | hex_plain:crack_pos",
684 " 13 | hash[:salt]:hex_plain:crack_pos",
685 " 14 | plain:hex_plain:crack_pos",
686 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
688 "- [ Rule Debugging Modes ] -",
693 " 2 | Original-Word",
694 " 3 | Original-Word:Finding-Rule",
695 " 4 | Original-Word:Finding-Rule:Processed-Word",
697 "- [ Attack Modes ] -",
704 " 6 | Hybrid Wordlist + Mask",
705 " 7 | Hybrid Mask + Wordlist",
707 "- [ Built-in Charsets ] -",
711 " l | abcdefghijklmnopqrstuvwxyz",
712 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
714 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
718 "- [ OpenCL Device Types ] -",
721 " ===+=============",
724 " 3 | FPGA, DSP, Co-Processor",
726 "- [ Workload Profiles ] -",
728 " # | Performance | Runtime | Power Consumption | Desktop Impact",
729 " ===+=============+=========+===================+=================",
730 " 1 | Low | 2 ms | Low | Minimal",
731 " 2 | Default | 12 ms | Economic | Noticeable",
732 " 3 | High | 96 ms | High | Unresponsive",
733 " 4 | Nightmare | 480 ms | Insane | Headless",
735 "- [ Basic Examples ] -",
737 " Attack- | Hash- |",
738 " Mode | Type | Example command",
739 " ==================+=======+==================================================================",
740 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
741 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
742 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
743 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
745 "If you still have no idea what just happened try following pages:",
747 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
748 "* https://hashcat.net/wiki/#frequently_asked_questions",
753 * hashcat specific functions
756 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
758 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
760 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
762 double exec_ms_sum
= 0;
766 for (int i
= 0; i
< last_num_entries
; i
++)
768 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
772 exec_ms_sum
+= exec_ms
;
778 if (exec_ms_cnt
== 0) return 0;
780 return exec_ms_sum
/ exec_ms_cnt
;
783 void status_display_machine_readable ()
787 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
793 fprintf (out
, "SPEED\t");
795 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
797 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
799 if (device_param
->skipped
) continue;
804 for (int i
= 0; i
< SPEED_CACHE
; i
++)
806 speed_cnt
+= device_param
->speed_cnt
[i
];
807 speed_ms
+= device_param
->speed_ms
[i
];
810 speed_cnt
/= SPEED_CACHE
;
811 speed_ms
/= SPEED_CACHE
;
813 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
820 fprintf (out
, "EXEC_RUNTIME\t");
822 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
824 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
826 if (device_param
->skipped
) continue;
828 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
830 fprintf (out
, "%f\t", exec_ms_avg
);
837 u64 words_cur
= get_lowest_words_done ();
839 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
845 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
848 u64 all_rejected
= 0;
849 u64 all_restored
= 0;
851 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
853 all_done
+= data
.words_progress_done
[salt_pos
];
854 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
855 all_restored
+= data
.words_progress_restored
[salt_pos
];
858 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
859 u64 progress_end
= progress_total
;
861 u64 progress_skip
= 0;
865 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
867 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
868 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
869 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
874 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
876 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
877 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
878 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
881 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
882 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
884 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
890 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
891 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
898 if (data
.gpu_temp_disable
== 0)
900 fprintf (out
, "TEMP\t");
902 hc_thread_mutex_lock (mux_adl
);
904 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
906 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
908 if (device_param
->skipped
) continue;
910 int temp
= hm_get_temperature_with_device_id (device_id
);
912 fprintf (out
, "%d\t", temp
);
915 hc_thread_mutex_unlock (mux_adl
);
927 void status_display ()
929 if (data
.devices_status
== STATUS_INIT
) return;
930 if (data
.devices_status
== STATUS_STARTING
) return;
932 // in this case some required buffers are free'd, ascii_digest() would run into segfault
933 if (data
.shutdown_inner
== 1) return;
935 if (data
.machine_readable
== 1)
937 status_display_machine_readable ();
942 char tmp_buf
[1000] = { 0 };
946 log_info ("Session.Name...: %s", data
.session
);
948 char *status_type
= strstatus (data
.devices_status
);
950 uint hash_mode
= data
.hash_mode
;
952 char *hash_type
= strhashtype (hash_mode
); // not a bug
954 log_info ("Status.........: %s", status_type
);
960 if (data
.rp_files_cnt
)
964 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
966 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
969 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
971 log_info ("Rules.Type.....: %s", tmp_buf
);
978 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
980 if (data
.rp_gen_seed
)
982 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
990 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
992 if (data
.wordlist_mode
== WL_MODE_FILE
)
994 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
996 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
998 log_info ("Input.Mode.....: Pipe");
1001 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1003 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1004 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1006 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1008 char *mask
= data
.mask
;
1012 uint mask_len
= data
.css_cnt
;
1014 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1018 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1020 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1022 mask_len
-= data
.salts_buf
[0].salt_len
;
1026 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1028 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1031 if (data
.maskcnt
> 1)
1033 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1035 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1038 log_info ("Input.Mode.....: %s", tmp_buf
);
1043 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1045 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1046 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1048 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1050 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1051 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1054 if (data
.digests_cnt
== 1)
1056 if (data
.hash_mode
== 2500)
1058 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1060 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1061 (char *) data
.salts_buf
[0].salt_buf
,
1075 else if (data
.hash_mode
== 5200)
1077 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1079 else if (data
.hash_mode
== 9000)
1081 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1083 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1085 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1087 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1089 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1093 char out_buf
[HCBUFSIZ
] = { 0 };
1095 ascii_digest (out_buf
, 0, 0);
1098 if (strlen (out_buf
) > 40)
1106 log_info ("Hash.Target....: %s", out_buf
);
1111 if (data
.hash_mode
== 3000)
1113 char out_buf1
[32] = { 0 };
1114 char out_buf2
[32] = { 0 };
1116 ascii_digest (out_buf1
, 0, 0);
1117 ascii_digest (out_buf2
, 0, 1);
1119 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1123 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1127 log_info ("Hash.Type......: %s", hash_type
);
1133 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1134 double speed_ms
[DEVICES_MAX
] = { 0 };
1136 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1138 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1140 if (device_param
->skipped
) continue;
1142 speed_cnt
[device_id
] = 0;
1143 speed_ms
[device_id
] = 0;
1145 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1147 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1148 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1151 speed_cnt
[device_id
] /= SPEED_CACHE
;
1152 speed_ms
[device_id
] /= SPEED_CACHE
;
1155 double hashes_all_ms
= 0;
1157 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1159 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1161 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1163 if (device_param
->skipped
) continue;
1165 hashes_dev_ms
[device_id
] = 0;
1167 if (speed_ms
[device_id
])
1169 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1171 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1179 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1181 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1183 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1185 if (device_param
->skipped
) continue;
1187 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1189 exec_all_ms
[device_id
] = exec_ms_avg
;
1196 double ms_running
= 0;
1198 hc_timer_get (data
.timer_running
, ms_running
);
1200 double ms_paused
= data
.ms_paused
;
1202 if (data
.devices_status
== STATUS_PAUSED
)
1204 double ms_paused_tmp
= 0;
1206 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1208 ms_paused
+= ms_paused_tmp
;
1213 __time64_t sec_run
= ms_running
/ 1000;
1217 time_t sec_run
= ms_running
/ 1000;
1223 char display_run
[32] = { 0 };
1227 struct tm
*tmp
= NULL
;
1231 tmp
= _gmtime64 (&sec_run
);
1235 tmp
= gmtime (&sec_run
);
1241 memset (&tm_run
, 0, sizeof (tm_run
));
1243 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1245 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1247 char *start
= ctime (&data
.proc_start
);
1249 size_t start_len
= strlen (start
);
1251 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1252 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1254 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1259 log_info ("Time.Started...: 0 secs");
1266 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1269 u64 all_rejected
= 0;
1270 u64 all_restored
= 0;
1272 u64 progress_noneed
= 0;
1274 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1276 all_done
+= data
.words_progress_done
[salt_pos
];
1277 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1278 all_restored
+= data
.words_progress_restored
[salt_pos
];
1280 // Important for ETA only
1282 if (data
.salts_shown
[salt_pos
] == 1)
1284 const u64 all
= data
.words_progress_done
[salt_pos
]
1285 + data
.words_progress_rejected
[salt_pos
]
1286 + data
.words_progress_restored
[salt_pos
];
1288 const u64 left
= data
.words_cnt
- all
;
1290 progress_noneed
+= left
;
1294 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1295 u64 progress_end
= progress_total
;
1297 u64 progress_skip
= 0;
1301 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1303 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1304 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1305 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1310 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1312 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1313 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1314 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1317 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1318 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1320 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1322 if (data
.devices_status
!= STATUS_CRACKED
)
1325 __time64_t sec_etc
= 0;
1332 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1334 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1336 sec_etc
= ms_left
/ 1000;
1341 //log_info ("Time.Estimated.: 0 secs");
1343 else if ((u64
) sec_etc
> ETC_MAX
)
1345 log_info ("Time.Estimated.: > 10 Years");
1349 char display_etc
[32] = { 0 };
1350 char display_runtime
[32] = { 0 };
1353 struct tm tm_runtime
;
1355 struct tm
*tmp
= NULL
;
1358 tmp
= _gmtime64 (&sec_etc
);
1360 tmp
= gmtime (&sec_etc
);
1365 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1367 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1375 char *etc
= ctime (&now
);
1377 size_t etc_len
= strlen (etc
);
1379 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1380 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1386 time (&runtime_cur
);
1390 __time64_t runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
1392 tmp
= _gmtime64 (&runtime_left
);
1396 time_t runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
1398 tmp
= gmtime (&runtime_left
);
1402 if ((tmp
!= NULL
) && (runtime_left
> 0) && (runtime_left
< sec_etc
))
1404 memcpy (&tm_runtime
, tmp
, sizeof (tm_runtime
));
1406 format_timer_display (&tm_runtime
, display_runtime
, sizeof (display_runtime
));
1408 log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc
, display_etc
, display_runtime
);
1412 log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc
, display_etc
);
1417 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1424 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1426 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1428 if (device_param
->skipped
) continue;
1430 char display_dev_cur
[16] = { 0 };
1432 strncpy (display_dev_cur
, "0.00", 4);
1434 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1436 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1439 char display_all_cur
[16] = { 0 };
1441 strncpy (display_all_cur
, "0.00", 4);
1443 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1445 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1447 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1448 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1450 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1454 if (data
.digests_cnt
> 100)
1456 time_t now
= time (NULL
);
1458 int cpt_cur_min
= 0;
1459 int cpt_cur_hour
= 0;
1460 int cpt_cur_day
= 0;
1462 for (int i
= 0; i
< CPT_BUF
; i
++)
1464 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1465 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1467 if ((timestamp
+ 60) > now
)
1469 cpt_cur_min
+= cracked
;
1472 if ((timestamp
+ 3600) > now
)
1474 cpt_cur_hour
+= cracked
;
1477 if ((timestamp
+ 86400) > now
)
1479 cpt_cur_day
+= cracked
;
1483 double ms_real
= ms_running
- ms_paused
;
1485 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1486 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1487 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1489 if ((data
.cpt_start
+ 86400) < now
)
1491 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1499 else if ((data
.cpt_start
+ 3600) < now
)
1501 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1508 else if ((data
.cpt_start
+ 60) < now
)
1510 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1518 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1527 u64 restore_point
= get_lowest_words_done ();
1529 u64 restore_total
= data
.words_base
;
1531 float percent_restore
= 0;
1533 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1535 if (progress_end_relative_skip
)
1537 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1539 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1540 float percent_rejected
= 0.0;
1544 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1547 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1548 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1550 if (data
.restore_disable
== 0)
1552 if (percent_finished
!= 1)
1554 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1561 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1563 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1564 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1566 if (data
.restore_disable
== 0)
1568 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1573 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1574 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1576 // --restore not allowed if stdin is used -- really? why?
1578 //if (data.restore_disable == 0)
1580 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1587 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1588 if (data
.devices_status
== STATUS_CRACKED
) return;
1589 if (data
.devices_status
== STATUS_ABORTED
) return;
1590 if (data
.devices_status
== STATUS_QUIT
) return;
1592 if (data
.gpu_temp_disable
== 0)
1594 hc_thread_mutex_lock (mux_adl
);
1596 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1598 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1600 if (device_param
->skipped
) continue;
1602 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1603 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1604 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1605 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1606 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1607 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1608 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1610 char output_buf
[256] = { 0 };
1614 if (num_temperature
>= 0)
1616 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1618 output_len
= strlen (output_buf
);
1621 if (num_fanspeed
>= 0)
1623 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1625 output_len
= strlen (output_buf
);
1628 if (num_utilization
>= 0)
1630 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1632 output_len
= strlen (output_buf
);
1635 if (num_corespeed
>= 0)
1637 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1639 output_len
= strlen (output_buf
);
1642 if (num_memoryspeed
>= 0)
1644 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1646 output_len
= strlen (output_buf
);
1649 if (num_buslanes
>= 0)
1651 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1653 output_len
= strlen (output_buf
);
1656 if (num_throttle
== 1)
1658 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1660 output_len
= strlen (output_buf
);
1663 if (output_len
== 0)
1665 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1667 output_len
= strlen (output_buf
);
1670 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1673 hc_thread_mutex_unlock (mux_adl
);
1676 #endif // HAVE_HWMON
1679 static void status_benchmark_automate ()
1681 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1682 double speed_ms
[DEVICES_MAX
] = { 0 };
1684 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1686 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1688 if (device_param
->skipped
) continue;
1690 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1691 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1694 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1696 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1698 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1700 if (device_param
->skipped
) continue;
1702 hashes_dev_ms
[device_id
] = 0;
1704 if (speed_ms
[device_id
])
1706 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1710 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1712 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1714 if (device_param
->skipped
) continue;
1716 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1720 static void status_benchmark ()
1722 if (data
.devices_status
== STATUS_INIT
) return;
1723 if (data
.devices_status
== STATUS_STARTING
) return;
1725 if (data
.shutdown_inner
== 1) return;
1727 if (data
.machine_readable
== 1)
1729 status_benchmark_automate ();
1734 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1735 double speed_ms
[DEVICES_MAX
] = { 0 };
1737 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1739 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1741 if (device_param
->skipped
) continue;
1743 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1744 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1747 double hashes_all_ms
= 0;
1749 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1751 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1753 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1755 if (device_param
->skipped
) continue;
1757 hashes_dev_ms
[device_id
] = 0;
1759 if (speed_ms
[device_id
])
1761 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1763 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1771 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1773 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1775 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1777 if (device_param
->skipped
) continue;
1779 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1781 exec_all_ms
[device_id
] = exec_ms_avg
;
1784 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1786 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1788 if (device_param
->skipped
) continue;
1790 char display_dev_cur
[16] = { 0 };
1792 strncpy (display_dev_cur
, "0.00", 4);
1794 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1796 if (data
.devices_active
>= 10)
1798 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1802 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1806 char display_all_cur
[16] = { 0 };
1808 strncpy (display_all_cur
, "0.00", 4);
1810 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1812 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1816 * hashcat -only- functions
1819 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1821 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1823 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1824 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1825 else if (attack_kern
== ATTACK_KERN_COMBI
)
1826 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1827 else if (attack_kern
== ATTACK_KERN_BF
)
1828 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1831 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1834 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1836 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1838 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1839 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1840 else if (attack_kern
== ATTACK_KERN_COMBI
)
1841 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1842 else if (attack_kern
== ATTACK_KERN_BF
)
1843 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1847 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1851 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1853 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1855 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1859 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1863 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1865 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1867 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1871 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1875 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1877 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1880 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1882 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1885 static char *filename_from_filepath (char *filepath
)
1889 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1893 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1905 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1907 if (line_len
& 1) return (line_len
); // not in hex
1909 if (data
.hex_wordlist
== 1)
1914 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1916 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1919 memset (line_buf
+ i
, 0, line_len
- i
);
1923 else if (line_len
>= 6) // $HEX[] = 6
1925 if (line_buf
[0] != '$') return (line_len
);
1926 if (line_buf
[1] != 'H') return (line_len
);
1927 if (line_buf
[2] != 'E') return (line_len
);
1928 if (line_buf
[3] != 'X') return (line_len
);
1929 if (line_buf
[4] != '[') return (line_len
);
1930 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1935 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1937 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1940 memset (line_buf
+ i
, 0, line_len
- i
);
1948 static void clear_prompt ()
1950 fputc ('\r', stdout
);
1952 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1954 fputc (' ', stdout
);
1957 fputc ('\r', stdout
);
1962 static int gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1964 cl_int CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1966 if (CL_err
!= CL_SUCCESS
)
1968 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
1976 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1978 char *outfile
= data
.outfile
;
1979 uint quiet
= data
.quiet
;
1980 FILE *pot_fp
= data
.pot_fp
;
1981 uint loopback
= data
.loopback
;
1982 uint debug_mode
= data
.debug_mode
;
1983 char *debug_file
= data
.debug_file
;
1985 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1986 int debug_rule_len
= 0; // -1 error
1987 uint debug_plain_len
= 0;
1989 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1993 char out_buf
[HCBUFSIZ
] = { 0 };
1995 const u32 salt_pos
= plain
->salt_pos
;
1996 const u32 digest_pos
= plain
->digest_pos
; // relative
1997 const u32 gidvid
= plain
->gidvid
;
1998 const u32 il_pos
= plain
->il_pos
;
2000 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2004 u64 crackpos
= device_param
->words_off
;
2006 uint plain_buf
[16] = { 0 };
2008 u8
*plain_ptr
= (u8
*) plain_buf
;
2010 unsigned int plain_len
= 0;
2012 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2016 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2018 for (int i
= 0; i
< 16; i
++)
2020 plain_buf
[i
] = pw
.i
[i
];
2023 plain_len
= pw
.pw_len
;
2025 const uint off
= device_param
->innerloop_pos
+ il_pos
;
2032 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
2034 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
2036 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
2040 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
2042 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
2044 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
2046 debug_plain_len
= plain_len
;
2050 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2053 crackpos
*= data
.kernel_rules_cnt
;
2054 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2056 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2058 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2062 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2064 for (int i
= 0; i
< 16; i
++)
2066 plain_buf
[i
] = pw
.i
[i
];
2069 plain_len
= pw
.pw_len
;
2071 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2072 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2074 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2076 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2080 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2082 memcpy (plain_ptr
, comb_buf
, comb_len
);
2085 plain_len
+= comb_len
;
2088 crackpos
*= data
.combs_cnt
;
2089 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2091 if (data
.pw_max
!= PW_DICTMAX1
)
2093 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2096 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2098 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2099 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2101 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2102 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2104 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2105 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2107 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2108 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2110 plain_len
= data
.css_cnt
;
2113 crackpos
*= data
.bfs_cnt
;
2114 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2116 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2120 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2122 for (int i
= 0; i
< 16; i
++)
2124 plain_buf
[i
] = pw
.i
[i
];
2127 plain_len
= pw
.pw_len
;
2129 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2132 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2134 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2136 plain_len
+= start
+ stop
;
2139 crackpos
*= data
.combs_cnt
;
2140 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2142 if (data
.pw_max
!= PW_DICTMAX1
)
2144 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2147 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2151 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2153 for (int i
= 0; i
< 16; i
++)
2155 plain_buf
[i
] = pw
.i
[i
];
2158 plain_len
= pw
.pw_len
;
2160 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2163 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2165 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2167 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2169 plain_len
+= start
+ stop
;
2172 crackpos
*= data
.combs_cnt
;
2173 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2175 if (data
.pw_max
!= PW_DICTMAX1
)
2177 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2181 if (data
.attack_mode
== ATTACK_MODE_BF
)
2183 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2185 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2187 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2189 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2193 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2195 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2197 plain_ptr
[j
] = plain_ptr
[i
];
2200 plain_len
= plain_len
/ 2;
2205 // if enabled, update also the potfile
2211 fprintf (pot_fp
, "%s:", out_buf
);
2213 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2215 fputc ('\n', pot_fp
);
2219 unlock_file (pot_fp
);
2224 FILE *out_fp
= NULL
;
2226 if (outfile
!= NULL
)
2228 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2230 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2241 if (quiet
== 0) clear_prompt ();
2244 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2246 if (outfile
!= NULL
)
2248 if (out_fp
!= stdout
)
2255 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2257 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2259 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2260 if (quiet
== 0) fflush (stdout
);
2269 char *loopback_file
= data
.loopback_file
;
2273 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2277 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2279 fputc ('\n', fb_fp
);
2285 // (rule) debug mode
2287 // the next check implies that:
2288 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2291 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2293 if (debug_rule_len
< 0) debug_rule_len
= 0;
2295 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2297 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2299 if ((quiet
== 0) && (debug_file
== NULL
))
2301 fprintf (stdout
, "%s", PROMPT
);
2308 static int check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2310 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2316 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2318 if (CL_err
!= CL_SUCCESS
)
2320 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2327 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2331 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2333 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, 0, num_cracked
* sizeof (plain_t
), cracked
, 0, NULL
, NULL
);
2335 if (CL_err
!= CL_SUCCESS
)
2337 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2342 uint cpt_cracked
= 0;
2344 hc_thread_mutex_lock (mux_display
);
2346 for (uint i
= 0; i
< num_cracked
; i
++)
2348 const uint hash_pos
= cracked
[i
].hash_pos
;
2350 if (data
.digests_shown
[hash_pos
] == 1) continue;
2352 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2354 data
.digests_shown
[hash_pos
] = 1;
2356 data
.digests_done
++;
2360 salt_buf
->digests_done
++;
2362 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2364 data
.salts_shown
[salt_pos
] = 1;
2370 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2372 check_hash (device_param
, &cracked
[i
]);
2375 hc_thread_mutex_unlock (mux_display
);
2379 if (cpt_cracked
> 0)
2381 hc_thread_mutex_lock (mux_display
);
2383 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2384 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2388 data
.cpt_total
+= cpt_cracked
;
2390 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2392 hc_thread_mutex_unlock (mux_display
);
2395 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2397 // we need to reset cracked state on the device
2398 // otherwise host thinks again and again the hash was cracked
2399 // and returns invalid password each time
2401 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2403 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, salt_buf
->digests_offset
* sizeof (uint
), salt_buf
->digests_cnt
* sizeof (uint
), &data
.digests_shown_tmp
[salt_buf
->digests_offset
], 0, NULL
, NULL
);
2405 if (CL_err
!= CL_SUCCESS
)
2407 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2415 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2417 if (CL_err
!= CL_SUCCESS
)
2419 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2428 // stolen from princeprocessor ;)
2439 static void out_flush (out_t
*out
)
2441 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2446 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2448 char *ptr
= out
->buf
+ out
->len
;
2450 memcpy (ptr
, pw_buf
, pw_len
);
2454 out
->len
+= pw_len
+ 1;
2456 if (out
->len
>= BUFSIZ
- 100)
2462 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2469 uint plain_buf
[16] = { 0 };
2471 u8
*plain_ptr
= (u8
*) plain_buf
;
2475 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2477 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2481 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2483 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2485 const uint pos
= device_param
->innerloop_pos
;
2487 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2489 for (int i
= 0; i
< 8; i
++)
2491 plain_buf
[i
] = pw
.i
[i
];
2494 plain_len
= pw
.pw_len
;
2496 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2498 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2500 out_push (&out
, plain_ptr
, plain_len
);
2504 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2508 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2510 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2512 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2514 for (int i
= 0; i
< 8; i
++)
2516 plain_buf
[i
] = pw
.i
[i
];
2519 plain_len
= pw
.pw_len
;
2521 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2522 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2524 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2526 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2530 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2532 memcpy (plain_ptr
, comb_buf
, comb_len
);
2535 plain_len
+= comb_len
;
2537 if (data
.pw_max
!= PW_DICTMAX1
)
2539 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2542 out_push (&out
, plain_ptr
, plain_len
);
2546 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2548 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2550 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2552 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2553 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2555 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2556 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2558 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2559 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2561 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2562 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2564 plain_len
= data
.css_cnt
;
2566 out_push (&out
, plain_ptr
, plain_len
);
2570 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2574 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2576 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2578 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2580 for (int i
= 0; i
< 8; i
++)
2582 plain_buf
[i
] = pw
.i
[i
];
2585 plain_len
= pw
.pw_len
;
2587 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2590 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2592 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2594 plain_len
+= start
+ stop
;
2596 out_push (&out
, plain_ptr
, plain_len
);
2600 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2604 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2606 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2608 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2610 for (int i
= 0; i
< 8; i
++)
2612 plain_buf
[i
] = pw
.i
[i
];
2615 plain_len
= pw
.pw_len
;
2617 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2620 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2622 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2624 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2626 plain_len
+= start
+ stop
;
2628 out_push (&out
, plain_ptr
, plain_len
);
2636 static void save_hash ()
2638 char *hashfile
= data
.hashfile
;
2640 char new_hashfile
[256] = { 0 };
2641 char old_hashfile
[256] = { 0 };
2643 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2644 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2646 unlink (new_hashfile
);
2648 char separator
= data
.separator
;
2650 FILE *fp
= fopen (new_hashfile
, "wb");
2654 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2659 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2661 if (data
.salts_shown
[salt_pos
] == 1) continue;
2663 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2665 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2667 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2669 if (data
.digests_shown
[idx
] == 1) continue;
2671 if (data
.hash_mode
!= 2500)
2673 if (data
.username
== 1)
2675 user_t
*user
= data
.hash_info
[idx
]->user
;
2679 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2681 fputc (separator
, fp
);
2684 char out_buf
[HCBUFSIZ
]; // scratch buffer
2688 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2690 fputs (out_buf
, fp
);
2698 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2700 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2709 unlink (old_hashfile
);
2711 if (rename (hashfile
, old_hashfile
) != 0)
2713 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2720 if (rename (new_hashfile
, hashfile
) != 0)
2722 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2727 unlink (old_hashfile
);
2730 static int run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2732 cl_int CL_err
= CL_SUCCESS
;
2734 uint num_elements
= num
;
2736 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2737 device_param
->kernel_params_buf32
[34] = num
;
2739 uint kernel_threads
= device_param
->kernel_threads
;
2741 while (num_elements
% kernel_threads
) num_elements
++;
2743 cl_kernel kernel
= NULL
;
2747 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2748 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2749 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2750 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2751 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2754 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2755 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2756 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2757 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2758 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2759 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2760 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2761 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2762 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2763 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2764 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2766 if (CL_err
!= CL_SUCCESS
)
2768 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2775 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2777 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2778 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2780 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2782 if (CL_err
!= CL_SUCCESS
)
2784 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2791 if (kern_run
== KERN_RUN_2
)
2793 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2795 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2799 while (num_elements
% kernel_threads
) num_elements
++;
2801 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2802 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2804 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2806 if (CL_err
!= CL_SUCCESS
)
2808 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2814 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2816 if (CL_err
!= CL_SUCCESS
)
2818 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2823 if (device_param
->nvidia_spin_damp
)
2825 if (data
.devices_status
== STATUS_RUNNING
)
2827 if (iteration
< EXPECTED_ITERATIONS
)
2831 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2832 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2833 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2839 CL_err
= hc_clWaitForEvents (data
.ocl
, 1, &event
);
2841 if (CL_err
!= CL_SUCCESS
)
2843 log_error ("ERROR: clWaitForEvents(): %s\n", val2cstr_cl (CL_err
));
2848 cl_ulong time_start
;
2851 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2852 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2854 if (CL_err
!= CL_SUCCESS
)
2856 log_error ("ERROR: clGetEventProfilingInfo(): %s\n", val2cstr_cl (CL_err
));
2861 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2863 if (data
.devices_status
== STATUS_RUNNING
)
2865 if (iteration
< EXPECTED_ITERATIONS
)
2869 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2870 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2871 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2878 uint exec_pos
= device_param
->exec_pos
;
2880 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2884 if (exec_pos
== EXEC_CACHE
)
2889 device_param
->exec_pos
= exec_pos
;
2892 CL_err
= hc_clReleaseEvent (data
.ocl
, event
);
2894 if (CL_err
!= CL_SUCCESS
)
2896 log_error ("ERROR: clReleaseEvent(): %s\n", val2cstr_cl (CL_err
));
2901 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2903 if (CL_err
!= CL_SUCCESS
)
2905 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
2913 static int run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2915 cl_int CL_err
= CL_SUCCESS
;
2917 uint num_elements
= num
;
2921 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2922 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2923 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2926 // causes problems with special threads like in bcrypt
2927 // const uint kernel_threads = device_param->kernel_threads;
2929 uint kernel_threads
= device_param
->kernel_threads
;
2931 while (num_elements
% kernel_threads
) num_elements
++;
2933 cl_kernel kernel
= NULL
;
2937 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2938 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2939 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2944 case KERN_RUN_MP
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2945 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2946 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2947 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2948 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2949 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2951 case KERN_RUN_MP_R
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2952 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2953 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2954 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2955 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2956 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2958 case KERN_RUN_MP_L
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2959 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2960 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2961 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2962 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2963 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2964 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2968 if (CL_err
!= CL_SUCCESS
)
2970 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2975 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2976 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2978 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2980 if (CL_err
!= CL_SUCCESS
)
2982 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2987 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2989 if (CL_err
!= CL_SUCCESS
)
2991 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2996 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2998 if (CL_err
!= CL_SUCCESS
)
3000 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3008 static int run_kernel_tm (hc_device_param_t
*device_param
)
3010 cl_int CL_err
= CL_SUCCESS
;
3012 const uint num_elements
= 1024; // fixed
3014 uint kernel_threads
= 32;
3016 cl_kernel kernel
= device_param
->kernel_tm
;
3018 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3019 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3021 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3023 if (CL_err
!= CL_SUCCESS
)
3025 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3030 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3032 if (CL_err
!= CL_SUCCESS
)
3034 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3039 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3041 if (CL_err
!= CL_SUCCESS
)
3043 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3051 static int run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
3053 cl_int CL_err
= CL_SUCCESS
;
3055 uint num_elements
= num
;
3057 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
3058 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
3060 // causes problems with special threads like in bcrypt
3061 // const uint kernel_threads = device_param->kernel_threads;
3063 uint kernel_threads
= device_param
->kernel_threads
;
3065 while (num_elements
% kernel_threads
) num_elements
++;
3067 cl_kernel kernel
= device_param
->kernel_amp
;
3069 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
3070 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
3072 if (CL_err
!= CL_SUCCESS
)
3074 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3079 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3080 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3082 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3084 if (CL_err
!= CL_SUCCESS
)
3086 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3091 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3093 if (CL_err
!= CL_SUCCESS
)
3095 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3100 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3102 if (CL_err
!= CL_SUCCESS
)
3104 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3112 static int run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
3114 cl_int CL_err
= CL_SUCCESS
;
3116 const u32 num16d
= num
/ 16;
3117 const u32 num16m
= num
% 16;
3121 device_param
->kernel_params_memset_buf32
[1] = value
;
3122 device_param
->kernel_params_memset_buf32
[2] = num16d
;
3124 uint kernel_threads
= device_param
->kernel_threads
;
3126 uint num_elements
= num16d
;
3128 while (num_elements
% kernel_threads
) num_elements
++;
3130 cl_kernel kernel
= device_param
->kernel_memset
;
3132 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
3133 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
3134 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
3136 if (CL_err
!= CL_SUCCESS
)
3138 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3143 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3144 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3146 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3148 if (CL_err
!= CL_SUCCESS
)
3150 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3155 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3157 if (CL_err
!= CL_SUCCESS
)
3159 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3164 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3166 if (CL_err
!= CL_SUCCESS
)
3168 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3183 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
3185 if (CL_err
!= CL_SUCCESS
)
3187 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3196 static int run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
3198 return run_kernel_memset (device_param
, buf
, 0, size
);
3201 static int choose_kernel (hc_device_param_t
*device_param
, const uint attack_exec
, const uint attack_mode
, const uint opts_type
, const salt_t
*salt_buf
, const uint highest_pw_len
, const uint pws_cnt
, const uint fast_iteration
)
3203 cl_int CL_err
= CL_SUCCESS
;
3205 if (data
.hash_mode
== 2000)
3207 process_stdout (device_param
, pws_cnt
);
3212 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3214 if (attack_mode
== ATTACK_MODE_BF
)
3216 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
3218 const uint size_tm
= 32 * sizeof (bs_word_t
);
3220 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
3222 run_kernel_tm (device_param
);
3224 CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
3226 if (CL_err
!= CL_SUCCESS
)
3228 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3235 if (highest_pw_len
< 16)
3237 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
3239 else if (highest_pw_len
< 32)
3241 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3245 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3250 run_kernel_amp (device_param
, pws_cnt
);
3252 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3254 if (opts_type
& OPTS_TYPE_HOOK12
)
3256 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3258 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3260 if (CL_err
!= CL_SUCCESS
)
3262 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3267 // do something with data
3269 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3271 if (CL_err
!= CL_SUCCESS
)
3273 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3279 uint iter
= salt_buf
->salt_iter
;
3281 uint loop_step
= device_param
->kernel_loops
;
3283 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3285 uint loop_left
= iter
- loop_pos
;
3287 loop_left
= MIN (loop_left
, loop_step
);
3289 device_param
->kernel_params_buf32
[28] = loop_pos
;
3290 device_param
->kernel_params_buf32
[29] = loop_left
;
3292 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3294 if (data
.devices_status
== STATUS_CRACKED
) break;
3295 if (data
.devices_status
== STATUS_ABORTED
) break;
3296 if (data
.devices_status
== STATUS_QUIT
) break;
3297 if (data
.devices_status
== STATUS_BYPASS
) break;
3303 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3305 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3309 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3311 const u32 speed_pos
= device_param
->speed_pos
;
3313 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3315 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3317 if (data
.benchmark
== 1)
3319 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3323 if (opts_type
& OPTS_TYPE_HOOK23
)
3325 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3327 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3329 if (CL_err
!= CL_SUCCESS
)
3331 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3336 // do something with data
3338 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3340 if (CL_err
!= CL_SUCCESS
)
3342 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3348 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3354 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3360 else if (rule_len
== 1)
3362 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3368 static int run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3370 cl_int CL_err
= CL_SUCCESS
;
3372 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3374 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3376 if (CL_err
!= CL_SUCCESS
)
3378 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3383 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3385 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3387 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3389 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3391 for (u32 i
= 0; i
< pws_cnt
; i
++)
3393 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3395 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3400 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3402 for (u32 i
= 0; i
< pws_cnt
; i
++)
3404 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3406 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3413 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3415 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3417 for (u32 i
= 0; i
< pws_cnt
; i
++)
3419 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3421 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3426 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3428 for (u32 i
= 0; i
< pws_cnt
; i
++)
3430 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3432 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3439 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3441 if (CL_err
!= CL_SUCCESS
)
3443 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3448 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3450 const u64 off
= device_param
->words_off
;
3452 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3454 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3460 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3462 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3464 device_param
->kernel_params_buf32
[28] = 0;
3465 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3466 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3468 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3470 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3474 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3477 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3479 return exec_ms_prev
;
3482 static int autotune (hc_device_param_t
*device_param
)
3484 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3486 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3487 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3489 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3490 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3492 u32 kernel_accel
= kernel_accel_min
;
3493 u32 kernel_loops
= kernel_loops_min
;
3495 // in this case the user specified a fixed -u and -n on the commandline
3496 // no way to tune anything
3497 // but we need to run a few caching rounds
3499 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3501 if (data
.hash_mode
!= 2000)
3503 try_run (device_param
, kernel_accel
, kernel_loops
);
3504 try_run (device_param
, kernel_accel
, kernel_loops
);
3505 try_run (device_param
, kernel_accel
, kernel_loops
);
3506 try_run (device_param
, kernel_accel
, kernel_loops
);
3509 device_param
->kernel_accel
= kernel_accel
;
3510 device_param
->kernel_loops
= kernel_loops
;
3512 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3514 device_param
->kernel_power
= kernel_power
;
3519 // from here it's clear we are allowed to autotune
3520 // so let's init some fake words
3522 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3524 if (data
.attack_kern
== ATTACK_KERN_BF
)
3526 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3530 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3532 device_param
->pws_buf
[i
].i
[0] = i
;
3533 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3534 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3537 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, kernel_power_max
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3539 if (CL_err
!= CL_SUCCESS
)
3541 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3547 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3549 if (data
.kernel_rules_cnt
> 1)
3551 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3553 if (CL_err
!= CL_SUCCESS
)
3555 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3563 run_kernel_amp (device_param
, kernel_power_max
);
3566 #define VERIFIER_CNT 1
3568 // first find out highest kernel-loops that stays below target_ms
3570 if (kernel_loops_min
< kernel_loops_max
)
3572 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3574 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3576 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3578 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3580 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3583 if (exec_ms
< target_ms
) break;
3587 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3589 #define STEPS_CNT 10
3591 if (kernel_accel_min
< kernel_accel_max
)
3593 for (int i
= 0; i
< STEPS_CNT
; i
++)
3595 const u32 kernel_accel_try
= 1 << i
;
3597 if (kernel_accel_try
< kernel_accel_min
) continue;
3598 if (kernel_accel_try
> kernel_accel_max
) break;
3600 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3602 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3604 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3606 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3609 if (exec_ms
> target_ms
) break;
3611 kernel_accel
= kernel_accel_try
;
3615 // at this point we want to know the actual runtime for the following reason:
3616 // we need a reference for the balancing loop following up, and this
3617 // the balancing loop can have an effect that the creates a new opportunity, for example:
3618 // if the target is 95 ms and the current runtime is 48ms the above loop
3619 // stopped the execution because the previous exec_ms was > 95ms
3620 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3621 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3623 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3625 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3627 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3629 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3632 u32 diff
= kernel_loops
- kernel_accel
;
3634 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3636 u32 kernel_accel_orig
= kernel_accel
;
3637 u32 kernel_loops_orig
= kernel_loops
;
3639 for (u32 f
= 1; f
< 1024; f
++)
3641 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3642 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3644 if (kernel_accel_try
> kernel_accel_max
) break;
3645 if (kernel_loops_try
< kernel_loops_min
) break;
3647 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3649 if (diff_new
> diff
) break;
3653 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3655 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3657 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3659 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3662 if (exec_ms
< exec_ms_pre_final
)
3664 exec_ms_pre_final
= exec_ms
;
3666 kernel_accel
= kernel_accel_try
;
3667 kernel_loops
= kernel_loops_try
;
3672 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3674 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3676 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3678 if (exec_accel_min
>= 1.0)
3680 // this is safe to not overflow kernel_accel_max because of accel_left
3682 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3685 // reset them fake words
3688 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3690 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3691 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3694 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3696 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3698 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3703 device_param
->exec_pos
= 0;
3705 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3707 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3708 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3709 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3713 device_param
->kernel_accel
= kernel_accel
;
3714 device_param
->kernel_loops
= kernel_loops
;
3716 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3718 device_param
->kernel_power
= kernel_power
;
3722 if (data
.quiet
== 0)
3726 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3727 "- Device #%u: autotuned kernel-loops to %u\n",
3728 device_param
->device_id
+ 1, kernel_accel
,
3729 device_param
->device_id
+ 1, kernel_loops
);
3731 fprintf (stdout
, "%s", PROMPT
);
3741 static int run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3743 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3747 uint speed_pos
= device_param
->speed_pos
;
3750 if (device_param
->timer_speed
.tv_sec
== 0)
3752 hc_timer_set (&device_param
->timer_speed
);
3757 if (device_param
->timer_speed
.QuadPart
== 0)
3759 hc_timer_set (&device_param
->timer_speed
);
3763 // find higest password length, this is for optimization stuff
3765 uint highest_pw_len
= 0;
3767 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3770 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3773 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3775 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3776 + device_param
->kernel_params_mp_l_buf32
[5];
3781 uint innerloop_step
= 0;
3782 uint innerloop_cnt
= 0;
3784 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3785 else innerloop_step
= 1;
3787 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3788 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3789 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3791 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3793 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3795 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3797 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3799 if (data
.devices_status
== STATUS_CRACKED
) break;
3800 if (data
.devices_status
== STATUS_ABORTED
) break;
3801 if (data
.devices_status
== STATUS_QUIT
) break;
3802 if (data
.devices_status
== STATUS_BYPASS
) break;
3804 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3806 device_param
->kernel_params_buf32
[27] = salt_pos
;
3807 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3808 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3810 FILE *combs_fp
= device_param
->combs_fp
;
3812 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3819 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3821 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3823 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3825 if (data
.devices_status
== STATUS_CRACKED
) break;
3826 if (data
.devices_status
== STATUS_ABORTED
) break;
3827 if (data
.devices_status
== STATUS_QUIT
) break;
3828 if (data
.devices_status
== STATUS_BYPASS
) break;
3830 uint fast_iteration
= 0;
3832 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3834 if (innerloop_left
> innerloop_step
)
3836 innerloop_left
= innerloop_step
;
3841 device_param
->innerloop_pos
= innerloop_pos
;
3842 device_param
->innerloop_left
= innerloop_left
;
3844 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3846 // i think we can get rid of this
3847 if (innerloop_left
== 0)
3849 puts ("bug, how should this happen????\n");
3854 if (data
.salts_shown
[salt_pos
] == 1)
3856 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3861 // initialize amplifiers
3863 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3867 while (i
< innerloop_left
)
3869 if (feof (combs_fp
)) break;
3871 int line_len
= fgetl (combs_fp
, line_buf
);
3873 if (line_len
>= PW_MAX1
) continue;
3875 line_len
= convert_from_hex (line_buf
, line_len
);
3877 char *line_buf_new
= line_buf
;
3879 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3881 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3883 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3885 if (rule_len_out
< 0)
3887 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3892 line_len
= rule_len_out
;
3894 line_buf_new
= rule_buf_out
;
3897 line_len
= MIN (line_len
, PW_DICTMAX
);
3899 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3901 memcpy (ptr
, line_buf_new
, line_len
);
3903 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3905 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3907 uppercase (ptr
, line_len
);
3910 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3912 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3914 ptr
[line_len
] = 0x80;
3917 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3919 ptr
[line_len
] = 0x01;
3923 device_param
->combs_buf
[i
].pw_len
= line_len
;
3928 for (uint j
= i
; j
< innerloop_left
; j
++)
3930 device_param
->combs_buf
[j
].i
[0] = 0;
3931 device_param
->combs_buf
[j
].i
[1] = 0;
3932 device_param
->combs_buf
[j
].i
[2] = 0;
3933 device_param
->combs_buf
[j
].i
[3] = 0;
3934 device_param
->combs_buf
[j
].i
[4] = 0;
3935 device_param
->combs_buf
[j
].i
[5] = 0;
3936 device_param
->combs_buf
[j
].i
[6] = 0;
3937 device_param
->combs_buf
[j
].i
[7] = 0;
3939 device_param
->combs_buf
[j
].pw_len
= 0;
3944 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3946 u64 off
= innerloop_pos
;
3948 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3950 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3952 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3954 u64 off
= innerloop_pos
;
3956 device_param
->kernel_params_mp_buf64
[3] = off
;
3958 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3960 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3962 u64 off
= innerloop_pos
;
3964 device_param
->kernel_params_mp_buf64
[3] = off
;
3966 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3971 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3973 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (kernel_rule_t
), 0, innerloop_left
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3975 if (CL_err
!= CL_SUCCESS
)
3977 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3982 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3984 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
3986 if (CL_err
!= CL_SUCCESS
)
3988 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3993 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3995 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
3997 if (CL_err
!= CL_SUCCESS
)
3999 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4004 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
4006 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4008 if (CL_err
!= CL_SUCCESS
)
4010 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4015 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
4017 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4019 if (CL_err
!= CL_SUCCESS
)
4021 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4027 if (data
.benchmark
== 1)
4029 hc_timer_set (&device_param
->timer_speed
);
4032 int rc
= choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
4034 if (rc
== -1) return -1;
4036 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4038 if (data
.devices_status
== STATUS_CRACKED
) break;
4039 if (data
.devices_status
== STATUS_ABORTED
) break;
4040 if (data
.devices_status
== STATUS_QUIT
) break;
4041 if (data
.devices_status
== STATUS_BYPASS
) break;
4047 if (data
.benchmark
== 0)
4049 check_cracked (device_param
, salt_pos
);
4056 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
4058 hc_thread_mutex_lock (mux_counter
);
4060 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
4062 hc_thread_mutex_unlock (mux_counter
);
4070 hc_timer_get (device_param
->timer_speed
, speed_ms
);
4072 hc_timer_set (&device_param
->timer_speed
);
4076 //hc_thread_mutex_lock (mux_display);
4078 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
4080 device_param
->speed_ms
[speed_pos
] = speed_ms
;
4082 //hc_thread_mutex_unlock (mux_display);
4086 if (speed_pos
== SPEED_CACHE
)
4095 if (data
.benchmark
== 1) break;
4099 device_param
->speed_pos
= speed_pos
;
4106 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
4108 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
4112 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
4114 wl_data
->buf
[wl_data
->cnt
] = 0;
4116 if (wl_data
->cnt
== 0) return;
4118 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
4122 if (wl_data
->cnt
== wl_data
->avail
)
4124 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
4126 wl_data
->avail
+= wl_data
->incr
;
4129 const int c
= fgetc (fd
);
4131 if (c
== EOF
) break;
4133 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
4137 if (c
== '\n') break;
4140 // ensure stream ends with a newline
4142 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
4146 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
4152 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4156 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4158 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4168 if (*ptr
!= '\n') continue;
4172 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4183 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4187 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4189 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4191 if (*ptr
!= '\n') continue;
4195 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4206 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4210 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4212 if (*ptr
!= '\n') continue;
4216 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4227 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
4229 while (wl_data
->pos
< wl_data
->cnt
)
4234 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
4236 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
4238 wl_data
->pos
+= off
;
4240 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4242 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4244 int rule_len_out
= -1;
4246 if (len
< BLOCK_SIZE
)
4248 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
4251 if (rule_len_out
< 0)
4256 if (rule_len_out
> PW_MAX
)
4277 fprintf (stderr
, "BUG feof()!!\n");
4282 load_segment (wl_data
, fd
);
4284 get_next_word (wl_data
, fd
, out_buf
, out_len
);
4288 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
4292 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
4302 fstat (fileno (fd
), &d
.stat
);
4306 _fstat64 (fileno (fd
), &d
.stat
);
4310 d
.stat
.st_nlink
= 0;
4314 d
.stat
.st_atime
= 0;
4317 d
.stat
.st_blksize
= 0;
4318 d
.stat
.st_blocks
= 0;
4321 if (d
.stat
.st_size
== 0) return 0;
4323 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4325 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
4329 u64 cnt
= d_cache
->cnt
;
4333 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4335 keyspace
*= data
.kernel_rules_cnt
;
4337 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4339 keyspace
*= data
.combs_cnt
;
4342 if (data
.quiet
== 0) log_info ("Cache-hit dictionary stats %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) d
.stat
.st_size
, (unsigned long long int) cnt
, (unsigned long long int) keyspace
);
4343 if (data
.quiet
== 0) log_info ("");
4345 hc_signal (sigHandler_default
);
4360 load_segment (wl_data
, fd
);
4362 comp
+= wl_data
->cnt
;
4366 while (i
< wl_data
->cnt
)
4371 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4373 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4375 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4377 int rule_len_out
= -1;
4379 if (len
< BLOCK_SIZE
)
4381 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4384 if (rule_len_out
< 0)
4396 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4398 cnt
+= data
.kernel_rules_cnt
;
4400 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4402 cnt
+= data
.combs_cnt
;
4415 if ((now
- prev
) == 0) continue;
4417 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4419 if (data
.quiet
== 0) log_info_nn ("Generating dictionary stats for %s: %llu bytes (%.2f%%), %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, percent
* 100, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4424 if (data
.quiet
== 0) log_info ("Generated dictionary stats for %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4425 if (data
.quiet
== 0) log_info ("");
4427 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4429 hc_signal (sigHandler_default
);
4434 static void *thread_monitor (void *p
)
4436 uint runtime_check
= 0;
4437 uint remove_check
= 0;
4438 uint status_check
= 0;
4439 uint restore_check
= 0;
4441 uint restore_left
= data
.restore_timer
;
4442 uint remove_left
= data
.remove_timer
;
4443 uint status_left
= data
.status_timer
;
4446 uint hwmon_check
= 0;
4448 int slowdown_warnings
= 0;
4450 // these variables are mainly used for fan control
4452 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4454 // temperature controller "loopback" values
4456 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4457 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4459 int temp_threshold
= 1; // degrees celcius
4461 int fan_speed_min
= 15; // in percentage
4462 int fan_speed_max
= 100;
4464 time_t last_temp_check_time
;
4465 #endif // HAVE_HWMON
4467 uint sleep_time
= 1;
4474 if (data
.restore_timer
)
4479 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4484 if (data
.status
== 1)
4490 if (data
.gpu_temp_disable
== 0)
4492 time (&last_temp_check_time
);
4498 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4501 if (hwmon_check
== 0)
4506 while (data
.shutdown_inner
== 0)
4508 hc_sleep (sleep_time
);
4510 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4514 if (hwmon_check
== 1)
4516 hc_thread_mutex_lock (mux_adl
);
4518 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4520 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4522 if (device_param
->skipped
) continue;
4524 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4528 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
;
4529 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
;
4531 memset (&perfPolicies_info
, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
));
4532 memset (&perfPolicies_status
, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
));
4534 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4535 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4537 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4539 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4541 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4543 if (perfPolicies_status
.throttle
& 2)
4545 if (slowdown_warnings
< 3)
4547 if (data
.quiet
== 0) clear_prompt ();
4549 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4551 if (slowdown_warnings
== 2)
4556 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4557 if (data
.quiet
== 0) fflush (stdout
);
4559 slowdown_warnings
++;
4564 slowdown_warnings
= 0;
4570 hc_thread_mutex_unlock (mux_adl
);
4573 if (hwmon_check
== 1)
4575 hc_thread_mutex_lock (mux_adl
);
4577 time_t temp_check_time
;
4579 time (&temp_check_time
);
4581 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4583 if (Ta
== 0) Ta
= 1;
4585 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4587 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4589 if (device_param
->skipped
) continue;
4591 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4593 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4595 if (temperature
> (int) data
.gpu_temp_abort
)
4597 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4599 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4604 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4606 if (gpu_temp_retain
)
4608 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4610 int temp_cur
= temperature
;
4612 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4614 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4616 // calculate Ta value (time difference in seconds between the last check and this check)
4618 last_temp_check_time
= temp_check_time
;
4624 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4626 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[device_id
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[device_id
])) / Ta
);
4628 if (abs (fan_diff_required
) >= temp_threshold
)
4630 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4632 int fan_speed_level
= fan_speed_cur
;
4634 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4636 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4638 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4639 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4641 if (fan_speed_new
!= fan_speed_cur
)
4643 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4644 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4646 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4648 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4650 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4652 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4655 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4659 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4663 fan_speed_chgd
[device_id
] = 1;
4666 temp_diff_old
[device_id
] = temp_diff_new
;
4673 hc_thread_mutex_unlock (mux_adl
);
4675 #endif // HAVE_HWMON
4677 if (restore_check
== 1)
4681 if (restore_left
== 0)
4683 if (data
.restore_disable
== 0) cycle_restore ();
4685 restore_left
= data
.restore_timer
;
4689 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4693 time (&runtime_cur
);
4695 int runtime_left
= data
.proc_start
+ data
.runtime
- runtime_cur
;
4697 if (runtime_left
<= 0)
4699 if (data
.benchmark
== 0)
4701 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4704 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4708 if (remove_check
== 1)
4712 if (remove_left
== 0)
4714 if (data
.digests_saved
!= data
.digests_done
)
4716 data
.digests_saved
= data
.digests_done
;
4721 remove_left
= data
.remove_timer
;
4725 if (status_check
== 1)
4729 if (status_left
== 0)
4731 hc_thread_mutex_lock (mux_display
);
4733 if (data
.quiet
== 0) clear_prompt ();
4735 if (data
.quiet
== 0) log_info ("");
4739 if (data
.quiet
== 0) log_info ("");
4741 hc_thread_mutex_unlock (mux_display
);
4743 status_left
= data
.status_timer
;
4749 myfree (fan_speed_chgd
);
4751 myfree (temp_diff_old
);
4752 myfree (temp_diff_sum
);
4760 static void *thread_outfile_remove (void *p
)
4762 // some hash-dependent constants
4763 char *outfile_dir
= data
.outfile_check_directory
;
4764 uint dgst_size
= data
.dgst_size
;
4765 uint isSalted
= data
.isSalted
;
4766 uint esalt_size
= data
.esalt_size
;
4767 uint hash_mode
= data
.hash_mode
;
4769 uint outfile_check_timer
= data
.outfile_check_timer
;
4771 char separator
= data
.separator
;
4773 // some hash-dependent functions
4774 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4775 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4778 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4780 hash_buf
.digest
= mymalloc (dgst_size
);
4782 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4784 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4786 uint digest_buf
[64] = { 0 };
4788 outfile_data_t
*out_info
= NULL
;
4790 char **out_files
= NULL
;
4792 time_t folder_mtime
= 0;
4796 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4798 while (data
.shutdown_inner
== 0)
4802 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4806 if (check_left
== 0)
4808 struct stat outfile_check_stat
;
4810 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4812 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4816 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4818 char **out_files_new
= scan_directory (outfile_dir
);
4820 int out_cnt_new
= count_dictionaries (out_files_new
);
4822 outfile_data_t
*out_info_new
= NULL
;
4824 if (out_cnt_new
> 0)
4826 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4828 for (int i
= 0; i
< out_cnt_new
; i
++)
4830 out_info_new
[i
].file_name
= out_files_new
[i
];
4832 // check if there are files that we have seen/checked before (and not changed)
4834 for (int j
= 0; j
< out_cnt
; j
++)
4836 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4838 struct stat outfile_stat
;
4840 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4842 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4844 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4845 out_info_new
[i
].seek
= out_info
[j
].seek
;
4853 local_free (out_info
);
4854 local_free (out_files
);
4856 out_files
= out_files_new
;
4857 out_cnt
= out_cnt_new
;
4858 out_info
= out_info_new
;
4860 folder_mtime
= outfile_check_stat
.st_mtime
;
4863 for (int j
= 0; j
< out_cnt
; j
++)
4865 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4869 //hc_thread_mutex_lock (mux_display);
4872 struct stat outfile_stat
;
4874 fstat (fileno (fp
), &outfile_stat
);
4878 struct stat64 outfile_stat
;
4880 _fstat64 (fileno (fp
), &outfile_stat
);
4883 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4885 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4886 out_info
[j
].seek
= 0;
4889 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4891 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4895 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4897 if (ptr
== NULL
) break;
4899 int line_len
= strlen (line_buf
);
4901 if (line_len
<= 0) continue;
4903 int iter
= MAX_CUT_TRIES
;
4905 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4907 if (line_buf
[i
] != separator
) continue;
4909 int parser_status
= PARSER_OK
;
4911 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4913 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4918 if (parser_status
== PARSER_OK
)
4920 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4922 if (data
.salts_shown
[salt_pos
] == 1) continue;
4924 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4926 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4928 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4930 if (data
.digests_shown
[idx
] == 1) continue;
4934 if (hash_mode
== 6800)
4936 if (i
== salt_buf
->salt_len
)
4938 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4941 else if (hash_mode
== 2500)
4943 // BSSID : MAC1 : MAC2 (:plain)
4944 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4946 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4948 if (!cracked
) continue;
4950 // now compare MAC1 and MAC2 too, since we have this additional info
4951 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4952 char *mac2_pos
= mac1_pos
+ 12 + 1;
4954 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4955 wpa_t
*wpa
= &wpas
[salt_pos
];
4957 // compare hex string(s) vs binary MAC address(es)
4959 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4961 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4970 if (!cracked
) continue;
4972 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4974 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4985 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4987 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4989 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4996 data
.digests_shown
[idx
] = 1;
4998 data
.digests_done
++;
5000 salt_buf
->digests_done
++;
5002 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
5004 data
.salts_shown
[salt_pos
] = 1;
5008 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
5013 if (data
.devices_status
== STATUS_CRACKED
) break;
5019 if (data
.devices_status
== STATUS_CRACKED
) break;
5024 if (data
.devices_status
== STATUS_CRACKED
) break;
5029 out_info
[j
].seek
= ftell (fp
);
5031 //hc_thread_mutex_unlock (mux_display);
5039 check_left
= outfile_check_timer
;
5043 if (esalt_size
) local_free (hash_buf
.esalt
);
5045 if (isSalted
) local_free (hash_buf
.salt
);
5047 local_free (hash_buf
.digest
);
5049 local_free (out_info
);
5051 local_free (out_files
);
5058 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
5060 //if (device_param->pws_cnt < device_param->kernel_power)
5062 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
5064 u8
*ptr
= (u8
*) pw
->i
;
5066 memcpy (ptr
, pw_buf
, pw_len
);
5068 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
5070 pw
->pw_len
= pw_len
;
5072 device_param
->pws_cnt
++;
5076 // fprintf (stderr, "BUG pw_add()!!\n");
5082 static void set_kernel_power_final (const u64 kernel_power_final
)
5084 if (data
.quiet
== 0)
5090 log_info ("INFO: approaching final keyspace, workload adjusted");
5093 fprintf (stdout
, "%s", PROMPT
);
5098 data
.kernel_power_final
= kernel_power_final
;
5101 static u32
get_power (hc_device_param_t
*device_param
)
5103 const u64 kernel_power_final
= data
.kernel_power_final
;
5105 if (kernel_power_final
)
5107 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
5109 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
5111 // work should be at least the hardware power available without any accelerator
5113 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
5118 return device_param
->kernel_power
;
5121 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
5123 hc_thread_mutex_lock (mux_dispatcher
);
5125 const u64 words_cur
= data
.words_cur
;
5126 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
5128 device_param
->words_off
= words_cur
;
5130 const u64 kernel_power_all
= data
.kernel_power_all
;
5132 const u64 words_left
= words_base
- words_cur
;
5134 if (words_left
< kernel_power_all
)
5136 if (data
.kernel_power_final
== 0)
5138 set_kernel_power_final (words_left
);
5142 const u32 kernel_power
= get_power (device_param
);
5144 uint work
= MIN (words_left
, kernel_power
);
5146 work
= MIN (work
, max
);
5148 data
.words_cur
+= work
;
5150 hc_thread_mutex_unlock (mux_dispatcher
);
5155 static void *thread_autotune (void *p
)
5157 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5159 if (device_param
->skipped
) return NULL
;
5161 autotune (device_param
);
5166 static void *thread_calc_stdin (void *p
)
5168 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5170 if (device_param
->skipped
) return NULL
;
5172 char *buf
= (char *) mymalloc (HCBUFSIZ
);
5174 const uint attack_kern
= data
.attack_kern
;
5176 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5178 hc_thread_mutex_lock (mux_dispatcher
);
5180 if (feof (stdin
) != 0)
5182 hc_thread_mutex_unlock (mux_dispatcher
);
5189 while (words_cur
< device_param
->kernel_power
)
5191 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
5193 if (line_buf
== NULL
) break;
5195 uint line_len
= in_superchop (line_buf
);
5197 line_len
= convert_from_hex (line_buf
, line_len
);
5199 // post-process rule engine
5201 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5203 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5205 int rule_len_out
= -1;
5207 if (line_len
< BLOCK_SIZE
)
5209 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5212 if (rule_len_out
< 0) continue;
5214 line_buf
= rule_buf_out
;
5215 line_len
= rule_len_out
;
5218 if (line_len
> PW_MAX
)
5223 // hmm that's always the case, or?
5225 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5227 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5229 hc_thread_mutex_lock (mux_counter
);
5231 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5233 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5236 hc_thread_mutex_unlock (mux_counter
);
5242 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5246 if (data
.devices_status
== STATUS_CRACKED
) break;
5247 if (data
.devices_status
== STATUS_ABORTED
) break;
5248 if (data
.devices_status
== STATUS_QUIT
) break;
5249 if (data
.devices_status
== STATUS_BYPASS
) break;
5252 hc_thread_mutex_unlock (mux_dispatcher
);
5254 if (data
.devices_status
== STATUS_CRACKED
) break;
5255 if (data
.devices_status
== STATUS_ABORTED
) break;
5256 if (data
.devices_status
== STATUS_QUIT
) break;
5257 if (data
.devices_status
== STATUS_BYPASS
) break;
5261 const uint pws_cnt
= device_param
->pws_cnt
;
5265 run_copy (device_param
, pws_cnt
);
5267 run_cracker (device_param
, pws_cnt
);
5269 device_param
->pws_cnt
= 0;
5273 if (attack_kern == ATTACK_KERN_STRAIGHT)
5275 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5277 else if (attack_kern == ATTACK_KERN_COMBI)
5279 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5285 device_param
->kernel_accel
= 0;
5286 device_param
->kernel_loops
= 0;
5293 static void *thread_calc (void *p
)
5295 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5297 if (device_param
->skipped
) return NULL
;
5299 const uint attack_mode
= data
.attack_mode
;
5300 const uint attack_kern
= data
.attack_kern
;
5302 if (attack_mode
== ATTACK_MODE_BF
)
5304 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5306 const uint work
= get_work (device_param
, -1);
5308 if (work
== 0) break;
5310 const u64 words_off
= device_param
->words_off
;
5311 const u64 words_fin
= words_off
+ work
;
5313 const uint pws_cnt
= work
;
5315 device_param
->pws_cnt
= pws_cnt
;
5319 run_copy (device_param
, pws_cnt
);
5321 run_cracker (device_param
, pws_cnt
);
5323 device_param
->pws_cnt
= 0;
5327 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
5331 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5333 if (data
.devices_status
== STATUS_CRACKED
) break;
5334 if (data
.devices_status
== STATUS_ABORTED
) break;
5335 if (data
.devices_status
== STATUS_QUIT
) break;
5336 if (data
.devices_status
== STATUS_BYPASS
) break;
5338 if (data
.benchmark
== 1) break;
5340 device_param
->words_done
= words_fin
;
5345 const uint segment_size
= data
.segment_size
;
5347 char *dictfile
= data
.dictfile
;
5349 if (attack_mode
== ATTACK_MODE_COMBI
)
5351 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5353 dictfile
= data
.dictfile2
;
5357 FILE *fd
= fopen (dictfile
, "rb");
5361 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5366 if (attack_mode
== ATTACK_MODE_COMBI
)
5368 const uint combs_mode
= data
.combs_mode
;
5370 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5372 const char *dictfilec
= data
.dictfile2
;
5374 FILE *combs_fp
= fopen (dictfilec
, "rb");
5376 if (combs_fp
== NULL
)
5378 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5385 device_param
->combs_fp
= combs_fp
;
5387 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5389 const char *dictfilec
= data
.dictfile
;
5391 FILE *combs_fp
= fopen (dictfilec
, "rb");
5393 if (combs_fp
== NULL
)
5395 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5402 device_param
->combs_fp
= combs_fp
;
5406 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5408 wl_data
->buf
= (char *) mymalloc (segment_size
);
5409 wl_data
->avail
= segment_size
;
5410 wl_data
->incr
= segment_size
;
5416 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5425 const uint work
= get_work (device_param
, max
);
5427 if (work
== 0) break;
5431 words_off
= device_param
->words_off
;
5432 words_fin
= words_off
+ work
;
5437 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5439 for ( ; words_cur
< words_fin
; words_cur
++)
5441 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5443 line_len
= convert_from_hex (line_buf
, line_len
);
5445 // post-process rule engine
5447 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5449 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5451 int rule_len_out
= -1;
5453 if (line_len
< BLOCK_SIZE
)
5455 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5458 if (rule_len_out
< 0) continue;
5460 line_buf
= rule_buf_out
;
5461 line_len
= rule_len_out
;
5464 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5466 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5470 hc_thread_mutex_lock (mux_counter
);
5472 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5474 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5477 hc_thread_mutex_unlock (mux_counter
);
5482 else if (attack_kern
== ATTACK_KERN_COMBI
)
5484 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5485 // since we still need to combine the plains
5487 if (line_len
> data
.pw_max
)
5491 hc_thread_mutex_lock (mux_counter
);
5493 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5495 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5498 hc_thread_mutex_unlock (mux_counter
);
5504 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5506 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5508 if (data
.devices_status
== STATUS_CRACKED
) break;
5509 if (data
.devices_status
== STATUS_ABORTED
) break;
5510 if (data
.devices_status
== STATUS_QUIT
) break;
5511 if (data
.devices_status
== STATUS_BYPASS
) break;
5514 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5516 if (data
.devices_status
== STATUS_CRACKED
) break;
5517 if (data
.devices_status
== STATUS_ABORTED
) break;
5518 if (data
.devices_status
== STATUS_QUIT
) break;
5519 if (data
.devices_status
== STATUS_BYPASS
) break;
5522 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5524 if (data
.devices_status
== STATUS_CRACKED
) break;
5525 if (data
.devices_status
== STATUS_ABORTED
) break;
5526 if (data
.devices_status
== STATUS_QUIT
) break;
5527 if (data
.devices_status
== STATUS_BYPASS
) break;
5533 const uint pws_cnt
= device_param
->pws_cnt
;
5537 run_copy (device_param
, pws_cnt
);
5539 run_cracker (device_param
, pws_cnt
);
5541 device_param
->pws_cnt
= 0;
5545 if (attack_kern == ATTACK_KERN_STRAIGHT)
5547 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5549 else if (attack_kern == ATTACK_KERN_COMBI)
5551 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5556 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5558 if (data
.devices_status
== STATUS_CRACKED
) break;
5559 if (data
.devices_status
== STATUS_ABORTED
) break;
5560 if (data
.devices_status
== STATUS_QUIT
) break;
5561 if (data
.devices_status
== STATUS_BYPASS
) break;
5563 if (words_fin
== 0) break;
5565 device_param
->words_done
= words_fin
;
5568 if (attack_mode
== ATTACK_MODE_COMBI
)
5570 fclose (device_param
->combs_fp
);
5573 free (wl_data
->buf
);
5579 device_param
->kernel_accel
= 0;
5580 device_param
->kernel_loops
= 0;
5585 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5589 log_error ("ERROR: %s : Invalid argument", __func__
);
5594 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5596 device_param
->kernel_params_buf32
[27] = salt_pos
;
5597 device_param
->kernel_params_buf32
[30] = 1;
5598 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5599 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5600 device_param
->kernel_params_buf32
[33] = 0;
5601 device_param
->kernel_params_buf32
[34] = 1;
5603 char *dictfile_old
= data
.dictfile
;
5605 const char *weak_hash_check
= "weak-hash-check";
5607 data
.dictfile
= (char *) weak_hash_check
;
5609 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5611 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5617 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5619 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5623 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5625 uint loop_step
= 16;
5627 const uint iter
= salt_buf
->salt_iter
;
5629 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5631 uint loop_left
= iter
- loop_pos
;
5633 loop_left
= MIN (loop_left
, loop_step
);
5635 device_param
->kernel_params_buf32
[28] = loop_pos
;
5636 device_param
->kernel_params_buf32
[29] = loop_left
;
5638 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5641 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5648 check_cracked (device_param
, salt_pos
);
5654 device_param
->kernel_params_buf32
[27] = 0;
5655 device_param
->kernel_params_buf32
[28] = 0;
5656 device_param
->kernel_params_buf32
[29] = 0;
5657 device_param
->kernel_params_buf32
[30] = 0;
5658 device_param
->kernel_params_buf32
[31] = 0;
5659 device_param
->kernel_params_buf32
[32] = 0;
5660 device_param
->kernel_params_buf32
[33] = 0;
5661 device_param
->kernel_params_buf32
[34] = 0;
5663 data
.dictfile
= dictfile_old
;
5665 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5670 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5672 if (data
.username
== 0)
5674 *hashbuf_pos
= line_buf
;
5675 *hashbuf_len
= line_len
;
5679 char *pos
= line_buf
;
5682 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5684 if (line_buf
[i
] == data
.separator
)
5699 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5706 for (int i
= 0; i
< line_len
; i
++)
5708 if (line_buf
[i
] == data
.separator
)
5717 if (pos
== NULL
) pos
= line_buf
+ i
;
5729 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5736 for (int i
= 0; i
< line_len
; i
++)
5738 if (line_buf
[i
] == ':')
5745 if (sep_cnt
== 2) sep2_len
++;
5746 if (sep_cnt
== 3) sep3_len
++;
5749 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5754 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5761 for (int i
= 0; i
< line_len
; i
++)
5763 if (line_buf
[i
] == ':')
5770 if (data
.hash_mode
== 1000)
5774 if (pos
== NULL
) pos
= line_buf
+ i
;
5779 else if (data
.hash_mode
== 3000)
5783 if (pos
== NULL
) pos
= line_buf
+ i
;
5794 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5801 for (int i
= 0; i
< line_len
; i
++)
5803 if (line_buf
[i
] == ':')
5812 if (pos
== NULL
) pos
= line_buf
+ i
;
5824 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5828 char sep5_first
= 0;
5829 char sep6_first
= 0;
5831 for (int i
= 0; i
< line_len
; i
++)
5833 if (line_buf
[i
] == ':')
5840 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5841 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5844 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5849 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5856 for (int i
= 0; i
< line_len
; i
++)
5858 if (line_buf
[i
] == ':')
5867 if (pos
== NULL
) pos
= line_buf
+ i
;
5877 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5884 for (int i
= 0; i
< line_len
; i
++)
5886 if (line_buf
[i
] == ':')
5895 if (pos
== NULL
) pos
= line_buf
+ i
;
5907 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5911 for (int i
= 0; i
< line_len
; i
++)
5913 if (line_buf
[i
] == ':') sep_cnt
++;
5916 if (sep_cnt
== 8) return 1;
5921 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5923 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5926 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5928 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5933 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5935 switch (hashfile_format
)
5937 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5938 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5939 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5940 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5944 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5946 switch (hashfile_format
)
5948 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5949 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5950 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5951 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5955 char *strhlfmt (const uint hashfile_format
)
5957 switch (hashfile_format
)
5959 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5960 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5961 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5962 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5963 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5964 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5965 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5966 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5967 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5968 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5971 return ((char *) "Unknown");
5974 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5976 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5978 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5979 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5981 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5985 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5989 int line_len
= fgetl (fp
, line_buf
);
5991 if (line_len
== 0) continue;
5993 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5994 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5995 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5997 if (num_check
== max_check
) break;
6004 uint hashlist_format
= HLFMT_HASHCAT
;
6006 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
6008 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
6010 hashlist_format
= i
;
6015 return hashlist_format
;
6019 * some further helper function
6022 // wrapper around mymalloc for ADL
6024 #if defined(HAVE_HWMON)
6025 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
6027 return mymalloc (iSize
);
6031 static uint
generate_bitmaps (const uint digests_cnt
, const uint dgst_size
, const uint dgst_shifts
, char *digests_buf_ptr
, const uint bitmap_mask
, const uint bitmap_size
, uint
*bitmap_a
, uint
*bitmap_b
, uint
*bitmap_c
, uint
*bitmap_d
, const u64 collisions_max
)
6035 const uint dgst_pos0
= data
.dgst_pos0
;
6036 const uint dgst_pos1
= data
.dgst_pos1
;
6037 const uint dgst_pos2
= data
.dgst_pos2
;
6038 const uint dgst_pos3
= data
.dgst_pos3
;
6040 memset (bitmap_a
, 0, bitmap_size
);
6041 memset (bitmap_b
, 0, bitmap_size
);
6042 memset (bitmap_c
, 0, bitmap_size
);
6043 memset (bitmap_d
, 0, bitmap_size
);
6045 for (uint i
= 0; i
< digests_cnt
; i
++)
6047 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
6049 digests_buf_ptr
+= dgst_size
;
6051 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
6052 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
6053 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
6054 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
6056 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
6057 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
6058 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
6059 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
6061 if (bitmap_a
[idx0
] & val0
) collisions
++;
6062 if (bitmap_b
[idx1
] & val1
) collisions
++;
6063 if (bitmap_c
[idx2
] & val2
) collisions
++;
6064 if (bitmap_d
[idx3
] & val3
) collisions
++;
6066 bitmap_a
[idx0
] |= val0
;
6067 bitmap_b
[idx1
] |= val1
;
6068 bitmap_c
[idx2
] |= val2
;
6069 bitmap_d
[idx3
] |= val3
;
6071 if (collisions
>= collisions_max
) return 0x7fffffff;
6082 void SetConsoleWindowSize (const int x
)
6084 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
6086 if (h
== INVALID_HANDLE_VALUE
) return;
6088 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
6090 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
6092 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
6094 sr
->Right
= MAX (sr
->Right
, x
- 1);
6098 co
.X
= sr
->Right
+ 1;
6101 if (!SetConsoleScreenBufferSize (h
, co
)) return;
6103 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
6107 int main (int argc
, char **argv
)
6110 SetConsoleWindowSize (132);
6114 * To help users a bit
6117 char *compute
= getenv ("COMPUTE");
6121 static char display
[100];
6123 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
6129 if (getenv ("DISPLAY") == NULL
)
6130 putenv ((char *) "DISPLAY=:0");
6133 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
6134 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
6136 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
6137 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
6139 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
6140 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
6142 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
6143 putenv ((char *) "CUDA_CACHE_DISABLE=1");
6145 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
6146 putenv ((char *) "POCL_KERNEL_CACHE=0");
6151 * There's some buggy OpenCL runtime that do not support -I.
6152 * A workaround is to chdir() to the OpenCL folder,
6153 * then compile the kernels,
6154 * then chdir() back to where we came from so we need to save it first
6159 if (getcwd (cwd
, sizeof (cwd
) - 1) == NULL
)
6161 log_error ("ERROR: getcwd(): %s", strerror (errno
));
6170 memset (&data
, 0, sizeof (hc_global_data_t
));
6176 data
.proc_start
= proc_start
;
6179 char **myargv
= argv
;
6181 hc_thread_mutex_init (mux_dispatcher
);
6182 hc_thread_mutex_init (mux_counter
);
6183 hc_thread_mutex_init (mux_display
);
6184 hc_thread_mutex_init (mux_adl
);
6187 * commandline parameters
6191 uint version
= VERSION
;
6193 uint benchmark
= BENCHMARK
;
6194 uint stdout_flag
= STDOUT_FLAG
;
6197 uint username
= USERNAME
;
6198 uint remove
= REMOVE
;
6199 uint remove_timer
= REMOVE_TIMER
;
6202 uint keyspace
= KEYSPACE
;
6203 uint potfile_disable
= POTFILE_DISABLE
;
6204 char *potfile_path
= NULL
;
6205 uint debug_mode
= DEBUG_MODE
;
6206 char *debug_file
= NULL
;
6207 char *induction_dir
= NULL
;
6208 char *outfile_check_dir
= NULL
;
6210 uint runtime
= RUNTIME
;
6211 uint hash_mode
= HASH_MODE
;
6212 uint attack_mode
= ATTACK_MODE
;
6213 uint markov_disable
= MARKOV_DISABLE
;
6214 uint markov_classic
= MARKOV_CLASSIC
;
6215 uint markov_threshold
= MARKOV_THRESHOLD
;
6216 char *markov_hcstat
= NULL
;
6217 char *outfile
= NULL
;
6218 uint outfile_format
= OUTFILE_FORMAT
;
6219 uint outfile_autohex
= OUTFILE_AUTOHEX
;
6220 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
6221 uint restore
= RESTORE
;
6222 uint restore_timer
= RESTORE_TIMER
;
6223 uint restore_disable
= RESTORE_DISABLE
;
6224 uint status
= STATUS
;
6225 uint status_timer
= STATUS_TIMER
;
6226 uint machine_readable
= MACHINE_READABLE
;
6227 uint loopback
= LOOPBACK
;
6228 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
6229 char *session
= NULL
;
6230 uint hex_charset
= HEX_CHARSET
;
6231 uint hex_salt
= HEX_SALT
;
6232 uint hex_wordlist
= HEX_WORDLIST
;
6233 uint rp_gen
= RP_GEN
;
6234 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
6235 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
6236 uint rp_gen_seed
= RP_GEN_SEED
;
6237 char *rule_buf_l
= (char *) RULE_BUF_L
;
6238 char *rule_buf_r
= (char *) RULE_BUF_R
;
6239 uint increment
= INCREMENT
;
6240 uint increment_min
= INCREMENT_MIN
;
6241 uint increment_max
= INCREMENT_MAX
;
6242 char *cpu_affinity
= NULL
;
6243 OCL_PTR
*ocl
= NULL
;
6244 char *opencl_devices
= NULL
;
6245 char *opencl_platforms
= NULL
;
6246 char *opencl_device_types
= NULL
;
6247 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
6248 char *truecrypt_keyfiles
= NULL
;
6249 char *veracrypt_keyfiles
= NULL
;
6250 uint veracrypt_pim
= 0;
6251 uint workload_profile
= WORKLOAD_PROFILE
;
6252 uint kernel_accel
= KERNEL_ACCEL
;
6253 uint kernel_loops
= KERNEL_LOOPS
;
6254 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
6255 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
6257 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
6258 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
6259 uint powertune_enable
= POWERTUNE_ENABLE
;
6261 uint logfile_disable
= LOGFILE_DISABLE
;
6262 uint segment_size
= SEGMENT_SIZE
;
6263 uint scrypt_tmto
= SCRYPT_TMTO
;
6264 char separator
= SEPARATOR
;
6265 uint bitmap_min
= BITMAP_MIN
;
6266 uint bitmap_max
= BITMAP_MAX
;
6267 char *custom_charset_1
= NULL
;
6268 char *custom_charset_2
= NULL
;
6269 char *custom_charset_3
= NULL
;
6270 char *custom_charset_4
= NULL
;
6272 #define IDX_HELP 'h'
6273 #define IDX_VERSION 'V'
6274 #define IDX_VERSION_LOWER 'v'
6275 #define IDX_QUIET 0xff02
6276 #define IDX_SHOW 0xff03
6277 #define IDX_LEFT 0xff04
6278 #define IDX_REMOVE 0xff05
6279 #define IDX_REMOVE_TIMER 0xff37
6280 #define IDX_SKIP 's'
6281 #define IDX_LIMIT 'l'
6282 #define IDX_KEYSPACE 0xff35
6283 #define IDX_POTFILE_DISABLE 0xff06
6284 #define IDX_POTFILE_PATH 0xffe0
6285 #define IDX_DEBUG_MODE 0xff43
6286 #define IDX_DEBUG_FILE 0xff44
6287 #define IDX_INDUCTION_DIR 0xff46
6288 #define IDX_OUTFILE_CHECK_DIR 0xff47
6289 #define IDX_USERNAME 0xff07
6290 #define IDX_FORCE 0xff08
6291 #define IDX_RUNTIME 0xff09
6292 #define IDX_BENCHMARK 'b'
6293 #define IDX_STDOUT_FLAG 0xff77
6294 #define IDX_HASH_MODE 'm'
6295 #define IDX_ATTACK_MODE 'a'
6296 #define IDX_RP_FILE 'r'
6297 #define IDX_RP_GEN 'g'
6298 #define IDX_RP_GEN_FUNC_MIN 0xff10
6299 #define IDX_RP_GEN_FUNC_MAX 0xff11
6300 #define IDX_RP_GEN_SEED 0xff34
6301 #define IDX_RULE_BUF_L 'j'
6302 #define IDX_RULE_BUF_R 'k'
6303 #define IDX_INCREMENT 'i'
6304 #define IDX_INCREMENT_MIN 0xff12
6305 #define IDX_INCREMENT_MAX 0xff13
6306 #define IDX_OUTFILE 'o'
6307 #define IDX_OUTFILE_FORMAT 0xff14
6308 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
6309 #define IDX_OUTFILE_CHECK_TIMER 0xff45
6310 #define IDX_RESTORE 0xff15
6311 #define IDX_RESTORE_DISABLE 0xff27
6312 #define IDX_STATUS 0xff17
6313 #define IDX_STATUS_TIMER 0xff18
6314 #define IDX_MACHINE_READABLE 0xff50
6315 #define IDX_LOOPBACK 0xff38
6316 #define IDX_WEAK_HASH_THRESHOLD 0xff42
6317 #define IDX_SESSION 0xff19
6318 #define IDX_HEX_CHARSET 0xff20
6319 #define IDX_HEX_SALT 0xff21
6320 #define IDX_HEX_WORDLIST 0xff40
6321 #define IDX_MARKOV_DISABLE 0xff22
6322 #define IDX_MARKOV_CLASSIC 0xff23
6323 #define IDX_MARKOV_THRESHOLD 't'
6324 #define IDX_MARKOV_HCSTAT 0xff24
6325 #define IDX_CPU_AFFINITY 0xff25
6326 #define IDX_OPENCL_DEVICES 'd'
6327 #define IDX_OPENCL_PLATFORMS 0xff72
6328 #define IDX_OPENCL_DEVICE_TYPES 'D'
6329 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
6330 #define IDX_WORKLOAD_PROFILE 'w'
6331 #define IDX_KERNEL_ACCEL 'n'
6332 #define IDX_KERNEL_LOOPS 'u'
6333 #define IDX_NVIDIA_SPIN_DAMP 0xff79
6334 #define IDX_GPU_TEMP_DISABLE 0xff29
6335 #define IDX_GPU_TEMP_ABORT 0xff30
6336 #define IDX_GPU_TEMP_RETAIN 0xff31
6337 #define IDX_POWERTUNE_ENABLE 0xff41
6338 #define IDX_LOGFILE_DISABLE 0xff51
6339 #define IDX_TRUECRYPT_KEYFILES 0xff52
6340 #define IDX_VERACRYPT_KEYFILES 0xff53
6341 #define IDX_VERACRYPT_PIM 0xff54
6342 #define IDX_SCRYPT_TMTO 0xff61
6343 #define IDX_SEGMENT_SIZE 'c'
6344 #define IDX_SEPARATOR 'p'
6345 #define IDX_BITMAP_MIN 0xff70
6346 #define IDX_BITMAP_MAX 0xff71
6347 #define IDX_CUSTOM_CHARSET_1 '1'
6348 #define IDX_CUSTOM_CHARSET_2 '2'
6349 #define IDX_CUSTOM_CHARSET_3 '3'
6350 #define IDX_CUSTOM_CHARSET_4 '4'
6352 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
6354 struct option long_options
[] =
6356 {"help", no_argument
, 0, IDX_HELP
},
6357 {"version", no_argument
, 0, IDX_VERSION
},
6358 {"quiet", no_argument
, 0, IDX_QUIET
},
6359 {"show", no_argument
, 0, IDX_SHOW
},
6360 {"left", no_argument
, 0, IDX_LEFT
},
6361 {"username", no_argument
, 0, IDX_USERNAME
},
6362 {"remove", no_argument
, 0, IDX_REMOVE
},
6363 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
6364 {"skip", required_argument
, 0, IDX_SKIP
},
6365 {"limit", required_argument
, 0, IDX_LIMIT
},
6366 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6367 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6368 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6369 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6370 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6371 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6372 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6373 {"force", no_argument
, 0, IDX_FORCE
},
6374 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6375 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6376 {"restore", no_argument
, 0, IDX_RESTORE
},
6377 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6378 {"status", no_argument
, 0, IDX_STATUS
},
6379 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6380 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6381 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6382 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6383 {"session", required_argument
, 0, IDX_SESSION
},
6384 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6385 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6386 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6387 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6388 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6389 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6390 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6391 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6392 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6393 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6394 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6395 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6396 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6397 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6398 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6399 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6400 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6401 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6402 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6403 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6404 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6405 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6406 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6407 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6408 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6409 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6410 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6411 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6412 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6413 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6414 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6416 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6417 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6418 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6419 #endif // HAVE_HWMON
6420 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6421 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6422 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6423 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6424 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6425 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6426 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6427 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6428 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6429 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6430 {"increment", no_argument
, 0, IDX_INCREMENT
},
6431 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6432 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6433 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6434 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6435 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6436 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6440 uint rp_files_cnt
= 0;
6442 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6444 int option_index
= 0;
6450 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6454 case IDX_HELP
: usage
= 1; break;
6456 case IDX_VERSION_LOWER
: version
= 1; break;
6457 case IDX_RESTORE
: restore
= 1; break;
6458 case IDX_SESSION
: session
= optarg
; break;
6459 case IDX_SHOW
: show
= 1; break;
6460 case IDX_LEFT
: left
= 1; break;
6461 case '?': return -1;
6467 log_error ("ERROR: Invalid argument specified");
6478 log_info ("%s", VERSION_TAG
);
6485 usage_big_print (PROGNAME
);
6491 * session needs to be set, always!
6494 if (session
== NULL
) session
= (char *) PROGNAME
;
6497 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6500 char *exec_path
= get_exec_path ();
6503 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
6505 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6506 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6508 if (resolved_install_folder
== NULL
)
6510 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6515 if (resolved_exec_path
== NULL
)
6517 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6522 char *install_dir
= get_install_dir (resolved_exec_path
);
6523 char *profile_dir
= NULL
;
6524 char *session_dir
= NULL
;
6525 char *shared_dir
= NULL
;
6527 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6529 struct passwd
*pw
= getpwuid (getuid ());
6531 const char *homedir
= pw
->pw_dir
;
6533 profile_dir
= get_profile_dir (homedir
);
6534 session_dir
= get_session_dir (profile_dir
);
6535 shared_dir
= strdup (SHARED_FOLDER
);
6537 mkdir (profile_dir
, 0700);
6538 mkdir (session_dir
, 0700);
6542 profile_dir
= install_dir
;
6543 session_dir
= install_dir
;
6544 shared_dir
= install_dir
;
6547 myfree (resolved_install_folder
);
6548 myfree (resolved_exec_path
);
6552 char *install_dir
= get_install_dir (exec_path
);
6553 char *profile_dir
= install_dir
;
6554 char *session_dir
= install_dir
;
6555 char *shared_dir
= install_dir
;
6559 data
.install_dir
= install_dir
;
6560 data
.profile_dir
= profile_dir
;
6561 data
.session_dir
= session_dir
;
6562 data
.shared_dir
= shared_dir
;
6567 * There's alot of problem related to bad support -I parameters when building the kernel.
6568 * Each OpenCL runtime handles it slightly different.
6569 * The most problematic is with new AMD drivers on Windows, which can not handle quote characters!
6570 * The best workaround found so far is to modify the TMP variable (only inside hashcat process) before the runtime is load
6573 char cpath
[1024] = { 0 };
6577 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
6579 char *cpath_real
= mymalloc (MAX_PATH
);
6581 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
6583 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
6590 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
6592 char *cpath_real
= mymalloc (PATH_MAX
);
6594 if (realpath (cpath
, cpath_real
) == NULL
)
6596 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
6603 //if (getenv ("TMP") == NULL)
6608 snprintf (tmp
, sizeof (tmp
) - 1, "TMP=%s", cpath_real
);
6615 naive_replace (cpath_real
, '\\', '/');
6617 // not escaping here, windows using quotes later
6618 // naive_escape (cpath_real, PATH_MAX, ' ', '\\');
6622 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
6627 * kernel cache, we need to make sure folder exist
6630 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6632 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6634 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6636 mkdir (kernels_folder
, 0700);
6638 myfree (kernels_folder
);
6644 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6646 data
.session
= session
;
6648 char *eff_restore_file
= (char *) mymalloc (session_size
);
6649 char *new_restore_file
= (char *) mymalloc (session_size
);
6651 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6652 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6654 data
.eff_restore_file
= eff_restore_file
;
6655 data
.new_restore_file
= new_restore_file
;
6657 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6659 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6660 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6665 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6666 if ((show
== 1) || (left
== 1))
6668 restore_disable
= 1;
6673 data
.restore_disable
= restore_disable
;
6675 restore_data_t
*rd
= init_restore (argc
, argv
);
6685 read_restore (eff_restore_file
, rd
);
6687 if (rd
->version_bin
< RESTORE_MIN
)
6689 log_error ("ERROR: Incompatible restore-file version");
6698 rd
->pid
= getpid ();
6700 rd
->pid
= GetCurrentProcessId ();
6704 uint hash_mode_chgd
= 0;
6705 uint runtime_chgd
= 0;
6706 uint kernel_loops_chgd
= 0;
6707 uint kernel_accel_chgd
= 0;
6708 uint nvidia_spin_damp_chgd
= 0;
6709 uint attack_mode_chgd
= 0;
6710 uint outfile_format_chgd
= 0;
6711 uint rp_gen_seed_chgd
= 0;
6712 uint remove_timer_chgd
= 0;
6713 uint increment_min_chgd
= 0;
6714 uint increment_max_chgd
= 0;
6715 uint workload_profile_chgd
= 0;
6716 uint opencl_vector_width_chgd
= 0;
6722 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6726 //case IDX_HELP: usage = 1; break;
6727 //case IDX_VERSION: version = 1; break;
6728 //case IDX_RESTORE: restore = 1; break;
6729 case IDX_QUIET
: quiet
= 1; break;
6730 //case IDX_SHOW: show = 1; break;
6731 case IDX_SHOW
: break;
6732 //case IDX_LEFT: left = 1; break;
6733 case IDX_LEFT
: break;
6734 case IDX_USERNAME
: username
= 1; break;
6735 case IDX_REMOVE
: remove
= 1; break;
6736 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6737 remove_timer_chgd
= 1; break;
6738 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6739 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6740 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6741 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6742 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6743 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6744 case IDX_FORCE
: force
= 1; break;
6745 case IDX_SKIP
: skip
= atoll (optarg
); break;
6746 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6747 case IDX_KEYSPACE
: keyspace
= 1; break;
6748 case IDX_BENCHMARK
: benchmark
= 1; break;
6749 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6750 case IDX_RESTORE
: break;
6751 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6752 case IDX_STATUS
: status
= 1; break;
6753 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6754 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6755 case IDX_LOOPBACK
: loopback
= 1; break;
6756 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6757 //case IDX_SESSION: session = optarg; break;
6758 case IDX_SESSION
: break;
6759 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6760 hash_mode_chgd
= 1; break;
6761 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6762 runtime_chgd
= 1; break;
6763 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6764 attack_mode_chgd
= 1; break;
6765 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6766 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6767 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6768 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6769 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6770 rp_gen_seed_chgd
= 1; break;
6771 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6772 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6773 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6774 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6775 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6776 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6777 case IDX_OUTFILE
: outfile
= optarg
; break;
6778 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6779 outfile_format_chgd
= 1; break;
6780 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6781 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6782 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6783 case IDX_HEX_SALT
: hex_salt
= 1; break;
6784 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6785 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6786 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6787 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6788 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6789 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6790 opencl_vector_width_chgd
= 1; break;
6791 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6792 workload_profile_chgd
= 1; break;
6793 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6794 kernel_accel_chgd
= 1; break;
6795 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6796 kernel_loops_chgd
= 1; break;
6797 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6798 nvidia_spin_damp_chgd
= 1; break;
6799 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6801 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6802 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6803 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6804 #endif // HAVE_HWMON
6805 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6806 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6807 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6808 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6809 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6810 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6811 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6812 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6813 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6814 case IDX_INCREMENT
: increment
= 1; break;
6815 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6816 increment_min_chgd
= 1; break;
6817 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6818 increment_max_chgd
= 1; break;
6819 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6820 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6821 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6822 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6825 log_error ("ERROR: Invalid argument specified");
6832 log_error ("ERROR: Invalid argument specified");
6838 * Inform user things getting started,
6839 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6840 * - we do not need to check algorithm_pos
6847 if (machine_readable
== 0)
6849 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6854 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6857 else if (restore
== 1)
6859 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6862 else if (stdout_flag
== 1)
6866 else if (keyspace
== 1)
6872 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6881 if (attack_mode
> 7)
6883 log_error ("ERROR: Invalid attack-mode specified");
6888 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6890 log_error ("ERROR: Invalid runtime specified");
6895 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6897 log_error ("ERROR: Invalid hash-type specified");
6902 // renamed hash modes
6916 log_error ("Old -m specified, use -m %d instead", n
);
6924 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6926 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6932 if (outfile_format
> 16)
6934 log_error ("ERROR: Invalid outfile-format specified");
6941 if (outfile_format_chgd
== 1)
6943 if (outfile_format
> 1)
6945 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6952 outfile_format
= OUTFILE_FMT_HASH
;
6958 if (outfile_format_chgd
== 1)
6960 if ((outfile_format
> 7) && (outfile_format
< 16))
6962 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6969 if (increment_min
< INCREMENT_MIN
)
6971 log_error ("ERROR: Invalid increment-min specified");
6976 if (increment_max
> INCREMENT_MAX
)
6978 log_error ("ERROR: Invalid increment-max specified");
6983 if (increment_min
> increment_max
)
6985 log_error ("ERROR: Invalid increment-min specified");
6990 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6992 log_error ("ERROR: Increment is not allowed in attack-mode 0");
6997 if ((increment
== 0) && (increment_min_chgd
== 1))
6999 log_error ("ERROR: Increment-min is only supported combined with increment switch");
7004 if ((increment
== 0) && (increment_max_chgd
== 1))
7006 log_error ("ERROR: Increment-max is only supported combined with increment switch");
7011 if (rp_files_cnt
&& rp_gen
)
7013 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
7018 if (rp_files_cnt
|| rp_gen
)
7020 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7022 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
7028 if (rp_gen_func_min
> rp_gen_func_max
)
7030 log_error ("ERROR: Invalid rp-gen-func-min specified");
7035 if (kernel_accel_chgd
== 1)
7039 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
7040 log_info ("Please consider using the -w option instead");
7041 log_info ("You can use --force to override this but do not post error reports if you do so");
7047 if (kernel_accel
< 1)
7049 log_error ("ERROR: Invalid kernel-accel specified");
7054 if (kernel_accel
> 1024)
7056 log_error ("ERROR: Invalid kernel-accel specified");
7062 if (kernel_loops_chgd
== 1)
7066 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
7067 log_info ("Please consider using the -w option instead");
7068 log_info ("You can use --force to override this but do not post error reports if you do so");
7074 if (kernel_loops
< 1)
7076 log_error ("ERROR: Invalid kernel-loops specified");
7081 if (kernel_loops
> 1024)
7083 log_error ("ERROR: Invalid kernel-loops specified");
7089 if ((workload_profile
< 1) || (workload_profile
> 4))
7091 log_error ("ERROR: workload-profile %i not available", workload_profile
);
7096 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
7098 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
7103 if (show
== 1 || left
== 1)
7105 attack_mode
= ATTACK_MODE_NONE
;
7109 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
7114 if (potfile_disable
== 1)
7116 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
7122 uint attack_kern
= ATTACK_KERN_NONE
;
7124 switch (attack_mode
)
7126 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
7127 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
7128 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
7129 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
7130 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
7135 if (myargv
[optind
] != 0)
7137 log_error ("ERROR: Invalid argument for benchmark mode specified");
7142 if (attack_mode_chgd
== 1)
7144 if (attack_mode
!= ATTACK_MODE_BF
)
7146 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
7154 if (stdout_flag
== 1) // no hash here
7161 int num_additional_params
= 1;
7163 if (attack_kern
== ATTACK_KERN_COMBI
)
7165 num_additional_params
= 2;
7168 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
7170 if (keyspace_wordlist_specified
== 0) optind
--;
7173 if (attack_kern
== ATTACK_KERN_NONE
)
7175 if ((optind
+ 1) != myargc
)
7177 usage_mini_print (myargv
[0]);
7182 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
7184 if ((optind
+ 1) > myargc
)
7186 usage_mini_print (myargv
[0]);
7191 else if (attack_kern
== ATTACK_KERN_COMBI
)
7193 if ((optind
+ 3) != myargc
)
7195 usage_mini_print (myargv
[0]);
7200 else if (attack_kern
== ATTACK_KERN_BF
)
7202 if ((optind
+ 1) > myargc
)
7204 usage_mini_print (myargv
[0]);
7211 usage_mini_print (myargv
[0]);
7217 if (skip
!= 0 && limit
!= 0)
7226 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
7232 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
7237 potfile_disable
= 1;
7239 restore_disable
= 1;
7243 weak_hash_threshold
= 0;
7248 if (stdout_flag
== 1)
7252 restore_disable
= 1;
7254 potfile_disable
= 1;
7255 weak_hash_threshold
= 0;
7256 gpu_temp_disable
= 1;
7259 outfile_format
= OUTFILE_FMT_PLAIN
;
7260 kernel_accel
= 1024;
7261 kernel_loops
= 1024;
7263 outfile_check_timer
= 0;
7265 opencl_vector_width
= 1;
7268 if (remove_timer_chgd
== 1)
7272 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
7277 if (remove_timer
< 1)
7279 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
7287 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
7289 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7291 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
7298 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
7306 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7308 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
7313 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7315 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
7323 log_error ("ERROR: Invalid debug-mode specified");
7328 if (debug_file
!= NULL
)
7332 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
7338 if (induction_dir
!= NULL
)
7340 if (attack_mode
== ATTACK_MODE_BF
)
7342 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
7348 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7350 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
7352 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
7357 weak_hash_threshold
= 0;
7360 if (nvidia_spin_damp
> 100)
7362 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
7369 * induction directory
7372 char *induction_directory
= NULL
;
7374 if (attack_mode
!= ATTACK_MODE_BF
)
7376 if (induction_dir
== NULL
)
7378 induction_directory
= (char *) mymalloc (session_size
);
7380 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
7382 // create induction folder if it does not already exist
7386 if (rmdir (induction_directory
) == -1)
7388 if (errno
== ENOENT
)
7390 // good, we can ignore
7392 else if (errno
== ENOTEMPTY
)
7394 char *induction_directory_mv
= (char *) mymalloc (session_size
);
7396 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
7398 if (rename (induction_directory
, induction_directory_mv
) != 0)
7400 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
7407 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7413 if (mkdir (induction_directory
, 0700) == -1)
7415 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7423 induction_directory
= induction_dir
;
7427 data
.induction_directory
= induction_directory
;
7433 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7435 char *loopback_file
= (char *) mymalloc (loopback_size
);
7441 char tuning_db_file
[256] = { 0 };
7443 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7445 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7448 * outfile-check directory
7451 char *outfile_check_directory
= NULL
;
7453 if (outfile_check_dir
== NULL
)
7455 outfile_check_directory
= (char *) mymalloc (session_size
);
7457 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7461 outfile_check_directory
= outfile_check_dir
;
7464 data
.outfile_check_directory
= outfile_check_directory
;
7468 struct stat outfile_check_stat
;
7470 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7472 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7476 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7481 else if (outfile_check_dir
== NULL
)
7483 if (mkdir (outfile_check_directory
, 0700) == -1)
7485 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7493 * special other stuff
7496 if (hash_mode
== 9710)
7499 outfile_format_chgd
= 1;
7502 if (hash_mode
== 9810)
7505 outfile_format_chgd
= 1;
7508 if (hash_mode
== 10410)
7511 outfile_format_chgd
= 1;
7518 data
.hash_mode
= hash_mode
;
7519 data
.restore
= restore
;
7520 data
.restore_timer
= restore_timer
;
7521 data
.restore_disable
= restore_disable
;
7522 data
.status
= status
;
7523 data
.status_timer
= status_timer
;
7524 data
.machine_readable
= machine_readable
;
7525 data
.loopback
= loopback
;
7526 data
.runtime
= runtime
;
7527 data
.remove
= remove
;
7528 data
.remove_timer
= remove_timer
;
7529 data
.debug_mode
= debug_mode
;
7530 data
.debug_file
= debug_file
;
7531 data
.username
= username
;
7533 data
.outfile
= outfile
;
7534 data
.outfile_format
= outfile_format
;
7535 data
.outfile_autohex
= outfile_autohex
;
7536 data
.hex_charset
= hex_charset
;
7537 data
.hex_salt
= hex_salt
;
7538 data
.hex_wordlist
= hex_wordlist
;
7539 data
.separator
= separator
;
7540 data
.rp_files
= rp_files
;
7541 data
.rp_files_cnt
= rp_files_cnt
;
7542 data
.rp_gen
= rp_gen
;
7543 data
.rp_gen_seed
= rp_gen_seed
;
7545 data
.benchmark
= benchmark
;
7549 data
.powertune_enable
= powertune_enable
;
7551 data
.logfile_disable
= logfile_disable
;
7552 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7553 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7554 data
.veracrypt_pim
= veracrypt_pim
;
7555 data
.scrypt_tmto
= scrypt_tmto
;
7556 data
.workload_profile
= workload_profile
;
7564 set_cpu_affinity (cpu_affinity
);
7567 if (rp_gen_seed_chgd
== 0)
7573 srand (rp_gen_seed
);
7580 if (logfile_disable
== 0)
7582 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7584 char *logfile
= (char *) mymalloc (logfile_size
);
7586 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7588 data
.logfile
= logfile
;
7590 char *topid
= logfile_generate_topid ();
7595 // logfile_append() checks for logfile_disable internally to make it easier from here
7597 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7598 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7599 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7600 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7601 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7602 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7603 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7604 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7605 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7606 #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));
7608 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7609 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7610 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7611 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7612 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7613 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7614 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7615 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7617 logfile_top_msg ("START");
7619 logfile_top_uint (attack_mode
);
7620 logfile_top_uint (attack_kern
);
7621 logfile_top_uint (benchmark
);
7622 logfile_top_uint (stdout_flag
);
7623 logfile_top_uint (bitmap_min
);
7624 logfile_top_uint (bitmap_max
);
7625 logfile_top_uint (debug_mode
);
7626 logfile_top_uint (force
);
7627 logfile_top_uint (kernel_accel
);
7628 logfile_top_uint (kernel_loops
);
7629 logfile_top_uint (nvidia_spin_damp
);
7630 logfile_top_uint (gpu_temp_disable
);
7632 logfile_top_uint (gpu_temp_abort
);
7633 logfile_top_uint (gpu_temp_retain
);
7635 logfile_top_uint (hash_mode
);
7636 logfile_top_uint (hex_charset
);
7637 logfile_top_uint (hex_salt
);
7638 logfile_top_uint (hex_wordlist
);
7639 logfile_top_uint (increment
);
7640 logfile_top_uint (increment_max
);
7641 logfile_top_uint (increment_min
);
7642 logfile_top_uint (keyspace
);
7643 logfile_top_uint (left
);
7644 logfile_top_uint (logfile_disable
);
7645 logfile_top_uint (loopback
);
7646 logfile_top_uint (markov_classic
);
7647 logfile_top_uint (markov_disable
);
7648 logfile_top_uint (markov_threshold
);
7649 logfile_top_uint (outfile_autohex
);
7650 logfile_top_uint (outfile_check_timer
);
7651 logfile_top_uint (outfile_format
);
7652 logfile_top_uint (potfile_disable
);
7653 logfile_top_string (potfile_path
);
7654 #if defined(HAVE_HWMON)
7655 logfile_top_uint (powertune_enable
);
7657 logfile_top_uint (scrypt_tmto
);
7658 logfile_top_uint (quiet
);
7659 logfile_top_uint (remove
);
7660 logfile_top_uint (remove_timer
);
7661 logfile_top_uint (restore
);
7662 logfile_top_uint (restore_disable
);
7663 logfile_top_uint (restore_timer
);
7664 logfile_top_uint (rp_gen
);
7665 logfile_top_uint (rp_gen_func_max
);
7666 logfile_top_uint (rp_gen_func_min
);
7667 logfile_top_uint (rp_gen_seed
);
7668 logfile_top_uint (runtime
);
7669 logfile_top_uint (segment_size
);
7670 logfile_top_uint (show
);
7671 logfile_top_uint (status
);
7672 logfile_top_uint (machine_readable
);
7673 logfile_top_uint (status_timer
);
7674 logfile_top_uint (usage
);
7675 logfile_top_uint (username
);
7676 logfile_top_uint (version
);
7677 logfile_top_uint (weak_hash_threshold
);
7678 logfile_top_uint (workload_profile
);
7679 logfile_top_uint64 (limit
);
7680 logfile_top_uint64 (skip
);
7681 logfile_top_char (separator
);
7682 logfile_top_string (cpu_affinity
);
7683 logfile_top_string (custom_charset_1
);
7684 logfile_top_string (custom_charset_2
);
7685 logfile_top_string (custom_charset_3
);
7686 logfile_top_string (custom_charset_4
);
7687 logfile_top_string (debug_file
);
7688 logfile_top_string (opencl_devices
);
7689 logfile_top_string (opencl_platforms
);
7690 logfile_top_string (opencl_device_types
);
7691 logfile_top_uint (opencl_vector_width
);
7692 logfile_top_string (induction_dir
);
7693 logfile_top_string (markov_hcstat
);
7694 logfile_top_string (outfile
);
7695 logfile_top_string (outfile_check_dir
);
7696 logfile_top_string (rule_buf_l
);
7697 logfile_top_string (rule_buf_r
);
7698 logfile_top_string (session
);
7699 logfile_top_string (truecrypt_keyfiles
);
7700 logfile_top_string (veracrypt_keyfiles
);
7701 logfile_top_uint (veracrypt_pim
);
7704 * Init OpenCL library loader
7709 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7717 * OpenCL platform selection
7720 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7723 * OpenCL device selection
7726 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7729 * OpenCL device type selection
7732 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7741 * disable useless stuff for benchmark
7746 restore_disable
= 1;
7747 potfile_disable
= 1;
7748 weak_hash_threshold
= 0;
7749 nvidia_spin_damp
= 0;
7750 gpu_temp_disable
= 1;
7751 outfile_check_timer
= 0;
7754 if (powertune_enable
== 1)
7756 gpu_temp_disable
= 0;
7760 data
.status_timer
= status_timer
;
7761 data
.restore_timer
= restore_timer
;
7762 data
.restore_disable
= restore_disable
;
7763 data
.outfile_check_timer
= outfile_check_timer
;
7766 * force attack mode to be bruteforce
7769 attack_mode
= ATTACK_MODE_BF
;
7770 attack_kern
= ATTACK_KERN_BF
;
7772 if (workload_profile_chgd
== 0)
7774 workload_profile
= 3;
7776 data
.workload_profile
= workload_profile
;
7781 * status, monitor and outfile remove threads
7784 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7786 data
.wordlist_mode
= wordlist_mode
;
7788 if (wordlist_mode
== WL_MODE_STDIN
)
7792 data
.status
= status
;
7795 uint outer_threads_cnt
= 0;
7797 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7799 data
.shutdown_outer
= 0;
7801 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7803 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7805 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7807 outer_threads_cnt
++;
7817 uint attack_exec
= 0;
7821 uint esalt_size
= 0;
7823 uint dgst_pos0
= -1;
7824 uint dgst_pos1
= -1;
7825 uint dgst_pos2
= -1;
7826 uint dgst_pos3
= -1;
7828 int (*parse_func
) (char *, uint
, hash_t
*);
7829 int (*sort_by_digest
) (const void *, const void *);
7831 uint algorithm_pos
= 0;
7832 uint algorithm_max
= 1;
7834 uint
*algorithms
= default_benchmark_algorithms
;
7836 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7838 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7841 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7842 * the following algos are skipped entirely
7845 if (algorithm_pos
> 0)
7849 rd
= init_restore (argc
, argv
);
7855 * update hash_mode in case of multihash benchmark
7860 if (hash_mode_chgd
== 0)
7862 hash_mode
= algorithms
[algorithm_pos
];
7864 data
.hash_mode
= hash_mode
;
7874 case 0: hash_type
= HASH_TYPE_MD5
;
7875 salt_type
= SALT_TYPE_NONE
;
7876 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7877 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7878 | OPTS_TYPE_PT_ADD80
7879 | OPTS_TYPE_PT_ADDBITS14
;
7880 kern_type
= KERN_TYPE_MD5
;
7881 dgst_size
= DGST_SIZE_4_4
;
7882 parse_func
= md5_parse_hash
;
7883 sort_by_digest
= sort_by_digest_4_4
;
7884 opti_type
= OPTI_TYPE_ZERO_BYTE
7885 | OPTI_TYPE_PRECOMPUTE_INIT
7886 | OPTI_TYPE_PRECOMPUTE_MERKLE
7887 | OPTI_TYPE_MEET_IN_MIDDLE
7888 | OPTI_TYPE_EARLY_SKIP
7889 | OPTI_TYPE_NOT_ITERATED
7890 | OPTI_TYPE_NOT_SALTED
7891 | OPTI_TYPE_RAW_HASH
;
7898 case 10: hash_type
= HASH_TYPE_MD5
;
7899 salt_type
= SALT_TYPE_INTERN
;
7900 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7901 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7902 | OPTS_TYPE_ST_ADD80
7903 | OPTS_TYPE_ST_ADDBITS14
;
7904 kern_type
= KERN_TYPE_MD5_PWSLT
;
7905 dgst_size
= DGST_SIZE_4_4
;
7906 parse_func
= md5s_parse_hash
;
7907 sort_by_digest
= sort_by_digest_4_4
;
7908 opti_type
= OPTI_TYPE_ZERO_BYTE
7909 | OPTI_TYPE_PRECOMPUTE_INIT
7910 | OPTI_TYPE_PRECOMPUTE_MERKLE
7911 | OPTI_TYPE_MEET_IN_MIDDLE
7912 | OPTI_TYPE_EARLY_SKIP
7913 | OPTI_TYPE_NOT_ITERATED
7914 | OPTI_TYPE_APPENDED_SALT
7915 | OPTI_TYPE_RAW_HASH
;
7922 case 11: hash_type
= HASH_TYPE_MD5
;
7923 salt_type
= SALT_TYPE_INTERN
;
7924 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7926 | OPTS_TYPE_ST_ADD80
7927 | OPTS_TYPE_ST_ADDBITS14
;
7928 kern_type
= KERN_TYPE_MD5_PWSLT
;
7929 dgst_size
= DGST_SIZE_4_4
;
7930 parse_func
= joomla_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_APPENDED_SALT
7939 | OPTI_TYPE_RAW_HASH
;
7946 case 12: hash_type
= HASH_TYPE_MD5
;
7947 salt_type
= SALT_TYPE_INTERN
;
7948 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7950 | OPTS_TYPE_ST_ADD80
7951 | OPTS_TYPE_ST_ADDBITS14
;
7952 kern_type
= KERN_TYPE_MD5_PWSLT
;
7953 dgst_size
= DGST_SIZE_4_4
;
7954 parse_func
= postgresql_parse_hash
;
7955 sort_by_digest
= sort_by_digest_4_4
;
7956 opti_type
= OPTI_TYPE_ZERO_BYTE
7957 | OPTI_TYPE_PRECOMPUTE_INIT
7958 | OPTI_TYPE_PRECOMPUTE_MERKLE
7959 | OPTI_TYPE_MEET_IN_MIDDLE
7960 | OPTI_TYPE_EARLY_SKIP
7961 | OPTI_TYPE_NOT_ITERATED
7962 | OPTI_TYPE_APPENDED_SALT
7963 | OPTI_TYPE_RAW_HASH
;
7970 case 20: hash_type
= HASH_TYPE_MD5
;
7971 salt_type
= SALT_TYPE_INTERN
;
7972 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7973 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7974 | OPTS_TYPE_PT_ADD80
7975 | OPTS_TYPE_PT_ADDBITS14
;
7976 kern_type
= KERN_TYPE_MD5_SLTPW
;
7977 dgst_size
= DGST_SIZE_4_4
;
7978 parse_func
= md5s_parse_hash
;
7979 sort_by_digest
= sort_by_digest_4_4
;
7980 opti_type
= OPTI_TYPE_ZERO_BYTE
7981 | OPTI_TYPE_PRECOMPUTE_INIT
7982 | OPTI_TYPE_PRECOMPUTE_MERKLE
7983 | OPTI_TYPE_EARLY_SKIP
7984 | OPTI_TYPE_NOT_ITERATED
7985 | OPTI_TYPE_PREPENDED_SALT
7986 | OPTI_TYPE_RAW_HASH
;
7993 case 21: hash_type
= HASH_TYPE_MD5
;
7994 salt_type
= SALT_TYPE_INTERN
;
7995 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7996 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7997 | OPTS_TYPE_PT_ADD80
7998 | OPTS_TYPE_PT_ADDBITS14
;
7999 kern_type
= KERN_TYPE_MD5_SLTPW
;
8000 dgst_size
= DGST_SIZE_4_4
;
8001 parse_func
= osc_parse_hash
;
8002 sort_by_digest
= sort_by_digest_4_4
;
8003 opti_type
= OPTI_TYPE_ZERO_BYTE
8004 | OPTI_TYPE_PRECOMPUTE_INIT
8005 | OPTI_TYPE_PRECOMPUTE_MERKLE
8006 | OPTI_TYPE_EARLY_SKIP
8007 | OPTI_TYPE_NOT_ITERATED
8008 | OPTI_TYPE_PREPENDED_SALT
8009 | OPTI_TYPE_RAW_HASH
;
8016 case 22: hash_type
= HASH_TYPE_MD5
;
8017 salt_type
= SALT_TYPE_EMBEDDED
;
8018 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8019 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8020 | OPTS_TYPE_PT_ADD80
8021 | OPTS_TYPE_PT_ADDBITS14
;
8022 kern_type
= KERN_TYPE_MD5_SLTPW
;
8023 dgst_size
= DGST_SIZE_4_4
;
8024 parse_func
= netscreen_parse_hash
;
8025 sort_by_digest
= sort_by_digest_4_4
;
8026 opti_type
= OPTI_TYPE_ZERO_BYTE
8027 | OPTI_TYPE_PRECOMPUTE_INIT
8028 | OPTI_TYPE_PRECOMPUTE_MERKLE
8029 | OPTI_TYPE_EARLY_SKIP
8030 | OPTI_TYPE_NOT_ITERATED
8031 | OPTI_TYPE_PREPENDED_SALT
8032 | OPTI_TYPE_RAW_HASH
;
8039 case 23: hash_type
= HASH_TYPE_MD5
;
8040 salt_type
= SALT_TYPE_EMBEDDED
;
8041 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8042 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8043 | OPTS_TYPE_PT_ADD80
8044 | OPTS_TYPE_PT_ADDBITS14
;
8045 kern_type
= KERN_TYPE_MD5_SLTPW
;
8046 dgst_size
= DGST_SIZE_4_4
;
8047 parse_func
= skype_parse_hash
;
8048 sort_by_digest
= sort_by_digest_4_4
;
8049 opti_type
= OPTI_TYPE_ZERO_BYTE
8050 | OPTI_TYPE_PRECOMPUTE_INIT
8051 | OPTI_TYPE_PRECOMPUTE_MERKLE
8052 | OPTI_TYPE_EARLY_SKIP
8053 | OPTI_TYPE_NOT_ITERATED
8054 | OPTI_TYPE_PREPENDED_SALT
8055 | OPTI_TYPE_RAW_HASH
;
8062 case 30: hash_type
= HASH_TYPE_MD5
;
8063 salt_type
= SALT_TYPE_INTERN
;
8064 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8065 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8066 | OPTS_TYPE_PT_UNICODE
8067 | OPTS_TYPE_ST_ADD80
8068 | OPTS_TYPE_ST_ADDBITS14
;
8069 kern_type
= KERN_TYPE_MD5_PWUSLT
;
8070 dgst_size
= DGST_SIZE_4_4
;
8071 parse_func
= md5s_parse_hash
;
8072 sort_by_digest
= sort_by_digest_4_4
;
8073 opti_type
= OPTI_TYPE_ZERO_BYTE
8074 | OPTI_TYPE_PRECOMPUTE_INIT
8075 | OPTI_TYPE_PRECOMPUTE_MERKLE
8076 | OPTI_TYPE_MEET_IN_MIDDLE
8077 | OPTI_TYPE_EARLY_SKIP
8078 | OPTI_TYPE_NOT_ITERATED
8079 | OPTI_TYPE_APPENDED_SALT
8080 | OPTI_TYPE_RAW_HASH
;
8087 case 40: hash_type
= HASH_TYPE_MD5
;
8088 salt_type
= SALT_TYPE_INTERN
;
8089 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8090 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8091 | OPTS_TYPE_PT_ADD80
8092 | OPTS_TYPE_PT_ADDBITS14
8093 | OPTS_TYPE_PT_UNICODE
;
8094 kern_type
= KERN_TYPE_MD5_SLTPWU
;
8095 dgst_size
= DGST_SIZE_4_4
;
8096 parse_func
= md5s_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 50: 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_ST_ADD80
8116 | OPTS_TYPE_ST_ADDBITS14
;
8117 kern_type
= KERN_TYPE_HMACMD5_PW
;
8118 dgst_size
= DGST_SIZE_4_4
;
8119 parse_func
= hmacmd5_parse_hash
;
8120 sort_by_digest
= sort_by_digest_4_4
;
8121 opti_type
= OPTI_TYPE_ZERO_BYTE
8122 | OPTI_TYPE_NOT_ITERATED
;
8129 case 60: hash_type
= HASH_TYPE_MD5
;
8130 salt_type
= SALT_TYPE_INTERN
;
8131 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8132 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8133 | OPTS_TYPE_PT_ADD80
8134 | OPTS_TYPE_PT_ADDBITS14
;
8135 kern_type
= KERN_TYPE_HMACMD5_SLT
;
8136 dgst_size
= DGST_SIZE_4_4
;
8137 parse_func
= hmacmd5_parse_hash
;
8138 sort_by_digest
= sort_by_digest_4_4
;
8139 opti_type
= OPTI_TYPE_ZERO_BYTE
8140 | OPTI_TYPE_NOT_ITERATED
;
8147 case 100: hash_type
= HASH_TYPE_SHA1
;
8148 salt_type
= SALT_TYPE_NONE
;
8149 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8150 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8151 | OPTS_TYPE_PT_ADD80
8152 | OPTS_TYPE_PT_ADDBITS15
;
8153 kern_type
= KERN_TYPE_SHA1
;
8154 dgst_size
= DGST_SIZE_4_5
;
8155 parse_func
= sha1_parse_hash
;
8156 sort_by_digest
= sort_by_digest_4_5
;
8157 opti_type
= OPTI_TYPE_ZERO_BYTE
8158 | OPTI_TYPE_PRECOMPUTE_INIT
8159 | OPTI_TYPE_PRECOMPUTE_MERKLE
8160 | OPTI_TYPE_EARLY_SKIP
8161 | OPTI_TYPE_NOT_ITERATED
8162 | OPTI_TYPE_NOT_SALTED
8163 | OPTI_TYPE_RAW_HASH
;
8170 case 101: hash_type
= HASH_TYPE_SHA1
;
8171 salt_type
= SALT_TYPE_NONE
;
8172 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8173 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8174 | OPTS_TYPE_PT_ADD80
8175 | OPTS_TYPE_PT_ADDBITS15
;
8176 kern_type
= KERN_TYPE_SHA1
;
8177 dgst_size
= DGST_SIZE_4_5
;
8178 parse_func
= sha1b64_parse_hash
;
8179 sort_by_digest
= sort_by_digest_4_5
;
8180 opti_type
= OPTI_TYPE_ZERO_BYTE
8181 | OPTI_TYPE_PRECOMPUTE_INIT
8182 | OPTI_TYPE_PRECOMPUTE_MERKLE
8183 | OPTI_TYPE_EARLY_SKIP
8184 | OPTI_TYPE_NOT_ITERATED
8185 | OPTI_TYPE_NOT_SALTED
8186 | OPTI_TYPE_RAW_HASH
;
8193 case 110: hash_type
= HASH_TYPE_SHA1
;
8194 salt_type
= SALT_TYPE_INTERN
;
8195 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8196 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8197 | OPTS_TYPE_ST_ADD80
8198 | OPTS_TYPE_ST_ADDBITS15
;
8199 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8200 dgst_size
= DGST_SIZE_4_5
;
8201 parse_func
= sha1s_parse_hash
;
8202 sort_by_digest
= sort_by_digest_4_5
;
8203 opti_type
= OPTI_TYPE_ZERO_BYTE
8204 | OPTI_TYPE_PRECOMPUTE_INIT
8205 | OPTI_TYPE_PRECOMPUTE_MERKLE
8206 | OPTI_TYPE_EARLY_SKIP
8207 | OPTI_TYPE_NOT_ITERATED
8208 | OPTI_TYPE_APPENDED_SALT
8209 | OPTI_TYPE_RAW_HASH
;
8216 case 111: hash_type
= HASH_TYPE_SHA1
;
8217 salt_type
= SALT_TYPE_EMBEDDED
;
8218 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8219 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8220 | OPTS_TYPE_ST_ADD80
8221 | OPTS_TYPE_ST_ADDBITS15
;
8222 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8223 dgst_size
= DGST_SIZE_4_5
;
8224 parse_func
= sha1b64s_parse_hash
;
8225 sort_by_digest
= sort_by_digest_4_5
;
8226 opti_type
= OPTI_TYPE_ZERO_BYTE
8227 | OPTI_TYPE_PRECOMPUTE_INIT
8228 | OPTI_TYPE_PRECOMPUTE_MERKLE
8229 | OPTI_TYPE_EARLY_SKIP
8230 | OPTI_TYPE_NOT_ITERATED
8231 | OPTI_TYPE_APPENDED_SALT
8232 | OPTI_TYPE_RAW_HASH
;
8239 case 112: hash_type
= HASH_TYPE_SHA1
;
8240 salt_type
= SALT_TYPE_INTERN
;
8241 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8242 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8243 | OPTS_TYPE_ST_ADD80
8244 | OPTS_TYPE_ST_ADDBITS15
8246 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8247 dgst_size
= DGST_SIZE_4_5
;
8248 parse_func
= oracles_parse_hash
;
8249 sort_by_digest
= sort_by_digest_4_5
;
8250 opti_type
= OPTI_TYPE_ZERO_BYTE
8251 | OPTI_TYPE_PRECOMPUTE_INIT
8252 | OPTI_TYPE_PRECOMPUTE_MERKLE
8253 | OPTI_TYPE_EARLY_SKIP
8254 | OPTI_TYPE_NOT_ITERATED
8255 | OPTI_TYPE_APPENDED_SALT
8256 | OPTI_TYPE_RAW_HASH
;
8263 case 120: hash_type
= HASH_TYPE_SHA1
;
8264 salt_type
= SALT_TYPE_INTERN
;
8265 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8266 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8267 | OPTS_TYPE_PT_ADD80
8268 | OPTS_TYPE_PT_ADDBITS15
;
8269 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8270 dgst_size
= DGST_SIZE_4_5
;
8271 parse_func
= sha1s_parse_hash
;
8272 sort_by_digest
= sort_by_digest_4_5
;
8273 opti_type
= OPTI_TYPE_ZERO_BYTE
8274 | OPTI_TYPE_PRECOMPUTE_INIT
8275 | OPTI_TYPE_PRECOMPUTE_MERKLE
8276 | OPTI_TYPE_EARLY_SKIP
8277 | OPTI_TYPE_NOT_ITERATED
8278 | OPTI_TYPE_PREPENDED_SALT
8279 | OPTI_TYPE_RAW_HASH
;
8286 case 121: hash_type
= HASH_TYPE_SHA1
;
8287 salt_type
= SALT_TYPE_INTERN
;
8288 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8289 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8290 | OPTS_TYPE_PT_ADD80
8291 | OPTS_TYPE_PT_ADDBITS15
8292 | OPTS_TYPE_ST_LOWER
;
8293 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8294 dgst_size
= DGST_SIZE_4_5
;
8295 parse_func
= smf_parse_hash
;
8296 sort_by_digest
= sort_by_digest_4_5
;
8297 opti_type
= OPTI_TYPE_ZERO_BYTE
8298 | OPTI_TYPE_PRECOMPUTE_INIT
8299 | OPTI_TYPE_PRECOMPUTE_MERKLE
8300 | OPTI_TYPE_EARLY_SKIP
8301 | OPTI_TYPE_NOT_ITERATED
8302 | OPTI_TYPE_PREPENDED_SALT
8303 | OPTI_TYPE_RAW_HASH
;
8310 case 122: hash_type
= HASH_TYPE_SHA1
;
8311 salt_type
= SALT_TYPE_EMBEDDED
;
8312 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8313 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8314 | OPTS_TYPE_PT_ADD80
8315 | OPTS_TYPE_PT_ADDBITS15
8317 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8318 dgst_size
= DGST_SIZE_4_5
;
8319 parse_func
= osx1_parse_hash
;
8320 sort_by_digest
= sort_by_digest_4_5
;
8321 opti_type
= OPTI_TYPE_ZERO_BYTE
8322 | OPTI_TYPE_PRECOMPUTE_INIT
8323 | OPTI_TYPE_PRECOMPUTE_MERKLE
8324 | OPTI_TYPE_EARLY_SKIP
8325 | OPTI_TYPE_NOT_ITERATED
8326 | OPTI_TYPE_PREPENDED_SALT
8327 | OPTI_TYPE_RAW_HASH
;
8334 case 124: hash_type
= HASH_TYPE_SHA1
;
8335 salt_type
= SALT_TYPE_EMBEDDED
;
8336 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8337 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8338 | OPTS_TYPE_PT_ADD80
8339 | OPTS_TYPE_PT_ADDBITS15
;
8340 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8341 dgst_size
= DGST_SIZE_4_5
;
8342 parse_func
= djangosha1_parse_hash
;
8343 sort_by_digest
= sort_by_digest_4_5
;
8344 opti_type
= OPTI_TYPE_ZERO_BYTE
8345 | OPTI_TYPE_PRECOMPUTE_INIT
8346 | OPTI_TYPE_PRECOMPUTE_MERKLE
8347 | OPTI_TYPE_EARLY_SKIP
8348 | OPTI_TYPE_NOT_ITERATED
8349 | OPTI_TYPE_PREPENDED_SALT
8350 | OPTI_TYPE_RAW_HASH
;
8357 case 125: hash_type
= HASH_TYPE_SHA1
;
8358 salt_type
= SALT_TYPE_EMBEDDED
;
8359 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8360 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8361 | OPTS_TYPE_PT_ADD80
8362 | OPTS_TYPE_PT_ADDBITS15
8364 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8365 dgst_size
= DGST_SIZE_4_5
;
8366 parse_func
= arubaos_parse_hash
;
8367 sort_by_digest
= sort_by_digest_4_5
;
8368 opti_type
= OPTI_TYPE_ZERO_BYTE
8369 | OPTI_TYPE_PRECOMPUTE_INIT
8370 | OPTI_TYPE_PRECOMPUTE_MERKLE
8371 | OPTI_TYPE_EARLY_SKIP
8372 | OPTI_TYPE_NOT_ITERATED
8373 | OPTI_TYPE_PREPENDED_SALT
8374 | OPTI_TYPE_RAW_HASH
;
8381 case 130: hash_type
= HASH_TYPE_SHA1
;
8382 salt_type
= SALT_TYPE_INTERN
;
8383 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8384 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8385 | OPTS_TYPE_PT_UNICODE
8386 | OPTS_TYPE_ST_ADD80
8387 | OPTS_TYPE_ST_ADDBITS15
;
8388 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8389 dgst_size
= DGST_SIZE_4_5
;
8390 parse_func
= sha1s_parse_hash
;
8391 sort_by_digest
= sort_by_digest_4_5
;
8392 opti_type
= OPTI_TYPE_ZERO_BYTE
8393 | OPTI_TYPE_PRECOMPUTE_INIT
8394 | OPTI_TYPE_PRECOMPUTE_MERKLE
8395 | OPTI_TYPE_EARLY_SKIP
8396 | OPTI_TYPE_NOT_ITERATED
8397 | OPTI_TYPE_APPENDED_SALT
8398 | OPTI_TYPE_RAW_HASH
;
8405 case 131: hash_type
= HASH_TYPE_SHA1
;
8406 salt_type
= SALT_TYPE_EMBEDDED
;
8407 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8408 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8409 | OPTS_TYPE_PT_UNICODE
8410 | OPTS_TYPE_PT_UPPER
8411 | OPTS_TYPE_ST_ADD80
8412 | OPTS_TYPE_ST_ADDBITS15
8414 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8415 dgst_size
= DGST_SIZE_4_5
;
8416 parse_func
= mssql2000_parse_hash
;
8417 sort_by_digest
= sort_by_digest_4_5
;
8418 opti_type
= OPTI_TYPE_ZERO_BYTE
8419 | OPTI_TYPE_PRECOMPUTE_INIT
8420 | OPTI_TYPE_PRECOMPUTE_MERKLE
8421 | OPTI_TYPE_EARLY_SKIP
8422 | OPTI_TYPE_NOT_ITERATED
8423 | OPTI_TYPE_APPENDED_SALT
8424 | OPTI_TYPE_RAW_HASH
;
8431 case 132: hash_type
= HASH_TYPE_SHA1
;
8432 salt_type
= SALT_TYPE_EMBEDDED
;
8433 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8434 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8435 | OPTS_TYPE_PT_UNICODE
8436 | OPTS_TYPE_ST_ADD80
8437 | OPTS_TYPE_ST_ADDBITS15
8439 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8440 dgst_size
= DGST_SIZE_4_5
;
8441 parse_func
= mssql2005_parse_hash
;
8442 sort_by_digest
= sort_by_digest_4_5
;
8443 opti_type
= OPTI_TYPE_ZERO_BYTE
8444 | OPTI_TYPE_PRECOMPUTE_INIT
8445 | OPTI_TYPE_PRECOMPUTE_MERKLE
8446 | OPTI_TYPE_EARLY_SKIP
8447 | OPTI_TYPE_NOT_ITERATED
8448 | OPTI_TYPE_APPENDED_SALT
8449 | OPTI_TYPE_RAW_HASH
;
8456 case 133: hash_type
= HASH_TYPE_SHA1
;
8457 salt_type
= SALT_TYPE_EMBEDDED
;
8458 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8459 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8460 | OPTS_TYPE_PT_UNICODE
8461 | OPTS_TYPE_ST_ADD80
8462 | OPTS_TYPE_ST_ADDBITS15
;
8463 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8464 dgst_size
= DGST_SIZE_4_5
;
8465 parse_func
= peoplesoft_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 140: hash_type
= HASH_TYPE_SHA1
;
8481 salt_type
= SALT_TYPE_INTERN
;
8482 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8483 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8484 | OPTS_TYPE_PT_ADD80
8485 | OPTS_TYPE_PT_ADDBITS15
8486 | OPTS_TYPE_PT_UNICODE
;
8487 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8488 dgst_size
= DGST_SIZE_4_5
;
8489 parse_func
= sha1s_parse_hash
;
8490 sort_by_digest
= sort_by_digest_4_5
;
8491 opti_type
= OPTI_TYPE_ZERO_BYTE
8492 | OPTI_TYPE_PRECOMPUTE_INIT
8493 | OPTI_TYPE_PRECOMPUTE_MERKLE
8494 | OPTI_TYPE_EARLY_SKIP
8495 | OPTI_TYPE_NOT_ITERATED
8496 | OPTI_TYPE_PREPENDED_SALT
8497 | OPTI_TYPE_RAW_HASH
;
8504 case 141: hash_type
= HASH_TYPE_SHA1
;
8505 salt_type
= SALT_TYPE_EMBEDDED
;
8506 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8507 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8508 | OPTS_TYPE_PT_ADD80
8509 | OPTS_TYPE_PT_ADDBITS15
8510 | OPTS_TYPE_PT_UNICODE
8511 | OPTS_TYPE_ST_BASE64
;
8512 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8513 dgst_size
= DGST_SIZE_4_5
;
8514 parse_func
= episerver_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_PREPENDED_SALT
8522 | OPTI_TYPE_RAW_HASH
;
8529 case 150: 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_ST_ADD80
8534 | OPTS_TYPE_ST_ADDBITS15
;
8535 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8536 dgst_size
= DGST_SIZE_4_5
;
8537 parse_func
= hmacsha1_parse_hash
;
8538 sort_by_digest
= sort_by_digest_4_5
;
8539 opti_type
= OPTI_TYPE_ZERO_BYTE
8540 | OPTI_TYPE_NOT_ITERATED
;
8547 case 160: hash_type
= HASH_TYPE_SHA1
;
8548 salt_type
= SALT_TYPE_INTERN
;
8549 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8550 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8551 | OPTS_TYPE_PT_ADD80
8552 | OPTS_TYPE_PT_ADDBITS15
;
8553 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8554 dgst_size
= DGST_SIZE_4_5
;
8555 parse_func
= hmacsha1_parse_hash
;
8556 sort_by_digest
= sort_by_digest_4_5
;
8557 opti_type
= OPTI_TYPE_ZERO_BYTE
8558 | OPTI_TYPE_NOT_ITERATED
;
8565 case 200: hash_type
= HASH_TYPE_MYSQL
;
8566 salt_type
= SALT_TYPE_NONE
;
8567 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8569 kern_type
= KERN_TYPE_MYSQL
;
8570 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8571 parse_func
= mysql323_parse_hash
;
8572 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8573 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8580 case 300: hash_type
= HASH_TYPE_SHA1
;
8581 salt_type
= SALT_TYPE_NONE
;
8582 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8583 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8584 | OPTS_TYPE_PT_ADD80
8585 | OPTS_TYPE_PT_ADDBITS15
;
8586 kern_type
= KERN_TYPE_MYSQL41
;
8587 dgst_size
= DGST_SIZE_4_5
;
8588 parse_func
= sha1_parse_hash
;
8589 sort_by_digest
= sort_by_digest_4_5
;
8590 opti_type
= OPTI_TYPE_ZERO_BYTE
8591 | OPTI_TYPE_PRECOMPUTE_INIT
8592 | OPTI_TYPE_PRECOMPUTE_MERKLE
8593 | OPTI_TYPE_EARLY_SKIP
8594 | OPTI_TYPE_NOT_ITERATED
8595 | OPTI_TYPE_NOT_SALTED
;
8602 case 400: hash_type
= HASH_TYPE_MD5
;
8603 salt_type
= SALT_TYPE_EMBEDDED
;
8604 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8606 kern_type
= KERN_TYPE_PHPASS
;
8607 dgst_size
= DGST_SIZE_4_4
;
8608 parse_func
= phpass_parse_hash
;
8609 sort_by_digest
= sort_by_digest_4_4
;
8610 opti_type
= OPTI_TYPE_ZERO_BYTE
8611 | OPTI_TYPE_SLOW_HASH_SIMD
;
8618 case 500: hash_type
= HASH_TYPE_MD5
;
8619 salt_type
= SALT_TYPE_EMBEDDED
;
8620 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8621 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8622 kern_type
= KERN_TYPE_MD5CRYPT
;
8623 dgst_size
= DGST_SIZE_4_4
;
8624 parse_func
= md5crypt_parse_hash
;
8625 sort_by_digest
= sort_by_digest_4_4
;
8626 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8633 case 501: hash_type
= HASH_TYPE_MD5
;
8634 salt_type
= SALT_TYPE_EMBEDDED
;
8635 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8637 | OPTS_TYPE_HASH_COPY
;
8638 kern_type
= KERN_TYPE_MD5CRYPT
;
8639 dgst_size
= DGST_SIZE_4_4
;
8640 parse_func
= juniper_parse_hash
;
8641 sort_by_digest
= sort_by_digest_4_4
;
8642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8649 case 900: hash_type
= HASH_TYPE_MD4
;
8650 salt_type
= SALT_TYPE_NONE
;
8651 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8653 | OPTS_TYPE_PT_ADD80
8654 | OPTS_TYPE_PT_ADDBITS14
;
8655 kern_type
= KERN_TYPE_MD4
;
8656 dgst_size
= DGST_SIZE_4_4
;
8657 parse_func
= md4_parse_hash
;
8658 sort_by_digest
= sort_by_digest_4_4
;
8659 opti_type
= OPTI_TYPE_ZERO_BYTE
8660 | OPTI_TYPE_PRECOMPUTE_INIT
8661 | OPTI_TYPE_PRECOMPUTE_MERKLE
8662 | OPTI_TYPE_MEET_IN_MIDDLE
8663 | OPTI_TYPE_EARLY_SKIP
8664 | OPTI_TYPE_NOT_ITERATED
8665 | OPTI_TYPE_NOT_SALTED
8666 | OPTI_TYPE_RAW_HASH
;
8673 case 1000: hash_type
= HASH_TYPE_MD4
;
8674 salt_type
= SALT_TYPE_NONE
;
8675 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8676 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8677 | OPTS_TYPE_PT_ADD80
8678 | OPTS_TYPE_PT_ADDBITS14
8679 | OPTS_TYPE_PT_UNICODE
;
8680 kern_type
= KERN_TYPE_MD4_PWU
;
8681 dgst_size
= DGST_SIZE_4_4
;
8682 parse_func
= md4_parse_hash
;
8683 sort_by_digest
= sort_by_digest_4_4
;
8684 opti_type
= OPTI_TYPE_ZERO_BYTE
8685 | OPTI_TYPE_PRECOMPUTE_INIT
8686 | OPTI_TYPE_PRECOMPUTE_MERKLE
8687 | OPTI_TYPE_MEET_IN_MIDDLE
8688 | OPTI_TYPE_EARLY_SKIP
8689 | OPTI_TYPE_NOT_ITERATED
8690 | OPTI_TYPE_NOT_SALTED
8691 | OPTI_TYPE_RAW_HASH
;
8698 case 1100: hash_type
= HASH_TYPE_MD4
;
8699 salt_type
= SALT_TYPE_INTERN
;
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 | OPTS_TYPE_PT_UNICODE
8705 | OPTS_TYPE_ST_ADD80
8706 | OPTS_TYPE_ST_UNICODE
8707 | OPTS_TYPE_ST_LOWER
;
8708 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8709 dgst_size
= DGST_SIZE_4_4
;
8710 parse_func
= dcc_parse_hash
;
8711 sort_by_digest
= sort_by_digest_4_4
;
8712 opti_type
= OPTI_TYPE_ZERO_BYTE
8713 | OPTI_TYPE_PRECOMPUTE_INIT
8714 | OPTI_TYPE_PRECOMPUTE_MERKLE
8715 | OPTI_TYPE_EARLY_SKIP
8716 | OPTI_TYPE_NOT_ITERATED
;
8723 case 1400: hash_type
= HASH_TYPE_SHA256
;
8724 salt_type
= SALT_TYPE_NONE
;
8725 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8726 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8727 | OPTS_TYPE_PT_ADD80
8728 | OPTS_TYPE_PT_ADDBITS15
;
8729 kern_type
= KERN_TYPE_SHA256
;
8730 dgst_size
= DGST_SIZE_4_8
;
8731 parse_func
= sha256_parse_hash
;
8732 sort_by_digest
= sort_by_digest_4_8
;
8733 opti_type
= OPTI_TYPE_ZERO_BYTE
8734 | OPTI_TYPE_PRECOMPUTE_INIT
8735 | OPTI_TYPE_PRECOMPUTE_MERKLE
8736 | OPTI_TYPE_EARLY_SKIP
8737 | OPTI_TYPE_NOT_ITERATED
8738 | OPTI_TYPE_NOT_SALTED
8739 | OPTI_TYPE_RAW_HASH
;
8746 case 1410: hash_type
= HASH_TYPE_SHA256
;
8747 salt_type
= SALT_TYPE_INTERN
;
8748 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8749 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8750 | OPTS_TYPE_ST_ADD80
8751 | OPTS_TYPE_ST_ADDBITS15
;
8752 kern_type
= KERN_TYPE_SHA256_PWSLT
;
8753 dgst_size
= DGST_SIZE_4_8
;
8754 parse_func
= sha256s_parse_hash
;
8755 sort_by_digest
= sort_by_digest_4_8
;
8756 opti_type
= OPTI_TYPE_ZERO_BYTE
8757 | OPTI_TYPE_PRECOMPUTE_INIT
8758 | OPTI_TYPE_PRECOMPUTE_MERKLE
8759 | OPTI_TYPE_EARLY_SKIP
8760 | OPTI_TYPE_NOT_ITERATED
8761 | OPTI_TYPE_APPENDED_SALT
8762 | OPTI_TYPE_RAW_HASH
;
8769 case 1420: hash_type
= HASH_TYPE_SHA256
;
8770 salt_type
= SALT_TYPE_INTERN
;
8771 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8772 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8773 | OPTS_TYPE_PT_ADD80
8774 | OPTS_TYPE_PT_ADDBITS15
;
8775 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8776 dgst_size
= DGST_SIZE_4_8
;
8777 parse_func
= sha256s_parse_hash
;
8778 sort_by_digest
= sort_by_digest_4_8
;
8779 opti_type
= OPTI_TYPE_ZERO_BYTE
8780 | OPTI_TYPE_PRECOMPUTE_INIT
8781 | OPTI_TYPE_PRECOMPUTE_MERKLE
8782 | OPTI_TYPE_EARLY_SKIP
8783 | OPTI_TYPE_NOT_ITERATED
8784 | OPTI_TYPE_PREPENDED_SALT
8785 | OPTI_TYPE_RAW_HASH
;
8792 case 1421: hash_type
= HASH_TYPE_SHA256
;
8793 salt_type
= SALT_TYPE_EMBEDDED
;
8794 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8795 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8796 | OPTS_TYPE_PT_ADD80
8797 | OPTS_TYPE_PT_ADDBITS15
;
8798 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8799 dgst_size
= DGST_SIZE_4_8
;
8800 parse_func
= hmailserver_parse_hash
;
8801 sort_by_digest
= sort_by_digest_4_8
;
8802 opti_type
= OPTI_TYPE_ZERO_BYTE
8803 | OPTI_TYPE_PRECOMPUTE_INIT
8804 | OPTI_TYPE_PRECOMPUTE_MERKLE
8805 | OPTI_TYPE_EARLY_SKIP
8806 | OPTI_TYPE_NOT_ITERATED
8807 | OPTI_TYPE_PREPENDED_SALT
8808 | OPTI_TYPE_RAW_HASH
;
8815 case 1430: hash_type
= HASH_TYPE_SHA256
;
8816 salt_type
= SALT_TYPE_INTERN
;
8817 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8818 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8819 | OPTS_TYPE_PT_UNICODE
8820 | OPTS_TYPE_ST_ADD80
8821 | OPTS_TYPE_ST_ADDBITS15
;
8822 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8823 dgst_size
= DGST_SIZE_4_8
;
8824 parse_func
= sha256s_parse_hash
;
8825 sort_by_digest
= sort_by_digest_4_8
;
8826 opti_type
= OPTI_TYPE_ZERO_BYTE
8827 | OPTI_TYPE_PRECOMPUTE_INIT
8828 | OPTI_TYPE_PRECOMPUTE_MERKLE
8829 | OPTI_TYPE_EARLY_SKIP
8830 | OPTI_TYPE_NOT_ITERATED
8831 | OPTI_TYPE_APPENDED_SALT
8832 | OPTI_TYPE_RAW_HASH
;
8839 case 1440: hash_type
= HASH_TYPE_SHA256
;
8840 salt_type
= SALT_TYPE_INTERN
;
8841 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8842 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8843 | OPTS_TYPE_PT_ADD80
8844 | OPTS_TYPE_PT_ADDBITS15
8845 | OPTS_TYPE_PT_UNICODE
;
8846 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8847 dgst_size
= DGST_SIZE_4_8
;
8848 parse_func
= sha256s_parse_hash
;
8849 sort_by_digest
= sort_by_digest_4_8
;
8850 opti_type
= OPTI_TYPE_ZERO_BYTE
8851 | OPTI_TYPE_PRECOMPUTE_INIT
8852 | OPTI_TYPE_PRECOMPUTE_MERKLE
8853 | OPTI_TYPE_EARLY_SKIP
8854 | OPTI_TYPE_NOT_ITERATED
8855 | OPTI_TYPE_PREPENDED_SALT
8856 | OPTI_TYPE_RAW_HASH
;
8863 case 1441: hash_type
= HASH_TYPE_SHA256
;
8864 salt_type
= SALT_TYPE_EMBEDDED
;
8865 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8866 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8867 | OPTS_TYPE_PT_ADD80
8868 | OPTS_TYPE_PT_ADDBITS15
8869 | OPTS_TYPE_PT_UNICODE
8870 | OPTS_TYPE_ST_BASE64
;
8871 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8872 dgst_size
= DGST_SIZE_4_8
;
8873 parse_func
= episerver4_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_PREPENDED_SALT
8881 | OPTI_TYPE_RAW_HASH
;
8888 case 1450: 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_ST_ADD80
;
8893 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8894 dgst_size
= DGST_SIZE_4_8
;
8895 parse_func
= hmacsha256_parse_hash
;
8896 sort_by_digest
= sort_by_digest_4_8
;
8897 opti_type
= OPTI_TYPE_ZERO_BYTE
8898 | OPTI_TYPE_NOT_ITERATED
;
8905 case 1460: hash_type
= HASH_TYPE_SHA256
;
8906 salt_type
= SALT_TYPE_INTERN
;
8907 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8908 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8909 | OPTS_TYPE_PT_ADD80
8910 | OPTS_TYPE_PT_ADDBITS15
;
8911 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8912 dgst_size
= DGST_SIZE_4_8
;
8913 parse_func
= hmacsha256_parse_hash
;
8914 sort_by_digest
= sort_by_digest_4_8
;
8915 opti_type
= OPTI_TYPE_ZERO_BYTE
8916 | OPTI_TYPE_NOT_ITERATED
;
8923 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8924 salt_type
= SALT_TYPE_EMBEDDED
;
8925 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8926 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8927 | OPTS_TYPE_PT_BITSLICE
;
8928 kern_type
= KERN_TYPE_DESCRYPT
;
8929 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8930 parse_func
= descrypt_parse_hash
;
8931 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8932 opti_type
= OPTI_TYPE_ZERO_BYTE
8933 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8940 case 1600: hash_type
= HASH_TYPE_MD5
;
8941 salt_type
= SALT_TYPE_EMBEDDED
;
8942 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8943 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8944 kern_type
= KERN_TYPE_APR1CRYPT
;
8945 dgst_size
= DGST_SIZE_4_4
;
8946 parse_func
= md5apr1_parse_hash
;
8947 sort_by_digest
= sort_by_digest_4_4
;
8948 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8955 case 1700: hash_type
= HASH_TYPE_SHA512
;
8956 salt_type
= SALT_TYPE_NONE
;
8957 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8958 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8959 | OPTS_TYPE_PT_ADD80
8960 | OPTS_TYPE_PT_ADDBITS15
;
8961 kern_type
= KERN_TYPE_SHA512
;
8962 dgst_size
= DGST_SIZE_8_8
;
8963 parse_func
= sha512_parse_hash
;
8964 sort_by_digest
= sort_by_digest_8_8
;
8965 opti_type
= OPTI_TYPE_ZERO_BYTE
8966 | OPTI_TYPE_PRECOMPUTE_INIT
8967 | OPTI_TYPE_PRECOMPUTE_MERKLE
8968 | OPTI_TYPE_EARLY_SKIP
8969 | OPTI_TYPE_NOT_ITERATED
8970 | OPTI_TYPE_NOT_SALTED
8971 | OPTI_TYPE_USES_BITS_64
8972 | OPTI_TYPE_RAW_HASH
;
8979 case 1710: hash_type
= HASH_TYPE_SHA512
;
8980 salt_type
= SALT_TYPE_INTERN
;
8981 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8982 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8983 | OPTS_TYPE_ST_ADD80
8984 | OPTS_TYPE_ST_ADDBITS15
;
8985 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8986 dgst_size
= DGST_SIZE_8_8
;
8987 parse_func
= sha512s_parse_hash
;
8988 sort_by_digest
= sort_by_digest_8_8
;
8989 opti_type
= OPTI_TYPE_ZERO_BYTE
8990 | OPTI_TYPE_PRECOMPUTE_INIT
8991 | OPTI_TYPE_PRECOMPUTE_MERKLE
8992 | OPTI_TYPE_EARLY_SKIP
8993 | OPTI_TYPE_NOT_ITERATED
8994 | OPTI_TYPE_APPENDED_SALT
8995 | OPTI_TYPE_USES_BITS_64
8996 | OPTI_TYPE_RAW_HASH
;
9003 case 1711: hash_type
= HASH_TYPE_SHA512
;
9004 salt_type
= SALT_TYPE_EMBEDDED
;
9005 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9006 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9007 | OPTS_TYPE_ST_ADD80
9008 | OPTS_TYPE_ST_ADDBITS15
;
9009 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9010 dgst_size
= DGST_SIZE_8_8
;
9011 parse_func
= sha512b64s_parse_hash
;
9012 sort_by_digest
= sort_by_digest_8_8
;
9013 opti_type
= OPTI_TYPE_ZERO_BYTE
9014 | OPTI_TYPE_PRECOMPUTE_INIT
9015 | OPTI_TYPE_PRECOMPUTE_MERKLE
9016 | OPTI_TYPE_EARLY_SKIP
9017 | OPTI_TYPE_NOT_ITERATED
9018 | OPTI_TYPE_APPENDED_SALT
9019 | OPTI_TYPE_USES_BITS_64
9020 | OPTI_TYPE_RAW_HASH
;
9027 case 1720: hash_type
= HASH_TYPE_SHA512
;
9028 salt_type
= SALT_TYPE_INTERN
;
9029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9030 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9031 | OPTS_TYPE_PT_ADD80
9032 | OPTS_TYPE_PT_ADDBITS15
;
9033 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9034 dgst_size
= DGST_SIZE_8_8
;
9035 parse_func
= sha512s_parse_hash
;
9036 sort_by_digest
= sort_by_digest_8_8
;
9037 opti_type
= OPTI_TYPE_ZERO_BYTE
9038 | OPTI_TYPE_PRECOMPUTE_INIT
9039 | OPTI_TYPE_PRECOMPUTE_MERKLE
9040 | OPTI_TYPE_EARLY_SKIP
9041 | OPTI_TYPE_NOT_ITERATED
9042 | OPTI_TYPE_PREPENDED_SALT
9043 | OPTI_TYPE_USES_BITS_64
9044 | OPTI_TYPE_RAW_HASH
;
9051 case 1722: hash_type
= HASH_TYPE_SHA512
;
9052 salt_type
= SALT_TYPE_EMBEDDED
;
9053 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9054 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9055 | OPTS_TYPE_PT_ADD80
9056 | OPTS_TYPE_PT_ADDBITS15
9058 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9059 dgst_size
= DGST_SIZE_8_8
;
9060 parse_func
= osx512_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_PREPENDED_SALT
9068 | OPTI_TYPE_USES_BITS_64
9069 | OPTI_TYPE_RAW_HASH
;
9076 case 1730: 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_UNICODE
9081 | OPTS_TYPE_ST_ADD80
9082 | OPTS_TYPE_ST_ADDBITS15
;
9083 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9084 dgst_size
= DGST_SIZE_8_8
;
9085 parse_func
= sha512s_parse_hash
;
9086 sort_by_digest
= sort_by_digest_8_8
;
9087 opti_type
= OPTI_TYPE_ZERO_BYTE
9088 | OPTI_TYPE_PRECOMPUTE_INIT
9089 | OPTI_TYPE_PRECOMPUTE_MERKLE
9090 | OPTI_TYPE_EARLY_SKIP
9091 | OPTI_TYPE_NOT_ITERATED
9092 | OPTI_TYPE_APPENDED_SALT
9093 | OPTI_TYPE_USES_BITS_64
9094 | OPTI_TYPE_RAW_HASH
;
9101 case 1731: hash_type
= HASH_TYPE_SHA512
;
9102 salt_type
= SALT_TYPE_EMBEDDED
;
9103 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9104 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9105 | OPTS_TYPE_PT_UNICODE
9106 | OPTS_TYPE_ST_ADD80
9107 | OPTS_TYPE_ST_ADDBITS15
9109 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9110 dgst_size
= DGST_SIZE_8_8
;
9111 parse_func
= mssql2012_parse_hash
;
9112 sort_by_digest
= sort_by_digest_8_8
;
9113 opti_type
= OPTI_TYPE_ZERO_BYTE
9114 | OPTI_TYPE_PRECOMPUTE_INIT
9115 | OPTI_TYPE_PRECOMPUTE_MERKLE
9116 | OPTI_TYPE_EARLY_SKIP
9117 | OPTI_TYPE_NOT_ITERATED
9118 | OPTI_TYPE_APPENDED_SALT
9119 | OPTI_TYPE_USES_BITS_64
9120 | OPTI_TYPE_RAW_HASH
;
9127 case 1740: hash_type
= HASH_TYPE_SHA512
;
9128 salt_type
= SALT_TYPE_INTERN
;
9129 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9130 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9131 | OPTS_TYPE_PT_ADD80
9132 | OPTS_TYPE_PT_ADDBITS15
9133 | OPTS_TYPE_PT_UNICODE
;
9134 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
9135 dgst_size
= DGST_SIZE_8_8
;
9136 parse_func
= sha512s_parse_hash
;
9137 sort_by_digest
= sort_by_digest_8_8
;
9138 opti_type
= OPTI_TYPE_ZERO_BYTE
9139 | OPTI_TYPE_PRECOMPUTE_INIT
9140 | OPTI_TYPE_PRECOMPUTE_MERKLE
9141 | OPTI_TYPE_EARLY_SKIP
9142 | OPTI_TYPE_NOT_ITERATED
9143 | OPTI_TYPE_PREPENDED_SALT
9144 | OPTI_TYPE_USES_BITS_64
9145 | OPTI_TYPE_RAW_HASH
;
9152 case 1750: hash_type
= HASH_TYPE_SHA512
;
9153 salt_type
= SALT_TYPE_INTERN
;
9154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9155 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9156 | OPTS_TYPE_ST_ADD80
;
9157 kern_type
= KERN_TYPE_HMACSHA512_PW
;
9158 dgst_size
= DGST_SIZE_8_8
;
9159 parse_func
= hmacsha512_parse_hash
;
9160 sort_by_digest
= sort_by_digest_8_8
;
9161 opti_type
= OPTI_TYPE_ZERO_BYTE
9162 | OPTI_TYPE_USES_BITS_64
9163 | OPTI_TYPE_NOT_ITERATED
;
9170 case 1760: hash_type
= HASH_TYPE_SHA512
;
9171 salt_type
= SALT_TYPE_INTERN
;
9172 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9173 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9174 | OPTS_TYPE_PT_ADD80
9175 | OPTS_TYPE_PT_ADDBITS15
;
9176 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
9177 dgst_size
= DGST_SIZE_8_8
;
9178 parse_func
= hmacsha512_parse_hash
;
9179 sort_by_digest
= sort_by_digest_8_8
;
9180 opti_type
= OPTI_TYPE_ZERO_BYTE
9181 | OPTI_TYPE_USES_BITS_64
9182 | OPTI_TYPE_NOT_ITERATED
;
9189 case 1800: hash_type
= HASH_TYPE_SHA512
;
9190 salt_type
= SALT_TYPE_EMBEDDED
;
9191 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9192 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9193 kern_type
= KERN_TYPE_SHA512CRYPT
;
9194 dgst_size
= DGST_SIZE_8_8
;
9195 parse_func
= sha512crypt_parse_hash
;
9196 sort_by_digest
= sort_by_digest_8_8
;
9197 opti_type
= OPTI_TYPE_ZERO_BYTE
9198 | OPTI_TYPE_USES_BITS_64
;
9205 case 2000: hash_type
= HASH_TYPE_STDOUT
;
9206 salt_type
= SALT_TYPE_NONE
;
9207 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9208 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9209 kern_type
= KERN_TYPE_STDOUT
;
9210 dgst_size
= DGST_SIZE_4_4
;
9212 sort_by_digest
= NULL
;
9220 case 2100: hash_type
= HASH_TYPE_DCC2
;
9221 salt_type
= SALT_TYPE_EMBEDDED
;
9222 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9223 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9224 | OPTS_TYPE_ST_LOWER
9225 | OPTS_TYPE_ST_UNICODE
;
9226 kern_type
= KERN_TYPE_DCC2
;
9227 dgst_size
= DGST_SIZE_4_4
;
9228 parse_func
= dcc2_parse_hash
;
9229 sort_by_digest
= sort_by_digest_4_4
;
9230 opti_type
= OPTI_TYPE_ZERO_BYTE
9231 | OPTI_TYPE_SLOW_HASH_SIMD
;
9238 case 2400: hash_type
= HASH_TYPE_MD5
;
9239 salt_type
= SALT_TYPE_NONE
;
9240 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9242 kern_type
= KERN_TYPE_MD5PIX
;
9243 dgst_size
= DGST_SIZE_4_4
;
9244 parse_func
= md5pix_parse_hash
;
9245 sort_by_digest
= sort_by_digest_4_4
;
9246 opti_type
= OPTI_TYPE_ZERO_BYTE
9247 | OPTI_TYPE_PRECOMPUTE_INIT
9248 | OPTI_TYPE_PRECOMPUTE_MERKLE
9249 | OPTI_TYPE_EARLY_SKIP
9250 | OPTI_TYPE_NOT_ITERATED
9251 | OPTI_TYPE_NOT_SALTED
;
9258 case 2410: hash_type
= HASH_TYPE_MD5
;
9259 salt_type
= SALT_TYPE_INTERN
;
9260 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9261 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9262 kern_type
= KERN_TYPE_MD5ASA
;
9263 dgst_size
= DGST_SIZE_4_4
;
9264 parse_func
= md5asa_parse_hash
;
9265 sort_by_digest
= sort_by_digest_4_4
;
9266 opti_type
= OPTI_TYPE_ZERO_BYTE
9267 | OPTI_TYPE_PRECOMPUTE_INIT
9268 | OPTI_TYPE_PRECOMPUTE_MERKLE
9269 | OPTI_TYPE_EARLY_SKIP
9270 | OPTI_TYPE_NOT_ITERATED
;
9277 case 2500: hash_type
= HASH_TYPE_WPA
;
9278 salt_type
= SALT_TYPE_EMBEDDED
;
9279 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9280 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9281 kern_type
= KERN_TYPE_WPA
;
9282 dgst_size
= DGST_SIZE_4_4
;
9283 parse_func
= wpa_parse_hash
;
9284 sort_by_digest
= sort_by_digest_4_4
;
9285 opti_type
= OPTI_TYPE_ZERO_BYTE
9286 | OPTI_TYPE_SLOW_HASH_SIMD
;
9293 case 2600: hash_type
= HASH_TYPE_MD5
;
9294 salt_type
= SALT_TYPE_VIRTUAL
;
9295 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9296 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9297 | OPTS_TYPE_PT_ADD80
9298 | OPTS_TYPE_PT_ADDBITS14
9299 | OPTS_TYPE_ST_ADD80
;
9300 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9301 dgst_size
= DGST_SIZE_4_4
;
9302 parse_func
= md5md5_parse_hash
;
9303 sort_by_digest
= sort_by_digest_4_4
;
9304 opti_type
= OPTI_TYPE_ZERO_BYTE
9305 | OPTI_TYPE_PRECOMPUTE_INIT
9306 | OPTI_TYPE_PRECOMPUTE_MERKLE
9307 | OPTI_TYPE_EARLY_SKIP
;
9314 case 2611: hash_type
= HASH_TYPE_MD5
;
9315 salt_type
= SALT_TYPE_INTERN
;
9316 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9317 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9318 | OPTS_TYPE_PT_ADD80
9319 | OPTS_TYPE_PT_ADDBITS14
9320 | OPTS_TYPE_ST_ADD80
;
9321 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9322 dgst_size
= DGST_SIZE_4_4
;
9323 parse_func
= vb3_parse_hash
;
9324 sort_by_digest
= sort_by_digest_4_4
;
9325 opti_type
= OPTI_TYPE_ZERO_BYTE
9326 | OPTI_TYPE_PRECOMPUTE_INIT
9327 | OPTI_TYPE_PRECOMPUTE_MERKLE
9328 | OPTI_TYPE_EARLY_SKIP
;
9335 case 2612: hash_type
= HASH_TYPE_MD5
;
9336 salt_type
= SALT_TYPE_EMBEDDED
;
9337 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9338 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9339 | OPTS_TYPE_PT_ADD80
9340 | OPTS_TYPE_PT_ADDBITS14
9341 | OPTS_TYPE_ST_ADD80
9343 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9344 dgst_size
= DGST_SIZE_4_4
;
9345 parse_func
= phps_parse_hash
;
9346 sort_by_digest
= sort_by_digest_4_4
;
9347 opti_type
= OPTI_TYPE_ZERO_BYTE
9348 | OPTI_TYPE_PRECOMPUTE_INIT
9349 | OPTI_TYPE_PRECOMPUTE_MERKLE
9350 | OPTI_TYPE_EARLY_SKIP
;
9357 case 2711: hash_type
= HASH_TYPE_MD5
;
9358 salt_type
= SALT_TYPE_INTERN
;
9359 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9360 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9361 | OPTS_TYPE_PT_ADD80
9362 | OPTS_TYPE_PT_ADDBITS14
9363 | OPTS_TYPE_ST_ADD80
;
9364 kern_type
= KERN_TYPE_MD55_PWSLT2
;
9365 dgst_size
= DGST_SIZE_4_4
;
9366 parse_func
= vb30_parse_hash
;
9367 sort_by_digest
= sort_by_digest_4_4
;
9368 opti_type
= OPTI_TYPE_ZERO_BYTE
9369 | OPTI_TYPE_PRECOMPUTE_INIT
9370 | OPTI_TYPE_EARLY_SKIP
;
9377 case 2811: hash_type
= HASH_TYPE_MD5
;
9378 salt_type
= SALT_TYPE_INTERN
;
9379 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9381 | OPTS_TYPE_PT_ADD80
9382 | OPTS_TYPE_PT_ADDBITS14
;
9383 kern_type
= KERN_TYPE_MD55_SLTPW
;
9384 dgst_size
= DGST_SIZE_4_4
;
9385 parse_func
= ipb2_parse_hash
;
9386 sort_by_digest
= sort_by_digest_4_4
;
9387 opti_type
= OPTI_TYPE_ZERO_BYTE
9388 | OPTI_TYPE_PRECOMPUTE_INIT
9389 | OPTI_TYPE_EARLY_SKIP
;
9396 case 3000: hash_type
= HASH_TYPE_LM
;
9397 salt_type
= SALT_TYPE_NONE
;
9398 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9399 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9400 | OPTS_TYPE_PT_UPPER
9401 | OPTS_TYPE_PT_BITSLICE
;
9402 kern_type
= KERN_TYPE_LM
;
9403 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9404 parse_func
= lm_parse_hash
;
9405 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9406 opti_type
= OPTI_TYPE_ZERO_BYTE
9407 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9414 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
9415 salt_type
= SALT_TYPE_INTERN
;
9416 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9417 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9418 | OPTS_TYPE_PT_UPPER
9419 | OPTS_TYPE_ST_UPPER
;
9420 kern_type
= KERN_TYPE_ORACLEH
;
9421 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9422 parse_func
= oracleh_parse_hash
;
9423 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9424 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9431 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9432 salt_type
= SALT_TYPE_EMBEDDED
;
9433 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9434 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9435 | OPTS_TYPE_ST_GENERATE_LE
;
9436 kern_type
= KERN_TYPE_BCRYPT
;
9437 dgst_size
= DGST_SIZE_4_6
;
9438 parse_func
= bcrypt_parse_hash
;
9439 sort_by_digest
= sort_by_digest_4_6
;
9440 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9447 case 3710: hash_type
= HASH_TYPE_MD5
;
9448 salt_type
= SALT_TYPE_INTERN
;
9449 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9450 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9451 | OPTS_TYPE_PT_ADD80
9452 | OPTS_TYPE_PT_ADDBITS14
;
9453 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9454 dgst_size
= DGST_SIZE_4_4
;
9455 parse_func
= md5s_parse_hash
;
9456 sort_by_digest
= sort_by_digest_4_4
;
9457 opti_type
= OPTI_TYPE_ZERO_BYTE
9458 | OPTI_TYPE_PRECOMPUTE_INIT
9459 | OPTI_TYPE_PRECOMPUTE_MERKLE
9460 | OPTI_TYPE_EARLY_SKIP
;
9467 case 3711: hash_type
= HASH_TYPE_MD5
;
9468 salt_type
= SALT_TYPE_EMBEDDED
;
9469 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9470 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9471 | OPTS_TYPE_PT_ADD80
9472 | OPTS_TYPE_PT_ADDBITS14
;
9473 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9474 dgst_size
= DGST_SIZE_4_4
;
9475 parse_func
= mediawiki_b_parse_hash
;
9476 sort_by_digest
= sort_by_digest_4_4
;
9477 opti_type
= OPTI_TYPE_ZERO_BYTE
9478 | OPTI_TYPE_PRECOMPUTE_INIT
9479 | OPTI_TYPE_PRECOMPUTE_MERKLE
9480 | OPTI_TYPE_EARLY_SKIP
;
9487 case 3800: hash_type
= HASH_TYPE_MD5
;
9488 salt_type
= SALT_TYPE_INTERN
;
9489 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9491 | OPTS_TYPE_ST_ADDBITS14
;
9492 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9493 dgst_size
= DGST_SIZE_4_4
;
9494 parse_func
= md5s_parse_hash
;
9495 sort_by_digest
= sort_by_digest_4_4
;
9496 opti_type
= OPTI_TYPE_ZERO_BYTE
9497 | OPTI_TYPE_PRECOMPUTE_INIT
9498 | OPTI_TYPE_PRECOMPUTE_MERKLE
9499 | OPTI_TYPE_EARLY_SKIP
9500 | OPTI_TYPE_NOT_ITERATED
9501 | OPTI_TYPE_RAW_HASH
;
9508 case 4300: hash_type
= HASH_TYPE_MD5
;
9509 salt_type
= SALT_TYPE_VIRTUAL
;
9510 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9511 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9512 | OPTS_TYPE_PT_ADD80
9513 | OPTS_TYPE_PT_ADDBITS14
9514 | OPTS_TYPE_ST_ADD80
;
9515 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9516 dgst_size
= DGST_SIZE_4_4
;
9517 parse_func
= md5md5_parse_hash
;
9518 sort_by_digest
= sort_by_digest_4_4
;
9519 opti_type
= OPTI_TYPE_ZERO_BYTE
9520 | OPTI_TYPE_PRECOMPUTE_INIT
9521 | OPTI_TYPE_PRECOMPUTE_MERKLE
9522 | OPTI_TYPE_EARLY_SKIP
;
9530 case 4400: hash_type
= HASH_TYPE_MD5
;
9531 salt_type
= SALT_TYPE_NONE
;
9532 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9533 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9534 | OPTS_TYPE_PT_ADD80
9535 | OPTS_TYPE_PT_ADDBITS15
;
9536 kern_type
= KERN_TYPE_MD5_SHA1
;
9537 dgst_size
= DGST_SIZE_4_4
;
9538 parse_func
= md5_parse_hash
;
9539 sort_by_digest
= sort_by_digest_4_4
;
9540 opti_type
= OPTI_TYPE_ZERO_BYTE
9541 | OPTI_TYPE_PRECOMPUTE_INIT
9542 | OPTI_TYPE_PRECOMPUTE_MERKLE
9543 | OPTI_TYPE_EARLY_SKIP
9544 | OPTI_TYPE_NOT_ITERATED
9545 | OPTI_TYPE_NOT_SALTED
9546 | OPTI_TYPE_RAW_HASH
;
9553 case 4500: hash_type
= HASH_TYPE_SHA1
;
9554 salt_type
= SALT_TYPE_NONE
;
9555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9557 | OPTS_TYPE_PT_ADD80
9558 | OPTS_TYPE_PT_ADDBITS15
;
9559 kern_type
= KERN_TYPE_SHA11
;
9560 dgst_size
= DGST_SIZE_4_5
;
9561 parse_func
= sha1_parse_hash
;
9562 sort_by_digest
= sort_by_digest_4_5
;
9563 opti_type
= OPTI_TYPE_ZERO_BYTE
9564 | OPTI_TYPE_PRECOMPUTE_INIT
9565 | OPTI_TYPE_PRECOMPUTE_MERKLE
9566 | OPTI_TYPE_EARLY_SKIP
9567 | OPTI_TYPE_NOT_SALTED
;
9574 case 4700: hash_type
= HASH_TYPE_SHA1
;
9575 salt_type
= SALT_TYPE_NONE
;
9576 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9577 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9578 | OPTS_TYPE_PT_ADD80
9579 | OPTS_TYPE_PT_ADDBITS14
;
9580 kern_type
= KERN_TYPE_SHA1_MD5
;
9581 dgst_size
= DGST_SIZE_4_5
;
9582 parse_func
= sha1_parse_hash
;
9583 sort_by_digest
= sort_by_digest_4_5
;
9584 opti_type
= OPTI_TYPE_ZERO_BYTE
9585 | OPTI_TYPE_PRECOMPUTE_INIT
9586 | OPTI_TYPE_PRECOMPUTE_MERKLE
9587 | OPTI_TYPE_EARLY_SKIP
9588 | OPTI_TYPE_NOT_ITERATED
9589 | OPTI_TYPE_NOT_SALTED
9590 | OPTI_TYPE_RAW_HASH
;
9597 case 4800: hash_type
= HASH_TYPE_MD5
;
9598 salt_type
= SALT_TYPE_EMBEDDED
;
9599 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9601 | OPTS_TYPE_PT_ADDBITS14
;
9602 kern_type
= KERN_TYPE_MD5_CHAP
;
9603 dgst_size
= DGST_SIZE_4_4
;
9604 parse_func
= chap_parse_hash
;
9605 sort_by_digest
= sort_by_digest_4_4
;
9606 opti_type
= OPTI_TYPE_ZERO_BYTE
9607 | OPTI_TYPE_PRECOMPUTE_INIT
9608 | OPTI_TYPE_PRECOMPUTE_MERKLE
9609 | OPTI_TYPE_MEET_IN_MIDDLE
9610 | OPTI_TYPE_EARLY_SKIP
9611 | OPTI_TYPE_NOT_ITERATED
9612 | OPTI_TYPE_RAW_HASH
;
9619 case 4900: hash_type
= HASH_TYPE_SHA1
;
9620 salt_type
= SALT_TYPE_INTERN
;
9621 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9623 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9624 dgst_size
= DGST_SIZE_4_5
;
9625 parse_func
= sha1s_parse_hash
;
9626 sort_by_digest
= sort_by_digest_4_5
;
9627 opti_type
= OPTI_TYPE_ZERO_BYTE
9628 | OPTI_TYPE_PRECOMPUTE_INIT
9629 | OPTI_TYPE_PRECOMPUTE_MERKLE
9630 | OPTI_TYPE_EARLY_SKIP
;
9637 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9638 salt_type
= SALT_TYPE_EMBEDDED
;
9639 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9640 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9641 | OPTS_TYPE_PT_ADD01
;
9642 kern_type
= KERN_TYPE_KECCAK
;
9643 dgst_size
= DGST_SIZE_8_25
;
9644 parse_func
= keccak_parse_hash
;
9645 sort_by_digest
= sort_by_digest_8_25
;
9646 opti_type
= OPTI_TYPE_ZERO_BYTE
9647 | OPTI_TYPE_USES_BITS_64
9648 | OPTI_TYPE_RAW_HASH
;
9655 case 5100: hash_type
= HASH_TYPE_MD5H
;
9656 salt_type
= SALT_TYPE_NONE
;
9657 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9658 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9659 | OPTS_TYPE_PT_ADD80
9660 | OPTS_TYPE_PT_ADDBITS14
;
9661 kern_type
= KERN_TYPE_MD5H
;
9662 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9663 parse_func
= md5half_parse_hash
;
9664 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9665 opti_type
= OPTI_TYPE_ZERO_BYTE
9666 | OPTI_TYPE_RAW_HASH
;
9673 case 5200: hash_type
= HASH_TYPE_SHA256
;
9674 salt_type
= SALT_TYPE_EMBEDDED
;
9675 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9676 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9677 kern_type
= KERN_TYPE_PSAFE3
;
9678 dgst_size
= DGST_SIZE_4_8
;
9679 parse_func
= psafe3_parse_hash
;
9680 sort_by_digest
= sort_by_digest_4_8
;
9681 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9688 case 5300: hash_type
= HASH_TYPE_MD5
;
9689 salt_type
= SALT_TYPE_EMBEDDED
;
9690 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9691 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9692 | OPTS_TYPE_ST_ADD80
;
9693 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9694 dgst_size
= DGST_SIZE_4_4
;
9695 parse_func
= ikepsk_md5_parse_hash
;
9696 sort_by_digest
= sort_by_digest_4_4
;
9697 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9704 case 5400: hash_type
= HASH_TYPE_SHA1
;
9705 salt_type
= SALT_TYPE_EMBEDDED
;
9706 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9707 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9708 | OPTS_TYPE_ST_ADD80
;
9709 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9710 dgst_size
= DGST_SIZE_4_5
;
9711 parse_func
= ikepsk_sha1_parse_hash
;
9712 sort_by_digest
= sort_by_digest_4_5
;
9713 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9720 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9721 salt_type
= SALT_TYPE_EMBEDDED
;
9722 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9723 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9724 | OPTS_TYPE_PT_ADD80
9725 | OPTS_TYPE_PT_ADDBITS14
9726 | OPTS_TYPE_PT_UNICODE
9728 kern_type
= KERN_TYPE_NETNTLMv1
;
9729 dgst_size
= DGST_SIZE_4_4
;
9730 parse_func
= netntlmv1_parse_hash
;
9731 sort_by_digest
= sort_by_digest_4_4
;
9732 opti_type
= OPTI_TYPE_ZERO_BYTE
9733 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9740 case 5600: hash_type
= HASH_TYPE_MD5
;
9741 salt_type
= SALT_TYPE_EMBEDDED
;
9742 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9744 | OPTS_TYPE_PT_ADD80
9745 | OPTS_TYPE_PT_ADDBITS14
9746 | OPTS_TYPE_PT_UNICODE
;
9747 kern_type
= KERN_TYPE_NETNTLMv2
;
9748 dgst_size
= DGST_SIZE_4_4
;
9749 parse_func
= netntlmv2_parse_hash
;
9750 sort_by_digest
= sort_by_digest_4_4
;
9751 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9758 case 5700: hash_type
= HASH_TYPE_SHA256
;
9759 salt_type
= SALT_TYPE_NONE
;
9760 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9761 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9762 | OPTS_TYPE_PT_ADD80
9763 | OPTS_TYPE_PT_ADDBITS15
;
9764 kern_type
= KERN_TYPE_SHA256
;
9765 dgst_size
= DGST_SIZE_4_8
;
9766 parse_func
= cisco4_parse_hash
;
9767 sort_by_digest
= sort_by_digest_4_8
;
9768 opti_type
= OPTI_TYPE_ZERO_BYTE
9769 | OPTI_TYPE_PRECOMPUTE_INIT
9770 | OPTI_TYPE_PRECOMPUTE_MERKLE
9771 | OPTI_TYPE_EARLY_SKIP
9772 | OPTI_TYPE_NOT_ITERATED
9773 | OPTI_TYPE_NOT_SALTED
9774 | OPTI_TYPE_RAW_HASH
;
9781 case 5800: hash_type
= HASH_TYPE_SHA1
;
9782 salt_type
= SALT_TYPE_INTERN
;
9783 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9784 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9785 | OPTS_TYPE_ST_ADD80
;
9786 kern_type
= KERN_TYPE_ANDROIDPIN
;
9787 dgst_size
= DGST_SIZE_4_5
;
9788 parse_func
= androidpin_parse_hash
;
9789 sort_by_digest
= sort_by_digest_4_5
;
9790 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9797 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9798 salt_type
= SALT_TYPE_NONE
;
9799 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9800 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9801 | OPTS_TYPE_PT_ADD80
;
9802 kern_type
= KERN_TYPE_RIPEMD160
;
9803 dgst_size
= DGST_SIZE_4_5
;
9804 parse_func
= ripemd160_parse_hash
;
9805 sort_by_digest
= sort_by_digest_4_5
;
9806 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9813 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9814 salt_type
= SALT_TYPE_NONE
;
9815 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9816 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9817 | OPTS_TYPE_PT_ADD80
;
9818 kern_type
= KERN_TYPE_WHIRLPOOL
;
9819 dgst_size
= DGST_SIZE_4_16
;
9820 parse_func
= whirlpool_parse_hash
;
9821 sort_by_digest
= sort_by_digest_4_16
;
9822 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9829 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9830 salt_type
= SALT_TYPE_EMBEDDED
;
9831 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9832 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9833 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9834 dgst_size
= DGST_SIZE_4_5
;
9835 parse_func
= truecrypt_parse_hash_2k
;
9836 sort_by_digest
= sort_by_digest_4_5
;
9837 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9844 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9845 salt_type
= SALT_TYPE_EMBEDDED
;
9846 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9847 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9848 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9849 dgst_size
= DGST_SIZE_4_5
;
9850 parse_func
= truecrypt_parse_hash_2k
;
9851 sort_by_digest
= sort_by_digest_4_5
;
9852 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9859 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9860 salt_type
= SALT_TYPE_EMBEDDED
;
9861 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9862 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9863 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9864 dgst_size
= DGST_SIZE_4_5
;
9865 parse_func
= truecrypt_parse_hash_2k
;
9866 sort_by_digest
= sort_by_digest_4_5
;
9867 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9874 case 6221: hash_type
= HASH_TYPE_SHA512
;
9875 salt_type
= SALT_TYPE_EMBEDDED
;
9876 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9877 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9878 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9879 dgst_size
= DGST_SIZE_8_8
;
9880 parse_func
= truecrypt_parse_hash_1k
;
9881 sort_by_digest
= sort_by_digest_8_8
;
9882 opti_type
= OPTI_TYPE_ZERO_BYTE
9883 | OPTI_TYPE_USES_BITS_64
;
9890 case 6222: hash_type
= HASH_TYPE_SHA512
;
9891 salt_type
= SALT_TYPE_EMBEDDED
;
9892 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9893 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9894 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9895 dgst_size
= DGST_SIZE_8_8
;
9896 parse_func
= truecrypt_parse_hash_1k
;
9897 sort_by_digest
= sort_by_digest_8_8
;
9898 opti_type
= OPTI_TYPE_ZERO_BYTE
9899 | OPTI_TYPE_USES_BITS_64
;
9906 case 6223: hash_type
= HASH_TYPE_SHA512
;
9907 salt_type
= SALT_TYPE_EMBEDDED
;
9908 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9909 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9910 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9911 dgst_size
= DGST_SIZE_8_8
;
9912 parse_func
= truecrypt_parse_hash_1k
;
9913 sort_by_digest
= sort_by_digest_8_8
;
9914 opti_type
= OPTI_TYPE_ZERO_BYTE
9915 | OPTI_TYPE_USES_BITS_64
;
9922 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9923 salt_type
= SALT_TYPE_EMBEDDED
;
9924 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9926 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9927 dgst_size
= DGST_SIZE_4_8
;
9928 parse_func
= truecrypt_parse_hash_1k
;
9929 sort_by_digest
= sort_by_digest_4_8
;
9930 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9937 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9938 salt_type
= SALT_TYPE_EMBEDDED
;
9939 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9940 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9941 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9942 dgst_size
= DGST_SIZE_4_8
;
9943 parse_func
= truecrypt_parse_hash_1k
;
9944 sort_by_digest
= sort_by_digest_4_8
;
9945 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9952 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9953 salt_type
= SALT_TYPE_EMBEDDED
;
9954 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9955 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9956 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9957 dgst_size
= DGST_SIZE_4_8
;
9958 parse_func
= truecrypt_parse_hash_1k
;
9959 sort_by_digest
= sort_by_digest_4_8
;
9960 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9967 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9968 salt_type
= SALT_TYPE_EMBEDDED
;
9969 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9970 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9971 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9972 dgst_size
= DGST_SIZE_4_5
;
9973 parse_func
= truecrypt_parse_hash_1k
;
9974 sort_by_digest
= sort_by_digest_4_5
;
9975 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9982 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9983 salt_type
= SALT_TYPE_EMBEDDED
;
9984 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9985 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9986 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9987 dgst_size
= DGST_SIZE_4_5
;
9988 parse_func
= truecrypt_parse_hash_1k
;
9989 sort_by_digest
= sort_by_digest_4_5
;
9990 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9997 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9998 salt_type
= SALT_TYPE_EMBEDDED
;
9999 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10000 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10001 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10002 dgst_size
= DGST_SIZE_4_5
;
10003 parse_func
= truecrypt_parse_hash_1k
;
10004 sort_by_digest
= sort_by_digest_4_5
;
10005 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10012 case 6300: hash_type
= HASH_TYPE_MD5
;
10013 salt_type
= SALT_TYPE_EMBEDDED
;
10014 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10015 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10016 kern_type
= KERN_TYPE_MD5AIX
;
10017 dgst_size
= DGST_SIZE_4_4
;
10018 parse_func
= md5aix_parse_hash
;
10019 sort_by_digest
= sort_by_digest_4_4
;
10020 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10027 case 6400: hash_type
= HASH_TYPE_SHA256
;
10028 salt_type
= SALT_TYPE_EMBEDDED
;
10029 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10030 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10031 kern_type
= KERN_TYPE_SHA256AIX
;
10032 dgst_size
= DGST_SIZE_4_8
;
10033 parse_func
= sha256aix_parse_hash
;
10034 sort_by_digest
= sort_by_digest_4_8
;
10035 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10042 case 6500: hash_type
= HASH_TYPE_SHA512
;
10043 salt_type
= SALT_TYPE_EMBEDDED
;
10044 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10045 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10046 kern_type
= KERN_TYPE_SHA512AIX
;
10047 dgst_size
= DGST_SIZE_8_8
;
10048 parse_func
= sha512aix_parse_hash
;
10049 sort_by_digest
= sort_by_digest_8_8
;
10050 opti_type
= OPTI_TYPE_ZERO_BYTE
10051 | OPTI_TYPE_USES_BITS_64
;
10058 case 6600: hash_type
= HASH_TYPE_AES
;
10059 salt_type
= SALT_TYPE_EMBEDDED
;
10060 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10061 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10062 kern_type
= KERN_TYPE_AGILEKEY
;
10063 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10064 parse_func
= agilekey_parse_hash
;
10065 sort_by_digest
= sort_by_digest_4_5
;
10066 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10073 case 6700: hash_type
= HASH_TYPE_SHA1
;
10074 salt_type
= SALT_TYPE_EMBEDDED
;
10075 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10076 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10077 kern_type
= KERN_TYPE_SHA1AIX
;
10078 dgst_size
= DGST_SIZE_4_5
;
10079 parse_func
= sha1aix_parse_hash
;
10080 sort_by_digest
= sort_by_digest_4_5
;
10081 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10088 case 6800: hash_type
= HASH_TYPE_AES
;
10089 salt_type
= SALT_TYPE_EMBEDDED
;
10090 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10091 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10092 kern_type
= KERN_TYPE_LASTPASS
;
10093 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
10094 parse_func
= lastpass_parse_hash
;
10095 sort_by_digest
= sort_by_digest_4_8
;
10096 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10103 case 6900: hash_type
= HASH_TYPE_GOST
;
10104 salt_type
= SALT_TYPE_NONE
;
10105 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10106 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10107 kern_type
= KERN_TYPE_GOST
;
10108 dgst_size
= DGST_SIZE_4_8
;
10109 parse_func
= gost_parse_hash
;
10110 sort_by_digest
= sort_by_digest_4_8
;
10111 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10118 case 7100: hash_type
= HASH_TYPE_SHA512
;
10119 salt_type
= SALT_TYPE_EMBEDDED
;
10120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10122 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10123 dgst_size
= DGST_SIZE_8_16
;
10124 parse_func
= sha512osx_parse_hash
;
10125 sort_by_digest
= sort_by_digest_8_16
;
10126 opti_type
= OPTI_TYPE_ZERO_BYTE
10127 | OPTI_TYPE_USES_BITS_64
10128 | OPTI_TYPE_SLOW_HASH_SIMD
;
10135 case 7200: hash_type
= HASH_TYPE_SHA512
;
10136 salt_type
= SALT_TYPE_EMBEDDED
;
10137 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10138 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10139 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10140 dgst_size
= DGST_SIZE_8_16
;
10141 parse_func
= sha512grub_parse_hash
;
10142 sort_by_digest
= sort_by_digest_8_16
;
10143 opti_type
= OPTI_TYPE_ZERO_BYTE
10144 | OPTI_TYPE_USES_BITS_64
10145 | OPTI_TYPE_SLOW_HASH_SIMD
;
10152 case 7300: hash_type
= HASH_TYPE_SHA1
;
10153 salt_type
= SALT_TYPE_EMBEDDED
;
10154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10155 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10156 | OPTS_TYPE_ST_ADD80
10157 | OPTS_TYPE_ST_ADDBITS15
;
10158 kern_type
= KERN_TYPE_RAKP
;
10159 dgst_size
= DGST_SIZE_4_5
;
10160 parse_func
= rakp_parse_hash
;
10161 sort_by_digest
= sort_by_digest_4_5
;
10162 opti_type
= OPTI_TYPE_ZERO_BYTE
10163 | OPTI_TYPE_NOT_ITERATED
;
10170 case 7400: hash_type
= HASH_TYPE_SHA256
;
10171 salt_type
= SALT_TYPE_EMBEDDED
;
10172 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10173 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10174 kern_type
= KERN_TYPE_SHA256CRYPT
;
10175 dgst_size
= DGST_SIZE_4_8
;
10176 parse_func
= sha256crypt_parse_hash
;
10177 sort_by_digest
= sort_by_digest_4_8
;
10178 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10185 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
10186 salt_type
= SALT_TYPE_EMBEDDED
;
10187 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10189 kern_type
= KERN_TYPE_KRB5PA
;
10190 dgst_size
= DGST_SIZE_4_4
;
10191 parse_func
= krb5pa_parse_hash
;
10192 sort_by_digest
= sort_by_digest_4_4
;
10193 opti_type
= OPTI_TYPE_ZERO_BYTE
10194 | OPTI_TYPE_NOT_ITERATED
;
10201 case 7600: hash_type
= HASH_TYPE_SHA1
;
10202 salt_type
= SALT_TYPE_INTERN
;
10203 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10204 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10205 | OPTS_TYPE_PT_ADD80
10206 | OPTS_TYPE_PT_ADDBITS15
;
10207 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
10208 dgst_size
= DGST_SIZE_4_5
;
10209 parse_func
= redmine_parse_hash
;
10210 sort_by_digest
= sort_by_digest_4_5
;
10211 opti_type
= OPTI_TYPE_ZERO_BYTE
10212 | OPTI_TYPE_PRECOMPUTE_INIT
10213 | OPTI_TYPE_EARLY_SKIP
10214 | OPTI_TYPE_NOT_ITERATED
10215 | OPTI_TYPE_PREPENDED_SALT
;
10222 case 7700: hash_type
= HASH_TYPE_SAPB
;
10223 salt_type
= SALT_TYPE_EMBEDDED
;
10224 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10225 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10226 | OPTS_TYPE_PT_UPPER
10227 | OPTS_TYPE_ST_UPPER
;
10228 kern_type
= KERN_TYPE_SAPB
;
10229 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10230 parse_func
= sapb_parse_hash
;
10231 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10232 opti_type
= OPTI_TYPE_ZERO_BYTE
10233 | OPTI_TYPE_PRECOMPUTE_INIT
10234 | OPTI_TYPE_NOT_ITERATED
;
10241 case 7800: hash_type
= HASH_TYPE_SAPG
;
10242 salt_type
= SALT_TYPE_EMBEDDED
;
10243 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10244 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10245 | OPTS_TYPE_ST_ADD80
10246 | OPTS_TYPE_ST_UPPER
;
10247 kern_type
= KERN_TYPE_SAPG
;
10248 dgst_size
= DGST_SIZE_4_5
;
10249 parse_func
= sapg_parse_hash
;
10250 sort_by_digest
= sort_by_digest_4_5
;
10251 opti_type
= OPTI_TYPE_ZERO_BYTE
10252 | OPTI_TYPE_PRECOMPUTE_INIT
10253 | OPTI_TYPE_NOT_ITERATED
;
10260 case 7900: hash_type
= HASH_TYPE_SHA512
;
10261 salt_type
= SALT_TYPE_EMBEDDED
;
10262 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10263 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10264 kern_type
= KERN_TYPE_DRUPAL7
;
10265 dgst_size
= DGST_SIZE_8_8
;
10266 parse_func
= drupal7_parse_hash
;
10267 sort_by_digest
= sort_by_digest_8_8
;
10268 opti_type
= OPTI_TYPE_ZERO_BYTE
10269 | OPTI_TYPE_USES_BITS_64
;
10276 case 8000: hash_type
= HASH_TYPE_SHA256
;
10277 salt_type
= SALT_TYPE_EMBEDDED
;
10278 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10279 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10280 | OPTS_TYPE_PT_UNICODE
10281 | OPTS_TYPE_ST_ADD80
10282 | OPTS_TYPE_ST_HEX
;
10283 kern_type
= KERN_TYPE_SYBASEASE
;
10284 dgst_size
= DGST_SIZE_4_8
;
10285 parse_func
= sybasease_parse_hash
;
10286 sort_by_digest
= sort_by_digest_4_8
;
10287 opti_type
= OPTI_TYPE_ZERO_BYTE
10288 | OPTI_TYPE_PRECOMPUTE_INIT
10289 | OPTI_TYPE_EARLY_SKIP
10290 | OPTI_TYPE_NOT_ITERATED
10291 | OPTI_TYPE_RAW_HASH
;
10298 case 8100: hash_type
= HASH_TYPE_SHA1
;
10299 salt_type
= SALT_TYPE_EMBEDDED
;
10300 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10301 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
10302 kern_type
= KERN_TYPE_NETSCALER
;
10303 dgst_size
= DGST_SIZE_4_5
;
10304 parse_func
= netscaler_parse_hash
;
10305 sort_by_digest
= sort_by_digest_4_5
;
10306 opti_type
= OPTI_TYPE_ZERO_BYTE
10307 | OPTI_TYPE_PRECOMPUTE_INIT
10308 | OPTI_TYPE_PRECOMPUTE_MERKLE
10309 | OPTI_TYPE_EARLY_SKIP
10310 | OPTI_TYPE_NOT_ITERATED
10311 | OPTI_TYPE_PREPENDED_SALT
10312 | OPTI_TYPE_RAW_HASH
;
10319 case 8200: hash_type
= HASH_TYPE_SHA256
;
10320 salt_type
= SALT_TYPE_EMBEDDED
;
10321 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10322 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10323 kern_type
= KERN_TYPE_CLOUDKEY
;
10324 dgst_size
= DGST_SIZE_4_8
;
10325 parse_func
= cloudkey_parse_hash
;
10326 sort_by_digest
= sort_by_digest_4_8
;
10327 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10334 case 8300: hash_type
= HASH_TYPE_SHA1
;
10335 salt_type
= SALT_TYPE_EMBEDDED
;
10336 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10337 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10339 | OPTS_TYPE_ST_ADD80
;
10340 kern_type
= KERN_TYPE_NSEC3
;
10341 dgst_size
= DGST_SIZE_4_5
;
10342 parse_func
= nsec3_parse_hash
;
10343 sort_by_digest
= sort_by_digest_4_5
;
10344 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10351 case 8400: hash_type
= HASH_TYPE_SHA1
;
10352 salt_type
= SALT_TYPE_INTERN
;
10353 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10354 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10355 | OPTS_TYPE_PT_ADD80
10356 | OPTS_TYPE_PT_ADDBITS15
;
10357 kern_type
= KERN_TYPE_WBB3
;
10358 dgst_size
= DGST_SIZE_4_5
;
10359 parse_func
= wbb3_parse_hash
;
10360 sort_by_digest
= sort_by_digest_4_5
;
10361 opti_type
= OPTI_TYPE_ZERO_BYTE
10362 | OPTI_TYPE_PRECOMPUTE_INIT
10363 | OPTI_TYPE_NOT_ITERATED
;
10370 case 8500: hash_type
= HASH_TYPE_DESRACF
;
10371 salt_type
= SALT_TYPE_EMBEDDED
;
10372 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10373 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10374 | OPTS_TYPE_ST_UPPER
;
10375 kern_type
= KERN_TYPE_RACF
;
10376 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10377 parse_func
= racf_parse_hash
;
10378 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10379 opti_type
= OPTI_TYPE_ZERO_BYTE
10380 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10387 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
10388 salt_type
= SALT_TYPE_NONE
;
10389 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10390 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10391 kern_type
= KERN_TYPE_LOTUS5
;
10392 dgst_size
= DGST_SIZE_4_4
;
10393 parse_func
= lotus5_parse_hash
;
10394 sort_by_digest
= sort_by_digest_4_4
;
10395 opti_type
= OPTI_TYPE_EARLY_SKIP
10396 | OPTI_TYPE_NOT_ITERATED
10397 | OPTI_TYPE_NOT_SALTED
10398 | OPTI_TYPE_RAW_HASH
;
10405 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
10406 salt_type
= SALT_TYPE_EMBEDDED
;
10407 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10408 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10409 kern_type
= KERN_TYPE_LOTUS6
;
10410 dgst_size
= DGST_SIZE_4_4
;
10411 parse_func
= lotus6_parse_hash
;
10412 sort_by_digest
= sort_by_digest_4_4
;
10413 opti_type
= OPTI_TYPE_EARLY_SKIP
10414 | OPTI_TYPE_NOT_ITERATED
10415 | OPTI_TYPE_RAW_HASH
;
10422 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
10423 salt_type
= SALT_TYPE_EMBEDDED
;
10424 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10425 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10426 kern_type
= KERN_TYPE_ANDROIDFDE
;
10427 dgst_size
= DGST_SIZE_4_4
;
10428 parse_func
= androidfde_parse_hash
;
10429 sort_by_digest
= sort_by_digest_4_4
;
10430 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10437 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10438 salt_type
= SALT_TYPE_EMBEDDED
;
10439 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10440 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10441 kern_type
= KERN_TYPE_SCRYPT
;
10442 dgst_size
= DGST_SIZE_4_8
;
10443 parse_func
= scrypt_parse_hash
;
10444 sort_by_digest
= sort_by_digest_4_8
;
10445 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10452 case 9000: hash_type
= HASH_TYPE_SHA1
;
10453 salt_type
= SALT_TYPE_EMBEDDED
;
10454 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10455 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10456 | OPTS_TYPE_ST_GENERATE_LE
;
10457 kern_type
= KERN_TYPE_PSAFE2
;
10458 dgst_size
= DGST_SIZE_4_5
;
10459 parse_func
= psafe2_parse_hash
;
10460 sort_by_digest
= sort_by_digest_4_5
;
10461 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10468 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10469 salt_type
= SALT_TYPE_EMBEDDED
;
10470 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10471 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10472 kern_type
= KERN_TYPE_LOTUS8
;
10473 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10474 parse_func
= lotus8_parse_hash
;
10475 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10476 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10483 case 9200: hash_type
= HASH_TYPE_SHA256
;
10484 salt_type
= SALT_TYPE_EMBEDDED
;
10485 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10486 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10487 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10488 dgst_size
= DGST_SIZE_4_32
;
10489 parse_func
= cisco8_parse_hash
;
10490 sort_by_digest
= sort_by_digest_4_32
;
10491 opti_type
= OPTI_TYPE_ZERO_BYTE
10492 | OPTI_TYPE_SLOW_HASH_SIMD
;
10499 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
10500 salt_type
= SALT_TYPE_EMBEDDED
;
10501 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10502 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10503 kern_type
= KERN_TYPE_SCRYPT
;
10504 dgst_size
= DGST_SIZE_4_8
;
10505 parse_func
= cisco9_parse_hash
;
10506 sort_by_digest
= sort_by_digest_4_8
;
10507 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10514 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10515 salt_type
= SALT_TYPE_EMBEDDED
;
10516 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10518 kern_type
= KERN_TYPE_OFFICE2007
;
10519 dgst_size
= DGST_SIZE_4_4
;
10520 parse_func
= office2007_parse_hash
;
10521 sort_by_digest
= sort_by_digest_4_4
;
10522 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10529 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10530 salt_type
= SALT_TYPE_EMBEDDED
;
10531 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10532 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10533 kern_type
= KERN_TYPE_OFFICE2010
;
10534 dgst_size
= DGST_SIZE_4_4
;
10535 parse_func
= office2010_parse_hash
;
10536 sort_by_digest
= sort_by_digest_4_4
;
10537 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10544 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10545 salt_type
= SALT_TYPE_EMBEDDED
;
10546 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10547 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10548 kern_type
= KERN_TYPE_OFFICE2013
;
10549 dgst_size
= DGST_SIZE_4_4
;
10550 parse_func
= office2013_parse_hash
;
10551 sort_by_digest
= sort_by_digest_4_4
;
10552 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10559 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10560 salt_type
= SALT_TYPE_EMBEDDED
;
10561 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10563 | OPTS_TYPE_PT_ADD80
10564 | OPTS_TYPE_PT_UNICODE
;
10565 kern_type
= KERN_TYPE_OLDOFFICE01
;
10566 dgst_size
= DGST_SIZE_4_4
;
10567 parse_func
= oldoffice01_parse_hash
;
10568 sort_by_digest
= sort_by_digest_4_4
;
10569 opti_type
= OPTI_TYPE_ZERO_BYTE
10570 | OPTI_TYPE_PRECOMPUTE_INIT
10571 | OPTI_TYPE_NOT_ITERATED
;
10578 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10579 salt_type
= SALT_TYPE_EMBEDDED
;
10580 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10582 | OPTS_TYPE_PT_ADD80
;
10583 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10584 dgst_size
= DGST_SIZE_4_4
;
10585 parse_func
= oldoffice01cm1_parse_hash
;
10586 sort_by_digest
= sort_by_digest_4_4
;
10587 opti_type
= OPTI_TYPE_ZERO_BYTE
10588 | OPTI_TYPE_PRECOMPUTE_INIT
10589 | OPTI_TYPE_NOT_ITERATED
;
10596 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10597 salt_type
= SALT_TYPE_EMBEDDED
;
10598 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10599 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10600 | OPTS_TYPE_PT_ADD80
10601 | OPTS_TYPE_PT_UNICODE
10602 | OPTS_TYPE_PT_NEVERCRACK
;
10603 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10604 dgst_size
= DGST_SIZE_4_4
;
10605 parse_func
= oldoffice01cm2_parse_hash
;
10606 sort_by_digest
= sort_by_digest_4_4
;
10607 opti_type
= OPTI_TYPE_ZERO_BYTE
10608 | OPTI_TYPE_PRECOMPUTE_INIT
10609 | OPTI_TYPE_NOT_ITERATED
;
10616 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10617 salt_type
= SALT_TYPE_EMBEDDED
;
10618 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10619 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10620 | OPTS_TYPE_PT_ADD80
10621 | OPTS_TYPE_PT_UNICODE
;
10622 kern_type
= KERN_TYPE_OLDOFFICE34
;
10623 dgst_size
= DGST_SIZE_4_4
;
10624 parse_func
= oldoffice34_parse_hash
;
10625 sort_by_digest
= sort_by_digest_4_4
;
10626 opti_type
= OPTI_TYPE_ZERO_BYTE
10627 | OPTI_TYPE_PRECOMPUTE_INIT
10628 | OPTI_TYPE_NOT_ITERATED
;
10635 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10636 salt_type
= SALT_TYPE_EMBEDDED
;
10637 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10638 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10639 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10640 dgst_size
= DGST_SIZE_4_4
;
10641 parse_func
= oldoffice34cm1_parse_hash
;
10642 sort_by_digest
= sort_by_digest_4_4
;
10643 opti_type
= OPTI_TYPE_ZERO_BYTE
10644 | OPTI_TYPE_PRECOMPUTE_INIT
10645 | OPTI_TYPE_NOT_ITERATED
;
10652 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10653 salt_type
= SALT_TYPE_EMBEDDED
;
10654 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10655 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10656 | OPTS_TYPE_PT_ADD80
10657 | OPTS_TYPE_PT_UNICODE
10658 | OPTS_TYPE_PT_NEVERCRACK
;
10659 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10660 dgst_size
= DGST_SIZE_4_4
;
10661 parse_func
= oldoffice34cm2_parse_hash
;
10662 sort_by_digest
= sort_by_digest_4_4
;
10663 opti_type
= OPTI_TYPE_ZERO_BYTE
10664 | OPTI_TYPE_PRECOMPUTE_INIT
10665 | OPTI_TYPE_NOT_ITERATED
;
10672 case 9900: hash_type
= HASH_TYPE_MD5
;
10673 salt_type
= SALT_TYPE_NONE
;
10674 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10675 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10676 kern_type
= KERN_TYPE_RADMIN2
;
10677 dgst_size
= DGST_SIZE_4_4
;
10678 parse_func
= radmin2_parse_hash
;
10679 sort_by_digest
= sort_by_digest_4_4
;
10680 opti_type
= OPTI_TYPE_ZERO_BYTE
10681 | OPTI_TYPE_PRECOMPUTE_INIT
10682 | OPTI_TYPE_EARLY_SKIP
10683 | OPTI_TYPE_NOT_ITERATED
10684 | OPTI_TYPE_NOT_SALTED
;
10691 case 10000: hash_type
= HASH_TYPE_SHA256
;
10692 salt_type
= SALT_TYPE_EMBEDDED
;
10693 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10694 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10695 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10696 dgst_size
= DGST_SIZE_4_32
;
10697 parse_func
= djangopbkdf2_parse_hash
;
10698 sort_by_digest
= sort_by_digest_4_32
;
10699 opti_type
= OPTI_TYPE_ZERO_BYTE
10700 | OPTI_TYPE_SLOW_HASH_SIMD
;
10707 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10708 salt_type
= SALT_TYPE_EMBEDDED
;
10709 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10710 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10711 kern_type
= KERN_TYPE_SIPHASH
;
10712 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10713 parse_func
= siphash_parse_hash
;
10714 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10715 opti_type
= OPTI_TYPE_ZERO_BYTE
10716 | OPTI_TYPE_NOT_ITERATED
10717 | OPTI_TYPE_RAW_HASH
;
10724 case 10200: hash_type
= HASH_TYPE_MD5
;
10725 salt_type
= SALT_TYPE_EMBEDDED
;
10726 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10728 | OPTS_TYPE_ST_ADD80
10729 | OPTS_TYPE_ST_ADDBITS14
;
10730 kern_type
= KERN_TYPE_HMACMD5_PW
;
10731 dgst_size
= DGST_SIZE_4_4
;
10732 parse_func
= crammd5_parse_hash
;
10733 sort_by_digest
= sort_by_digest_4_4
;
10734 opti_type
= OPTI_TYPE_ZERO_BYTE
10735 | OPTI_TYPE_NOT_ITERATED
;
10742 case 10300: hash_type
= HASH_TYPE_SHA1
;
10743 salt_type
= SALT_TYPE_EMBEDDED
;
10744 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10745 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10746 kern_type
= KERN_TYPE_SAPH_SHA1
;
10747 dgst_size
= DGST_SIZE_4_5
;
10748 parse_func
= saph_sha1_parse_hash
;
10749 sort_by_digest
= sort_by_digest_4_5
;
10750 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10757 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10758 salt_type
= SALT_TYPE_EMBEDDED
;
10759 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10760 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10761 kern_type
= KERN_TYPE_PDF11
;
10762 dgst_size
= DGST_SIZE_4_4
;
10763 parse_func
= pdf11_parse_hash
;
10764 sort_by_digest
= sort_by_digest_4_4
;
10765 opti_type
= OPTI_TYPE_ZERO_BYTE
10766 | OPTI_TYPE_NOT_ITERATED
;
10773 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10774 salt_type
= SALT_TYPE_EMBEDDED
;
10775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10777 kern_type
= KERN_TYPE_PDF11CM1
;
10778 dgst_size
= DGST_SIZE_4_4
;
10779 parse_func
= pdf11cm1_parse_hash
;
10780 sort_by_digest
= sort_by_digest_4_4
;
10781 opti_type
= OPTI_TYPE_ZERO_BYTE
10782 | OPTI_TYPE_NOT_ITERATED
;
10789 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10790 salt_type
= SALT_TYPE_EMBEDDED
;
10791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10793 kern_type
= KERN_TYPE_PDF11CM2
;
10794 dgst_size
= DGST_SIZE_4_4
;
10795 parse_func
= pdf11cm2_parse_hash
;
10796 sort_by_digest
= sort_by_digest_4_4
;
10797 opti_type
= OPTI_TYPE_ZERO_BYTE
10798 | OPTI_TYPE_NOT_ITERATED
;
10805 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10806 salt_type
= SALT_TYPE_EMBEDDED
;
10807 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10808 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10809 kern_type
= KERN_TYPE_PDF14
;
10810 dgst_size
= DGST_SIZE_4_4
;
10811 parse_func
= pdf14_parse_hash
;
10812 sort_by_digest
= sort_by_digest_4_4
;
10813 opti_type
= OPTI_TYPE_ZERO_BYTE
10814 | OPTI_TYPE_NOT_ITERATED
;
10821 case 10600: hash_type
= HASH_TYPE_SHA256
;
10822 salt_type
= SALT_TYPE_EMBEDDED
;
10823 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10824 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10825 | OPTS_TYPE_ST_ADD80
10826 | OPTS_TYPE_ST_ADDBITS15
10827 | OPTS_TYPE_HASH_COPY
;
10828 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10829 dgst_size
= DGST_SIZE_4_8
;
10830 parse_func
= pdf17l3_parse_hash
;
10831 sort_by_digest
= sort_by_digest_4_8
;
10832 opti_type
= OPTI_TYPE_ZERO_BYTE
10833 | OPTI_TYPE_PRECOMPUTE_INIT
10834 | OPTI_TYPE_PRECOMPUTE_MERKLE
10835 | OPTI_TYPE_EARLY_SKIP
10836 | OPTI_TYPE_NOT_ITERATED
10837 | OPTI_TYPE_APPENDED_SALT
10838 | OPTI_TYPE_RAW_HASH
;
10845 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10846 salt_type
= SALT_TYPE_EMBEDDED
;
10847 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10848 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10849 | OPTS_TYPE_HASH_COPY
;
10850 kern_type
= KERN_TYPE_PDF17L8
;
10851 dgst_size
= DGST_SIZE_4_8
;
10852 parse_func
= pdf17l8_parse_hash
;
10853 sort_by_digest
= sort_by_digest_4_8
;
10854 opti_type
= OPTI_TYPE_ZERO_BYTE
10855 | OPTI_TYPE_NOT_ITERATED
;
10862 case 10800: hash_type
= HASH_TYPE_SHA384
;
10863 salt_type
= SALT_TYPE_NONE
;
10864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10865 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10866 | OPTS_TYPE_PT_ADD80
10867 | OPTS_TYPE_PT_ADDBITS15
;
10868 kern_type
= KERN_TYPE_SHA384
;
10869 dgst_size
= DGST_SIZE_8_8
;
10870 parse_func
= sha384_parse_hash
;
10871 sort_by_digest
= sort_by_digest_8_8
;
10872 opti_type
= OPTI_TYPE_ZERO_BYTE
10873 | OPTI_TYPE_PRECOMPUTE_INIT
10874 | OPTI_TYPE_PRECOMPUTE_MERKLE
10875 | OPTI_TYPE_EARLY_SKIP
10876 | OPTI_TYPE_NOT_ITERATED
10877 | OPTI_TYPE_NOT_SALTED
10878 | OPTI_TYPE_USES_BITS_64
10879 | OPTI_TYPE_RAW_HASH
;
10886 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10887 salt_type
= SALT_TYPE_EMBEDDED
;
10888 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10889 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10890 | OPTS_TYPE_ST_BASE64
10891 | OPTS_TYPE_HASH_COPY
;
10892 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10893 dgst_size
= DGST_SIZE_4_32
;
10894 parse_func
= pbkdf2_sha256_parse_hash
;
10895 sort_by_digest
= sort_by_digest_4_32
;
10896 opti_type
= OPTI_TYPE_ZERO_BYTE
10897 | OPTI_TYPE_SLOW_HASH_SIMD
;
10904 case 11000: hash_type
= HASH_TYPE_MD5
;
10905 salt_type
= SALT_TYPE_INTERN
;
10906 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10907 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10908 | OPTS_TYPE_PT_ADD80
;
10909 kern_type
= KERN_TYPE_PRESTASHOP
;
10910 dgst_size
= DGST_SIZE_4_4
;
10911 parse_func
= prestashop_parse_hash
;
10912 sort_by_digest
= sort_by_digest_4_4
;
10913 opti_type
= OPTI_TYPE_ZERO_BYTE
10914 | OPTI_TYPE_PRECOMPUTE_INIT
10915 | OPTI_TYPE_NOT_ITERATED
10916 | OPTI_TYPE_PREPENDED_SALT
;
10923 case 11100: hash_type
= HASH_TYPE_MD5
;
10924 salt_type
= SALT_TYPE_EMBEDDED
;
10925 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10926 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10927 | OPTS_TYPE_ST_ADD80
;
10928 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10929 dgst_size
= DGST_SIZE_4_4
;
10930 parse_func
= postgresql_auth_parse_hash
;
10931 sort_by_digest
= sort_by_digest_4_4
;
10932 opti_type
= OPTI_TYPE_ZERO_BYTE
10933 | OPTI_TYPE_PRECOMPUTE_INIT
10934 | OPTI_TYPE_PRECOMPUTE_MERKLE
10935 | OPTI_TYPE_EARLY_SKIP
;
10942 case 11200: hash_type
= HASH_TYPE_SHA1
;
10943 salt_type
= SALT_TYPE_EMBEDDED
;
10944 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10945 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10946 | OPTS_TYPE_PT_ADD80
10947 | OPTS_TYPE_ST_HEX
;
10948 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10949 dgst_size
= DGST_SIZE_4_5
;
10950 parse_func
= mysql_auth_parse_hash
;
10951 sort_by_digest
= sort_by_digest_4_5
;
10952 opti_type
= OPTI_TYPE_ZERO_BYTE
10953 | OPTI_TYPE_EARLY_SKIP
;
10960 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10961 salt_type
= SALT_TYPE_EMBEDDED
;
10962 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10965 | OPTS_TYPE_ST_ADD80
;
10966 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10967 dgst_size
= DGST_SIZE_4_4
;
10968 parse_func
= bitcoin_wallet_parse_hash
;
10969 sort_by_digest
= sort_by_digest_4_4
;
10970 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10977 case 11400: hash_type
= HASH_TYPE_MD5
;
10978 salt_type
= SALT_TYPE_EMBEDDED
;
10979 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10980 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10981 | OPTS_TYPE_PT_ADD80
10982 | OPTS_TYPE_HASH_COPY
;
10983 kern_type
= KERN_TYPE_SIP_AUTH
;
10984 dgst_size
= DGST_SIZE_4_4
;
10985 parse_func
= sip_auth_parse_hash
;
10986 sort_by_digest
= sort_by_digest_4_4
;
10987 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10994 case 11500: hash_type
= HASH_TYPE_CRC32
;
10995 salt_type
= SALT_TYPE_INTERN
;
10996 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10997 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10998 | OPTS_TYPE_ST_GENERATE_LE
10999 | OPTS_TYPE_ST_HEX
;
11000 kern_type
= KERN_TYPE_CRC32
;
11001 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11002 parse_func
= crc32_parse_hash
;
11003 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11004 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11011 case 11600: hash_type
= HASH_TYPE_AES
;
11012 salt_type
= SALT_TYPE_EMBEDDED
;
11013 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11014 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11015 | OPTS_TYPE_PT_NEVERCRACK
;
11016 kern_type
= KERN_TYPE_SEVEN_ZIP
;
11017 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11018 parse_func
= seven_zip_parse_hash
;
11019 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11020 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11027 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
11028 salt_type
= SALT_TYPE_NONE
;
11029 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11030 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11031 | OPTS_TYPE_PT_ADD01
;
11032 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
11033 dgst_size
= DGST_SIZE_4_8
;
11034 parse_func
= gost2012sbog_256_parse_hash
;
11035 sort_by_digest
= sort_by_digest_4_8
;
11036 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11043 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
11044 salt_type
= SALT_TYPE_NONE
;
11045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11047 | OPTS_TYPE_PT_ADD01
;
11048 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
11049 dgst_size
= DGST_SIZE_4_16
;
11050 parse_func
= gost2012sbog_512_parse_hash
;
11051 sort_by_digest
= sort_by_digest_4_16
;
11052 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11059 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
11060 salt_type
= SALT_TYPE_EMBEDDED
;
11061 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11062 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11063 | OPTS_TYPE_ST_BASE64
11064 | OPTS_TYPE_HASH_COPY
;
11065 kern_type
= KERN_TYPE_PBKDF2_MD5
;
11066 dgst_size
= DGST_SIZE_4_32
;
11067 parse_func
= pbkdf2_md5_parse_hash
;
11068 sort_by_digest
= sort_by_digest_4_32
;
11069 opti_type
= OPTI_TYPE_ZERO_BYTE
11070 | OPTI_TYPE_SLOW_HASH_SIMD
;
11077 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11078 salt_type
= SALT_TYPE_EMBEDDED
;
11079 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11081 | OPTS_TYPE_ST_BASE64
11082 | OPTS_TYPE_HASH_COPY
;
11083 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
11084 dgst_size
= DGST_SIZE_4_32
;
11085 parse_func
= pbkdf2_sha1_parse_hash
;
11086 sort_by_digest
= sort_by_digest_4_32
;
11087 opti_type
= OPTI_TYPE_ZERO_BYTE
11088 | OPTI_TYPE_SLOW_HASH_SIMD
;
11095 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
11096 salt_type
= SALT_TYPE_EMBEDDED
;
11097 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11099 | OPTS_TYPE_ST_BASE64
11100 | OPTS_TYPE_HASH_COPY
;
11101 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
11102 dgst_size
= DGST_SIZE_8_16
;
11103 parse_func
= pbkdf2_sha512_parse_hash
;
11104 sort_by_digest
= sort_by_digest_8_16
;
11105 opti_type
= OPTI_TYPE_ZERO_BYTE
11106 | OPTI_TYPE_USES_BITS_64
11107 | OPTI_TYPE_SLOW_HASH_SIMD
;
11114 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
11115 salt_type
= SALT_TYPE_EMBEDDED
;
11116 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11117 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11118 kern_type
= KERN_TYPE_ECRYPTFS
;
11119 dgst_size
= DGST_SIZE_8_8
;
11120 parse_func
= ecryptfs_parse_hash
;
11121 sort_by_digest
= sort_by_digest_8_8
;
11122 opti_type
= OPTI_TYPE_ZERO_BYTE
11123 | OPTI_TYPE_USES_BITS_64
;
11130 case 12300: hash_type
= HASH_TYPE_ORACLET
;
11131 salt_type
= SALT_TYPE_EMBEDDED
;
11132 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11133 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11134 kern_type
= KERN_TYPE_ORACLET
;
11135 dgst_size
= DGST_SIZE_8_16
;
11136 parse_func
= oraclet_parse_hash
;
11137 sort_by_digest
= sort_by_digest_8_16
;
11138 opti_type
= OPTI_TYPE_ZERO_BYTE
11139 | OPTI_TYPE_USES_BITS_64
;
11146 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
11147 salt_type
= SALT_TYPE_EMBEDDED
;
11148 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11149 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11150 kern_type
= KERN_TYPE_BSDICRYPT
;
11151 dgst_size
= DGST_SIZE_4_4
;
11152 parse_func
= bsdicrypt_parse_hash
;
11153 sort_by_digest
= sort_by_digest_4_4
;
11154 opti_type
= OPTI_TYPE_ZERO_BYTE
11155 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
11162 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
11163 salt_type
= SALT_TYPE_EMBEDDED
;
11164 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11166 kern_type
= KERN_TYPE_RAR3
;
11167 dgst_size
= DGST_SIZE_4_4
;
11168 parse_func
= rar3hp_parse_hash
;
11169 sort_by_digest
= sort_by_digest_4_4
;
11170 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11177 case 12600: hash_type
= HASH_TYPE_SHA256
;
11178 salt_type
= SALT_TYPE_INTERN
;
11179 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11180 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11181 | OPTS_TYPE_PT_ADD80
;
11182 kern_type
= KERN_TYPE_CF10
;
11183 dgst_size
= DGST_SIZE_4_8
;
11184 parse_func
= cf10_parse_hash
;
11185 sort_by_digest
= sort_by_digest_4_8
;
11186 opti_type
= OPTI_TYPE_ZERO_BYTE
11187 | OPTI_TYPE_PRECOMPUTE_INIT
11188 | OPTI_TYPE_EARLY_SKIP
11189 | OPTI_TYPE_NOT_ITERATED
;
11196 case 12700: hash_type
= HASH_TYPE_AES
;
11197 salt_type
= SALT_TYPE_EMBEDDED
;
11198 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11199 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11200 | OPTS_TYPE_HASH_COPY
;
11201 kern_type
= KERN_TYPE_MYWALLET
;
11202 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
11203 parse_func
= mywallet_parse_hash
;
11204 sort_by_digest
= sort_by_digest_4_5
;
11205 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11212 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11213 salt_type
= SALT_TYPE_EMBEDDED
;
11214 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11216 kern_type
= KERN_TYPE_MS_DRSR
;
11217 dgst_size
= DGST_SIZE_4_8
;
11218 parse_func
= ms_drsr_parse_hash
;
11219 sort_by_digest
= sort_by_digest_4_8
;
11220 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11227 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11228 salt_type
= SALT_TYPE_EMBEDDED
;
11229 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11230 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11231 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
11232 dgst_size
= DGST_SIZE_4_8
;
11233 parse_func
= androidfde_samsung_parse_hash
;
11234 sort_by_digest
= sort_by_digest_4_8
;
11235 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11242 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11243 salt_type
= SALT_TYPE_EMBEDDED
;
11244 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11245 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11246 kern_type
= KERN_TYPE_RAR5
;
11247 dgst_size
= DGST_SIZE_4_4
;
11248 parse_func
= rar5_parse_hash
;
11249 sort_by_digest
= sort_by_digest_4_4
;
11250 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11257 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
11258 salt_type
= SALT_TYPE_EMBEDDED
;
11259 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11260 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11261 kern_type
= KERN_TYPE_KRB5TGS
;
11262 dgst_size
= DGST_SIZE_4_4
;
11263 parse_func
= krb5tgs_parse_hash
;
11264 sort_by_digest
= sort_by_digest_4_4
;
11265 opti_type
= OPTI_TYPE_ZERO_BYTE
11266 | OPTI_TYPE_NOT_ITERATED
;
11273 case 13200: hash_type
= HASH_TYPE_AES
;
11274 salt_type
= SALT_TYPE_EMBEDDED
;
11275 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11276 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11277 kern_type
= KERN_TYPE_AXCRYPT
;
11278 dgst_size
= DGST_SIZE_4_4
;
11279 parse_func
= axcrypt_parse_hash
;
11280 sort_by_digest
= sort_by_digest_4_4
;
11281 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11288 case 13300: hash_type
= HASH_TYPE_SHA1
;
11289 salt_type
= SALT_TYPE_NONE
;
11290 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11291 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11292 | OPTS_TYPE_PT_ADD80
11293 | OPTS_TYPE_PT_ADDBITS15
;
11294 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
11295 dgst_size
= DGST_SIZE_4_5
;
11296 parse_func
= sha1axcrypt_parse_hash
;
11297 sort_by_digest
= sort_by_digest_4_5
;
11298 opti_type
= OPTI_TYPE_ZERO_BYTE
11299 | OPTI_TYPE_PRECOMPUTE_INIT
11300 | OPTI_TYPE_EARLY_SKIP
11301 | OPTI_TYPE_NOT_ITERATED
11302 | OPTI_TYPE_NOT_SALTED
;
11309 case 13400: hash_type
= HASH_TYPE_AES
;
11310 salt_type
= SALT_TYPE_EMBEDDED
;
11311 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11313 kern_type
= KERN_TYPE_KEEPASS
;
11314 dgst_size
= DGST_SIZE_4_4
;
11315 parse_func
= keepass_parse_hash
;
11316 sort_by_digest
= sort_by_digest_4_4
;
11317 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11324 case 13500: hash_type
= HASH_TYPE_SHA1
;
11325 salt_type
= SALT_TYPE_EMBEDDED
;
11326 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11327 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11328 | OPTS_TYPE_PT_UNICODE
11329 | OPTS_TYPE_PT_ADD80
;
11330 kern_type
= KERN_TYPE_PSTOKEN
;
11331 dgst_size
= DGST_SIZE_4_5
;
11332 parse_func
= pstoken_parse_hash
;
11333 sort_by_digest
= sort_by_digest_4_5
;
11334 opti_type
= OPTI_TYPE_ZERO_BYTE
11335 | OPTI_TYPE_PRECOMPUTE_INIT
11336 | OPTI_TYPE_EARLY_SKIP
11337 | OPTI_TYPE_NOT_ITERATED
11338 | OPTI_TYPE_PREPENDED_SALT
11339 | OPTI_TYPE_RAW_HASH
;
11346 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11347 salt_type
= SALT_TYPE_EMBEDDED
;
11348 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11349 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11350 kern_type
= KERN_TYPE_ZIP2
;
11351 dgst_size
= DGST_SIZE_4_4
;
11352 parse_func
= zip2_parse_hash
;
11353 sort_by_digest
= sort_by_digest_4_4
;
11354 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11361 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
11362 salt_type
= SALT_TYPE_EMBEDDED
;
11363 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11365 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11366 dgst_size
= DGST_SIZE_4_5
;
11367 parse_func
= veracrypt_parse_hash_655331
;
11368 sort_by_digest
= sort_by_digest_4_5
;
11369 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11376 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
11377 salt_type
= SALT_TYPE_EMBEDDED
;
11378 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11379 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11380 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11381 dgst_size
= DGST_SIZE_4_5
;
11382 parse_func
= veracrypt_parse_hash_655331
;
11383 sort_by_digest
= sort_by_digest_4_5
;
11384 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11391 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
11392 salt_type
= SALT_TYPE_EMBEDDED
;
11393 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11395 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11396 dgst_size
= DGST_SIZE_4_5
;
11397 parse_func
= veracrypt_parse_hash_655331
;
11398 sort_by_digest
= sort_by_digest_4_5
;
11399 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11406 case 13721: hash_type
= HASH_TYPE_SHA512
;
11407 salt_type
= SALT_TYPE_EMBEDDED
;
11408 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11409 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11410 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
11411 dgst_size
= DGST_SIZE_8_8
;
11412 parse_func
= veracrypt_parse_hash_500000
;
11413 sort_by_digest
= sort_by_digest_8_8
;
11414 opti_type
= OPTI_TYPE_ZERO_BYTE
11415 | OPTI_TYPE_USES_BITS_64
;
11422 case 13722: hash_type
= HASH_TYPE_SHA512
;
11423 salt_type
= SALT_TYPE_EMBEDDED
;
11424 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11425 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11426 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11427 dgst_size
= DGST_SIZE_8_8
;
11428 parse_func
= veracrypt_parse_hash_500000
;
11429 sort_by_digest
= sort_by_digest_8_8
;
11430 opti_type
= OPTI_TYPE_ZERO_BYTE
11431 | OPTI_TYPE_USES_BITS_64
;
11438 case 13723: hash_type
= HASH_TYPE_SHA512
;
11439 salt_type
= SALT_TYPE_EMBEDDED
;
11440 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11441 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11442 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11443 dgst_size
= DGST_SIZE_8_8
;
11444 parse_func
= veracrypt_parse_hash_500000
;
11445 sort_by_digest
= sort_by_digest_8_8
;
11446 opti_type
= OPTI_TYPE_ZERO_BYTE
11447 | OPTI_TYPE_USES_BITS_64
;
11454 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
11455 salt_type
= SALT_TYPE_EMBEDDED
;
11456 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11458 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
11459 dgst_size
= DGST_SIZE_4_8
;
11460 parse_func
= veracrypt_parse_hash_500000
;
11461 sort_by_digest
= sort_by_digest_4_8
;
11462 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11469 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
11470 salt_type
= SALT_TYPE_EMBEDDED
;
11471 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11472 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11473 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
11474 dgst_size
= DGST_SIZE_4_8
;
11475 parse_func
= veracrypt_parse_hash_500000
;
11476 sort_by_digest
= sort_by_digest_4_8
;
11477 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11484 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
11485 salt_type
= SALT_TYPE_EMBEDDED
;
11486 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11488 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
11489 dgst_size
= DGST_SIZE_4_8
;
11490 parse_func
= veracrypt_parse_hash_500000
;
11491 sort_by_digest
= sort_by_digest_4_8
;
11492 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11499 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11500 salt_type
= SALT_TYPE_EMBEDDED
;
11501 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11502 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11503 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11504 dgst_size
= DGST_SIZE_4_5
;
11505 parse_func
= veracrypt_parse_hash_327661
;
11506 sort_by_digest
= sort_by_digest_4_5
;
11507 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11514 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11515 salt_type
= SALT_TYPE_EMBEDDED
;
11516 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11518 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11519 dgst_size
= DGST_SIZE_4_5
;
11520 parse_func
= veracrypt_parse_hash_327661
;
11521 sort_by_digest
= sort_by_digest_4_5
;
11522 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11529 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11530 salt_type
= SALT_TYPE_EMBEDDED
;
11531 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11532 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11533 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11534 dgst_size
= DGST_SIZE_4_5
;
11535 parse_func
= veracrypt_parse_hash_327661
;
11536 sort_by_digest
= sort_by_digest_4_5
;
11537 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11544 case 13751: hash_type
= HASH_TYPE_SHA256
;
11545 salt_type
= SALT_TYPE_EMBEDDED
;
11546 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11547 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11548 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11549 dgst_size
= DGST_SIZE_4_8
;
11550 parse_func
= veracrypt_parse_hash_500000
;
11551 sort_by_digest
= sort_by_digest_4_8
;
11552 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11559 case 13752: hash_type
= HASH_TYPE_SHA256
;
11560 salt_type
= SALT_TYPE_EMBEDDED
;
11561 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11563 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11564 dgst_size
= DGST_SIZE_4_8
;
11565 parse_func
= veracrypt_parse_hash_500000
;
11566 sort_by_digest
= sort_by_digest_4_8
;
11567 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11574 case 13753: hash_type
= HASH_TYPE_SHA256
;
11575 salt_type
= SALT_TYPE_EMBEDDED
;
11576 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11577 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11578 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11579 dgst_size
= DGST_SIZE_4_8
;
11580 parse_func
= veracrypt_parse_hash_500000
;
11581 sort_by_digest
= sort_by_digest_4_8
;
11582 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11589 case 13761: hash_type
= HASH_TYPE_SHA256
;
11590 salt_type
= SALT_TYPE_EMBEDDED
;
11591 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11592 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11593 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11594 dgst_size
= DGST_SIZE_4_8
;
11595 parse_func
= veracrypt_parse_hash_200000
;
11596 sort_by_digest
= sort_by_digest_4_8
;
11597 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11604 case 13762: hash_type
= HASH_TYPE_SHA256
;
11605 salt_type
= SALT_TYPE_EMBEDDED
;
11606 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11607 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11608 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11609 dgst_size
= DGST_SIZE_4_8
;
11610 parse_func
= veracrypt_parse_hash_200000
;
11611 sort_by_digest
= sort_by_digest_4_8
;
11612 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11619 case 13763: hash_type
= HASH_TYPE_SHA256
;
11620 salt_type
= SALT_TYPE_EMBEDDED
;
11621 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11623 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11624 dgst_size
= DGST_SIZE_4_8
;
11625 parse_func
= veracrypt_parse_hash_200000
;
11626 sort_by_digest
= sort_by_digest_4_8
;
11627 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11634 case 13800: hash_type
= HASH_TYPE_SHA256
;
11635 salt_type
= SALT_TYPE_EMBEDDED
;
11636 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11637 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11638 | OPTS_TYPE_PT_UNICODE
;
11639 kern_type
= KERN_TYPE_WIN8PHONE
;
11640 dgst_size
= DGST_SIZE_4_8
;
11641 parse_func
= win8phone_parse_hash
;
11642 sort_by_digest
= sort_by_digest_4_8
;
11643 opti_type
= OPTI_TYPE_ZERO_BYTE
11644 | OPTI_TYPE_PRECOMPUTE_INIT
11645 | OPTI_TYPE_EARLY_SKIP
11646 | OPTI_TYPE_NOT_ITERATED
11647 | OPTI_TYPE_RAW_HASH
;
11654 default: usage_mini_print (PROGNAME
); return -1;
11661 data
.parse_func
= parse_func
;
11669 if (salt_type
== SALT_TYPE_INTERN
)
11671 opts_type
|= OPTS_TYPE_ST_HEX
;
11675 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11681 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11682 | (salt_type
== SALT_TYPE_EXTERN
)
11683 | (salt_type
== SALT_TYPE_EMBEDDED
)
11684 | (salt_type
== SALT_TYPE_VIRTUAL
));
11686 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11688 data
.hash_type
= hash_type
;
11689 data
.attack_mode
= attack_mode
;
11690 data
.attack_kern
= attack_kern
;
11691 data
.attack_exec
= attack_exec
;
11692 data
.kern_type
= kern_type
;
11693 data
.opts_type
= opts_type
;
11694 data
.dgst_size
= dgst_size
;
11695 data
.salt_type
= salt_type
;
11696 data
.isSalted
= isSalted
;
11697 data
.sort_by_digest
= sort_by_digest
;
11698 data
.dgst_pos0
= dgst_pos0
;
11699 data
.dgst_pos1
= dgst_pos1
;
11700 data
.dgst_pos2
= dgst_pos2
;
11701 data
.dgst_pos3
= dgst_pos3
;
11707 case 2500: esalt_size
= sizeof (wpa_t
); break;
11708 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11709 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11710 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11711 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11712 case 6211: esalt_size
= sizeof (tc_t
); break;
11713 case 6212: esalt_size
= sizeof (tc_t
); break;
11714 case 6213: esalt_size
= sizeof (tc_t
); break;
11715 case 6221: esalt_size
= sizeof (tc_t
); break;
11716 case 6222: esalt_size
= sizeof (tc_t
); break;
11717 case 6223: esalt_size
= sizeof (tc_t
); break;
11718 case 6231: esalt_size
= sizeof (tc_t
); break;
11719 case 6232: esalt_size
= sizeof (tc_t
); break;
11720 case 6233: esalt_size
= sizeof (tc_t
); break;
11721 case 6241: esalt_size
= sizeof (tc_t
); break;
11722 case 6242: esalt_size
= sizeof (tc_t
); break;
11723 case 6243: esalt_size
= sizeof (tc_t
); break;
11724 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11725 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11726 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11727 case 7300: esalt_size
= sizeof (rakp_t
); break;
11728 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11729 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11730 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11731 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11732 case 9400: esalt_size
= sizeof (office2007_t
); break;
11733 case 9500: esalt_size
= sizeof (office2010_t
); break;
11734 case 9600: esalt_size
= sizeof (office2013_t
); break;
11735 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11736 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11737 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11738 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11739 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11740 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11741 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11742 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11743 case 10400: esalt_size
= sizeof (pdf_t
); break;
11744 case 10410: esalt_size
= sizeof (pdf_t
); break;
11745 case 10420: esalt_size
= sizeof (pdf_t
); break;
11746 case 10500: esalt_size
= sizeof (pdf_t
); break;
11747 case 10600: esalt_size
= sizeof (pdf_t
); break;
11748 case 10700: esalt_size
= sizeof (pdf_t
); break;
11749 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11750 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11751 case 11400: esalt_size
= sizeof (sip_t
); break;
11752 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11753 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11754 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11755 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11756 case 13000: esalt_size
= sizeof (rar5_t
); break;
11757 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11758 case 13400: esalt_size
= sizeof (keepass_t
); break;
11759 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11760 case 13600: esalt_size
= sizeof (zip2_t
); break;
11761 case 13711: esalt_size
= sizeof (tc_t
); break;
11762 case 13712: esalt_size
= sizeof (tc_t
); break;
11763 case 13713: esalt_size
= sizeof (tc_t
); break;
11764 case 13721: esalt_size
= sizeof (tc_t
); break;
11765 case 13722: esalt_size
= sizeof (tc_t
); break;
11766 case 13723: esalt_size
= sizeof (tc_t
); break;
11767 case 13731: esalt_size
= sizeof (tc_t
); break;
11768 case 13732: esalt_size
= sizeof (tc_t
); break;
11769 case 13733: esalt_size
= sizeof (tc_t
); break;
11770 case 13741: esalt_size
= sizeof (tc_t
); break;
11771 case 13742: esalt_size
= sizeof (tc_t
); break;
11772 case 13743: esalt_size
= sizeof (tc_t
); break;
11773 case 13751: esalt_size
= sizeof (tc_t
); break;
11774 case 13752: esalt_size
= sizeof (tc_t
); break;
11775 case 13753: esalt_size
= sizeof (tc_t
); break;
11776 case 13761: esalt_size
= sizeof (tc_t
); break;
11777 case 13762: esalt_size
= sizeof (tc_t
); break;
11778 case 13763: esalt_size
= sizeof (tc_t
); break;
11779 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11782 data
.esalt_size
= esalt_size
;
11785 * choose dictionary parser
11788 if (hash_type
== HASH_TYPE_LM
)
11790 get_next_word_func
= get_next_word_lm
;
11792 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11794 get_next_word_func
= get_next_word_uc
;
11798 get_next_word_func
= get_next_word_std
;
11805 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11808 size_t dictstat_nmemb
= 0;
11812 uint dictstat_nmemb
= 0;
11815 char dictstat
[256] = { 0 };
11817 FILE *dictstat_fp
= NULL
;
11821 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11823 dictstat_fp
= fopen (dictstat
, "rb");
11828 struct stat tmpstat
;
11830 fstat (fileno (dictstat_fp
), &tmpstat
);
11834 struct stat64 tmpstat
;
11836 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11839 if (tmpstat
.st_mtime
< COMPTIME
)
11841 /* with v0.15 the format changed so we have to ensure user is using a good version
11842 since there is no version-header in the dictstat file */
11844 fclose (dictstat_fp
);
11850 while (!feof (dictstat_fp
))
11854 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11856 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11858 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11860 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11866 fclose (dictstat_fp
);
11875 char potfile
[256] = { 0 };
11877 if (potfile_path
== NULL
)
11879 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11883 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11886 data
.pot_fp
= NULL
;
11888 FILE *out_fp
= NULL
;
11889 FILE *pot_fp
= NULL
;
11891 if (show
== 1 || left
== 1)
11893 pot_fp
= fopen (potfile
, "rb");
11895 if (pot_fp
== NULL
)
11897 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11902 if (outfile
!= NULL
)
11904 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11906 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11920 if (potfile_disable
== 0)
11922 pot_fp
= fopen (potfile
, "ab");
11924 if (pot_fp
== NULL
)
11926 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11931 data
.pot_fp
= pot_fp
;
11938 uint pot_avail
= 0;
11940 if (show
== 1 || left
== 1)
11942 SUPPRESS_OUTPUT
= 1;
11944 pot_avail
= count_lines (pot_fp
);
11948 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11950 uint pot_hashes_avail
= 0;
11954 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11956 while (!feof (pot_fp
))
11960 int line_len
= fgetl (pot_fp
, line_buf
);
11962 if (line_len
== 0) continue;
11964 char *plain_buf
= line_buf
+ line_len
;
11966 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11968 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11970 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11971 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11973 if (pot_cnt
== pot_hashes_avail
)
11977 for (pos
= 0; pos
< INCR_POT
; pos
++)
11979 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11981 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11983 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11985 tmp_hash
->digest
= mymalloc (dgst_size
);
11989 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11994 tmp_hash
->esalt
= mymalloc (esalt_size
);
11997 pot_hashes_avail
++;
12005 int iter
= MAX_CUT_TRIES
;
12009 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
12011 if (line_buf
[i
] == ':')
12019 if (data
.hash_mode
!= 2500)
12021 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
12025 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
12027 if (line_len
> max_salt_size
)
12029 parser_status
= PARSER_GLOBAL_LENGTH
;
12033 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
12035 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
12037 hashes_buf
->salt
->salt_len
= line_len
;
12039 parser_status
= PARSER_OK
;
12043 // if NOT parsed without error, we add the ":" to the plain
12045 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
12051 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
12053 if (parser_status
< PARSER_GLOBAL_ZERO
)
12055 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
12060 if (plain_len
>= 255) continue;
12062 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
12064 pot_ptr
->plain_len
= plain_len
;
12073 SUPPRESS_OUTPUT
= 0;
12075 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
12082 uint pw_min
= PW_MIN
;
12083 uint pw_max
= PW_MAX
;
12087 case 125: if (pw_max
> 32) pw_max
= 32;
12089 case 400: if (pw_max
> 40) pw_max
= 40;
12091 case 500: if (pw_max
> 16) pw_max
= 16;
12093 case 1500: if (pw_max
> 8) pw_max
= 8;
12095 case 1600: if (pw_max
> 16) pw_max
= 16;
12097 case 1800: if (pw_max
> 16) pw_max
= 16;
12099 case 2100: if (pw_max
> 16) pw_max
= 16;
12101 case 2500: if (pw_min
< 8) pw_min
= 8;
12103 case 3000: if (pw_max
> 7) pw_max
= 7;
12105 case 5200: if (pw_max
> 24) pw_max
= 24;
12107 case 5800: if (pw_max
> 16) pw_max
= 16;
12109 case 6300: if (pw_max
> 16) pw_max
= 16;
12111 case 7400: if (pw_max
> 16) pw_max
= 16;
12113 case 7700: if (pw_max
> 8) pw_max
= 8;
12115 case 7900: if (pw_max
> 48) pw_max
= 48;
12117 case 8500: if (pw_max
> 8) pw_max
= 8;
12119 case 8600: if (pw_max
> 16) pw_max
= 16;
12121 case 9710: pw_min
= 5;
12124 case 9810: pw_min
= 5;
12127 case 10410: pw_min
= 5;
12130 case 10300: if (pw_max
< 3) pw_min
= 3;
12131 if (pw_max
> 40) pw_max
= 40;
12133 case 10500: if (pw_max
< 3) pw_min
= 3;
12134 if (pw_max
> 40) pw_max
= 40;
12136 case 10700: if (pw_max
> 16) pw_max
= 16;
12138 case 11300: if (pw_max
> 40) pw_max
= 40;
12140 case 11600: if (pw_max
> 32) pw_max
= 32;
12142 case 12500: if (pw_max
> 20) pw_max
= 20;
12144 case 12800: if (pw_max
> 24) pw_max
= 24;
12148 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12150 switch (attack_kern
)
12152 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12154 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12160 * charsets : keep them together for more easy maintainnce
12163 cs_t mp_sys
[6] = { { { 0 }, 0 } };
12164 cs_t mp_usr
[4] = { { { 0 }, 0 } };
12166 mp_setup_sys (mp_sys
);
12168 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
12169 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
12170 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
12171 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
12174 * load hashes, part I: find input mode, count hashes
12177 uint hashlist_mode
= 0;
12178 uint hashlist_format
= HLFMT_HASHCAT
;
12180 uint hashes_avail
= 0;
12182 if ((benchmark
== 0) && (stdout_flag
== 0))
12186 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
12188 if ((hash_mode
== 2500) ||
12189 (hash_mode
== 5200) ||
12190 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
12191 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
12192 (hash_mode
== 9000))
12194 hashlist_mode
= HL_MODE_ARG
;
12196 char *hashfile
= myargv
[optind
];
12198 data
.hashfile
= hashfile
;
12200 logfile_top_var_string ("target", hashfile
);
12203 if (hashlist_mode
== HL_MODE_ARG
)
12205 if (hash_mode
== 2500)
12209 if (stat (data
.hashfile
, &st
) == -1)
12211 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
12216 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
12223 else if (hashlist_mode
== HL_MODE_FILE
)
12225 char *hashfile
= myargv
[optind
];
12227 data
.hashfile
= hashfile
;
12229 logfile_top_var_string ("target", hashfile
);
12233 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12235 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12240 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
12242 hashes_avail
= count_lines (fp
);
12246 if (hashes_avail
== 0)
12248 log_error ("ERROR: hashfile is empty or corrupt");
12255 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
12257 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
12259 log_error ("ERROR: remove not supported in native hashfile-format mode");
12271 hashlist_mode
= HL_MODE_ARG
;
12276 if (hash_mode
== 3000) hashes_avail
*= 2;
12278 data
.hashlist_mode
= hashlist_mode
;
12279 data
.hashlist_format
= hashlist_format
;
12281 logfile_top_uint (hashlist_mode
);
12282 logfile_top_uint (hashlist_format
);
12285 * load hashes, part II: allocate required memory, set pointers
12288 hash_t
*hashes_buf
= NULL
;
12289 void *digests_buf
= NULL
;
12290 salt_t
*salts_buf
= NULL
;
12291 void *esalts_buf
= NULL
;
12293 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
12295 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
12297 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12301 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12303 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
12305 hashes_buf
[hash_pos
].hash_info
= hash_info
;
12307 if (username
&& (remove
|| show
|| left
))
12309 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
12314 hash_info
->orighash
= (char *) mymalloc (256);
12321 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12325 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
12330 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12333 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12335 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
12339 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
12343 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
12348 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
12353 * load hashes, part III: parse hashes or generate them if benchmark
12356 uint hashes_cnt
= 0;
12358 if (benchmark
== 0)
12362 // useless to read hash file for keyspace, cheat a little bit w/ optind
12364 else if (stdout_flag
== 1)
12366 // useless to read hash file for stdout, cheat a little bit w/ optind
12368 else if (hashes_avail
== 0)
12371 else if (hashlist_mode
== HL_MODE_ARG
)
12373 char *input_buf
= myargv
[optind
];
12375 uint input_len
= strlen (input_buf
);
12377 logfile_top_var_string ("target", input_buf
);
12379 char *hash_buf
= NULL
;
12382 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
12384 bool hash_fmt_error
= 0;
12386 if (hash_len
< 1) hash_fmt_error
= 1;
12387 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12389 if (hash_fmt_error
)
12391 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12395 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12397 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12399 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12404 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
12407 int parser_status
= PARSER_OK
;
12409 if (hash_mode
== 2500)
12413 log_error ("ERROR: hccap file not specified");
12418 hashlist_mode
= HL_MODE_FILE
;
12420 data
.hashlist_mode
= hashlist_mode
;
12422 FILE *fp
= fopen (hash_buf
, "rb");
12426 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12431 if (hashes_avail
< 1)
12433 log_error ("ERROR: hccap file is empty or corrupt");
12440 uint hccap_size
= sizeof (hccap_t
);
12442 char *in
= (char *) mymalloc (hccap_size
);
12446 int n
= fread (in
, hccap_size
, 1, fp
);
12450 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12455 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12457 if (parser_status
!= PARSER_OK
)
12459 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12464 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12466 if ((show
== 1) || (left
== 1))
12468 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12470 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12472 int cur_pos
= tmp_salt
->salt_len
;
12473 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12475 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12477 // do the appending task
12479 snprintf (salt_ptr
+ cur_pos
,
12481 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12493 wpa
->orig_mac2
[5]);
12495 // memset () the remaining part of the salt
12497 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12498 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12500 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12502 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12505 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
);
12506 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
);
12515 else if (hash_mode
== 3000)
12517 if (hash_len
== 32)
12519 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12521 hash_t
*lm_hash_left
= NULL
;
12523 if (parser_status
== PARSER_OK
)
12525 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12531 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12534 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12536 hash_t
*lm_hash_right
= NULL
;
12538 if (parser_status
== PARSER_OK
)
12540 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12546 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12551 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12553 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
);
12554 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
);
12559 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12561 if (parser_status
== PARSER_OK
)
12563 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12564 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12567 if (parser_status
== PARSER_OK
)
12573 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12579 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12581 if (parser_status
== PARSER_OK
)
12583 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12584 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12587 if (parser_status
== PARSER_OK
)
12593 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12598 else if (hashlist_mode
== HL_MODE_FILE
)
12600 char *hashfile
= data
.hashfile
;
12604 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12606 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12613 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12619 int line_len
= fgetl (fp
, line_buf
);
12621 if (line_len
== 0) continue;
12623 char *hash_buf
= NULL
;
12626 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12628 bool hash_fmt_error
= 0;
12630 if (hash_len
< 1) hash_fmt_error
= 1;
12631 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12633 if (hash_fmt_error
)
12635 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12642 char *user_buf
= NULL
;
12645 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12647 if (remove
|| show
)
12649 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12651 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12653 user_t
*user_ptr
= *user
;
12655 if (user_buf
!= NULL
)
12657 user_ptr
->user_name
= mystrdup (user_buf
);
12661 user_ptr
->user_name
= mystrdup ("");
12664 user_ptr
->user_len
= user_len
;
12668 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12670 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12672 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12677 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12680 if (hash_mode
== 3000)
12682 if (hash_len
== 32)
12684 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12686 if (parser_status
< PARSER_GLOBAL_ZERO
)
12688 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12693 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12697 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12699 if (parser_status
< PARSER_GLOBAL_ZERO
)
12701 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12706 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12708 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);
12714 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
);
12715 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
);
12719 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12721 if (parser_status
< PARSER_GLOBAL_ZERO
)
12723 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12728 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);
12730 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12731 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12738 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12740 if (parser_status
< PARSER_GLOBAL_ZERO
)
12742 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12747 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);
12749 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12750 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12760 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12762 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12769 hashes_buf
[0].salt
->salt_len
= 8;
12771 // special salt handling
12775 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12776 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12778 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12780 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12782 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12784 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12786 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12788 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12790 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12792 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12794 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12796 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12797 hashes_buf
[0].salt
->scrypt_N
= 1024;
12798 hashes_buf
[0].salt
->scrypt_r
= 1;
12799 hashes_buf
[0].salt
->scrypt_p
= 1;
12801 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12803 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12804 hashes_buf
[0].salt
->scrypt_N
= 16384;
12805 hashes_buf
[0].salt
->scrypt_r
= 1;
12806 hashes_buf
[0].salt
->scrypt_p
= 1;
12808 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12810 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12812 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12814 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12816 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12818 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12820 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12822 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12824 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12826 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12828 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12830 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12832 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12834 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12836 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12840 // special esalt handling
12844 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12846 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12847 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12849 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12850 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12852 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12853 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12854 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12855 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12857 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12858 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12859 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12860 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12862 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12864 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12865 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12866 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12868 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12869 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12870 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12872 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12873 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12874 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12876 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12877 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12878 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12880 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12881 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12882 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12884 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12885 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12886 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12888 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12889 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12890 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12892 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12894 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12896 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12897 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12898 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12907 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12909 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12911 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12913 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12915 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12917 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12919 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12921 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12923 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12925 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12927 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12929 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12931 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12933 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12935 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12937 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12939 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12941 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12943 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12945 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12947 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12949 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12951 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12953 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12955 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12957 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12959 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12961 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12963 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12965 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12967 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12969 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12971 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12973 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12975 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12977 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12981 // set default iterations
12985 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12987 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12989 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12991 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12993 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12995 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12997 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12999 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
13001 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
13003 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
13005 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13007 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13009 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13011 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13013 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13015 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13017 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13019 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13021 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13023 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13025 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13027 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13029 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13031 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
13033 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
13035 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
13037 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
13039 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
13041 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
13043 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
13045 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
13047 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
13049 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
13051 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
13053 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
13055 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
13057 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
13059 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
13061 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
13063 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
13065 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
13067 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
13069 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
13071 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
13073 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
13075 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
13077 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
13079 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
13081 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
13083 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
13085 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
13087 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
13089 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
13091 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
13093 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
13095 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
13097 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
13099 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
13101 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
13103 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
13105 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
13107 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
13109 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
13111 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
13113 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13115 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13117 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13119 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13121 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13123 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13125 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13127 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13129 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13131 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13133 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13135 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13137 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13139 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13141 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13143 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13145 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13147 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13154 if (show
== 1 || left
== 1)
13156 for (uint i
= 0; i
< pot_cnt
; i
++)
13158 pot_t
*pot_ptr
= &pot
[i
];
13160 hash_t
*hashes_buf
= &pot_ptr
->hash
;
13162 local_free (hashes_buf
->digest
);
13166 local_free (hashes_buf
->salt
);
13172 if (data
.quiet
== 0) log_info_nn ("");
13177 if ((keyspace
== 0) && (stdout_flag
== 0))
13179 if (hashes_cnt
== 0)
13181 log_error ("ERROR: No hashes loaded");
13188 * Sanity check for hashfile vs outfile (should not point to the same physical file)
13191 if (data
.outfile
!= NULL
)
13193 if (data
.hashfile
!= NULL
)
13196 struct stat tmpstat_outfile
;
13197 struct stat tmpstat_hashfile
;
13201 struct stat64 tmpstat_outfile
;
13202 struct stat64 tmpstat_hashfile
;
13205 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
13207 if (tmp_outfile_fp
)
13210 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13214 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13217 fclose (tmp_outfile_fp
);
13220 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
13222 if (tmp_hashfile_fp
)
13225 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13229 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13232 fclose (tmp_hashfile_fp
);
13235 if (tmp_outfile_fp
&& tmp_outfile_fp
)
13237 tmpstat_outfile
.st_mode
= 0;
13238 tmpstat_outfile
.st_nlink
= 0;
13239 tmpstat_outfile
.st_uid
= 0;
13240 tmpstat_outfile
.st_gid
= 0;
13241 tmpstat_outfile
.st_rdev
= 0;
13242 tmpstat_outfile
.st_atime
= 0;
13244 tmpstat_hashfile
.st_mode
= 0;
13245 tmpstat_hashfile
.st_nlink
= 0;
13246 tmpstat_hashfile
.st_uid
= 0;
13247 tmpstat_hashfile
.st_gid
= 0;
13248 tmpstat_hashfile
.st_rdev
= 0;
13249 tmpstat_hashfile
.st_atime
= 0;
13252 tmpstat_outfile
.st_blksize
= 0;
13253 tmpstat_outfile
.st_blocks
= 0;
13255 tmpstat_hashfile
.st_blksize
= 0;
13256 tmpstat_hashfile
.st_blocks
= 0;
13260 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
13262 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13269 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
13271 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13281 * Remove duplicates
13284 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
13288 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13292 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13295 uint hashes_cnt_orig
= hashes_cnt
;
13299 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
13303 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
13305 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13310 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13313 if (hashes_pos
> hashes_cnt
)
13315 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
13325 uint potfile_remove_cracks
= 0;
13327 if (potfile_disable
== 0)
13331 hash_buf
.digest
= mymalloc (dgst_size
);
13332 hash_buf
.salt
= NULL
;
13333 hash_buf
.esalt
= NULL
;
13334 hash_buf
.hash_info
= NULL
;
13335 hash_buf
.cracked
= 0;
13339 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
13344 hash_buf
.esalt
= mymalloc (esalt_size
);
13347 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
13349 // no solution for these special hash types (for instane because they use hashfile in output etc)
13350 if ((hash_mode
!= 5200) &&
13351 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
13352 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
13353 (hash_mode
!= 9000))
13355 FILE *fp
= fopen (potfile
, "rb");
13359 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
13361 // to be safe work with a copy (because of line_len loop, i etc)
13362 // moved up here because it's easier to handle continue case
13365 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
13369 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
13371 if (ptr
== NULL
) break;
13373 int line_len
= strlen (line_buf
);
13375 if (line_len
== 0) continue;
13377 int iter
= MAX_CUT_TRIES
;
13379 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
13381 if (line_buf
[i
] != ':') continue;
13385 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
13388 hash_t
*found
= NULL
;
13390 if (hash_mode
== 6800)
13392 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13394 // manipulate salt_buf
13395 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
13397 hash_buf
.salt
->salt_len
= i
;
13399 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
13402 else if (hash_mode
== 2500)
13404 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13406 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
13407 // manipulate salt_buf
13409 memset (line_buf_cpy
, 0, HCBUFSIZ
);
13410 memcpy (line_buf_cpy
, line_buf
, i
);
13412 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
13414 if (mac2_pos
== NULL
) continue;
13419 if (strlen (mac2_pos
) != 12) continue;
13421 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
13423 if (mac1_pos
== NULL
) continue;
13428 if (strlen (mac1_pos
) != 12) continue;
13430 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13432 // here we need the ESSID
13433 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13435 hash_buf
.salt
->salt_len
= essid_length
;
13437 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13441 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13443 // compare hex string(s) vs binary MAC address(es)
13445 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13447 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13456 if (!found
) continue;
13458 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13460 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13472 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13474 if (parser_status
== PARSER_OK
)
13478 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13482 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13487 if (found
== NULL
) continue;
13489 if (!found
->cracked
) potfile_remove_cracks
++;
13491 found
->cracked
= 1;
13499 myfree (line_buf_cpy
);
13509 local_free (hash_buf
.esalt
);
13514 local_free (hash_buf
.salt
);
13517 local_free (hash_buf
.digest
);
13521 * Now generate all the buffers required for later
13524 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13526 salt_t
*salts_buf_new
= NULL
;
13527 void *esalts_buf_new
= NULL
;
13531 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13535 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13540 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13543 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13545 uint digests_cnt
= hashes_cnt
;
13546 uint digests_done
= 0;
13548 size_t size_digests
= digests_cnt
* dgst_size
;
13549 size_t size_shown
= digests_cnt
* sizeof (uint
);
13551 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13552 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13554 uint salts_cnt
= 0;
13555 uint salts_done
= 0;
13557 hashinfo_t
**hash_info
= NULL
;
13559 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13561 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13563 if (username
&& (remove
|| show
))
13567 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13569 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13571 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13576 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13581 // copied from inner loop
13583 salt_buf
= &salts_buf_new
[salts_cnt
];
13585 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13589 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13592 salt_buf
->digests_cnt
= 0;
13593 salt_buf
->digests_done
= 0;
13594 salt_buf
->digests_offset
= 0;
13599 if (hashes_buf
[0].cracked
== 1)
13601 digests_shown
[0] = 1;
13605 salt_buf
->digests_done
++;
13608 salt_buf
->digests_cnt
++;
13610 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13612 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13614 hash_info
[0] = hashes_buf
[0].hash_info
;
13617 // copy from inner loop
13619 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13623 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13625 salt_buf
= &salts_buf_new
[salts_cnt
];
13627 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13631 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13634 salt_buf
->digests_cnt
= 0;
13635 salt_buf
->digests_done
= 0;
13636 salt_buf
->digests_offset
= hashes_pos
;
13642 if (hashes_buf
[hashes_pos
].cracked
== 1)
13644 digests_shown
[hashes_pos
] = 1;
13648 salt_buf
->digests_done
++;
13651 salt_buf
->digests_cnt
++;
13653 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13655 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13657 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13661 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13663 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13665 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13667 salts_shown
[salt_pos
] = 1;
13672 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13675 local_free (digests_buf
);
13676 local_free (salts_buf
);
13677 local_free (esalts_buf
);
13679 digests_buf
= digests_buf_new
;
13680 salts_buf
= salts_buf_new
;
13681 esalts_buf
= esalts_buf_new
;
13683 local_free (hashes_buf
);
13686 * special modification not set from parser
13691 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13692 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13693 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13694 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13695 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13696 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13697 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13698 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13699 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13700 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13701 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13702 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13703 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13704 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13705 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13706 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13707 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13708 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13709 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13710 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13711 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13712 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13713 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13714 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13715 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13716 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13717 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13718 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13719 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13720 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13723 if (truecrypt_keyfiles
)
13725 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13727 char *keyfiles
= strdup (truecrypt_keyfiles
);
13729 char *keyfile
= strtok (keyfiles
, ",");
13733 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13735 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13740 if (veracrypt_keyfiles
)
13742 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13744 char *keyfiles
= strdup (veracrypt_keyfiles
);
13746 char *keyfile
= strtok (keyfiles
, ",");
13750 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13752 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13757 data
.digests_cnt
= digests_cnt
;
13758 data
.digests_done
= digests_done
;
13759 data
.digests_buf
= digests_buf
;
13760 data
.digests_shown
= digests_shown
;
13761 data
.digests_shown_tmp
= digests_shown_tmp
;
13763 data
.salts_cnt
= salts_cnt
;
13764 data
.salts_done
= salts_done
;
13765 data
.salts_buf
= salts_buf
;
13766 data
.salts_shown
= salts_shown
;
13768 data
.esalts_buf
= esalts_buf
;
13769 data
.hash_info
= hash_info
;
13772 * Automatic Optimizers
13775 if (salts_cnt
== 1)
13776 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13778 if (digests_cnt
== 1)
13779 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13781 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13782 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13784 if (attack_mode
== ATTACK_MODE_BF
)
13785 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13787 data
.opti_type
= opti_type
;
13789 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13791 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13793 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13795 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13797 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13798 opts_type
|= OPTS_TYPE_PT_ADD80
;
13801 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13803 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13804 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13807 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13809 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13810 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13817 * Some algorithm, like descrypt, can benefit from JIT compilation
13820 int force_jit_compilation
= -1;
13822 if (hash_mode
== 8900)
13824 force_jit_compilation
= 8900;
13826 else if (hash_mode
== 9300)
13828 force_jit_compilation
= 8900;
13830 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13832 force_jit_compilation
= 1500;
13836 * generate bitmap tables
13839 const uint bitmap_shift1
= 5;
13840 const uint bitmap_shift2
= 13;
13842 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13844 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13845 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13846 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13847 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13848 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13849 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13850 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13851 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
13858 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13860 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13862 bitmap_nums
= 1 << bitmap_bits
;
13864 bitmap_mask
= bitmap_nums
- 1;
13866 bitmap_size
= bitmap_nums
* sizeof (uint
);
13868 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13870 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;
13871 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;
13876 bitmap_nums
= 1 << bitmap_bits
;
13878 bitmap_mask
= bitmap_nums
- 1;
13880 bitmap_size
= bitmap_nums
* sizeof (uint
);
13882 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);
13883 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);
13886 * prepare quick rule
13889 data
.rule_buf_l
= rule_buf_l
;
13890 data
.rule_buf_r
= rule_buf_r
;
13892 int rule_len_l
= (int) strlen (rule_buf_l
);
13893 int rule_len_r
= (int) strlen (rule_buf_r
);
13895 data
.rule_len_l
= rule_len_l
;
13896 data
.rule_len_r
= rule_len_r
;
13902 uint
*all_kernel_rules_cnt
= NULL
;
13904 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13908 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13910 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13913 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13917 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13919 uint kernel_rules_avail
= 0;
13921 uint kernel_rules_cnt
= 0;
13923 kernel_rule_t
*kernel_rules_buf
= NULL
;
13925 char *rp_file
= rp_files
[i
];
13927 char in
[BLOCK_SIZE
] = { 0 };
13928 char out
[BLOCK_SIZE
] = { 0 };
13932 uint rule_line
= 0;
13934 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13936 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13943 memset (rule_buf
, 0, HCBUFSIZ
);
13945 rule_len
= fgetl (fp
, rule_buf
);
13949 if (rule_len
== 0) continue;
13951 if (rule_buf
[0] == '#') continue;
13953 if (kernel_rules_avail
== kernel_rules_cnt
)
13955 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13957 kernel_rules_avail
+= INCR_RULES
;
13960 memset (in
, 0, BLOCK_SIZE
);
13961 memset (out
, 0, BLOCK_SIZE
);
13963 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13967 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13972 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13974 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13976 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13982 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13984 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13990 kernel_rules_cnt
++;
13995 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13997 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
14001 * merge rules or automatic rule generator
14004 uint kernel_rules_cnt
= 0;
14006 kernel_rule_t
*kernel_rules_buf
= NULL
;
14008 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14012 kernel_rules_cnt
= 1;
14014 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
14016 repeats
[0] = kernel_rules_cnt
;
14018 for (uint i
= 0; i
< rp_files_cnt
; i
++)
14020 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
14022 repeats
[i
+ 1] = kernel_rules_cnt
;
14025 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
14027 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
14029 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
14033 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
14035 for (uint j
= 0; j
< rp_files_cnt
; j
++)
14037 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
14040 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
14042 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
14044 if (out_pos
== RULES_MAX
- 1)
14046 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
14051 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
14056 local_free (repeats
);
14060 uint kernel_rules_avail
= 0;
14062 while (kernel_rules_cnt
< rp_gen
)
14064 if (kernel_rules_avail
== kernel_rules_cnt
)
14066 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14068 kernel_rules_avail
+= INCR_RULES
;
14071 memset (rule_buf
, 0, HCBUFSIZ
);
14073 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
14075 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
14077 kernel_rules_cnt
++;
14085 * generate NOP rules
14088 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
14090 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
14092 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
14094 kernel_rules_cnt
++;
14097 data
.kernel_rules_cnt
= kernel_rules_cnt
;
14098 data
.kernel_rules_buf
= kernel_rules_buf
;
14100 if (kernel_rules_cnt
== 0)
14102 log_error ("ERROR: No valid rules left");
14108 * OpenCL platforms: detect
14111 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
14112 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
14114 cl_uint platforms_cnt
= 0;
14115 cl_uint platform_devices_cnt
= 0;
14119 cl_int CL_err
= hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
14121 if (CL_err
!= CL_SUCCESS
)
14123 log_error ("ERROR: clGetPlatformIDs(): %s\n", val2cstr_cl (CL_err
));
14128 if (platforms_cnt
== 0)
14131 log_info ("ATTENTION! No OpenCL compatible platform found");
14133 log_info ("You're probably missing the OpenCL runtime installation");
14134 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
14135 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
14136 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
14142 if (opencl_platforms_filter
!= (uint
) -1)
14144 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
14146 if (opencl_platforms_filter
> platform_cnt_mask
)
14148 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
14155 if (opencl_device_types
== NULL
)
14158 * OpenCL device types:
14159 * 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.
14162 cl_device_type device_types_all
= 0;
14164 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14166 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
14168 cl_platform_id platform
= platforms
[platform_id
];
14170 cl_int CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14172 if (CL_err
!= CL_SUCCESS
)
14174 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14178 // Silently ignore at this point, it will be reused later and create a note for the user at that point
14183 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14185 cl_device_id device
= platform_devices
[platform_devices_id
];
14187 cl_device_type device_type
;
14189 cl_int CL_err
= hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14191 if (CL_err
!= CL_SUCCESS
)
14193 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14198 device_types_all
|= device_type
;
14202 // In such a case, automatically enable CPU device type support, since it's disabled by default.
14204 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
14206 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
14209 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
14210 // If we have a CPU device, force it to be used
14212 if (stdout_flag
== 1)
14214 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
14216 device_types_filter
= CL_DEVICE_TYPE_CPU
;
14222 * OpenCL devices: simply push all devices from all platforms into the same device array
14226 int need_nvapi
= 0;
14228 int need_xnvctrl
= 0;
14230 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
14232 data
.devices_param
= devices_param
;
14234 uint devices_cnt
= 0;
14236 uint devices_active
= 0;
14238 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14240 cl_int CL_err
= CL_SUCCESS
;
14242 cl_platform_id platform
= platforms
[platform_id
];
14244 char platform_vendor
[INFOSZ
] = { 0 };
14246 CL_err
= hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
14248 if (CL_err
!= CL_SUCCESS
)
14250 log_error ("ERROR: clGetPlatformInfo(): %s\n", val2cstr_cl (CL_err
));
14255 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
14256 // this causes trouble with vendor id based macros
14257 // we'll assign generic to those without special optimization available
14259 cl_uint platform_vendor_id
= 0;
14261 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
14263 platform_vendor_id
= VENDOR_ID_AMD
;
14265 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14267 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14269 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
14271 platform_vendor_id
= VENDOR_ID_APPLE
;
14273 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14275 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14277 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14279 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
14281 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
14283 platform_vendor_id
= VENDOR_ID_MESA
;
14285 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
14287 platform_vendor_id
= VENDOR_ID_NV
;
14289 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
14291 platform_vendor_id
= VENDOR_ID_POCL
;
14295 platform_vendor_id
= VENDOR_ID_GENERIC
;
14298 uint platform_skipped
= ((opencl_platforms_filter
& (1 << platform_id
)) == 0);
14300 CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14302 if (CL_err
!= CL_SUCCESS
)
14304 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14308 platform_skipped
= 2;
14311 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14313 if (machine_readable
== 0)
14315 if (platform_skipped
== 0)
14317 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
14319 char line
[256] = { 0 };
14321 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
14325 else if (platform_skipped
== 1)
14327 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
14330 else if (platform_skipped
== 2)
14332 log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id
+ 1, platform_vendor
);
14338 if (platform_skipped
== 1) continue;
14339 if (platform_skipped
== 2) continue;
14341 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14343 size_t param_value_size
= 0;
14345 const uint device_id
= devices_cnt
;
14347 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14349 device_param
->platform_vendor_id
= platform_vendor_id
;
14351 device_param
->device
= platform_devices
[platform_devices_id
];
14353 device_param
->device_id
= device_id
;
14355 device_param
->platform_devices_id
= platform_devices_id
;
14357 device_param
->platform
= platform
;
14361 cl_device_type device_type
;
14363 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14365 if (CL_err
!= CL_SUCCESS
)
14367 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14372 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
14374 device_param
->device_type
= device_type
;
14378 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
14380 if (CL_err
!= CL_SUCCESS
)
14382 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14387 char *device_name
= (char *) mymalloc (param_value_size
);
14389 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
14391 if (CL_err
!= CL_SUCCESS
)
14393 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14398 device_param
->device_name
= device_name
;
14402 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
14404 if (CL_err
!= CL_SUCCESS
)
14406 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14411 char *device_vendor
= (char *) mymalloc (param_value_size
);
14413 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
14415 if (CL_err
!= CL_SUCCESS
)
14417 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14422 device_param
->device_vendor
= device_vendor
;
14424 cl_uint device_vendor_id
= 0;
14426 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
14428 device_vendor_id
= VENDOR_ID_AMD
;
14430 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14432 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14434 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
14436 device_vendor_id
= VENDOR_ID_APPLE
;
14438 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14440 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14442 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14444 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
14446 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
14448 device_vendor_id
= VENDOR_ID_MESA
;
14450 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
14452 device_vendor_id
= VENDOR_ID_NV
;
14454 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
14456 device_vendor_id
= VENDOR_ID_POCL
;
14460 device_vendor_id
= VENDOR_ID_GENERIC
;
14463 device_param
->device_vendor_id
= device_vendor_id
;
14467 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14471 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
14473 if (CL_err
!= CL_SUCCESS
)
14475 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14480 char *device_version
= (char *) mymalloc (param_value_size
);
14482 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
14484 if (CL_err
!= CL_SUCCESS
)
14486 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14491 device_param
->device_version
= device_version
;
14493 // device_opencl_version
14495 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
14497 if (CL_err
!= CL_SUCCESS
)
14499 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14504 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
14506 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
14508 if (CL_err
!= CL_SUCCESS
)
14510 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14515 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
14517 myfree (device_opencl_version
);
14521 cl_uint vector_width
;
14523 if (opencl_vector_width_chgd
== 0)
14525 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
14527 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
14529 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
14531 if (CL_err
!= CL_SUCCESS
)
14533 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14540 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
14542 if (CL_err
!= CL_SUCCESS
)
14544 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14552 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14557 vector_width
= opencl_vector_width
;
14560 if (vector_width
> 16) vector_width
= 16;
14562 device_param
->vector_width
= vector_width
;
14564 // max_compute_units
14566 cl_uint device_processors
;
14568 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14570 if (CL_err
!= CL_SUCCESS
)
14572 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14577 device_param
->device_processors
= device_processors
;
14579 // device_maxmem_alloc
14580 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14582 cl_ulong device_maxmem_alloc
;
14584 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14586 if (CL_err
!= CL_SUCCESS
)
14588 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14593 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14595 // device_global_mem
14597 cl_ulong device_global_mem
;
14599 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14601 if (CL_err
!= CL_SUCCESS
)
14603 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14608 device_param
->device_global_mem
= device_global_mem
;
14610 // max_work_group_size
14612 size_t device_maxworkgroup_size
;
14614 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14616 if (CL_err
!= CL_SUCCESS
)
14618 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14623 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14625 // max_clock_frequency
14627 cl_uint device_maxclock_frequency
;
14629 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14631 if (CL_err
!= CL_SUCCESS
)
14633 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14638 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14640 // device_endian_little
14642 cl_bool device_endian_little
;
14644 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14646 if (CL_err
!= CL_SUCCESS
)
14648 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14653 if (device_endian_little
== CL_FALSE
)
14655 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14657 device_param
->skipped
= 1;
14660 // device_available
14662 cl_bool device_available
;
14664 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14666 if (CL_err
!= CL_SUCCESS
)
14668 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14673 if (device_available
== CL_FALSE
)
14675 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14677 device_param
->skipped
= 1;
14680 // device_compiler_available
14682 cl_bool device_compiler_available
;
14684 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14686 if (CL_err
!= CL_SUCCESS
)
14688 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14693 if (device_compiler_available
== CL_FALSE
)
14695 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14697 device_param
->skipped
= 1;
14700 // device_execution_capabilities
14702 cl_device_exec_capabilities device_execution_capabilities
;
14704 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14706 if (CL_err
!= CL_SUCCESS
)
14708 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14713 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14715 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14717 device_param
->skipped
= 1;
14720 // device_extensions
14722 size_t device_extensions_size
;
14724 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14726 if (CL_err
!= CL_SUCCESS
)
14728 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14733 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14735 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14737 if (CL_err
!= CL_SUCCESS
)
14739 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14744 if (strstr (device_extensions
, "base_atomics") == 0)
14746 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14748 device_param
->skipped
= 1;
14751 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14753 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14755 device_param
->skipped
= 1;
14758 myfree (device_extensions
);
14760 // device_local_mem_size
14762 cl_ulong device_local_mem_size
;
14764 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14766 if (CL_err
!= CL_SUCCESS
)
14768 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14773 if (device_local_mem_size
< 32768)
14775 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14777 device_param
->skipped
= 1;
14780 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14781 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14782 // This results in both utilizing it for 50%
14783 // However, Intel has much better SIMD control over their own hardware
14784 // It makes sense to give them full control over their own hardware
14786 if (device_type
& CL_DEVICE_TYPE_CPU
)
14788 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14790 if (data
.force
== 0)
14792 if (algorithm_pos
== 0)
14794 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14795 log_info (" You can use --force to override this but do not post error reports if you do so");
14798 device_param
->skipped
= 1;
14805 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
14806 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14810 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14812 if (CL_err
!= CL_SUCCESS
)
14814 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14819 char *driver_version
= (char *) mymalloc (param_value_size
);
14821 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14823 if (CL_err
!= CL_SUCCESS
)
14825 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14830 device_param
->driver_version
= driver_version
;
14832 // device_name_chksum
14834 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14837 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
);
14839 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
);
14842 uint device_name_digest
[4] = { 0 };
14844 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14846 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14848 device_param
->device_name_chksum
= device_name_chksum
;
14852 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14854 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14859 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14873 if (device_type
& CL_DEVICE_TYPE_GPU
)
14875 if (device_vendor_id
== VENDOR_ID_NV
)
14877 cl_uint kernel_exec_timeout
= 0;
14879 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14881 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14883 if (CL_err
!= CL_SUCCESS
)
14885 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14890 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14892 cl_uint sm_minor
= 0;
14893 cl_uint sm_major
= 0;
14895 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14896 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14898 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14900 if (CL_err
!= CL_SUCCESS
)
14902 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14907 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14909 if (CL_err
!= CL_SUCCESS
)
14911 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14916 device_param
->sm_minor
= sm_minor
;
14917 device_param
->sm_major
= sm_major
;
14919 // CPU burning loop damper
14920 // Value is given as number between 0-100
14923 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14925 if (nvidia_spin_damp_chgd
== 0)
14927 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14930 * the workaround is not a friend of rule based attacks
14931 * the words from the wordlist combined with fast and slow rules cause
14932 * fluctuations which cause inaccurate wait time estimations
14933 * using a reduced damping percentage almost compensates this
14936 device_param
->nvidia_spin_damp
= 64;
14940 device_param
->nvidia_spin_damp
/= 100;
14946 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14948 if (machine_readable
== 0)
14950 if (device_param
->skipped
== 0)
14952 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
14955 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
14956 (unsigned int) (device_global_mem
/ 1024 / 1024),
14957 (unsigned int) device_processors
);
14961 log_info ("- Device #%u: %s, skipped",
14968 // common driver check
14970 if (device_param
->skipped
== 0)
14972 if (device_type
& CL_DEVICE_TYPE_GPU
)
14974 if (platform_vendor_id
== VENDOR_ID_AMD
)
14976 int catalyst_check
= (force
== 1) ? 0 : 1;
14978 int catalyst_warn
= 0;
14980 int catalyst_broken
= 0;
14982 if (catalyst_check
== 1)
14986 // v14.9 and higher
14987 if (atoi (device_param
->driver_version
) >= 1573)
14992 catalyst_check
= 0;
14995 if (catalyst_broken
== 1)
14998 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
14999 log_info ("It passes over cracked hashes and will not report them as cracked");
15000 log_info ("You are STRONGLY encouraged not to use it");
15001 log_info ("You can use --force to override this but do not post error reports if you do so");
15007 if (catalyst_warn
== 1)
15010 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
15011 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
15012 log_info ("See hashcat's homepage for official supported catalyst drivers");
15014 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
15016 log_info ("You can use --force to override this but do not post error reports if you do so");
15022 else if (platform_vendor_id
== VENDOR_ID_NV
)
15024 if (device_param
->kernel_exec_timeout
!= 0)
15026 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);
15027 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
15032 /* turns out pocl still creates segfaults (because of llvm)
15033 if (device_type & CL_DEVICE_TYPE_CPU)
15035 if (platform_vendor_id == VENDOR_ID_AMD)
15040 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
15041 log_info ("You are STRONGLY encouraged not to use it");
15042 log_info ("You can use --force to override this but do not post error reports if you do so");
15043 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
15053 * kernel accel and loops tuning db adjustment
15056 device_param
->kernel_accel_min
= 1;
15057 device_param
->kernel_accel_max
= 1024;
15059 device_param
->kernel_loops_min
= 1;
15060 device_param
->kernel_loops_max
= 1024;
15062 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
15064 if (tuningdb_entry
)
15066 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
15067 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
15071 device_param
->kernel_accel_min
= _kernel_accel
;
15072 device_param
->kernel_accel_max
= _kernel_accel
;
15077 if (workload_profile
== 1)
15079 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
15081 else if (workload_profile
== 2)
15083 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
15086 device_param
->kernel_loops_min
= _kernel_loops
;
15087 device_param
->kernel_loops_max
= _kernel_loops
;
15091 // commandline parameters overwrite tuningdb entries
15095 device_param
->kernel_accel_min
= kernel_accel
;
15096 device_param
->kernel_accel_max
= kernel_accel
;
15101 device_param
->kernel_loops_min
= kernel_loops
;
15102 device_param
->kernel_loops_max
= kernel_loops
;
15117 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
15119 if (machine_readable
== 0)
15126 if (keyspace
== 0 && devices_active
== 0)
15128 log_error ("ERROR: No devices found/left");
15133 // 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)
15135 if (devices_filter
!= (uint
) -1)
15137 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
15139 if (devices_filter
> devices_cnt_mask
)
15141 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
15147 data
.devices_cnt
= devices_cnt
;
15149 data
.devices_active
= devices_active
;
15156 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
];
15157 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
];
15158 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
];
15159 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
];
15161 memset (hm_adapters_adl
, 0, sizeof (hm_adapters_adl
));
15162 memset (hm_adapters_nvapi
, 0, sizeof (hm_adapters_nvapi
));
15163 memset (hm_adapters_nvml
, 0, sizeof (hm_adapters_nvml
));
15164 memset (hm_adapters_xnvctrl
, 0, sizeof (hm_adapters_xnvctrl
));
15166 if (gpu_temp_disable
== 0)
15168 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
15169 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
15170 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
15171 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
15173 data
.hm_adl
= NULL
;
15174 data
.hm_nvapi
= NULL
;
15175 data
.hm_nvml
= NULL
;
15176 data
.hm_xnvctrl
= NULL
;
15178 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
15180 data
.hm_nvml
= nvml
;
15185 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
15187 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
15189 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
15193 for (int i
= 0; i
< tmp_in
; i
++)
15195 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
15198 for (int i
= 0; i
< tmp_out
; i
++)
15200 unsigned int speed
;
15202 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
15204 // doesn't seem to create any advantages
15205 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
15206 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
15211 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
15213 data
.hm_nvapi
= nvapi
;
15218 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
15220 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
15222 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
15226 for (int i
= 0; i
< tmp_in
; i
++)
15228 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
15233 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
15235 data
.hm_xnvctrl
= xnvctrl
;
15238 if (data
.hm_xnvctrl
)
15240 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
15242 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15244 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15246 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15248 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
15252 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
15257 if ((need_adl
== 1) && (adl_init (adl
) == 0))
15264 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
15266 // total number of adapters
15268 int hm_adapters_num
;
15270 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return -1;
15274 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
15276 if (lpAdapterInfo
== NULL
) return -1;
15278 // get a list (of ids of) valid/usable adapters
15280 int num_adl_adapters
= 0;
15282 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
15284 if (num_adl_adapters
> 0)
15286 hc_thread_mutex_lock (mux_adl
);
15288 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
15290 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15292 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15293 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15295 hc_thread_mutex_unlock (mux_adl
);
15298 myfree (valid_adl_device_list
);
15299 myfree (lpAdapterInfo
);
15303 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15305 gpu_temp_disable
= 1;
15310 * OpenCL devices: allocate buffer for device specific information
15313 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
15315 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
15317 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
15320 * User-defined GPU temp handling
15323 if (gpu_temp_disable
== 1)
15325 gpu_temp_abort
= 0;
15326 gpu_temp_retain
= 0;
15329 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
15331 if (gpu_temp_abort
< gpu_temp_retain
)
15333 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
15339 data
.gpu_temp_disable
= gpu_temp_disable
;
15340 data
.gpu_temp_abort
= gpu_temp_abort
;
15341 data
.gpu_temp_retain
= gpu_temp_retain
;
15345 * enable custom signal handler(s)
15348 if (benchmark
== 0)
15350 hc_signal (sigHandler_default
);
15354 hc_signal (sigHandler_benchmark
);
15361 if (data
.quiet
== 0)
15363 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
15365 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
);
15367 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15369 log_info ("Rules: %u", kernel_rules_cnt
);
15374 log_info ("Applicable Optimizers:");
15376 for (uint i
= 0; i
< 32; i
++)
15378 const uint opti_bit
= 1u << i
;
15380 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
15385 * Watchdog and Temperature balance
15389 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15391 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
15394 if (gpu_temp_abort
== 0)
15396 log_info ("Watchdog: Temperature abort trigger disabled");
15400 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
15403 if (gpu_temp_retain
== 0)
15405 log_info ("Watchdog: Temperature retain trigger disabled");
15409 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
15412 if (data
.quiet
== 0) log_info ("");
15422 if (gpu_temp_disable
== 0)
15424 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15426 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15428 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15430 if (device_param
->skipped
) continue;
15432 const uint platform_devices_id
= device_param
->platform_devices_id
;
15434 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15436 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
15437 data
.hm_device
[device_id
].nvapi
= 0;
15438 data
.hm_device
[device_id
].nvml
= 0;
15439 data
.hm_device
[device_id
].xnvctrl
= 0;
15440 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
15441 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
15442 data
.hm_device
[device_id
].fan_set_supported
= 0;
15445 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15447 data
.hm_device
[device_id
].adl
= 0;
15448 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
15449 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
15450 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
15451 data
.hm_device
[device_id
].od_version
= 0;
15452 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
15453 data
.hm_device
[device_id
].fan_set_supported
= 0;
15459 * powertune on user request
15462 if (powertune_enable
== 1)
15464 hc_thread_mutex_lock (mux_adl
);
15466 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15468 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15470 if (device_param
->skipped
) continue;
15472 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
15476 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
15477 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
15478 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
15479 * Driver / ADL bug?
15482 if (data
.hm_device
[device_id
].od_version
== 6)
15486 // check powertune capabilities first, if not available then skip device
15488 int powertune_supported
= 0;
15490 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
15492 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15497 // first backup current value, we will restore it later
15499 if (powertune_supported
!= 0)
15501 // powercontrol settings
15503 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15505 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
15507 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
15510 if (ADL_rc
!= ADL_OK
)
15512 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15517 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15519 log_error ("ERROR: Failed to set new ADL PowerControl values");
15526 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15528 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15530 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
)
15532 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15537 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15539 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15541 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
15543 log_error ("ERROR: Failed to get ADL device capabilities");
15548 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15549 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15551 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15552 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15554 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15555 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15557 // warning if profile has too low max values
15559 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15561 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15564 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15566 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15569 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15571 performance_state
->iNumberOfPerformanceLevels
= 2;
15573 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15574 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15575 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15576 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15578 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
)
15580 log_info ("ERROR: Failed to set ADL performance state");
15585 local_free (performance_state
);
15588 // set powertune value only
15590 if (powertune_supported
!= 0)
15593 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15595 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
15597 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15602 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15604 log_error ("ERROR: Failed to set new ADL PowerControl values");
15612 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
15614 // first backup current value, we will restore it later
15616 unsigned int limit
;
15618 int powertune_supported
= 0;
15620 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
15622 powertune_supported
= 1;
15625 // if backup worked, activate the maximum allowed
15627 if (powertune_supported
!= 0)
15629 unsigned int minLimit
;
15630 unsigned int maxLimit
;
15632 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
15636 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
15638 // now we can be sure we need to reset later
15640 nvml_power_limit
[device_id
] = limit
;
15648 hc_thread_mutex_unlock (mux_adl
);
15651 #endif // HAVE_HWMON
15654 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
15657 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
15659 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15661 cl_int CL_err
= CL_SUCCESS
;
15667 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15669 if (device_param
->skipped
) continue;
15672 * device properties
15675 const char *device_name_chksum
= device_param
->device_name_chksum
;
15676 const u32 device_processors
= device_param
->device_processors
;
15679 * create context for each device
15682 cl_context_properties properties
[3];
15684 properties
[0] = CL_CONTEXT_PLATFORM
;
15685 properties
[1] = (cl_context_properties
) device_param
->platform
;
15688 CL_err
= hc_clCreateContext (data
.ocl
, properties
, 1, &device_param
->device
, NULL
, NULL
, &device_param
->context
);
15690 if (CL_err
!= CL_SUCCESS
)
15692 log_error ("ERROR: clCreateContext(): %s\n", val2cstr_cl (CL_err
));
15698 * create command-queue
15701 // not supported with NV
15702 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15704 CL_err
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
, &device_param
->command_queue
);
15706 if (CL_err
!= CL_SUCCESS
)
15708 log_error ("ERROR: clCreateCommandQueue(): %s\n", val2cstr_cl (CL_err
));
15714 * kernel threads: some algorithms need a fixed kernel-threads count
15715 * because of shared memory usage or bitslice
15716 * there needs to be some upper limit, otherwise there's too much overhead
15719 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15721 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15722 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15724 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15726 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15729 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15730 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15731 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15732 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15733 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15734 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15735 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15736 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15737 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15738 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15739 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15740 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15741 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15743 device_param
->kernel_threads
= kernel_threads
;
15745 device_param
->hardware_power
= device_processors
* kernel_threads
;
15748 * create input buffers on device : calculate size of fixed memory buffers
15751 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15752 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15754 device_param
->size_root_css
= size_root_css
;
15755 device_param
->size_markov_css
= size_markov_css
;
15757 size_t size_results
= sizeof (uint
);
15759 device_param
->size_results
= size_results
;
15761 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15762 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15764 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15765 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15766 size_t size_esalts
= salts_cnt
* esalt_size
;
15768 device_param
->size_plains
= size_plains
;
15769 device_param
->size_digests
= size_digests
;
15770 device_param
->size_shown
= size_shown
;
15771 device_param
->size_salts
= size_salts
;
15773 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15774 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15775 size_t size_tm
= 32 * sizeof (bs_word_t
);
15779 size_t size_scrypt
= 4;
15781 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15783 // we need to check that all hashes have the same scrypt settings
15785 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15786 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15787 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15789 for (uint i
= 1; i
< salts_cnt
; i
++)
15791 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15792 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15793 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15795 log_error ("ERROR: Mixed scrypt settings not supported");
15801 uint tmto_start
= 0;
15802 uint tmto_stop
= 10;
15806 tmto_start
= scrypt_tmto
;
15810 // in case the user did not specify the tmto manually
15811 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15813 if (hash_mode
== 8900)
15815 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15819 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15824 else if (hash_mode
== 9300)
15826 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15830 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15837 data
.scrypt_tmp_size
= (128 * scrypt_r
* scrypt_p
);
15839 device_param
->kernel_accel_min
= 1;
15840 device_param
->kernel_accel_max
= 8;
15844 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15846 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15848 size_scrypt
/= 1 << tmto
;
15850 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15852 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15854 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15859 if (size_scrypt
> device_param
->device_global_mem
)
15861 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15866 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15868 data
.scrypt_tmto_final
= tmto
;
15874 if (tmto
== tmto_stop
)
15876 log_error ("ERROR: Can't allocate enough device memory");
15881 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
);
15884 size_t size_scrypt4
= size_scrypt
/ 4;
15887 * some algorithms need a fixed kernel-loops count
15890 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15892 const u32 kernel_loops_fixed
= 1024;
15894 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15895 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15898 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15900 const u32 kernel_loops_fixed
= 1024;
15902 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15903 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15906 if (hash_mode
== 8900)
15908 const u32 kernel_loops_fixed
= 1;
15910 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15911 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15914 if (hash_mode
== 9300)
15916 const u32 kernel_loops_fixed
= 1;
15918 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15919 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15922 if (hash_mode
== 12500)
15924 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15926 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15927 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15931 * some algorithms have a maximum kernel-loops count
15934 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15936 u32 innerloop_cnt
= 0;
15938 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15940 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15941 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15942 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15946 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
15949 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
15950 (innerloop_cnt
<= device_param
->kernel_loops_max
))
15952 device_param
->kernel_loops_max
= innerloop_cnt
;
15956 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
15957 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
15959 // find out if we would request too much memory on memory blocks which are based on kernel_accel
15961 size_t size_pws
= 4;
15962 size_t size_tmps
= 4;
15963 size_t size_hooks
= 4;
15965 while (kernel_accel_max
>= kernel_accel_min
)
15967 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
15971 size_pws
= kernel_power_max
* sizeof (pw_t
);
15977 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
15978 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15979 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15980 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
15981 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
15982 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
15983 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
15984 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
15985 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
15986 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
15987 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15988 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15989 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15990 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15991 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15992 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
15993 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15994 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15995 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15996 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15997 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15998 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
15999 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16000 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
16001 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
16002 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
16003 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
16004 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
16005 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16006 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16007 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
16008 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
16009 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16010 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
16011 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16012 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
16013 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
16014 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16015 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16016 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
16017 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
16018 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
16019 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16020 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
16021 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
16022 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
16023 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
16024 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16025 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
16026 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
16027 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
16028 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16029 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16030 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
16031 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
16032 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
16033 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
16034 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
16035 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16036 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16037 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16038 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
16039 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
16040 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16041 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16042 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16043 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16044 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16045 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16046 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16047 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16048 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16049 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16050 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16051 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16052 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16053 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16054 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16055 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16056 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16057 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16058 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16063 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
16070 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
16071 // if not, decrease amplifier and try again
16073 int memory_limit_hit
= 0;
16075 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16076 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16077 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16079 const u64 size_total
16096 + size_pws
// not a bug
16110 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
16112 if (memory_limit_hit
== 1)
16114 kernel_accel_max
--;
16122 if (kernel_accel_max
< kernel_accel_min
)
16124 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
16129 device_param
->kernel_accel_min
= kernel_accel_min
;
16130 device_param
->kernel_accel_max
= kernel_accel_max
;
16133 if (kernel_accel_max < kernel_accel)
16135 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
16137 device_param->kernel_accel = kernel_accel_max;
16141 device_param
->size_bfs
= size_bfs
;
16142 device_param
->size_combs
= size_combs
;
16143 device_param
->size_rules
= size_rules
;
16144 device_param
->size_rules_c
= size_rules_c
;
16145 device_param
->size_pws
= size_pws
;
16146 device_param
->size_tmps
= size_tmps
;
16147 device_param
->size_hooks
= size_hooks
;
16150 * default building options
16153 if (chdir (cpath_real
) == -1)
16155 log_error ("ERROR: %s: %s", cpath_real
, strerror (errno
));
16160 char build_opts
[1024] = { 0 };
16163 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
16165 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
16169 // this test needs to be done manually because of osx opencl runtime
16170 // if there's a problem with permission, its not reporting back and erroring out silently
16172 #define files_cnt 15
16174 const char *files_names
[files_cnt
] =
16176 "inc_cipher_aes256.cl",
16177 "inc_cipher_serpent256.cl",
16178 "inc_cipher_twofish256.cl",
16180 "inc_comp_multi_bs.cl",
16181 "inc_comp_multi.cl",
16182 "inc_comp_single_bs.cl",
16183 "inc_comp_single.cl",
16184 "inc_hash_constants.h",
16185 "inc_hash_functions.cl",
16193 for (int i
= 0; i
< files_cnt
; i
++)
16195 FILE *fd
= fopen (files_names
[i
], "r");
16199 log_error ("ERROR: %s: fopen(): %s", files_names
[i
], strerror (errno
));
16206 size_t n
= fread (buf
, 1, 1, fd
);
16210 log_error ("ERROR: %s: fread(): %s", files_names
[i
], strerror (errno
));
16218 // we don't have sm_* on vendors not NV but it doesn't matter
16220 char build_opts_new
[1024] = { 0 };
16222 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
);
16224 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
16227 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
16236 * kernel source filename
16239 char source_file
[256] = { 0 };
16241 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
16245 if (stat (source_file
, &sst
) == -1)
16247 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16253 * kernel cached filename
16256 char cached_file
[256] = { 0 };
16258 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
16264 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
16270 * kernel compile or load
16273 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16275 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16277 if (force_jit_compilation
== -1)
16281 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
));
16283 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16285 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16287 if (CL_err
!= CL_SUCCESS
)
16289 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16294 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16296 if (CL_err
!= CL_SUCCESS
)
16298 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16304 size_t build_log_size
= 0;
16306 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16308 if (CL_err
!= CL_SUCCESS
)
16310 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16315 if (build_log_size
> 1)
16317 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16319 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16321 if (CL_err
!= CL_SUCCESS
)
16323 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16330 myfree (build_log
);
16334 if (CL_err
!= CL_SUCCESS
)
16336 device_param
->skipped
= true;
16338 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16343 size_t binary_size
;
16345 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16347 if (CL_err
!= CL_SUCCESS
)
16349 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16354 u8
*binary
= (u8
*) mymalloc (binary_size
);
16356 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16358 if (CL_err
!= CL_SUCCESS
)
16360 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16365 writeProgramBin (cached_file
, binary
, binary_size
);
16367 local_free (binary
);
16372 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16375 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16377 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program
);
16379 if (CL_err
!= CL_SUCCESS
)
16381 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16386 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16388 if (CL_err
!= CL_SUCCESS
)
16390 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16399 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
16402 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16404 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16406 if (CL_err
!= CL_SUCCESS
)
16408 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16413 char build_opts_update
[1024] = { 0 };
16415 if (force_jit_compilation
== 1500)
16417 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
16419 else if (force_jit_compilation
== 8900)
16421 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);
16425 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
16428 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
);
16430 if (CL_err
!= CL_SUCCESS
)
16432 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16438 size_t build_log_size
= 0;
16440 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16442 if (CL_err
!= CL_SUCCESS
)
16444 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16449 if (build_log_size
> 1)
16451 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16453 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16455 if (CL_err
!= CL_SUCCESS
)
16457 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16464 myfree (build_log
);
16468 if (CL_err
!= CL_SUCCESS
)
16470 device_param
->skipped
= true;
16472 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16476 local_free (kernel_lengths
);
16477 local_free (kernel_sources
[0]);
16478 local_free (kernel_sources
);
16482 * word generator kernel
16485 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
16488 * kernel mp source filename
16491 char source_file
[256] = { 0 };
16493 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
16497 if (stat (source_file
, &sst
) == -1)
16499 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16505 * kernel mp cached filename
16508 char cached_file
[256] = { 0 };
16510 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
16516 if (stat (cached_file
, &cst
) == -1)
16522 * kernel compile or load
16525 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16527 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16531 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
));
16532 if (quiet
== 0) log_info ("");
16534 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16536 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_mp
);
16538 if (CL_err
!= CL_SUCCESS
)
16540 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16545 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16547 if (CL_err
!= CL_SUCCESS
)
16549 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16554 if (CL_err
!= CL_SUCCESS
)
16556 device_param
->skipped
= true;
16558 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16563 size_t binary_size
;
16565 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16567 if (CL_err
!= CL_SUCCESS
)
16569 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16574 u8
*binary
= (u8
*) mymalloc (binary_size
);
16576 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16578 if (CL_err
!= CL_SUCCESS
)
16580 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16585 writeProgramBin (cached_file
, binary
, binary_size
);
16587 local_free (binary
);
16592 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16595 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16597 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_mp
);
16599 if (CL_err
!= CL_SUCCESS
)
16601 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16606 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16608 if (CL_err
!= CL_SUCCESS
)
16610 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16616 local_free (kernel_lengths
);
16617 local_free (kernel_sources
[0]);
16618 local_free (kernel_sources
);
16625 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16632 * kernel amp source filename
16635 char source_file
[256] = { 0 };
16637 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
16641 if (stat (source_file
, &sst
) == -1)
16643 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16649 * kernel amp cached filename
16652 char cached_file
[256] = { 0 };
16654 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
16660 if (stat (cached_file
, &cst
) == -1)
16666 * kernel compile or load
16669 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16671 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16675 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
));
16676 if (quiet
== 0) log_info ("");
16678 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16680 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_amp
);
16682 if (CL_err
!= CL_SUCCESS
)
16684 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16689 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16691 if (CL_err
!= CL_SUCCESS
)
16693 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16698 if (CL_err
!= CL_SUCCESS
)
16700 device_param
->skipped
= true;
16702 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
16707 size_t binary_size
;
16709 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16711 if (CL_err
!= CL_SUCCESS
)
16713 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16718 u8
*binary
= (u8
*) mymalloc (binary_size
);
16720 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16722 if (CL_err
!= CL_SUCCESS
)
16724 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16729 writeProgramBin (cached_file
, binary
, binary_size
);
16731 local_free (binary
);
16736 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16739 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16741 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_amp
);
16743 if (CL_err
!= CL_SUCCESS
)
16745 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16750 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16752 if (CL_err
!= CL_SUCCESS
)
16754 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16760 local_free (kernel_lengths
);
16761 local_free (kernel_sources
[0]);
16762 local_free (kernel_sources
);
16765 // return back to the folder we came from initially (workaround)
16767 if (chdir (cwd
) == -1)
16769 log_error ("ERROR: %s: %s", cwd
, strerror (errno
));
16774 // some algorithm collide too fast, make that impossible
16776 if (benchmark
== 1)
16778 ((uint
*) digests_buf
)[0] = -1;
16779 ((uint
*) digests_buf
)[1] = -1;
16780 ((uint
*) digests_buf
)[2] = -1;
16781 ((uint
*) digests_buf
)[3] = -1;
16788 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_buf
);
16789 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_amp_buf
);
16790 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
, &device_param
->d_tmps
);
16791 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
, &device_param
->d_hooks
);
16792 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_a
);
16793 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_b
);
16794 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_c
);
16795 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_d
);
16796 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_a
);
16797 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_b
);
16798 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_c
);
16799 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_d
);
16800 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
, &device_param
->d_plain_bufs
);
16801 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
, &device_param
->d_digests_buf
);
16802 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
, &device_param
->d_digests_shown
);
16803 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
, &device_param
->d_salt_bufs
);
16804 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
, &device_param
->d_result
);
16805 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV0_buf
);
16806 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV1_buf
);
16807 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV2_buf
);
16808 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV3_buf
);
16810 if (CL_err
!= CL_SUCCESS
)
16812 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16817 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
);
16818 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
);
16819 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
);
16820 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
);
16821 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
);
16822 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
);
16823 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
);
16824 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
);
16825 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
);
16826 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
);
16827 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
);
16829 if (CL_err
!= CL_SUCCESS
)
16831 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16840 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16842 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
, &device_param
->d_rules
);
16843 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
, &device_param
->d_rules_c
);
16845 if (CL_err
!= CL_SUCCESS
)
16847 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16852 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
);
16854 if (CL_err
!= CL_SUCCESS
)
16856 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16861 else if (attack_kern
== ATTACK_KERN_COMBI
)
16863 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs
);
16864 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs_c
);
16865 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16866 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16868 if (CL_err
!= CL_SUCCESS
)
16870 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16875 else if (attack_kern
== ATTACK_KERN_BF
)
16877 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs
);
16878 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs_c
);
16879 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
, &device_param
->d_tm_c
);
16880 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16881 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16883 if (CL_err
!= CL_SUCCESS
)
16885 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16893 CL_err
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
, &device_param
->d_esalt_bufs
);
16895 if (CL_err
!= CL_SUCCESS
)
16897 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16902 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
);
16904 if (CL_err
!= CL_SUCCESS
)
16906 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16916 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16918 device_param
->pws_buf
= pws_buf
;
16920 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16922 device_param
->combs_buf
= combs_buf
;
16924 void *hooks_buf
= mymalloc (size_hooks
);
16926 device_param
->hooks_buf
= hooks_buf
;
16932 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16933 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16934 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16935 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16936 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16937 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16938 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16939 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16940 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16941 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16942 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16944 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16945 ? &device_param
->d_pws_buf
16946 : &device_param
->d_pws_amp_buf
;
16947 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16948 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
16949 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
16950 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
16951 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
16952 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
16953 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
16954 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
16955 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
16956 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
16957 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
16958 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
16959 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
16960 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
16961 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
16962 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
16963 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
16964 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
16965 device_param
->kernel_params
[19] = &device_param
->d_result
;
16966 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
16967 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
16968 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
16969 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
16970 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
16971 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
16972 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
16973 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
16974 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
16975 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
16976 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
16977 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
16978 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
16979 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
16980 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
16982 device_param
->kernel_params_mp_buf64
[3] = 0;
16983 device_param
->kernel_params_mp_buf32
[4] = 0;
16984 device_param
->kernel_params_mp_buf32
[5] = 0;
16985 device_param
->kernel_params_mp_buf32
[6] = 0;
16986 device_param
->kernel_params_mp_buf32
[7] = 0;
16987 device_param
->kernel_params_mp_buf32
[8] = 0;
16989 device_param
->kernel_params_mp
[0] = NULL
;
16990 device_param
->kernel_params_mp
[1] = NULL
;
16991 device_param
->kernel_params_mp
[2] = NULL
;
16992 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
16993 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
16994 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
16995 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
16996 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
16997 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
16999 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17000 device_param
->kernel_params_mp_l_buf32
[4] = 0;
17001 device_param
->kernel_params_mp_l_buf32
[5] = 0;
17002 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17003 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17004 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17005 device_param
->kernel_params_mp_l_buf32
[9] = 0;
17007 device_param
->kernel_params_mp_l
[0] = NULL
;
17008 device_param
->kernel_params_mp_l
[1] = NULL
;
17009 device_param
->kernel_params_mp_l
[2] = NULL
;
17010 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
17011 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
17012 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
17013 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
17014 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
17015 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
17016 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
17018 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17019 device_param
->kernel_params_mp_r_buf32
[4] = 0;
17020 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17021 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17022 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17023 device_param
->kernel_params_mp_r_buf32
[8] = 0;
17025 device_param
->kernel_params_mp_r
[0] = NULL
;
17026 device_param
->kernel_params_mp_r
[1] = NULL
;
17027 device_param
->kernel_params_mp_r
[2] = NULL
;
17028 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
17029 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
17030 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
17031 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
17032 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
17033 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
17035 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
17036 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
17038 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
17039 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
17040 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
17041 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
17042 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
17043 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
17044 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
17046 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
17047 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
17049 device_param
->kernel_params_memset_buf32
[1] = 0; // value
17050 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
17052 device_param
->kernel_params_memset
[0] = NULL
;
17053 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
17054 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
17060 size_t kernel_wgs_tmp
;
17062 char kernel_name
[64] = { 0 };
17064 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17066 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17068 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
17070 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17072 if (CL_err
!= CL_SUCCESS
)
17074 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17079 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
17081 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17083 if (CL_err
!= CL_SUCCESS
)
17085 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17090 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
17092 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17094 if (CL_err
!= CL_SUCCESS
)
17096 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17103 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
17105 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17107 if (CL_err
!= CL_SUCCESS
)
17109 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17114 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
17116 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17118 if (CL_err
!= CL_SUCCESS
)
17120 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17125 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
17127 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17129 if (CL_err
!= CL_SUCCESS
)
17131 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17137 if (data
.attack_mode
== ATTACK_MODE_BF
)
17139 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17141 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
17143 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel_tm
);
17145 if (CL_err
!= CL_SUCCESS
)
17147 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17152 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
);
17154 if (CL_err
!= CL_SUCCESS
)
17156 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17165 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
17167 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
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_loop", kern_type
);
17178 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17180 if (CL_err
!= CL_SUCCESS
)
17182 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17187 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
17189 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17191 if (CL_err
!= CL_SUCCESS
)
17193 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17198 if (opts_type
& OPTS_TYPE_HOOK12
)
17200 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
17202 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel12
);
17204 if (CL_err
!= CL_SUCCESS
)
17206 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17211 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
);
17213 if (CL_err
!= CL_SUCCESS
)
17215 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17221 if (opts_type
& OPTS_TYPE_HOOK23
)
17223 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
17225 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel23
);
17227 if (CL_err
!= CL_SUCCESS
)
17229 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17234 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
);
17236 if (CL_err
!= CL_SUCCESS
)
17238 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17245 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
);
17246 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
);
17247 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
);
17249 if (CL_err
!= CL_SUCCESS
)
17251 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17256 for (uint i
= 0; i
<= 23; i
++)
17258 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17259 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17260 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17262 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17263 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17265 if (CL_err
!= CL_SUCCESS
)
17267 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17273 for (uint i
= 24; i
<= 34; i
++)
17275 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17276 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17277 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17279 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17280 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17282 if (CL_err
!= CL_SUCCESS
)
17284 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17292 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset", &device_param
->kernel_memset
);
17294 if (CL_err
!= CL_SUCCESS
)
17296 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17301 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
);
17303 if (CL_err
!= CL_SUCCESS
)
17305 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17310 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
17311 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
17312 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
17314 if (CL_err
!= CL_SUCCESS
)
17316 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17323 if (attack_mode
== ATTACK_MODE_BF
)
17325 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov", &device_param
->kernel_mp_l
);
17326 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov", &device_param
->kernel_mp_r
);
17328 if (CL_err
!= CL_SUCCESS
)
17330 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17335 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
);
17336 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
);
17338 if (CL_err
!= CL_SUCCESS
)
17340 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17345 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17347 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
17348 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
17350 if (CL_err
!= CL_SUCCESS
)
17352 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17358 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
17360 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17362 if (CL_err
!= CL_SUCCESS
)
17364 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17369 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
);
17371 if (CL_err
!= CL_SUCCESS
)
17373 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17378 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17380 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17382 if (CL_err
!= CL_SUCCESS
)
17384 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17389 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
);
17391 if (CL_err
!= CL_SUCCESS
)
17393 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17399 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17405 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp", &device_param
->kernel_amp
);
17407 if (CL_err
!= CL_SUCCESS
)
17409 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17414 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
);
17416 if (CL_err
!= CL_SUCCESS
)
17418 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17424 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17430 for (uint i
= 0; i
< 5; i
++)
17432 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
17434 if (CL_err
!= CL_SUCCESS
)
17436 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17442 for (uint i
= 5; i
< 7; i
++)
17444 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
17446 if (CL_err
!= CL_SUCCESS
)
17448 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17455 // maybe this has been updated by clGetKernelWorkGroupInfo()
17456 // value can only be decreased, so we don't need to reallocate buffers
17458 device_param
->kernel_threads
= kernel_threads
;
17460 // zero some data buffers
17462 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
17463 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
17464 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
17465 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
17466 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
17467 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
17473 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
17475 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
17477 else if (attack_kern
== ATTACK_KERN_COMBI
)
17479 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
17480 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
17481 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17482 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17484 else if (attack_kern
== ATTACK_KERN_BF
)
17486 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
17487 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
17488 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
17489 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17490 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17493 #if defined(HAVE_HWMON)
17496 * Store initial fanspeed if gpu_temp_retain is enabled
17499 if (gpu_temp_disable
== 0)
17501 if (gpu_temp_retain
!= 0)
17503 hc_thread_mutex_lock (mux_adl
);
17505 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
17507 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
17508 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
17510 // we also set it to tell the OS we take control over the fan and it's automatic controller
17511 // if it was set to automatic. we do not control user-defined fanspeeds.
17513 if (fanpolicy
== 1)
17515 data
.hm_device
[device_id
].fan_set_supported
= 1;
17519 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17521 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
17523 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17526 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
17530 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
17536 data
.hm_device
[device_id
].fan_set_supported
= 1;
17540 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
17542 data
.hm_device
[device_id
].fan_set_supported
= 0;
17547 data
.hm_device
[device_id
].fan_set_supported
= 0;
17551 hc_thread_mutex_unlock (mux_adl
);
17555 #endif // HAVE_HWMON
17558 if (data
.quiet
== 0) log_info_nn ("");
17561 * In benchmark-mode, inform user which algorithm is checked
17564 if (benchmark
== 1)
17566 if (machine_readable
== 0)
17570 data
.quiet
= quiet
;
17572 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
17574 log_info ("Hashtype: %s", hash_type
);
17580 * keep track of the progress
17583 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17584 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17585 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17592 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
17594 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
17599 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
17601 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
17606 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
17608 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
17618 segment_size
*= (1024 * 1024);
17620 data
.segment_size
= segment_size
;
17622 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
17624 wl_data
->buf
= (char *) mymalloc (segment_size
);
17625 wl_data
->avail
= segment_size
;
17626 wl_data
->incr
= segment_size
;
17630 cs_t
*css_buf
= NULL
;
17634 char **masks
= NULL
;
17635 char **dictfiles
= NULL
;
17637 uint mask_from_file
= 0;
17639 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17641 if (wordlist_mode
== WL_MODE_FILE
)
17643 int wls_left
= myargc
- (optind
+ 1);
17645 for (int i
= 0; i
< wls_left
; i
++)
17647 char *l0_filename
= myargv
[optind
+ 1 + i
];
17649 struct stat l0_stat
;
17651 if (stat (l0_filename
, &l0_stat
) == -1)
17653 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
17658 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
17662 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17666 dictfiles
[dictcnt
- 1] = l0_filename
;
17670 // do not allow --keyspace w/ a directory
17674 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17679 char **dictionary_files
= NULL
;
17681 dictionary_files
= scan_directory (l0_filename
);
17683 if (dictionary_files
!= NULL
)
17685 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17687 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17689 char *l1_filename
= dictionary_files
[d
];
17691 struct stat l1_stat
;
17693 if (stat (l1_filename
, &l1_stat
) == -1)
17695 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17700 if (S_ISREG (l1_stat
.st_mode
))
17702 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17706 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17711 local_free (dictionary_files
);
17717 log_error ("ERROR: No usable dictionary file found.");
17722 else if (wordlist_mode
== WL_MODE_STDIN
)
17727 else if (attack_mode
== ATTACK_MODE_COMBI
)
17731 char *dictfile1
= myargv
[optind
+ 1 + 0];
17732 char *dictfile2
= myargv
[optind
+ 1 + 1];
17734 // find the bigger dictionary and use as base
17739 struct stat tmp_stat
;
17741 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
17743 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17748 if (stat (dictfile1
, &tmp_stat
) == -1)
17750 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17757 if (S_ISDIR (tmp_stat
.st_mode
))
17759 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
17766 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
17768 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17775 if (stat (dictfile2
, &tmp_stat
) == -1)
17777 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17785 if (S_ISDIR (tmp_stat
.st_mode
))
17787 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
17795 data
.combs_cnt
= 1;
17799 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
17801 data
.quiet
= quiet
;
17803 if (words1_cnt
== 0)
17805 log_error ("ERROR: %s: empty file", dictfile1
);
17813 data
.combs_cnt
= 1;
17817 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17819 data
.quiet
= quiet
;
17821 if (words2_cnt
== 0)
17823 log_error ("ERROR: %s: empty file", dictfile2
);
17834 data
.dictfile
= dictfile1
;
17835 data
.dictfile2
= dictfile2
;
17837 if (words1_cnt
>= words2_cnt
)
17839 data
.combs_cnt
= words2_cnt
;
17840 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
17842 dictfiles
= &data
.dictfile
;
17848 data
.combs_cnt
= words1_cnt
;
17849 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17851 dictfiles
= &data
.dictfile2
;
17855 // we also have to switch wordlist related rules!
17857 char *tmpc
= data
.rule_buf_l
;
17859 data
.rule_buf_l
= data
.rule_buf_r
;
17860 data
.rule_buf_r
= tmpc
;
17862 int tmpi
= data
.rule_len_l
;
17864 data
.rule_len_l
= data
.rule_len_r
;
17865 data
.rule_len_r
= tmpi
;
17868 else if (attack_mode
== ATTACK_MODE_BF
)
17874 if (benchmark
== 0)
17876 mask
= myargv
[optind
+ 1];
17878 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
17880 if ((optind
+ 2) <= myargc
)
17882 struct stat file_stat
;
17884 if (stat (mask
, &file_stat
) == -1)
17888 masks
[maskcnt
- 1] = mystrdup (mask
);
17892 int wls_left
= myargc
- (optind
+ 1);
17894 uint masks_avail
= INCR_MASKS
;
17896 for (int i
= 0; i
< wls_left
; i
++)
17900 mask
= myargv
[optind
+ 1 + i
];
17902 if (stat (mask
, &file_stat
) == -1)
17904 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17910 uint is_file
= S_ISREG (file_stat
.st_mode
);
17916 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17918 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17923 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17925 while (!feof (mask_fp
))
17927 memset (line_buf
, 0, HCBUFSIZ
);
17929 int line_len
= fgetl (mask_fp
, line_buf
);
17931 if (line_len
== 0) continue;
17933 if (line_buf
[0] == '#') continue;
17935 if (masks_avail
== maskcnt
)
17937 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17939 masks_avail
+= INCR_MASKS
;
17942 masks
[maskcnt
] = mystrdup (line_buf
);
17953 log_error ("ERROR: %s: unsupported file-type", mask
);
17959 mask_from_file
= 1;
17964 custom_charset_1
= (char *) "?l?d?u";
17965 custom_charset_2
= (char *) "?l?d";
17966 custom_charset_3
= (char *) "?l?d*!$@_";
17968 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
17969 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
17970 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
17972 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
17974 wordlist_mode
= WL_MODE_MASK
;
17976 data
.wordlist_mode
= wordlist_mode
;
17986 * generate full masks and charsets
17989 masks
= (char **) mymalloc (sizeof (char *));
17993 case 1731: pw_min
= 5;
17995 mask
= mystrdup ("?b?b?b?b?b");
17997 case 12500: pw_min
= 5;
17999 mask
= mystrdup ("?b?b?b?b?b");
18001 default: pw_min
= 7;
18003 mask
= mystrdup ("?b?b?b?b?b?b?b");
18009 masks
[maskcnt
- 1] = mystrdup (mask
);
18011 wordlist_mode
= WL_MODE_MASK
;
18013 data
.wordlist_mode
= wordlist_mode
;
18018 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
18022 if (increment_min
> pw_min
) pw_min
= increment_min
;
18024 if (increment_max
< pw_max
) pw_max
= increment_max
;
18027 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
18029 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
18033 char *mask
= myargv
[myargc
- 1];
18037 masks
= (char **) mymalloc (1 * sizeof (char *));
18041 struct stat file_stat
;
18043 if (stat (mask
, &file_stat
) == -1)
18047 masks
[maskcnt
- 1] = mystrdup (mask
);
18051 uint is_file
= S_ISREG (file_stat
.st_mode
);
18057 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18059 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18064 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18066 uint masks_avail
= 1;
18068 while (!feof (mask_fp
))
18070 memset (line_buf
, 0, HCBUFSIZ
);
18072 int line_len
= fgetl (mask_fp
, line_buf
);
18074 if (line_len
== 0) continue;
18076 if (line_buf
[0] == '#') continue;
18078 if (masks_avail
== maskcnt
)
18080 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18082 masks_avail
+= INCR_MASKS
;
18085 masks
[maskcnt
] = mystrdup (line_buf
);
18094 mask_from_file
= 1;
18100 masks
[maskcnt
- 1] = mystrdup (mask
);
18106 int wls_left
= myargc
- (optind
+ 2);
18108 for (int i
= 0; i
< wls_left
; i
++)
18110 char *filename
= myargv
[optind
+ 1 + i
];
18112 struct stat file_stat
;
18114 if (stat (filename
, &file_stat
) == -1)
18116 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18121 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18125 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18129 dictfiles
[dictcnt
- 1] = filename
;
18133 // do not allow --keyspace w/ a directory
18137 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18142 char **dictionary_files
= NULL
;
18144 dictionary_files
= scan_directory (filename
);
18146 if (dictionary_files
!= NULL
)
18148 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18150 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18152 char *l1_filename
= dictionary_files
[d
];
18154 struct stat l1_stat
;
18156 if (stat (l1_filename
, &l1_stat
) == -1)
18158 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18163 if (S_ISREG (l1_stat
.st_mode
))
18165 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18169 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18174 local_free (dictionary_files
);
18180 log_error ("ERROR: No usable dictionary file found.");
18189 uint mask_min
= increment_min
; // we can't reject smaller masks here
18190 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18192 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18194 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18196 if (cur_mask
== NULL
) break;
18198 masks
[maskcnt
] = cur_mask
;
18202 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18206 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18208 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
18212 char *mask
= myargv
[optind
+ 1 + 0];
18216 masks
= (char **) mymalloc (1 * sizeof (char *));
18220 struct stat file_stat
;
18222 if (stat (mask
, &file_stat
) == -1)
18226 masks
[maskcnt
- 1] = mystrdup (mask
);
18230 uint is_file
= S_ISREG (file_stat
.st_mode
);
18236 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18238 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18243 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18245 uint masks_avail
= 1;
18247 while (!feof (mask_fp
))
18249 memset (line_buf
, 0, HCBUFSIZ
);
18251 int line_len
= fgetl (mask_fp
, line_buf
);
18253 if (line_len
== 0) continue;
18255 if (line_buf
[0] == '#') continue;
18257 if (masks_avail
== maskcnt
)
18259 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18261 masks_avail
+= INCR_MASKS
;
18264 masks
[maskcnt
] = mystrdup (line_buf
);
18273 mask_from_file
= 1;
18279 masks
[maskcnt
- 1] = mystrdup (mask
);
18285 int wls_left
= myargc
- (optind
+ 2);
18287 for (int i
= 0; i
< wls_left
; i
++)
18289 char *filename
= myargv
[optind
+ 2 + i
];
18291 struct stat file_stat
;
18293 if (stat (filename
, &file_stat
) == -1)
18295 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18300 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18304 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18308 dictfiles
[dictcnt
- 1] = filename
;
18312 // do not allow --keyspace w/ a directory
18316 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18321 char **dictionary_files
= NULL
;
18323 dictionary_files
= scan_directory (filename
);
18325 if (dictionary_files
!= NULL
)
18327 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18329 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18331 char *l1_filename
= dictionary_files
[d
];
18333 struct stat l1_stat
;
18335 if (stat (l1_filename
, &l1_stat
) == -1)
18337 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18342 if (S_ISREG (l1_stat
.st_mode
))
18344 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18348 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18353 local_free (dictionary_files
);
18359 log_error ("ERROR: No usable dictionary file found.");
18368 uint mask_min
= increment_min
; // we can't reject smaller masks here
18369 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18371 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18373 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18375 if (cur_mask
== NULL
) break;
18377 masks
[maskcnt
] = cur_mask
;
18381 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18386 data
.pw_min
= pw_min
;
18387 data
.pw_max
= pw_max
;
18393 if (weak_hash_threshold
>= salts_cnt
)
18395 hc_device_param_t
*device_param
= NULL
;
18397 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18399 device_param
= &data
.devices_param
[device_id
];
18401 if (device_param
->skipped
) continue;
18406 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
18408 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
18410 weak_hash_check (device_param
, salt_pos
);
18413 // Display hack, guarantee that there is at least one \r before real start
18415 //if (data.quiet == 0) log_info ("");
18419 * status and monitor threads
18422 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18424 data
.devices_status
= STATUS_STARTING
;
18427 uint inner_threads_cnt
= 0;
18429 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
18431 data
.shutdown_inner
= 0;
18437 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
18439 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
18441 inner_threads_cnt
++;
18443 if (outfile_check_timer
!= 0)
18445 if (data
.outfile_check_directory
!= NULL
)
18447 if ((hash_mode
!= 5200) &&
18448 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
18449 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
18450 (hash_mode
!= 9000))
18452 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
18454 inner_threads_cnt
++;
18458 outfile_check_timer
= 0;
18463 outfile_check_timer
= 0;
18469 * Inform the user if we got some hashes remove because of the pot file remove feature
18472 if (data
.quiet
== 0)
18474 if (potfile_remove_cracks
> 0)
18476 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
18477 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
18481 data
.outfile_check_timer
= outfile_check_timer
;
18487 char **induction_dictionaries
= NULL
;
18489 int induction_dictionaries_cnt
= 0;
18491 hcstat_table_t
*root_table_buf
= NULL
;
18492 hcstat_table_t
*markov_table_buf
= NULL
;
18494 uint initial_restore_done
= 0;
18496 data
.maskcnt
= maskcnt
;
18498 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
18500 if (data
.devices_status
== STATUS_CRACKED
) continue;
18501 if (data
.devices_status
== STATUS_ABORTED
) continue;
18502 if (data
.devices_status
== STATUS_QUIT
) continue;
18504 if (maskpos
> rd
->maskpos
)
18509 rd
->maskpos
= maskpos
;
18510 data
.maskpos
= maskpos
;
18512 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
18514 char *mask
= masks
[maskpos
];
18516 if (mask_from_file
== 1)
18518 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
18523 uint mask_offset
= 0;
18525 uint separator_cnt
;
18527 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
18529 str_ptr
= strstr (mask
+ mask_offset
, ",");
18531 if (str_ptr
== NULL
) break;
18533 str_pos
= str_ptr
- mask
;
18535 // escaped separator, i.e. "\,"
18539 if (mask
[str_pos
- 1] == '\\')
18543 mask_offset
= str_pos
+ 1;
18549 // reset the offset
18553 mask
[str_pos
] = '\0';
18555 switch (separator_cnt
)
18558 mp_reset_usr (mp_usr
, 0);
18560 custom_charset_1
= mask
;
18561 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18565 mp_reset_usr (mp_usr
, 1);
18567 custom_charset_2
= mask
;
18568 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18572 mp_reset_usr (mp_usr
, 2);
18574 custom_charset_3
= mask
;
18575 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18579 mp_reset_usr (mp_usr
, 3);
18581 custom_charset_4
= mask
;
18582 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
18586 mask
= mask
+ str_pos
+ 1;
18590 * 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 "\")
18591 * it would be interpreted as a custom charset definition.
18593 * We need to replace all "\," with just "," within the mask (but allow the special case "\\," which means "\" followed by ",")
18594 * 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 ","
18597 uint mask_len_cur
= strlen (mask
);
18599 uint mask_out_pos
= 0;
18600 char mask_prev
= 0;
18602 for (uint mask_iter
= 0; mask_iter
< mask_len_cur
; mask_iter
++, mask_out_pos
++)
18604 if (mask
[mask_iter
] == ',')
18606 if (mask_prev
== '\\')
18608 mask_out_pos
-= 1; // this means: skip the previous "\"
18612 mask_prev
= mask
[mask_iter
];
18614 mask
[mask_out_pos
] = mask
[mask_iter
];
18617 mask
[mask_out_pos
] = '\0';
18620 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18624 local_free (css_buf
);
18625 local_free (data
.root_css_buf
);
18626 local_free (data
.markov_css_buf
);
18628 local_free (masks
[maskpos
- 1]);
18631 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18634 data
.css_cnt
= css_cnt
;
18635 data
.css_buf
= css_buf
;
18637 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
18639 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
18641 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
18642 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
18644 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
18646 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
18648 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
18649 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
18651 data
.root_css_buf
= root_css_buf
;
18652 data
.markov_css_buf
= markov_css_buf
;
18654 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
18656 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
18658 local_free (root_table_buf
);
18659 local_free (markov_table_buf
);
18663 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18665 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18667 if (device_param
->skipped
) continue;
18669 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
18670 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
18671 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
18673 device_param
->kernel_params_mp_buf64
[3] = 0;
18674 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
18675 device_param
->kernel_params_mp_buf32
[5] = 0;
18676 device_param
->kernel_params_mp_buf32
[6] = 0;
18677 device_param
->kernel_params_mp_buf32
[7] = 0;
18679 if (attack_mode
== ATTACK_MODE_HYBRID1
)
18681 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
18682 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
18683 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
18684 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
18686 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18688 device_param
->kernel_params_mp_buf32
[5] = 0;
18689 device_param
->kernel_params_mp_buf32
[6] = 0;
18690 device_param
->kernel_params_mp_buf32
[7] = 0;
18693 cl_int CL_err
= CL_SUCCESS
;
18695 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
]);
18696 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
]);
18697 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
]);
18699 if (CL_err
!= CL_SUCCESS
)
18701 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
18706 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
);
18707 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
);
18709 if (CL_err
!= CL_SUCCESS
)
18711 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
18717 else if (attack_mode
== ATTACK_MODE_BF
)
18719 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
18723 for (uint i
= 0; i
< dictcnt
; i
++)
18725 local_free (dictfiles
[i
]);
18728 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
18730 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
18732 if (l1_filename
== NULL
) break;
18736 dictfiles
[dictcnt
- 1] = l1_filename
;
18743 dictfiles
[dictcnt
- 1] = mask
;
18748 log_error ("ERROR: Mask is too small");
18755 free (induction_dictionaries
);
18757 // induction_dictionaries_cnt = 0; // implied
18759 if (attack_mode
!= ATTACK_MODE_BF
)
18763 induction_dictionaries
= scan_directory (induction_directory
);
18765 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18769 if (induction_dictionaries_cnt
)
18771 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18775 * prevent the user from using --keyspace together w/ maskfile and or dictfile
18779 if ((maskcnt
> 1) || (dictcnt
> 1))
18781 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
18787 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
18789 if (data
.devices_status
== STATUS_CRACKED
) continue;
18790 if (data
.devices_status
== STATUS_ABORTED
) continue;
18791 if (data
.devices_status
== STATUS_QUIT
) continue;
18793 rd
->dictpos
= dictpos
;
18795 char *subid
= logfile_generate_subid ();
18797 data
.subid
= subid
;
18799 logfile_sub_msg ("START");
18801 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18803 data
.devices_status
= STATUS_INIT
;
18806 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
18807 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
18808 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
18810 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
18814 data
.cpt_start
= time (NULL
);
18816 data
.cpt_total
= 0;
18818 if (data
.restore
== 0)
18820 rd
->words_cur
= skip
;
18827 data
.ms_paused
= 0;
18829 data
.kernel_power_final
= 0;
18831 data
.words_cur
= rd
->words_cur
;
18833 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18835 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18837 if (device_param
->skipped
) continue;
18839 device_param
->speed_pos
= 0;
18841 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
18842 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
18844 device_param
->exec_pos
= 0;
18846 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
18848 device_param
->outerloop_pos
= 0;
18849 device_param
->outerloop_left
= 0;
18850 device_param
->innerloop_pos
= 0;
18851 device_param
->innerloop_left
= 0;
18853 // some more resets:
18855 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
18857 device_param
->pws_cnt
= 0;
18859 device_param
->words_off
= 0;
18860 device_param
->words_done
= 0;
18863 // figure out some workload
18865 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18867 if (data
.wordlist_mode
== WL_MODE_FILE
)
18869 char *dictfile
= NULL
;
18871 if (induction_dictionaries_cnt
)
18873 dictfile
= induction_dictionaries
[0];
18877 dictfile
= dictfiles
[dictpos
];
18880 data
.dictfile
= dictfile
;
18882 logfile_sub_string (dictfile
);
18884 for (uint i
= 0; i
< rp_files_cnt
; i
++)
18886 logfile_sub_var_string ("rulefile", rp_files
[i
]);
18889 FILE *fd2
= fopen (dictfile
, "rb");
18893 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18898 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18902 if (data
.words_cnt
== 0)
18904 logfile_sub_msg ("STOP");
18910 else if (attack_mode
== ATTACK_MODE_COMBI
)
18912 char *dictfile
= data
.dictfile
;
18913 char *dictfile2
= data
.dictfile2
;
18915 logfile_sub_string (dictfile
);
18916 logfile_sub_string (dictfile2
);
18918 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
18920 FILE *fd2
= fopen (dictfile
, "rb");
18924 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18929 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18933 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
18935 FILE *fd2
= fopen (dictfile2
, "rb");
18939 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
18944 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
18949 if (data
.words_cnt
== 0)
18951 logfile_sub_msg ("STOP");
18956 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18958 char *dictfile
= NULL
;
18960 if (induction_dictionaries_cnt
)
18962 dictfile
= induction_dictionaries
[0];
18966 dictfile
= dictfiles
[dictpos
];
18969 data
.dictfile
= dictfile
;
18971 char *mask
= data
.mask
;
18973 logfile_sub_string (dictfile
);
18974 logfile_sub_string (mask
);
18976 FILE *fd2
= fopen (dictfile
, "rb");
18980 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18985 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18989 if (data
.words_cnt
== 0)
18991 logfile_sub_msg ("STOP");
18996 else if (attack_mode
== ATTACK_MODE_BF
)
18998 local_free (css_buf
);
18999 local_free (data
.root_css_buf
);
19000 local_free (data
.markov_css_buf
);
19002 char *mask
= dictfiles
[dictpos
];
19004 logfile_sub_string (mask
);
19008 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
19010 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19012 uint css_cnt_unicode
= css_cnt
* 2;
19014 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
19016 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
19018 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
19020 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
19021 css_buf_unicode
[j
+ 1].cs_len
= 1;
19026 css_buf
= css_buf_unicode
;
19027 css_cnt
= css_cnt_unicode
;
19030 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
19032 uint mask_min
= pw_min
;
19033 uint mask_max
= pw_max
;
19035 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19041 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
19043 if (css_cnt
< mask_min
)
19045 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
19048 if (css_cnt
> mask_max
)
19050 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
19053 // skip to next mask
19055 logfile_sub_msg ("STOP");
19060 uint save_css_cnt
= css_cnt
;
19062 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
19064 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
19066 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
19067 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
19069 uint css_cnt_salt
= css_cnt
+ salt_len
;
19071 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
19073 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
19075 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
19077 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
19078 css_buf_salt
[j
].cs_len
= 1;
19083 css_buf
= css_buf_salt
;
19084 css_cnt
= css_cnt_salt
;
19089 data
.css_cnt
= css_cnt
;
19090 data
.css_buf
= css_buf
;
19092 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
19094 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
19096 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
19098 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
19099 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
19101 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
19103 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
19105 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
19106 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
19108 data
.root_css_buf
= root_css_buf
;
19109 data
.markov_css_buf
= markov_css_buf
;
19111 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
19113 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
19115 local_free (root_table_buf
);
19116 local_free (markov_table_buf
);
19120 uint css_cnt_l
= css_cnt
;
19123 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
19125 if (save_css_cnt
< 6)
19129 else if (save_css_cnt
== 6)
19135 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19137 if (save_css_cnt
== 8 || save_css_cnt
== 10)
19148 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
19163 /* unfinished code?
19164 int sum = css_buf[css_cnt_r - 1].cs_len;
19166 for (uint i = 1; i < 4 && i < css_cnt; i++)
19168 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
19172 sum *= css_buf[css_cnt_r - 1].cs_len;
19177 css_cnt_l
-= css_cnt_r
;
19179 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
19181 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19183 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19185 if (device_param
->skipped
) continue;
19187 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
19188 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
19189 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
19191 device_param
->kernel_params_mp_l_buf64
[3] = 0;
19192 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
19193 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
19194 device_param
->kernel_params_mp_l_buf32
[6] = 0;
19195 device_param
->kernel_params_mp_l_buf32
[7] = 0;
19196 device_param
->kernel_params_mp_l_buf32
[8] = 0;
19198 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
19199 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
19200 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
19201 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
19203 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
19204 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
19205 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
19207 device_param
->kernel_params_mp_r_buf64
[3] = 0;
19208 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
19209 device_param
->kernel_params_mp_r_buf32
[5] = 0;
19210 device_param
->kernel_params_mp_r_buf32
[6] = 0;
19211 device_param
->kernel_params_mp_r_buf32
[7] = 0;
19213 cl_int CL_err
= CL_SUCCESS
;
19215 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
]);
19216 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
]);
19217 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
]);
19219 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
]);
19220 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
]);
19221 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
]);
19223 if (CL_err
!= CL_SUCCESS
)
19225 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
19230 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
);
19231 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
);
19233 if (CL_err
!= CL_SUCCESS
)
19235 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
19242 u64 words_base
= data
.words_cnt
;
19244 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19246 if (data
.kernel_rules_cnt
)
19248 words_base
/= data
.kernel_rules_cnt
;
19251 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19253 if (data
.combs_cnt
)
19255 words_base
/= data
.combs_cnt
;
19258 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19262 words_base
/= data
.bfs_cnt
;
19266 data
.words_base
= words_base
;
19270 log_info ("%llu", (unsigned long long int) words_base
);
19275 if (data
.words_cur
> data
.words_base
)
19277 log_error ("ERROR: Restore value greater keyspace");
19282 if (data
.words_cur
)
19284 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19286 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19288 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
19291 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19293 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19295 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
19298 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19300 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19302 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
19308 * Update loopback file
19317 uint random_num
= get_random_num (0, 9999);
19319 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
19321 data
.loopback_file
= loopback_file
;
19325 * Update dictionary statistic
19330 dictstat_fp
= fopen (dictstat
, "wb");
19334 lock_file (dictstat_fp
);
19336 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
19338 fclose (dictstat_fp
);
19343 * create autotune threads
19346 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
19348 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19350 data
.devices_status
= STATUS_AUTOTUNE
;
19353 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19355 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19357 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
19360 hc_thread_wait (data
.devices_cnt
, c_threads
);
19363 * Inform user about possible slow speeds
19366 uint hardware_power_all
= 0;
19368 uint kernel_power_all
= 0;
19370 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19372 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19374 hardware_power_all
+= device_param
->hardware_power
;
19376 kernel_power_all
+= device_param
->kernel_power
;
19379 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
19381 data
.kernel_power_all
= kernel_power_all
;
19383 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19385 if (data
.words_base
< kernel_power_all
)
19391 log_info ("ATTENTION!");
19392 log_info (" The wordlist or mask you are using is too small.");
19393 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
19394 log_info (" The cracking speed will drop.");
19395 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
19402 * create cracker threads
19405 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19407 data
.devices_status
= STATUS_RUNNING
;
19410 if (initial_restore_done
== 0)
19412 if (data
.restore_disable
== 0) cycle_restore ();
19414 initial_restore_done
= 1;
19417 hc_timer_set (&data
.timer_running
);
19419 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19421 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
19423 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
19424 if (quiet
== 0) fflush (stdout
);
19427 else if (wordlist_mode
== WL_MODE_STDIN
)
19429 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
19430 if (data
.quiet
== 0) log_info ("");
19433 time_t runtime_start
;
19435 time (&runtime_start
);
19437 data
.runtime_start
= runtime_start
;
19439 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19441 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19443 if (wordlist_mode
== WL_MODE_STDIN
)
19445 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
19449 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
19453 hc_thread_wait (data
.devices_cnt
, c_threads
);
19455 local_free (c_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_EXHAUSTED
;
19462 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
19466 if (induction_dictionaries_cnt
)
19468 unlink (induction_dictionaries
[0]);
19471 free (induction_dictionaries
);
19473 if (attack_mode
!= ATTACK_MODE_BF
)
19475 induction_dictionaries
= scan_directory (induction_directory
);
19477 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
19480 if (benchmark
== 1)
19482 status_benchmark ();
19484 if (machine_readable
== 0)
19510 if (induction_dictionaries_cnt
)
19512 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
19514 // 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)
19519 time_t runtime_stop
;
19521 time (&runtime_stop
);
19523 data
.runtime_stop
= runtime_stop
;
19525 logfile_sub_uint (runtime_start
);
19526 logfile_sub_uint (runtime_stop
);
19528 logfile_sub_msg ("STOP");
19530 global_free (subid
);
19532 // from this point we handle bypass as running
19534 if (data
.devices_status
== STATUS_BYPASS
)
19536 data
.devices_status
= STATUS_RUNNING
;
19539 // and overwrite benchmark aborts as well
19541 if (data
.benchmark
== 1)
19543 if (data
.devices_status
== STATUS_ABORTED
)
19545 data
.devices_status
= STATUS_RUNNING
;
19551 if (data
.devices_status
== STATUS_CRACKED
) break;
19552 if (data
.devices_status
== STATUS_ABORTED
) break;
19553 if (data
.devices_status
== STATUS_QUIT
) break;
19556 if (data
.devices_status
== STATUS_CRACKED
) break;
19557 if (data
.devices_status
== STATUS_ABORTED
) break;
19558 if (data
.devices_status
== STATUS_QUIT
) break;
19561 // 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
19562 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
19564 if (data
.wordlist_mode
== WL_MODE_FILE
)
19566 if (data
.dictfile
== NULL
)
19568 if (dictfiles
!= NULL
)
19570 data
.dictfile
= dictfiles
[0];
19572 hc_timer_set (&data
.timer_running
);
19577 // NOTE: combi is okay because it is already set beforehand
19578 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
19580 if (data
.dictfile
== NULL
)
19582 if (dictfiles
!= NULL
)
19584 hc_timer_set (&data
.timer_running
);
19586 data
.dictfile
= dictfiles
[0];
19590 else if (attack_mode
== ATTACK_MODE_BF
)
19592 if (data
.mask
== NULL
)
19594 hc_timer_set (&data
.timer_running
);
19596 data
.mask
= masks
[0];
19600 // if cracked / aborted remove last induction dictionary
19602 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
19604 struct stat induct_stat
;
19606 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
19608 unlink (induction_dictionaries
[file_pos
]);
19612 // wait for inner threads
19614 data
.shutdown_inner
= 1;
19616 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
19618 hc_thread_wait (1, &inner_threads
[thread_idx
]);
19621 local_free (inner_threads
);
19623 // we dont need restore file anymore
19624 if (data
.restore_disable
== 0)
19626 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
19628 unlink (eff_restore_file
);
19629 unlink (new_restore_file
);
19637 // finally save left hashes
19639 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
19648 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19650 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19652 if (device_param
->skipped
) continue;
19654 cl_int CL_err
= CL_SUCCESS
;
19656 local_free (device_param
->combs_buf
);
19657 local_free (device_param
->hooks_buf
);
19658 local_free (device_param
->device_name
);
19659 local_free (device_param
->device_name_chksum
);
19660 local_free (device_param
->device_version
);
19661 local_free (device_param
->driver_version
);
19663 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
19665 if (device_param
->d_pws_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
19666 if (device_param
->d_pws_amp_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
19667 if (device_param
->d_rules
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
19668 if (device_param
->d_rules_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
19669 if (device_param
->d_combs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
19670 if (device_param
->d_combs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
19671 if (device_param
->d_bfs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
19672 if (device_param
->d_bfs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
19673 if (device_param
->d_bitmap_s1_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
19674 if (device_param
->d_bitmap_s1_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
19675 if (device_param
->d_bitmap_s1_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
19676 if (device_param
->d_bitmap_s1_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
19677 if (device_param
->d_bitmap_s2_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
19678 if (device_param
->d_bitmap_s2_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
19679 if (device_param
->d_bitmap_s2_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
19680 if (device_param
->d_bitmap_s2_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
19681 if (device_param
->d_plain_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
19682 if (device_param
->d_digests_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
19683 if (device_param
->d_digests_shown
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
19684 if (device_param
->d_salt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
19685 if (device_param
->d_esalt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
19686 if (device_param
->d_tmps
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
19687 if (device_param
->d_hooks
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
19688 if (device_param
->d_result
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
19689 if (device_param
->d_scryptV0_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
19690 if (device_param
->d_scryptV1_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
19691 if (device_param
->d_scryptV2_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
19692 if (device_param
->d_scryptV3_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
19693 if (device_param
->d_root_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
19694 if (device_param
->d_markov_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
19695 if (device_param
->d_tm_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
19697 if (CL_err
!= CL_SUCCESS
)
19699 log_error ("ERROR: clReleaseMemObject(): %s\n", val2cstr_cl (CL_err
));
19704 if (device_param
->kernel1
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
19705 if (device_param
->kernel12
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
19706 if (device_param
->kernel2
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
19707 if (device_param
->kernel23
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
19708 if (device_param
->kernel3
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
19709 if (device_param
->kernel_mp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
19710 if (device_param
->kernel_mp_l
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
19711 if (device_param
->kernel_mp_r
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
19712 if (device_param
->kernel_tm
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
19713 if (device_param
->kernel_amp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
19714 if (device_param
->kernel_memset
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
19716 if (CL_err
!= CL_SUCCESS
)
19718 log_error ("ERROR: clReleaseKernel(): %s\n", val2cstr_cl (CL_err
));
19723 if (device_param
->program
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program
);
19724 if (device_param
->program_mp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
19725 if (device_param
->program_amp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
19727 if (CL_err
!= CL_SUCCESS
)
19729 log_error ("ERROR: clReleaseProgram(): %s\n", val2cstr_cl (CL_err
));
19734 if (device_param
->command_queue
) CL_err
|= hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
19736 if (CL_err
!= CL_SUCCESS
)
19738 log_error ("ERROR: clReleaseCommandQueue(): %s\n", val2cstr_cl (CL_err
));
19743 if (device_param
->context
) CL_err
|= hc_clReleaseContext (data
.ocl
, device_param
->context
);
19745 if (CL_err
!= CL_SUCCESS
)
19747 log_error ("ERROR: hc_clReleaseContext(): %s\n", val2cstr_cl (CL_err
));
19753 // reset default fan speed
19756 if (gpu_temp_disable
== 0)
19758 if (gpu_temp_retain
!= 0)
19760 hc_thread_mutex_lock (mux_adl
);
19762 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19764 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19766 if (device_param
->skipped
) continue;
19768 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
19772 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
19774 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
19776 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
19779 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
19783 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
19787 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
19791 hc_thread_mutex_unlock (mux_adl
);
19795 // reset power tuning
19797 if (powertune_enable
== 1)
19799 hc_thread_mutex_lock (mux_adl
);
19801 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19803 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19805 if (device_param
->skipped
) continue;
19807 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
19809 if (data
.hm_device
[device_id
].od_version
== 6)
19811 // check powertune capabilities first, if not available then skip device
19813 int powertune_supported
= 0;
19815 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
19817 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
19822 if (powertune_supported
!= 0)
19824 // powercontrol settings
19826 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
19828 log_info ("ERROR: Failed to restore the ADL PowerControl values");
19835 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
19837 performance_state
->iNumberOfPerformanceLevels
= 2;
19839 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
19840 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
19841 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
19842 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
19844 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
19846 log_info ("ERROR: Failed to restore ADL performance state");
19851 local_free (performance_state
);
19856 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
19858 unsigned int limit
= nvml_power_limit
[device_id
];
19862 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
19867 hc_thread_mutex_unlock (mux_adl
);
19870 if (gpu_temp_disable
== 0)
19874 hm_NVML_nvmlShutdown (data
.hm_nvml
);
19876 nvml_close (data
.hm_nvml
);
19878 data
.hm_nvml
= NULL
;
19883 hm_NvAPI_Unload (data
.hm_nvapi
);
19885 nvapi_close (data
.hm_nvapi
);
19887 data
.hm_nvapi
= NULL
;
19890 if (data
.hm_xnvctrl
)
19892 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
19894 xnvctrl_close (data
.hm_xnvctrl
);
19896 data
.hm_xnvctrl
= NULL
;
19901 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
19903 adl_close (data
.hm_adl
);
19905 data
.hm_adl
= NULL
;
19908 #endif // HAVE_HWMON
19912 local_free (masks
);
19914 local_free (dictstat_base
);
19916 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
19918 pot_t
*pot_ptr
= &pot
[pot_pos
];
19920 hash_t
*hash
= &pot_ptr
->hash
;
19922 local_free (hash
->digest
);
19926 local_free (hash
->salt
);
19932 local_free (all_kernel_rules_cnt
);
19933 local_free (all_kernel_rules_buf
);
19935 local_free (wl_data
->buf
);
19936 local_free (wl_data
);
19938 local_free (bitmap_s1_a
);
19939 local_free (bitmap_s1_b
);
19940 local_free (bitmap_s1_c
);
19941 local_free (bitmap_s1_d
);
19942 local_free (bitmap_s2_a
);
19943 local_free (bitmap_s2_b
);
19944 local_free (bitmap_s2_c
);
19945 local_free (bitmap_s2_d
);
19948 local_free (od_clock_mem_status
);
19949 local_free (od_power_control_status
);
19950 local_free (nvml_power_limit
);
19953 global_free (devices_param
);
19955 global_free (kernel_rules_buf
);
19957 global_free (root_css_buf
);
19958 global_free (markov_css_buf
);
19960 global_free (digests_buf
);
19961 global_free (digests_shown
);
19962 global_free (digests_shown_tmp
);
19964 global_free (salts_buf
);
19965 global_free (salts_shown
);
19967 global_free (esalts_buf
);
19969 global_free (words_progress_done
);
19970 global_free (words_progress_rejected
);
19971 global_free (words_progress_restored
);
19973 if (pot_fp
) fclose (pot_fp
);
19975 if (data
.devices_status
== STATUS_QUIT
) break;
19978 // wait for outer threads
19980 data
.shutdown_outer
= 1;
19982 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
19984 hc_thread_wait (1, &outer_threads
[thread_idx
]);
19987 local_free (outer_threads
);
19989 // destroy others mutex
19991 hc_thread_mutex_delete (mux_dispatcher
);
19992 hc_thread_mutex_delete (mux_counter
);
19993 hc_thread_mutex_delete (mux_display
);
19994 hc_thread_mutex_delete (mux_adl
);
19998 local_free (eff_restore_file
);
19999 local_free (new_restore_file
);
20005 tuning_db_destroy (tuning_db
);
20009 local_free (loopback_file
);
20011 if (loopback
== 1) unlink (loopback_file
);
20013 // induction directory
20015 if (induction_dir
== NULL
)
20017 if (attack_mode
!= ATTACK_MODE_BF
)
20019 if (rmdir (induction_directory
) == -1)
20021 if (errno
== ENOENT
)
20023 // good, we can ignore
20025 else if (errno
== ENOTEMPTY
)
20027 // good, we can ignore
20031 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
20037 local_free (induction_directory
);
20041 // outfile-check directory
20043 if (outfile_check_dir
== NULL
)
20045 if (rmdir (outfile_check_directory
) == -1)
20047 if (errno
== ENOENT
)
20049 // good, we can ignore
20051 else if (errno
== ENOTEMPTY
)
20053 // good, we can ignore
20057 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
20063 local_free (outfile_check_directory
);
20070 logfile_top_uint (proc_start
);
20071 logfile_top_uint (proc_stop
);
20073 logfile_top_msg ("STOP");
20075 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
20076 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
20078 if (data
.ocl
) ocl_close (data
.ocl
);
20080 if (data
.devices_status
== STATUS_ABORTED
) return 2;
20081 if (data
.devices_status
== STATUS_QUIT
) return 2;
20082 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
20083 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
20084 if (data
.devices_status
== STATUS_CRACKED
) return 0;