2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
19 #include <rp_kernel_on_cpu.h>
22 const char *PROGNAME
= "hashcat";
23 const uint VERSION_BIN
= 300;
24 const uint RESTORE_MIN
= 300;
26 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
28 #define INCR_RULES 10000
29 #define INCR_SALTS 100000
30 #define INCR_MASKS 1000
36 #define MARKOV_THRESHOLD 0
37 #define MARKOV_DISABLE 0
38 #define MARKOV_CLASSIC 0
42 #define RESTORE_TIMER 60
43 #define RESTORE_DISABLE 0
45 #define STATUS_TIMER 10
46 #define MACHINE_READABLE 0
48 #define WEAK_HASH_THRESHOLD 100
53 #define REMOVE_TIMER 60
57 #define POTFILE_DISABLE 0
60 #define RP_GEN_FUNC_MIN 1
61 #define RP_GEN_FUNC_MAX 4
63 #define RULE_BUF_L ":"
64 #define RULE_BUF_R ":"
69 #define HEX_WORDLIST 0
70 #define OUTFILE_FORMAT 3
71 #define OUTFILE_AUTOHEX 1
72 #define OUTFILE_CHECK_TIMER 5
75 #define SEGMENT_SIZE 32
77 #define INCREMENT_MIN 1
78 #define INCREMENT_MAX PW_MAX
83 #define NVIDIA_SPIN_DAMP 100
84 #define GPU_TEMP_DISABLE 0
85 #define GPU_TEMP_ABORT 90
86 #define GPU_TEMP_RETAIN 75
87 #define WORKLOAD_PROFILE 2
88 #define KERNEL_ACCEL 0
89 #define KERNEL_LOOPS 0
90 #define KERNEL_RULES 1024
91 #define KERNEL_COMBS 1024
92 #define KERNEL_BFS 1024
93 #define KERNEL_THREADS_MAX 256
94 #define KERNEL_THREADS_MAX_CPU 1
95 #define POWERTUNE_ENABLE 0
96 #define LOGFILE_DISABLE 0
98 #define OPENCL_VECTOR_WIDTH 0
100 #define WL_MODE_STDIN 1
101 #define WL_MODE_FILE 2
102 #define WL_MODE_MASK 3
104 #define HL_MODE_FILE 4
105 #define HL_MODE_ARG 5
107 #define HLFMTS_CNT 11
108 #define HLFMT_HASHCAT 0
109 #define HLFMT_PWDUMP 1
110 #define HLFMT_PASSWD 2
111 #define HLFMT_SHADOW 3
114 #define HLFMT_NETNTLM1 7
115 #define HLFMT_NETNTLM2 8
116 #define HLFMT_NSLDAP 9
117 #define HLFMT_NSLDAPS 10
119 #define HLFMT_TEXT_HASHCAT "native hashcat"
120 #define HLFMT_TEXT_PWDUMP "pwdump"
121 #define HLFMT_TEXT_PASSWD "passwd"
122 #define HLFMT_TEXT_SHADOW "shadow"
123 #define HLFMT_TEXT_DCC "DCC"
124 #define HLFMT_TEXT_DCC2 "DCC 2"
125 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
126 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
127 #define HLFMT_TEXT_NSLDAP "nsldap"
128 #define HLFMT_TEXT_NSLDAPS "nsldaps"
130 #define ATTACK_MODE_STRAIGHT 0
131 #define ATTACK_MODE_COMBI 1
132 #define ATTACK_MODE_TOGGLE 2
133 #define ATTACK_MODE_BF 3
134 #define ATTACK_MODE_PERM 4
135 #define ATTACK_MODE_TABLE 5
136 #define ATTACK_MODE_HYBRID1 6
137 #define ATTACK_MODE_HYBRID2 7
138 #define ATTACK_MODE_NONE 100
140 #define ATTACK_KERN_STRAIGHT 0
141 #define ATTACK_KERN_COMBI 1
142 #define ATTACK_KERN_BF 3
143 #define ATTACK_KERN_NONE 100
145 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
146 #define ATTACK_EXEC_INSIDE_KERNEL 11
148 #define COMBINATOR_MODE_BASE_LEFT 10001
149 #define COMBINATOR_MODE_BASE_RIGHT 10002
151 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
152 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
154 #define MAX_CUT_TRIES 4
156 #define MAX_DICTSTAT 10000
158 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
160 #define NVIDIA_100PERCENTCPU_WORKAROUND 100
162 #define global_free(attr) \
164 myfree ((void *) data.attr); \
169 #define local_free(attr) \
171 myfree ((void *) attr); \
176 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
177 #define HC_API_CALL __stdcall
182 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
333 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
339 static unsigned int full01
= 0x01010101;
340 static unsigned int full80
= 0x80808080;
342 int SUPPRESS_OUTPUT
= 0;
344 hc_thread_mutex_t mux_adl
;
345 hc_thread_mutex_t mux_counter
;
346 hc_thread_mutex_t mux_dispatcher
;
347 hc_thread_mutex_t mux_display
;
349 hc_global_data_t data
;
351 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
353 const char *USAGE_MINI
[] =
355 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
357 "Try --help for more help.",
361 const char *USAGE_BIG
[] =
363 "%s, advanced password recovery",
365 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
369 " Options Short / Long | Type | Description | Example",
370 "===============================+======+======================================================+=======================",
371 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
372 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
373 " -V, --version | | Print version |",
374 " -h, --help | | Print help |",
375 " --quiet | | Suppress output |",
376 " --hex-charset | | Assume charset is given in hex |",
377 " --hex-salt | | Assume salt is given in hex |",
378 " --hex-wordlist | | Assume words in wordlist is given in hex |",
379 " --force | | Ignore warnings |",
380 " --status | | Enable automatic update of the status-screen |",
381 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
382 " --machine-readable | | Display the status view in a machine readable format |",
383 " --loopback | | Add new plains to induct directory |",
384 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
385 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
386 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
387 " --markov-classic | | Enables classic markov-chains, no per-position |",
388 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
389 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
390 " --session | Str | Define specific session name | --session=mysession",
391 " --restore | | Restore session from --session |",
392 " --restore-disable | | Do not write restore file |",
393 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
394 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
395 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
396 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
397 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
398 " --stdout | | Do not crack a hash, instead print candidates only |",
399 " --show | | Compare hashlist with potfile; Show cracked hashes |",
400 " --left | | Compare hashlist with potfile; Show uncracked hashes |",
401 " --username | | Enable ignoring of usernames in hashfile |",
402 " --remove | | Enable remove of hash once it is cracked |",
403 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
404 " --potfile-disable | | Do not write potfile |",
405 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
406 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
407 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
408 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
409 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
410 " --logfile-disable | | Disable the logfile |",
411 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
412 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
413 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
414 " -b, --benchmark | | Run benchmark |",
415 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
416 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
417 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
418 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
419 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
420 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
421 " -D, --opencl-device-types | Str | OpenCL device-types to use, separate with comma | -D 1",
422 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
423 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
424 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
425 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
426 " --nvidia-spin-damp | Num | Workaround NVidias CPU burning loop bug, in percent | --nvidia-spin-damp=50",
427 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
429 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
430 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
431 " --powertune-enable | | Enable power tuning, restores settings when finished |",
433 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
434 " -s, --skip | Num | Skip X words from the start | -s 1000000",
435 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
436 " --keyspace | | Show keyspace base:mod values and quit |",
437 " -j, --rule-left | Rule | Single rule applied to each word from left wordlist | -j 'c'",
438 " -k, --rule-right | Rule | Single rule applied to each word from right wordlist | -k '^-'",
439 " -r, --rules-file | File | Multiple rules applied to each word from wordlists | -r rules/best64.rule",
440 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
441 " --generate-rules-func-min | Num | Force min X funcs per rule |",
442 " --generate-rules-func-max | Num | Force max X funcs per rule |",
443 " --generate-rules-seed | Num | Force RNG seed set to X |",
444 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
445 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
446 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
447 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
448 " -i, --increment | | Enable mask increment mode |",
449 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
450 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
451 " --mangle | | Mangle password before hashing |",
453 "- [ Hash modes ] -",
455 " # | Name | Category",
456 " ======+==================================================+======================================",
457 " 900 | MD4 | Raw Hash",
458 " 0 | MD5 | Raw Hash",
459 " 5100 | Half MD5 | Raw Hash",
460 " 100 | SHA1 | Raw Hash",
461 " 10800 | SHA-384 | Raw Hash",
462 " 1400 | SHA-256 | Raw Hash",
463 " 1700 | SHA-512 | Raw Hash",
464 " 5000 | SHA-3(Keccak) | Raw Hash",
465 " 10100 | SipHash | Raw Hash",
466 " 6000 | RipeMD160 | Raw Hash",
467 " 6100 | Whirlpool | Raw Hash",
468 " 6900 | GOST R 34.11-94 | Raw Hash",
469 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
470 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
471 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
477 " 2600 | md5(md5($pass)) | Raw Hash, Salted and / or Iterated",
478 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
479 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
480 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
481 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
482 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
483 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
484 " 4500 | sha1(sha1($pass)) | Raw Hash, Salted and / or Iterated",
485 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
486 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
487 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
488 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
489 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
490 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
491 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
492 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
493 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
494 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
495 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
496 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
497 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
498 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
499 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
500 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
501 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
502 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
503 " 400 | phpass | Generic KDF",
504 " 8900 | scrypt | Generic KDF",
505 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
506 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
507 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
508 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
509 " 23 | Skype | Network protocols",
510 " 2500 | WPA/WPA2 | Network protocols",
511 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
512 " 5300 | IKE-PSK MD5 | Network protocols",
513 " 5400 | IKE-PSK SHA1 | Network protocols",
514 " 5500 | NetNTLMv1 | Network protocols",
515 " 5500 | NetNTLMv1 + ESS | Network protocols",
516 " 5600 | NetNTLMv2 | Network protocols",
517 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
518 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
519 " 8300 | DNSSEC (NSEC3) | Network protocols",
520 " 10200 | Cram MD5 | Network protocols",
521 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
522 " 11200 | MySQL CRAM (SHA1) | Network protocols",
523 " 11400 | SIP digest authentication (MD5) | Network protocols",
524 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
525 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
526 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
527 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
528 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
529 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
530 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
531 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
532 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
533 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
534 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
535 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
536 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
537 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
538 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
539 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
540 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
541 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
542 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
543 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
544 " 12 | PostgreSQL | Database Server",
545 " 131 | MSSQL(2000) | Database Server",
546 " 132 | MSSQL(2005) | Database Server",
547 " 1731 | MSSQL(2012) | Database Server",
548 " 1731 | MSSQL(2014) | Database Server",
549 " 200 | MySQL323 | Database Server",
550 " 300 | MySQL4.1/MySQL5 | Database Server",
551 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
552 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
553 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
554 " 8000 | Sybase ASE | Database Server",
555 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
556 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
557 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
558 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
559 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
560 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
561 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
562 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
563 " 11500 | CRC32 | Checksums",
564 " 3000 | LM | Operating-Systems",
565 " 1000 | NTLM | Operating-Systems",
566 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
567 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
568 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
569 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
570 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
571 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
572 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
573 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
574 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
575 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
576 " 1722 | OSX v10.7 | Operating-Systems",
577 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
578 " 6300 | AIX {smd5} | Operating-Systems",
579 " 6700 | AIX {ssha1} | Operating-Systems",
580 " 6400 | AIX {ssha256} | Operating-Systems",
581 " 6500 | AIX {ssha512} | Operating-Systems",
582 " 2400 | Cisco-PIX | Operating-Systems",
583 " 2410 | Cisco-ASA | Operating-Systems",
584 " 500 | Cisco-IOS $1$ | Operating-Systems",
585 " 5700 | Cisco-IOS $4$ | Operating-Systems",
586 " 9200 | Cisco-IOS $8$ | Operating-Systems",
587 " 9300 | Cisco-IOS $9$ | Operating-Systems",
588 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
589 " 501 | Juniper IVE | Operating-Systems",
590 " 5800 | Android PIN | Operating-Systems",
591 " 13800 | Windows 8+ phone PIN/Password | Operating-Systems",
592 " 8100 | Citrix Netscaler | Operating-Systems",
593 " 8500 | RACF | Operating-Systems",
594 " 7200 | GRUB 2 | Operating-Systems",
595 " 9900 | Radmin2 | Operating-Systems",
596 " 125 | ArubaOS | Operating-Systems",
597 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
598 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
599 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
600 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
601 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
602 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
603 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
604 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
605 " 11600 | 7-Zip | Archives",
606 " 12500 | RAR3-hp | Archives",
607 " 13000 | RAR5 | Archives",
608 " 13200 | AxCrypt | Archives",
609 " 13300 | AxCrypt in memory SHA1 | Archives",
610 " 13600 | WinZip | Archives",
611 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
612 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
613 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
614 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
615 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
616 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
617 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
618 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
619 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
625 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
626 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
627 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
628 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
629 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
630 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
631 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
632 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
633 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
634 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
635 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
636 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
637 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
638 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
639 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
640 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
641 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
642 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
643 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
644 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
645 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
646 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
647 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
648 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
649 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
650 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
651 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
652 " 9400 | MS Office 2007 | Documents",
653 " 9500 | MS Office 2010 | Documents",
654 " 9600 | MS Office 2013 | Documents",
655 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
656 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
657 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
658 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
659 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
660 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
661 " 9000 | Password Safe v2 | Password Managers",
662 " 5200 | Password Safe v3 | Password Managers",
663 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
664 " 6600 | 1Password, agilekeychain | Password Managers",
665 " 8200 | 1Password, cloudkeychain | Password Managers",
666 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
667 " 12700 | Blockchain, My Wallet | Password Managers",
668 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
670 "- [ Outfile Formats ] -",
676 " 3 | hash[:salt]:plain",
678 " 5 | hash[:salt]:hex_plain",
679 " 6 | plain:hex_plain",
680 " 7 | hash[:salt]:plain:hex_plain",
682 " 9 | hash[:salt]:crack_pos",
683 " 10 | plain:crack_pos",
684 " 11 | hash[:salt]:plain:crack_pos",
685 " 12 | hex_plain:crack_pos",
686 " 13 | hash[:salt]:hex_plain:crack_pos",
687 " 14 | plain:hex_plain:crack_pos",
688 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
690 "- [ Rule Debugging Modes ] -",
695 " 2 | Original-Word",
696 " 3 | Original-Word:Finding-Rule",
697 " 4 | Original-Word:Finding-Rule:Processed-Word",
699 "- [ Attack Modes ] -",
706 " 6 | Hybrid Wordlist + Mask",
707 " 7 | Hybrid Mask + Wordlist",
709 "- [ Built-in Charsets ] -",
713 " l | abcdefghijklmnopqrstuvwxyz",
714 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
716 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
720 "- [ OpenCL Device Types ] -",
723 " ===+=============",
726 " 3 | FPGA, DSP, Co-Processor",
728 "- [ Workload Profiles ] -",
730 " # | Performance | Runtime | Power Consumption | Desktop Impact",
731 " ===+=============+=========+===================+=================",
732 " 1 | Low | 2 ms | Low | Minimal",
733 " 2 | Default | 12 ms | Economic | Noticeable",
734 " 3 | High | 96 ms | High | Unresponsive",
735 " 4 | Nightmare | 480 ms | Insane | Headless",
737 "- [ Basic Examples ] -",
739 " Attack- | Hash- |",
740 " Mode | Type | Example command",
741 " ==================+=======+==================================================================",
742 " Wordlist | $P$ | %s -a 0 -m 400 example400.hash example.dict",
743 " Wordlist + Rules | MD5 | %s -a 0 -m 0 example0.hash example.dict -r rules/best64.rule",
744 " Brute-Force | MD5 | %s -a 3 -m 0 example0.hash ?a?a?a?a?a?a",
745 " Combinator | MD5 | %s -a 1 -m 0 example0.hash example.dict example.dict",
747 "If you still have no idea what just happened try following pages:",
749 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
750 "* https://hashcat.net/wiki/#frequently_asked_questions",
755 * hashcat specific functions
758 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
760 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
762 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
764 double exec_ms_sum
= 0;
768 for (int i
= 0; i
< last_num_entries
; i
++)
770 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
774 exec_ms_sum
+= exec_ms
;
780 if (exec_ms_cnt
== 0) return 0;
782 return exec_ms_sum
/ exec_ms_cnt
;
785 void status_display_machine_readable ()
789 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
795 fprintf (out
, "SPEED\t");
797 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
799 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
801 if (device_param
->skipped
) continue;
806 for (int i
= 0; i
< SPEED_CACHE
; i
++)
808 speed_cnt
+= device_param
->speed_cnt
[i
];
809 speed_ms
+= device_param
->speed_ms
[i
];
812 speed_cnt
/= SPEED_CACHE
;
813 speed_ms
/= SPEED_CACHE
;
815 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
822 fprintf (out
, "EXEC_RUNTIME\t");
824 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
826 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
828 if (device_param
->skipped
) continue;
830 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
832 fprintf (out
, "%f\t", exec_ms_avg
);
839 u64 words_cur
= get_lowest_words_done ();
841 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
847 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
850 u64 all_rejected
= 0;
851 u64 all_restored
= 0;
853 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
855 all_done
+= data
.words_progress_done
[salt_pos
];
856 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
857 all_restored
+= data
.words_progress_restored
[salt_pos
];
860 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
861 u64 progress_end
= progress_total
;
863 u64 progress_skip
= 0;
867 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
869 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
870 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
871 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
876 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
878 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
879 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
880 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
883 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
884 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
886 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
892 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
893 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
900 if (data
.gpu_temp_disable
== 0)
902 fprintf (out
, "TEMP\t");
904 hc_thread_mutex_lock (mux_adl
);
906 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
908 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
910 if (device_param
->skipped
) continue;
912 int temp
= hm_get_temperature_with_device_id (device_id
);
914 fprintf (out
, "%d\t", temp
);
917 hc_thread_mutex_unlock (mux_adl
);
929 void status_display ()
931 if (data
.devices_status
== STATUS_INIT
) return;
932 if (data
.devices_status
== STATUS_STARTING
) return;
934 // in this case some required buffers are free'd, ascii_digest() would run into segfault
935 if (data
.shutdown_inner
== 1) return;
937 if (data
.machine_readable
== 1)
939 status_display_machine_readable ();
944 char tmp_buf
[1000] = { 0 };
948 log_info ("Session.Name...: %s", data
.session
);
950 char *status_type
= strstatus (data
.devices_status
);
952 uint hash_mode
= data
.hash_mode
;
954 char *hash_type
= strhashtype (hash_mode
); // not a bug
956 log_info ("Status.........: %s", status_type
);
962 if (data
.rp_files_cnt
)
966 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
968 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
971 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
973 log_info ("Rules.Type.....: %s", tmp_buf
);
980 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
982 if (data
.rp_gen_seed
)
984 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
992 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
994 if (data
.wordlist_mode
== WL_MODE_FILE
)
996 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
998 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
1000 log_info ("Input.Mode.....: Pipe");
1003 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1005 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1006 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1008 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1010 char *mask
= data
.mask
;
1014 uint mask_len
= data
.css_cnt
;
1016 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1020 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1022 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1024 mask_len
-= data
.salts_buf
[0].salt_len
;
1028 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1030 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1033 if (data
.maskcnt
> 1)
1035 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1037 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1040 log_info ("Input.Mode.....: %s", tmp_buf
);
1045 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1047 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1048 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1050 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1052 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1053 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1056 if (data
.digests_cnt
== 1)
1058 if (data
.hash_mode
== 2500)
1060 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1062 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1063 (char *) data
.salts_buf
[0].salt_buf
,
1077 else if (data
.hash_mode
== 5200)
1079 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1081 else if (data
.hash_mode
== 9000)
1083 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1085 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1087 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1089 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1091 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1095 char out_buf
[HCBUFSIZ
] = { 0 };
1097 ascii_digest (out_buf
, 0, 0);
1100 if (strlen (out_buf
) > 40)
1108 log_info ("Hash.Target....: %s", out_buf
);
1113 if (data
.hash_mode
== 3000)
1115 char out_buf1
[32] = { 0 };
1116 char out_buf2
[32] = { 0 };
1118 ascii_digest (out_buf1
, 0, 0);
1119 ascii_digest (out_buf2
, 0, 1);
1121 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1125 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1129 log_info ("Hash.Type......: %s", hash_type
);
1135 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1136 double speed_ms
[DEVICES_MAX
] = { 0 };
1138 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1140 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1142 if (device_param
->skipped
) continue;
1144 speed_cnt
[device_id
] = 0;
1145 speed_ms
[device_id
] = 0;
1147 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1149 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1150 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1153 speed_cnt
[device_id
] /= SPEED_CACHE
;
1154 speed_ms
[device_id
] /= SPEED_CACHE
;
1157 double hashes_all_ms
= 0;
1159 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1161 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1163 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1165 if (device_param
->skipped
) continue;
1167 hashes_dev_ms
[device_id
] = 0;
1169 if (speed_ms
[device_id
])
1171 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1173 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1181 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1183 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1185 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1187 if (device_param
->skipped
) continue;
1189 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1191 exec_all_ms
[device_id
] = exec_ms_avg
;
1198 double ms_running
= 0;
1200 hc_timer_get (data
.timer_running
, ms_running
);
1202 double ms_paused
= data
.ms_paused
;
1204 if (data
.devices_status
== STATUS_PAUSED
)
1206 double ms_paused_tmp
= 0;
1208 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1210 ms_paused
+= ms_paused_tmp
;
1215 __time64_t sec_run
= ms_running
/ 1000;
1219 time_t sec_run
= ms_running
/ 1000;
1225 char display_run
[32] = { 0 };
1229 struct tm
*tmp
= NULL
;
1233 tmp
= _gmtime64 (&sec_run
);
1237 tmp
= gmtime (&sec_run
);
1243 memset (&tm_run
, 0, sizeof (tm_run
));
1245 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1247 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1249 char *start
= ctime (&data
.proc_start
);
1251 size_t start_len
= strlen (start
);
1253 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1254 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1256 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1261 log_info ("Time.Started...: 0 secs");
1268 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1271 u64 all_rejected
= 0;
1272 u64 all_restored
= 0;
1274 u64 progress_noneed
= 0;
1276 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1278 all_done
+= data
.words_progress_done
[salt_pos
];
1279 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1280 all_restored
+= data
.words_progress_restored
[salt_pos
];
1282 // Important for ETA only
1284 if (data
.salts_shown
[salt_pos
] == 1)
1286 const u64 all
= data
.words_progress_done
[salt_pos
]
1287 + data
.words_progress_rejected
[salt_pos
]
1288 + data
.words_progress_restored
[salt_pos
];
1290 const u64 left
= data
.words_cnt
- all
;
1292 progress_noneed
+= left
;
1296 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1297 u64 progress_end
= progress_total
;
1299 u64 progress_skip
= 0;
1303 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1305 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1306 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1307 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1312 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1314 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1315 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1316 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1319 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1320 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1322 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1324 if (data
.devices_status
!= STATUS_CRACKED
)
1327 __time64_t sec_etc
= 0;
1334 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1336 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1338 sec_etc
= ms_left
/ 1000;
1343 //log_info ("Time.Estimated.: 0 secs");
1345 else if ((u64
) sec_etc
> ETC_MAX
)
1347 log_info ("Time.Estimated.: > 10 Years");
1351 char display_etc
[32] = { 0 };
1352 char display_runtime
[32] = { 0 };
1355 struct tm tm_runtime
;
1357 struct tm
*tmp
= NULL
;
1360 tmp
= _gmtime64 (&sec_etc
);
1362 tmp
= gmtime (&sec_etc
);
1367 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1369 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1377 char *etc
= ctime (&now
);
1379 size_t etc_len
= strlen (etc
);
1381 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1382 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1388 time (&runtime_cur
);
1392 __time64_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1394 tmp
= _gmtime64 (&runtime_left
);
1398 time_t runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
1400 tmp
= gmtime (&runtime_left
);
1404 if ((tmp
!= NULL
) && (runtime_left
> 0) && (runtime_left
< sec_etc
))
1406 memcpy (&tm_runtime
, tmp
, sizeof (tm_runtime
));
1408 format_timer_display (&tm_runtime
, display_runtime
, sizeof (display_runtime
));
1410 log_info ("Time.Estimated.: %s (%s), but limited (%s)", etc
, display_etc
, display_runtime
);
1414 log_info ("Time.Estimated.: %s (%s), but limit exceeded", etc
, display_etc
);
1419 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1426 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1428 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1430 if (device_param
->skipped
) continue;
1432 char display_dev_cur
[16] = { 0 };
1434 strncpy (display_dev_cur
, "0.00", 4);
1436 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1438 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1441 char display_all_cur
[16] = { 0 };
1443 strncpy (display_all_cur
, "0.00", 4);
1445 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1447 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1449 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1450 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1452 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1456 if (data
.digests_cnt
> 100)
1458 time_t now
= time (NULL
);
1460 int cpt_cur_min
= 0;
1461 int cpt_cur_hour
= 0;
1462 int cpt_cur_day
= 0;
1464 for (int i
= 0; i
< CPT_BUF
; i
++)
1466 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1467 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1469 if ((timestamp
+ 60) > now
)
1471 cpt_cur_min
+= cracked
;
1474 if ((timestamp
+ 3600) > now
)
1476 cpt_cur_hour
+= cracked
;
1479 if ((timestamp
+ 86400) > now
)
1481 cpt_cur_day
+= cracked
;
1485 double ms_real
= ms_running
- ms_paused
;
1487 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1488 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1489 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1491 if ((data
.cpt_start
+ 86400) < now
)
1493 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1501 else if ((data
.cpt_start
+ 3600) < now
)
1503 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1510 else if ((data
.cpt_start
+ 60) < now
)
1512 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1520 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1529 u64 restore_point
= get_lowest_words_done ();
1531 u64 restore_total
= data
.words_base
;
1533 float percent_restore
= 0;
1535 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1537 if (progress_end_relative_skip
)
1539 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1541 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1542 float percent_rejected
= 0.0;
1546 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1549 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1550 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1552 if (data
.restore_disable
== 0)
1554 if (percent_finished
!= 1)
1556 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1563 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1565 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1566 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1568 if (data
.restore_disable
== 0)
1570 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1575 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1576 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1578 // --restore not allowed if stdin is used -- really? why?
1580 //if (data.restore_disable == 0)
1582 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1589 if (data
.devices_status
== STATUS_EXHAUSTED
) return;
1590 if (data
.devices_status
== STATUS_CRACKED
) return;
1591 if (data
.devices_status
== STATUS_ABORTED
) return;
1592 if (data
.devices_status
== STATUS_QUIT
) return;
1594 if (data
.gpu_temp_disable
== 0)
1596 hc_thread_mutex_lock (mux_adl
);
1598 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1600 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1602 if (device_param
->skipped
) continue;
1604 const int num_temperature
= hm_get_temperature_with_device_id (device_id
);
1605 const int num_fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
1606 const int num_utilization
= hm_get_utilization_with_device_id (device_id
);
1607 const int num_corespeed
= hm_get_corespeed_with_device_id (device_id
);
1608 const int num_memoryspeed
= hm_get_memoryspeed_with_device_id (device_id
);
1609 const int num_buslanes
= hm_get_buslanes_with_device_id (device_id
);
1610 const int num_throttle
= hm_get_throttle_with_device_id (device_id
);
1612 char output_buf
[256] = { 0 };
1616 if (num_temperature
>= 0)
1618 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Temp:%3uc", num_temperature
);
1620 output_len
= strlen (output_buf
);
1623 if (num_fanspeed
>= 0)
1625 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Fan:%3u%%", num_fanspeed
);
1627 output_len
= strlen (output_buf
);
1630 if (num_utilization
>= 0)
1632 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Util:%3u%%", num_utilization
);
1634 output_len
= strlen (output_buf
);
1637 if (num_corespeed
>= 0)
1639 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Core:%4uMhz", num_corespeed
);
1641 output_len
= strlen (output_buf
);
1644 if (num_memoryspeed
>= 0)
1646 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Mem:%4uMhz", num_memoryspeed
);
1648 output_len
= strlen (output_buf
);
1651 if (num_buslanes
>= 0)
1653 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " Lanes:%u", num_buslanes
);
1655 output_len
= strlen (output_buf
);
1658 if (num_throttle
== 1)
1660 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " *Throttled*");
1662 output_len
= strlen (output_buf
);
1665 if (output_len
== 0)
1667 snprintf (output_buf
+ output_len
, sizeof (output_buf
) - output_len
, " N/A");
1669 output_len
= strlen (output_buf
);
1672 log_info ("HWMon.Dev.#%d...:%s", device_id
+ 1, output_buf
);
1675 hc_thread_mutex_unlock (mux_adl
);
1678 #endif // HAVE_HWMON
1681 static void status_benchmark_automate ()
1683 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1684 double speed_ms
[DEVICES_MAX
] = { 0 };
1686 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1688 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1690 if (device_param
->skipped
) continue;
1692 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1693 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1696 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1698 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1700 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1702 if (device_param
->skipped
) continue;
1704 hashes_dev_ms
[device_id
] = 0;
1706 if (speed_ms
[device_id
])
1708 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1712 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1714 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1716 if (device_param
->skipped
) continue;
1718 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1722 static void status_benchmark ()
1724 if (data
.devices_status
== STATUS_INIT
) return;
1725 if (data
.devices_status
== STATUS_STARTING
) return;
1727 if (data
.shutdown_inner
== 1) return;
1729 if (data
.machine_readable
== 1)
1731 status_benchmark_automate ();
1736 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1737 double speed_ms
[DEVICES_MAX
] = { 0 };
1739 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1741 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1743 if (device_param
->skipped
) continue;
1745 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1746 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1749 double hashes_all_ms
= 0;
1751 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1753 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1755 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1757 if (device_param
->skipped
) continue;
1759 hashes_dev_ms
[device_id
] = 0;
1761 if (speed_ms
[device_id
])
1763 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1765 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1773 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1775 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1777 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1779 if (device_param
->skipped
) continue;
1781 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1783 exec_all_ms
[device_id
] = exec_ms_avg
;
1786 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1788 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1790 if (device_param
->skipped
) continue;
1792 char display_dev_cur
[16] = { 0 };
1794 strncpy (display_dev_cur
, "0.00", 4);
1796 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1798 if (data
.devices_active
>= 10)
1800 log_info ("Speed.Dev.#%d: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1804 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1808 char display_all_cur
[16] = { 0 };
1810 strncpy (display_all_cur
, "0.00", 4);
1812 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1814 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1818 * hashcat -only- functions
1821 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, uint mangle
, char *shared_dir
, char *source_file
)
1823 char const * postfix
= "";
1829 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1831 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1832 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0%s.cl", shared_dir
, (int) kern_type
, postfix
);
1833 else if (attack_kern
== ATTACK_KERN_COMBI
)
1834 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1%s.cl", shared_dir
, (int) kern_type
, postfix
);
1835 else if (attack_kern
== ATTACK_KERN_BF
)
1836 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3%s.cl", shared_dir
, (int) kern_type
, postfix
);
1839 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1842 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, uint mangle
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1844 char const * postfix
= "";
1850 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1852 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1853 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1854 else if (attack_kern
== ATTACK_KERN_COMBI
)
1855 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1856 else if (attack_kern
== ATTACK_KERN_BF
)
1857 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3%s.%s.kernel", profile_dir
, (int) kern_type
, postfix
, device_name_chksum
);
1861 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1865 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1867 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1869 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1873 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1877 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1879 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1881 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1885 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1889 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1891 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1894 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1896 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1899 static char *filename_from_filepath (char *filepath
)
1903 if ((ptr
= strrchr (filepath
, '/')) != NULL
)
1907 else if ((ptr
= strrchr (filepath
, '\\')) != NULL
)
1919 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1921 if (line_len
& 1) return (line_len
); // not in hex
1923 if (data
.hex_wordlist
== 1)
1928 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1930 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1933 memset (line_buf
+ i
, 0, line_len
- i
);
1937 else if (line_len
>= 6) // $HEX[] = 6
1939 if (line_buf
[0] != '$') return (line_len
);
1940 if (line_buf
[1] != 'H') return (line_len
);
1941 if (line_buf
[2] != 'E') return (line_len
);
1942 if (line_buf
[3] != 'X') return (line_len
);
1943 if (line_buf
[4] != '[') return (line_len
);
1944 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1949 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1951 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1954 memset (line_buf
+ i
, 0, line_len
- i
);
1962 static void clear_prompt ()
1964 fputc ('\r', stdout
);
1966 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1968 fputc (' ', stdout
);
1971 fputc ('\r', stdout
);
1976 static int gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1978 cl_int CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1980 if (CL_err
!= CL_SUCCESS
)
1982 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
1990 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1992 char *outfile
= data
.outfile
;
1993 uint quiet
= data
.quiet
;
1994 FILE *pot_fp
= data
.pot_fp
;
1995 uint loopback
= data
.loopback
;
1996 uint debug_mode
= data
.debug_mode
;
1997 char *debug_file
= data
.debug_file
;
1999 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
2000 int debug_rule_len
= 0; // -1 error
2001 uint debug_plain_len
= 0;
2003 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
2007 char out_buf
[HCBUFSIZ
] = { 0 };
2009 const u32 salt_pos
= plain
->salt_pos
;
2010 const u32 digest_pos
= plain
->digest_pos
; // relative
2011 const u32 gidvid
= plain
->gidvid
;
2012 const u32 il_pos
= plain
->il_pos
;
2014 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2018 u64 crackpos
= device_param
->words_off
;
2020 uint plain_buf
[16] = { 0 };
2022 u8
*plain_ptr
= (u8
*) plain_buf
;
2024 unsigned int plain_len
= 0;
2026 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2030 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2032 for (int i
= 0; i
< 16; i
++)
2034 plain_buf
[i
] = pw
.i
[i
];
2037 plain_len
= pw
.pw_len
;
2039 const uint off
= device_param
->innerloop_pos
+ il_pos
;
2046 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
2048 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
2050 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
2054 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
2056 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
2058 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
2060 debug_plain_len
= plain_len
;
2064 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2067 crackpos
*= data
.kernel_rules_cnt
;
2068 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2070 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2072 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2076 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2078 for (int i
= 0; i
< 16; i
++)
2080 plain_buf
[i
] = pw
.i
[i
];
2083 plain_len
= pw
.pw_len
;
2085 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2086 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2088 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2090 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2094 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2096 memcpy (plain_ptr
, comb_buf
, comb_len
);
2099 plain_len
+= comb_len
;
2102 crackpos
*= data
.combs_cnt
;
2103 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2105 if (data
.pw_max
!= PW_DICTMAX1
)
2107 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2110 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2112 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2113 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2115 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2116 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2118 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2119 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2121 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2122 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2124 plain_len
= data
.css_cnt
;
2127 crackpos
*= data
.bfs_cnt
;
2128 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2130 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2134 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2136 for (int i
= 0; i
< 16; i
++)
2138 plain_buf
[i
] = pw
.i
[i
];
2141 plain_len
= pw
.pw_len
;
2143 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2146 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2148 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2150 plain_len
+= start
+ stop
;
2153 crackpos
*= data
.combs_cnt
;
2154 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2156 if (data
.pw_max
!= PW_DICTMAX1
)
2158 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2161 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2165 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2167 for (int i
= 0; i
< 16; i
++)
2169 plain_buf
[i
] = pw
.i
[i
];
2172 plain_len
= pw
.pw_len
;
2174 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2177 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2179 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2181 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2183 plain_len
+= start
+ stop
;
2186 crackpos
*= data
.combs_cnt
;
2187 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2189 if (data
.pw_max
!= PW_DICTMAX1
)
2191 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2195 if (data
.attack_mode
== ATTACK_MODE_BF
)
2197 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2199 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2201 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2203 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2207 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2209 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2211 plain_ptr
[j
] = plain_ptr
[i
];
2214 plain_len
= plain_len
/ 2;
2219 // if enabled, update also the potfile
2225 fprintf (pot_fp
, "%s:", out_buf
);
2227 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2229 fputc ('\n', pot_fp
);
2233 unlock_file (pot_fp
);
2238 FILE *out_fp
= NULL
;
2240 if (outfile
!= NULL
)
2242 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2244 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2255 if (quiet
== 0) clear_prompt ();
2258 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2260 if (outfile
!= NULL
)
2262 if (out_fp
!= stdout
)
2269 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2271 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2273 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2274 if (quiet
== 0) fflush (stdout
);
2283 char *loopback_file
= data
.loopback_file
;
2287 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2291 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2293 fputc ('\n', fb_fp
);
2299 // (rule) debug mode
2301 // the next check implies that:
2302 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2305 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2307 if (debug_rule_len
< 0) debug_rule_len
= 0;
2309 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2311 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2313 if ((quiet
== 0) && (debug_file
== NULL
))
2315 fprintf (stdout
, "%s", PROMPT
);
2322 static int check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2324 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2330 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2332 if (CL_err
!= CL_SUCCESS
)
2334 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2341 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2345 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2347 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, 0, num_cracked
* sizeof (plain_t
), cracked
, 0, NULL
, NULL
);
2349 if (CL_err
!= CL_SUCCESS
)
2351 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
2356 uint cpt_cracked
= 0;
2358 hc_thread_mutex_lock (mux_display
);
2360 for (uint i
= 0; i
< num_cracked
; i
++)
2362 const uint hash_pos
= cracked
[i
].hash_pos
;
2364 if (data
.digests_shown
[hash_pos
] == 1) continue;
2366 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2368 data
.digests_shown
[hash_pos
] = 1;
2370 data
.digests_done
++;
2374 salt_buf
->digests_done
++;
2376 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2378 data
.salts_shown
[salt_pos
] = 1;
2384 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2386 check_hash (device_param
, &cracked
[i
]);
2389 hc_thread_mutex_unlock (mux_display
);
2393 if (cpt_cracked
> 0)
2395 hc_thread_mutex_lock (mux_display
);
2397 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2398 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2402 data
.cpt_total
+= cpt_cracked
;
2404 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2406 hc_thread_mutex_unlock (mux_display
);
2409 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2411 // we need to reset cracked state on the device
2412 // otherwise host thinks again and again the hash was cracked
2413 // and returns invalid password each time
2415 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2417 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, salt_buf
->digests_offset
* sizeof (uint
), salt_buf
->digests_cnt
* sizeof (uint
), &data
.digests_shown_tmp
[salt_buf
->digests_offset
], 0, NULL
, NULL
);
2419 if (CL_err
!= CL_SUCCESS
)
2421 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2429 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2431 if (CL_err
!= CL_SUCCESS
)
2433 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
2442 // stolen from princeprocessor ;)
2453 static void out_flush (out_t
*out
)
2455 fwrite (out
->buf
, 1, out
->len
, out
->fp
);
2460 static void out_push (out_t
*out
, const u8
*pw_buf
, const int pw_len
)
2462 char *ptr
= out
->buf
+ out
->len
;
2464 memcpy (ptr
, pw_buf
, pw_len
);
2468 out
->len
+= pw_len
+ 1;
2470 if (out
->len
>= BUFSIZ
- 100)
2476 static void process_stdout (hc_device_param_t
*device_param
, const uint pws_cnt
)
2483 uint plain_buf
[16] = { 0 };
2485 u8
*plain_ptr
= (u8
*) plain_buf
;
2489 const uint il_cnt
= device_param
->kernel_params_buf32
[30]; // ugly, i know
2491 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2495 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2497 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2499 const uint pos
= device_param
->innerloop_pos
;
2501 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2503 for (int i
= 0; i
< 8; i
++)
2505 plain_buf
[i
] = pw
.i
[i
];
2508 plain_len
= pw
.pw_len
;
2510 plain_len
= apply_rules (data
.kernel_rules_buf
[pos
+ il_pos
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
2512 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2514 out_push (&out
, plain_ptr
, plain_len
);
2518 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2522 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2524 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2526 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2528 for (int i
= 0; i
< 8; i
++)
2530 plain_buf
[i
] = pw
.i
[i
];
2533 plain_len
= pw
.pw_len
;
2535 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
2536 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
2538 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2540 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
2544 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
2546 memcpy (plain_ptr
, comb_buf
, comb_len
);
2549 plain_len
+= comb_len
;
2551 if (data
.pw_max
!= PW_DICTMAX1
)
2553 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2556 out_push (&out
, plain_ptr
, plain_len
);
2560 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2562 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2564 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2566 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
2567 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
2569 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
2570 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
2572 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
2573 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
2575 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
2576 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
2578 plain_len
= data
.css_cnt
;
2580 out_push (&out
, plain_ptr
, plain_len
);
2584 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2588 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2590 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2592 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2594 for (int i
= 0; i
< 8; i
++)
2596 plain_buf
[i
] = pw
.i
[i
];
2599 plain_len
= pw
.pw_len
;
2601 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2604 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2606 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2608 plain_len
+= start
+ stop
;
2610 out_push (&out
, plain_ptr
, plain_len
);
2614 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2618 for (uint gidvid
= 0; gidvid
< pws_cnt
; gidvid
++)
2620 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2622 for (uint il_pos
= 0; il_pos
< il_cnt
; il_pos
++)
2624 for (int i
= 0; i
< 8; i
++)
2626 plain_buf
[i
] = pw
.i
[i
];
2629 plain_len
= pw
.pw_len
;
2631 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2634 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2636 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2638 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2640 plain_len
+= start
+ stop
;
2642 out_push (&out
, plain_ptr
, plain_len
);
2650 static void save_hash ()
2652 char *hashfile
= data
.hashfile
;
2654 char new_hashfile
[256] = { 0 };
2655 char old_hashfile
[256] = { 0 };
2657 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2658 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2660 unlink (new_hashfile
);
2662 char separator
= data
.separator
;
2664 FILE *fp
= fopen (new_hashfile
, "wb");
2668 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2673 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2675 if (data
.salts_shown
[salt_pos
] == 1) continue;
2677 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2679 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2681 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2683 if (data
.digests_shown
[idx
] == 1) continue;
2685 if (data
.hash_mode
!= 2500)
2687 if (data
.username
== 1)
2689 user_t
*user
= data
.hash_info
[idx
]->user
;
2693 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2695 fputc (separator
, fp
);
2698 char out_buf
[HCBUFSIZ
]; // scratch buffer
2702 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2704 fputs (out_buf
, fp
);
2712 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2714 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2723 unlink (old_hashfile
);
2725 if (rename (hashfile
, old_hashfile
) != 0)
2727 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2734 if (rename (new_hashfile
, hashfile
) != 0)
2736 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2741 unlink (old_hashfile
);
2744 static int run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
, const uint iteration
)
2746 cl_int CL_err
= CL_SUCCESS
;
2748 uint num_elements
= num
;
2750 device_param
->kernel_params_buf32
[33] = data
.combs_mode
;
2751 device_param
->kernel_params_buf32
[34] = num
;
2753 uint kernel_threads
= device_param
->kernel_threads
;
2755 while (num_elements
% kernel_threads
) num_elements
++;
2757 cl_kernel kernel
= NULL
;
2761 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2762 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2763 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2764 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2765 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2768 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2769 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2770 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2771 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2772 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2773 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2774 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2775 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2776 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 32, sizeof (cl_uint
), device_param
->kernel_params
[32]);
2777 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 33, sizeof (cl_uint
), device_param
->kernel_params
[33]);
2778 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 34, sizeof (cl_uint
), device_param
->kernel_params
[34]);
2780 if (CL_err
!= CL_SUCCESS
)
2782 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2789 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2791 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2792 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2794 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2796 if (CL_err
!= CL_SUCCESS
)
2798 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2805 if (kern_run
== KERN_RUN_2
)
2807 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2809 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2813 while (num_elements
% kernel_threads
) num_elements
++;
2815 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2816 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2818 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2820 if (CL_err
!= CL_SUCCESS
)
2822 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
2828 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
2830 if (CL_err
!= CL_SUCCESS
)
2832 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
2837 if (device_param
->nvidia_spin_damp
)
2839 if (data
.devices_status
== STATUS_RUNNING
)
2841 if (iteration
< EXPECTED_ITERATIONS
)
2845 case KERN_RUN_1
: if (device_param
->exec_us_prev1
[iteration
]) usleep (device_param
->exec_us_prev1
[iteration
] * device_param
->nvidia_spin_damp
); break;
2846 case KERN_RUN_2
: if (device_param
->exec_us_prev2
[iteration
]) usleep (device_param
->exec_us_prev2
[iteration
] * device_param
->nvidia_spin_damp
); break;
2847 case KERN_RUN_3
: if (device_param
->exec_us_prev3
[iteration
]) usleep (device_param
->exec_us_prev3
[iteration
] * device_param
->nvidia_spin_damp
); break;
2853 CL_err
= hc_clWaitForEvents (data
.ocl
, 1, &event
);
2855 if (CL_err
!= CL_SUCCESS
)
2857 log_error ("ERROR: clWaitForEvents(): %s\n", val2cstr_cl (CL_err
));
2862 cl_ulong time_start
;
2865 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2866 CL_err
|= hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2868 if (CL_err
!= CL_SUCCESS
)
2870 log_error ("ERROR: clGetEventProfilingInfo(): %s\n", val2cstr_cl (CL_err
));
2875 const double exec_us
= (double) (time_end
- time_start
) / 1000;
2877 if (data
.devices_status
== STATUS_RUNNING
)
2879 if (iteration
< EXPECTED_ITERATIONS
)
2883 case KERN_RUN_1
: device_param
->exec_us_prev1
[iteration
] = exec_us
; break;
2884 case KERN_RUN_2
: device_param
->exec_us_prev2
[iteration
] = exec_us
; break;
2885 case KERN_RUN_3
: device_param
->exec_us_prev3
[iteration
] = exec_us
; break;
2892 uint exec_pos
= device_param
->exec_pos
;
2894 device_param
->exec_ms
[exec_pos
] = exec_us
/ 1000;
2898 if (exec_pos
== EXEC_CACHE
)
2903 device_param
->exec_pos
= exec_pos
;
2906 CL_err
= hc_clReleaseEvent (data
.ocl
, event
);
2908 if (CL_err
!= CL_SUCCESS
)
2910 log_error ("ERROR: clReleaseEvent(): %s\n", val2cstr_cl (CL_err
));
2915 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
2917 if (CL_err
!= CL_SUCCESS
)
2919 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
2927 static int run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2929 cl_int CL_err
= CL_SUCCESS
;
2931 uint num_elements
= num
;
2935 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2936 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2937 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2940 // causes problems with special threads like in bcrypt
2941 // const uint kernel_threads = device_param->kernel_threads;
2943 uint kernel_threads
= device_param
->kernel_threads
;
2945 while (num_elements
% kernel_threads
) num_elements
++;
2947 cl_kernel kernel
= NULL
;
2951 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2952 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2953 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2958 case KERN_RUN_MP
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2959 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2960 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2961 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2962 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2963 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2965 case KERN_RUN_MP_R
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2966 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2967 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2968 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2969 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2970 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2972 case KERN_RUN_MP_L
: CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2973 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2974 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2975 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2976 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2977 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2978 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2982 if (CL_err
!= CL_SUCCESS
)
2984 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
2989 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2990 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2992 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2994 if (CL_err
!= CL_SUCCESS
)
2996 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3001 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3003 if (CL_err
!= CL_SUCCESS
)
3005 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3010 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3012 if (CL_err
!= CL_SUCCESS
)
3014 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3022 static int run_kernel_tm (hc_device_param_t
*device_param
)
3024 cl_int CL_err
= CL_SUCCESS
;
3026 const uint num_elements
= 1024; // fixed
3028 uint kernel_threads
= 32;
3030 cl_kernel kernel
= device_param
->kernel_tm
;
3032 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3033 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3035 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3037 if (CL_err
!= CL_SUCCESS
)
3039 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3044 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3046 if (CL_err
!= CL_SUCCESS
)
3048 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3053 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3055 if (CL_err
!= CL_SUCCESS
)
3057 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3065 static int run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
3067 cl_int CL_err
= CL_SUCCESS
;
3069 uint num_elements
= num
;
3071 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
3072 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
3074 // causes problems with special threads like in bcrypt
3075 // const uint kernel_threads = device_param->kernel_threads;
3077 uint kernel_threads
= device_param
->kernel_threads
;
3079 while (num_elements
% kernel_threads
) num_elements
++;
3081 cl_kernel kernel
= device_param
->kernel_amp
;
3083 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
3084 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
3086 if (CL_err
!= CL_SUCCESS
)
3088 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3093 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3094 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3096 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3098 if (CL_err
!= CL_SUCCESS
)
3100 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3105 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3107 if (CL_err
!= CL_SUCCESS
)
3109 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3114 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3116 if (CL_err
!= CL_SUCCESS
)
3118 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3126 static int run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
3128 cl_int CL_err
= CL_SUCCESS
;
3130 const u32 num16d
= num
/ 16;
3131 const u32 num16m
= num
% 16;
3135 device_param
->kernel_params_memset_buf32
[1] = value
;
3136 device_param
->kernel_params_memset_buf32
[2] = num16d
;
3138 uint kernel_threads
= device_param
->kernel_threads
;
3140 uint num_elements
= num16d
;
3142 while (num_elements
% kernel_threads
) num_elements
++;
3144 cl_kernel kernel
= device_param
->kernel_memset
;
3146 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
3147 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
3148 CL_err
|= hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
3150 if (CL_err
!= CL_SUCCESS
)
3152 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
3157 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
3158 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
3160 CL_err
= hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
3162 if (CL_err
!= CL_SUCCESS
)
3164 log_error ("ERROR: clEnqueueNDRangeKernel(): %s\n", val2cstr_cl (CL_err
));
3169 CL_err
= hc_clFlush (data
.ocl
, device_param
->command_queue
);
3171 if (CL_err
!= CL_SUCCESS
)
3173 log_error ("ERROR: clFlush(): %s\n", val2cstr_cl (CL_err
));
3178 CL_err
= hc_clFinish (data
.ocl
, device_param
->command_queue
);
3180 if (CL_err
!= CL_SUCCESS
)
3182 log_error ("ERROR: clFinish(): %s\n", val2cstr_cl (CL_err
));
3197 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
3199 if (CL_err
!= CL_SUCCESS
)
3201 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3210 static int run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
3212 return run_kernel_memset (device_param
, buf
, 0, size
);
3215 static int choose_kernel (hc_device_param_t
*device_param
, const uint attack_exec
, const uint attack_mode
, const uint opts_type
, const salt_t
*salt_buf
, const uint highest_pw_len
, const uint pws_cnt
, const uint fast_iteration
)
3217 cl_int CL_err
= CL_SUCCESS
;
3219 if (data
.hash_mode
== 2000)
3221 process_stdout (device_param
, pws_cnt
);
3226 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3228 if (attack_mode
== ATTACK_MODE_BF
)
3230 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
3232 const uint size_tm
= 32 * sizeof (bs_word_t
);
3234 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
3236 run_kernel_tm (device_param
);
3238 CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
3240 if (CL_err
!= CL_SUCCESS
)
3242 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3249 if (highest_pw_len
< 16)
3251 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true, fast_iteration
);
3253 else if (highest_pw_len
< 32)
3255 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, fast_iteration
);
3259 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true, fast_iteration
);
3264 run_kernel_amp (device_param
, pws_cnt
);
3266 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false, 0);
3268 if (opts_type
& OPTS_TYPE_HOOK12
)
3270 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false, 0);
3272 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3274 if (CL_err
!= CL_SUCCESS
)
3276 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3281 // do something with data
3283 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3285 if (CL_err
!= CL_SUCCESS
)
3287 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3293 uint iter
= salt_buf
->salt_iter
;
3295 uint loop_step
= device_param
->kernel_loops
;
3297 for (uint loop_pos
= 0, slow_iteration
= 0; loop_pos
< iter
; loop_pos
+= loop_step
, slow_iteration
++)
3299 uint loop_left
= iter
- loop_pos
;
3301 loop_left
= MIN (loop_left
, loop_step
);
3303 device_param
->kernel_params_buf32
[28] = loop_pos
;
3304 device_param
->kernel_params_buf32
[29] = loop_left
;
3306 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true, slow_iteration
);
3308 if (data
.devices_status
== STATUS_CRACKED
) break;
3309 if (data
.devices_status
== STATUS_ABORTED
) break;
3310 if (data
.devices_status
== STATUS_QUIT
) break;
3311 if (data
.devices_status
== STATUS_BYPASS
) break;
3317 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
3319 const u64 perf_sum_all
= pws_cnt
* iter_part
;
3323 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3325 const u32 speed_pos
= device_param
->speed_pos
;
3327 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3329 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3331 if (data
.benchmark
== 1)
3333 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
3337 if (opts_type
& OPTS_TYPE_HOOK23
)
3339 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false, 0);
3341 CL_err
= hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3343 if (CL_err
!= CL_SUCCESS
)
3345 log_error ("ERROR: clEnqueueReadBuffer(): %s\n", val2cstr_cl (CL_err
));
3350 // do something with data
3352 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
3354 if (CL_err
!= CL_SUCCESS
)
3356 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3362 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false, 0);
3368 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
3374 else if (rule_len
== 1)
3376 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
3382 static int run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
3384 cl_int CL_err
= CL_SUCCESS
;
3386 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3388 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3390 if (CL_err
!= CL_SUCCESS
)
3392 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3397 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3399 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3401 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
3403 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3405 for (u32 i
= 0; i
< pws_cnt
; i
++)
3407 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3409 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3414 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3416 for (u32 i
= 0; i
< pws_cnt
; i
++)
3418 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3420 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3427 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3429 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3431 for (u32 i
= 0; i
< pws_cnt
; i
++)
3433 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3435 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3440 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3442 for (u32 i
= 0; i
< pws_cnt
; i
++)
3444 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
3446 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
3453 CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3455 if (CL_err
!= CL_SUCCESS
)
3457 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3462 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3464 const u64 off
= device_param
->words_off
;
3466 device_param
->kernel_params_mp_l_buf64
[3] = off
;
3468 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
3474 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
3476 const u32 kernel_power_try
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
3478 device_param
->kernel_params_buf32
[28] = 0;
3479 device_param
->kernel_params_buf32
[29] = kernel_loops
; // not a bug, both need to be set
3480 device_param
->kernel_params_buf32
[30] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
3482 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3484 run_kernel (KERN_RUN_1
, device_param
, kernel_power_try
, true, 0);
3488 run_kernel (KERN_RUN_2
, device_param
, kernel_power_try
, true, 0);
3491 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
3493 return exec_ms_prev
;
3496 static int autotune (hc_device_param_t
*device_param
)
3498 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
3500 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
3501 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
3503 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
3504 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
3506 u32 kernel_accel
= kernel_accel_min
;
3507 u32 kernel_loops
= kernel_loops_min
;
3509 // in this case the user specified a fixed -u and -n on the commandline
3510 // no way to tune anything
3511 // but we need to run a few caching rounds
3513 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
3515 if (data
.hash_mode
!= 2000)
3517 try_run (device_param
, kernel_accel
, kernel_loops
);
3518 try_run (device_param
, kernel_accel
, kernel_loops
);
3519 try_run (device_param
, kernel_accel
, kernel_loops
);
3520 try_run (device_param
, kernel_accel
, kernel_loops
);
3523 device_param
->kernel_accel
= kernel_accel
;
3524 device_param
->kernel_loops
= kernel_loops
;
3526 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3528 device_param
->kernel_power
= kernel_power
;
3533 // from here it's clear we are allowed to autotune
3534 // so let's init some fake words
3536 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
3538 if (data
.attack_kern
== ATTACK_KERN_BF
)
3540 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
3544 for (u32 i
= 0; i
< kernel_power_max
; i
++)
3546 device_param
->pws_buf
[i
].i
[0] = i
;
3547 device_param
->pws_buf
[i
].i
[1] = 0x01234567;
3548 device_param
->pws_buf
[i
].pw_len
= 7 + (i
& 7);
3551 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, kernel_power_max
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
3553 if (CL_err
!= CL_SUCCESS
)
3555 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
3561 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
3563 if (data
.kernel_rules_cnt
> 1)
3565 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, 0, 0, MIN (kernel_loops_max
, KERNEL_RULES
) * sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3567 if (CL_err
!= CL_SUCCESS
)
3569 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3577 run_kernel_amp (device_param
, kernel_power_max
);
3580 #define VERIFIER_CNT 1
3582 // first find out highest kernel-loops that stays below target_ms
3584 if (kernel_loops_min
< kernel_loops_max
)
3586 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
3588 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3590 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3592 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
3594 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3597 if (exec_ms
< target_ms
) break;
3601 // now the same for kernel-accel but with the new kernel-loops from previous loop set
3603 #define STEPS_CNT 10
3605 if (kernel_accel_min
< kernel_accel_max
)
3607 for (int i
= 0; i
< STEPS_CNT
; i
++)
3609 const u32 kernel_accel_try
= 1u << i
;
3611 if (kernel_accel_try
< kernel_accel_min
) continue;
3612 if (kernel_accel_try
> kernel_accel_max
) break;
3614 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3616 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3618 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3620 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3623 if (exec_ms
> target_ms
) break;
3625 kernel_accel
= kernel_accel_try
;
3629 // at this point we want to know the actual runtime for the following reason:
3630 // we need a reference for the balancing loop following up, and this
3631 // the balancing loop can have an effect that the creates a new opportunity, for example:
3632 // if the target is 95 ms and the current runtime is 48ms the above loop
3633 // stopped the execution because the previous exec_ms was > 95ms
3634 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3635 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3637 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3639 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3641 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3643 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3646 u32 diff
= kernel_loops
- kernel_accel
;
3648 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3650 u32 kernel_accel_orig
= kernel_accel
;
3651 u32 kernel_loops_orig
= kernel_loops
;
3653 for (u32 f
= 1; f
< 1024; f
++)
3655 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3656 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3658 if (kernel_accel_try
> kernel_accel_max
) break;
3659 if (kernel_loops_try
< kernel_loops_min
) break;
3661 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3663 if (diff_new
> diff
) break;
3667 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3669 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3671 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3673 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3676 if (exec_ms
< exec_ms_pre_final
)
3678 exec_ms_pre_final
= exec_ms
;
3680 kernel_accel
= kernel_accel_try
;
3681 kernel_loops
= kernel_loops_try
;
3686 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3688 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3690 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3692 if (exec_accel_min
>= 1.0)
3694 // this is safe to not overflow kernel_accel_max because of accel_left
3696 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3699 // reset them fake words
3702 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3704 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3705 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3708 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3710 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3712 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3717 device_param
->exec_pos
= 0;
3719 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3721 memset (device_param
->exec_us_prev1
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3722 memset (device_param
->exec_us_prev2
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3723 memset (device_param
->exec_us_prev3
, 0, EXPECTED_ITERATIONS
* sizeof (double));
3727 device_param
->kernel_accel
= kernel_accel
;
3728 device_param
->kernel_loops
= kernel_loops
;
3730 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3732 device_param
->kernel_power
= kernel_power
;
3736 if (data
.quiet
== 0)
3740 log_info ("- Device #%u: autotuned kernel-accel to %u\n"
3741 "- Device #%u: autotuned kernel-loops to %u\n",
3742 device_param
->device_id
+ 1, kernel_accel
,
3743 device_param
->device_id
+ 1, kernel_loops
);
3745 fprintf (stdout
, "%s", PROMPT
);
3755 static int run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3757 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3761 uint speed_pos
= device_param
->speed_pos
;
3764 if (device_param
->timer_speed
.tv_sec
== 0)
3766 hc_timer_set (&device_param
->timer_speed
);
3771 if (device_param
->timer_speed
.QuadPart
== 0)
3773 hc_timer_set (&device_param
->timer_speed
);
3777 // find higest password length, this is for optimization stuff
3779 uint highest_pw_len
= 0;
3781 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3784 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3787 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3789 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3790 + device_param
->kernel_params_mp_l_buf32
[5];
3795 uint innerloop_step
= 0;
3796 uint innerloop_cnt
= 0;
3798 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3799 else innerloop_step
= 1;
3801 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3803 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3805 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3807 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3809 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3811 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3813 if (data
.devices_status
== STATUS_CRACKED
) break;
3814 if (data
.devices_status
== STATUS_ABORTED
) break;
3815 if (data
.devices_status
== STATUS_QUIT
) break;
3816 if (data
.devices_status
== STATUS_BYPASS
) break;
3818 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3820 device_param
->kernel_params_buf32
[27] = salt_pos
;
3821 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
3822 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
3824 FILE *combs_fp
= device_param
->combs_fp
;
3826 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3833 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3835 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3837 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3839 if (data
.devices_status
== STATUS_CRACKED
) break;
3840 if (data
.devices_status
== STATUS_ABORTED
) break;
3841 if (data
.devices_status
== STATUS_QUIT
) break;
3842 if (data
.devices_status
== STATUS_BYPASS
) break;
3844 uint fast_iteration
= 0;
3846 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3848 if (innerloop_left
> innerloop_step
)
3850 innerloop_left
= innerloop_step
;
3855 device_param
->innerloop_pos
= innerloop_pos
;
3856 device_param
->innerloop_left
= innerloop_left
;
3858 device_param
->kernel_params_buf32
[30] = innerloop_left
;
3860 // i think we can get rid of this
3861 if (innerloop_left
== 0)
3863 puts ("bug, how should this happen????\n");
3868 if (data
.salts_shown
[salt_pos
] == 1)
3870 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3875 // initialize amplifiers
3877 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3881 while (i
< innerloop_left
)
3883 if (feof (combs_fp
)) break;
3885 int line_len
= fgetl (combs_fp
, line_buf
);
3887 if (line_len
>= PW_MAX1
) continue;
3889 line_len
= convert_from_hex (line_buf
, line_len
);
3891 char *line_buf_new
= line_buf
;
3893 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3895 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3897 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3899 if (rule_len_out
< 0)
3901 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3906 line_len
= rule_len_out
;
3908 line_buf_new
= rule_buf_out
;
3911 line_len
= MIN (line_len
, PW_DICTMAX
);
3913 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3915 memcpy (ptr
, line_buf_new
, line_len
);
3917 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3919 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3921 uppercase (ptr
, line_len
);
3924 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3926 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3928 ptr
[line_len
] = 0x80;
3931 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3933 ptr
[line_len
] = 0x01;
3937 device_param
->combs_buf
[i
].pw_len
= line_len
;
3942 for (uint j
= i
; j
< innerloop_left
; j
++)
3944 device_param
->combs_buf
[j
].i
[0] = 0;
3945 device_param
->combs_buf
[j
].i
[1] = 0;
3946 device_param
->combs_buf
[j
].i
[2] = 0;
3947 device_param
->combs_buf
[j
].i
[3] = 0;
3948 device_param
->combs_buf
[j
].i
[4] = 0;
3949 device_param
->combs_buf
[j
].i
[5] = 0;
3950 device_param
->combs_buf
[j
].i
[6] = 0;
3951 device_param
->combs_buf
[j
].i
[7] = 0;
3953 device_param
->combs_buf
[j
].pw_len
= 0;
3958 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3960 u64 off
= innerloop_pos
;
3962 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3964 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3966 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3968 u64 off
= innerloop_pos
;
3970 device_param
->kernel_params_mp_buf64
[3] = off
;
3972 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3974 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3976 u64 off
= innerloop_pos
;
3978 device_param
->kernel_params_mp_buf64
[3] = off
;
3980 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3985 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3987 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (kernel_rule_t
), 0, innerloop_left
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3989 if (CL_err
!= CL_SUCCESS
)
3991 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
3996 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3998 cl_int CL_err
= hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
4000 if (CL_err
!= CL_SUCCESS
)
4002 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
4007 else if (data
.attack_mode
== ATTACK_MODE_BF
)
4009 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
4011 if (CL_err
!= CL_SUCCESS
)
4013 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4018 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
4020 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4022 if (CL_err
!= CL_SUCCESS
)
4024 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4029 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
4031 cl_int CL_err
= hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
4033 if (CL_err
!= CL_SUCCESS
)
4035 log_error ("ERROR: clEnqueueCopyBuffer(): %s\n", val2cstr_cl (CL_err
));
4041 if (data
.benchmark
== 1)
4043 hc_timer_set (&device_param
->timer_speed
);
4046 int rc
= choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
, fast_iteration
);
4048 if (rc
== -1) return -1;
4050 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4052 if (data
.devices_status
== STATUS_CRACKED
) break;
4053 if (data
.devices_status
== STATUS_ABORTED
) break;
4054 if (data
.devices_status
== STATUS_QUIT
) break;
4055 if (data
.devices_status
== STATUS_BYPASS
) break;
4061 if (data
.benchmark
== 0)
4063 check_cracked (device_param
, salt_pos
);
4070 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
4072 hc_thread_mutex_lock (mux_counter
);
4074 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
4076 hc_thread_mutex_unlock (mux_counter
);
4084 hc_timer_get (device_param
->timer_speed
, speed_ms
);
4086 hc_timer_set (&device_param
->timer_speed
);
4090 //hc_thread_mutex_lock (mux_display);
4092 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
4094 device_param
->speed_ms
[speed_pos
] = speed_ms
;
4096 //hc_thread_mutex_unlock (mux_display);
4100 if (speed_pos
== SPEED_CACHE
)
4109 if (data
.benchmark
== 1) break;
4113 device_param
->speed_pos
= speed_pos
;
4120 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
4122 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
4126 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
4128 wl_data
->buf
[wl_data
->cnt
] = 0;
4130 if (wl_data
->cnt
== 0) return;
4132 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
4136 if (wl_data
->cnt
== wl_data
->avail
)
4138 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
4140 wl_data
->avail
+= wl_data
->incr
;
4143 const int c
= fgetc (fd
);
4145 if (c
== EOF
) break;
4147 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
4151 if (c
== '\n') break;
4154 // ensure stream ends with a newline
4156 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
4160 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
4166 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4170 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4172 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4182 if (*ptr
!= '\n') continue;
4186 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4197 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4201 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4203 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
4205 if (*ptr
!= '\n') continue;
4209 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4220 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
4224 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
4226 if (*ptr
!= '\n') continue;
4230 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
4241 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
4243 while (wl_data
->pos
< wl_data
->cnt
)
4248 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
4250 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
4252 wl_data
->pos
+= off
;
4254 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4256 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4258 int rule_len_out
= -1;
4260 if (len
< BLOCK_SIZE
)
4262 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
4265 if (rule_len_out
< 0)
4270 if (rule_len_out
> PW_MAX
)
4291 fprintf (stderr
, "BUG feof()!!\n");
4296 load_segment (wl_data
, fd
);
4298 get_next_word (wl_data
, fd
, out_buf
, out_len
);
4302 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
4306 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
4316 fstat (fileno (fd
), &d
.stat
);
4320 _fstat64 (fileno (fd
), &d
.stat
);
4324 d
.stat
.st_nlink
= 0;
4328 d
.stat
.st_atime
= 0;
4331 d
.stat
.st_blksize
= 0;
4332 d
.stat
.st_blocks
= 0;
4335 if (d
.stat
.st_size
== 0) return 0;
4337 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4339 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
4343 u64 cnt
= d_cache
->cnt
;
4347 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4349 keyspace
*= data
.kernel_rules_cnt
;
4351 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4353 keyspace
*= data
.combs_cnt
;
4356 if (data
.quiet
== 0) log_info ("Cache-hit dictionary stats %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) d
.stat
.st_size
, (unsigned long long int) cnt
, (unsigned long long int) keyspace
);
4357 if (data
.quiet
== 0) log_info ("");
4359 hc_signal (sigHandler_default
);
4374 load_segment (wl_data
, fd
);
4376 comp
+= wl_data
->cnt
;
4380 while (i
< wl_data
->cnt
)
4385 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
4387 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4389 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4391 int rule_len_out
= -1;
4393 if (len
< BLOCK_SIZE
)
4395 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
4398 if (rule_len_out
< 0)
4410 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
4412 cnt
+= data
.kernel_rules_cnt
;
4414 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
4416 cnt
+= data
.combs_cnt
;
4429 if ((now
- prev
) == 0) continue;
4431 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
4433 if (data
.quiet
== 0) log_info_nn ("Generating dictionary stats for %s: %llu bytes (%.2f%%), %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, percent
* 100, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4438 if (data
.quiet
== 0) log_info ("Generated dictionary stats for %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
4439 if (data
.quiet
== 0) log_info ("");
4441 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
4443 hc_signal (sigHandler_default
);
4448 static void *thread_monitor (void *p
)
4450 uint runtime_check
= 0;
4451 uint remove_check
= 0;
4452 uint status_check
= 0;
4453 uint restore_check
= 0;
4455 uint restore_left
= data
.restore_timer
;
4456 uint remove_left
= data
.remove_timer
;
4457 uint status_left
= data
.status_timer
;
4460 uint hwmon_check
= 0;
4462 int slowdown_warnings
= 0;
4464 // these variables are mainly used for fan control
4466 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4468 // temperature controller "loopback" values
4470 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4471 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
4473 int temp_threshold
= 1; // degrees celcius
4475 int fan_speed_min
= 15; // in percentage
4476 int fan_speed_max
= 100;
4478 time_t last_temp_check_time
;
4479 #endif // HAVE_HWMON
4481 uint sleep_time
= 1;
4488 if (data
.restore_timer
)
4493 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
4498 if (data
.status
== 1)
4504 if (data
.gpu_temp_disable
== 0)
4506 time (&last_temp_check_time
);
4512 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
4515 if (hwmon_check
== 0)
4520 while (data
.shutdown_inner
== 0)
4522 hc_sleep (sleep_time
);
4524 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4528 if (hwmon_check
== 1)
4530 hc_thread_mutex_lock (mux_adl
);
4532 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4534 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4536 if (device_param
->skipped
) continue;
4538 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4542 NV_GPU_PERF_POLICIES_INFO_PARAMS_V1 perfPolicies_info
;
4543 NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1 perfPolicies_status
;
4545 memset (&perfPolicies_info
, 0, sizeof (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
));
4546 memset (&perfPolicies_status
, 0, sizeof (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
));
4548 perfPolicies_info
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_INFO_PARAMS_V1
, 1);
4549 perfPolicies_status
.version
= MAKE_NVAPI_VERSION (NV_GPU_PERF_POLICIES_STATUS_PARAMS_V1
, 1);
4551 hm_NvAPI_GPU_GetPerfPoliciesInfo (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_info
);
4553 perfPolicies_status
.info_value
= perfPolicies_info
.info_value
;
4555 hm_NvAPI_GPU_GetPerfPoliciesStatus (data
.hm_nvapi
, data
.hm_device
[device_id
].nvapi
, &perfPolicies_status
);
4557 if (perfPolicies_status
.throttle
& 2)
4559 if (slowdown_warnings
< 3)
4561 if (data
.quiet
== 0) clear_prompt ();
4563 log_info ("WARNING: Drivers temperature threshold hit on GPU #%d, expect performance to drop...", device_id
+ 1);
4565 if (slowdown_warnings
== 2)
4570 if (data
.quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
4571 if (data
.quiet
== 0) fflush (stdout
);
4573 slowdown_warnings
++;
4578 slowdown_warnings
= 0;
4584 hc_thread_mutex_unlock (mux_adl
);
4587 if (hwmon_check
== 1)
4589 hc_thread_mutex_lock (mux_adl
);
4591 time_t temp_check_time
;
4593 time (&temp_check_time
);
4595 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
4597 if (Ta
== 0) Ta
= 1;
4599 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
4601 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
4603 if (device_param
->skipped
) continue;
4605 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
4607 const int temperature
= hm_get_temperature_with_device_id (device_id
);
4609 if (temperature
> (int) data
.gpu_temp_abort
)
4611 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
4613 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4618 const int gpu_temp_retain
= data
.gpu_temp_retain
;
4620 if (gpu_temp_retain
)
4622 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
4624 int temp_cur
= temperature
;
4626 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
4628 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
4630 // calculate Ta value (time difference in seconds between the last check and this check)
4632 last_temp_check_time
= temp_check_time
;
4638 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
4640 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[device_id
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[device_id
])) / Ta
);
4642 if (abs (fan_diff_required
) >= temp_threshold
)
4644 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
4646 int fan_speed_level
= fan_speed_cur
;
4648 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
4650 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
4652 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
4653 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
4655 if (fan_speed_new
!= fan_speed_cur
)
4657 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
4658 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
4660 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
4662 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
4664 hm_set_fanspeed_with_device_id_adl (device_id
, fan_speed_new
, 1);
4666 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
4669 hm_set_fanspeed_with_device_id_nvapi (device_id
, fan_speed_new
, 1);
4673 hm_set_fanspeed_with_device_id_xnvctrl (device_id
, fan_speed_new
);
4677 fan_speed_chgd
[device_id
] = 1;
4680 temp_diff_old
[device_id
] = temp_diff_new
;
4687 hc_thread_mutex_unlock (mux_adl
);
4689 #endif // HAVE_HWMON
4691 if (restore_check
== 1)
4695 if (restore_left
== 0)
4697 if (data
.restore_disable
== 0) cycle_restore ();
4699 restore_left
= data
.restore_timer
;
4703 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
4707 time (&runtime_cur
);
4709 int runtime_left
= data
.proc_start
+ data
.runtime
+ data
.prepare_time
- runtime_cur
;
4711 if (runtime_left
<= 0)
4713 if (data
.benchmark
== 0)
4715 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
4718 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
4722 if (remove_check
== 1)
4726 if (remove_left
== 0)
4728 if (data
.digests_saved
!= data
.digests_done
)
4730 data
.digests_saved
= data
.digests_done
;
4735 remove_left
= data
.remove_timer
;
4739 if (status_check
== 1)
4743 if (status_left
== 0)
4745 hc_thread_mutex_lock (mux_display
);
4747 if (data
.quiet
== 0) clear_prompt ();
4749 if (data
.quiet
== 0) log_info ("");
4753 if (data
.quiet
== 0) log_info ("");
4755 hc_thread_mutex_unlock (mux_display
);
4757 status_left
= data
.status_timer
;
4763 myfree (fan_speed_chgd
);
4765 myfree (temp_diff_old
);
4766 myfree (temp_diff_sum
);
4774 static void *thread_outfile_remove (void *p
)
4776 // some hash-dependent constants
4777 char *outfile_dir
= data
.outfile_check_directory
;
4778 uint dgst_size
= data
.dgst_size
;
4779 uint isSalted
= data
.isSalted
;
4780 uint esalt_size
= data
.esalt_size
;
4781 uint hash_mode
= data
.hash_mode
;
4783 uint outfile_check_timer
= data
.outfile_check_timer
;
4785 char separator
= data
.separator
;
4787 // some hash-dependent functions
4788 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4789 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4792 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4794 hash_buf
.digest
= mymalloc (dgst_size
);
4796 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4798 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4800 uint digest_buf
[64] = { 0 };
4802 outfile_data_t
*out_info
= NULL
;
4804 char **out_files
= NULL
;
4806 time_t folder_mtime
= 0;
4810 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4812 while (data
.shutdown_inner
== 0)
4816 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4820 if (check_left
== 0)
4822 struct stat outfile_check_stat
;
4824 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4826 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4830 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4832 char **out_files_new
= scan_directory (outfile_dir
);
4834 int out_cnt_new
= count_dictionaries (out_files_new
);
4836 outfile_data_t
*out_info_new
= NULL
;
4838 if (out_cnt_new
> 0)
4840 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4842 for (int i
= 0; i
< out_cnt_new
; i
++)
4844 out_info_new
[i
].file_name
= out_files_new
[i
];
4846 // check if there are files that we have seen/checked before (and not changed)
4848 for (int j
= 0; j
< out_cnt
; j
++)
4850 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4852 struct stat outfile_stat
;
4854 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4856 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4858 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4859 out_info_new
[i
].seek
= out_info
[j
].seek
;
4867 local_free (out_info
);
4868 local_free (out_files
);
4870 out_files
= out_files_new
;
4871 out_cnt
= out_cnt_new
;
4872 out_info
= out_info_new
;
4874 folder_mtime
= outfile_check_stat
.st_mtime
;
4877 for (int j
= 0; j
< out_cnt
; j
++)
4879 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4883 //hc_thread_mutex_lock (mux_display);
4886 struct stat outfile_stat
;
4888 fstat (fileno (fp
), &outfile_stat
);
4892 struct stat64 outfile_stat
;
4894 _fstat64 (fileno (fp
), &outfile_stat
);
4897 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4899 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4900 out_info
[j
].seek
= 0;
4903 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4905 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4909 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4911 if (ptr
== NULL
) break;
4913 int line_len
= strlen (line_buf
);
4915 if (line_len
<= 0) continue;
4917 int iter
= MAX_CUT_TRIES
;
4919 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4921 if (line_buf
[i
] != separator
) continue;
4923 int parser_status
= PARSER_OK
;
4925 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4927 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4932 if (parser_status
== PARSER_OK
)
4934 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4936 if (data
.salts_shown
[salt_pos
] == 1) continue;
4938 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4940 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4942 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4944 if (data
.digests_shown
[idx
] == 1) continue;
4948 if (hash_mode
== 6800)
4950 if (i
== salt_buf
->salt_len
)
4952 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4955 else if (hash_mode
== 2500)
4957 // BSSID : MAC1 : MAC2 (:plain)
4958 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4960 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4962 if (!cracked
) continue;
4964 // now compare MAC1 and MAC2 too, since we have this additional info
4965 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4966 char *mac2_pos
= mac1_pos
+ 12 + 1;
4968 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4969 wpa_t
*wpa
= &wpas
[salt_pos
];
4971 // compare hex string(s) vs binary MAC address(es)
4973 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4975 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4984 if (!cracked
) continue;
4986 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4988 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4999 char *digests_buf_ptr
= (char *) data
.digests_buf
;
5001 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
5003 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
5010 data
.digests_shown
[idx
] = 1;
5012 data
.digests_done
++;
5014 salt_buf
->digests_done
++;
5016 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
5018 data
.salts_shown
[salt_pos
] = 1;
5022 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
5027 if (data
.devices_status
== STATUS_CRACKED
) break;
5033 if (data
.devices_status
== STATUS_CRACKED
) break;
5038 if (data
.devices_status
== STATUS_CRACKED
) break;
5043 out_info
[j
].seek
= ftell (fp
);
5045 //hc_thread_mutex_unlock (mux_display);
5053 check_left
= outfile_check_timer
;
5057 if (esalt_size
) local_free (hash_buf
.esalt
);
5059 if (isSalted
) local_free (hash_buf
.salt
);
5061 local_free (hash_buf
.digest
);
5063 local_free (out_info
);
5065 local_free (out_files
);
5072 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
5074 //if (device_param->pws_cnt < device_param->kernel_power)
5076 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
5078 u8
*ptr
= (u8
*) pw
->i
;
5080 memcpy (ptr
, pw_buf
, pw_len
);
5082 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
5084 pw
->pw_len
= pw_len
;
5086 device_param
->pws_cnt
++;
5090 // fprintf (stderr, "BUG pw_add()!!\n");
5096 static void set_kernel_power_final (const u64 kernel_power_final
)
5098 if (data
.quiet
== 0)
5104 log_info ("INFO: approaching final keyspace, workload adjusted");
5107 fprintf (stdout
, "%s", PROMPT
);
5112 data
.kernel_power_final
= kernel_power_final
;
5115 static u32
get_power (hc_device_param_t
*device_param
)
5117 const u64 kernel_power_final
= data
.kernel_power_final
;
5119 if (kernel_power_final
)
5121 const double device_factor
= (double) device_param
->hardware_power
/ data
.hardware_power_all
;
5123 const u64 words_left_device
= CEIL ((double) kernel_power_final
* device_factor
);
5125 // work should be at least the hardware power available without any accelerator
5127 const u64 work
= MAX (words_left_device
, device_param
->hardware_power
);
5132 return device_param
->kernel_power
;
5135 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
)
5137 hc_thread_mutex_lock (mux_dispatcher
);
5139 const u64 words_cur
= data
.words_cur
;
5140 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: MIN (data
.limit
, data
.words_base
);
5142 device_param
->words_off
= words_cur
;
5144 const u64 kernel_power_all
= data
.kernel_power_all
;
5146 const u64 words_left
= words_base
- words_cur
;
5148 if (words_left
< kernel_power_all
)
5150 if (data
.kernel_power_final
== 0)
5152 set_kernel_power_final (words_left
);
5156 const u32 kernel_power
= get_power (device_param
);
5158 uint work
= MIN (words_left
, kernel_power
);
5160 work
= MIN (work
, max
);
5162 data
.words_cur
+= work
;
5164 hc_thread_mutex_unlock (mux_dispatcher
);
5169 static void *thread_autotune (void *p
)
5171 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5173 if (device_param
->skipped
) return NULL
;
5175 autotune (device_param
);
5180 static void *thread_calc_stdin (void *p
)
5182 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5184 if (device_param
->skipped
) return NULL
;
5186 char *buf
= (char *) mymalloc (HCBUFSIZ
);
5188 const uint attack_kern
= data
.attack_kern
;
5190 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5192 hc_thread_mutex_lock (mux_dispatcher
);
5194 if (feof (stdin
) != 0)
5196 hc_thread_mutex_unlock (mux_dispatcher
);
5203 while (words_cur
< device_param
->kernel_power
)
5205 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
5207 if (line_buf
== NULL
) break;
5209 uint line_len
= in_superchop (line_buf
);
5211 line_len
= convert_from_hex (line_buf
, line_len
);
5213 // post-process rule engine
5215 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5217 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5219 int rule_len_out
= -1;
5221 if (line_len
< BLOCK_SIZE
)
5223 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5226 if (rule_len_out
< 0) continue;
5228 line_buf
= rule_buf_out
;
5229 line_len
= rule_len_out
;
5232 if (line_len
> PW_MAX
)
5237 // hmm that's always the case, or?
5239 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5241 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5243 hc_thread_mutex_lock (mux_counter
);
5245 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5247 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5250 hc_thread_mutex_unlock (mux_counter
);
5256 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5260 if (data
.devices_status
== STATUS_CRACKED
) break;
5261 if (data
.devices_status
== STATUS_ABORTED
) break;
5262 if (data
.devices_status
== STATUS_QUIT
) break;
5263 if (data
.devices_status
== STATUS_BYPASS
) break;
5266 hc_thread_mutex_unlock (mux_dispatcher
);
5268 if (data
.devices_status
== STATUS_CRACKED
) break;
5269 if (data
.devices_status
== STATUS_ABORTED
) break;
5270 if (data
.devices_status
== STATUS_QUIT
) break;
5271 if (data
.devices_status
== STATUS_BYPASS
) break;
5275 const uint pws_cnt
= device_param
->pws_cnt
;
5279 run_copy (device_param
, pws_cnt
);
5281 run_cracker (device_param
, pws_cnt
);
5283 device_param
->pws_cnt
= 0;
5287 if (attack_kern == ATTACK_KERN_STRAIGHT)
5289 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5291 else if (attack_kern == ATTACK_KERN_COMBI)
5293 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5299 device_param
->kernel_accel
= 0;
5300 device_param
->kernel_loops
= 0;
5307 static void *thread_calc (void *p
)
5309 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
5311 if (device_param
->skipped
) return NULL
;
5313 const uint attack_mode
= data
.attack_mode
;
5314 const uint attack_kern
= data
.attack_kern
;
5316 if (attack_mode
== ATTACK_MODE_BF
)
5318 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5320 const uint work
= get_work (device_param
, -1);
5322 if (work
== 0) break;
5324 const u64 words_off
= device_param
->words_off
;
5325 const u64 words_fin
= words_off
+ work
;
5327 const uint pws_cnt
= work
;
5329 device_param
->pws_cnt
= pws_cnt
;
5333 run_copy (device_param
, pws_cnt
);
5335 run_cracker (device_param
, pws_cnt
);
5337 device_param
->pws_cnt
= 0;
5341 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
5345 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5347 if (data
.devices_status
== STATUS_CRACKED
) break;
5348 if (data
.devices_status
== STATUS_ABORTED
) break;
5349 if (data
.devices_status
== STATUS_QUIT
) break;
5350 if (data
.devices_status
== STATUS_BYPASS
) break;
5352 if (data
.benchmark
== 1) break;
5354 device_param
->words_done
= words_fin
;
5359 const uint segment_size
= data
.segment_size
;
5361 char *dictfile
= data
.dictfile
;
5363 if (attack_mode
== ATTACK_MODE_COMBI
)
5365 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5367 dictfile
= data
.dictfile2
;
5371 FILE *fd
= fopen (dictfile
, "rb");
5375 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
5380 if (attack_mode
== ATTACK_MODE_COMBI
)
5382 const uint combs_mode
= data
.combs_mode
;
5384 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
5386 const char *dictfilec
= data
.dictfile2
;
5388 FILE *combs_fp
= fopen (dictfilec
, "rb");
5390 if (combs_fp
== NULL
)
5392 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5399 device_param
->combs_fp
= combs_fp
;
5401 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
5403 const char *dictfilec
= data
.dictfile
;
5405 FILE *combs_fp
= fopen (dictfilec
, "rb");
5407 if (combs_fp
== NULL
)
5409 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
5416 device_param
->combs_fp
= combs_fp
;
5420 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
5422 wl_data
->buf
= (char *) mymalloc (segment_size
);
5423 wl_data
->avail
= segment_size
;
5424 wl_data
->incr
= segment_size
;
5430 while ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
5439 const uint work
= get_work (device_param
, max
);
5441 if (work
== 0) break;
5445 words_off
= device_param
->words_off
;
5446 words_fin
= words_off
+ work
;
5451 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5453 for ( ; words_cur
< words_fin
; words_cur
++)
5455 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
5457 line_len
= convert_from_hex (line_buf
, line_len
);
5459 // post-process rule engine
5461 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
5463 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
5465 int rule_len_out
= -1;
5467 if (line_len
< BLOCK_SIZE
)
5469 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
5472 if (rule_len_out
< 0) continue;
5474 line_buf
= rule_buf_out
;
5475 line_len
= rule_len_out
;
5478 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5480 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
5484 hc_thread_mutex_lock (mux_counter
);
5486 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5488 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
5491 hc_thread_mutex_unlock (mux_counter
);
5496 else if (attack_kern
== ATTACK_KERN_COMBI
)
5498 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
5499 // since we still need to combine the plains
5501 if (line_len
> data
.pw_max
)
5505 hc_thread_mutex_lock (mux_counter
);
5507 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
5509 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
5512 hc_thread_mutex_unlock (mux_counter
);
5518 pw_add (device_param
, (u8
*) line_buf
, line_len
);
5520 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5522 if (data
.devices_status
== STATUS_CRACKED
) break;
5523 if (data
.devices_status
== STATUS_ABORTED
) break;
5524 if (data
.devices_status
== STATUS_QUIT
) break;
5525 if (data
.devices_status
== STATUS_BYPASS
) break;
5528 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5530 if (data
.devices_status
== STATUS_CRACKED
) break;
5531 if (data
.devices_status
== STATUS_ABORTED
) break;
5532 if (data
.devices_status
== STATUS_QUIT
) break;
5533 if (data
.devices_status
== STATUS_BYPASS
) break;
5536 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5538 if (data
.devices_status
== STATUS_CRACKED
) break;
5539 if (data
.devices_status
== STATUS_ABORTED
) break;
5540 if (data
.devices_status
== STATUS_QUIT
) break;
5541 if (data
.devices_status
== STATUS_BYPASS
) break;
5547 const uint pws_cnt
= device_param
->pws_cnt
;
5551 run_copy (device_param
, pws_cnt
);
5553 run_cracker (device_param
, pws_cnt
);
5555 device_param
->pws_cnt
= 0;
5559 if (attack_kern == ATTACK_KERN_STRAIGHT)
5561 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
5563 else if (attack_kern == ATTACK_KERN_COMBI)
5565 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
5570 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
5572 if (data
.devices_status
== STATUS_CRACKED
) break;
5573 if (data
.devices_status
== STATUS_ABORTED
) break;
5574 if (data
.devices_status
== STATUS_QUIT
) break;
5575 if (data
.devices_status
== STATUS_BYPASS
) break;
5577 if (words_fin
== 0) break;
5579 device_param
->words_done
= words_fin
;
5582 if (attack_mode
== ATTACK_MODE_COMBI
)
5584 fclose (device_param
->combs_fp
);
5587 free (wl_data
->buf
);
5593 device_param
->kernel_accel
= 0;
5594 device_param
->kernel_loops
= 0;
5599 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
5603 log_error ("ERROR: %s : Invalid argument", __func__
);
5608 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
5610 device_param
->kernel_params_buf32
[27] = salt_pos
;
5611 device_param
->kernel_params_buf32
[30] = 1;
5612 device_param
->kernel_params_buf32
[31] = salt_buf
->digests_cnt
;
5613 device_param
->kernel_params_buf32
[32] = salt_buf
->digests_offset
;
5614 device_param
->kernel_params_buf32
[33] = 0;
5615 device_param
->kernel_params_buf32
[34] = 1;
5617 char *dictfile_old
= data
.dictfile
;
5619 const char *weak_hash_check
= "weak-hash-check";
5621 data
.dictfile
= (char *) weak_hash_check
;
5623 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
5625 data
.kernel_rules_buf
[0].cmds
[0] = 0;
5631 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
5633 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5637 run_kernel (KERN_RUN_1
, device_param
, 1, false, 0);
5639 uint loop_step
= 16;
5641 const uint iter
= salt_buf
->salt_iter
;
5643 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
5645 uint loop_left
= iter
- loop_pos
;
5647 loop_left
= MIN (loop_left
, loop_step
);
5649 device_param
->kernel_params_buf32
[28] = loop_pos
;
5650 device_param
->kernel_params_buf32
[29] = loop_left
;
5652 run_kernel (KERN_RUN_2
, device_param
, 1, false, 0);
5655 run_kernel (KERN_RUN_3
, device_param
, 1, false, 0);
5662 check_cracked (device_param
, salt_pos
);
5668 device_param
->kernel_params_buf32
[27] = 0;
5669 device_param
->kernel_params_buf32
[28] = 0;
5670 device_param
->kernel_params_buf32
[29] = 0;
5671 device_param
->kernel_params_buf32
[30] = 0;
5672 device_param
->kernel_params_buf32
[31] = 0;
5673 device_param
->kernel_params_buf32
[32] = 0;
5674 device_param
->kernel_params_buf32
[33] = 0;
5675 device_param
->kernel_params_buf32
[34] = 0;
5677 data
.dictfile
= dictfile_old
;
5679 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
5684 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5686 if (data
.username
== 0)
5688 *hashbuf_pos
= line_buf
;
5689 *hashbuf_len
= line_len
;
5693 char *pos
= line_buf
;
5696 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
5698 if (line_buf
[i
] == data
.separator
)
5713 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5720 for (int i
= 0; i
< line_len
; i
++)
5722 if (line_buf
[i
] == data
.separator
)
5731 if (pos
== NULL
) pos
= line_buf
+ i
;
5743 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5750 for (int i
= 0; i
< line_len
; i
++)
5752 if (line_buf
[i
] == ':')
5759 if (sep_cnt
== 2) sep2_len
++;
5760 if (sep_cnt
== 3) sep3_len
++;
5763 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5768 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5775 for (int i
= 0; i
< line_len
; i
++)
5777 if (line_buf
[i
] == ':')
5784 if (data
.hash_mode
== 1000)
5788 if (pos
== NULL
) pos
= line_buf
+ i
;
5793 else if (data
.hash_mode
== 3000)
5797 if (pos
== NULL
) pos
= line_buf
+ i
;
5808 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5815 for (int i
= 0; i
< line_len
; i
++)
5817 if (line_buf
[i
] == ':')
5826 if (pos
== NULL
) pos
= line_buf
+ i
;
5838 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5842 char sep5_first
= 0;
5843 char sep6_first
= 0;
5845 for (int i
= 0; i
< line_len
; i
++)
5847 if (line_buf
[i
] == ':')
5854 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5855 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5858 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5863 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5870 for (int i
= 0; i
< line_len
; i
++)
5872 if (line_buf
[i
] == ':')
5881 if (pos
== NULL
) pos
= line_buf
+ i
;
5891 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5898 for (int i
= 0; i
< line_len
; i
++)
5900 if (line_buf
[i
] == ':')
5909 if (pos
== NULL
) pos
= line_buf
+ i
;
5921 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5925 for (int i
= 0; i
< line_len
; i
++)
5927 if (line_buf
[i
] == ':') sep_cnt
++;
5930 if (sep_cnt
== 8) return 1;
5935 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5937 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5940 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5942 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5947 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5949 switch (hashfile_format
)
5951 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5952 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5953 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5954 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5958 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5960 switch (hashfile_format
)
5962 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5963 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5964 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5965 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5969 char *strhlfmt (const uint hashfile_format
)
5971 switch (hashfile_format
)
5973 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5974 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5975 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5976 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5977 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5978 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5979 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5980 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5981 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5982 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5985 return ((char *) "Unknown");
5988 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5990 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5992 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5993 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5995 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5999 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
6003 int line_len
= fgetl (fp
, line_buf
);
6005 if (line_len
== 0) continue;
6007 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
6008 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
6009 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
6011 if (num_check
== max_check
) break;
6018 uint hashlist_format
= HLFMT_HASHCAT
;
6020 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
6022 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
6024 hashlist_format
= i
;
6029 return hashlist_format
;
6033 * some further helper function
6036 // wrapper around mymalloc for ADL
6038 #if defined(HAVE_HWMON)
6039 void *HC_API_CALL
ADL_Main_Memory_Alloc (const int iSize
)
6041 return mymalloc (iSize
);
6045 static uint
generate_bitmaps (const uint digests_cnt
, const uint dgst_size
, const uint dgst_shifts
, char *digests_buf_ptr
, const uint bitmap_mask
, const uint bitmap_size
, uint
*bitmap_a
, uint
*bitmap_b
, uint
*bitmap_c
, uint
*bitmap_d
, const u64 collisions_max
)
6049 const uint dgst_pos0
= data
.dgst_pos0
;
6050 const uint dgst_pos1
= data
.dgst_pos1
;
6051 const uint dgst_pos2
= data
.dgst_pos2
;
6052 const uint dgst_pos3
= data
.dgst_pos3
;
6054 memset (bitmap_a
, 0, bitmap_size
);
6055 memset (bitmap_b
, 0, bitmap_size
);
6056 memset (bitmap_c
, 0, bitmap_size
);
6057 memset (bitmap_d
, 0, bitmap_size
);
6059 for (uint i
= 0; i
< digests_cnt
; i
++)
6061 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
6063 digests_buf_ptr
+= dgst_size
;
6065 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
6066 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
6067 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
6068 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
6070 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
6071 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
6072 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
6073 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
6075 if (bitmap_a
[idx0
] & val0
) collisions
++;
6076 if (bitmap_b
[idx1
] & val1
) collisions
++;
6077 if (bitmap_c
[idx2
] & val2
) collisions
++;
6078 if (bitmap_d
[idx3
] & val3
) collisions
++;
6080 bitmap_a
[idx0
] |= val0
;
6081 bitmap_b
[idx1
] |= val1
;
6082 bitmap_c
[idx2
] |= val2
;
6083 bitmap_d
[idx3
] |= val3
;
6085 if (collisions
>= collisions_max
) return 0x7fffffff;
6096 void SetConsoleWindowSize (const int x
)
6098 HANDLE h
= GetStdHandle (STD_OUTPUT_HANDLE
);
6100 if (h
== INVALID_HANDLE_VALUE
) return;
6102 CONSOLE_SCREEN_BUFFER_INFO bufferInfo
;
6104 if (!GetConsoleScreenBufferInfo (h
, &bufferInfo
)) return;
6106 SMALL_RECT
*sr
= &bufferInfo
.srWindow
;
6108 sr
->Right
= MAX (sr
->Right
, x
- 1);
6112 co
.X
= sr
->Right
+ 1;
6115 if (!SetConsoleScreenBufferSize (h
, co
)) return;
6117 if (!SetConsoleWindowInfo (h
, TRUE
, sr
)) return;
6121 int main (int argc
, char **argv
)
6124 SetConsoleWindowSize (132);
6128 * To help users a bit
6131 char *compute
= getenv ("COMPUTE");
6135 static char display
[100];
6137 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
6143 if (getenv ("DISPLAY") == NULL
)
6144 putenv ((char *) "DISPLAY=:0");
6147 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
6148 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
6150 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
6151 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
6153 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
6154 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
6156 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
6157 putenv ((char *) "CUDA_CACHE_DISABLE=1");
6159 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
6160 putenv ((char *) "POCL_KERNEL_CACHE=0");
6165 * There's some buggy OpenCL runtime that do not support -I.
6166 * A workaround is to chdir() to the OpenCL folder,
6167 * then compile the kernels,
6168 * then chdir() back to where we came from so we need to save it first
6173 if (getcwd (cwd
, sizeof (cwd
) - 1) == NULL
)
6175 log_error ("ERROR: getcwd(): %s", strerror (errno
));
6184 memset (&data
, 0, sizeof (hc_global_data_t
));
6190 data
.proc_start
= proc_start
;
6192 time_t prepare_start
;
6194 time (&prepare_start
);
6197 char **myargv
= argv
;
6199 hc_thread_mutex_init (mux_dispatcher
);
6200 hc_thread_mutex_init (mux_counter
);
6201 hc_thread_mutex_init (mux_display
);
6202 hc_thread_mutex_init (mux_adl
);
6205 * commandline parameters
6209 uint version
= VERSION
;
6211 uint benchmark
= BENCHMARK
;
6212 uint stdout_flag
= STDOUT_FLAG
;
6215 uint username
= USERNAME
;
6216 uint remove
= REMOVE
;
6217 uint remove_timer
= REMOVE_TIMER
;
6220 uint keyspace
= KEYSPACE
;
6221 uint potfile_disable
= POTFILE_DISABLE
;
6222 char *potfile_path
= NULL
;
6223 uint debug_mode
= DEBUG_MODE
;
6224 char *debug_file
= NULL
;
6225 char *induction_dir
= NULL
;
6226 char *outfile_check_dir
= NULL
;
6228 uint runtime
= RUNTIME
;
6229 uint hash_mode
= HASH_MODE
;
6230 uint attack_mode
= ATTACK_MODE
;
6231 uint markov_disable
= MARKOV_DISABLE
;
6232 uint markov_classic
= MARKOV_CLASSIC
;
6233 uint markov_threshold
= MARKOV_THRESHOLD
;
6234 char *markov_hcstat
= NULL
;
6235 char *outfile
= NULL
;
6236 uint outfile_format
= OUTFILE_FORMAT
;
6237 uint outfile_autohex
= OUTFILE_AUTOHEX
;
6238 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
6239 uint restore
= RESTORE
;
6240 uint restore_timer
= RESTORE_TIMER
;
6241 uint restore_disable
= RESTORE_DISABLE
;
6242 uint status
= STATUS
;
6243 uint status_timer
= STATUS_TIMER
;
6244 uint machine_readable
= MACHINE_READABLE
;
6245 uint loopback
= LOOPBACK
;
6246 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
6247 char *session
= NULL
;
6248 uint hex_charset
= HEX_CHARSET
;
6249 uint hex_salt
= HEX_SALT
;
6250 uint hex_wordlist
= HEX_WORDLIST
;
6251 uint rp_gen
= RP_GEN
;
6252 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
6253 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
6254 uint rp_gen_seed
= RP_GEN_SEED
;
6255 char *rule_buf_l
= (char *) RULE_BUF_L
;
6256 char *rule_buf_r
= (char *) RULE_BUF_R
;
6257 uint increment
= INCREMENT
;
6258 uint increment_min
= INCREMENT_MIN
;
6259 uint increment_max
= INCREMENT_MAX
;
6260 uint mangle
= MANGLE
;
6261 char *cpu_affinity
= NULL
;
6262 OCL_PTR
*ocl
= NULL
;
6263 char *opencl_devices
= NULL
;
6264 char *opencl_platforms
= NULL
;
6265 char *opencl_device_types
= NULL
;
6266 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
6267 char *truecrypt_keyfiles
= NULL
;
6268 char *veracrypt_keyfiles
= NULL
;
6269 uint veracrypt_pim
= 0;
6270 uint workload_profile
= WORKLOAD_PROFILE
;
6271 uint kernel_accel
= KERNEL_ACCEL
;
6272 uint kernel_loops
= KERNEL_LOOPS
;
6273 uint nvidia_spin_damp
= NVIDIA_SPIN_DAMP
;
6274 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
6276 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
6277 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
6278 uint powertune_enable
= POWERTUNE_ENABLE
;
6280 uint logfile_disable
= LOGFILE_DISABLE
;
6281 uint segment_size
= SEGMENT_SIZE
;
6282 uint scrypt_tmto
= SCRYPT_TMTO
;
6283 char separator
= SEPARATOR
;
6284 uint bitmap_min
= BITMAP_MIN
;
6285 uint bitmap_max
= BITMAP_MAX
;
6286 char *custom_charset_1
= NULL
;
6287 char *custom_charset_2
= NULL
;
6288 char *custom_charset_3
= NULL
;
6289 char *custom_charset_4
= NULL
;
6291 #define IDX_HELP 'h'
6292 #define IDX_VERSION 'V'
6293 #define IDX_VERSION_LOWER 'v'
6294 #define IDX_QUIET 0xff02
6295 #define IDX_SHOW 0xff03
6296 #define IDX_LEFT 0xff04
6297 #define IDX_REMOVE 0xff05
6298 #define IDX_REMOVE_TIMER 0xff37
6299 #define IDX_SKIP 's'
6300 #define IDX_LIMIT 'l'
6301 #define IDX_KEYSPACE 0xff35
6302 #define IDX_POTFILE_DISABLE 0xff06
6303 #define IDX_POTFILE_PATH 0xffe0
6304 #define IDX_DEBUG_MODE 0xff43
6305 #define IDX_DEBUG_FILE 0xff44
6306 #define IDX_INDUCTION_DIR 0xff46
6307 #define IDX_OUTFILE_CHECK_DIR 0xff47
6308 #define IDX_USERNAME 0xff07
6309 #define IDX_FORCE 0xff08
6310 #define IDX_RUNTIME 0xff09
6311 #define IDX_BENCHMARK 'b'
6312 #define IDX_STDOUT_FLAG 0xff77
6313 #define IDX_HASH_MODE 'm'
6314 #define IDX_ATTACK_MODE 'a'
6315 #define IDX_RP_FILE 'r'
6316 #define IDX_RP_GEN 'g'
6317 #define IDX_RP_GEN_FUNC_MIN 0xff10
6318 #define IDX_RP_GEN_FUNC_MAX 0xff11
6319 #define IDX_RP_GEN_SEED 0xff34
6320 #define IDX_RULE_BUF_L 'j'
6321 #define IDX_RULE_BUF_R 'k'
6322 #define IDX_INCREMENT 'i'
6323 #define IDX_INCREMENT_MIN 0xff12
6324 #define IDX_INCREMENT_MAX 0xff13
6325 #define IDX_MANGLE 0xff80
6326 #define IDX_OUTFILE 'o'
6327 #define IDX_OUTFILE_FORMAT 0xff14
6328 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
6329 #define IDX_OUTFILE_CHECK_TIMER 0xff45
6330 #define IDX_RESTORE 0xff15
6331 #define IDX_RESTORE_DISABLE 0xff27
6332 #define IDX_STATUS 0xff17
6333 #define IDX_STATUS_TIMER 0xff18
6334 #define IDX_MACHINE_READABLE 0xff50
6335 #define IDX_LOOPBACK 0xff38
6336 #define IDX_WEAK_HASH_THRESHOLD 0xff42
6337 #define IDX_SESSION 0xff19
6338 #define IDX_HEX_CHARSET 0xff20
6339 #define IDX_HEX_SALT 0xff21
6340 #define IDX_HEX_WORDLIST 0xff40
6341 #define IDX_MARKOV_DISABLE 0xff22
6342 #define IDX_MARKOV_CLASSIC 0xff23
6343 #define IDX_MARKOV_THRESHOLD 't'
6344 #define IDX_MARKOV_HCSTAT 0xff24
6345 #define IDX_CPU_AFFINITY 0xff25
6346 #define IDX_OPENCL_DEVICES 'd'
6347 #define IDX_OPENCL_PLATFORMS 0xff72
6348 #define IDX_OPENCL_DEVICE_TYPES 'D'
6349 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
6350 #define IDX_WORKLOAD_PROFILE 'w'
6351 #define IDX_KERNEL_ACCEL 'n'
6352 #define IDX_KERNEL_LOOPS 'u'
6353 #define IDX_NVIDIA_SPIN_DAMP 0xff79
6354 #define IDX_GPU_TEMP_DISABLE 0xff29
6355 #define IDX_GPU_TEMP_ABORT 0xff30
6356 #define IDX_GPU_TEMP_RETAIN 0xff31
6357 #define IDX_POWERTUNE_ENABLE 0xff41
6358 #define IDX_LOGFILE_DISABLE 0xff51
6359 #define IDX_TRUECRYPT_KEYFILES 0xff52
6360 #define IDX_VERACRYPT_KEYFILES 0xff53
6361 #define IDX_VERACRYPT_PIM 0xff54
6362 #define IDX_SCRYPT_TMTO 0xff61
6363 #define IDX_SEGMENT_SIZE 'c'
6364 #define IDX_SEPARATOR 'p'
6365 #define IDX_BITMAP_MIN 0xff70
6366 #define IDX_BITMAP_MAX 0xff71
6367 #define IDX_CUSTOM_CHARSET_1 '1'
6368 #define IDX_CUSTOM_CHARSET_2 '2'
6369 #define IDX_CUSTOM_CHARSET_3 '3'
6370 #define IDX_CUSTOM_CHARSET_4 '4'
6372 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:D:n:u:c:p:s:l:1:2:3:4:ibw:";
6374 struct option long_options
[] =
6376 {"help", no_argument
, 0, IDX_HELP
},
6377 {"version", no_argument
, 0, IDX_VERSION
},
6378 {"quiet", no_argument
, 0, IDX_QUIET
},
6379 {"show", no_argument
, 0, IDX_SHOW
},
6380 {"left", no_argument
, 0, IDX_LEFT
},
6381 {"username", no_argument
, 0, IDX_USERNAME
},
6382 {"remove", no_argument
, 0, IDX_REMOVE
},
6383 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
6384 {"skip", required_argument
, 0, IDX_SKIP
},
6385 {"limit", required_argument
, 0, IDX_LIMIT
},
6386 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
6387 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
6388 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
6389 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
6390 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
6391 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
6392 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
6393 {"force", no_argument
, 0, IDX_FORCE
},
6394 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
6395 {"stdout", no_argument
, 0, IDX_STDOUT_FLAG
},
6396 {"restore", no_argument
, 0, IDX_RESTORE
},
6397 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
6398 {"status", no_argument
, 0, IDX_STATUS
},
6399 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
6400 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
6401 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
6402 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
6403 {"session", required_argument
, 0, IDX_SESSION
},
6404 {"runtime", required_argument
, 0, IDX_RUNTIME
},
6405 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
6406 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
6407 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
6408 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
6409 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
6410 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
6411 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
6412 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
6413 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
6414 {"outfile", required_argument
, 0, IDX_OUTFILE
},
6415 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
6416 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
6417 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
6418 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
6419 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
6420 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
6421 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
6422 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
6423 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
6424 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
6425 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
6426 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
6427 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
6428 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
6429 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
6430 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
6431 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
6432 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
6433 {"nvidia-spin-damp", required_argument
, 0, IDX_NVIDIA_SPIN_DAMP
},
6434 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
6436 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
6437 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
6438 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
6439 #endif // HAVE_HWMON
6440 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
6441 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
6442 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
6443 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
6444 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
6445 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
6446 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
6447 {"separator", required_argument
, 0, IDX_SEPARATOR
},
6448 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
6449 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
6450 {"increment", no_argument
, 0, IDX_INCREMENT
},
6451 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
6452 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
6453 {"mangle", no_argument
, 0, IDX_MANGLE
},
6454 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
6455 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
6456 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
6457 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
6461 uint rp_files_cnt
= 0;
6463 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
6465 int option_index
= 0;
6471 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6475 case IDX_HELP
: usage
= 1; break;
6477 case IDX_VERSION_LOWER
: version
= 1; break;
6478 case IDX_RESTORE
: restore
= 1; break;
6479 case IDX_SESSION
: session
= optarg
; break;
6480 case IDX_SHOW
: show
= 1; break;
6481 case IDX_LEFT
: left
= 1; break;
6482 case '?': return -1;
6488 log_error ("ERROR: Invalid argument specified");
6499 log_info ("%s", VERSION_TAG
);
6506 usage_big_print (PROGNAME
);
6512 * session needs to be set, always!
6515 if (session
== NULL
) session
= (char *) PROGNAME
;
6518 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
6521 char *exec_path
= get_exec_path ();
6524 #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
6526 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
6527 char *resolved_exec_path
= realpath (exec_path
, NULL
);
6529 if (resolved_install_folder
== NULL
)
6531 log_error ("ERROR: %s: %s", resolved_install_folder
, strerror (errno
));
6536 if (resolved_exec_path
== NULL
)
6538 log_error ("ERROR: %s: %s", resolved_exec_path
, strerror (errno
));
6543 char *install_dir
= get_install_dir (resolved_exec_path
);
6544 char *profile_dir
= NULL
;
6545 char *session_dir
= NULL
;
6546 char *shared_dir
= NULL
;
6548 if (strcmp (install_dir
, resolved_install_folder
) == 0)
6550 struct passwd
*pw
= getpwuid (getuid ());
6552 const char *homedir
= pw
->pw_dir
;
6554 profile_dir
= get_profile_dir (homedir
);
6555 session_dir
= get_session_dir (profile_dir
);
6556 shared_dir
= strdup (SHARED_FOLDER
);
6558 mkdir (profile_dir
, 0700);
6559 mkdir (session_dir
, 0700);
6563 profile_dir
= install_dir
;
6564 session_dir
= install_dir
;
6565 shared_dir
= install_dir
;
6568 myfree (resolved_install_folder
);
6569 myfree (resolved_exec_path
);
6573 char *install_dir
= get_install_dir (exec_path
);
6574 char *profile_dir
= install_dir
;
6575 char *session_dir
= install_dir
;
6576 char *shared_dir
= install_dir
;
6580 data
.install_dir
= install_dir
;
6581 data
.profile_dir
= profile_dir
;
6582 data
.session_dir
= session_dir
;
6583 data
.shared_dir
= shared_dir
;
6588 * There's alot of problem related to bad support -I parameters when building the kernel.
6589 * Each OpenCL runtime handles it slightly different.
6590 * The most problematic is with new AMD drivers on Windows, which can not handle quote characters!
6591 * The best workaround found so far is to modify the TMP variable (only inside hashcat process) before the runtime is load
6594 char cpath
[1024] = { 0 };
6598 snprintf (cpath
, sizeof (cpath
) - 1, "%s\\OpenCL\\", shared_dir
);
6600 char *cpath_real
= mymalloc (MAX_PATH
);
6602 if (GetFullPathName (cpath
, MAX_PATH
, cpath_real
, NULL
) == 0)
6604 log_error ("ERROR: %s: %s", cpath
, "GetFullPathName()");
6611 snprintf (cpath
, sizeof (cpath
) - 1, "%s/OpenCL/", shared_dir
);
6613 char *cpath_real
= mymalloc (PATH_MAX
);
6615 if (realpath (cpath
, cpath_real
) == NULL
)
6617 log_error ("ERROR: %s: %s", cpath
, strerror (errno
));
6624 //if (getenv ("TMP") == NULL)
6629 snprintf (tmp
, sizeof (tmp
) - 1, "TMP=%s", cpath_real
);
6636 naive_replace (cpath_real
, '\\', '/');
6638 // not escaping here, windows using quotes later
6639 // naive_escape (cpath_real, PATH_MAX, ' ', '\\');
6643 naive_escape (cpath_real
, PATH_MAX
, ' ', '\\');
6648 * kernel cache, we need to make sure folder exist
6651 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
6653 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
6655 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
6657 mkdir (kernels_folder
, 0700);
6659 myfree (kernels_folder
);
6665 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6667 data
.session
= session
;
6669 char *eff_restore_file
= (char *) mymalloc (session_size
);
6670 char *new_restore_file
= (char *) mymalloc (session_size
);
6672 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
6673 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
6675 data
.eff_restore_file
= eff_restore_file
;
6676 data
.new_restore_file
= new_restore_file
;
6678 if (((show
== 1) || (left
== 1)) && (restore
== 1))
6680 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
6681 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
6686 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
6687 if ((show
== 1) || (left
== 1))
6689 restore_disable
= 1;
6694 data
.restore_disable
= restore_disable
;
6696 restore_data_t
*rd
= init_restore (argc
, argv
);
6706 read_restore (eff_restore_file
, rd
);
6708 if (rd
->version_bin
< RESTORE_MIN
)
6710 log_error ("ERROR: Incompatible restore-file version");
6719 rd
->pid
= getpid ();
6721 rd
->pid
= GetCurrentProcessId ();
6725 uint hash_mode_chgd
= 0;
6726 uint runtime_chgd
= 0;
6727 uint kernel_loops_chgd
= 0;
6728 uint kernel_accel_chgd
= 0;
6729 uint nvidia_spin_damp_chgd
= 0;
6730 uint attack_mode_chgd
= 0;
6731 uint outfile_format_chgd
= 0;
6732 uint rp_gen_seed_chgd
= 0;
6733 uint remove_timer_chgd
= 0;
6734 uint increment_min_chgd
= 0;
6735 uint increment_max_chgd
= 0;
6736 uint workload_profile_chgd
= 0;
6737 uint opencl_vector_width_chgd
= 0;
6743 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
6747 //case IDX_HELP: usage = 1; break;
6748 //case IDX_VERSION: version = 1; break;
6749 //case IDX_RESTORE: restore = 1; break;
6750 case IDX_QUIET
: quiet
= 1; break;
6751 //case IDX_SHOW: show = 1; break;
6752 case IDX_SHOW
: break;
6753 //case IDX_LEFT: left = 1; break;
6754 case IDX_LEFT
: break;
6755 case IDX_USERNAME
: username
= 1; break;
6756 case IDX_REMOVE
: remove
= 1; break;
6757 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
6758 remove_timer_chgd
= 1; break;
6759 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
6760 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
6761 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
6762 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
6763 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
6764 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
6765 case IDX_FORCE
: force
= 1; break;
6766 case IDX_SKIP
: skip
= atoll (optarg
); break;
6767 case IDX_LIMIT
: limit
= atoll (optarg
); break;
6768 case IDX_KEYSPACE
: keyspace
= 1; break;
6769 case IDX_BENCHMARK
: benchmark
= 1; break;
6770 case IDX_STDOUT_FLAG
: stdout_flag
= 1; break;
6771 case IDX_RESTORE
: break;
6772 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
6773 case IDX_STATUS
: status
= 1; break;
6774 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
6775 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
6776 case IDX_LOOPBACK
: loopback
= 1; break;
6777 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
6778 //case IDX_SESSION: session = optarg; break;
6779 case IDX_SESSION
: break;
6780 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
6781 hash_mode_chgd
= 1; break;
6782 case IDX_RUNTIME
: runtime
= atoi (optarg
);
6783 runtime_chgd
= 1; break;
6784 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
6785 attack_mode_chgd
= 1; break;
6786 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
6787 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
6788 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
6789 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
6790 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
6791 rp_gen_seed_chgd
= 1; break;
6792 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
6793 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
6794 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
6795 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
6796 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
6797 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
6798 case IDX_OUTFILE
: outfile
= optarg
; break;
6799 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
6800 outfile_format_chgd
= 1; break;
6801 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
6802 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
6803 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
6804 case IDX_HEX_SALT
: hex_salt
= 1; break;
6805 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
6806 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
6807 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
6808 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
6809 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
6810 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
6811 opencl_vector_width_chgd
= 1; break;
6812 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
6813 workload_profile_chgd
= 1; break;
6814 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
6815 kernel_accel_chgd
= 1; break;
6816 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
6817 kernel_loops_chgd
= 1; break;
6818 case IDX_NVIDIA_SPIN_DAMP
: nvidia_spin_damp
= atoi (optarg
);
6819 nvidia_spin_damp_chgd
= 1; break;
6820 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
6822 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
); break;
6823 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
); break;
6824 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
6825 #endif // HAVE_HWMON
6826 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
6827 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
6828 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
6829 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
6830 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
6831 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
6832 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
6833 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
6834 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
6835 case IDX_INCREMENT
: increment
= 1; break;
6836 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
6837 increment_min_chgd
= 1; break;
6838 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
6839 increment_max_chgd
= 1; break;
6840 case IDX_MANGLE
: mangle
= 1; break;
6841 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
6842 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
6843 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
6844 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
6847 log_error ("ERROR: Invalid argument specified");
6854 log_error ("ERROR: Invalid argument specified");
6860 * Inform user things getting started,
6861 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
6862 * - we do not need to check algorithm_pos
6869 if (machine_readable
== 0)
6871 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6876 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6879 else if (restore
== 1)
6881 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6884 else if (stdout_flag
== 1)
6888 else if (keyspace
== 1)
6894 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6903 if (attack_mode
> 7)
6905 log_error ("ERROR: Invalid attack-mode specified");
6910 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6912 log_error ("ERROR: Invalid runtime specified");
6917 if (hash_mode_chgd
&& hash_mode
> 13800) // just added to remove compiler warnings for hash_mode_chgd
6919 log_error ("ERROR: Invalid hash-type specified");
6924 // renamed hash modes
6938 log_error ("Old -m specified, use -m %d instead", n
);
6946 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6948 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6954 if (outfile_format
> 16)
6956 log_error ("ERROR: Invalid outfile-format specified");
6963 if (outfile_format_chgd
== 1)
6965 if (outfile_format
> 1)
6967 log_error ("ERROR: Mixing outfile-format > 1 with left parameter is not allowed");
6974 outfile_format
= OUTFILE_FMT_HASH
;
6980 if (outfile_format_chgd
== 1)
6982 if ((outfile_format
> 7) && (outfile_format
< 16))
6984 log_error ("ERROR: Mixing outfile-format > 7 with show parameter is not allowed");
6991 if (increment_min
< INCREMENT_MIN
)
6993 log_error ("ERROR: Invalid increment-min specified");
6998 if (increment_max
> INCREMENT_MAX
)
7000 log_error ("ERROR: Invalid increment-max specified");
7005 if (increment_min
> increment_max
)
7007 log_error ("ERROR: Invalid increment-min specified");
7012 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
7014 log_error ("ERROR: Increment is not allowed in attack-mode 0");
7019 if ((increment
== 0) && (increment_min_chgd
== 1))
7021 log_error ("ERROR: Increment-min is only supported combined with increment switch");
7026 if ((increment
== 0) && (increment_max_chgd
== 1))
7028 log_error ("ERROR: Increment-max is only supported combined with increment switch");
7033 if (rp_files_cnt
&& rp_gen
)
7035 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
7040 if (rp_files_cnt
|| rp_gen
)
7042 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7044 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
7050 if (rp_gen_func_min
> rp_gen_func_max
)
7052 log_error ("ERROR: Invalid rp-gen-func-min specified");
7057 if (kernel_accel_chgd
== 1)
7061 log_info ("The manual use of the -n option (or --kernel-accel) is outdated");
7062 log_info ("Please consider using the -w option instead");
7063 log_info ("You can use --force to override this but do not post error reports if you do so");
7069 if (kernel_accel
< 1)
7071 log_error ("ERROR: Invalid kernel-accel specified");
7076 if (kernel_accel
> 1024)
7078 log_error ("ERROR: Invalid kernel-accel specified");
7084 if (kernel_loops_chgd
== 1)
7088 log_info ("The manual use of the -u option (or --kernel-loops) is outdated");
7089 log_info ("Please consider using the -w option instead");
7090 log_info ("You can use --force to override this but do not post error reports if you do so");
7096 if (kernel_loops
< 1)
7098 log_error ("ERROR: Invalid kernel-loops specified");
7103 if (kernel_loops
> 1024)
7105 log_error ("ERROR: Invalid kernel-loops specified");
7111 if ((workload_profile
< 1) || (workload_profile
> 4))
7113 log_error ("ERROR: workload-profile %i not available", workload_profile
);
7118 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
7120 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
7125 if (show
== 1 || left
== 1)
7127 attack_mode
= ATTACK_MODE_NONE
;
7131 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
7136 if (potfile_disable
== 1)
7138 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
7144 uint attack_kern
= ATTACK_KERN_NONE
;
7146 switch (attack_mode
)
7148 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
7149 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
7150 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
7151 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
7152 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
7157 if (myargv
[optind
] != 0)
7159 log_error ("ERROR: Invalid argument for benchmark mode specified");
7164 if (attack_mode_chgd
== 1)
7166 if (attack_mode
!= ATTACK_MODE_BF
)
7168 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
7176 if (stdout_flag
== 1) // no hash here
7183 int num_additional_params
= 1;
7185 if (attack_kern
== ATTACK_KERN_COMBI
)
7187 num_additional_params
= 2;
7190 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
7192 if (keyspace_wordlist_specified
== 0) optind
--;
7195 if (attack_kern
== ATTACK_KERN_NONE
)
7197 if ((optind
+ 1) != myargc
)
7199 usage_mini_print (myargv
[0]);
7204 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
7206 if ((optind
+ 1) > myargc
)
7208 usage_mini_print (myargv
[0]);
7213 else if (attack_kern
== ATTACK_KERN_COMBI
)
7215 if ((optind
+ 3) != myargc
)
7217 usage_mini_print (myargv
[0]);
7222 else if (attack_kern
== ATTACK_KERN_BF
)
7224 if ((optind
+ 1) > myargc
)
7226 usage_mini_print (myargv
[0]);
7233 usage_mini_print (myargv
[0]);
7239 if (skip
!= 0 && limit
!= 0)
7248 log_error ("ERROR: Combining show parameter with keyspace parameter is not allowed");
7254 log_error ("ERROR: Combining left parameter with keyspace parameter is not allowed");
7259 potfile_disable
= 1;
7261 restore_disable
= 1;
7265 weak_hash_threshold
= 0;
7270 if (stdout_flag
== 1)
7274 restore_disable
= 1;
7276 potfile_disable
= 1;
7277 weak_hash_threshold
= 0;
7278 gpu_temp_disable
= 1;
7281 outfile_format
= OUTFILE_FMT_PLAIN
;
7282 kernel_accel
= 1024;
7283 kernel_loops
= 1024;
7285 outfile_check_timer
= 0;
7287 opencl_vector_width
= 1;
7290 if (remove_timer_chgd
== 1)
7294 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
7299 if (remove_timer
< 1)
7301 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
7309 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
7311 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7313 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
7320 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
7328 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7330 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
7335 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
7337 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
7345 log_error ("ERROR: Invalid debug-mode specified");
7350 if (debug_file
!= NULL
)
7354 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
7360 if (induction_dir
!= NULL
)
7362 if (attack_mode
== ATTACK_MODE_BF
)
7364 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
7370 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
7372 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
7374 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
7379 weak_hash_threshold
= 0;
7382 if (nvidia_spin_damp
> 100)
7384 log_error ("ERROR: setting --nvidia-spin-damp must be between 0 and 100 (inclusive)");
7391 * induction directory
7394 char *induction_directory
= NULL
;
7396 if (attack_mode
!= ATTACK_MODE_BF
)
7398 if (induction_dir
== NULL
)
7400 induction_directory
= (char *) mymalloc (session_size
);
7402 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
7404 // create induction folder if it does not already exist
7408 if (rmdir (induction_directory
) == -1)
7410 if (errno
== ENOENT
)
7412 // good, we can ignore
7414 else if (errno
== ENOTEMPTY
)
7416 char *induction_directory_mv
= (char *) mymalloc (session_size
);
7418 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
7420 if (rename (induction_directory
, induction_directory_mv
) != 0)
7422 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
7429 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7435 if (mkdir (induction_directory
, 0700) == -1)
7437 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
7445 induction_directory
= induction_dir
;
7449 data
.induction_directory
= induction_directory
;
7455 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
7457 char *loopback_file
= (char *) mymalloc (loopback_size
);
7463 char tuning_db_file
[256] = { 0 };
7465 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
7467 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
7470 * outfile-check directory
7473 char *outfile_check_directory
= NULL
;
7475 if (outfile_check_dir
== NULL
)
7477 outfile_check_directory
= (char *) mymalloc (session_size
);
7479 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
7483 outfile_check_directory
= outfile_check_dir
;
7486 data
.outfile_check_directory
= outfile_check_directory
;
7490 struct stat outfile_check_stat
;
7492 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
7494 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
7498 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
7503 else if (outfile_check_dir
== NULL
)
7505 if (mkdir (outfile_check_directory
, 0700) == -1)
7507 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
7515 * special other stuff
7518 if (hash_mode
== 9710)
7521 outfile_format_chgd
= 1;
7524 if (hash_mode
== 9810)
7527 outfile_format_chgd
= 1;
7530 if (hash_mode
== 10410)
7533 outfile_format_chgd
= 1;
7540 data
.hash_mode
= hash_mode
;
7541 data
.restore
= restore
;
7542 data
.restore_timer
= restore_timer
;
7543 data
.restore_disable
= restore_disable
;
7544 data
.status
= status
;
7545 data
.status_timer
= status_timer
;
7546 data
.machine_readable
= machine_readable
;
7547 data
.loopback
= loopback
;
7548 data
.runtime
= runtime
;
7549 data
.remove
= remove
;
7550 data
.remove_timer
= remove_timer
;
7551 data
.debug_mode
= debug_mode
;
7552 data
.debug_file
= debug_file
;
7553 data
.username
= username
;
7555 data
.outfile
= outfile
;
7556 data
.outfile_format
= outfile_format
;
7557 data
.outfile_autohex
= outfile_autohex
;
7558 data
.hex_charset
= hex_charset
;
7559 data
.hex_salt
= hex_salt
;
7560 data
.hex_wordlist
= hex_wordlist
;
7561 data
.separator
= separator
;
7562 data
.rp_files
= rp_files
;
7563 data
.rp_files_cnt
= rp_files_cnt
;
7564 data
.rp_gen
= rp_gen
;
7565 data
.rp_gen_seed
= rp_gen_seed
;
7567 data
.benchmark
= benchmark
;
7571 data
.powertune_enable
= powertune_enable
;
7573 data
.logfile_disable
= logfile_disable
;
7574 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
7575 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
7576 data
.veracrypt_pim
= veracrypt_pim
;
7577 data
.scrypt_tmto
= scrypt_tmto
;
7578 data
.workload_profile
= workload_profile
;
7586 set_cpu_affinity (cpu_affinity
);
7589 if (rp_gen_seed_chgd
== 0)
7595 srand (rp_gen_seed
);
7602 if (logfile_disable
== 0)
7604 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
7606 char *logfile
= (char *) mymalloc (logfile_size
);
7608 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
7610 data
.logfile
= logfile
;
7612 char *topid
= logfile_generate_topid ();
7617 // logfile_append() checks for logfile_disable internally to make it easier from here
7619 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
7620 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
7621 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
7622 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
7623 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
7624 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
7625 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
7626 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
7627 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
7628 #define logfile_sub_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s\t%s", data.topid, data.subid, (var), (val));
7630 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
7631 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
7632 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
7633 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
7634 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
7635 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
7636 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
7637 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
7639 logfile_top_msg ("START");
7641 logfile_top_uint (attack_mode
);
7642 logfile_top_uint (attack_kern
);
7643 logfile_top_uint (benchmark
);
7644 logfile_top_uint (stdout_flag
);
7645 logfile_top_uint (bitmap_min
);
7646 logfile_top_uint (bitmap_max
);
7647 logfile_top_uint (debug_mode
);
7648 logfile_top_uint (force
);
7649 logfile_top_uint (kernel_accel
);
7650 logfile_top_uint (kernel_loops
);
7651 logfile_top_uint (nvidia_spin_damp
);
7652 logfile_top_uint (gpu_temp_disable
);
7654 logfile_top_uint (gpu_temp_abort
);
7655 logfile_top_uint (gpu_temp_retain
);
7657 logfile_top_uint (hash_mode
);
7658 logfile_top_uint (hex_charset
);
7659 logfile_top_uint (hex_salt
);
7660 logfile_top_uint (hex_wordlist
);
7661 logfile_top_uint (increment
);
7662 logfile_top_uint (increment_max
);
7663 logfile_top_uint (increment_min
);
7664 logfile_top_uint (mangle
);
7665 logfile_top_uint (keyspace
);
7666 logfile_top_uint (left
);
7667 logfile_top_uint (logfile_disable
);
7668 logfile_top_uint (loopback
);
7669 logfile_top_uint (markov_classic
);
7670 logfile_top_uint (markov_disable
);
7671 logfile_top_uint (markov_threshold
);
7672 logfile_top_uint (outfile_autohex
);
7673 logfile_top_uint (outfile_check_timer
);
7674 logfile_top_uint (outfile_format
);
7675 logfile_top_uint (potfile_disable
);
7676 logfile_top_string (potfile_path
);
7677 #if defined(HAVE_HWMON)
7678 logfile_top_uint (powertune_enable
);
7680 logfile_top_uint (scrypt_tmto
);
7681 logfile_top_uint (quiet
);
7682 logfile_top_uint (remove
);
7683 logfile_top_uint (remove_timer
);
7684 logfile_top_uint (restore
);
7685 logfile_top_uint (restore_disable
);
7686 logfile_top_uint (restore_timer
);
7687 logfile_top_uint (rp_gen
);
7688 logfile_top_uint (rp_gen_func_max
);
7689 logfile_top_uint (rp_gen_func_min
);
7690 logfile_top_uint (rp_gen_seed
);
7691 logfile_top_uint (runtime
);
7692 logfile_top_uint (segment_size
);
7693 logfile_top_uint (show
);
7694 logfile_top_uint (status
);
7695 logfile_top_uint (machine_readable
);
7696 logfile_top_uint (status_timer
);
7697 logfile_top_uint (usage
);
7698 logfile_top_uint (username
);
7699 logfile_top_uint (version
);
7700 logfile_top_uint (weak_hash_threshold
);
7701 logfile_top_uint (workload_profile
);
7702 logfile_top_uint64 (limit
);
7703 logfile_top_uint64 (skip
);
7704 logfile_top_char (separator
);
7705 logfile_top_string (cpu_affinity
);
7706 logfile_top_string (custom_charset_1
);
7707 logfile_top_string (custom_charset_2
);
7708 logfile_top_string (custom_charset_3
);
7709 logfile_top_string (custom_charset_4
);
7710 logfile_top_string (debug_file
);
7711 logfile_top_string (opencl_devices
);
7712 logfile_top_string (opencl_platforms
);
7713 logfile_top_string (opencl_device_types
);
7714 logfile_top_uint (opencl_vector_width
);
7715 logfile_top_string (induction_dir
);
7716 logfile_top_string (markov_hcstat
);
7717 logfile_top_string (outfile
);
7718 logfile_top_string (outfile_check_dir
);
7719 logfile_top_string (rule_buf_l
);
7720 logfile_top_string (rule_buf_r
);
7721 logfile_top_string (session
);
7722 logfile_top_string (truecrypt_keyfiles
);
7723 logfile_top_string (veracrypt_keyfiles
);
7724 logfile_top_uint (veracrypt_pim
);
7727 * Init OpenCL library loader
7732 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
7740 * OpenCL platform selection
7743 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
7746 * OpenCL device selection
7749 u32 devices_filter
= setup_devices_filter (opencl_devices
);
7752 * OpenCL device type selection
7755 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
7764 * disable useless stuff for benchmark
7769 restore_disable
= 1;
7770 potfile_disable
= 1;
7771 weak_hash_threshold
= 0;
7772 nvidia_spin_damp
= 0;
7773 gpu_temp_disable
= 1;
7774 outfile_check_timer
= 0;
7777 if (powertune_enable
== 1)
7779 gpu_temp_disable
= 0;
7783 data
.status_timer
= status_timer
;
7784 data
.restore_timer
= restore_timer
;
7785 data
.restore_disable
= restore_disable
;
7786 data
.outfile_check_timer
= outfile_check_timer
;
7789 * force attack mode to be bruteforce
7792 attack_mode
= ATTACK_MODE_BF
;
7793 attack_kern
= ATTACK_KERN_BF
;
7795 if (workload_profile_chgd
== 0)
7797 workload_profile
= 3;
7799 data
.workload_profile
= workload_profile
;
7804 * status, monitor and outfile remove threads
7807 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
7809 data
.wordlist_mode
= wordlist_mode
;
7811 if (wordlist_mode
== WL_MODE_STDIN
)
7815 data
.status
= status
;
7818 uint outer_threads_cnt
= 0;
7820 hc_thread_t
*outer_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
7822 data
.shutdown_outer
= 0;
7824 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
7826 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
7828 hc_thread_create (outer_threads
[outer_threads_cnt
], thread_keypress
, NULL
);
7830 outer_threads_cnt
++;
7840 uint attack_exec
= 0;
7844 uint esalt_size
= 0;
7846 uint dgst_pos0
= -1;
7847 uint dgst_pos1
= -1;
7848 uint dgst_pos2
= -1;
7849 uint dgst_pos3
= -1;
7851 int (*parse_func
) (char *, uint
, hash_t
*);
7852 int (*sort_by_digest
) (const void *, const void *);
7854 uint algorithm_pos
= 0;
7855 uint algorithm_max
= 1;
7857 uint
*algorithms
= default_benchmark_algorithms
;
7859 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
7861 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
7864 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
7865 * the following algos are skipped entirely
7868 if (algorithm_pos
> 0)
7872 rd
= init_restore (argc
, argv
);
7878 * update hash_mode in case of multihash benchmark
7883 if (hash_mode_chgd
== 0)
7885 hash_mode
= algorithms
[algorithm_pos
];
7887 data
.hash_mode
= hash_mode
;
7897 case 0: hash_type
= HASH_TYPE_MD5
;
7898 salt_type
= SALT_TYPE_NONE
;
7899 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7901 | OPTS_TYPE_PT_ADD80
7902 | OPTS_TYPE_PT_ADDBITS14
;
7903 kern_type
= KERN_TYPE_MD5
;
7904 dgst_size
= DGST_SIZE_4_4
;
7905 parse_func
= md5_parse_hash
;
7906 sort_by_digest
= sort_by_digest_4_4
;
7907 opti_type
= OPTI_TYPE_ZERO_BYTE
7908 | OPTI_TYPE_PRECOMPUTE_INIT
7909 | OPTI_TYPE_PRECOMPUTE_MERKLE
7910 | OPTI_TYPE_MEET_IN_MIDDLE
7911 | OPTI_TYPE_EARLY_SKIP
7912 | OPTI_TYPE_NOT_ITERATED
7913 | OPTI_TYPE_NOT_SALTED
7914 | OPTI_TYPE_RAW_HASH
;
7921 case 10: hash_type
= HASH_TYPE_MD5
;
7922 salt_type
= SALT_TYPE_INTERN
;
7923 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7924 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7925 | OPTS_TYPE_ST_ADD80
7926 | OPTS_TYPE_ST_ADDBITS14
;
7927 kern_type
= KERN_TYPE_MD5_PWSLT
;
7928 dgst_size
= DGST_SIZE_4_4
;
7929 parse_func
= md5s_parse_hash
;
7930 sort_by_digest
= sort_by_digest_4_4
;
7931 opti_type
= OPTI_TYPE_ZERO_BYTE
7932 | OPTI_TYPE_PRECOMPUTE_INIT
7933 | OPTI_TYPE_PRECOMPUTE_MERKLE
7934 | OPTI_TYPE_MEET_IN_MIDDLE
7935 | OPTI_TYPE_EARLY_SKIP
7936 | OPTI_TYPE_NOT_ITERATED
7937 | OPTI_TYPE_APPENDED_SALT
7938 | OPTI_TYPE_RAW_HASH
;
7945 case 11: hash_type
= HASH_TYPE_MD5
;
7946 salt_type
= SALT_TYPE_INTERN
;
7947 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7948 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7949 | OPTS_TYPE_ST_ADD80
7950 | OPTS_TYPE_ST_ADDBITS14
;
7951 kern_type
= KERN_TYPE_MD5_PWSLT
;
7952 dgst_size
= DGST_SIZE_4_4
;
7953 parse_func
= joomla_parse_hash
;
7954 sort_by_digest
= sort_by_digest_4_4
;
7955 opti_type
= OPTI_TYPE_ZERO_BYTE
7956 | OPTI_TYPE_PRECOMPUTE_INIT
7957 | OPTI_TYPE_PRECOMPUTE_MERKLE
7958 | OPTI_TYPE_MEET_IN_MIDDLE
7959 | OPTI_TYPE_EARLY_SKIP
7960 | OPTI_TYPE_NOT_ITERATED
7961 | OPTI_TYPE_APPENDED_SALT
7962 | OPTI_TYPE_RAW_HASH
;
7969 case 12: hash_type
= HASH_TYPE_MD5
;
7970 salt_type
= SALT_TYPE_INTERN
;
7971 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7972 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7973 | OPTS_TYPE_ST_ADD80
7974 | OPTS_TYPE_ST_ADDBITS14
;
7975 kern_type
= KERN_TYPE_MD5_PWSLT
;
7976 dgst_size
= DGST_SIZE_4_4
;
7977 parse_func
= postgresql_parse_hash
;
7978 sort_by_digest
= sort_by_digest_4_4
;
7979 opti_type
= OPTI_TYPE_ZERO_BYTE
7980 | OPTI_TYPE_PRECOMPUTE_INIT
7981 | OPTI_TYPE_PRECOMPUTE_MERKLE
7982 | OPTI_TYPE_MEET_IN_MIDDLE
7983 | OPTI_TYPE_EARLY_SKIP
7984 | OPTI_TYPE_NOT_ITERATED
7985 | OPTI_TYPE_APPENDED_SALT
7986 | OPTI_TYPE_RAW_HASH
;
7993 case 20: 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
= md5s_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 21: hash_type
= HASH_TYPE_MD5
;
8017 salt_type
= SALT_TYPE_INTERN
;
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
= osc_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 22: 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
= netscreen_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 23: hash_type
= HASH_TYPE_MD5
;
8063 salt_type
= SALT_TYPE_EMBEDDED
;
8064 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8065 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8066 | OPTS_TYPE_PT_ADD80
8067 | OPTS_TYPE_PT_ADDBITS14
;
8068 kern_type
= KERN_TYPE_MD5_SLTPW
;
8069 dgst_size
= DGST_SIZE_4_4
;
8070 parse_func
= skype_parse_hash
;
8071 sort_by_digest
= sort_by_digest_4_4
;
8072 opti_type
= OPTI_TYPE_ZERO_BYTE
8073 | OPTI_TYPE_PRECOMPUTE_INIT
8074 | OPTI_TYPE_PRECOMPUTE_MERKLE
8075 | OPTI_TYPE_EARLY_SKIP
8076 | OPTI_TYPE_NOT_ITERATED
8077 | OPTI_TYPE_PREPENDED_SALT
8078 | OPTI_TYPE_RAW_HASH
;
8085 case 30: hash_type
= HASH_TYPE_MD5
;
8086 salt_type
= SALT_TYPE_INTERN
;
8087 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8088 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8089 | OPTS_TYPE_PT_UNICODE
8090 | OPTS_TYPE_ST_ADD80
8091 | OPTS_TYPE_ST_ADDBITS14
;
8092 kern_type
= KERN_TYPE_MD5_PWUSLT
;
8093 dgst_size
= DGST_SIZE_4_4
;
8094 parse_func
= md5s_parse_hash
;
8095 sort_by_digest
= sort_by_digest_4_4
;
8096 opti_type
= OPTI_TYPE_ZERO_BYTE
8097 | OPTI_TYPE_PRECOMPUTE_INIT
8098 | OPTI_TYPE_PRECOMPUTE_MERKLE
8099 | OPTI_TYPE_MEET_IN_MIDDLE
8100 | OPTI_TYPE_EARLY_SKIP
8101 | OPTI_TYPE_NOT_ITERATED
8102 | OPTI_TYPE_APPENDED_SALT
8103 | OPTI_TYPE_RAW_HASH
;
8110 case 40: hash_type
= HASH_TYPE_MD5
;
8111 salt_type
= SALT_TYPE_INTERN
;
8112 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8113 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8114 | OPTS_TYPE_PT_ADD80
8115 | OPTS_TYPE_PT_ADDBITS14
8116 | OPTS_TYPE_PT_UNICODE
;
8117 kern_type
= KERN_TYPE_MD5_SLTPWU
;
8118 dgst_size
= DGST_SIZE_4_4
;
8119 parse_func
= md5s_parse_hash
;
8120 sort_by_digest
= sort_by_digest_4_4
;
8121 opti_type
= OPTI_TYPE_ZERO_BYTE
8122 | OPTI_TYPE_PRECOMPUTE_INIT
8123 | OPTI_TYPE_PRECOMPUTE_MERKLE
8124 | OPTI_TYPE_EARLY_SKIP
8125 | OPTI_TYPE_NOT_ITERATED
8126 | OPTI_TYPE_PREPENDED_SALT
8127 | OPTI_TYPE_RAW_HASH
;
8134 case 50: hash_type
= HASH_TYPE_MD5
;
8135 salt_type
= SALT_TYPE_INTERN
;
8136 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8137 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8138 | OPTS_TYPE_ST_ADD80
8139 | OPTS_TYPE_ST_ADDBITS14
;
8140 kern_type
= KERN_TYPE_HMACMD5_PW
;
8141 dgst_size
= DGST_SIZE_4_4
;
8142 parse_func
= hmacmd5_parse_hash
;
8143 sort_by_digest
= sort_by_digest_4_4
;
8144 opti_type
= OPTI_TYPE_ZERO_BYTE
8145 | OPTI_TYPE_NOT_ITERATED
;
8152 case 60: hash_type
= HASH_TYPE_MD5
;
8153 salt_type
= SALT_TYPE_INTERN
;
8154 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8156 | OPTS_TYPE_PT_ADD80
8157 | OPTS_TYPE_PT_ADDBITS14
;
8158 kern_type
= KERN_TYPE_HMACMD5_SLT
;
8159 dgst_size
= DGST_SIZE_4_4
;
8160 parse_func
= hmacmd5_parse_hash
;
8161 sort_by_digest
= sort_by_digest_4_4
;
8162 opti_type
= OPTI_TYPE_ZERO_BYTE
8163 | OPTI_TYPE_NOT_ITERATED
;
8170 case 100: 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
= sha1_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 101: hash_type
= HASH_TYPE_SHA1
;
8194 salt_type
= SALT_TYPE_NONE
;
8195 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8196 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8197 | OPTS_TYPE_PT_ADD80
8198 | OPTS_TYPE_PT_ADDBITS15
;
8199 kern_type
= KERN_TYPE_SHA1
;
8200 dgst_size
= DGST_SIZE_4_5
;
8201 parse_func
= sha1b64_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_NOT_SALTED
8209 | OPTI_TYPE_RAW_HASH
;
8216 case 110: hash_type
= HASH_TYPE_SHA1
;
8217 salt_type
= SALT_TYPE_INTERN
;
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
= sha1s_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 111: hash_type
= HASH_TYPE_SHA1
;
8240 salt_type
= SALT_TYPE_EMBEDDED
;
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
;
8245 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8246 dgst_size
= DGST_SIZE_4_5
;
8247 parse_func
= sha1b64s_parse_hash
;
8248 sort_by_digest
= sort_by_digest_4_5
;
8249 opti_type
= OPTI_TYPE_ZERO_BYTE
8250 | OPTI_TYPE_PRECOMPUTE_INIT
8251 | OPTI_TYPE_PRECOMPUTE_MERKLE
8252 | OPTI_TYPE_EARLY_SKIP
8253 | OPTI_TYPE_NOT_ITERATED
8254 | OPTI_TYPE_APPENDED_SALT
8255 | OPTI_TYPE_RAW_HASH
;
8262 case 112: hash_type
= HASH_TYPE_SHA1
;
8263 salt_type
= SALT_TYPE_INTERN
;
8264 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8265 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8266 | OPTS_TYPE_ST_ADD80
8267 | OPTS_TYPE_ST_ADDBITS15
8269 kern_type
= KERN_TYPE_SHA1_PWSLT
;
8270 dgst_size
= DGST_SIZE_4_5
;
8271 parse_func
= oracles_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_APPENDED_SALT
8279 | OPTI_TYPE_RAW_HASH
;
8286 case 120: 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 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8293 dgst_size
= DGST_SIZE_4_5
;
8294 parse_func
= sha1s_parse_hash
;
8295 sort_by_digest
= sort_by_digest_4_5
;
8296 opti_type
= OPTI_TYPE_ZERO_BYTE
8297 | OPTI_TYPE_PRECOMPUTE_INIT
8298 | OPTI_TYPE_PRECOMPUTE_MERKLE
8299 | OPTI_TYPE_EARLY_SKIP
8300 | OPTI_TYPE_NOT_ITERATED
8301 | OPTI_TYPE_PREPENDED_SALT
8302 | OPTI_TYPE_RAW_HASH
;
8309 case 121: hash_type
= HASH_TYPE_SHA1
;
8310 salt_type
= SALT_TYPE_INTERN
;
8311 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8312 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8313 | OPTS_TYPE_PT_ADD80
8314 | OPTS_TYPE_PT_ADDBITS15
8315 | OPTS_TYPE_ST_LOWER
;
8316 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8317 dgst_size
= DGST_SIZE_4_5
;
8318 parse_func
= smf_parse_hash
;
8319 sort_by_digest
= sort_by_digest_4_5
;
8320 opti_type
= OPTI_TYPE_ZERO_BYTE
8321 | OPTI_TYPE_PRECOMPUTE_INIT
8322 | OPTI_TYPE_PRECOMPUTE_MERKLE
8323 | OPTI_TYPE_EARLY_SKIP
8324 | OPTI_TYPE_NOT_ITERATED
8325 | OPTI_TYPE_PREPENDED_SALT
8326 | OPTI_TYPE_RAW_HASH
;
8333 case 122: hash_type
= HASH_TYPE_SHA1
;
8334 salt_type
= SALT_TYPE_EMBEDDED
;
8335 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8336 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8337 | OPTS_TYPE_PT_ADD80
8338 | OPTS_TYPE_PT_ADDBITS15
8340 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8341 dgst_size
= DGST_SIZE_4_5
;
8342 parse_func
= osx1_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 124: 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
;
8363 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8364 dgst_size
= DGST_SIZE_4_5
;
8365 parse_func
= djangosha1_parse_hash
;
8366 sort_by_digest
= sort_by_digest_4_5
;
8367 opti_type
= OPTI_TYPE_ZERO_BYTE
8368 | OPTI_TYPE_PRECOMPUTE_INIT
8369 | OPTI_TYPE_PRECOMPUTE_MERKLE
8370 | OPTI_TYPE_EARLY_SKIP
8371 | OPTI_TYPE_NOT_ITERATED
8372 | OPTI_TYPE_PREPENDED_SALT
8373 | OPTI_TYPE_RAW_HASH
;
8380 case 125: hash_type
= HASH_TYPE_SHA1
;
8381 salt_type
= SALT_TYPE_EMBEDDED
;
8382 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8383 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8384 | OPTS_TYPE_PT_ADD80
8385 | OPTS_TYPE_PT_ADDBITS15
8387 kern_type
= KERN_TYPE_SHA1_SLTPW
;
8388 dgst_size
= DGST_SIZE_4_5
;
8389 parse_func
= arubaos_parse_hash
;
8390 sort_by_digest
= sort_by_digest_4_5
;
8391 opti_type
= OPTI_TYPE_ZERO_BYTE
8392 | OPTI_TYPE_PRECOMPUTE_INIT
8393 | OPTI_TYPE_PRECOMPUTE_MERKLE
8394 | OPTI_TYPE_EARLY_SKIP
8395 | OPTI_TYPE_NOT_ITERATED
8396 | OPTI_TYPE_PREPENDED_SALT
8397 | OPTI_TYPE_RAW_HASH
;
8404 case 130: hash_type
= HASH_TYPE_SHA1
;
8405 salt_type
= SALT_TYPE_INTERN
;
8406 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8407 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8408 | OPTS_TYPE_PT_UNICODE
8409 | OPTS_TYPE_ST_ADD80
8410 | OPTS_TYPE_ST_ADDBITS15
;
8411 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8412 dgst_size
= DGST_SIZE_4_5
;
8413 parse_func
= sha1s_parse_hash
;
8414 sort_by_digest
= sort_by_digest_4_5
;
8415 opti_type
= OPTI_TYPE_ZERO_BYTE
8416 | OPTI_TYPE_PRECOMPUTE_INIT
8417 | OPTI_TYPE_PRECOMPUTE_MERKLE
8418 | OPTI_TYPE_EARLY_SKIP
8419 | OPTI_TYPE_NOT_ITERATED
8420 | OPTI_TYPE_APPENDED_SALT
8421 | OPTI_TYPE_RAW_HASH
;
8428 case 131: hash_type
= HASH_TYPE_SHA1
;
8429 salt_type
= SALT_TYPE_EMBEDDED
;
8430 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8431 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8432 | OPTS_TYPE_PT_UNICODE
8433 | OPTS_TYPE_PT_UPPER
8434 | OPTS_TYPE_ST_ADD80
8435 | OPTS_TYPE_ST_ADDBITS15
8437 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8438 dgst_size
= DGST_SIZE_4_5
;
8439 parse_func
= mssql2000_parse_hash
;
8440 sort_by_digest
= sort_by_digest_4_5
;
8441 opti_type
= OPTI_TYPE_ZERO_BYTE
8442 | OPTI_TYPE_PRECOMPUTE_INIT
8443 | OPTI_TYPE_PRECOMPUTE_MERKLE
8444 | OPTI_TYPE_EARLY_SKIP
8445 | OPTI_TYPE_NOT_ITERATED
8446 | OPTI_TYPE_APPENDED_SALT
8447 | OPTI_TYPE_RAW_HASH
;
8454 case 132: hash_type
= HASH_TYPE_SHA1
;
8455 salt_type
= SALT_TYPE_EMBEDDED
;
8456 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8457 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8458 | OPTS_TYPE_PT_UNICODE
8459 | OPTS_TYPE_ST_ADD80
8460 | OPTS_TYPE_ST_ADDBITS15
8462 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8463 dgst_size
= DGST_SIZE_4_5
;
8464 parse_func
= mssql2005_parse_hash
;
8465 sort_by_digest
= sort_by_digest_4_5
;
8466 opti_type
= OPTI_TYPE_ZERO_BYTE
8467 | OPTI_TYPE_PRECOMPUTE_INIT
8468 | OPTI_TYPE_PRECOMPUTE_MERKLE
8469 | OPTI_TYPE_EARLY_SKIP
8470 | OPTI_TYPE_NOT_ITERATED
8471 | OPTI_TYPE_APPENDED_SALT
8472 | OPTI_TYPE_RAW_HASH
;
8479 case 133: hash_type
= HASH_TYPE_SHA1
;
8480 salt_type
= SALT_TYPE_EMBEDDED
;
8481 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8482 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8483 | OPTS_TYPE_PT_UNICODE
8484 | OPTS_TYPE_ST_ADD80
8485 | OPTS_TYPE_ST_ADDBITS15
;
8486 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
8487 dgst_size
= DGST_SIZE_4_5
;
8488 parse_func
= peoplesoft_parse_hash
;
8489 sort_by_digest
= sort_by_digest_4_5
;
8490 opti_type
= OPTI_TYPE_ZERO_BYTE
8491 | OPTI_TYPE_PRECOMPUTE_INIT
8492 | OPTI_TYPE_PRECOMPUTE_MERKLE
8493 | OPTI_TYPE_EARLY_SKIP
8494 | OPTI_TYPE_NOT_ITERATED
8495 | OPTI_TYPE_APPENDED_SALT
8496 | OPTI_TYPE_RAW_HASH
;
8503 case 140: hash_type
= HASH_TYPE_SHA1
;
8504 salt_type
= SALT_TYPE_INTERN
;
8505 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8506 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8507 | OPTS_TYPE_PT_ADD80
8508 | OPTS_TYPE_PT_ADDBITS15
8509 | OPTS_TYPE_PT_UNICODE
;
8510 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8511 dgst_size
= DGST_SIZE_4_5
;
8512 parse_func
= sha1s_parse_hash
;
8513 sort_by_digest
= sort_by_digest_4_5
;
8514 opti_type
= OPTI_TYPE_ZERO_BYTE
8515 | OPTI_TYPE_PRECOMPUTE_INIT
8516 | OPTI_TYPE_PRECOMPUTE_MERKLE
8517 | OPTI_TYPE_EARLY_SKIP
8518 | OPTI_TYPE_NOT_ITERATED
8519 | OPTI_TYPE_PREPENDED_SALT
8520 | OPTI_TYPE_RAW_HASH
;
8527 case 141: hash_type
= HASH_TYPE_SHA1
;
8528 salt_type
= SALT_TYPE_EMBEDDED
;
8529 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8530 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8531 | OPTS_TYPE_PT_ADD80
8532 | OPTS_TYPE_PT_ADDBITS15
8533 | OPTS_TYPE_PT_UNICODE
8534 | OPTS_TYPE_ST_BASE64
;
8535 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
8536 dgst_size
= DGST_SIZE_4_5
;
8537 parse_func
= episerver_parse_hash
;
8538 sort_by_digest
= sort_by_digest_4_5
;
8539 opti_type
= OPTI_TYPE_ZERO_BYTE
8540 | OPTI_TYPE_PRECOMPUTE_INIT
8541 | OPTI_TYPE_PRECOMPUTE_MERKLE
8542 | OPTI_TYPE_EARLY_SKIP
8543 | OPTI_TYPE_NOT_ITERATED
8544 | OPTI_TYPE_PREPENDED_SALT
8545 | OPTI_TYPE_RAW_HASH
;
8552 case 150: hash_type
= HASH_TYPE_SHA1
;
8553 salt_type
= SALT_TYPE_INTERN
;
8554 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8555 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8556 | OPTS_TYPE_ST_ADD80
8557 | OPTS_TYPE_ST_ADDBITS15
;
8558 kern_type
= KERN_TYPE_HMACSHA1_PW
;
8559 dgst_size
= DGST_SIZE_4_5
;
8560 parse_func
= hmacsha1_parse_hash
;
8561 sort_by_digest
= sort_by_digest_4_5
;
8562 opti_type
= OPTI_TYPE_ZERO_BYTE
8563 | OPTI_TYPE_NOT_ITERATED
;
8570 case 160: hash_type
= HASH_TYPE_SHA1
;
8571 salt_type
= SALT_TYPE_INTERN
;
8572 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8573 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8574 | OPTS_TYPE_PT_ADD80
8575 | OPTS_TYPE_PT_ADDBITS15
;
8576 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
8577 dgst_size
= DGST_SIZE_4_5
;
8578 parse_func
= hmacsha1_parse_hash
;
8579 sort_by_digest
= sort_by_digest_4_5
;
8580 opti_type
= OPTI_TYPE_ZERO_BYTE
8581 | OPTI_TYPE_NOT_ITERATED
;
8588 case 200: hash_type
= HASH_TYPE_MYSQL
;
8589 salt_type
= SALT_TYPE_NONE
;
8590 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8592 kern_type
= KERN_TYPE_MYSQL
;
8593 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8594 parse_func
= mysql323_parse_hash
;
8595 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8596 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8603 case 300: hash_type
= HASH_TYPE_SHA1
;
8604 salt_type
= SALT_TYPE_NONE
;
8605 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8606 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8607 | OPTS_TYPE_PT_ADD80
8608 | OPTS_TYPE_PT_ADDBITS15
;
8609 kern_type
= KERN_TYPE_MYSQL41
;
8610 dgst_size
= DGST_SIZE_4_5
;
8611 parse_func
= sha1_parse_hash
;
8612 sort_by_digest
= sort_by_digest_4_5
;
8613 opti_type
= OPTI_TYPE_ZERO_BYTE
8614 | OPTI_TYPE_PRECOMPUTE_INIT
8615 | OPTI_TYPE_PRECOMPUTE_MERKLE
8616 | OPTI_TYPE_EARLY_SKIP
8617 | OPTI_TYPE_NOT_ITERATED
8618 | OPTI_TYPE_NOT_SALTED
;
8625 case 400: hash_type
= HASH_TYPE_MD5
;
8626 salt_type
= SALT_TYPE_EMBEDDED
;
8627 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8628 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8629 kern_type
= KERN_TYPE_PHPASS
;
8630 dgst_size
= DGST_SIZE_4_4
;
8631 parse_func
= phpass_parse_hash
;
8632 sort_by_digest
= sort_by_digest_4_4
;
8633 opti_type
= OPTI_TYPE_ZERO_BYTE
8634 | OPTI_TYPE_SLOW_HASH_SIMD
;
8641 case 500: hash_type
= HASH_TYPE_MD5
;
8642 salt_type
= SALT_TYPE_EMBEDDED
;
8643 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8645 kern_type
= KERN_TYPE_MD5CRYPT
;
8646 dgst_size
= DGST_SIZE_4_4
;
8647 parse_func
= md5crypt_parse_hash
;
8648 sort_by_digest
= sort_by_digest_4_4
;
8649 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8656 case 501: hash_type
= HASH_TYPE_MD5
;
8657 salt_type
= SALT_TYPE_EMBEDDED
;
8658 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8660 | OPTS_TYPE_HASH_COPY
;
8661 kern_type
= KERN_TYPE_MD5CRYPT
;
8662 dgst_size
= DGST_SIZE_4_4
;
8663 parse_func
= juniper_parse_hash
;
8664 sort_by_digest
= sort_by_digest_4_4
;
8665 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8672 case 900: hash_type
= HASH_TYPE_MD4
;
8673 salt_type
= SALT_TYPE_NONE
;
8674 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8675 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8676 | OPTS_TYPE_PT_ADD80
8677 | OPTS_TYPE_PT_ADDBITS14
;
8678 kern_type
= KERN_TYPE_MD4
;
8679 dgst_size
= DGST_SIZE_4_4
;
8680 parse_func
= md4_parse_hash
;
8681 sort_by_digest
= sort_by_digest_4_4
;
8682 opti_type
= OPTI_TYPE_ZERO_BYTE
8683 | OPTI_TYPE_PRECOMPUTE_INIT
8684 | OPTI_TYPE_PRECOMPUTE_MERKLE
8685 | OPTI_TYPE_MEET_IN_MIDDLE
8686 | OPTI_TYPE_EARLY_SKIP
8687 | OPTI_TYPE_NOT_ITERATED
8688 | OPTI_TYPE_NOT_SALTED
8689 | OPTI_TYPE_RAW_HASH
;
8696 case 1000: hash_type
= HASH_TYPE_MD4
;
8697 salt_type
= SALT_TYPE_NONE
;
8698 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8699 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8700 | OPTS_TYPE_PT_ADD80
8701 | OPTS_TYPE_PT_ADDBITS14
8702 | OPTS_TYPE_PT_UNICODE
;
8703 kern_type
= KERN_TYPE_MD4_PWU
;
8704 dgst_size
= DGST_SIZE_4_4
;
8705 parse_func
= md4_parse_hash
;
8706 sort_by_digest
= sort_by_digest_4_4
;
8707 opti_type
= OPTI_TYPE_ZERO_BYTE
8708 | OPTI_TYPE_PRECOMPUTE_INIT
8709 | OPTI_TYPE_PRECOMPUTE_MERKLE
8710 | OPTI_TYPE_MEET_IN_MIDDLE
8711 | OPTI_TYPE_EARLY_SKIP
8712 | OPTI_TYPE_NOT_ITERATED
8713 | OPTI_TYPE_NOT_SALTED
8714 | OPTI_TYPE_RAW_HASH
;
8721 case 1100: hash_type
= HASH_TYPE_MD4
;
8722 salt_type
= SALT_TYPE_INTERN
;
8723 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8724 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8725 | OPTS_TYPE_PT_ADD80
8726 | OPTS_TYPE_PT_ADDBITS14
8727 | OPTS_TYPE_PT_UNICODE
8728 | OPTS_TYPE_ST_ADD80
8729 | OPTS_TYPE_ST_UNICODE
8730 | OPTS_TYPE_ST_LOWER
;
8731 kern_type
= KERN_TYPE_MD44_PWUSLT
;
8732 dgst_size
= DGST_SIZE_4_4
;
8733 parse_func
= dcc_parse_hash
;
8734 sort_by_digest
= sort_by_digest_4_4
;
8735 opti_type
= OPTI_TYPE_ZERO_BYTE
8736 | OPTI_TYPE_PRECOMPUTE_INIT
8737 | OPTI_TYPE_PRECOMPUTE_MERKLE
8738 | OPTI_TYPE_EARLY_SKIP
8739 | OPTI_TYPE_NOT_ITERATED
;
8746 case 1400: hash_type
= HASH_TYPE_SHA256
;
8747 salt_type
= SALT_TYPE_NONE
;
8748 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8749 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8750 | OPTS_TYPE_PT_ADD80
8751 | OPTS_TYPE_PT_ADDBITS15
;
8752 kern_type
= KERN_TYPE_SHA256
;
8753 dgst_size
= DGST_SIZE_4_8
;
8754 parse_func
= sha256_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_NOT_SALTED
8762 | OPTI_TYPE_RAW_HASH
;
8769 case 1410: 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_ST_ADD80
8774 | OPTS_TYPE_ST_ADDBITS15
;
8775 kern_type
= KERN_TYPE_SHA256_PWSLT
;
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_APPENDED_SALT
8785 | OPTI_TYPE_RAW_HASH
;
8792 case 1420: hash_type
= HASH_TYPE_SHA256
;
8793 salt_type
= SALT_TYPE_INTERN
;
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
= sha256s_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 1421: hash_type
= HASH_TYPE_SHA256
;
8816 salt_type
= SALT_TYPE_EMBEDDED
;
8817 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8818 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8819 | OPTS_TYPE_PT_ADD80
8820 | OPTS_TYPE_PT_ADDBITS15
;
8821 kern_type
= KERN_TYPE_SHA256_SLTPW
;
8822 dgst_size
= DGST_SIZE_4_8
;
8823 parse_func
= hmailserver_parse_hash
;
8824 sort_by_digest
= sort_by_digest_4_8
;
8825 opti_type
= OPTI_TYPE_ZERO_BYTE
8826 | OPTI_TYPE_PRECOMPUTE_INIT
8827 | OPTI_TYPE_PRECOMPUTE_MERKLE
8828 | OPTI_TYPE_EARLY_SKIP
8829 | OPTI_TYPE_NOT_ITERATED
8830 | OPTI_TYPE_PREPENDED_SALT
8831 | OPTI_TYPE_RAW_HASH
;
8838 case 1430: hash_type
= HASH_TYPE_SHA256
;
8839 salt_type
= SALT_TYPE_INTERN
;
8840 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8841 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8842 | OPTS_TYPE_PT_UNICODE
8843 | OPTS_TYPE_ST_ADD80
8844 | OPTS_TYPE_ST_ADDBITS15
;
8845 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
8846 dgst_size
= DGST_SIZE_4_8
;
8847 parse_func
= sha256s_parse_hash
;
8848 sort_by_digest
= sort_by_digest_4_8
;
8849 opti_type
= OPTI_TYPE_ZERO_BYTE
8850 | OPTI_TYPE_PRECOMPUTE_INIT
8851 | OPTI_TYPE_PRECOMPUTE_MERKLE
8852 | OPTI_TYPE_EARLY_SKIP
8853 | OPTI_TYPE_NOT_ITERATED
8854 | OPTI_TYPE_APPENDED_SALT
8855 | OPTI_TYPE_RAW_HASH
;
8862 case 1440: hash_type
= HASH_TYPE_SHA256
;
8863 salt_type
= SALT_TYPE_INTERN
;
8864 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8865 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8866 | OPTS_TYPE_PT_ADD80
8867 | OPTS_TYPE_PT_ADDBITS15
8868 | OPTS_TYPE_PT_UNICODE
;
8869 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8870 dgst_size
= DGST_SIZE_4_8
;
8871 parse_func
= sha256s_parse_hash
;
8872 sort_by_digest
= sort_by_digest_4_8
;
8873 opti_type
= OPTI_TYPE_ZERO_BYTE
8874 | OPTI_TYPE_PRECOMPUTE_INIT
8875 | OPTI_TYPE_PRECOMPUTE_MERKLE
8876 | OPTI_TYPE_EARLY_SKIP
8877 | OPTI_TYPE_NOT_ITERATED
8878 | OPTI_TYPE_PREPENDED_SALT
8879 | OPTI_TYPE_RAW_HASH
;
8886 case 1441: hash_type
= HASH_TYPE_SHA256
;
8887 salt_type
= SALT_TYPE_EMBEDDED
;
8888 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8889 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8890 | OPTS_TYPE_PT_ADD80
8891 | OPTS_TYPE_PT_ADDBITS15
8892 | OPTS_TYPE_PT_UNICODE
8893 | OPTS_TYPE_ST_BASE64
;
8894 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
8895 dgst_size
= DGST_SIZE_4_8
;
8896 parse_func
= episerver4_parse_hash
;
8897 sort_by_digest
= sort_by_digest_4_8
;
8898 opti_type
= OPTI_TYPE_ZERO_BYTE
8899 | OPTI_TYPE_PRECOMPUTE_INIT
8900 | OPTI_TYPE_PRECOMPUTE_MERKLE
8901 | OPTI_TYPE_EARLY_SKIP
8902 | OPTI_TYPE_NOT_ITERATED
8903 | OPTI_TYPE_PREPENDED_SALT
8904 | OPTI_TYPE_RAW_HASH
;
8911 case 1450: hash_type
= HASH_TYPE_SHA256
;
8912 salt_type
= SALT_TYPE_INTERN
;
8913 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8914 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8915 | OPTS_TYPE_ST_ADD80
;
8916 kern_type
= KERN_TYPE_HMACSHA256_PW
;
8917 dgst_size
= DGST_SIZE_4_8
;
8918 parse_func
= hmacsha256_parse_hash
;
8919 sort_by_digest
= sort_by_digest_4_8
;
8920 opti_type
= OPTI_TYPE_ZERO_BYTE
8921 | OPTI_TYPE_NOT_ITERATED
;
8928 case 1460: hash_type
= HASH_TYPE_SHA256
;
8929 salt_type
= SALT_TYPE_INTERN
;
8930 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8931 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8932 | OPTS_TYPE_PT_ADD80
8933 | OPTS_TYPE_PT_ADDBITS15
;
8934 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8935 dgst_size
= DGST_SIZE_4_8
;
8936 parse_func
= hmacsha256_parse_hash
;
8937 sort_by_digest
= sort_by_digest_4_8
;
8938 opti_type
= OPTI_TYPE_ZERO_BYTE
8939 | OPTI_TYPE_NOT_ITERATED
;
8946 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8947 salt_type
= SALT_TYPE_EMBEDDED
;
8948 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8950 | OPTS_TYPE_PT_BITSLICE
;
8951 kern_type
= KERN_TYPE_DESCRYPT
;
8952 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8953 parse_func
= descrypt_parse_hash
;
8954 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8955 opti_type
= OPTI_TYPE_ZERO_BYTE
8956 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8963 case 1600: hash_type
= HASH_TYPE_MD5
;
8964 salt_type
= SALT_TYPE_EMBEDDED
;
8965 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8966 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8967 kern_type
= KERN_TYPE_APR1CRYPT
;
8968 dgst_size
= DGST_SIZE_4_4
;
8969 parse_func
= md5apr1_parse_hash
;
8970 sort_by_digest
= sort_by_digest_4_4
;
8971 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8978 case 1700: hash_type
= HASH_TYPE_SHA512
;
8979 salt_type
= SALT_TYPE_NONE
;
8980 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8981 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8982 | OPTS_TYPE_PT_ADD80
8983 | OPTS_TYPE_PT_ADDBITS15
;
8984 kern_type
= KERN_TYPE_SHA512
;
8985 dgst_size
= DGST_SIZE_8_8
;
8986 parse_func
= sha512_parse_hash
;
8987 sort_by_digest
= sort_by_digest_8_8
;
8988 opti_type
= OPTI_TYPE_ZERO_BYTE
8989 | OPTI_TYPE_PRECOMPUTE_INIT
8990 | OPTI_TYPE_PRECOMPUTE_MERKLE
8991 | OPTI_TYPE_EARLY_SKIP
8992 | OPTI_TYPE_NOT_ITERATED
8993 | OPTI_TYPE_NOT_SALTED
8994 | OPTI_TYPE_USES_BITS_64
8995 | OPTI_TYPE_RAW_HASH
;
9002 case 1710: hash_type
= HASH_TYPE_SHA512
;
9003 salt_type
= SALT_TYPE_INTERN
;
9004 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9005 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9006 | OPTS_TYPE_ST_ADD80
9007 | OPTS_TYPE_ST_ADDBITS15
;
9008 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9009 dgst_size
= DGST_SIZE_8_8
;
9010 parse_func
= sha512s_parse_hash
;
9011 sort_by_digest
= sort_by_digest_8_8
;
9012 opti_type
= OPTI_TYPE_ZERO_BYTE
9013 | OPTI_TYPE_PRECOMPUTE_INIT
9014 | OPTI_TYPE_PRECOMPUTE_MERKLE
9015 | OPTI_TYPE_EARLY_SKIP
9016 | OPTI_TYPE_NOT_ITERATED
9017 | OPTI_TYPE_APPENDED_SALT
9018 | OPTI_TYPE_USES_BITS_64
9019 | OPTI_TYPE_RAW_HASH
;
9026 case 1711: hash_type
= HASH_TYPE_SHA512
;
9027 salt_type
= SALT_TYPE_EMBEDDED
;
9028 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9029 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9030 | OPTS_TYPE_ST_ADD80
9031 | OPTS_TYPE_ST_ADDBITS15
;
9032 kern_type
= KERN_TYPE_SHA512_PWSLT
;
9033 dgst_size
= DGST_SIZE_8_8
;
9034 parse_func
= sha512b64s_parse_hash
;
9035 sort_by_digest
= sort_by_digest_8_8
;
9036 opti_type
= OPTI_TYPE_ZERO_BYTE
9037 | OPTI_TYPE_PRECOMPUTE_INIT
9038 | OPTI_TYPE_PRECOMPUTE_MERKLE
9039 | OPTI_TYPE_EARLY_SKIP
9040 | OPTI_TYPE_NOT_ITERATED
9041 | OPTI_TYPE_APPENDED_SALT
9042 | OPTI_TYPE_USES_BITS_64
9043 | OPTI_TYPE_RAW_HASH
;
9050 case 1720: hash_type
= HASH_TYPE_SHA512
;
9051 salt_type
= SALT_TYPE_INTERN
;
9052 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9053 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9054 | OPTS_TYPE_PT_ADD80
9055 | OPTS_TYPE_PT_ADDBITS15
;
9056 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9057 dgst_size
= DGST_SIZE_8_8
;
9058 parse_func
= sha512s_parse_hash
;
9059 sort_by_digest
= sort_by_digest_8_8
;
9060 opti_type
= OPTI_TYPE_ZERO_BYTE
9061 | OPTI_TYPE_PRECOMPUTE_INIT
9062 | OPTI_TYPE_PRECOMPUTE_MERKLE
9063 | OPTI_TYPE_EARLY_SKIP
9064 | OPTI_TYPE_NOT_ITERATED
9065 | OPTI_TYPE_PREPENDED_SALT
9066 | OPTI_TYPE_USES_BITS_64
9067 | OPTI_TYPE_RAW_HASH
;
9074 case 1722: hash_type
= HASH_TYPE_SHA512
;
9075 salt_type
= SALT_TYPE_EMBEDDED
;
9076 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9077 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9078 | OPTS_TYPE_PT_ADD80
9079 | OPTS_TYPE_PT_ADDBITS15
9081 kern_type
= KERN_TYPE_SHA512_SLTPW
;
9082 dgst_size
= DGST_SIZE_8_8
;
9083 parse_func
= osx512_parse_hash
;
9084 sort_by_digest
= sort_by_digest_8_8
;
9085 opti_type
= OPTI_TYPE_ZERO_BYTE
9086 | OPTI_TYPE_PRECOMPUTE_INIT
9087 | OPTI_TYPE_PRECOMPUTE_MERKLE
9088 | OPTI_TYPE_EARLY_SKIP
9089 | OPTI_TYPE_NOT_ITERATED
9090 | OPTI_TYPE_PREPENDED_SALT
9091 | OPTI_TYPE_USES_BITS_64
9092 | OPTI_TYPE_RAW_HASH
;
9099 case 1730: hash_type
= HASH_TYPE_SHA512
;
9100 salt_type
= SALT_TYPE_INTERN
;
9101 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9102 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9103 | OPTS_TYPE_PT_UNICODE
9104 | OPTS_TYPE_ST_ADD80
9105 | OPTS_TYPE_ST_ADDBITS15
;
9106 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9107 dgst_size
= DGST_SIZE_8_8
;
9108 parse_func
= sha512s_parse_hash
;
9109 sort_by_digest
= sort_by_digest_8_8
;
9110 opti_type
= OPTI_TYPE_ZERO_BYTE
9111 | OPTI_TYPE_PRECOMPUTE_INIT
9112 | OPTI_TYPE_PRECOMPUTE_MERKLE
9113 | OPTI_TYPE_EARLY_SKIP
9114 | OPTI_TYPE_NOT_ITERATED
9115 | OPTI_TYPE_APPENDED_SALT
9116 | OPTI_TYPE_USES_BITS_64
9117 | OPTI_TYPE_RAW_HASH
;
9124 case 1731: hash_type
= HASH_TYPE_SHA512
;
9125 salt_type
= SALT_TYPE_EMBEDDED
;
9126 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9127 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9128 | OPTS_TYPE_PT_UNICODE
9129 | OPTS_TYPE_ST_ADD80
9130 | OPTS_TYPE_ST_ADDBITS15
9132 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
9133 dgst_size
= DGST_SIZE_8_8
;
9134 parse_func
= mssql2012_parse_hash
;
9135 sort_by_digest
= sort_by_digest_8_8
;
9136 opti_type
= OPTI_TYPE_ZERO_BYTE
9137 | OPTI_TYPE_PRECOMPUTE_INIT
9138 | OPTI_TYPE_PRECOMPUTE_MERKLE
9139 | OPTI_TYPE_EARLY_SKIP
9140 | OPTI_TYPE_NOT_ITERATED
9141 | OPTI_TYPE_APPENDED_SALT
9142 | OPTI_TYPE_USES_BITS_64
9143 | OPTI_TYPE_RAW_HASH
;
9150 case 1740: hash_type
= HASH_TYPE_SHA512
;
9151 salt_type
= SALT_TYPE_INTERN
;
9152 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9153 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9154 | OPTS_TYPE_PT_ADD80
9155 | OPTS_TYPE_PT_ADDBITS15
9156 | OPTS_TYPE_PT_UNICODE
;
9157 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
9158 dgst_size
= DGST_SIZE_8_8
;
9159 parse_func
= sha512s_parse_hash
;
9160 sort_by_digest
= sort_by_digest_8_8
;
9161 opti_type
= OPTI_TYPE_ZERO_BYTE
9162 | OPTI_TYPE_PRECOMPUTE_INIT
9163 | OPTI_TYPE_PRECOMPUTE_MERKLE
9164 | OPTI_TYPE_EARLY_SKIP
9165 | OPTI_TYPE_NOT_ITERATED
9166 | OPTI_TYPE_PREPENDED_SALT
9167 | OPTI_TYPE_USES_BITS_64
9168 | OPTI_TYPE_RAW_HASH
;
9175 case 1750: hash_type
= HASH_TYPE_SHA512
;
9176 salt_type
= SALT_TYPE_INTERN
;
9177 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9178 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9179 | OPTS_TYPE_ST_ADD80
;
9180 kern_type
= KERN_TYPE_HMACSHA512_PW
;
9181 dgst_size
= DGST_SIZE_8_8
;
9182 parse_func
= hmacsha512_parse_hash
;
9183 sort_by_digest
= sort_by_digest_8_8
;
9184 opti_type
= OPTI_TYPE_ZERO_BYTE
9185 | OPTI_TYPE_USES_BITS_64
9186 | OPTI_TYPE_NOT_ITERATED
;
9193 case 1760: hash_type
= HASH_TYPE_SHA512
;
9194 salt_type
= SALT_TYPE_INTERN
;
9195 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9196 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9197 | OPTS_TYPE_PT_ADD80
9198 | OPTS_TYPE_PT_ADDBITS15
;
9199 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
9200 dgst_size
= DGST_SIZE_8_8
;
9201 parse_func
= hmacsha512_parse_hash
;
9202 sort_by_digest
= sort_by_digest_8_8
;
9203 opti_type
= OPTI_TYPE_ZERO_BYTE
9204 | OPTI_TYPE_USES_BITS_64
9205 | OPTI_TYPE_NOT_ITERATED
;
9212 case 1800: hash_type
= HASH_TYPE_SHA512
;
9213 salt_type
= SALT_TYPE_EMBEDDED
;
9214 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9216 kern_type
= KERN_TYPE_SHA512CRYPT
;
9217 dgst_size
= DGST_SIZE_8_8
;
9218 parse_func
= sha512crypt_parse_hash
;
9219 sort_by_digest
= sort_by_digest_8_8
;
9220 opti_type
= OPTI_TYPE_ZERO_BYTE
9221 | OPTI_TYPE_USES_BITS_64
;
9228 case 2000: hash_type
= HASH_TYPE_STDOUT
;
9229 salt_type
= SALT_TYPE_NONE
;
9230 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9231 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9232 kern_type
= KERN_TYPE_STDOUT
;
9233 dgst_size
= DGST_SIZE_4_4
;
9235 sort_by_digest
= NULL
;
9243 case 2100: hash_type
= HASH_TYPE_DCC2
;
9244 salt_type
= SALT_TYPE_EMBEDDED
;
9245 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9246 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9247 | OPTS_TYPE_ST_LOWER
9248 | OPTS_TYPE_ST_UNICODE
;
9249 kern_type
= KERN_TYPE_DCC2
;
9250 dgst_size
= DGST_SIZE_4_4
;
9251 parse_func
= dcc2_parse_hash
;
9252 sort_by_digest
= sort_by_digest_4_4
;
9253 opti_type
= OPTI_TYPE_ZERO_BYTE
9254 | OPTI_TYPE_SLOW_HASH_SIMD
;
9261 case 2400: hash_type
= HASH_TYPE_MD5
;
9262 salt_type
= SALT_TYPE_NONE
;
9263 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9264 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9265 kern_type
= KERN_TYPE_MD5PIX
;
9266 dgst_size
= DGST_SIZE_4_4
;
9267 parse_func
= md5pix_parse_hash
;
9268 sort_by_digest
= sort_by_digest_4_4
;
9269 opti_type
= OPTI_TYPE_ZERO_BYTE
9270 | OPTI_TYPE_PRECOMPUTE_INIT
9271 | OPTI_TYPE_PRECOMPUTE_MERKLE
9272 | OPTI_TYPE_EARLY_SKIP
9273 | OPTI_TYPE_NOT_ITERATED
9274 | OPTI_TYPE_NOT_SALTED
;
9281 case 2410: hash_type
= HASH_TYPE_MD5
;
9282 salt_type
= SALT_TYPE_INTERN
;
9283 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9284 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9285 kern_type
= KERN_TYPE_MD5ASA
;
9286 dgst_size
= DGST_SIZE_4_4
;
9287 parse_func
= md5asa_parse_hash
;
9288 sort_by_digest
= sort_by_digest_4_4
;
9289 opti_type
= OPTI_TYPE_ZERO_BYTE
9290 | OPTI_TYPE_PRECOMPUTE_INIT
9291 | OPTI_TYPE_PRECOMPUTE_MERKLE
9292 | OPTI_TYPE_EARLY_SKIP
9293 | OPTI_TYPE_NOT_ITERATED
;
9300 case 2500: hash_type
= HASH_TYPE_WPA
;
9301 salt_type
= SALT_TYPE_EMBEDDED
;
9302 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9303 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9304 kern_type
= KERN_TYPE_WPA
;
9305 dgst_size
= DGST_SIZE_4_4
;
9306 parse_func
= wpa_parse_hash
;
9307 sort_by_digest
= sort_by_digest_4_4
;
9308 opti_type
= OPTI_TYPE_ZERO_BYTE
9309 | OPTI_TYPE_SLOW_HASH_SIMD
;
9316 case 2600: hash_type
= HASH_TYPE_MD5
;
9317 salt_type
= SALT_TYPE_VIRTUAL
;
9318 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9319 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9320 | OPTS_TYPE_PT_ADD80
9321 | OPTS_TYPE_PT_ADDBITS14
9322 | OPTS_TYPE_ST_ADD80
;
9323 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9324 dgst_size
= DGST_SIZE_4_4
;
9325 parse_func
= md5md5_parse_hash
;
9326 sort_by_digest
= sort_by_digest_4_4
;
9327 opti_type
= OPTI_TYPE_ZERO_BYTE
9328 | OPTI_TYPE_PRECOMPUTE_INIT
9329 | OPTI_TYPE_PRECOMPUTE_MERKLE
9330 | OPTI_TYPE_EARLY_SKIP
;
9337 case 2611: hash_type
= HASH_TYPE_MD5
;
9338 salt_type
= SALT_TYPE_INTERN
;
9339 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9340 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9341 | OPTS_TYPE_PT_ADD80
9342 | OPTS_TYPE_PT_ADDBITS14
9343 | OPTS_TYPE_ST_ADD80
;
9344 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9345 dgst_size
= DGST_SIZE_4_4
;
9346 parse_func
= vb3_parse_hash
;
9347 sort_by_digest
= sort_by_digest_4_4
;
9348 opti_type
= OPTI_TYPE_ZERO_BYTE
9349 | OPTI_TYPE_PRECOMPUTE_INIT
9350 | OPTI_TYPE_PRECOMPUTE_MERKLE
9351 | OPTI_TYPE_EARLY_SKIP
;
9358 case 2612: hash_type
= HASH_TYPE_MD5
;
9359 salt_type
= SALT_TYPE_EMBEDDED
;
9360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9362 | OPTS_TYPE_PT_ADD80
9363 | OPTS_TYPE_PT_ADDBITS14
9364 | OPTS_TYPE_ST_ADD80
9366 kern_type
= KERN_TYPE_MD55_PWSLT1
;
9367 dgst_size
= DGST_SIZE_4_4
;
9368 parse_func
= phps_parse_hash
;
9369 sort_by_digest
= sort_by_digest_4_4
;
9370 opti_type
= OPTI_TYPE_ZERO_BYTE
9371 | OPTI_TYPE_PRECOMPUTE_INIT
9372 | OPTI_TYPE_PRECOMPUTE_MERKLE
9373 | OPTI_TYPE_EARLY_SKIP
;
9380 case 2711: hash_type
= HASH_TYPE_MD5
;
9381 salt_type
= SALT_TYPE_INTERN
;
9382 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9383 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9384 | OPTS_TYPE_PT_ADD80
9385 | OPTS_TYPE_PT_ADDBITS14
9386 | OPTS_TYPE_ST_ADD80
;
9387 kern_type
= KERN_TYPE_MD55_PWSLT2
;
9388 dgst_size
= DGST_SIZE_4_4
;
9389 parse_func
= vb30_parse_hash
;
9390 sort_by_digest
= sort_by_digest_4_4
;
9391 opti_type
= OPTI_TYPE_ZERO_BYTE
9392 | OPTI_TYPE_PRECOMPUTE_INIT
9393 | OPTI_TYPE_EARLY_SKIP
;
9400 case 2811: hash_type
= HASH_TYPE_MD5
;
9401 salt_type
= SALT_TYPE_INTERN
;
9402 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9403 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9404 | OPTS_TYPE_PT_ADD80
9405 | OPTS_TYPE_PT_ADDBITS14
;
9406 kern_type
= KERN_TYPE_MD55_SLTPW
;
9407 dgst_size
= DGST_SIZE_4_4
;
9408 parse_func
= ipb2_parse_hash
;
9409 sort_by_digest
= sort_by_digest_4_4
;
9410 opti_type
= OPTI_TYPE_ZERO_BYTE
9411 | OPTI_TYPE_PRECOMPUTE_INIT
9412 | OPTI_TYPE_EARLY_SKIP
;
9419 case 3000: hash_type
= HASH_TYPE_LM
;
9420 salt_type
= SALT_TYPE_NONE
;
9421 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9422 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9423 | OPTS_TYPE_PT_UPPER
9424 | OPTS_TYPE_PT_BITSLICE
;
9425 kern_type
= KERN_TYPE_LM
;
9426 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9427 parse_func
= lm_parse_hash
;
9428 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9429 opti_type
= OPTI_TYPE_ZERO_BYTE
9430 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9437 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
9438 salt_type
= SALT_TYPE_INTERN
;
9439 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9440 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9441 | OPTS_TYPE_PT_UPPER
9442 | OPTS_TYPE_ST_UPPER
;
9443 kern_type
= KERN_TYPE_ORACLEH
;
9444 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9445 parse_func
= oracleh_parse_hash
;
9446 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9454 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
9455 salt_type
= SALT_TYPE_EMBEDDED
;
9456 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9458 | OPTS_TYPE_ST_GENERATE_LE
;
9459 kern_type
= KERN_TYPE_BCRYPT
;
9460 dgst_size
= DGST_SIZE_4_6
;
9461 parse_func
= bcrypt_parse_hash
;
9462 sort_by_digest
= sort_by_digest_4_6
;
9463 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9470 case 3710: hash_type
= HASH_TYPE_MD5
;
9471 salt_type
= SALT_TYPE_INTERN
;
9472 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9473 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9474 | OPTS_TYPE_PT_ADD80
9475 | OPTS_TYPE_PT_ADDBITS14
;
9476 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9477 dgst_size
= DGST_SIZE_4_4
;
9478 parse_func
= md5s_parse_hash
;
9479 sort_by_digest
= sort_by_digest_4_4
;
9480 opti_type
= OPTI_TYPE_ZERO_BYTE
9481 | OPTI_TYPE_PRECOMPUTE_INIT
9482 | OPTI_TYPE_PRECOMPUTE_MERKLE
9483 | OPTI_TYPE_EARLY_SKIP
;
9490 case 3711: hash_type
= HASH_TYPE_MD5
;
9491 salt_type
= SALT_TYPE_EMBEDDED
;
9492 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9493 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9494 | OPTS_TYPE_PT_ADD80
9495 | OPTS_TYPE_PT_ADDBITS14
;
9496 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
9497 dgst_size
= DGST_SIZE_4_4
;
9498 parse_func
= mediawiki_b_parse_hash
;
9499 sort_by_digest
= sort_by_digest_4_4
;
9500 opti_type
= OPTI_TYPE_ZERO_BYTE
9501 | OPTI_TYPE_PRECOMPUTE_INIT
9502 | OPTI_TYPE_PRECOMPUTE_MERKLE
9503 | OPTI_TYPE_EARLY_SKIP
;
9510 case 3800: hash_type
= HASH_TYPE_MD5
;
9511 salt_type
= SALT_TYPE_INTERN
;
9512 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9513 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9514 | OPTS_TYPE_ST_ADDBITS14
;
9515 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
9516 dgst_size
= DGST_SIZE_4_4
;
9517 parse_func
= md5s_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
9523 | OPTI_TYPE_NOT_ITERATED
9524 | OPTI_TYPE_RAW_HASH
;
9531 case 4300: hash_type
= HASH_TYPE_MD5
;
9532 salt_type
= SALT_TYPE_VIRTUAL
;
9533 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9534 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9535 | OPTS_TYPE_PT_ADD80
9536 | OPTS_TYPE_PT_ADDBITS14
9537 | OPTS_TYPE_ST_ADD80
;
9538 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
9539 dgst_size
= DGST_SIZE_4_4
;
9540 parse_func
= md5md5_parse_hash
;
9541 sort_by_digest
= sort_by_digest_4_4
;
9542 opti_type
= OPTI_TYPE_ZERO_BYTE
9543 | OPTI_TYPE_PRECOMPUTE_INIT
9544 | OPTI_TYPE_PRECOMPUTE_MERKLE
9545 | OPTI_TYPE_EARLY_SKIP
;
9553 case 4400: hash_type
= HASH_TYPE_MD5
;
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_MD5_SHA1
;
9560 dgst_size
= DGST_SIZE_4_4
;
9561 parse_func
= md5_parse_hash
;
9562 sort_by_digest
= sort_by_digest_4_4
;
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_ITERATED
9568 | OPTI_TYPE_NOT_SALTED
9569 | OPTI_TYPE_RAW_HASH
;
9576 case 4500: hash_type
= HASH_TYPE_SHA1
;
9577 salt_type
= SALT_TYPE_NONE
;
9578 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9579 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9580 | OPTS_TYPE_PT_ADD80
9581 | OPTS_TYPE_PT_ADDBITS15
;
9582 kern_type
= KERN_TYPE_SHA11
;
9583 dgst_size
= DGST_SIZE_4_5
;
9584 parse_func
= sha1_parse_hash
;
9585 sort_by_digest
= sort_by_digest_4_5
;
9586 opti_type
= OPTI_TYPE_ZERO_BYTE
9587 | OPTI_TYPE_PRECOMPUTE_INIT
9588 | OPTI_TYPE_PRECOMPUTE_MERKLE
9589 | OPTI_TYPE_EARLY_SKIP
9590 | OPTI_TYPE_NOT_SALTED
;
9597 case 4700: hash_type
= HASH_TYPE_SHA1
;
9598 salt_type
= SALT_TYPE_NONE
;
9599 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9601 | OPTS_TYPE_PT_ADD80
9602 | OPTS_TYPE_PT_ADDBITS14
;
9603 kern_type
= KERN_TYPE_SHA1_MD5
;
9604 dgst_size
= DGST_SIZE_4_5
;
9605 parse_func
= sha1_parse_hash
;
9606 sort_by_digest
= sort_by_digest_4_5
;
9607 opti_type
= OPTI_TYPE_ZERO_BYTE
9608 | OPTI_TYPE_PRECOMPUTE_INIT
9609 | OPTI_TYPE_PRECOMPUTE_MERKLE
9610 | OPTI_TYPE_EARLY_SKIP
9611 | OPTI_TYPE_NOT_ITERATED
9612 | OPTI_TYPE_NOT_SALTED
9613 | OPTI_TYPE_RAW_HASH
;
9620 case 4800: hash_type
= HASH_TYPE_MD5
;
9621 salt_type
= SALT_TYPE_EMBEDDED
;
9622 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9623 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9624 | OPTS_TYPE_PT_ADDBITS14
;
9625 kern_type
= KERN_TYPE_MD5_CHAP
;
9626 dgst_size
= DGST_SIZE_4_4
;
9627 parse_func
= chap_parse_hash
;
9628 sort_by_digest
= sort_by_digest_4_4
;
9629 opti_type
= OPTI_TYPE_ZERO_BYTE
9630 | OPTI_TYPE_PRECOMPUTE_INIT
9631 | OPTI_TYPE_PRECOMPUTE_MERKLE
9632 | OPTI_TYPE_MEET_IN_MIDDLE
9633 | OPTI_TYPE_EARLY_SKIP
9634 | OPTI_TYPE_NOT_ITERATED
9635 | OPTI_TYPE_RAW_HASH
;
9642 case 4900: hash_type
= HASH_TYPE_SHA1
;
9643 salt_type
= SALT_TYPE_INTERN
;
9644 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9645 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9646 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
9647 dgst_size
= DGST_SIZE_4_5
;
9648 parse_func
= sha1s_parse_hash
;
9649 sort_by_digest
= sort_by_digest_4_5
;
9650 opti_type
= OPTI_TYPE_ZERO_BYTE
9651 | OPTI_TYPE_PRECOMPUTE_INIT
9652 | OPTI_TYPE_PRECOMPUTE_MERKLE
9653 | OPTI_TYPE_EARLY_SKIP
;
9660 case 5000: hash_type
= HASH_TYPE_KECCAK
;
9661 salt_type
= SALT_TYPE_EMBEDDED
;
9662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9664 | OPTS_TYPE_PT_ADD01
;
9665 kern_type
= KERN_TYPE_KECCAK
;
9666 dgst_size
= DGST_SIZE_8_25
;
9667 parse_func
= keccak_parse_hash
;
9668 sort_by_digest
= sort_by_digest_8_25
;
9669 opti_type
= OPTI_TYPE_ZERO_BYTE
9670 | OPTI_TYPE_USES_BITS_64
9671 | OPTI_TYPE_RAW_HASH
;
9678 case 5100: hash_type
= HASH_TYPE_MD5H
;
9679 salt_type
= SALT_TYPE_NONE
;
9680 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9682 | OPTS_TYPE_PT_ADD80
9683 | OPTS_TYPE_PT_ADDBITS14
;
9684 kern_type
= KERN_TYPE_MD5H
;
9685 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9686 parse_func
= md5half_parse_hash
;
9687 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9688 opti_type
= OPTI_TYPE_ZERO_BYTE
9689 | OPTI_TYPE_RAW_HASH
;
9696 case 5200: hash_type
= HASH_TYPE_SHA256
;
9697 salt_type
= SALT_TYPE_EMBEDDED
;
9698 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9699 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9700 kern_type
= KERN_TYPE_PSAFE3
;
9701 dgst_size
= DGST_SIZE_4_8
;
9702 parse_func
= psafe3_parse_hash
;
9703 sort_by_digest
= sort_by_digest_4_8
;
9704 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9711 case 5300: hash_type
= HASH_TYPE_MD5
;
9712 salt_type
= SALT_TYPE_EMBEDDED
;
9713 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9714 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9715 | OPTS_TYPE_ST_ADD80
;
9716 kern_type
= KERN_TYPE_IKEPSK_MD5
;
9717 dgst_size
= DGST_SIZE_4_4
;
9718 parse_func
= ikepsk_md5_parse_hash
;
9719 sort_by_digest
= sort_by_digest_4_4
;
9720 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9727 case 5400: hash_type
= HASH_TYPE_SHA1
;
9728 salt_type
= SALT_TYPE_EMBEDDED
;
9729 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9730 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9731 | OPTS_TYPE_ST_ADD80
;
9732 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
9733 dgst_size
= DGST_SIZE_4_5
;
9734 parse_func
= ikepsk_sha1_parse_hash
;
9735 sort_by_digest
= sort_by_digest_4_5
;
9736 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9743 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
9744 salt_type
= SALT_TYPE_EMBEDDED
;
9745 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9746 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9747 | OPTS_TYPE_PT_ADD80
9748 | OPTS_TYPE_PT_ADDBITS14
9749 | OPTS_TYPE_PT_UNICODE
9751 kern_type
= KERN_TYPE_NETNTLMv1
;
9752 dgst_size
= DGST_SIZE_4_4
;
9753 parse_func
= netntlmv1_parse_hash
;
9754 sort_by_digest
= sort_by_digest_4_4
;
9755 opti_type
= OPTI_TYPE_ZERO_BYTE
9756 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9763 case 5600: hash_type
= HASH_TYPE_MD5
;
9764 salt_type
= SALT_TYPE_EMBEDDED
;
9765 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9766 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9767 | OPTS_TYPE_PT_ADD80
9768 | OPTS_TYPE_PT_ADDBITS14
9769 | OPTS_TYPE_PT_UNICODE
;
9770 kern_type
= KERN_TYPE_NETNTLMv2
;
9771 dgst_size
= DGST_SIZE_4_4
;
9772 parse_func
= netntlmv2_parse_hash
;
9773 sort_by_digest
= sort_by_digest_4_4
;
9774 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9781 case 5700: hash_type
= HASH_TYPE_SHA256
;
9782 salt_type
= SALT_TYPE_NONE
;
9783 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9784 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9785 | OPTS_TYPE_PT_ADD80
9786 | OPTS_TYPE_PT_ADDBITS15
;
9787 kern_type
= KERN_TYPE_SHA256
;
9788 dgst_size
= DGST_SIZE_4_8
;
9789 parse_func
= cisco4_parse_hash
;
9790 sort_by_digest
= sort_by_digest_4_8
;
9791 opti_type
= OPTI_TYPE_ZERO_BYTE
9792 | OPTI_TYPE_PRECOMPUTE_INIT
9793 | OPTI_TYPE_PRECOMPUTE_MERKLE
9794 | OPTI_TYPE_EARLY_SKIP
9795 | OPTI_TYPE_NOT_ITERATED
9796 | OPTI_TYPE_NOT_SALTED
9797 | OPTI_TYPE_RAW_HASH
;
9804 case 5800: hash_type
= HASH_TYPE_SHA1
;
9805 salt_type
= SALT_TYPE_INTERN
;
9806 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9807 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
9808 | OPTS_TYPE_ST_ADD80
;
9809 kern_type
= KERN_TYPE_ANDROIDPIN
;
9810 dgst_size
= DGST_SIZE_4_5
;
9811 parse_func
= androidpin_parse_hash
;
9812 sort_by_digest
= sort_by_digest_4_5
;
9813 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9820 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
9821 salt_type
= SALT_TYPE_NONE
;
9822 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9823 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9824 | OPTS_TYPE_PT_ADD80
;
9825 kern_type
= KERN_TYPE_RIPEMD160
;
9826 dgst_size
= DGST_SIZE_4_5
;
9827 parse_func
= ripemd160_parse_hash
;
9828 sort_by_digest
= sort_by_digest_4_5
;
9829 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9836 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
9837 salt_type
= SALT_TYPE_NONE
;
9838 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9839 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9840 | OPTS_TYPE_PT_ADD80
;
9841 kern_type
= KERN_TYPE_WHIRLPOOL
;
9842 dgst_size
= DGST_SIZE_4_16
;
9843 parse_func
= whirlpool_parse_hash
;
9844 sort_by_digest
= sort_by_digest_4_16
;
9845 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9852 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
9853 salt_type
= SALT_TYPE_EMBEDDED
;
9854 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9855 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9856 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9857 dgst_size
= DGST_SIZE_4_5
;
9858 parse_func
= truecrypt_parse_hash_2k
;
9859 sort_by_digest
= sort_by_digest_4_5
;
9860 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9867 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
9868 salt_type
= SALT_TYPE_EMBEDDED
;
9869 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9871 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9872 dgst_size
= DGST_SIZE_4_5
;
9873 parse_func
= truecrypt_parse_hash_2k
;
9874 sort_by_digest
= sort_by_digest_4_5
;
9875 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9882 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
9883 salt_type
= SALT_TYPE_EMBEDDED
;
9884 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9885 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9886 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9887 dgst_size
= DGST_SIZE_4_5
;
9888 parse_func
= truecrypt_parse_hash_2k
;
9889 sort_by_digest
= sort_by_digest_4_5
;
9890 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9897 case 6221: hash_type
= HASH_TYPE_SHA512
;
9898 salt_type
= SALT_TYPE_EMBEDDED
;
9899 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9901 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
9902 dgst_size
= DGST_SIZE_8_8
;
9903 parse_func
= truecrypt_parse_hash_1k
;
9904 sort_by_digest
= sort_by_digest_8_8
;
9905 opti_type
= OPTI_TYPE_ZERO_BYTE
9906 | OPTI_TYPE_USES_BITS_64
;
9913 case 6222: hash_type
= HASH_TYPE_SHA512
;
9914 salt_type
= SALT_TYPE_EMBEDDED
;
9915 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9916 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9917 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
9918 dgst_size
= DGST_SIZE_8_8
;
9919 parse_func
= truecrypt_parse_hash_1k
;
9920 sort_by_digest
= sort_by_digest_8_8
;
9921 opti_type
= OPTI_TYPE_ZERO_BYTE
9922 | OPTI_TYPE_USES_BITS_64
;
9929 case 6223: hash_type
= HASH_TYPE_SHA512
;
9930 salt_type
= SALT_TYPE_EMBEDDED
;
9931 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9932 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9933 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
9934 dgst_size
= DGST_SIZE_8_8
;
9935 parse_func
= truecrypt_parse_hash_1k
;
9936 sort_by_digest
= sort_by_digest_8_8
;
9937 opti_type
= OPTI_TYPE_ZERO_BYTE
9938 | OPTI_TYPE_USES_BITS_64
;
9945 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9946 salt_type
= SALT_TYPE_EMBEDDED
;
9947 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9948 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9949 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9950 dgst_size
= DGST_SIZE_4_8
;
9951 parse_func
= truecrypt_parse_hash_1k
;
9952 sort_by_digest
= sort_by_digest_4_8
;
9953 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9960 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9961 salt_type
= SALT_TYPE_EMBEDDED
;
9962 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9964 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9965 dgst_size
= DGST_SIZE_4_8
;
9966 parse_func
= truecrypt_parse_hash_1k
;
9967 sort_by_digest
= sort_by_digest_4_8
;
9968 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9975 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9976 salt_type
= SALT_TYPE_EMBEDDED
;
9977 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9978 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9979 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9980 dgst_size
= DGST_SIZE_4_8
;
9981 parse_func
= truecrypt_parse_hash_1k
;
9982 sort_by_digest
= sort_by_digest_4_8
;
9983 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9990 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9991 salt_type
= SALT_TYPE_EMBEDDED
;
9992 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9993 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9994 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9995 dgst_size
= DGST_SIZE_4_5
;
9996 parse_func
= truecrypt_parse_hash_1k
;
9997 sort_by_digest
= sort_by_digest_4_5
;
9998 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10005 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
10006 salt_type
= SALT_TYPE_EMBEDDED
;
10007 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10008 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10009 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10010 dgst_size
= DGST_SIZE_4_5
;
10011 parse_func
= truecrypt_parse_hash_1k
;
10012 sort_by_digest
= sort_by_digest_4_5
;
10013 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10020 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
10021 salt_type
= SALT_TYPE_EMBEDDED
;
10022 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10023 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10024 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10025 dgst_size
= DGST_SIZE_4_5
;
10026 parse_func
= truecrypt_parse_hash_1k
;
10027 sort_by_digest
= sort_by_digest_4_5
;
10028 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10035 case 6300: hash_type
= HASH_TYPE_MD5
;
10036 salt_type
= SALT_TYPE_EMBEDDED
;
10037 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10038 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10039 kern_type
= KERN_TYPE_MD5AIX
;
10040 dgst_size
= DGST_SIZE_4_4
;
10041 parse_func
= md5aix_parse_hash
;
10042 sort_by_digest
= sort_by_digest_4_4
;
10043 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10050 case 6400: hash_type
= HASH_TYPE_SHA256
;
10051 salt_type
= SALT_TYPE_EMBEDDED
;
10052 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10053 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10054 kern_type
= KERN_TYPE_SHA256AIX
;
10055 dgst_size
= DGST_SIZE_4_8
;
10056 parse_func
= sha256aix_parse_hash
;
10057 sort_by_digest
= sort_by_digest_4_8
;
10058 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10065 case 6500: hash_type
= HASH_TYPE_SHA512
;
10066 salt_type
= SALT_TYPE_EMBEDDED
;
10067 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10069 kern_type
= KERN_TYPE_SHA512AIX
;
10070 dgst_size
= DGST_SIZE_8_8
;
10071 parse_func
= sha512aix_parse_hash
;
10072 sort_by_digest
= sort_by_digest_8_8
;
10073 opti_type
= OPTI_TYPE_ZERO_BYTE
10074 | OPTI_TYPE_USES_BITS_64
;
10081 case 6600: hash_type
= HASH_TYPE_AES
;
10082 salt_type
= SALT_TYPE_EMBEDDED
;
10083 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10084 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10085 kern_type
= KERN_TYPE_AGILEKEY
;
10086 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10087 parse_func
= agilekey_parse_hash
;
10088 sort_by_digest
= sort_by_digest_4_5
;
10089 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10096 case 6700: hash_type
= HASH_TYPE_SHA1
;
10097 salt_type
= SALT_TYPE_EMBEDDED
;
10098 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10099 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10100 kern_type
= KERN_TYPE_SHA1AIX
;
10101 dgst_size
= DGST_SIZE_4_5
;
10102 parse_func
= sha1aix_parse_hash
;
10103 sort_by_digest
= sort_by_digest_4_5
;
10104 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10111 case 6800: hash_type
= HASH_TYPE_AES
;
10112 salt_type
= SALT_TYPE_EMBEDDED
;
10113 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10115 kern_type
= KERN_TYPE_LASTPASS
;
10116 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
10117 parse_func
= lastpass_parse_hash
;
10118 sort_by_digest
= sort_by_digest_4_8
;
10119 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10126 case 6900: hash_type
= HASH_TYPE_GOST
;
10127 salt_type
= SALT_TYPE_NONE
;
10128 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10129 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10130 kern_type
= KERN_TYPE_GOST
;
10131 dgst_size
= DGST_SIZE_4_8
;
10132 parse_func
= gost_parse_hash
;
10133 sort_by_digest
= sort_by_digest_4_8
;
10134 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10141 case 7100: hash_type
= HASH_TYPE_SHA512
;
10142 salt_type
= SALT_TYPE_EMBEDDED
;
10143 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10144 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10145 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10146 dgst_size
= DGST_SIZE_8_16
;
10147 parse_func
= sha512osx_parse_hash
;
10148 sort_by_digest
= sort_by_digest_8_16
;
10149 opti_type
= OPTI_TYPE_ZERO_BYTE
10150 | OPTI_TYPE_USES_BITS_64
10151 | OPTI_TYPE_SLOW_HASH_SIMD
;
10158 case 7200: hash_type
= HASH_TYPE_SHA512
;
10159 salt_type
= SALT_TYPE_EMBEDDED
;
10160 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10161 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10162 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10163 dgst_size
= DGST_SIZE_8_16
;
10164 parse_func
= sha512grub_parse_hash
;
10165 sort_by_digest
= sort_by_digest_8_16
;
10166 opti_type
= OPTI_TYPE_ZERO_BYTE
10167 | OPTI_TYPE_USES_BITS_64
10168 | OPTI_TYPE_SLOW_HASH_SIMD
;
10175 case 7300: hash_type
= HASH_TYPE_SHA1
;
10176 salt_type
= SALT_TYPE_EMBEDDED
;
10177 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10178 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10179 | OPTS_TYPE_ST_ADD80
10180 | OPTS_TYPE_ST_ADDBITS15
;
10181 kern_type
= KERN_TYPE_RAKP
;
10182 dgst_size
= DGST_SIZE_4_5
;
10183 parse_func
= rakp_parse_hash
;
10184 sort_by_digest
= sort_by_digest_4_5
;
10185 opti_type
= OPTI_TYPE_ZERO_BYTE
10186 | OPTI_TYPE_NOT_ITERATED
;
10193 case 7400: hash_type
= HASH_TYPE_SHA256
;
10194 salt_type
= SALT_TYPE_EMBEDDED
;
10195 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10196 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10197 kern_type
= KERN_TYPE_SHA256CRYPT
;
10198 dgst_size
= DGST_SIZE_4_8
;
10199 parse_func
= sha256crypt_parse_hash
;
10200 sort_by_digest
= sort_by_digest_4_8
;
10201 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10208 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
10209 salt_type
= SALT_TYPE_EMBEDDED
;
10210 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10211 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10212 kern_type
= KERN_TYPE_KRB5PA
;
10213 dgst_size
= DGST_SIZE_4_4
;
10214 parse_func
= krb5pa_parse_hash
;
10215 sort_by_digest
= sort_by_digest_4_4
;
10216 opti_type
= OPTI_TYPE_ZERO_BYTE
10217 | OPTI_TYPE_NOT_ITERATED
;
10224 case 7600: hash_type
= HASH_TYPE_SHA1
;
10225 salt_type
= SALT_TYPE_INTERN
;
10226 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10227 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10228 | OPTS_TYPE_PT_ADD80
10229 | OPTS_TYPE_PT_ADDBITS15
;
10230 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
10231 dgst_size
= DGST_SIZE_4_5
;
10232 parse_func
= redmine_parse_hash
;
10233 sort_by_digest
= sort_by_digest_4_5
;
10234 opti_type
= OPTI_TYPE_ZERO_BYTE
10235 | OPTI_TYPE_PRECOMPUTE_INIT
10236 | OPTI_TYPE_EARLY_SKIP
10237 | OPTI_TYPE_NOT_ITERATED
10238 | OPTI_TYPE_PREPENDED_SALT
;
10245 case 7700: hash_type
= HASH_TYPE_SAPB
;
10246 salt_type
= SALT_TYPE_EMBEDDED
;
10247 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10248 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10249 | OPTS_TYPE_PT_UPPER
10250 | OPTS_TYPE_ST_UPPER
;
10251 kern_type
= KERN_TYPE_SAPB
;
10252 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10253 parse_func
= sapb_parse_hash
;
10254 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10255 opti_type
= OPTI_TYPE_ZERO_BYTE
10256 | OPTI_TYPE_PRECOMPUTE_INIT
10257 | OPTI_TYPE_NOT_ITERATED
;
10264 case 7800: hash_type
= HASH_TYPE_SAPG
;
10265 salt_type
= SALT_TYPE_EMBEDDED
;
10266 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10267 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10268 | OPTS_TYPE_ST_ADD80
10269 | OPTS_TYPE_ST_UPPER
;
10270 kern_type
= KERN_TYPE_SAPG
;
10271 dgst_size
= DGST_SIZE_4_5
;
10272 parse_func
= sapg_parse_hash
;
10273 sort_by_digest
= sort_by_digest_4_5
;
10274 opti_type
= OPTI_TYPE_ZERO_BYTE
10275 | OPTI_TYPE_PRECOMPUTE_INIT
10276 | OPTI_TYPE_NOT_ITERATED
;
10283 case 7900: hash_type
= HASH_TYPE_SHA512
;
10284 salt_type
= SALT_TYPE_EMBEDDED
;
10285 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10287 kern_type
= KERN_TYPE_DRUPAL7
;
10288 dgst_size
= DGST_SIZE_8_8
;
10289 parse_func
= drupal7_parse_hash
;
10290 sort_by_digest
= sort_by_digest_8_8
;
10291 opti_type
= OPTI_TYPE_ZERO_BYTE
10292 | OPTI_TYPE_USES_BITS_64
;
10299 case 8000: hash_type
= HASH_TYPE_SHA256
;
10300 salt_type
= SALT_TYPE_EMBEDDED
;
10301 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10302 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10303 | OPTS_TYPE_PT_UNICODE
10304 | OPTS_TYPE_ST_ADD80
10305 | OPTS_TYPE_ST_HEX
;
10306 kern_type
= KERN_TYPE_SYBASEASE
;
10307 dgst_size
= DGST_SIZE_4_8
;
10308 parse_func
= sybasease_parse_hash
;
10309 sort_by_digest
= sort_by_digest_4_8
;
10310 opti_type
= OPTI_TYPE_ZERO_BYTE
10311 | OPTI_TYPE_PRECOMPUTE_INIT
10312 | OPTI_TYPE_EARLY_SKIP
10313 | OPTI_TYPE_NOT_ITERATED
10314 | OPTI_TYPE_RAW_HASH
;
10321 case 8100: hash_type
= HASH_TYPE_SHA1
;
10322 salt_type
= SALT_TYPE_EMBEDDED
;
10323 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
10325 kern_type
= KERN_TYPE_NETSCALER
;
10326 dgst_size
= DGST_SIZE_4_5
;
10327 parse_func
= netscaler_parse_hash
;
10328 sort_by_digest
= sort_by_digest_4_5
;
10329 opti_type
= OPTI_TYPE_ZERO_BYTE
10330 | OPTI_TYPE_PRECOMPUTE_INIT
10331 | OPTI_TYPE_PRECOMPUTE_MERKLE
10332 | OPTI_TYPE_EARLY_SKIP
10333 | OPTI_TYPE_NOT_ITERATED
10334 | OPTI_TYPE_PREPENDED_SALT
10335 | OPTI_TYPE_RAW_HASH
;
10342 case 8200: hash_type
= HASH_TYPE_SHA256
;
10343 salt_type
= SALT_TYPE_EMBEDDED
;
10344 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10345 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10346 kern_type
= KERN_TYPE_CLOUDKEY
;
10347 dgst_size
= DGST_SIZE_4_8
;
10348 parse_func
= cloudkey_parse_hash
;
10349 sort_by_digest
= sort_by_digest_4_8
;
10350 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10357 case 8300: hash_type
= HASH_TYPE_SHA1
;
10358 salt_type
= SALT_TYPE_EMBEDDED
;
10359 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10360 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10362 | OPTS_TYPE_ST_ADD80
;
10363 kern_type
= KERN_TYPE_NSEC3
;
10364 dgst_size
= DGST_SIZE_4_5
;
10365 parse_func
= nsec3_parse_hash
;
10366 sort_by_digest
= sort_by_digest_4_5
;
10367 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10374 case 8400: hash_type
= HASH_TYPE_SHA1
;
10375 salt_type
= SALT_TYPE_INTERN
;
10376 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10377 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10378 | OPTS_TYPE_PT_ADD80
10379 | OPTS_TYPE_PT_ADDBITS15
;
10380 kern_type
= KERN_TYPE_WBB3
;
10381 dgst_size
= DGST_SIZE_4_5
;
10382 parse_func
= wbb3_parse_hash
;
10383 sort_by_digest
= sort_by_digest_4_5
;
10384 opti_type
= OPTI_TYPE_ZERO_BYTE
10385 | OPTI_TYPE_PRECOMPUTE_INIT
10386 | OPTI_TYPE_NOT_ITERATED
;
10393 case 8500: hash_type
= HASH_TYPE_DESRACF
;
10394 salt_type
= SALT_TYPE_EMBEDDED
;
10395 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10396 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10397 | OPTS_TYPE_ST_UPPER
;
10398 kern_type
= KERN_TYPE_RACF
;
10399 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10400 parse_func
= racf_parse_hash
;
10401 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10402 opti_type
= OPTI_TYPE_ZERO_BYTE
10403 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10410 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
10411 salt_type
= SALT_TYPE_NONE
;
10412 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10414 kern_type
= KERN_TYPE_LOTUS5
;
10415 dgst_size
= DGST_SIZE_4_4
;
10416 parse_func
= lotus5_parse_hash
;
10417 sort_by_digest
= sort_by_digest_4_4
;
10418 opti_type
= OPTI_TYPE_EARLY_SKIP
10419 | OPTI_TYPE_NOT_ITERATED
10420 | OPTI_TYPE_NOT_SALTED
10421 | OPTI_TYPE_RAW_HASH
;
10428 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
10429 salt_type
= SALT_TYPE_EMBEDDED
;
10430 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10431 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10432 kern_type
= KERN_TYPE_LOTUS6
;
10433 dgst_size
= DGST_SIZE_4_4
;
10434 parse_func
= lotus6_parse_hash
;
10435 sort_by_digest
= sort_by_digest_4_4
;
10436 opti_type
= OPTI_TYPE_EARLY_SKIP
10437 | OPTI_TYPE_NOT_ITERATED
10438 | OPTI_TYPE_RAW_HASH
;
10445 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
10446 salt_type
= SALT_TYPE_EMBEDDED
;
10447 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10448 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10449 kern_type
= KERN_TYPE_ANDROIDFDE
;
10450 dgst_size
= DGST_SIZE_4_4
;
10451 parse_func
= androidfde_parse_hash
;
10452 sort_by_digest
= sort_by_digest_4_4
;
10453 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10460 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
10461 salt_type
= SALT_TYPE_EMBEDDED
;
10462 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10463 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10464 kern_type
= KERN_TYPE_SCRYPT
;
10465 dgst_size
= DGST_SIZE_4_8
;
10466 parse_func
= scrypt_parse_hash
;
10467 sort_by_digest
= sort_by_digest_4_8
;
10468 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10475 case 9000: hash_type
= HASH_TYPE_SHA1
;
10476 salt_type
= SALT_TYPE_EMBEDDED
;
10477 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10478 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10479 | OPTS_TYPE_ST_GENERATE_LE
;
10480 kern_type
= KERN_TYPE_PSAFE2
;
10481 dgst_size
= DGST_SIZE_4_5
;
10482 parse_func
= psafe2_parse_hash
;
10483 sort_by_digest
= sort_by_digest_4_5
;
10484 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10491 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
10492 salt_type
= SALT_TYPE_EMBEDDED
;
10493 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10494 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10495 kern_type
= KERN_TYPE_LOTUS8
;
10496 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10497 parse_func
= lotus8_parse_hash
;
10498 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10499 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10506 case 9200: hash_type
= HASH_TYPE_SHA256
;
10507 salt_type
= SALT_TYPE_EMBEDDED
;
10508 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10509 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10510 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10511 dgst_size
= DGST_SIZE_4_32
;
10512 parse_func
= cisco8_parse_hash
;
10513 sort_by_digest
= sort_by_digest_4_32
;
10514 opti_type
= OPTI_TYPE_ZERO_BYTE
10515 | OPTI_TYPE_SLOW_HASH_SIMD
;
10522 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
10523 salt_type
= SALT_TYPE_EMBEDDED
;
10524 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10525 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10526 kern_type
= KERN_TYPE_SCRYPT
;
10527 dgst_size
= DGST_SIZE_4_8
;
10528 parse_func
= cisco9_parse_hash
;
10529 sort_by_digest
= sort_by_digest_4_8
;
10530 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10537 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
10538 salt_type
= SALT_TYPE_EMBEDDED
;
10539 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10540 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10541 kern_type
= KERN_TYPE_OFFICE2007
;
10542 dgst_size
= DGST_SIZE_4_4
;
10543 parse_func
= office2007_parse_hash
;
10544 sort_by_digest
= sort_by_digest_4_4
;
10545 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10552 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
10553 salt_type
= SALT_TYPE_EMBEDDED
;
10554 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10555 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10556 kern_type
= KERN_TYPE_OFFICE2010
;
10557 dgst_size
= DGST_SIZE_4_4
;
10558 parse_func
= office2010_parse_hash
;
10559 sort_by_digest
= sort_by_digest_4_4
;
10560 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10567 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
10568 salt_type
= SALT_TYPE_EMBEDDED
;
10569 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10570 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10571 kern_type
= KERN_TYPE_OFFICE2013
;
10572 dgst_size
= DGST_SIZE_4_4
;
10573 parse_func
= office2013_parse_hash
;
10574 sort_by_digest
= sort_by_digest_4_4
;
10575 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10582 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
10583 salt_type
= SALT_TYPE_EMBEDDED
;
10584 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10585 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10586 | OPTS_TYPE_PT_ADD80
10587 | OPTS_TYPE_PT_UNICODE
;
10588 kern_type
= KERN_TYPE_OLDOFFICE01
;
10589 dgst_size
= DGST_SIZE_4_4
;
10590 parse_func
= oldoffice01_parse_hash
;
10591 sort_by_digest
= sort_by_digest_4_4
;
10592 opti_type
= OPTI_TYPE_ZERO_BYTE
10593 | OPTI_TYPE_PRECOMPUTE_INIT
10594 | OPTI_TYPE_NOT_ITERATED
;
10601 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
10602 salt_type
= SALT_TYPE_EMBEDDED
;
10603 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10605 | OPTS_TYPE_PT_ADD80
;
10606 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
10607 dgst_size
= DGST_SIZE_4_4
;
10608 parse_func
= oldoffice01cm1_parse_hash
;
10609 sort_by_digest
= sort_by_digest_4_4
;
10610 opti_type
= OPTI_TYPE_ZERO_BYTE
10611 | OPTI_TYPE_PRECOMPUTE_INIT
10612 | OPTI_TYPE_NOT_ITERATED
;
10619 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
10620 salt_type
= SALT_TYPE_EMBEDDED
;
10621 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10623 | OPTS_TYPE_PT_ADD80
10624 | OPTS_TYPE_PT_UNICODE
10625 | OPTS_TYPE_PT_NEVERCRACK
;
10626 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
10627 dgst_size
= DGST_SIZE_4_4
;
10628 parse_func
= oldoffice01cm2_parse_hash
;
10629 sort_by_digest
= sort_by_digest_4_4
;
10630 opti_type
= OPTI_TYPE_ZERO_BYTE
10631 | OPTI_TYPE_PRECOMPUTE_INIT
10632 | OPTI_TYPE_NOT_ITERATED
;
10639 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
10640 salt_type
= SALT_TYPE_EMBEDDED
;
10641 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10642 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10643 | OPTS_TYPE_PT_ADD80
10644 | OPTS_TYPE_PT_UNICODE
;
10645 kern_type
= KERN_TYPE_OLDOFFICE34
;
10646 dgst_size
= DGST_SIZE_4_4
;
10647 parse_func
= oldoffice34_parse_hash
;
10648 sort_by_digest
= sort_by_digest_4_4
;
10649 opti_type
= OPTI_TYPE_ZERO_BYTE
10650 | OPTI_TYPE_PRECOMPUTE_INIT
10651 | OPTI_TYPE_NOT_ITERATED
;
10658 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
10659 salt_type
= SALT_TYPE_EMBEDDED
;
10660 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10661 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10662 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
10663 dgst_size
= DGST_SIZE_4_4
;
10664 parse_func
= oldoffice34cm1_parse_hash
;
10665 sort_by_digest
= sort_by_digest_4_4
;
10666 opti_type
= OPTI_TYPE_ZERO_BYTE
10667 | OPTI_TYPE_PRECOMPUTE_INIT
10668 | OPTI_TYPE_NOT_ITERATED
;
10675 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
10676 salt_type
= SALT_TYPE_EMBEDDED
;
10677 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10678 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10679 | OPTS_TYPE_PT_ADD80
10680 | OPTS_TYPE_PT_UNICODE
10681 | OPTS_TYPE_PT_NEVERCRACK
;
10682 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
10683 dgst_size
= DGST_SIZE_4_4
;
10684 parse_func
= oldoffice34cm2_parse_hash
;
10685 sort_by_digest
= sort_by_digest_4_4
;
10686 opti_type
= OPTI_TYPE_ZERO_BYTE
10687 | OPTI_TYPE_PRECOMPUTE_INIT
10688 | OPTI_TYPE_NOT_ITERATED
;
10695 case 9900: hash_type
= HASH_TYPE_MD5
;
10696 salt_type
= SALT_TYPE_NONE
;
10697 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10698 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10699 kern_type
= KERN_TYPE_RADMIN2
;
10700 dgst_size
= DGST_SIZE_4_4
;
10701 parse_func
= radmin2_parse_hash
;
10702 sort_by_digest
= sort_by_digest_4_4
;
10703 opti_type
= OPTI_TYPE_ZERO_BYTE
10704 | OPTI_TYPE_PRECOMPUTE_INIT
10705 | OPTI_TYPE_EARLY_SKIP
10706 | OPTI_TYPE_NOT_ITERATED
10707 | OPTI_TYPE_NOT_SALTED
;
10714 case 10000: hash_type
= HASH_TYPE_SHA256
;
10715 salt_type
= SALT_TYPE_EMBEDDED
;
10716 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10717 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10718 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10719 dgst_size
= DGST_SIZE_4_32
;
10720 parse_func
= djangopbkdf2_parse_hash
;
10721 sort_by_digest
= sort_by_digest_4_32
;
10722 opti_type
= OPTI_TYPE_ZERO_BYTE
10723 | OPTI_TYPE_SLOW_HASH_SIMD
;
10730 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
10731 salt_type
= SALT_TYPE_EMBEDDED
;
10732 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10734 kern_type
= KERN_TYPE_SIPHASH
;
10735 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10736 parse_func
= siphash_parse_hash
;
10737 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10738 opti_type
= OPTI_TYPE_ZERO_BYTE
10739 | OPTI_TYPE_NOT_ITERATED
10740 | OPTI_TYPE_RAW_HASH
;
10747 case 10200: hash_type
= HASH_TYPE_MD5
;
10748 salt_type
= SALT_TYPE_EMBEDDED
;
10749 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10750 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10751 | OPTS_TYPE_ST_ADD80
10752 | OPTS_TYPE_ST_ADDBITS14
;
10753 kern_type
= KERN_TYPE_HMACMD5_PW
;
10754 dgst_size
= DGST_SIZE_4_4
;
10755 parse_func
= crammd5_parse_hash
;
10756 sort_by_digest
= sort_by_digest_4_4
;
10757 opti_type
= OPTI_TYPE_ZERO_BYTE
10758 | OPTI_TYPE_NOT_ITERATED
;
10765 case 10300: hash_type
= HASH_TYPE_SHA1
;
10766 salt_type
= SALT_TYPE_EMBEDDED
;
10767 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10768 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10769 kern_type
= KERN_TYPE_SAPH_SHA1
;
10770 dgst_size
= DGST_SIZE_4_5
;
10771 parse_func
= saph_sha1_parse_hash
;
10772 sort_by_digest
= sort_by_digest_4_5
;
10773 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10780 case 10400: hash_type
= HASH_TYPE_PDFU16
;
10781 salt_type
= SALT_TYPE_EMBEDDED
;
10782 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10783 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10784 kern_type
= KERN_TYPE_PDF11
;
10785 dgst_size
= DGST_SIZE_4_4
;
10786 parse_func
= pdf11_parse_hash
;
10787 sort_by_digest
= sort_by_digest_4_4
;
10788 opti_type
= OPTI_TYPE_ZERO_BYTE
10789 | OPTI_TYPE_NOT_ITERATED
;
10796 case 10410: hash_type
= HASH_TYPE_PDFU16
;
10797 salt_type
= SALT_TYPE_EMBEDDED
;
10798 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10799 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10800 kern_type
= KERN_TYPE_PDF11CM1
;
10801 dgst_size
= DGST_SIZE_4_4
;
10802 parse_func
= pdf11cm1_parse_hash
;
10803 sort_by_digest
= sort_by_digest_4_4
;
10804 opti_type
= OPTI_TYPE_ZERO_BYTE
10805 | OPTI_TYPE_NOT_ITERATED
;
10812 case 10420: hash_type
= HASH_TYPE_PDFU16
;
10813 salt_type
= SALT_TYPE_EMBEDDED
;
10814 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10815 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10816 kern_type
= KERN_TYPE_PDF11CM2
;
10817 dgst_size
= DGST_SIZE_4_4
;
10818 parse_func
= pdf11cm2_parse_hash
;
10819 sort_by_digest
= sort_by_digest_4_4
;
10820 opti_type
= OPTI_TYPE_ZERO_BYTE
10821 | OPTI_TYPE_NOT_ITERATED
;
10828 case 10500: hash_type
= HASH_TYPE_PDFU16
;
10829 salt_type
= SALT_TYPE_EMBEDDED
;
10830 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10831 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10832 kern_type
= KERN_TYPE_PDF14
;
10833 dgst_size
= DGST_SIZE_4_4
;
10834 parse_func
= pdf14_parse_hash
;
10835 sort_by_digest
= sort_by_digest_4_4
;
10836 opti_type
= OPTI_TYPE_ZERO_BYTE
10837 | OPTI_TYPE_NOT_ITERATED
;
10844 case 10600: hash_type
= HASH_TYPE_SHA256
;
10845 salt_type
= SALT_TYPE_EMBEDDED
;
10846 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10847 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10848 | OPTS_TYPE_ST_ADD80
10849 | OPTS_TYPE_ST_ADDBITS15
10850 | OPTS_TYPE_HASH_COPY
;
10851 kern_type
= KERN_TYPE_SHA256_PWSLT
;
10852 dgst_size
= DGST_SIZE_4_8
;
10853 parse_func
= pdf17l3_parse_hash
;
10854 sort_by_digest
= sort_by_digest_4_8
;
10855 opti_type
= OPTI_TYPE_ZERO_BYTE
10856 | OPTI_TYPE_PRECOMPUTE_INIT
10857 | OPTI_TYPE_PRECOMPUTE_MERKLE
10858 | OPTI_TYPE_EARLY_SKIP
10859 | OPTI_TYPE_NOT_ITERATED
10860 | OPTI_TYPE_APPENDED_SALT
10861 | OPTI_TYPE_RAW_HASH
;
10868 case 10700: hash_type
= HASH_TYPE_PDFU32
;
10869 salt_type
= SALT_TYPE_EMBEDDED
;
10870 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10871 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10872 | OPTS_TYPE_HASH_COPY
;
10873 kern_type
= KERN_TYPE_PDF17L8
;
10874 dgst_size
= DGST_SIZE_4_8
;
10875 parse_func
= pdf17l8_parse_hash
;
10876 sort_by_digest
= sort_by_digest_4_8
;
10877 opti_type
= OPTI_TYPE_ZERO_BYTE
10878 | OPTI_TYPE_NOT_ITERATED
;
10885 case 10800: hash_type
= HASH_TYPE_SHA384
;
10886 salt_type
= SALT_TYPE_NONE
;
10887 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10888 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10889 | OPTS_TYPE_PT_ADD80
10890 | OPTS_TYPE_PT_ADDBITS15
;
10891 kern_type
= KERN_TYPE_SHA384
;
10892 dgst_size
= DGST_SIZE_8_8
;
10893 parse_func
= sha384_parse_hash
;
10894 sort_by_digest
= sort_by_digest_8_8
;
10895 opti_type
= OPTI_TYPE_ZERO_BYTE
10896 | OPTI_TYPE_PRECOMPUTE_INIT
10897 | OPTI_TYPE_PRECOMPUTE_MERKLE
10898 | OPTI_TYPE_EARLY_SKIP
10899 | OPTI_TYPE_NOT_ITERATED
10900 | OPTI_TYPE_NOT_SALTED
10901 | OPTI_TYPE_USES_BITS_64
10902 | OPTI_TYPE_RAW_HASH
;
10909 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10910 salt_type
= SALT_TYPE_EMBEDDED
;
10911 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10912 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10913 | OPTS_TYPE_ST_BASE64
10914 | OPTS_TYPE_HASH_COPY
;
10915 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
10916 dgst_size
= DGST_SIZE_4_32
;
10917 parse_func
= pbkdf2_sha256_parse_hash
;
10918 sort_by_digest
= sort_by_digest_4_32
;
10919 opti_type
= OPTI_TYPE_ZERO_BYTE
10920 | OPTI_TYPE_SLOW_HASH_SIMD
;
10927 case 11000: hash_type
= HASH_TYPE_MD5
;
10928 salt_type
= SALT_TYPE_INTERN
;
10929 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10931 | OPTS_TYPE_PT_ADD80
;
10932 kern_type
= KERN_TYPE_PRESTASHOP
;
10933 dgst_size
= DGST_SIZE_4_4
;
10934 parse_func
= prestashop_parse_hash
;
10935 sort_by_digest
= sort_by_digest_4_4
;
10936 opti_type
= OPTI_TYPE_ZERO_BYTE
10937 | OPTI_TYPE_PRECOMPUTE_INIT
10938 | OPTI_TYPE_NOT_ITERATED
10939 | OPTI_TYPE_PREPENDED_SALT
;
10946 case 11100: hash_type
= HASH_TYPE_MD5
;
10947 salt_type
= SALT_TYPE_EMBEDDED
;
10948 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10949 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10950 | OPTS_TYPE_ST_ADD80
;
10951 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10952 dgst_size
= DGST_SIZE_4_4
;
10953 parse_func
= postgresql_auth_parse_hash
;
10954 sort_by_digest
= sort_by_digest_4_4
;
10955 opti_type
= OPTI_TYPE_ZERO_BYTE
10956 | OPTI_TYPE_PRECOMPUTE_INIT
10957 | OPTI_TYPE_PRECOMPUTE_MERKLE
10958 | OPTI_TYPE_EARLY_SKIP
;
10965 case 11200: hash_type
= HASH_TYPE_SHA1
;
10966 salt_type
= SALT_TYPE_EMBEDDED
;
10967 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10968 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10969 | OPTS_TYPE_PT_ADD80
10970 | OPTS_TYPE_ST_HEX
;
10971 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10972 dgst_size
= DGST_SIZE_4_5
;
10973 parse_func
= mysql_auth_parse_hash
;
10974 sort_by_digest
= sort_by_digest_4_5
;
10975 opti_type
= OPTI_TYPE_ZERO_BYTE
10976 | OPTI_TYPE_EARLY_SKIP
;
10983 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10984 salt_type
= SALT_TYPE_EMBEDDED
;
10985 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10986 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10988 | OPTS_TYPE_ST_ADD80
;
10989 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10990 dgst_size
= DGST_SIZE_4_4
;
10991 parse_func
= bitcoin_wallet_parse_hash
;
10992 sort_by_digest
= sort_by_digest_4_4
;
10993 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11000 case 11400: hash_type
= HASH_TYPE_MD5
;
11001 salt_type
= SALT_TYPE_EMBEDDED
;
11002 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11003 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11004 | OPTS_TYPE_PT_ADD80
11005 | OPTS_TYPE_HASH_COPY
;
11006 kern_type
= KERN_TYPE_SIP_AUTH
;
11007 dgst_size
= DGST_SIZE_4_4
;
11008 parse_func
= sip_auth_parse_hash
;
11009 sort_by_digest
= sort_by_digest_4_4
;
11010 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11017 case 11500: hash_type
= HASH_TYPE_CRC32
;
11018 salt_type
= SALT_TYPE_INTERN
;
11019 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11020 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11021 | OPTS_TYPE_ST_GENERATE_LE
11022 | OPTS_TYPE_ST_HEX
;
11023 kern_type
= KERN_TYPE_CRC32
;
11024 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11025 parse_func
= crc32_parse_hash
;
11026 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11027 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11034 case 11600: hash_type
= HASH_TYPE_AES
;
11035 salt_type
= SALT_TYPE_EMBEDDED
;
11036 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11037 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11038 | OPTS_TYPE_PT_NEVERCRACK
;
11039 kern_type
= KERN_TYPE_SEVEN_ZIP
;
11040 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
11041 parse_func
= seven_zip_parse_hash
;
11042 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
11043 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11050 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
11051 salt_type
= SALT_TYPE_NONE
;
11052 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11053 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11054 | OPTS_TYPE_PT_ADD01
;
11055 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
11056 dgst_size
= DGST_SIZE_4_8
;
11057 parse_func
= gost2012sbog_256_parse_hash
;
11058 sort_by_digest
= sort_by_digest_4_8
;
11059 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11066 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
11067 salt_type
= SALT_TYPE_NONE
;
11068 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11069 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11070 | OPTS_TYPE_PT_ADD01
;
11071 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
11072 dgst_size
= DGST_SIZE_4_16
;
11073 parse_func
= gost2012sbog_512_parse_hash
;
11074 sort_by_digest
= sort_by_digest_4_16
;
11075 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11082 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
11083 salt_type
= SALT_TYPE_EMBEDDED
;
11084 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11085 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11086 | OPTS_TYPE_ST_BASE64
11087 | OPTS_TYPE_HASH_COPY
;
11088 kern_type
= KERN_TYPE_PBKDF2_MD5
;
11089 dgst_size
= DGST_SIZE_4_32
;
11090 parse_func
= pbkdf2_md5_parse_hash
;
11091 sort_by_digest
= sort_by_digest_4_32
;
11092 opti_type
= OPTI_TYPE_ZERO_BYTE
11093 | OPTI_TYPE_SLOW_HASH_SIMD
;
11100 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11101 salt_type
= SALT_TYPE_EMBEDDED
;
11102 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11103 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11104 | OPTS_TYPE_ST_BASE64
11105 | OPTS_TYPE_HASH_COPY
;
11106 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
11107 dgst_size
= DGST_SIZE_4_32
;
11108 parse_func
= pbkdf2_sha1_parse_hash
;
11109 sort_by_digest
= sort_by_digest_4_32
;
11110 opti_type
= OPTI_TYPE_ZERO_BYTE
11111 | OPTI_TYPE_SLOW_HASH_SIMD
;
11118 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
11119 salt_type
= SALT_TYPE_EMBEDDED
;
11120 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11121 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11122 | OPTS_TYPE_ST_BASE64
11123 | OPTS_TYPE_HASH_COPY
;
11124 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
11125 dgst_size
= DGST_SIZE_8_16
;
11126 parse_func
= pbkdf2_sha512_parse_hash
;
11127 sort_by_digest
= sort_by_digest_8_16
;
11128 opti_type
= OPTI_TYPE_ZERO_BYTE
11129 | OPTI_TYPE_USES_BITS_64
11130 | OPTI_TYPE_SLOW_HASH_SIMD
;
11137 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
11138 salt_type
= SALT_TYPE_EMBEDDED
;
11139 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11140 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11141 kern_type
= KERN_TYPE_ECRYPTFS
;
11142 dgst_size
= DGST_SIZE_8_8
;
11143 parse_func
= ecryptfs_parse_hash
;
11144 sort_by_digest
= sort_by_digest_8_8
;
11145 opti_type
= OPTI_TYPE_ZERO_BYTE
11146 | OPTI_TYPE_USES_BITS_64
;
11153 case 12300: hash_type
= HASH_TYPE_ORACLET
;
11154 salt_type
= SALT_TYPE_EMBEDDED
;
11155 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11156 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11157 kern_type
= KERN_TYPE_ORACLET
;
11158 dgst_size
= DGST_SIZE_8_16
;
11159 parse_func
= oraclet_parse_hash
;
11160 sort_by_digest
= sort_by_digest_8_16
;
11161 opti_type
= OPTI_TYPE_ZERO_BYTE
11162 | OPTI_TYPE_USES_BITS_64
;
11169 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
11170 salt_type
= SALT_TYPE_EMBEDDED
;
11171 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11172 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11173 kern_type
= KERN_TYPE_BSDICRYPT
;
11174 dgst_size
= DGST_SIZE_4_4
;
11175 parse_func
= bsdicrypt_parse_hash
;
11176 sort_by_digest
= sort_by_digest_4_4
;
11177 opti_type
= OPTI_TYPE_ZERO_BYTE
11178 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
11185 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
11186 salt_type
= SALT_TYPE_EMBEDDED
;
11187 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11189 kern_type
= KERN_TYPE_RAR3
;
11190 dgst_size
= DGST_SIZE_4_4
;
11191 parse_func
= rar3hp_parse_hash
;
11192 sort_by_digest
= sort_by_digest_4_4
;
11193 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11200 case 12600: hash_type
= HASH_TYPE_SHA256
;
11201 salt_type
= SALT_TYPE_INTERN
;
11202 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11203 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11204 | OPTS_TYPE_PT_ADD80
;
11205 kern_type
= KERN_TYPE_CF10
;
11206 dgst_size
= DGST_SIZE_4_8
;
11207 parse_func
= cf10_parse_hash
;
11208 sort_by_digest
= sort_by_digest_4_8
;
11209 opti_type
= OPTI_TYPE_ZERO_BYTE
11210 | OPTI_TYPE_PRECOMPUTE_INIT
11211 | OPTI_TYPE_EARLY_SKIP
11212 | OPTI_TYPE_NOT_ITERATED
;
11219 case 12700: hash_type
= HASH_TYPE_AES
;
11220 salt_type
= SALT_TYPE_EMBEDDED
;
11221 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11222 opts_type
= OPTS_TYPE_PT_GENERATE_LE
11223 | OPTS_TYPE_HASH_COPY
;
11224 kern_type
= KERN_TYPE_MYWALLET
;
11225 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
11226 parse_func
= mywallet_parse_hash
;
11227 sort_by_digest
= sort_by_digest_4_5
;
11228 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11235 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11236 salt_type
= SALT_TYPE_EMBEDDED
;
11237 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11238 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11239 kern_type
= KERN_TYPE_MS_DRSR
;
11240 dgst_size
= DGST_SIZE_4_8
;
11241 parse_func
= ms_drsr_parse_hash
;
11242 sort_by_digest
= sort_by_digest_4_8
;
11243 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11250 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11251 salt_type
= SALT_TYPE_EMBEDDED
;
11252 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11253 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11254 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
11255 dgst_size
= DGST_SIZE_4_8
;
11256 parse_func
= androidfde_samsung_parse_hash
;
11257 sort_by_digest
= sort_by_digest_4_8
;
11258 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11265 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
11266 salt_type
= SALT_TYPE_EMBEDDED
;
11267 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11268 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11269 kern_type
= KERN_TYPE_RAR5
;
11270 dgst_size
= DGST_SIZE_4_4
;
11271 parse_func
= rar5_parse_hash
;
11272 sort_by_digest
= sort_by_digest_4_4
;
11273 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11280 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
11281 salt_type
= SALT_TYPE_EMBEDDED
;
11282 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11283 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11284 kern_type
= KERN_TYPE_KRB5TGS
;
11285 dgst_size
= DGST_SIZE_4_4
;
11286 parse_func
= krb5tgs_parse_hash
;
11287 sort_by_digest
= sort_by_digest_4_4
;
11288 opti_type
= OPTI_TYPE_ZERO_BYTE
11289 | OPTI_TYPE_NOT_ITERATED
;
11296 case 13200: hash_type
= HASH_TYPE_AES
;
11297 salt_type
= SALT_TYPE_EMBEDDED
;
11298 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11299 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11300 kern_type
= KERN_TYPE_AXCRYPT
;
11301 dgst_size
= DGST_SIZE_4_4
;
11302 parse_func
= axcrypt_parse_hash
;
11303 sort_by_digest
= sort_by_digest_4_4
;
11304 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11311 case 13300: hash_type
= HASH_TYPE_SHA1
;
11312 salt_type
= SALT_TYPE_NONE
;
11313 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11314 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11315 | OPTS_TYPE_PT_ADD80
11316 | OPTS_TYPE_PT_ADDBITS15
;
11317 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
11318 dgst_size
= DGST_SIZE_4_5
;
11319 parse_func
= sha1axcrypt_parse_hash
;
11320 sort_by_digest
= sort_by_digest_4_5
;
11321 opti_type
= OPTI_TYPE_ZERO_BYTE
11322 | OPTI_TYPE_PRECOMPUTE_INIT
11323 | OPTI_TYPE_EARLY_SKIP
11324 | OPTI_TYPE_NOT_ITERATED
11325 | OPTI_TYPE_NOT_SALTED
;
11332 case 13400: hash_type
= HASH_TYPE_AES
;
11333 salt_type
= SALT_TYPE_EMBEDDED
;
11334 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11335 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11336 kern_type
= KERN_TYPE_KEEPASS
;
11337 dgst_size
= DGST_SIZE_4_4
;
11338 parse_func
= keepass_parse_hash
;
11339 sort_by_digest
= sort_by_digest_4_4
;
11340 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11347 case 13500: hash_type
= HASH_TYPE_SHA1
;
11348 salt_type
= SALT_TYPE_EMBEDDED
;
11349 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11350 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11351 | OPTS_TYPE_PT_UNICODE
11352 | OPTS_TYPE_PT_ADD80
;
11353 kern_type
= KERN_TYPE_PSTOKEN
;
11354 dgst_size
= DGST_SIZE_4_5
;
11355 parse_func
= pstoken_parse_hash
;
11356 sort_by_digest
= sort_by_digest_4_5
;
11357 opti_type
= OPTI_TYPE_ZERO_BYTE
11358 | OPTI_TYPE_PRECOMPUTE_INIT
11359 | OPTI_TYPE_EARLY_SKIP
11360 | OPTI_TYPE_NOT_ITERATED
11361 | OPTI_TYPE_PREPENDED_SALT
11362 | OPTI_TYPE_RAW_HASH
;
11369 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
11370 salt_type
= SALT_TYPE_EMBEDDED
;
11371 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11372 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11373 kern_type
= KERN_TYPE_ZIP2
;
11374 dgst_size
= DGST_SIZE_4_4
;
11375 parse_func
= zip2_parse_hash
;
11376 sort_by_digest
= sort_by_digest_4_4
;
11377 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11384 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
11385 salt_type
= SALT_TYPE_EMBEDDED
;
11386 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11387 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11388 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11389 dgst_size
= DGST_SIZE_4_5
;
11390 parse_func
= veracrypt_parse_hash_655331
;
11391 sort_by_digest
= sort_by_digest_4_5
;
11392 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11399 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
11400 salt_type
= SALT_TYPE_EMBEDDED
;
11401 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11402 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11403 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11404 dgst_size
= DGST_SIZE_4_5
;
11405 parse_func
= veracrypt_parse_hash_655331
;
11406 sort_by_digest
= sort_by_digest_4_5
;
11407 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11414 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
11415 salt_type
= SALT_TYPE_EMBEDDED
;
11416 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11417 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11418 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11419 dgst_size
= DGST_SIZE_4_5
;
11420 parse_func
= veracrypt_parse_hash_655331
;
11421 sort_by_digest
= sort_by_digest_4_5
;
11422 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11429 case 13721: hash_type
= HASH_TYPE_SHA512
;
11430 salt_type
= SALT_TYPE_EMBEDDED
;
11431 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11432 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11433 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
11434 dgst_size
= DGST_SIZE_8_8
;
11435 parse_func
= veracrypt_parse_hash_500000
;
11436 sort_by_digest
= sort_by_digest_8_8
;
11437 opti_type
= OPTI_TYPE_ZERO_BYTE
11438 | OPTI_TYPE_USES_BITS_64
;
11445 case 13722: hash_type
= HASH_TYPE_SHA512
;
11446 salt_type
= SALT_TYPE_EMBEDDED
;
11447 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11448 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11449 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
11450 dgst_size
= DGST_SIZE_8_8
;
11451 parse_func
= veracrypt_parse_hash_500000
;
11452 sort_by_digest
= sort_by_digest_8_8
;
11453 opti_type
= OPTI_TYPE_ZERO_BYTE
11454 | OPTI_TYPE_USES_BITS_64
;
11461 case 13723: hash_type
= HASH_TYPE_SHA512
;
11462 salt_type
= SALT_TYPE_EMBEDDED
;
11463 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11464 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11465 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
11466 dgst_size
= DGST_SIZE_8_8
;
11467 parse_func
= veracrypt_parse_hash_500000
;
11468 sort_by_digest
= sort_by_digest_8_8
;
11469 opti_type
= OPTI_TYPE_ZERO_BYTE
11470 | OPTI_TYPE_USES_BITS_64
;
11477 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
11478 salt_type
= SALT_TYPE_EMBEDDED
;
11479 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11480 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11481 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
11482 dgst_size
= DGST_SIZE_4_8
;
11483 parse_func
= veracrypt_parse_hash_500000
;
11484 sort_by_digest
= sort_by_digest_4_8
;
11485 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11492 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
11493 salt_type
= SALT_TYPE_EMBEDDED
;
11494 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11495 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11496 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
11497 dgst_size
= DGST_SIZE_4_8
;
11498 parse_func
= veracrypt_parse_hash_500000
;
11499 sort_by_digest
= sort_by_digest_4_8
;
11500 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11507 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
11508 salt_type
= SALT_TYPE_EMBEDDED
;
11509 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11510 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11511 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
11512 dgst_size
= DGST_SIZE_4_8
;
11513 parse_func
= veracrypt_parse_hash_500000
;
11514 sort_by_digest
= sort_by_digest_4_8
;
11515 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11522 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
11523 salt_type
= SALT_TYPE_EMBEDDED
;
11524 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11525 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11526 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
11527 dgst_size
= DGST_SIZE_4_5
;
11528 parse_func
= veracrypt_parse_hash_327661
;
11529 sort_by_digest
= sort_by_digest_4_5
;
11530 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11537 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
11538 salt_type
= SALT_TYPE_EMBEDDED
;
11539 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11540 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11541 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
11542 dgst_size
= DGST_SIZE_4_5
;
11543 parse_func
= veracrypt_parse_hash_327661
;
11544 sort_by_digest
= sort_by_digest_4_5
;
11545 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11552 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
11553 salt_type
= SALT_TYPE_EMBEDDED
;
11554 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11555 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
11556 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
11557 dgst_size
= DGST_SIZE_4_5
;
11558 parse_func
= veracrypt_parse_hash_327661
;
11559 sort_by_digest
= sort_by_digest_4_5
;
11560 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11567 case 13751: hash_type
= HASH_TYPE_SHA256
;
11568 salt_type
= SALT_TYPE_EMBEDDED
;
11569 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11570 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11571 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11572 dgst_size
= DGST_SIZE_4_8
;
11573 parse_func
= veracrypt_parse_hash_500000
;
11574 sort_by_digest
= sort_by_digest_4_8
;
11575 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11582 case 13752: hash_type
= HASH_TYPE_SHA256
;
11583 salt_type
= SALT_TYPE_EMBEDDED
;
11584 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11585 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11586 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11587 dgst_size
= DGST_SIZE_4_8
;
11588 parse_func
= veracrypt_parse_hash_500000
;
11589 sort_by_digest
= sort_by_digest_4_8
;
11590 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11597 case 13753: hash_type
= HASH_TYPE_SHA256
;
11598 salt_type
= SALT_TYPE_EMBEDDED
;
11599 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11601 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11602 dgst_size
= DGST_SIZE_4_8
;
11603 parse_func
= veracrypt_parse_hash_500000
;
11604 sort_by_digest
= sort_by_digest_4_8
;
11605 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11612 case 13761: hash_type
= HASH_TYPE_SHA256
;
11613 salt_type
= SALT_TYPE_EMBEDDED
;
11614 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11615 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11616 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
11617 dgst_size
= DGST_SIZE_4_8
;
11618 parse_func
= veracrypt_parse_hash_200000
;
11619 sort_by_digest
= sort_by_digest_4_8
;
11620 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11627 case 13762: hash_type
= HASH_TYPE_SHA256
;
11628 salt_type
= SALT_TYPE_EMBEDDED
;
11629 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11630 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11631 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
11632 dgst_size
= DGST_SIZE_4_8
;
11633 parse_func
= veracrypt_parse_hash_200000
;
11634 sort_by_digest
= sort_by_digest_4_8
;
11635 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11642 case 13763: hash_type
= HASH_TYPE_SHA256
;
11643 salt_type
= SALT_TYPE_EMBEDDED
;
11644 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
11645 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
11646 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
11647 dgst_size
= DGST_SIZE_4_8
;
11648 parse_func
= veracrypt_parse_hash_200000
;
11649 sort_by_digest
= sort_by_digest_4_8
;
11650 opti_type
= OPTI_TYPE_ZERO_BYTE
;
11657 case 13800: hash_type
= HASH_TYPE_SHA256
;
11658 salt_type
= SALT_TYPE_EMBEDDED
;
11659 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
11660 opts_type
= OPTS_TYPE_PT_GENERATE_BE
11661 | OPTS_TYPE_PT_UNICODE
;
11662 kern_type
= KERN_TYPE_WIN8PHONE
;
11663 dgst_size
= DGST_SIZE_4_8
;
11664 parse_func
= win8phone_parse_hash
;
11665 sort_by_digest
= sort_by_digest_4_8
;
11666 opti_type
= OPTI_TYPE_ZERO_BYTE
11667 | OPTI_TYPE_PRECOMPUTE_INIT
11668 | OPTI_TYPE_EARLY_SKIP
11669 | OPTI_TYPE_NOT_ITERATED
11670 | OPTI_TYPE_RAW_HASH
;
11677 default: usage_mini_print (PROGNAME
); return -1;
11684 data
.parse_func
= parse_func
;
11692 if (salt_type
== SALT_TYPE_INTERN
)
11694 opts_type
|= OPTS_TYPE_ST_HEX
;
11698 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
11704 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
11705 | (salt_type
== SALT_TYPE_EXTERN
)
11706 | (salt_type
== SALT_TYPE_EMBEDDED
)
11707 | (salt_type
== SALT_TYPE_VIRTUAL
));
11709 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
11711 data
.hash_type
= hash_type
;
11712 data
.attack_mode
= attack_mode
;
11713 data
.attack_kern
= attack_kern
;
11714 data
.attack_exec
= attack_exec
;
11715 data
.kern_type
= kern_type
;
11716 data
.opts_type
= opts_type
;
11717 data
.dgst_size
= dgst_size
;
11718 data
.salt_type
= salt_type
;
11719 data
.isSalted
= isSalted
;
11720 data
.sort_by_digest
= sort_by_digest
;
11721 data
.dgst_pos0
= dgst_pos0
;
11722 data
.dgst_pos1
= dgst_pos1
;
11723 data
.dgst_pos2
= dgst_pos2
;
11724 data
.dgst_pos3
= dgst_pos3
;
11730 case 2500: esalt_size
= sizeof (wpa_t
); break;
11731 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
11732 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
11733 case 5500: esalt_size
= sizeof (netntlm_t
); break;
11734 case 5600: esalt_size
= sizeof (netntlm_t
); break;
11735 case 6211: esalt_size
= sizeof (tc_t
); break;
11736 case 6212: esalt_size
= sizeof (tc_t
); break;
11737 case 6213: esalt_size
= sizeof (tc_t
); break;
11738 case 6221: esalt_size
= sizeof (tc_t
); break;
11739 case 6222: esalt_size
= sizeof (tc_t
); break;
11740 case 6223: esalt_size
= sizeof (tc_t
); break;
11741 case 6231: esalt_size
= sizeof (tc_t
); break;
11742 case 6232: esalt_size
= sizeof (tc_t
); break;
11743 case 6233: esalt_size
= sizeof (tc_t
); break;
11744 case 6241: esalt_size
= sizeof (tc_t
); break;
11745 case 6242: esalt_size
= sizeof (tc_t
); break;
11746 case 6243: esalt_size
= sizeof (tc_t
); break;
11747 case 6600: esalt_size
= sizeof (agilekey_t
); break;
11748 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11749 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11750 case 7300: esalt_size
= sizeof (rakp_t
); break;
11751 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
11752 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
11753 case 8800: esalt_size
= sizeof (androidfde_t
); break;
11754 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11755 case 9400: esalt_size
= sizeof (office2007_t
); break;
11756 case 9500: esalt_size
= sizeof (office2010_t
); break;
11757 case 9600: esalt_size
= sizeof (office2013_t
); break;
11758 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
11759 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
11760 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
11761 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
11762 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
11763 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
11764 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11765 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
11766 case 10400: esalt_size
= sizeof (pdf_t
); break;
11767 case 10410: esalt_size
= sizeof (pdf_t
); break;
11768 case 10420: esalt_size
= sizeof (pdf_t
); break;
11769 case 10500: esalt_size
= sizeof (pdf_t
); break;
11770 case 10600: esalt_size
= sizeof (pdf_t
); break;
11771 case 10700: esalt_size
= sizeof (pdf_t
); break;
11772 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
11773 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
11774 case 11400: esalt_size
= sizeof (sip_t
); break;
11775 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
11776 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
11777 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
11778 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
11779 case 13000: esalt_size
= sizeof (rar5_t
); break;
11780 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
11781 case 13400: esalt_size
= sizeof (keepass_t
); break;
11782 case 13500: esalt_size
= sizeof (pstoken_t
); break;
11783 case 13600: esalt_size
= sizeof (zip2_t
); break;
11784 case 13711: esalt_size
= sizeof (tc_t
); break;
11785 case 13712: esalt_size
= sizeof (tc_t
); break;
11786 case 13713: esalt_size
= sizeof (tc_t
); break;
11787 case 13721: esalt_size
= sizeof (tc_t
); break;
11788 case 13722: esalt_size
= sizeof (tc_t
); break;
11789 case 13723: esalt_size
= sizeof (tc_t
); break;
11790 case 13731: esalt_size
= sizeof (tc_t
); break;
11791 case 13732: esalt_size
= sizeof (tc_t
); break;
11792 case 13733: esalt_size
= sizeof (tc_t
); break;
11793 case 13741: esalt_size
= sizeof (tc_t
); break;
11794 case 13742: esalt_size
= sizeof (tc_t
); break;
11795 case 13743: esalt_size
= sizeof (tc_t
); break;
11796 case 13751: esalt_size
= sizeof (tc_t
); break;
11797 case 13752: esalt_size
= sizeof (tc_t
); break;
11798 case 13753: esalt_size
= sizeof (tc_t
); break;
11799 case 13761: esalt_size
= sizeof (tc_t
); break;
11800 case 13762: esalt_size
= sizeof (tc_t
); break;
11801 case 13763: esalt_size
= sizeof (tc_t
); break;
11802 case 13800: esalt_size
= sizeof (win8phone_t
); break;
11805 data
.esalt_size
= esalt_size
;
11808 * choose dictionary parser
11811 if (hash_type
== HASH_TYPE_LM
)
11813 get_next_word_func
= get_next_word_lm
;
11815 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
11817 get_next_word_func
= get_next_word_uc
;
11821 get_next_word_func
= get_next_word_std
;
11828 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
11831 size_t dictstat_nmemb
= 0;
11835 uint dictstat_nmemb
= 0;
11838 char dictstat
[256] = { 0 };
11840 FILE *dictstat_fp
= NULL
;
11844 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
11846 dictstat_fp
= fopen (dictstat
, "rb");
11851 struct stat tmpstat
;
11853 fstat (fileno (dictstat_fp
), &tmpstat
);
11857 struct stat64 tmpstat
;
11859 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
11862 if (tmpstat
.st_mtime
< COMPTIME
)
11864 /* with v0.15 the format changed so we have to ensure user is using a good version
11865 since there is no version-header in the dictstat file */
11867 fclose (dictstat_fp
);
11873 while (!feof (dictstat_fp
))
11877 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
11879 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
11881 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
11883 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
11889 fclose (dictstat_fp
);
11898 char potfile
[256] = { 0 };
11900 if (potfile_path
== NULL
)
11902 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
11906 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
11909 data
.pot_fp
= NULL
;
11911 FILE *out_fp
= NULL
;
11912 FILE *pot_fp
= NULL
;
11914 if (show
== 1 || left
== 1)
11916 pot_fp
= fopen (potfile
, "rb");
11918 if (pot_fp
== NULL
)
11920 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11925 if (outfile
!= NULL
)
11927 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
11929 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
11943 if (potfile_disable
== 0)
11945 pot_fp
= fopen (potfile
, "ab");
11947 if (pot_fp
== NULL
)
11949 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
11954 data
.pot_fp
= pot_fp
;
11961 uint pot_avail
= 0;
11963 if (show
== 1 || left
== 1)
11965 SUPPRESS_OUTPUT
= 1;
11967 pot_avail
= count_lines (pot_fp
);
11971 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11973 uint pot_hashes_avail
= 0;
11977 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11979 while (!feof (pot_fp
))
11983 int line_len
= fgetl (pot_fp
, line_buf
);
11985 if (line_len
== 0) continue;
11987 char *plain_buf
= line_buf
+ line_len
;
11989 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11991 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11993 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11994 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11996 if (pot_cnt
== pot_hashes_avail
)
12000 for (pos
= 0; pos
< INCR_POT
; pos
++)
12002 if ((pot_cnt
+ pos
) >= pot_avail
) break;
12004 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
12006 hash_t
*tmp_hash
= &tmp_pot
->hash
;
12008 tmp_hash
->digest
= mymalloc (dgst_size
);
12012 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12017 tmp_hash
->esalt
= mymalloc (esalt_size
);
12020 pot_hashes_avail
++;
12028 int iter
= MAX_CUT_TRIES
;
12032 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
12034 if (line_buf
[i
] == ':')
12042 if (data
.hash_mode
!= 2500)
12044 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
12048 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
12050 if (line_len
> max_salt_size
)
12052 parser_status
= PARSER_GLOBAL_LENGTH
;
12056 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
12058 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
12060 hashes_buf
->salt
->salt_len
= line_len
;
12062 parser_status
= PARSER_OK
;
12066 // if NOT parsed without error, we add the ":" to the plain
12068 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
12074 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
12076 if (parser_status
< PARSER_GLOBAL_ZERO
)
12078 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
12083 if (plain_len
>= 255) continue;
12085 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
12087 pot_ptr
->plain_len
= plain_len
;
12096 SUPPRESS_OUTPUT
= 0;
12098 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
12105 uint pw_min
= PW_MIN
;
12106 uint pw_max
= PW_MAX
;
12110 case 125: if (pw_max
> 32) pw_max
= 32;
12112 case 400: if (pw_max
> 40) pw_max
= 40;
12114 case 500: if (pw_max
> 16) pw_max
= 16;
12116 case 1500: if (pw_max
> 8) pw_max
= 8;
12118 case 1600: if (pw_max
> 16) pw_max
= 16;
12120 case 1800: if (pw_max
> 16) pw_max
= 16;
12122 case 2100: if (pw_max
> 16) pw_max
= 16;
12124 case 2500: if (pw_min
< 8) pw_min
= 8;
12126 case 3000: if (pw_max
> 7) pw_max
= 7;
12128 case 5200: if (pw_max
> 24) pw_max
= 24;
12130 case 5800: if (pw_max
> 16) pw_max
= 16;
12132 case 6300: if (pw_max
> 16) pw_max
= 16;
12134 case 7400: if (pw_max
> 16) pw_max
= 16;
12136 case 7700: if (pw_max
> 8) pw_max
= 8;
12138 case 7900: if (pw_max
> 48) pw_max
= 48;
12140 case 8500: if (pw_max
> 8) pw_max
= 8;
12142 case 8600: if (pw_max
> 16) pw_max
= 16;
12144 case 9710: pw_min
= 5;
12147 case 9810: pw_min
= 5;
12150 case 10410: pw_min
= 5;
12153 case 10300: if (pw_max
< 3) pw_min
= 3;
12154 if (pw_max
> 40) pw_max
= 40;
12156 case 10500: if (pw_max
< 3) pw_min
= 3;
12157 if (pw_max
> 40) pw_max
= 40;
12159 case 10700: if (pw_max
> 16) pw_max
= 16;
12161 case 11300: if (pw_max
> 40) pw_max
= 40;
12163 case 11600: if (pw_max
> 32) pw_max
= 32;
12165 case 12500: if (pw_max
> 20) pw_max
= 20;
12167 case 12800: if (pw_max
> 24) pw_max
= 24;
12171 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12173 switch (attack_kern
)
12175 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12177 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
12183 * charsets : keep them together for more easy maintainnce
12186 cs_t mp_sys
[6] = { { { 0 }, 0 } };
12187 cs_t mp_usr
[4] = { { { 0 }, 0 } };
12189 mp_setup_sys (mp_sys
);
12191 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
12192 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
12193 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
12194 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
12197 * load hashes, part I: find input mode, count hashes
12200 uint hashlist_mode
= 0;
12201 uint hashlist_format
= HLFMT_HASHCAT
;
12203 uint hashes_avail
= 0;
12205 if ((benchmark
== 0) && (stdout_flag
== 0))
12209 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
12211 if ((hash_mode
== 2500) ||
12212 (hash_mode
== 5200) ||
12213 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
12214 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
12215 (hash_mode
== 9000))
12217 hashlist_mode
= HL_MODE_ARG
;
12219 char *hashfile
= myargv
[optind
];
12221 data
.hashfile
= hashfile
;
12223 logfile_top_var_string ("target", hashfile
);
12226 if (hashlist_mode
== HL_MODE_ARG
)
12228 if (hash_mode
== 2500)
12232 if (stat (data
.hashfile
, &st
) == -1)
12234 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
12239 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
12246 else if (hashlist_mode
== HL_MODE_FILE
)
12248 char *hashfile
= myargv
[optind
];
12250 data
.hashfile
= hashfile
;
12252 logfile_top_var_string ("target", hashfile
);
12256 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12258 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12263 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
12265 hashes_avail
= count_lines (fp
);
12269 if (hashes_avail
== 0)
12271 log_error ("ERROR: hashfile is empty or corrupt");
12278 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
12280 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
12282 log_error ("ERROR: remove not supported in native hashfile-format mode");
12294 hashlist_mode
= HL_MODE_ARG
;
12299 if (hash_mode
== 3000) hashes_avail
*= 2;
12301 data
.hashlist_mode
= hashlist_mode
;
12302 data
.hashlist_format
= hashlist_format
;
12304 logfile_top_uint (hashlist_mode
);
12305 logfile_top_uint (hashlist_format
);
12308 * load hashes, part II: allocate required memory, set pointers
12311 hash_t
*hashes_buf
= NULL
;
12312 void *digests_buf
= NULL
;
12313 salt_t
*salts_buf
= NULL
;
12314 void *esalts_buf
= NULL
;
12316 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
12318 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
12320 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12324 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12326 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
12328 hashes_buf
[hash_pos
].hash_info
= hash_info
;
12330 if (username
&& (remove
|| show
|| left
))
12332 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
12337 hash_info
->orighash
= (char *) mymalloc (256);
12344 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12348 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
12353 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12356 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
12358 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
12362 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
12366 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
12371 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
12376 * load hashes, part III: parse hashes or generate them if benchmark
12379 uint hashes_cnt
= 0;
12381 if (benchmark
== 0)
12385 // useless to read hash file for keyspace, cheat a little bit w/ optind
12387 else if (stdout_flag
== 1)
12389 // useless to read hash file for stdout, cheat a little bit w/ optind
12391 else if (hashes_avail
== 0)
12394 else if (hashlist_mode
== HL_MODE_ARG
)
12396 char *input_buf
= myargv
[optind
];
12398 uint input_len
= strlen (input_buf
);
12400 logfile_top_var_string ("target", input_buf
);
12402 char *hash_buf
= NULL
;
12405 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
12407 bool hash_fmt_error
= 0;
12409 if (hash_len
< 1) hash_fmt_error
= 1;
12410 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12412 if (hash_fmt_error
)
12414 log_info ("WARNING: Failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12418 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12420 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12422 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12427 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
12430 int parser_status
= PARSER_OK
;
12432 if (hash_mode
== 2500)
12436 log_error ("ERROR: hccap file not specified");
12441 hashlist_mode
= HL_MODE_FILE
;
12443 data
.hashlist_mode
= hashlist_mode
;
12445 FILE *fp
= fopen (hash_buf
, "rb");
12449 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
12454 if (hashes_avail
< 1)
12456 log_error ("ERROR: hccap file is empty or corrupt");
12463 uint hccap_size
= sizeof (hccap_t
);
12465 char *in
= (char *) mymalloc (hccap_size
);
12469 int n
= fread (in
, hccap_size
, 1, fp
);
12473 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
12478 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
12480 if (parser_status
!= PARSER_OK
)
12482 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
12487 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
12489 if ((show
== 1) || (left
== 1))
12491 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
12493 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
12495 int cur_pos
= tmp_salt
->salt_len
;
12496 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12498 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
12500 // do the appending task
12502 snprintf (salt_ptr
+ cur_pos
,
12504 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
12516 wpa
->orig_mac2
[5]);
12518 // memset () the remaining part of the salt
12520 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
12521 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
12523 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
12525 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
12528 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
);
12529 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
);
12538 else if (hash_mode
== 3000)
12540 if (hash_len
== 32)
12542 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12544 hash_t
*lm_hash_left
= NULL
;
12546 if (parser_status
== PARSER_OK
)
12548 lm_hash_left
= &hashes_buf
[hashes_cnt
];
12554 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12557 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12559 hash_t
*lm_hash_right
= NULL
;
12561 if (parser_status
== PARSER_OK
)
12563 lm_hash_right
= &hashes_buf
[hashes_cnt
];
12569 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12574 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
12576 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
);
12577 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
);
12582 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12584 if (parser_status
== PARSER_OK
)
12586 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12587 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12590 if (parser_status
== PARSER_OK
)
12596 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12602 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12604 if (parser_status
== PARSER_OK
)
12606 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12607 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12610 if (parser_status
== PARSER_OK
)
12616 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
12621 else if (hashlist_mode
== HL_MODE_FILE
)
12623 char *hashfile
= data
.hashfile
;
12627 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
12629 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
12636 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12642 int line_len
= fgetl (fp
, line_buf
);
12644 if (line_len
== 0) continue;
12646 char *hash_buf
= NULL
;
12649 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
12651 bool hash_fmt_error
= 0;
12653 if (hash_len
< 1) hash_fmt_error
= 1;
12654 if (hash_buf
== NULL
) hash_fmt_error
= 1;
12656 if (hash_fmt_error
)
12658 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
12665 char *user_buf
= NULL
;
12668 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
12670 if (remove
|| show
)
12672 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
12674 *user
= (user_t
*) mymalloc (sizeof (user_t
));
12676 user_t
*user_ptr
= *user
;
12678 if (user_buf
!= NULL
)
12680 user_ptr
->user_name
= mystrdup (user_buf
);
12684 user_ptr
->user_name
= mystrdup ("");
12687 user_ptr
->user_len
= user_len
;
12691 if (opts_type
& OPTS_TYPE_HASH_COPY
)
12693 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
12695 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
12700 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
12703 if (hash_mode
== 3000)
12705 if (hash_len
== 32)
12707 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
12709 if (parser_status
< PARSER_GLOBAL_ZERO
)
12711 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12716 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
12720 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
12722 if (parser_status
< PARSER_GLOBAL_ZERO
)
12724 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12729 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
12731 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);
12737 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
);
12738 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
);
12742 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12744 if (parser_status
< PARSER_GLOBAL_ZERO
)
12746 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12751 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
12753 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12754 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12761 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
12763 if (parser_status
< PARSER_GLOBAL_ZERO
)
12765 log_info ("WARNING: Hashfile '%s' on line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
12770 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);
12772 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12773 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
12783 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
12785 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
12792 hashes_buf
[0].salt
->salt_len
= 8;
12794 // special salt handling
12798 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
12799 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
12801 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
12803 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
12805 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
12807 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
12809 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
12811 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
12813 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
12815 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
12817 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
12819 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
12820 hashes_buf
[0].salt
->scrypt_N
= 1024;
12821 hashes_buf
[0].salt
->scrypt_r
= 1;
12822 hashes_buf
[0].salt
->scrypt_p
= 1;
12824 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
12826 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
12827 hashes_buf
[0].salt
->scrypt_N
= 16384;
12828 hashes_buf
[0].salt
->scrypt_r
= 1;
12829 hashes_buf
[0].salt
->scrypt_p
= 1;
12831 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
12833 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
12835 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
12837 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
12839 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
12841 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
12843 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
12845 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
12847 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
12849 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
12851 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
12853 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
12855 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
12857 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
12859 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
12863 // special esalt handling
12867 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
12869 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12870 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12872 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
12873 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
12875 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12876 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12877 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12878 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12880 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
12881 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
12882 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
12883 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
12885 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
12887 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12888 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12889 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12891 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12892 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12893 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12895 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12896 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12897 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12899 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12900 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
12901 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
12903 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12904 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12905 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12907 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
12908 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
12909 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
12911 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
12912 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
12913 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
12915 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
12917 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
12919 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
12920 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
12921 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
12930 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
12932 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
12934 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
12936 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
12938 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
12940 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
12942 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
12944 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
12946 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
12948 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
12950 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
12952 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
12954 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
12956 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
12958 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
12960 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
12962 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
12964 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12966 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12968 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12970 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12972 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12974 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12976 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12978 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12980 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12982 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12984 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12986 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12988 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12990 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12992 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12994 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12996 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12998 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
13000 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
13004 // set default iterations
13008 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
13010 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13012 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13014 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13016 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
13018 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
13020 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
13022 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
13024 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
13026 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
13028 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13030 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13032 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
13034 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13036 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13038 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13040 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13042 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13044 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13046 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13048 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13050 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
13052 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
13054 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
13056 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
13058 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
13060 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
13062 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
13064 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
13066 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
13068 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
13070 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
13072 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
13074 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
13076 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
13078 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
13080 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
13082 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
13084 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
13086 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
13088 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
13090 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
13092 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
13094 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
13096 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
13098 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
13100 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
13102 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
13104 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
13106 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
13108 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
13110 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
13112 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
13114 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
13116 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
13118 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
13120 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
13122 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
13124 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
13126 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
13128 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
13130 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
13132 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
13134 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
13136 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13138 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13140 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
13142 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13144 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13146 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13148 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13150 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13152 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13154 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13156 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13158 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
13160 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13162 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13164 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
13166 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13168 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13170 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
13177 if (show
== 1 || left
== 1)
13179 for (uint i
= 0; i
< pot_cnt
; i
++)
13181 pot_t
*pot_ptr
= &pot
[i
];
13183 hash_t
*hashes_buf
= &pot_ptr
->hash
;
13185 local_free (hashes_buf
->digest
);
13189 local_free (hashes_buf
->salt
);
13195 if (data
.quiet
== 0) log_info_nn ("");
13200 if ((keyspace
== 0) && (stdout_flag
== 0))
13202 if (hashes_cnt
== 0)
13204 log_error ("ERROR: No hashes loaded");
13211 * Sanity check for hashfile vs outfile (should not point to the same physical file)
13214 if (data
.outfile
!= NULL
)
13216 if (data
.hashfile
!= NULL
)
13219 struct stat tmpstat_outfile
;
13220 struct stat tmpstat_hashfile
;
13224 struct stat64 tmpstat_outfile
;
13225 struct stat64 tmpstat_hashfile
;
13228 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
13230 if (tmp_outfile_fp
)
13233 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13237 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
13240 fclose (tmp_outfile_fp
);
13243 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
13245 if (tmp_hashfile_fp
)
13248 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13252 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
13255 fclose (tmp_hashfile_fp
);
13258 if (tmp_outfile_fp
&& tmp_outfile_fp
)
13260 tmpstat_outfile
.st_mode
= 0;
13261 tmpstat_outfile
.st_nlink
= 0;
13262 tmpstat_outfile
.st_uid
= 0;
13263 tmpstat_outfile
.st_gid
= 0;
13264 tmpstat_outfile
.st_rdev
= 0;
13265 tmpstat_outfile
.st_atime
= 0;
13267 tmpstat_hashfile
.st_mode
= 0;
13268 tmpstat_hashfile
.st_nlink
= 0;
13269 tmpstat_hashfile
.st_uid
= 0;
13270 tmpstat_hashfile
.st_gid
= 0;
13271 tmpstat_hashfile
.st_rdev
= 0;
13272 tmpstat_hashfile
.st_atime
= 0;
13275 tmpstat_outfile
.st_blksize
= 0;
13276 tmpstat_outfile
.st_blocks
= 0;
13278 tmpstat_hashfile
.st_blksize
= 0;
13279 tmpstat_hashfile
.st_blocks
= 0;
13283 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
13285 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13292 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
13294 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
13304 * Remove duplicates
13307 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
13311 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13315 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13318 uint hashes_cnt_orig
= hashes_cnt
;
13322 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
13326 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
13328 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13333 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
13336 if (hashes_pos
> hashes_cnt
)
13338 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
13348 uint potfile_remove_cracks
= 0;
13350 if (potfile_disable
== 0)
13354 hash_buf
.digest
= mymalloc (dgst_size
);
13355 hash_buf
.salt
= NULL
;
13356 hash_buf
.esalt
= NULL
;
13357 hash_buf
.hash_info
= NULL
;
13358 hash_buf
.cracked
= 0;
13362 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
13367 hash_buf
.esalt
= mymalloc (esalt_size
);
13370 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
13372 // no solution for these special hash types (for instane because they use hashfile in output etc)
13373 if ((hash_mode
!= 5200) &&
13374 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
13375 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
13376 (hash_mode
!= 9000))
13378 FILE *fp
= fopen (potfile
, "rb");
13382 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
13384 // to be safe work with a copy (because of line_len loop, i etc)
13385 // moved up here because it's easier to handle continue case
13388 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
13392 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
13394 if (ptr
== NULL
) break;
13396 int line_len
= strlen (line_buf
);
13398 if (line_len
== 0) continue;
13400 int iter
= MAX_CUT_TRIES
;
13402 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
13404 if (line_buf
[i
] != ':') continue;
13408 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
13411 hash_t
*found
= NULL
;
13413 if (hash_mode
== 6800)
13415 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13417 // manipulate salt_buf
13418 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
13420 hash_buf
.salt
->salt_len
= i
;
13422 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
13425 else if (hash_mode
== 2500)
13427 if (i
< 64) // 64 = 16 * uint in salt_buf[]
13429 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
13430 // manipulate salt_buf
13432 memset (line_buf_cpy
, 0, HCBUFSIZ
);
13433 memcpy (line_buf_cpy
, line_buf
, i
);
13435 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
13437 if (mac2_pos
== NULL
) continue;
13442 if (strlen (mac2_pos
) != 12) continue;
13444 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
13446 if (mac1_pos
== NULL
) continue;
13451 if (strlen (mac1_pos
) != 12) continue;
13453 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
13455 // here we need the ESSID
13456 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
13458 hash_buf
.salt
->salt_len
= essid_length
;
13460 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
13464 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
13466 // compare hex string(s) vs binary MAC address(es)
13468 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13470 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
13479 if (!found
) continue;
13481 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
13483 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
13495 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
13497 if (parser_status
== PARSER_OK
)
13501 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
13505 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
13510 if (found
== NULL
) continue;
13512 if (!found
->cracked
) potfile_remove_cracks
++;
13514 found
->cracked
= 1;
13522 myfree (line_buf_cpy
);
13532 local_free (hash_buf
.esalt
);
13537 local_free (hash_buf
.salt
);
13540 local_free (hash_buf
.digest
);
13544 * Now generate all the buffers required for later
13547 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
13549 salt_t
*salts_buf_new
= NULL
;
13550 void *esalts_buf_new
= NULL
;
13554 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
13558 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
13563 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
13566 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
13568 uint digests_cnt
= hashes_cnt
;
13569 uint digests_done
= 0;
13571 size_t size_digests
= digests_cnt
* dgst_size
;
13572 size_t size_shown
= digests_cnt
* sizeof (uint
);
13574 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
13575 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
13577 uint salts_cnt
= 0;
13578 uint salts_done
= 0;
13580 hashinfo_t
**hash_info
= NULL
;
13582 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13584 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
13586 if (username
&& (remove
|| show
))
13590 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
13592 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
13594 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
13599 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
13604 // copied from inner loop
13606 salt_buf
= &salts_buf_new
[salts_cnt
];
13608 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
13612 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
13615 salt_buf
->digests_cnt
= 0;
13616 salt_buf
->digests_done
= 0;
13617 salt_buf
->digests_offset
= 0;
13622 if (hashes_buf
[0].cracked
== 1)
13624 digests_shown
[0] = 1;
13628 salt_buf
->digests_done
++;
13631 salt_buf
->digests_cnt
++;
13633 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
13635 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13637 hash_info
[0] = hashes_buf
[0].hash_info
;
13640 // copy from inner loop
13642 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
13646 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
13648 salt_buf
= &salts_buf_new
[salts_cnt
];
13650 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
13654 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
13657 salt_buf
->digests_cnt
= 0;
13658 salt_buf
->digests_done
= 0;
13659 salt_buf
->digests_offset
= hashes_pos
;
13665 if (hashes_buf
[hashes_pos
].cracked
== 1)
13667 digests_shown
[hashes_pos
] = 1;
13671 salt_buf
->digests_done
++;
13674 salt_buf
->digests_cnt
++;
13676 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
13678 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
13680 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
13684 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
13686 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
13688 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
13690 salts_shown
[salt_pos
] = 1;
13695 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
13698 local_free (digests_buf
);
13699 local_free (salts_buf
);
13700 local_free (esalts_buf
);
13702 digests_buf
= digests_buf_new
;
13703 salts_buf
= salts_buf_new
;
13704 esalts_buf
= esalts_buf_new
;
13706 local_free (hashes_buf
);
13709 * special modification not set from parser
13714 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13715 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13716 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13717 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13718 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13719 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13720 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13721 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13722 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13723 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13724 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13725 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13726 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13727 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13728 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13729 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13730 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13731 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13732 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13733 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13734 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13735 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13736 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13737 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13738 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13739 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13740 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13741 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
13742 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
13743 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
13746 if (truecrypt_keyfiles
)
13748 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13750 char *keyfiles
= strdup (truecrypt_keyfiles
);
13752 char *keyfile
= strtok (keyfiles
, ",");
13756 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13758 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13763 if (veracrypt_keyfiles
)
13765 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
13767 char *keyfiles
= strdup (veracrypt_keyfiles
);
13769 char *keyfile
= strtok (keyfiles
, ",");
13773 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
13775 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
13780 data
.digests_cnt
= digests_cnt
;
13781 data
.digests_done
= digests_done
;
13782 data
.digests_buf
= digests_buf
;
13783 data
.digests_shown
= digests_shown
;
13784 data
.digests_shown_tmp
= digests_shown_tmp
;
13786 data
.salts_cnt
= salts_cnt
;
13787 data
.salts_done
= salts_done
;
13788 data
.salts_buf
= salts_buf
;
13789 data
.salts_shown
= salts_shown
;
13791 data
.esalts_buf
= esalts_buf
;
13792 data
.hash_info
= hash_info
;
13795 * Automatic Optimizers
13798 if (salts_cnt
== 1)
13799 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
13801 if (digests_cnt
== 1)
13802 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
13804 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
13805 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
13807 if (attack_mode
== ATTACK_MODE_BF
)
13808 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
13810 data
.opti_type
= opti_type
;
13812 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
13814 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13816 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
13818 if (opts_type
& OPTS_TYPE_ST_ADD80
)
13820 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
13821 opts_type
|= OPTS_TYPE_PT_ADD80
;
13824 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
13826 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
13827 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
13830 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
13832 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
13833 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
13840 * Some algorithm, like descrypt, can benefit from JIT compilation
13843 int force_jit_compilation
= -1;
13845 if (hash_mode
== 8900)
13847 force_jit_compilation
= 8900;
13849 else if (hash_mode
== 9300)
13851 force_jit_compilation
= 8900;
13853 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
13855 force_jit_compilation
= 1500;
13859 * generate bitmap tables
13862 const uint bitmap_shift1
= 5;
13863 const uint bitmap_shift2
= 13;
13865 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
13867 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13868 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13869 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13870 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13871 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13872 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13873 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13874 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1u << bitmap_max
) * sizeof (uint
));
13881 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
13883 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
13885 bitmap_nums
= 1u << bitmap_bits
;
13887 bitmap_mask
= bitmap_nums
- 1;
13889 bitmap_size
= bitmap_nums
* sizeof (uint
);
13891 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
13893 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;
13894 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;
13899 bitmap_nums
= 1u << bitmap_bits
;
13901 bitmap_mask
= bitmap_nums
- 1;
13903 bitmap_size
= bitmap_nums
* sizeof (uint
);
13905 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);
13906 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);
13909 * prepare quick rule
13912 data
.rule_buf_l
= rule_buf_l
;
13913 data
.rule_buf_r
= rule_buf_r
;
13915 int rule_len_l
= (int) strlen (rule_buf_l
);
13916 int rule_len_r
= (int) strlen (rule_buf_r
);
13918 data
.rule_len_l
= rule_len_l
;
13919 data
.rule_len_r
= rule_len_r
;
13925 uint
*all_kernel_rules_cnt
= NULL
;
13927 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
13931 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
13933 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
13936 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
13940 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13942 uint kernel_rules_avail
= 0;
13944 uint kernel_rules_cnt
= 0;
13946 kernel_rule_t
*kernel_rules_buf
= NULL
;
13948 char *rp_file
= rp_files
[i
];
13950 char in
[BLOCK_SIZE
] = { 0 };
13951 char out
[BLOCK_SIZE
] = { 0 };
13955 uint rule_line
= 0;
13957 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
13959 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13966 memset (rule_buf
, 0, HCBUFSIZ
);
13968 rule_len
= fgetl (fp
, rule_buf
);
13972 if (rule_len
== 0) continue;
13974 if (rule_buf
[0] == '#') continue;
13976 if (kernel_rules_avail
== kernel_rules_cnt
)
13978 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13980 kernel_rules_avail
+= INCR_RULES
;
13983 memset (in
, 0, BLOCK_SIZE
);
13984 memset (out
, 0, BLOCK_SIZE
);
13986 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13990 log_info ("WARNING: Skipping invalid or unsupported rule in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13995 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13997 log_info ("WARNING: Cannot convert rule for use on OpenCL device in file %s on line %u: %s", rp_file
, rule_line
, rule_buf
);
13999 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
14005 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
14007 log_info ("Duplicate rule for use on OpenCL device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
14013 kernel_rules_cnt
++;
14018 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
14020 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
14024 * merge rules or automatic rule generator
14027 uint kernel_rules_cnt
= 0;
14029 kernel_rule_t
*kernel_rules_buf
= NULL
;
14031 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14035 kernel_rules_cnt
= 1;
14037 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
14039 repeats
[0] = kernel_rules_cnt
;
14041 for (uint i
= 0; i
< rp_files_cnt
; i
++)
14043 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
14045 repeats
[i
+ 1] = kernel_rules_cnt
;
14048 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
14050 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
14052 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
14056 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
14058 for (uint j
= 0; j
< rp_files_cnt
; j
++)
14060 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
14063 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
14065 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
14067 if (out_pos
== RULES_MAX
- 1)
14069 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
14074 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
14079 local_free (repeats
);
14083 uint kernel_rules_avail
= 0;
14085 while (kernel_rules_cnt
< rp_gen
)
14087 if (kernel_rules_avail
== kernel_rules_cnt
)
14089 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
14091 kernel_rules_avail
+= INCR_RULES
;
14094 memset (rule_buf
, 0, HCBUFSIZ
);
14096 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
14098 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
14100 kernel_rules_cnt
++;
14108 * generate NOP rules
14111 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
14113 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
14115 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
14117 kernel_rules_cnt
++;
14120 data
.kernel_rules_cnt
= kernel_rules_cnt
;
14121 data
.kernel_rules_buf
= kernel_rules_buf
;
14123 if (kernel_rules_cnt
== 0)
14125 log_error ("ERROR: No valid rules left");
14131 * OpenCL platforms: detect
14134 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
14135 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
14137 cl_uint platforms_cnt
= 0;
14138 cl_uint platform_devices_cnt
= 0;
14142 cl_int CL_err
= hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
14144 if (CL_err
!= CL_SUCCESS
)
14146 log_error ("ERROR: clGetPlatformIDs(): %s\n", val2cstr_cl (CL_err
));
14151 if (platforms_cnt
== 0)
14154 log_info ("ATTENTION! No OpenCL compatible platform found");
14156 log_info ("You're probably missing the OpenCL runtime installation");
14157 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
14158 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
14159 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
14165 if (opencl_platforms_filter
!= (uint
) -1)
14167 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
14169 if (opencl_platforms_filter
> platform_cnt_mask
)
14171 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
14178 if (opencl_device_types
== NULL
)
14181 * OpenCL device types:
14182 * 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.
14185 cl_device_type device_types_all
= 0;
14187 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14189 if ((opencl_platforms_filter
& (1u << platform_id
)) == 0) continue;
14191 cl_platform_id platform
= platforms
[platform_id
];
14193 cl_int CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14195 if (CL_err
!= CL_SUCCESS
)
14197 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14201 // Silently ignore at this point, it will be reused later and create a note for the user at that point
14206 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14208 cl_device_id device
= platform_devices
[platform_devices_id
];
14210 cl_device_type device_type
;
14212 cl_int CL_err
= hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14214 if (CL_err
!= CL_SUCCESS
)
14216 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14221 device_types_all
|= device_type
;
14225 // In such a case, automatically enable CPU device type support, since it's disabled by default.
14227 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
14229 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
14232 // In another case, when the user uses --stdout, using CPU devices is much faster to setup
14233 // If we have a CPU device, force it to be used
14235 if (stdout_flag
== 1)
14237 if (device_types_all
& CL_DEVICE_TYPE_CPU
)
14239 device_types_filter
= CL_DEVICE_TYPE_CPU
;
14245 * OpenCL devices: simply push all devices from all platforms into the same device array
14249 int need_nvapi
= 0;
14251 int need_xnvctrl
= 0;
14253 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
14255 data
.devices_param
= devices_param
;
14257 uint devices_cnt
= 0;
14259 uint devices_active
= 0;
14261 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
14263 cl_int CL_err
= CL_SUCCESS
;
14265 cl_platform_id platform
= platforms
[platform_id
];
14267 char platform_vendor
[INFOSZ
] = { 0 };
14269 CL_err
= hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
14271 if (CL_err
!= CL_SUCCESS
)
14273 log_error ("ERROR: clGetPlatformInfo(): %s\n", val2cstr_cl (CL_err
));
14278 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
14279 // this causes trouble with vendor id based macros
14280 // we'll assign generic to those without special optimization available
14282 cl_uint platform_vendor_id
= 0;
14284 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
14286 platform_vendor_id
= VENDOR_ID_AMD
;
14288 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14290 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14292 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
14294 platform_vendor_id
= VENDOR_ID_APPLE
;
14296 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14298 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14300 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14302 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
14304 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
14306 platform_vendor_id
= VENDOR_ID_MESA
;
14308 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
14310 platform_vendor_id
= VENDOR_ID_NV
;
14312 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
14314 platform_vendor_id
= VENDOR_ID_POCL
;
14318 platform_vendor_id
= VENDOR_ID_GENERIC
;
14321 uint platform_skipped
= ((opencl_platforms_filter
& (1u << platform_id
)) == 0);
14323 CL_err
= hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
14325 if (CL_err
!= CL_SUCCESS
)
14327 //log_error ("ERROR: clGetDeviceIDs(): %s\n", val2cstr_cl (CL_err));
14331 platform_skipped
= 2;
14334 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14336 if (machine_readable
== 0)
14338 if (platform_skipped
== 0)
14340 const int len
= log_info ("OpenCL Platform #%u: %s", platform_id
+ 1, platform_vendor
);
14342 char line
[256] = { 0 };
14344 for (int i
= 0; i
< len
; i
++) line
[i
] = '=';
14348 else if (platform_skipped
== 1)
14350 log_info ("OpenCL Platform #%u: %s, skipped", platform_id
+ 1, platform_vendor
);
14353 else if (platform_skipped
== 2)
14355 log_info ("OpenCL Platform #%u: %s, skipped! No OpenCL compatible devices found", platform_id
+ 1, platform_vendor
);
14361 if (platform_skipped
== 1) continue;
14362 if (platform_skipped
== 2) continue;
14364 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
14366 size_t param_value_size
= 0;
14368 const uint device_id
= devices_cnt
;
14370 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14372 device_param
->platform_vendor_id
= platform_vendor_id
;
14374 device_param
->device
= platform_devices
[platform_devices_id
];
14376 device_param
->device_id
= device_id
;
14378 device_param
->platform_devices_id
= platform_devices_id
;
14380 device_param
->platform
= platform
;
14384 cl_device_type device_type
;
14386 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
14388 if (CL_err
!= CL_SUCCESS
)
14390 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14395 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
14397 device_param
->device_type
= device_type
;
14401 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
14403 if (CL_err
!= CL_SUCCESS
)
14405 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14410 char *device_name
= (char *) mymalloc (param_value_size
);
14412 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
14414 if (CL_err
!= CL_SUCCESS
)
14416 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14421 device_param
->device_name
= device_name
;
14425 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
14427 if (CL_err
!= CL_SUCCESS
)
14429 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14434 char *device_vendor
= (char *) mymalloc (param_value_size
);
14436 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
14438 if (CL_err
!= CL_SUCCESS
)
14440 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14445 device_param
->device_vendor
= device_vendor
;
14447 cl_uint device_vendor_id
= 0;
14449 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
14451 device_vendor_id
= VENDOR_ID_AMD
;
14453 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
14455 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
14457 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
14459 device_vendor_id
= VENDOR_ID_APPLE
;
14461 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
14463 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
14465 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
14467 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
14469 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
14471 device_vendor_id
= VENDOR_ID_MESA
;
14473 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
14475 device_vendor_id
= VENDOR_ID_NV
;
14477 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
14479 device_vendor_id
= VENDOR_ID_POCL
;
14483 device_vendor_id
= VENDOR_ID_GENERIC
;
14486 device_param
->device_vendor_id
= device_vendor_id
;
14490 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
14494 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
14496 if (CL_err
!= CL_SUCCESS
)
14498 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14503 char *device_version
= (char *) mymalloc (param_value_size
);
14505 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
14507 if (CL_err
!= CL_SUCCESS
)
14509 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14514 device_param
->device_version
= device_version
;
14516 // device_opencl_version
14518 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
14520 if (CL_err
!= CL_SUCCESS
)
14522 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14527 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
14529 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
14531 if (CL_err
!= CL_SUCCESS
)
14533 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14538 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
14540 myfree (device_opencl_version
);
14544 cl_uint vector_width
;
14546 if (opencl_vector_width_chgd
== 0)
14548 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
14550 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
14552 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
14554 if (CL_err
!= CL_SUCCESS
)
14556 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14563 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
14565 if (CL_err
!= CL_SUCCESS
)
14567 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14575 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
14580 vector_width
= opencl_vector_width
;
14583 if (vector_width
> 16) vector_width
= 16;
14585 device_param
->vector_width
= vector_width
;
14587 // max_compute_units
14589 cl_uint device_processors
;
14591 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
14593 if (CL_err
!= CL_SUCCESS
)
14595 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14600 device_param
->device_processors
= device_processors
;
14602 // device_maxmem_alloc
14603 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
14605 cl_ulong device_maxmem_alloc
;
14607 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
14609 if (CL_err
!= CL_SUCCESS
)
14611 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14616 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
14618 // device_global_mem
14620 cl_ulong device_global_mem
;
14622 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
14624 if (CL_err
!= CL_SUCCESS
)
14626 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14631 device_param
->device_global_mem
= device_global_mem
;
14633 // max_work_group_size
14635 size_t device_maxworkgroup_size
;
14637 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
14639 if (CL_err
!= CL_SUCCESS
)
14641 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14646 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
14648 // max_clock_frequency
14650 cl_uint device_maxclock_frequency
;
14652 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
14654 if (CL_err
!= CL_SUCCESS
)
14656 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14661 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
14663 // device_endian_little
14665 cl_bool device_endian_little
;
14667 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
14669 if (CL_err
!= CL_SUCCESS
)
14671 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14676 if (device_endian_little
== CL_FALSE
)
14678 log_info ("- Device #%u: WARNING: Not a little endian device", device_id
+ 1);
14680 device_param
->skipped
= 1;
14683 // device_available
14685 cl_bool device_available
;
14687 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
14689 if (CL_err
!= CL_SUCCESS
)
14691 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14696 if (device_available
== CL_FALSE
)
14698 log_info ("- Device #%u: WARNING: Device not available", device_id
+ 1);
14700 device_param
->skipped
= 1;
14703 // device_compiler_available
14705 cl_bool device_compiler_available
;
14707 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
14709 if (CL_err
!= CL_SUCCESS
)
14711 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14716 if (device_compiler_available
== CL_FALSE
)
14718 log_info ("- Device #%u: WARNING: No compiler available for device", device_id
+ 1);
14720 device_param
->skipped
= 1;
14723 // device_execution_capabilities
14725 cl_device_exec_capabilities device_execution_capabilities
;
14727 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
14729 if (CL_err
!= CL_SUCCESS
)
14731 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14736 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
14738 log_info ("- Device #%u: WARNING: Device does not support executing kernels", device_id
+ 1);
14740 device_param
->skipped
= 1;
14743 // device_extensions
14745 size_t device_extensions_size
;
14747 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
14749 if (CL_err
!= CL_SUCCESS
)
14751 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14756 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
14758 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
14760 if (CL_err
!= CL_SUCCESS
)
14762 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14767 if (strstr (device_extensions
, "base_atomics") == 0)
14769 log_info ("- Device #%u: WARNING: Device does not support base atomics", device_id
+ 1);
14771 device_param
->skipped
= 1;
14774 if (strstr (device_extensions
, "byte_addressable_store") == 0)
14776 log_info ("- Device #%u: WARNING: Device does not support byte addressable store", device_id
+ 1);
14778 device_param
->skipped
= 1;
14781 myfree (device_extensions
);
14783 // device_local_mem_size
14785 cl_ulong device_local_mem_size
;
14787 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
14789 if (CL_err
!= CL_SUCCESS
)
14791 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14796 if (device_local_mem_size
< 32768)
14798 log_info ("- Device #%u: WARNING: Device local mem size is too small", device_id
+ 1);
14800 device_param
->skipped
= 1;
14803 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
14804 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
14805 // This results in both utilizing it for 50%
14806 // However, Intel has much better SIMD control over their own hardware
14807 // It makes sense to give them full control over their own hardware
14809 if (device_type
& CL_DEVICE_TYPE_CPU
)
14811 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
14813 if (data
.force
== 0)
14815 if (algorithm_pos
== 0)
14817 log_info ("- Device #%u: WARNING: Not a native Intel OpenCL runtime, expect massive speed loss", device_id
+ 1);
14818 log_info (" You can use --force to override this but do not post error reports if you do so");
14821 device_param
->skipped
= 1;
14828 device_param
->skipped
|= ((devices_filter
& (1u << device_id
)) == 0);
14829 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
14833 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
14835 if (CL_err
!= CL_SUCCESS
)
14837 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14842 char *driver_version
= (char *) mymalloc (param_value_size
);
14844 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
14846 if (CL_err
!= CL_SUCCESS
)
14848 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14853 device_param
->driver_version
= driver_version
;
14855 // device_name_chksum
14857 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
14860 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
);
14862 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
);
14865 uint device_name_digest
[4] = { 0 };
14867 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
14869 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
14871 device_param
->device_name_chksum
= device_name_chksum
;
14875 if (device_param
->device_type
& CL_DEVICE_TYPE_GPU
)
14877 if ((device_param
->platform_vendor_id
== VENDOR_ID_AMD
) && (device_param
->device_vendor_id
== VENDOR_ID_AMD
))
14882 if ((device_param
->platform_vendor_id
== VENDOR_ID_NV
) && (device_param
->device_vendor_id
== VENDOR_ID_NV
))
14896 if (device_type
& CL_DEVICE_TYPE_GPU
)
14898 if (device_vendor_id
== VENDOR_ID_NV
)
14900 cl_uint kernel_exec_timeout
= 0;
14902 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
14904 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
14906 if (CL_err
!= CL_SUCCESS
)
14908 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14913 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
14915 cl_uint sm_minor
= 0;
14916 cl_uint sm_major
= 0;
14918 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
14919 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
14921 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
14923 if (CL_err
!= CL_SUCCESS
)
14925 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14930 CL_err
= hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
14932 if (CL_err
!= CL_SUCCESS
)
14934 log_error ("ERROR: clGetDeviceInfo(): %s\n", val2cstr_cl (CL_err
));
14939 device_param
->sm_minor
= sm_minor
;
14940 device_param
->sm_major
= sm_major
;
14942 // CPU burning loop damper
14943 // Value is given as number between 0-100
14946 device_param
->nvidia_spin_damp
= (double) nvidia_spin_damp
;
14948 if (nvidia_spin_damp_chgd
== 0)
14950 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
14953 * the workaround is not a friend of rule based attacks
14954 * the words from the wordlist combined with fast and slow rules cause
14955 * fluctuations which cause inaccurate wait time estimations
14956 * using a reduced damping percentage almost compensates this
14959 device_param
->nvidia_spin_damp
= 64;
14963 device_param
->nvidia_spin_damp
/= 100;
14969 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
14971 if (machine_readable
== 0)
14973 if (device_param
->skipped
== 0)
14975 log_info ("- Device #%u: %s, %lu/%lu MB allocatable, %uMCU",
14978 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
14979 (unsigned int) (device_global_mem
/ 1024 / 1024),
14980 (unsigned int) device_processors
);
14984 log_info ("- Device #%u: %s, skipped",
14991 // common driver check
14993 if (device_param
->skipped
== 0)
14995 if (device_type
& CL_DEVICE_TYPE_GPU
)
14997 if (platform_vendor_id
== VENDOR_ID_AMD
)
14999 int catalyst_check
= (force
== 1) ? 0 : 1;
15001 int catalyst_warn
= 0;
15003 int catalyst_broken
= 0;
15005 if (catalyst_check
== 1)
15009 // v14.9 and higher
15010 if (atoi (device_param
->driver_version
) >= 1573)
15015 catalyst_check
= 0;
15018 if (catalyst_broken
== 1)
15021 log_info ("ATTENTION! The Catalyst driver installed on your system is known to be broken!");
15022 log_info ("It passes over cracked hashes and will not report them as cracked");
15023 log_info ("You are STRONGLY encouraged not to use it");
15024 log_info ("You can use --force to override this but do not post error reports if you do so");
15030 if (catalyst_warn
== 1)
15033 log_info ("ATTENTION! Unsupported or incorrectly installed Catalyst driver detected!");
15034 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver");
15035 log_info ("See hashcat's homepage for official supported catalyst drivers");
15037 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
15039 log_info ("You can use --force to override this but do not post error reports if you do so");
15045 else if (platform_vendor_id
== VENDOR_ID_NV
)
15047 if (device_param
->kernel_exec_timeout
!= 0)
15049 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);
15050 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
15055 /* turns out pocl still creates segfaults (because of llvm)
15056 if (device_type & CL_DEVICE_TYPE_CPU)
15058 if (platform_vendor_id == VENDOR_ID_AMD)
15063 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
15064 log_info ("You are STRONGLY encouraged not to use it");
15065 log_info ("You can use --force to override this but do not post error reports if you do so");
15066 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
15076 * kernel accel and loops tuning db adjustment
15079 device_param
->kernel_accel_min
= 1;
15080 device_param
->kernel_accel_max
= 1024;
15082 device_param
->kernel_loops_min
= 1;
15083 device_param
->kernel_loops_max
= 1024;
15085 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
15087 if (tuningdb_entry
)
15089 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
15090 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
15094 device_param
->kernel_accel_min
= _kernel_accel
;
15095 device_param
->kernel_accel_max
= _kernel_accel
;
15100 if (workload_profile
== 1)
15102 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
15104 else if (workload_profile
== 2)
15106 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
15109 device_param
->kernel_loops_min
= _kernel_loops
;
15110 device_param
->kernel_loops_max
= _kernel_loops
;
15114 // commandline parameters overwrite tuningdb entries
15118 device_param
->kernel_accel_min
= kernel_accel
;
15119 device_param
->kernel_accel_max
= kernel_accel
;
15124 device_param
->kernel_loops_min
= kernel_loops
;
15125 device_param
->kernel_loops_max
= kernel_loops
;
15140 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
15142 if (machine_readable
== 0)
15149 if (keyspace
== 0 && devices_active
== 0)
15151 log_error ("ERROR: No devices found/left");
15156 // 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)
15158 if (devices_filter
!= (uint
) -1)
15160 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
15162 if (devices_filter
> devices_cnt_mask
)
15164 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
15170 data
.devices_cnt
= devices_cnt
;
15172 data
.devices_active
= devices_active
;
15179 hm_attrs_t hm_adapters_adl
[DEVICES_MAX
];
15180 hm_attrs_t hm_adapters_nvapi
[DEVICES_MAX
];
15181 hm_attrs_t hm_adapters_nvml
[DEVICES_MAX
];
15182 hm_attrs_t hm_adapters_xnvctrl
[DEVICES_MAX
];
15184 memset (hm_adapters_adl
, 0, sizeof (hm_adapters_adl
));
15185 memset (hm_adapters_nvapi
, 0, sizeof (hm_adapters_nvapi
));
15186 memset (hm_adapters_nvml
, 0, sizeof (hm_adapters_nvml
));
15187 memset (hm_adapters_xnvctrl
, 0, sizeof (hm_adapters_xnvctrl
));
15189 if (gpu_temp_disable
== 0)
15191 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
15192 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
15193 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
15194 XNVCTRL_PTR
*xnvctrl
= (XNVCTRL_PTR
*) mymalloc (sizeof (XNVCTRL_PTR
));
15196 data
.hm_adl
= NULL
;
15197 data
.hm_nvapi
= NULL
;
15198 data
.hm_nvml
= NULL
;
15199 data
.hm_xnvctrl
= NULL
;
15201 if ((need_nvml
== 1) && (nvml_init (nvml
) == 0))
15203 data
.hm_nvml
= nvml
;
15208 if (hm_NVML_nvmlInit (data
.hm_nvml
) == NVML_SUCCESS
)
15210 HM_ADAPTER_NVML nvmlGPUHandle
[DEVICES_MAX
] = { 0 };
15212 int tmp_in
= hm_get_adapter_index_nvml (nvmlGPUHandle
);
15216 for (int i
= 0; i
< tmp_in
; i
++)
15218 hm_adapters_nvml
[tmp_out
++].nvml
= nvmlGPUHandle
[i
];
15221 for (int i
= 0; i
< tmp_out
; i
++)
15223 unsigned int speed
;
15225 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nvml
, 0, hm_adapters_nvml
[i
].nvml
, &speed
) == NVML_SUCCESS
) hm_adapters_nvml
[i
].fan_get_supported
= 1;
15227 // doesn't seem to create any advantages
15228 //hm_NVML_nvmlDeviceSetComputeMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_COMPUTEMODE_EXCLUSIVE_PROCESS);
15229 //hm_NVML_nvmlDeviceSetGpuOperationMode (data.hm_nvml, 1, hm_adapters_nvml[i].nvml, NVML_GOM_ALL_ON);
15234 if ((need_nvapi
== 1) && (nvapi_init (nvapi
) == 0))
15236 data
.hm_nvapi
= nvapi
;
15241 if (hm_NvAPI_Initialize (data
.hm_nvapi
) == NVAPI_OK
)
15243 HM_ADAPTER_NVAPI nvGPUHandle
[DEVICES_MAX
] = { 0 };
15245 int tmp_in
= hm_get_adapter_index_nvapi (nvGPUHandle
);
15249 for (int i
= 0; i
< tmp_in
; i
++)
15251 hm_adapters_nvapi
[tmp_out
++].nvapi
= nvGPUHandle
[i
];
15256 if ((need_xnvctrl
== 1) && (xnvctrl_init (xnvctrl
) == 0))
15258 data
.hm_xnvctrl
= xnvctrl
;
15261 if (data
.hm_xnvctrl
)
15263 if (hm_XNVCTRL_XOpenDisplay (data
.hm_xnvctrl
) == 0)
15265 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15267 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15269 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15271 hm_adapters_xnvctrl
[device_id
].xnvctrl
= device_id
;
15275 if (get_fan_speed_current (data
.hm_xnvctrl
, device_id
, &speed
) == 0) hm_adapters_xnvctrl
[device_id
].fan_get_supported
= 1;
15280 if ((need_adl
== 1) && (adl_init (adl
) == 0))
15287 if (hm_ADL_Main_Control_Create (data
.hm_adl
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
15289 // total number of adapters
15291 int hm_adapters_num
;
15293 if (get_adapters_num_adl (data
.hm_adl
, &hm_adapters_num
) != 0) return -1;
15297 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_adl (data
.hm_adl
, hm_adapters_num
);
15299 if (lpAdapterInfo
== NULL
) return -1;
15301 // get a list (of ids of) valid/usable adapters
15303 int num_adl_adapters
= 0;
15305 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
15307 if (num_adl_adapters
> 0)
15309 hc_thread_mutex_lock (mux_adl
);
15311 // hm_get_opencl_busid_devid (hm_adapters_adl, devices_all_cnt, devices_all);
15313 hm_get_adapter_index_adl (hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15315 hm_get_overdrive_version (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15316 hm_check_fanspeed_control (data
.hm_adl
, hm_adapters_adl
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
15318 hc_thread_mutex_unlock (mux_adl
);
15321 myfree (valid_adl_device_list
);
15322 myfree (lpAdapterInfo
);
15326 if (data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15328 gpu_temp_disable
= 1;
15333 * OpenCL devices: allocate buffer for device specific information
15336 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
15338 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
15340 unsigned int *nvml_power_limit
= (unsigned int *) mycalloc (data
.devices_cnt
, sizeof (unsigned int));
15343 * User-defined GPU temp handling
15346 if (gpu_temp_disable
== 1)
15348 gpu_temp_abort
= 0;
15349 gpu_temp_retain
= 0;
15352 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
15354 if (gpu_temp_abort
< gpu_temp_retain
)
15356 log_error ("ERROR: Invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
15362 data
.gpu_temp_disable
= gpu_temp_disable
;
15363 data
.gpu_temp_abort
= gpu_temp_abort
;
15364 data
.gpu_temp_retain
= gpu_temp_retain
;
15368 * enable custom signal handler(s)
15371 if (benchmark
== 0)
15373 hc_signal (sigHandler_default
);
15377 hc_signal (sigHandler_benchmark
);
15384 if (data
.quiet
== 0)
15386 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
15388 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
);
15390 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15392 log_info ("Rules: %u", kernel_rules_cnt
);
15397 log_info ("Applicable Optimizers:");
15399 for (uint i
= 0; i
< 32; i
++)
15401 const uint opti_bit
= 1u << i
;
15403 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
15408 * Watchdog and Temperature balance
15412 if (gpu_temp_disable
== 0 && data
.hm_adl
== NULL
&& data
.hm_nvml
== NULL
&& data
.hm_xnvctrl
== NULL
)
15414 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
15417 if (gpu_temp_abort
== 0)
15419 log_info ("Watchdog: Temperature abort trigger disabled");
15423 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
15426 if (gpu_temp_retain
== 0)
15428 log_info ("Watchdog: Temperature retain trigger disabled");
15432 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
15435 if (data
.quiet
== 0) log_info ("");
15445 if (gpu_temp_disable
== 0)
15447 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15449 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15451 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
15453 if (device_param
->skipped
) continue;
15455 const uint platform_devices_id
= device_param
->platform_devices_id
;
15457 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15459 data
.hm_device
[device_id
].adl
= hm_adapters_adl
[platform_devices_id
].adl
;
15460 data
.hm_device
[device_id
].nvapi
= 0;
15461 data
.hm_device
[device_id
].nvml
= 0;
15462 data
.hm_device
[device_id
].xnvctrl
= 0;
15463 data
.hm_device
[device_id
].od_version
= hm_adapters_adl
[platform_devices_id
].od_version
;
15464 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_adl
[platform_devices_id
].fan_get_supported
;
15465 data
.hm_device
[device_id
].fan_set_supported
= 0;
15468 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15470 data
.hm_device
[device_id
].adl
= 0;
15471 data
.hm_device
[device_id
].nvapi
= hm_adapters_nvapi
[platform_devices_id
].nvapi
;
15472 data
.hm_device
[device_id
].nvml
= hm_adapters_nvml
[platform_devices_id
].nvml
;
15473 data
.hm_device
[device_id
].xnvctrl
= hm_adapters_xnvctrl
[platform_devices_id
].xnvctrl
;
15474 data
.hm_device
[device_id
].od_version
= 0;
15475 data
.hm_device
[device_id
].fan_get_supported
= hm_adapters_nvml
[platform_devices_id
].fan_get_supported
;
15476 data
.hm_device
[device_id
].fan_set_supported
= 0;
15482 * powertune on user request
15485 if (powertune_enable
== 1)
15487 hc_thread_mutex_lock (mux_adl
);
15489 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15491 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15493 if (device_param
->skipped
) continue;
15495 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
15499 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
15500 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
15501 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
15502 * Driver / ADL bug?
15505 if (data
.hm_device
[device_id
].od_version
== 6)
15509 // check powertune capabilities first, if not available then skip device
15511 int powertune_supported
= 0;
15513 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
15515 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15520 // first backup current value, we will restore it later
15522 if (powertune_supported
!= 0)
15524 // powercontrol settings
15526 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15528 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) == ADL_OK
)
15530 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &od_power_control_status
[device_id
]);
15533 if (ADL_rc
!= ADL_OK
)
15535 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15540 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15542 log_error ("ERROR: Failed to set new ADL PowerControl values");
15549 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15551 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15553 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
)
15555 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15560 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15562 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15564 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &caps
)) != ADL_OK
)
15566 log_error ("ERROR: Failed to get ADL device capabilities");
15571 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15572 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15574 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15575 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15577 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15578 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15580 // warning if profile has too low max values
15582 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15584 log_info ("WARN: The custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15587 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15589 log_info ("WARN: The custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15592 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15594 performance_state
->iNumberOfPerformanceLevels
= 2;
15596 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15597 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15598 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15599 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15601 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
)
15603 log_info ("ERROR: Failed to set ADL performance state");
15608 local_free (performance_state
);
15611 // set powertune value only
15613 if (powertune_supported
!= 0)
15616 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15618 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune
)) != ADL_OK
)
15620 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15625 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, powertune
.iMaxValue
)) != ADL_OK
)
15627 log_error ("ERROR: Failed to set new ADL PowerControl values");
15635 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
15637 // first backup current value, we will restore it later
15639 unsigned int limit
;
15641 int powertune_supported
= 0;
15643 if (hm_NVML_nvmlDeviceGetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &limit
) == NVML_SUCCESS
)
15645 powertune_supported
= 1;
15648 // if backup worked, activate the maximum allowed
15650 if (powertune_supported
!= 0)
15652 unsigned int minLimit
;
15653 unsigned int maxLimit
;
15655 if (hm_NVML_nvmlDeviceGetPowerManagementLimitConstraints (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, &minLimit
, &maxLimit
) == NVML_SUCCESS
)
15659 if (hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, maxLimit
) == NVML_SUCCESS
)
15661 // now we can be sure we need to reset later
15663 nvml_power_limit
[device_id
] = limit
;
15671 hc_thread_mutex_unlock (mux_adl
);
15674 #endif // HAVE_HWMON
15677 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
15680 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
15682 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15684 cl_int CL_err
= CL_SUCCESS
;
15690 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15692 if (device_param
->skipped
) continue;
15695 * device properties
15698 const char *device_name_chksum
= device_param
->device_name_chksum
;
15699 const u32 device_processors
= device_param
->device_processors
;
15702 * create context for each device
15705 cl_context_properties properties
[3];
15707 properties
[0] = CL_CONTEXT_PLATFORM
;
15708 properties
[1] = (cl_context_properties
) device_param
->platform
;
15711 CL_err
= hc_clCreateContext (data
.ocl
, properties
, 1, &device_param
->device
, NULL
, NULL
, &device_param
->context
);
15713 if (CL_err
!= CL_SUCCESS
)
15715 log_error ("ERROR: clCreateContext(): %s\n", val2cstr_cl (CL_err
));
15721 * create command-queue
15724 // not supported with NV
15725 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
15727 CL_err
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
, &device_param
->command_queue
);
15729 if (CL_err
!= CL_SUCCESS
)
15731 log_error ("ERROR: clCreateCommandQueue(): %s\n", val2cstr_cl (CL_err
));
15737 * kernel threads: some algorithms need a fixed kernel-threads count
15738 * because of shared memory usage or bitslice
15739 * there needs to be some upper limit, otherwise there's too much overhead
15742 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
15744 if (hash_mode
== 8900) kernel_threads
= 64; // Scrypt
15745 if (hash_mode
== 9300) kernel_threads
= 64; // Scrypt
15747 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
15749 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
15752 if (hash_mode
== 1500) kernel_threads
= 64; // DES
15753 if (hash_mode
== 3000) kernel_threads
= 64; // DES
15754 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
15755 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
15756 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
15757 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
15758 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
15759 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
15760 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
15761 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
15762 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
15763 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
15764 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
15766 device_param
->kernel_threads
= kernel_threads
;
15768 device_param
->hardware_power
= device_processors
* kernel_threads
;
15771 * create input buffers on device : calculate size of fixed memory buffers
15774 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
15775 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
15777 device_param
->size_root_css
= size_root_css
;
15778 device_param
->size_markov_css
= size_markov_css
;
15780 size_t size_results
= sizeof (uint
);
15782 device_param
->size_results
= size_results
;
15784 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
15785 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
15787 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
15788 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
15789 size_t size_esalts
= salts_cnt
* esalt_size
;
15791 device_param
->size_plains
= size_plains
;
15792 device_param
->size_digests
= size_digests
;
15793 device_param
->size_shown
= size_shown
;
15794 device_param
->size_salts
= size_salts
;
15796 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
15797 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
15798 size_t size_tm
= 32 * sizeof (bs_word_t
);
15802 size_t size_scrypt
= 4;
15804 if ((hash_mode
== 8900) || (hash_mode
== 9300))
15806 // we need to check that all hashes have the same scrypt settings
15808 const u32 scrypt_N
= data
.salts_buf
[0].scrypt_N
;
15809 const u32 scrypt_r
= data
.salts_buf
[0].scrypt_r
;
15810 const u32 scrypt_p
= data
.salts_buf
[0].scrypt_p
;
15812 for (uint i
= 1; i
< salts_cnt
; i
++)
15814 if ((data
.salts_buf
[i
].scrypt_N
!= scrypt_N
)
15815 || (data
.salts_buf
[i
].scrypt_r
!= scrypt_r
)
15816 || (data
.salts_buf
[i
].scrypt_p
!= scrypt_p
))
15818 log_error ("ERROR: Mixed scrypt settings not supported");
15824 uint tmto_start
= 0;
15825 uint tmto_stop
= 10;
15829 tmto_start
= scrypt_tmto
;
15833 // in case the user did not specify the tmto manually
15834 // use some values known to run best (tested on 290x for AMD and GTX1080 for NV)
15836 if (hash_mode
== 8900)
15838 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15842 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15847 else if (hash_mode
== 9300)
15849 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
15853 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
15860 data
.scrypt_tmp_size
= (128 * scrypt_r
* scrypt_p
);
15862 device_param
->kernel_accel_min
= 1;
15863 device_param
->kernel_accel_max
= 8;
15867 for (tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
15869 size_scrypt
= (128 * scrypt_r
) * scrypt_N
;
15871 size_scrypt
/= 1u << tmto
;
15873 size_scrypt
*= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel_max
;
15875 if ((size_scrypt
/ 4) > device_param
->device_maxmem_alloc
)
15877 if (quiet
== 0) log_info ("WARNING: Not enough single-block device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15882 if (size_scrypt
> device_param
->device_global_mem
)
15884 if (quiet
== 0) log_info ("WARNING: Not enough total device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
15889 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
15891 data
.scrypt_tmto_final
= tmto
;
15897 if (tmto
== tmto_stop
)
15899 log_error ("ERROR: Can't allocate enough device memory");
15904 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
);
15907 size_t size_scrypt4
= size_scrypt
/ 4;
15910 * some algorithms need a fixed kernel-loops count
15913 if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
)
15915 const u32 kernel_loops_fixed
= 1024;
15917 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15918 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15921 if (hash_mode
== 3000 && attack_mode
== ATTACK_MODE_BF
)
15923 const u32 kernel_loops_fixed
= 1024;
15925 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15926 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15929 if (hash_mode
== 8900)
15931 const u32 kernel_loops_fixed
= 1;
15933 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15934 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15937 if (hash_mode
== 9300)
15939 const u32 kernel_loops_fixed
= 1;
15941 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15942 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15945 if (hash_mode
== 12500)
15947 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
15949 device_param
->kernel_loops_min
= kernel_loops_fixed
;
15950 device_param
->kernel_loops_max
= kernel_loops_fixed
;
15954 * some algorithms have a maximum kernel-loops count
15957 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
15959 u32 innerloop_cnt
= 0;
15961 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15963 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
15964 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
15965 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
15969 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
15972 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
15973 (innerloop_cnt
<= device_param
->kernel_loops_max
))
15975 device_param
->kernel_loops_max
= innerloop_cnt
;
15979 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
15980 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
15982 // find out if we would request too much memory on memory blocks which are based on kernel_accel
15984 size_t size_pws
= 4;
15985 size_t size_tmps
= 4;
15986 size_t size_hooks
= 4;
15988 while (kernel_accel_max
>= kernel_accel_min
)
15990 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
15994 size_pws
= kernel_power_max
* sizeof (pw_t
);
16000 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
16001 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16002 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16003 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16004 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
16005 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
16006 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
16007 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
16008 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
16009 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
16010 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16011 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16012 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16013 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16014 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16015 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16016 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16017 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16018 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16019 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16020 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16021 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16022 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
16023 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
16024 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
16025 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
16026 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
16027 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
16028 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16029 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16030 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
16031 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
16032 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16033 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
16034 case 8900: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16035 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
16036 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
16037 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16038 case 9300: size_tmps
= kernel_power_max
* data
.scrypt_tmp_size
; break;
16039 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
16040 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
16041 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
16042 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16043 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
16044 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
16045 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
16046 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
16047 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16048 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
16049 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
16050 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
16051 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16052 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
16053 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
16054 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
16055 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
16056 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
16057 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
16058 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16059 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16060 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
16061 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
16062 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
16063 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
16064 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16065 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16066 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16067 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16068 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16069 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
16070 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16071 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16072 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16073 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16074 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16075 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16076 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16077 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16078 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16079 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16080 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16081 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
16086 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
16093 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
16094 // if not, decrease amplifier and try again
16096 int memory_limit_hit
= 0;
16098 if (size_pws
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16099 if (size_tmps
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16100 if (size_hooks
> device_param
->device_maxmem_alloc
) memory_limit_hit
= 1;
16102 const u64 size_total
16119 + size_pws
// not a bug
16133 if (size_total
> device_param
->device_global_mem
) memory_limit_hit
= 1;
16135 if (memory_limit_hit
== 1)
16137 kernel_accel_max
--;
16145 if (kernel_accel_max
< kernel_accel_min
)
16147 log_error ("- Device #%u: Device does not provide enough allocatable device-memory to handle this attack", device_id
+ 1);
16152 device_param
->kernel_accel_min
= kernel_accel_min
;
16153 device_param
->kernel_accel_max
= kernel_accel_max
;
16156 if (kernel_accel_max < kernel_accel)
16158 if (quiet == 0) log_info ("- Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
16160 device_param->kernel_accel = kernel_accel_max;
16164 device_param
->size_bfs
= size_bfs
;
16165 device_param
->size_combs
= size_combs
;
16166 device_param
->size_rules
= size_rules
;
16167 device_param
->size_rules_c
= size_rules_c
;
16168 device_param
->size_pws
= size_pws
;
16169 device_param
->size_tmps
= size_tmps
;
16170 device_param
->size_hooks
= size_hooks
;
16173 * default building options
16176 if (chdir (cpath_real
) == -1)
16178 log_error ("ERROR: %s: %s", cpath_real
, strerror (errno
));
16183 char build_opts
[1024] = { 0 };
16186 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\"", cpath_real
);
16188 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I %s", cpath_real
);
16192 // this test needs to be done manually because of osx opencl runtime
16193 // if there's a problem with permission, its not reporting back and erroring out silently
16195 #define files_cnt 15
16197 const char *files_names
[files_cnt
] =
16199 "inc_cipher_aes256.cl",
16200 "inc_cipher_serpent256.cl",
16201 "inc_cipher_twofish256.cl",
16203 "inc_comp_multi_bs.cl",
16204 "inc_comp_multi.cl",
16205 "inc_comp_single_bs.cl",
16206 "inc_comp_single.cl",
16207 "inc_hash_constants.h",
16208 "inc_hash_functions.cl",
16216 for (int i
= 0; i
< files_cnt
; i
++)
16218 FILE *fd
= fopen (files_names
[i
], "r");
16222 log_error ("ERROR: %s: fopen(): %s", files_names
[i
], strerror (errno
));
16229 size_t n
= fread (buf
, 1, 1, fd
);
16233 log_error ("ERROR: %s: fread(): %s", files_names
[i
], strerror (errno
));
16241 // we don't have sm_* on vendors not NV but it doesn't matter
16243 char build_opts_new
[1024] = { 0 };
16245 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
);
16247 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
));
16250 log_info ("- Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
16259 * kernel source filename
16262 char source_file
[256] = { 0 };
16264 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, mangle
, shared_dir
, source_file
);
16268 if (stat (source_file
, &sst
) == -1)
16270 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16276 * kernel cached filename
16279 char cached_file
[256] = { 0 };
16281 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, mangle
, profile_dir
, device_name_chksum
, cached_file
);
16287 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
16293 * kernel compile or load
16296 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16298 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16300 if (force_jit_compilation
== -1)
16304 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
));
16306 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16308 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16310 if (CL_err
!= CL_SUCCESS
)
16312 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16317 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16319 if (CL_err
!= CL_SUCCESS
)
16321 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16327 size_t build_log_size
= 0;
16329 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16331 if (CL_err
!= CL_SUCCESS
)
16333 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16338 if (build_log_size
> 1)
16340 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16342 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16344 if (CL_err
!= CL_SUCCESS
)
16346 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16353 myfree (build_log
);
16357 if (CL_err
!= CL_SUCCESS
)
16359 device_param
->skipped
= true;
16361 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16366 size_t binary_size
;
16368 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16370 if (CL_err
!= CL_SUCCESS
)
16372 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16377 u8
*binary
= (u8
*) mymalloc (binary_size
);
16379 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16381 if (CL_err
!= CL_SUCCESS
)
16383 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16388 writeProgramBin (cached_file
, binary
, binary_size
);
16390 local_free (binary
);
16395 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16398 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16400 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program
);
16402 if (CL_err
!= CL_SUCCESS
)
16404 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16409 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16411 if (CL_err
!= CL_SUCCESS
)
16413 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16422 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
16425 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16427 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program
);
16429 if (CL_err
!= CL_SUCCESS
)
16431 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16436 char build_opts_update
[1024] = { 0 };
16438 if (force_jit_compilation
== 1500)
16440 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%u", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
16442 else if (force_jit_compilation
== 8900)
16444 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);
16448 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
16451 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
);
16453 if (CL_err
!= CL_SUCCESS
)
16455 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16461 size_t build_log_size
= 0;
16463 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
16465 if (CL_err
!= CL_SUCCESS
)
16467 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16472 if (build_log_size
> 1)
16474 char *build_log
= (char *) mymalloc (build_log_size
+ 1);
16476 CL_err
= hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
16478 if (CL_err
!= CL_SUCCESS
)
16480 log_error ("ERROR: clGetProgramBuildInfo(): %s\n", val2cstr_cl (CL_err
));
16487 myfree (build_log
);
16491 if (CL_err
!= CL_SUCCESS
)
16493 device_param
->skipped
= true;
16495 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16499 local_free (kernel_lengths
);
16500 local_free (kernel_sources
[0]);
16501 local_free (kernel_sources
);
16505 * word generator kernel
16508 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
16511 * kernel mp source filename
16514 char source_file
[256] = { 0 };
16516 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
16520 if (stat (source_file
, &sst
) == -1)
16522 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16528 * kernel mp cached filename
16531 char cached_file
[256] = { 0 };
16533 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
16539 if (stat (cached_file
, &cst
) == -1)
16545 * kernel compile or load
16548 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16550 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16554 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
));
16555 if (quiet
== 0) log_info ("");
16557 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16559 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_mp
);
16561 if (CL_err
!= CL_SUCCESS
)
16563 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16568 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16570 if (CL_err
!= CL_SUCCESS
)
16572 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16577 if (CL_err
!= CL_SUCCESS
)
16579 device_param
->skipped
= true;
16581 log_info ("- Device #%u: Kernel %s build failure. Proceeding without this device.", device_id
+ 1, source_file
);
16586 size_t binary_size
;
16588 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16590 if (CL_err
!= CL_SUCCESS
)
16592 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16597 u8
*binary
= (u8
*) mymalloc (binary_size
);
16599 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16601 if (CL_err
!= CL_SUCCESS
)
16603 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16608 writeProgramBin (cached_file
, binary
, binary_size
);
16610 local_free (binary
);
16615 log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16618 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16620 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_mp
);
16622 if (CL_err
!= CL_SUCCESS
)
16624 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16629 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16631 if (CL_err
!= CL_SUCCESS
)
16633 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16639 local_free (kernel_lengths
);
16640 local_free (kernel_sources
[0]);
16641 local_free (kernel_sources
);
16648 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16655 * kernel amp source filename
16658 char source_file
[256] = { 0 };
16660 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
16664 if (stat (source_file
, &sst
) == -1)
16666 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
16672 * kernel amp cached filename
16675 char cached_file
[256] = { 0 };
16677 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
16683 if (stat (cached_file
, &cst
) == -1)
16689 * kernel compile or load
16692 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
16694 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
16698 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
));
16699 if (quiet
== 0) log_info ("");
16701 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
16703 CL_err
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
, &device_param
->program_amp
);
16705 if (CL_err
!= CL_SUCCESS
)
16707 log_error ("ERROR: clCreateProgramWithSource(): %s\n", val2cstr_cl (CL_err
));
16712 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16714 if (CL_err
!= CL_SUCCESS
)
16716 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16721 if (CL_err
!= CL_SUCCESS
)
16723 device_param
->skipped
= true;
16725 log_info ("- Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
16730 size_t binary_size
;
16732 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
16734 if (CL_err
!= CL_SUCCESS
)
16736 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16741 u8
*binary
= (u8
*) mymalloc (binary_size
);
16743 CL_err
= hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
16745 if (CL_err
!= CL_SUCCESS
)
16747 log_error ("ERROR: clGetProgramInfo(): %s\n", val2cstr_cl (CL_err
));
16752 writeProgramBin (cached_file
, binary
, binary_size
);
16754 local_free (binary
);
16759 if (quiet
== 0) log_info ("- Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
16762 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
16764 CL_err
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
, &device_param
->program_amp
);
16766 if (CL_err
!= CL_SUCCESS
)
16768 log_error ("ERROR: clCreateProgramWithBinary(): %s\n", val2cstr_cl (CL_err
));
16773 CL_err
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
16775 if (CL_err
!= CL_SUCCESS
)
16777 log_error ("ERROR: clBuildProgram(): %s\n", val2cstr_cl (CL_err
));
16783 local_free (kernel_lengths
);
16784 local_free (kernel_sources
[0]);
16785 local_free (kernel_sources
);
16788 // return back to the folder we came from initially (workaround)
16790 if (chdir (cwd
) == -1)
16792 log_error ("ERROR: %s: %s", cwd
, strerror (errno
));
16797 // some algorithm collide too fast, make that impossible
16799 if (benchmark
== 1)
16801 ((uint
*) digests_buf
)[0] = -1;
16802 ((uint
*) digests_buf
)[1] = -1;
16803 ((uint
*) digests_buf
)[2] = -1;
16804 ((uint
*) digests_buf
)[3] = -1;
16811 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_buf
);
16812 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
, &device_param
->d_pws_amp_buf
);
16813 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
, &device_param
->d_tmps
);
16814 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
, &device_param
->d_hooks
);
16815 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_a
);
16816 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_b
);
16817 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_c
);
16818 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s1_d
);
16819 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_a
);
16820 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_b
);
16821 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_c
);
16822 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
, &device_param
->d_bitmap_s2_d
);
16823 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
, &device_param
->d_plain_bufs
);
16824 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
, &device_param
->d_digests_buf
);
16825 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
, &device_param
->d_digests_shown
);
16826 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
, &device_param
->d_salt_bufs
);
16827 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
, &device_param
->d_result
);
16828 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV0_buf
);
16829 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV1_buf
);
16830 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV2_buf
);
16831 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scrypt4
, NULL
, &device_param
->d_scryptV3_buf
);
16833 if (CL_err
!= CL_SUCCESS
)
16835 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16840 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
);
16841 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
);
16842 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
);
16843 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
);
16844 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
);
16845 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
);
16846 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
);
16847 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
);
16848 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
);
16849 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
);
16850 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
);
16852 if (CL_err
!= CL_SUCCESS
)
16854 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16863 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
16865 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
, &device_param
->d_rules
);
16866 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
, &device_param
->d_rules_c
);
16868 if (CL_err
!= CL_SUCCESS
)
16870 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16875 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
);
16877 if (CL_err
!= CL_SUCCESS
)
16879 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16884 else if (attack_kern
== ATTACK_KERN_COMBI
)
16886 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs
);
16887 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
, &device_param
->d_combs_c
);
16888 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16889 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16891 if (CL_err
!= CL_SUCCESS
)
16893 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16898 else if (attack_kern
== ATTACK_KERN_BF
)
16900 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs
);
16901 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
, &device_param
->d_bfs_c
);
16902 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
, &device_param
->d_tm_c
);
16903 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
, &device_param
->d_root_css_buf
);
16904 CL_err
|= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
, &device_param
->d_markov_css_buf
);
16906 if (CL_err
!= CL_SUCCESS
)
16908 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16916 CL_err
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
, &device_param
->d_esalt_bufs
);
16918 if (CL_err
!= CL_SUCCESS
)
16920 log_error ("ERROR: clCreateBuffer(): %s\n", val2cstr_cl (CL_err
));
16925 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
);
16927 if (CL_err
!= CL_SUCCESS
)
16929 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
16939 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
16941 device_param
->pws_buf
= pws_buf
;
16943 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
16945 device_param
->combs_buf
= combs_buf
;
16947 void *hooks_buf
= mymalloc (size_hooks
);
16949 device_param
->hooks_buf
= hooks_buf
;
16955 device_param
->kernel_params_buf32
[24] = bitmap_mask
;
16956 device_param
->kernel_params_buf32
[25] = bitmap_shift1
;
16957 device_param
->kernel_params_buf32
[26] = bitmap_shift2
;
16958 device_param
->kernel_params_buf32
[27] = 0; // salt_pos
16959 device_param
->kernel_params_buf32
[28] = 0; // loop_pos
16960 device_param
->kernel_params_buf32
[29] = 0; // loop_cnt
16961 device_param
->kernel_params_buf32
[30] = 0; // kernel_rules_cnt
16962 device_param
->kernel_params_buf32
[31] = 0; // digests_cnt
16963 device_param
->kernel_params_buf32
[32] = 0; // digests_offset
16964 device_param
->kernel_params_buf32
[33] = 0; // combs_mode
16965 device_param
->kernel_params_buf32
[34] = 0; // gid_max
16967 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
16968 ? &device_param
->d_pws_buf
16969 : &device_param
->d_pws_amp_buf
;
16970 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
16971 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
16972 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
16973 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
16974 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
16975 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
16976 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
16977 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
16978 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
16979 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
16980 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
16981 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
16982 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
16983 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
16984 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
16985 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
16986 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
16987 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
16988 device_param
->kernel_params
[19] = &device_param
->d_result
;
16989 device_param
->kernel_params
[20] = &device_param
->d_scryptV0_buf
;
16990 device_param
->kernel_params
[21] = &device_param
->d_scryptV1_buf
;
16991 device_param
->kernel_params
[22] = &device_param
->d_scryptV2_buf
;
16992 device_param
->kernel_params
[23] = &device_param
->d_scryptV3_buf
;
16993 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
16994 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
16995 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
16996 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
16997 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
16998 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
16999 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
17000 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
17001 device_param
->kernel_params
[32] = &device_param
->kernel_params_buf32
[32];
17002 device_param
->kernel_params
[33] = &device_param
->kernel_params_buf32
[33];
17003 device_param
->kernel_params
[34] = &device_param
->kernel_params_buf32
[34];
17005 device_param
->kernel_params_mp_buf64
[3] = 0;
17006 device_param
->kernel_params_mp_buf32
[4] = 0;
17007 device_param
->kernel_params_mp_buf32
[5] = 0;
17008 device_param
->kernel_params_mp_buf32
[6] = 0;
17009 device_param
->kernel_params_mp_buf32
[7] = 0;
17010 device_param
->kernel_params_mp_buf32
[8] = 0;
17012 device_param
->kernel_params_mp
[0] = NULL
;
17013 device_param
->kernel_params_mp
[1] = NULL
;
17014 device_param
->kernel_params_mp
[2] = NULL
;
17015 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
17016 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
17017 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
17018 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
17019 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
17020 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
17022 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17023 device_param
->kernel_params_mp_l_buf32
[4] = 0;
17024 device_param
->kernel_params_mp_l_buf32
[5] = 0;
17025 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17026 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17027 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17028 device_param
->kernel_params_mp_l_buf32
[9] = 0;
17030 device_param
->kernel_params_mp_l
[0] = NULL
;
17031 device_param
->kernel_params_mp_l
[1] = NULL
;
17032 device_param
->kernel_params_mp_l
[2] = NULL
;
17033 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
17034 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
17035 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
17036 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
17037 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
17038 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
17039 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
17041 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17042 device_param
->kernel_params_mp_r_buf32
[4] = 0;
17043 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17044 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17045 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17046 device_param
->kernel_params_mp_r_buf32
[8] = 0;
17048 device_param
->kernel_params_mp_r
[0] = NULL
;
17049 device_param
->kernel_params_mp_r
[1] = NULL
;
17050 device_param
->kernel_params_mp_r
[2] = NULL
;
17051 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
17052 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
17053 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
17054 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
17055 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
17056 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
17058 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
17059 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
17061 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
17062 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
17063 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
17064 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
17065 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
17066 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
17067 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
17069 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
17070 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
17072 device_param
->kernel_params_memset_buf32
[1] = 0; // value
17073 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
17075 device_param
->kernel_params_memset
[0] = NULL
;
17076 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
17077 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
17083 size_t kernel_wgs_tmp
;
17085 char kernel_name
[64] = { 0 };
17087 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17089 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17091 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
17093 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17095 if (CL_err
!= CL_SUCCESS
)
17097 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17102 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
17104 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17106 if (CL_err
!= CL_SUCCESS
)
17108 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17113 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
17115 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17117 if (CL_err
!= CL_SUCCESS
)
17119 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17126 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
17128 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17130 if (CL_err
!= CL_SUCCESS
)
17132 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17137 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
17139 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17141 if (CL_err
!= CL_SUCCESS
)
17143 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17148 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
17150 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17152 if (CL_err
!= CL_SUCCESS
)
17154 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17160 if (data
.attack_mode
== ATTACK_MODE_BF
)
17162 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17164 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
17166 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel_tm
);
17168 if (CL_err
!= CL_SUCCESS
)
17170 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17175 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
);
17177 if (CL_err
!= CL_SUCCESS
)
17179 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17188 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
17190 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel1
);
17192 if (CL_err
!= CL_SUCCESS
)
17194 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17199 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
17201 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel2
);
17203 if (CL_err
!= CL_SUCCESS
)
17205 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17210 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
17212 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel3
);
17214 if (CL_err
!= CL_SUCCESS
)
17216 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17221 if (opts_type
& OPTS_TYPE_HOOK12
)
17223 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
17225 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel12
);
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
->kernel12
, 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
));
17244 if (opts_type
& OPTS_TYPE_HOOK23
)
17246 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
17248 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
, &device_param
->kernel23
);
17250 if (CL_err
!= CL_SUCCESS
)
17252 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17257 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
);
17259 if (CL_err
!= CL_SUCCESS
)
17261 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17268 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
);
17269 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
);
17270 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
);
17272 if (CL_err
!= CL_SUCCESS
)
17274 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17279 for (uint i
= 0; i
<= 23; i
++)
17281 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17282 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17283 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17285 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17286 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
17288 if (CL_err
!= CL_SUCCESS
)
17290 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17296 for (uint i
= 24; i
<= 34; i
++)
17298 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17299 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17300 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17302 if (opts_type
& OPTS_TYPE_HOOK12
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17303 if (opts_type
& OPTS_TYPE_HOOK23
) CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
17305 if (CL_err
!= CL_SUCCESS
)
17307 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17315 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset", &device_param
->kernel_memset
);
17317 if (CL_err
!= CL_SUCCESS
)
17319 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17324 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
);
17326 if (CL_err
!= CL_SUCCESS
)
17328 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17333 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
17334 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
17335 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
17337 if (CL_err
!= CL_SUCCESS
)
17339 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17346 if (attack_mode
== ATTACK_MODE_BF
)
17348 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov", &device_param
->kernel_mp_l
);
17349 CL_err
|= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov", &device_param
->kernel_mp_r
);
17351 if (CL_err
!= CL_SUCCESS
)
17353 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17358 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
);
17359 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
);
17361 if (CL_err
!= CL_SUCCESS
)
17363 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17368 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
17370 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
17371 CL_err
|= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
17373 if (CL_err
!= CL_SUCCESS
)
17375 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17381 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
17383 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17385 if (CL_err
!= CL_SUCCESS
)
17387 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17392 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
);
17394 if (CL_err
!= CL_SUCCESS
)
17396 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17401 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
17403 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov", &device_param
->kernel_mp
);
17405 if (CL_err
!= CL_SUCCESS
)
17407 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17412 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
);
17414 if (CL_err
!= CL_SUCCESS
)
17416 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17422 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17428 CL_err
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp", &device_param
->kernel_amp
);
17430 if (CL_err
!= CL_SUCCESS
)
17432 log_error ("ERROR: clCreateKernel(): %s\n", val2cstr_cl (CL_err
));
17437 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
);
17439 if (CL_err
!= CL_SUCCESS
)
17441 log_error ("ERROR: clGetKernelWorkGroupInfo(): %s\n", val2cstr_cl (CL_err
));
17447 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17453 for (uint i
= 0; i
< 5; i
++)
17455 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
17457 if (CL_err
!= CL_SUCCESS
)
17459 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17465 for (uint i
= 5; i
< 7; i
++)
17467 CL_err
= hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
17469 if (CL_err
!= CL_SUCCESS
)
17471 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
17478 // maybe this has been updated by clGetKernelWorkGroupInfo()
17479 // value can only be decreased, so we don't need to reallocate buffers
17481 device_param
->kernel_threads
= kernel_threads
;
17483 // zero some data buffers
17485 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
17486 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
17487 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
17488 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
17489 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
17490 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
17496 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
17498 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
17500 else if (attack_kern
== ATTACK_KERN_COMBI
)
17502 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
17503 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
17504 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17505 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17507 else if (attack_kern
== ATTACK_KERN_BF
)
17509 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
17510 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
17511 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
17512 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
17513 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
17516 #if defined(HAVE_HWMON)
17519 * Store initial fanspeed if gpu_temp_retain is enabled
17522 if (gpu_temp_disable
== 0)
17524 if (gpu_temp_retain
!= 0)
17526 hc_thread_mutex_lock (mux_adl
);
17528 if (data
.hm_device
[device_id
].fan_get_supported
== 1)
17530 const int fanspeed
= hm_get_fanspeed_with_device_id (device_id
);
17531 const int fanpolicy
= hm_get_fanpolicy_with_device_id (device_id
);
17533 // we also set it to tell the OS we take control over the fan and it's automatic controller
17534 // if it was set to automatic. we do not control user-defined fanspeeds.
17536 if (fanpolicy
== 1)
17538 data
.hm_device
[device_id
].fan_set_supported
= 1;
17542 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
17544 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, fanspeed
, 1);
17546 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
17549 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE
);
17553 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, fanspeed
, 1);
17559 data
.hm_device
[device_id
].fan_set_supported
= 1;
17563 log_info ("WARNING: Failed to set initial fan speed for device #%u", device_id
+ 1);
17565 data
.hm_device
[device_id
].fan_set_supported
= 0;
17570 data
.hm_device
[device_id
].fan_set_supported
= 0;
17574 hc_thread_mutex_unlock (mux_adl
);
17578 #endif // HAVE_HWMON
17581 if (data
.quiet
== 0) log_info_nn ("");
17584 * In benchmark-mode, inform user which algorithm is checked
17587 if (benchmark
== 1)
17589 if (machine_readable
== 0)
17593 data
.quiet
= quiet
;
17595 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
17597 log_info ("Hashtype: %s", hash_type
);
17603 * keep track of the progress
17606 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17607 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17608 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
17615 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
17617 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
17622 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
17624 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
17629 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
17631 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
17641 segment_size
*= (1024 * 1024);
17643 data
.segment_size
= segment_size
;
17645 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
17647 wl_data
->buf
= (char *) mymalloc (segment_size
);
17648 wl_data
->avail
= segment_size
;
17649 wl_data
->incr
= segment_size
;
17653 cs_t
*css_buf
= NULL
;
17657 char **masks
= NULL
;
17658 char **dictfiles
= NULL
;
17660 uint mask_from_file
= 0;
17662 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17664 if (wordlist_mode
== WL_MODE_FILE
)
17666 int wls_left
= myargc
- (optind
+ 1);
17668 for (int i
= 0; i
< wls_left
; i
++)
17670 char *l0_filename
= myargv
[optind
+ 1 + i
];
17672 struct stat l0_stat
;
17674 if (stat (l0_filename
, &l0_stat
) == -1)
17676 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
17681 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
17685 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17689 dictfiles
[dictcnt
- 1] = l0_filename
;
17693 // do not allow --keyspace w/ a directory
17697 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
17702 char **dictionary_files
= NULL
;
17704 dictionary_files
= scan_directory (l0_filename
);
17706 if (dictionary_files
!= NULL
)
17708 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
17710 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
17712 char *l1_filename
= dictionary_files
[d
];
17714 struct stat l1_stat
;
17716 if (stat (l1_filename
, &l1_stat
) == -1)
17718 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
17723 if (S_ISREG (l1_stat
.st_mode
))
17725 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
17729 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
17734 local_free (dictionary_files
);
17740 log_error ("ERROR: No usable dictionary file found.");
17745 else if (wordlist_mode
== WL_MODE_STDIN
)
17750 else if (attack_mode
== ATTACK_MODE_COMBI
)
17754 char *dictfile1
= myargv
[optind
+ 1 + 0];
17755 char *dictfile2
= myargv
[optind
+ 1 + 1];
17757 // find the bigger dictionary and use as base
17762 struct stat tmp_stat
;
17764 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
17766 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17771 if (stat (dictfile1
, &tmp_stat
) == -1)
17773 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
17780 if (S_ISDIR (tmp_stat
.st_mode
))
17782 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
17789 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
17791 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17798 if (stat (dictfile2
, &tmp_stat
) == -1)
17800 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17808 if (S_ISDIR (tmp_stat
.st_mode
))
17810 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
17818 data
.combs_cnt
= 1;
17822 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
17824 data
.quiet
= quiet
;
17826 if (words1_cnt
== 0)
17828 log_error ("ERROR: %s: empty file", dictfile1
);
17836 data
.combs_cnt
= 1;
17840 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17842 data
.quiet
= quiet
;
17844 if (words2_cnt
== 0)
17846 log_error ("ERROR: %s: empty file", dictfile2
);
17857 data
.dictfile
= dictfile1
;
17858 data
.dictfile2
= dictfile2
;
17860 if (words1_cnt
>= words2_cnt
)
17862 data
.combs_cnt
= words2_cnt
;
17863 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
17865 dictfiles
= &data
.dictfile
;
17871 data
.combs_cnt
= words1_cnt
;
17872 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
17874 dictfiles
= &data
.dictfile2
;
17878 // we also have to switch wordlist related rules!
17880 char *tmpc
= data
.rule_buf_l
;
17882 data
.rule_buf_l
= data
.rule_buf_r
;
17883 data
.rule_buf_r
= tmpc
;
17885 int tmpi
= data
.rule_len_l
;
17887 data
.rule_len_l
= data
.rule_len_r
;
17888 data
.rule_len_r
= tmpi
;
17891 else if (attack_mode
== ATTACK_MODE_BF
)
17897 if (benchmark
== 0)
17899 mask
= myargv
[optind
+ 1];
17901 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
17903 if ((optind
+ 2) <= myargc
)
17905 struct stat file_stat
;
17907 if (stat (mask
, &file_stat
) == -1)
17911 masks
[maskcnt
- 1] = mystrdup (mask
);
17915 int wls_left
= myargc
- (optind
+ 1);
17917 uint masks_avail
= INCR_MASKS
;
17919 for (int i
= 0; i
< wls_left
; i
++)
17923 mask
= myargv
[optind
+ 1 + i
];
17925 if (stat (mask
, &file_stat
) == -1)
17927 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17933 uint is_file
= S_ISREG (file_stat
.st_mode
);
17939 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
17941 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
17946 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
17948 while (!feof (mask_fp
))
17950 memset (line_buf
, 0, HCBUFSIZ
);
17952 int line_len
= fgetl (mask_fp
, line_buf
);
17954 if (line_len
== 0) continue;
17956 if (line_buf
[0] == '#') continue;
17958 if (masks_avail
== maskcnt
)
17960 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
17962 masks_avail
+= INCR_MASKS
;
17965 masks
[maskcnt
] = mystrdup (line_buf
);
17976 log_error ("ERROR: %s: unsupported file-type", mask
);
17982 mask_from_file
= 1;
17987 custom_charset_1
= (char *) "?l?d?u";
17988 custom_charset_2
= (char *) "?l?d";
17989 custom_charset_3
= (char *) "?l?d*!$@_";
17991 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
17992 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
17993 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
17995 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
17997 wordlist_mode
= WL_MODE_MASK
;
17999 data
.wordlist_mode
= wordlist_mode
;
18009 * generate full masks and charsets
18012 masks
= (char **) mymalloc (sizeof (char *));
18016 case 1731: pw_min
= 5;
18018 mask
= mystrdup ("?b?b?b?b?b");
18020 case 12500: pw_min
= 5;
18022 mask
= mystrdup ("?b?b?b?b?b");
18024 default: pw_min
= 7;
18026 mask
= mystrdup ("?b?b?b?b?b?b?b");
18032 masks
[maskcnt
- 1] = mystrdup (mask
);
18034 wordlist_mode
= WL_MODE_MASK
;
18036 data
.wordlist_mode
= wordlist_mode
;
18041 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
18045 if (increment_min
> pw_min
) pw_min
= increment_min
;
18047 if (increment_max
< pw_max
) pw_max
= increment_max
;
18050 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
18052 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
18056 char *mask
= myargv
[myargc
- 1];
18060 masks
= (char **) mymalloc (1 * sizeof (char *));
18064 struct stat file_stat
;
18066 if (stat (mask
, &file_stat
) == -1)
18070 masks
[maskcnt
- 1] = mystrdup (mask
);
18074 uint is_file
= S_ISREG (file_stat
.st_mode
);
18080 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18082 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18087 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18089 uint masks_avail
= 1;
18091 while (!feof (mask_fp
))
18093 memset (line_buf
, 0, HCBUFSIZ
);
18095 int line_len
= fgetl (mask_fp
, line_buf
);
18097 if (line_len
== 0) continue;
18099 if (line_buf
[0] == '#') continue;
18101 if (masks_avail
== maskcnt
)
18103 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18105 masks_avail
+= INCR_MASKS
;
18108 masks
[maskcnt
] = mystrdup (line_buf
);
18117 mask_from_file
= 1;
18123 masks
[maskcnt
- 1] = mystrdup (mask
);
18129 int wls_left
= myargc
- (optind
+ 2);
18131 for (int i
= 0; i
< wls_left
; i
++)
18133 char *filename
= myargv
[optind
+ 1 + i
];
18135 struct stat file_stat
;
18137 if (stat (filename
, &file_stat
) == -1)
18139 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18144 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18148 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18152 dictfiles
[dictcnt
- 1] = filename
;
18156 // do not allow --keyspace w/ a directory
18160 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18165 char **dictionary_files
= NULL
;
18167 dictionary_files
= scan_directory (filename
);
18169 if (dictionary_files
!= NULL
)
18171 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18173 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18175 char *l1_filename
= dictionary_files
[d
];
18177 struct stat l1_stat
;
18179 if (stat (l1_filename
, &l1_stat
) == -1)
18181 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18186 if (S_ISREG (l1_stat
.st_mode
))
18188 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18192 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18197 local_free (dictionary_files
);
18203 log_error ("ERROR: No usable dictionary file found.");
18212 uint mask_min
= increment_min
; // we can't reject smaller masks here
18213 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18215 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18217 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18219 if (cur_mask
== NULL
) break;
18221 masks
[maskcnt
] = cur_mask
;
18225 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18229 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18231 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
18235 char *mask
= myargv
[optind
+ 1 + 0];
18239 masks
= (char **) mymalloc (1 * sizeof (char *));
18243 struct stat file_stat
;
18245 if (stat (mask
, &file_stat
) == -1)
18249 masks
[maskcnt
- 1] = mystrdup (mask
);
18253 uint is_file
= S_ISREG (file_stat
.st_mode
);
18259 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
18261 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
18266 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
18268 uint masks_avail
= 1;
18270 while (!feof (mask_fp
))
18272 memset (line_buf
, 0, HCBUFSIZ
);
18274 int line_len
= fgetl (mask_fp
, line_buf
);
18276 if (line_len
== 0) continue;
18278 if (line_buf
[0] == '#') continue;
18280 if (masks_avail
== maskcnt
)
18282 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
18284 masks_avail
+= INCR_MASKS
;
18287 masks
[maskcnt
] = mystrdup (line_buf
);
18296 mask_from_file
= 1;
18302 masks
[maskcnt
- 1] = mystrdup (mask
);
18308 int wls_left
= myargc
- (optind
+ 2);
18310 for (int i
= 0; i
< wls_left
; i
++)
18312 char *filename
= myargv
[optind
+ 2 + i
];
18314 struct stat file_stat
;
18316 if (stat (filename
, &file_stat
) == -1)
18318 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
18323 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
18327 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18331 dictfiles
[dictcnt
- 1] = filename
;
18335 // do not allow --keyspace w/ a directory
18339 log_error ("ERROR: Keyspace parameter is not allowed together with a directory");
18344 char **dictionary_files
= NULL
;
18346 dictionary_files
= scan_directory (filename
);
18348 if (dictionary_files
!= NULL
)
18350 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
18352 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
18354 char *l1_filename
= dictionary_files
[d
];
18356 struct stat l1_stat
;
18358 if (stat (l1_filename
, &l1_stat
) == -1)
18360 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
18365 if (S_ISREG (l1_stat
.st_mode
))
18367 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
18371 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
18376 local_free (dictionary_files
);
18382 log_error ("ERROR: No usable dictionary file found.");
18391 uint mask_min
= increment_min
; // we can't reject smaller masks here
18392 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
18394 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
18396 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
18398 if (cur_mask
== NULL
) break;
18400 masks
[maskcnt
] = cur_mask
;
18404 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
18409 data
.pw_min
= pw_min
;
18410 data
.pw_max
= pw_max
;
18416 if (weak_hash_threshold
>= salts_cnt
)
18418 hc_device_param_t
*device_param
= NULL
;
18420 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18422 device_param
= &data
.devices_param
[device_id
];
18424 if (device_param
->skipped
) continue;
18429 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
18431 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
18433 weak_hash_check (device_param
, salt_pos
);
18436 // Display hack, guarantee that there is at least one \r before real start
18438 //if (data.quiet == 0) log_info ("");
18442 * status and monitor threads
18445 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18447 data
.devices_status
= STATUS_STARTING
;
18450 uint inner_threads_cnt
= 0;
18452 hc_thread_t
*inner_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
18454 data
.shutdown_inner
= 0;
18460 if (keyspace
== 0 && benchmark
== 0 && stdout_flag
== 0)
18462 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_monitor
, NULL
);
18464 inner_threads_cnt
++;
18466 if (outfile_check_timer
!= 0)
18468 if (data
.outfile_check_directory
!= NULL
)
18470 if ((hash_mode
!= 5200) &&
18471 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
18472 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
18473 (hash_mode
!= 9000))
18475 hc_thread_create (inner_threads
[inner_threads_cnt
], thread_outfile_remove
, NULL
);
18477 inner_threads_cnt
++;
18481 outfile_check_timer
= 0;
18486 outfile_check_timer
= 0;
18492 * Inform the user if we got some hashes remove because of the pot file remove feature
18495 if (data
.quiet
== 0)
18497 if (potfile_remove_cracks
> 0)
18499 if (potfile_remove_cracks
== 1) log_info ("INFO: Removed 1 hash found in pot file\n");
18500 else log_info ("INFO: Removed %u hashes found in pot file\n", potfile_remove_cracks
);
18504 data
.outfile_check_timer
= outfile_check_timer
;
18510 char **induction_dictionaries
= NULL
;
18512 int induction_dictionaries_cnt
= 0;
18514 hcstat_table_t
*root_table_buf
= NULL
;
18515 hcstat_table_t
*markov_table_buf
= NULL
;
18517 uint initial_restore_done
= 0;
18519 data
.maskcnt
= maskcnt
;
18521 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
18523 if (data
.devices_status
== STATUS_CRACKED
) continue;
18524 if (data
.devices_status
== STATUS_ABORTED
) continue;
18525 if (data
.devices_status
== STATUS_QUIT
) continue;
18527 if (maskpos
> rd
->maskpos
)
18532 rd
->maskpos
= maskpos
;
18533 data
.maskpos
= maskpos
;
18535 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
18537 char *mask
= masks
[maskpos
];
18539 if (mask_from_file
== 1)
18541 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
18546 uint mask_offset
= 0;
18548 uint separator_cnt
;
18550 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
18552 str_ptr
= strstr (mask
+ mask_offset
, ",");
18554 if (str_ptr
== NULL
) break;
18556 str_pos
= str_ptr
- mask
;
18558 // escaped separator, i.e. "\,"
18562 if (mask
[str_pos
- 1] == '\\')
18566 mask_offset
= str_pos
+ 1;
18572 // reset the offset
18576 mask
[str_pos
] = '\0';
18578 switch (separator_cnt
)
18581 mp_reset_usr (mp_usr
, 0);
18583 custom_charset_1
= mask
;
18584 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
18588 mp_reset_usr (mp_usr
, 1);
18590 custom_charset_2
= mask
;
18591 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
18595 mp_reset_usr (mp_usr
, 2);
18597 custom_charset_3
= mask
;
18598 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
18602 mp_reset_usr (mp_usr
, 3);
18604 custom_charset_4
= mask
;
18605 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
18609 mask
= mask
+ str_pos
+ 1;
18613 * 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 "\")
18614 * it would be interpreted as a custom charset definition.
18616 * We need to replace all "\," with just "," within the mask (but allow the special case "\\," which means "\" followed by ",")
18617 * 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 ","
18620 uint mask_len_cur
= strlen (mask
);
18622 uint mask_out_pos
= 0;
18623 char mask_prev
= 0;
18625 for (uint mask_iter
= 0; mask_iter
< mask_len_cur
; mask_iter
++, mask_out_pos
++)
18627 if (mask
[mask_iter
] == ',')
18629 if (mask_prev
== '\\')
18631 mask_out_pos
-= 1; // this means: skip the previous "\"
18635 mask_prev
= mask
[mask_iter
];
18637 mask
[mask_out_pos
] = mask
[mask_iter
];
18640 mask
[mask_out_pos
] = '\0';
18643 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18647 local_free (css_buf
);
18648 local_free (data
.root_css_buf
);
18649 local_free (data
.markov_css_buf
);
18651 local_free (masks
[maskpos
- 1]);
18654 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
18657 data
.css_cnt
= css_cnt
;
18658 data
.css_buf
= css_buf
;
18660 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
18662 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
18664 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
18665 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
18667 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
18669 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
18671 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
18672 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
18674 data
.root_css_buf
= root_css_buf
;
18675 data
.markov_css_buf
= markov_css_buf
;
18677 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
18679 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
18681 local_free (root_table_buf
);
18682 local_free (markov_table_buf
);
18686 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18688 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18690 if (device_param
->skipped
) continue;
18692 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
18693 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
18694 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
18696 device_param
->kernel_params_mp_buf64
[3] = 0;
18697 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
18698 device_param
->kernel_params_mp_buf32
[5] = 0;
18699 device_param
->kernel_params_mp_buf32
[6] = 0;
18700 device_param
->kernel_params_mp_buf32
[7] = 0;
18702 if (attack_mode
== ATTACK_MODE_HYBRID1
)
18704 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
18705 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
18706 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
18707 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
18709 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
18711 device_param
->kernel_params_mp_buf32
[5] = 0;
18712 device_param
->kernel_params_mp_buf32
[6] = 0;
18713 device_param
->kernel_params_mp_buf32
[7] = 0;
18716 cl_int CL_err
= CL_SUCCESS
;
18718 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
]);
18719 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
]);
18720 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
]);
18722 if (CL_err
!= CL_SUCCESS
)
18724 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
18729 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
);
18730 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
);
18732 if (CL_err
!= CL_SUCCESS
)
18734 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
18740 else if (attack_mode
== ATTACK_MODE_BF
)
18742 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
18746 for (uint i
= 0; i
< dictcnt
; i
++)
18748 local_free (dictfiles
[i
]);
18751 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
18753 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
18755 if (l1_filename
== NULL
) break;
18759 dictfiles
[dictcnt
- 1] = l1_filename
;
18766 dictfiles
[dictcnt
- 1] = mask
;
18771 log_error ("ERROR: Mask is too small");
18778 free (induction_dictionaries
);
18780 // induction_dictionaries_cnt = 0; // implied
18782 if (attack_mode
!= ATTACK_MODE_BF
)
18786 induction_dictionaries
= scan_directory (induction_directory
);
18788 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
18792 if (induction_dictionaries_cnt
)
18794 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
18798 * prevent the user from using --keyspace together w/ maskfile and or dictfile
18802 if ((maskcnt
> 1) || (dictcnt
> 1))
18804 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
18810 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; dictpos
++)
18812 if (data
.devices_status
== STATUS_CRACKED
) continue;
18813 if (data
.devices_status
== STATUS_ABORTED
) continue;
18814 if (data
.devices_status
== STATUS_QUIT
) continue;
18816 rd
->dictpos
= dictpos
;
18818 char *subid
= logfile_generate_subid ();
18820 data
.subid
= subid
;
18822 logfile_sub_msg ("START");
18824 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
18826 data
.devices_status
= STATUS_INIT
;
18829 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
18830 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
18831 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
18833 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
18837 data
.cpt_start
= time (NULL
);
18839 data
.cpt_total
= 0;
18841 if (data
.restore
== 0)
18843 rd
->words_cur
= skip
;
18850 data
.ms_paused
= 0;
18852 data
.kernel_power_final
= 0;
18854 data
.words_cur
= rd
->words_cur
;
18856 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
18858 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
18860 if (device_param
->skipped
) continue;
18862 device_param
->speed_pos
= 0;
18864 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
18865 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
18867 device_param
->exec_pos
= 0;
18869 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
18871 device_param
->outerloop_pos
= 0;
18872 device_param
->outerloop_left
= 0;
18873 device_param
->innerloop_pos
= 0;
18874 device_param
->innerloop_left
= 0;
18876 // some more resets:
18878 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
18880 device_param
->pws_cnt
= 0;
18882 device_param
->words_off
= 0;
18883 device_param
->words_done
= 0;
18886 // figure out some workload
18888 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
18890 if (data
.wordlist_mode
== WL_MODE_FILE
)
18892 char *dictfile
= NULL
;
18894 if (induction_dictionaries_cnt
)
18896 dictfile
= induction_dictionaries
[0];
18900 dictfile
= dictfiles
[dictpos
];
18903 data
.dictfile
= dictfile
;
18905 logfile_sub_string (dictfile
);
18907 for (uint i
= 0; i
< rp_files_cnt
; i
++)
18909 logfile_sub_var_string ("rulefile", rp_files
[i
]);
18912 FILE *fd2
= fopen (dictfile
, "rb");
18916 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18921 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18925 if (data
.words_cnt
== 0)
18927 logfile_sub_msg ("STOP");
18933 else if (attack_mode
== ATTACK_MODE_COMBI
)
18935 char *dictfile
= data
.dictfile
;
18936 char *dictfile2
= data
.dictfile2
;
18938 logfile_sub_string (dictfile
);
18939 logfile_sub_string (dictfile2
);
18941 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
18943 FILE *fd2
= fopen (dictfile
, "rb");
18947 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
18952 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
18956 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
18958 FILE *fd2
= fopen (dictfile2
, "rb");
18962 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
18967 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
18972 if (data
.words_cnt
== 0)
18974 logfile_sub_msg ("STOP");
18979 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
18981 char *dictfile
= NULL
;
18983 if (induction_dictionaries_cnt
)
18985 dictfile
= induction_dictionaries
[0];
18989 dictfile
= dictfiles
[dictpos
];
18992 data
.dictfile
= dictfile
;
18994 char *mask
= data
.mask
;
18996 logfile_sub_string (dictfile
);
18997 logfile_sub_string (mask
);
18999 FILE *fd2
= fopen (dictfile
, "rb");
19003 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
19008 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
19012 if (data
.words_cnt
== 0)
19014 logfile_sub_msg ("STOP");
19019 else if (attack_mode
== ATTACK_MODE_BF
)
19021 local_free (css_buf
);
19022 local_free (data
.root_css_buf
);
19023 local_free (data
.markov_css_buf
);
19025 char *mask
= dictfiles
[dictpos
];
19027 logfile_sub_string (mask
);
19031 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
19033 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19035 uint css_cnt_unicode
= css_cnt
* 2;
19037 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
19039 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
19041 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
19043 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
19044 css_buf_unicode
[j
+ 1].cs_len
= 1;
19049 css_buf
= css_buf_unicode
;
19050 css_cnt
= css_cnt_unicode
;
19053 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
19055 uint mask_min
= pw_min
;
19056 uint mask_max
= pw_max
;
19058 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19064 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
19066 if (css_cnt
< mask_min
)
19068 log_info ("WARNING: Skipping mask '%s' because it is smaller than the minimum password length", mask
);
19071 if (css_cnt
> mask_max
)
19073 log_info ("WARNING: Skipping mask '%s' because it is larger than the maximum password length", mask
);
19076 // skip to next mask
19078 logfile_sub_msg ("STOP");
19083 uint save_css_cnt
= css_cnt
;
19085 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
19087 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
19089 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
19090 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
19092 uint css_cnt_salt
= css_cnt
+ salt_len
;
19094 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
19096 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
19098 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
19100 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
19101 css_buf_salt
[j
].cs_len
= 1;
19106 css_buf
= css_buf_salt
;
19107 css_cnt
= css_cnt_salt
;
19112 data
.css_cnt
= css_cnt
;
19113 data
.css_buf
= css_buf
;
19115 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
19117 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
19119 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
19121 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
19122 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
19124 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
19126 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
19128 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
19129 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
19131 data
.root_css_buf
= root_css_buf
;
19132 data
.markov_css_buf
= markov_css_buf
;
19134 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
19136 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
19138 local_free (root_table_buf
);
19139 local_free (markov_table_buf
);
19143 uint css_cnt_l
= css_cnt
;
19146 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
19148 if (save_css_cnt
< 6)
19152 else if (save_css_cnt
== 6)
19158 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
19160 if (save_css_cnt
== 8 || save_css_cnt
== 10)
19171 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
19186 /* unfinished code?
19187 int sum = css_buf[css_cnt_r - 1].cs_len;
19189 for (uint i = 1; i < 4 && i < css_cnt; i++)
19191 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
19195 sum *= css_buf[css_cnt_r - 1].cs_len;
19200 css_cnt_l
-= css_cnt_r
;
19202 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
19204 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19206 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19208 if (device_param
->skipped
) continue;
19210 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
19211 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
19212 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
19214 device_param
->kernel_params_mp_l_buf64
[3] = 0;
19215 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
19216 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
19217 device_param
->kernel_params_mp_l_buf32
[6] = 0;
19218 device_param
->kernel_params_mp_l_buf32
[7] = 0;
19219 device_param
->kernel_params_mp_l_buf32
[8] = 0;
19221 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
19222 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
19223 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
19224 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
19226 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
19227 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
19228 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
19230 device_param
->kernel_params_mp_r_buf64
[3] = 0;
19231 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
19232 device_param
->kernel_params_mp_r_buf32
[5] = 0;
19233 device_param
->kernel_params_mp_r_buf32
[6] = 0;
19234 device_param
->kernel_params_mp_r_buf32
[7] = 0;
19236 cl_int CL_err
= CL_SUCCESS
;
19238 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
]);
19239 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
]);
19240 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
]);
19242 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
]);
19243 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
]);
19244 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
]);
19246 if (CL_err
!= CL_SUCCESS
)
19248 log_error ("ERROR: clSetKernelArg(): %s\n", val2cstr_cl (CL_err
));
19253 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
);
19254 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
);
19256 if (CL_err
!= CL_SUCCESS
)
19258 log_error ("ERROR: clEnqueueWriteBuffer(): %s\n", val2cstr_cl (CL_err
));
19265 u64 words_base
= data
.words_cnt
;
19267 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19269 if (data
.kernel_rules_cnt
)
19271 words_base
/= data
.kernel_rules_cnt
;
19274 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19276 if (data
.combs_cnt
)
19278 words_base
/= data
.combs_cnt
;
19281 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19285 words_base
/= data
.bfs_cnt
;
19289 data
.words_base
= words_base
;
19293 log_info ("%llu", (unsigned long long int) words_base
);
19298 if (data
.words_cur
> data
.words_base
)
19300 log_error ("ERROR: Restore value greater keyspace");
19305 if (data
.words_cur
)
19307 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
19309 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19311 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
19314 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
19316 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19318 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
19321 else if (data
.attack_kern
== ATTACK_KERN_BF
)
19323 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
19325 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
19331 * Update loopback file
19340 uint random_num
= get_random_num (0, 9999);
19342 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
19344 data
.loopback_file
= loopback_file
;
19348 * Update dictionary statistic
19353 dictstat_fp
= fopen (dictstat
, "wb");
19357 lock_file (dictstat_fp
);
19359 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
19361 fclose (dictstat_fp
);
19366 * create autotune threads
19369 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
19371 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19373 data
.devices_status
= STATUS_AUTOTUNE
;
19376 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19378 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19380 hc_thread_create (c_threads
[device_id
], thread_autotune
, device_param
);
19383 hc_thread_wait (data
.devices_cnt
, c_threads
);
19386 * Inform user about possible slow speeds
19389 uint hardware_power_all
= 0;
19391 uint kernel_power_all
= 0;
19393 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19395 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19397 hardware_power_all
+= device_param
->hardware_power
;
19399 kernel_power_all
+= device_param
->kernel_power
;
19402 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
19404 data
.kernel_power_all
= kernel_power_all
;
19406 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19408 if (data
.words_base
< kernel_power_all
)
19414 log_info ("ATTENTION!");
19415 log_info (" The wordlist or mask you are using is too small.");
19416 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
19417 log_info (" The cracking speed will drop.");
19418 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
19425 * create cracker threads
19428 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19430 data
.devices_status
= STATUS_RUNNING
;
19433 if (initial_restore_done
== 0)
19435 if (data
.restore_disable
== 0) cycle_restore ();
19437 initial_restore_done
= 1;
19440 hc_timer_set (&data
.timer_running
);
19442 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
19444 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
19446 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
19447 if (quiet
== 0) fflush (stdout
);
19450 else if (wordlist_mode
== WL_MODE_STDIN
)
19452 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
19453 if (data
.quiet
== 0) log_info ("");
19456 time_t runtime_start
;
19458 time (&runtime_start
);
19460 data
.runtime_start
= runtime_start
;
19462 data
.prepare_time
+= runtime_start
- prepare_start
;
19464 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19466 hc_device_param_t
*device_param
= &devices_param
[device_id
];
19468 if (wordlist_mode
== WL_MODE_STDIN
)
19470 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
19474 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
19478 hc_thread_wait (data
.devices_cnt
, c_threads
);
19480 local_free (c_threads
);
19482 if ((data
.devices_status
!= STATUS_BYPASS
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
19484 data
.devices_status
= STATUS_EXHAUSTED
;
19487 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
19491 if (induction_dictionaries_cnt
)
19493 unlink (induction_dictionaries
[0]);
19496 free (induction_dictionaries
);
19498 if (attack_mode
!= ATTACK_MODE_BF
)
19500 induction_dictionaries
= scan_directory (induction_directory
);
19502 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
19505 if (benchmark
== 1)
19507 status_benchmark ();
19509 if (machine_readable
== 0)
19535 if (induction_dictionaries_cnt
)
19537 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
19539 // 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)
19544 time_t runtime_stop
;
19546 time (&runtime_stop
);
19548 data
.runtime_stop
= runtime_stop
;
19550 logfile_sub_uint (runtime_start
);
19551 logfile_sub_uint (runtime_stop
);
19553 time (&prepare_start
);
19555 logfile_sub_msg ("STOP");
19557 global_free (subid
);
19559 // from this point we handle bypass as running
19561 if (data
.devices_status
== STATUS_BYPASS
)
19563 data
.devices_status
= STATUS_RUNNING
;
19566 // and overwrite benchmark aborts as well
19568 if (data
.benchmark
== 1)
19570 if (data
.devices_status
== STATUS_ABORTED
)
19572 data
.devices_status
= STATUS_RUNNING
;
19578 if (data
.devices_status
== STATUS_CRACKED
) break;
19579 if (data
.devices_status
== STATUS_ABORTED
) break;
19580 if (data
.devices_status
== STATUS_QUIT
) break;
19583 if (data
.devices_status
== STATUS_CRACKED
) break;
19584 if (data
.devices_status
== STATUS_ABORTED
) break;
19585 if (data
.devices_status
== STATUS_QUIT
) break;
19588 // 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
19589 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
19591 if (data
.wordlist_mode
== WL_MODE_FILE
)
19593 if (data
.dictfile
== NULL
)
19595 if (dictfiles
!= NULL
)
19597 data
.dictfile
= dictfiles
[0];
19599 hc_timer_set (&data
.timer_running
);
19604 // NOTE: combi is okay because it is already set beforehand
19605 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
19607 if (data
.dictfile
== NULL
)
19609 if (dictfiles
!= NULL
)
19611 hc_timer_set (&data
.timer_running
);
19613 data
.dictfile
= dictfiles
[0];
19617 else if (attack_mode
== ATTACK_MODE_BF
)
19619 if (data
.mask
== NULL
)
19621 hc_timer_set (&data
.timer_running
);
19623 data
.mask
= masks
[0];
19627 // if cracked / aborted remove last induction dictionary
19629 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
19631 struct stat induct_stat
;
19633 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
19635 unlink (induction_dictionaries
[file_pos
]);
19639 // wait for inner threads
19641 data
.shutdown_inner
= 1;
19643 for (uint thread_idx
= 0; thread_idx
< inner_threads_cnt
; thread_idx
++)
19645 hc_thread_wait (1, &inner_threads
[thread_idx
]);
19648 local_free (inner_threads
);
19650 // we dont need restore file anymore
19651 if (data
.restore_disable
== 0)
19653 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
19655 unlink (eff_restore_file
);
19656 unlink (new_restore_file
);
19664 // finally save left hashes
19666 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
19675 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19677 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19679 if (device_param
->skipped
) continue;
19681 cl_int CL_err
= CL_SUCCESS
;
19683 local_free (device_param
->combs_buf
);
19684 local_free (device_param
->hooks_buf
);
19685 local_free (device_param
->device_name
);
19686 local_free (device_param
->device_name_chksum
);
19687 local_free (device_param
->device_version
);
19688 local_free (device_param
->driver_version
);
19690 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
19692 if (device_param
->d_pws_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
19693 if (device_param
->d_pws_amp_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
19694 if (device_param
->d_rules
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
19695 if (device_param
->d_rules_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
19696 if (device_param
->d_combs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
19697 if (device_param
->d_combs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
19698 if (device_param
->d_bfs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
19699 if (device_param
->d_bfs_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
19700 if (device_param
->d_bitmap_s1_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
19701 if (device_param
->d_bitmap_s1_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
19702 if (device_param
->d_bitmap_s1_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
19703 if (device_param
->d_bitmap_s1_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
19704 if (device_param
->d_bitmap_s2_a
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
19705 if (device_param
->d_bitmap_s2_b
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
19706 if (device_param
->d_bitmap_s2_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
19707 if (device_param
->d_bitmap_s2_d
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
19708 if (device_param
->d_plain_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
19709 if (device_param
->d_digests_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
19710 if (device_param
->d_digests_shown
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
19711 if (device_param
->d_salt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
19712 if (device_param
->d_esalt_bufs
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
19713 if (device_param
->d_tmps
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
19714 if (device_param
->d_hooks
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
19715 if (device_param
->d_result
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
19716 if (device_param
->d_scryptV0_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV0_buf
);
19717 if (device_param
->d_scryptV1_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV1_buf
);
19718 if (device_param
->d_scryptV2_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV2_buf
);
19719 if (device_param
->d_scryptV3_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV3_buf
);
19720 if (device_param
->d_root_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
19721 if (device_param
->d_markov_css_buf
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
19722 if (device_param
->d_tm_c
) CL_err
|= hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
19724 if (CL_err
!= CL_SUCCESS
)
19726 log_error ("ERROR: clReleaseMemObject(): %s\n", val2cstr_cl (CL_err
));
19731 if (device_param
->kernel1
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
19732 if (device_param
->kernel12
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
19733 if (device_param
->kernel2
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
19734 if (device_param
->kernel23
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
19735 if (device_param
->kernel3
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
19736 if (device_param
->kernel_mp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
19737 if (device_param
->kernel_mp_l
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
19738 if (device_param
->kernel_mp_r
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
19739 if (device_param
->kernel_tm
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
19740 if (device_param
->kernel_amp
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
19741 if (device_param
->kernel_memset
) CL_err
|= hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
19743 if (CL_err
!= CL_SUCCESS
)
19745 log_error ("ERROR: clReleaseKernel(): %s\n", val2cstr_cl (CL_err
));
19750 if (device_param
->program
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program
);
19751 if (device_param
->program_mp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
19752 if (device_param
->program_amp
) CL_err
|= hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
19754 if (CL_err
!= CL_SUCCESS
)
19756 log_error ("ERROR: clReleaseProgram(): %s\n", val2cstr_cl (CL_err
));
19761 if (device_param
->command_queue
) CL_err
|= hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
19763 if (CL_err
!= CL_SUCCESS
)
19765 log_error ("ERROR: clReleaseCommandQueue(): %s\n", val2cstr_cl (CL_err
));
19770 if (device_param
->context
) CL_err
|= hc_clReleaseContext (data
.ocl
, device_param
->context
);
19772 if (CL_err
!= CL_SUCCESS
)
19774 log_error ("ERROR: hc_clReleaseContext(): %s\n", val2cstr_cl (CL_err
));
19780 // reset default fan speed
19783 if (gpu_temp_disable
== 0)
19785 if (gpu_temp_retain
!= 0)
19787 hc_thread_mutex_lock (mux_adl
);
19789 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19791 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19793 if (device_param
->skipped
) continue;
19795 if (data
.hm_device
[device_id
].fan_set_supported
== 1)
19799 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
19801 rc
= hm_set_fanspeed_with_device_id_adl (device_id
, 100, 0);
19803 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
19806 rc
= set_fan_control (data
.hm_xnvctrl
, data
.hm_device
[device_id
].xnvctrl
, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE
);
19810 rc
= hm_set_fanspeed_with_device_id_nvapi (device_id
, 100, 0);
19814 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed and policy for device #%", device_id
+ 1);
19818 hc_thread_mutex_unlock (mux_adl
);
19822 // reset power tuning
19824 if (powertune_enable
== 1)
19826 hc_thread_mutex_lock (mux_adl
);
19828 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
19830 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
19832 if (device_param
->skipped
) continue;
19834 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_AMD
)
19836 if (data
.hm_device
[device_id
].od_version
== 6)
19838 // check powertune capabilities first, if not available then skip device
19840 int powertune_supported
= 0;
19842 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_adl
, data
.hm_device
[device_id
].adl
, &powertune_supported
)) != ADL_OK
)
19844 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
19849 if (powertune_supported
!= 0)
19851 // powercontrol settings
19853 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, od_power_control_status
[device_id
])) != ADL_OK
)
19855 log_info ("ERROR: Failed to restore the ADL PowerControl values");
19862 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
19864 performance_state
->iNumberOfPerformanceLevels
= 2;
19866 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
19867 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
19868 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
19869 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
19871 if ((hm_ADL_Overdrive_State_Set (data
.hm_adl
, data
.hm_device
[device_id
].adl
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
19873 log_info ("ERROR: Failed to restore ADL performance state");
19878 local_free (performance_state
);
19883 if (data
.devices_param
[device_id
].device_vendor_id
== VENDOR_ID_NV
)
19885 unsigned int limit
= nvml_power_limit
[device_id
];
19889 hm_NVML_nvmlDeviceSetPowerManagementLimit (data
.hm_nvml
, 0, data
.hm_device
[device_id
].nvml
, limit
);
19894 hc_thread_mutex_unlock (mux_adl
);
19897 if (gpu_temp_disable
== 0)
19901 hm_NVML_nvmlShutdown (data
.hm_nvml
);
19903 nvml_close (data
.hm_nvml
);
19905 data
.hm_nvml
= NULL
;
19910 hm_NvAPI_Unload (data
.hm_nvapi
);
19912 nvapi_close (data
.hm_nvapi
);
19914 data
.hm_nvapi
= NULL
;
19917 if (data
.hm_xnvctrl
)
19919 hm_XNVCTRL_XCloseDisplay (data
.hm_xnvctrl
);
19921 xnvctrl_close (data
.hm_xnvctrl
);
19923 data
.hm_xnvctrl
= NULL
;
19928 hm_ADL_Main_Control_Destroy (data
.hm_adl
);
19930 adl_close (data
.hm_adl
);
19932 data
.hm_adl
= NULL
;
19935 #endif // HAVE_HWMON
19939 local_free (masks
);
19941 local_free (dictstat_base
);
19943 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
19945 pot_t
*pot_ptr
= &pot
[pot_pos
];
19947 hash_t
*hash
= &pot_ptr
->hash
;
19949 local_free (hash
->digest
);
19953 local_free (hash
->salt
);
19959 local_free (all_kernel_rules_cnt
);
19960 local_free (all_kernel_rules_buf
);
19962 local_free (wl_data
->buf
);
19963 local_free (wl_data
);
19965 local_free (bitmap_s1_a
);
19966 local_free (bitmap_s1_b
);
19967 local_free (bitmap_s1_c
);
19968 local_free (bitmap_s1_d
);
19969 local_free (bitmap_s2_a
);
19970 local_free (bitmap_s2_b
);
19971 local_free (bitmap_s2_c
);
19972 local_free (bitmap_s2_d
);
19975 local_free (od_clock_mem_status
);
19976 local_free (od_power_control_status
);
19977 local_free (nvml_power_limit
);
19980 global_free (devices_param
);
19982 global_free (kernel_rules_buf
);
19984 global_free (root_css_buf
);
19985 global_free (markov_css_buf
);
19987 global_free (digests_buf
);
19988 global_free (digests_shown
);
19989 global_free (digests_shown_tmp
);
19991 global_free (salts_buf
);
19992 global_free (salts_shown
);
19994 global_free (esalts_buf
);
19996 global_free (words_progress_done
);
19997 global_free (words_progress_rejected
);
19998 global_free (words_progress_restored
);
20000 if (pot_fp
) fclose (pot_fp
);
20002 if (data
.devices_status
== STATUS_QUIT
) break;
20005 // wait for outer threads
20007 data
.shutdown_outer
= 1;
20009 for (uint thread_idx
= 0; thread_idx
< outer_threads_cnt
; thread_idx
++)
20011 hc_thread_wait (1, &outer_threads
[thread_idx
]);
20014 local_free (outer_threads
);
20016 // destroy others mutex
20018 hc_thread_mutex_delete (mux_dispatcher
);
20019 hc_thread_mutex_delete (mux_counter
);
20020 hc_thread_mutex_delete (mux_display
);
20021 hc_thread_mutex_delete (mux_adl
);
20025 local_free (eff_restore_file
);
20026 local_free (new_restore_file
);
20032 tuning_db_destroy (tuning_db
);
20036 local_free (loopback_file
);
20038 if (loopback
== 1) unlink (loopback_file
);
20040 // induction directory
20042 if (induction_dir
== NULL
)
20044 if (attack_mode
!= ATTACK_MODE_BF
)
20046 if (rmdir (induction_directory
) == -1)
20048 if (errno
== ENOENT
)
20050 // good, we can ignore
20052 else if (errno
== ENOTEMPTY
)
20054 // good, we can ignore
20058 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
20064 local_free (induction_directory
);
20068 // outfile-check directory
20070 if (outfile_check_dir
== NULL
)
20072 if (rmdir (outfile_check_directory
) == -1)
20074 if (errno
== ENOENT
)
20076 // good, we can ignore
20078 else if (errno
== ENOTEMPTY
)
20080 // good, we can ignore
20084 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
20090 local_free (outfile_check_directory
);
20097 logfile_top_uint (proc_start
);
20098 logfile_top_uint (proc_stop
);
20100 logfile_top_msg ("STOP");
20102 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
20103 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
20105 if (data
.ocl
) ocl_close (data
.ocl
);
20107 if (data
.devices_status
== STATUS_ABORTED
) return 2;
20108 if (data
.devices_status
== STATUS_QUIT
) return 2;
20109 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
20110 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
20111 if (data
.devices_status
== STATUS_CRACKED
) return 0;