2 * Authors.....: Jens Steube <jens.steube@gmail.com>
3 * Gabriele Gristina <matrix@hashcat.net>
4 * magnum <john.magnum@hushmail.com>
15 #include <rp_kernel_on_cpu.h>
18 const char *PROGNAME
= "hashcat";
19 const uint VERSION_BIN
= 300;
20 const uint RESTORE_MIN
= 300;
22 double TARGET_MS_PROFILE
[4] = { 2, 12, 96, 480 };
24 #define INCR_RULES 10000
25 #define INCR_SALTS 100000
26 #define INCR_MASKS 1000
32 #define MARKOV_THRESHOLD 0
33 #define MARKOV_DISABLE 0
34 #define MARKOV_CLASSIC 0
37 #define RESTORE_TIMER 60
38 #define RESTORE_DISABLE 0
40 #define STATUS_TIMER 10
41 #define MACHINE_READABLE 0
43 #define WEAK_HASH_THRESHOLD 100
48 #define REMOVE_TIMER 60
52 #define POTFILE_DISABLE 0
55 #define RP_GEN_FUNC_MIN 1
56 #define RP_GEN_FUNC_MAX 4
58 #define RULE_BUF_L ":"
59 #define RULE_BUF_R ":"
64 #define HEX_WORDLIST 0
65 #define OUTFILE_FORMAT 3
66 #define OUTFILE_AUTOHEX 1
67 #define OUTFILE_CHECK_TIMER 5
70 #define SEGMENT_SIZE 32
72 #define INCREMENT_MIN 1
73 #define INCREMENT_MAX PW_MAX
77 #define GPU_TEMP_DISABLE 0
78 #define GPU_TEMP_ABORT 90
79 #define GPU_TEMP_RETAIN 80
80 #define WORKLOAD_PROFILE 2
81 #define KERNEL_ACCEL 0
82 #define KERNEL_LOOPS 0
83 #define KERNEL_RULES 1024
84 #define KERNEL_COMBS 1024
85 #define KERNEL_BFS 1024
86 #define KERNEL_THREADS_MAX 256
87 #define KERNEL_THREADS_MAX_CPU 16
88 #define POWERTUNE_ENABLE 0
89 #define LOGFILE_DISABLE 0
91 #define OPENCL_VECTOR_WIDTH 0
93 #define WL_MODE_STDIN 1
94 #define WL_MODE_FILE 2
95 #define WL_MODE_MASK 3
97 #define HL_MODE_FILE 4
100 #define HLFMTS_CNT 11
101 #define HLFMT_HASHCAT 0
102 #define HLFMT_PWDUMP 1
103 #define HLFMT_PASSWD 2
104 #define HLFMT_SHADOW 3
107 #define HLFMT_NETNTLM1 7
108 #define HLFMT_NETNTLM2 8
109 #define HLFMT_NSLDAP 9
110 #define HLFMT_NSLDAPS 10
112 #define HLFMT_TEXT_HASHCAT "native hashcat"
113 #define HLFMT_TEXT_PWDUMP "pwdump"
114 #define HLFMT_TEXT_PASSWD "passwd"
115 #define HLFMT_TEXT_SHADOW "shadow"
116 #define HLFMT_TEXT_DCC "DCC"
117 #define HLFMT_TEXT_DCC2 "DCC 2"
118 #define HLFMT_TEXT_NETNTLM1 "NetNTLMv1"
119 #define HLFMT_TEXT_NETNTLM2 "NetNTLMv2"
120 #define HLFMT_TEXT_NSLDAP "nsldap"
121 #define HLFMT_TEXT_NSLDAPS "nsldaps"
123 #define ATTACK_MODE_STRAIGHT 0
124 #define ATTACK_MODE_COMBI 1
125 #define ATTACK_MODE_TOGGLE 2
126 #define ATTACK_MODE_BF 3
127 #define ATTACK_MODE_PERM 4
128 #define ATTACK_MODE_TABLE 5
129 #define ATTACK_MODE_HYBRID1 6
130 #define ATTACK_MODE_HYBRID2 7
131 #define ATTACK_MODE_NONE 100
133 #define ATTACK_KERN_STRAIGHT 0
134 #define ATTACK_KERN_COMBI 1
135 #define ATTACK_KERN_BF 3
136 #define ATTACK_KERN_NONE 100
138 #define ATTACK_EXEC_OUTSIDE_KERNEL 10
139 #define ATTACK_EXEC_INSIDE_KERNEL 11
141 #define COMBINATOR_MODE_BASE_LEFT 10001
142 #define COMBINATOR_MODE_BASE_RIGHT 10002
144 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
145 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
147 #define MAX_CUT_TRIES 4
149 #define MAX_DICTSTAT 10000
151 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 143
153 #define global_free(attr) \
155 myfree ((void *) data.attr); \
160 #define local_free(attr) \
162 myfree ((void *) attr); \
167 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
318 static void (*get_next_word_func
) (char *, u32
, u32
*, u32
*);
324 static unsigned int full01
= 0x01010101;
325 static unsigned int full80
= 0x80808080;
327 int SUPPRESS_OUTPUT
= 0;
329 hc_thread_mutex_t mux_adl
;
330 hc_thread_mutex_t mux_counter
;
331 hc_thread_mutex_t mux_dispatcher
;
332 hc_thread_mutex_t mux_display
;
334 hc_global_data_t data
;
336 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
338 const char *USAGE_MINI
[] =
340 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
342 "Try --help for more help.",
346 const char *USAGE_BIG
[] =
348 "%s, advanced password recovery",
350 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
354 " Options Short / Long | Type | Description | Example",
355 "===============================|======|======================================================|=======================",
356 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
357 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
358 " -V, --version | | Print version |",
359 " -h, --help | | Print help |",
360 " --quiet | | Suppress output |",
361 " --hex-charset | | Assume charset is given in hex |",
362 " --hex-salt | | Assume salt is given in hex |",
363 " --hex-wordlist | | Assume words in wordlist is given in hex |",
364 " --force | | Ignore warnings |",
365 " --status | | Enable automatic update of the status-screen |",
366 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
367 " --machine-readable | | Display the status view in a machine readable format |",
368 " --loopback | | Add new plains to induct directory |",
369 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
370 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
371 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
372 " --markov-classic | | Enables classic markov-chains, no per-position |",
373 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
374 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
375 " --session | Str | Define specific session name | --session=mysession",
376 " --restore | | Restore session from --session |",
377 " --restore-disable | | Do not write restore file |",
378 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
379 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
380 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
381 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
382 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
383 " --show | | Show cracked passwords only |",
384 " --left | | Show un-cracked passwords only |",
385 " --username | | Enable ignoring of usernames in hashfile |",
386 " --remove | | Enable remove of hash once it is cracked |",
387 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
388 " --potfile-disable | | Do not write potfile |",
389 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
390 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
391 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
392 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
393 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
394 " --logfile-disable | | Disable the logfile |",
395 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
396 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
397 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
398 " -b, --benchmark | | Run benchmark |",
399 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
400 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
401 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
402 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
403 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
404 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
405 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
406 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
407 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
408 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
409 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
410 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
412 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
413 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
415 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
418 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
419 " -s, --skip | Num | Skip X words from the start | -s 1000000",
420 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
421 " --keyspace | | Show keyspace base:mod values and quit |",
422 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
423 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
424 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
425 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
426 " --generate-rules-func-min | Num | Force min X funcs per rule |",
427 " --generate-rules-func-max | Num | Force max X funcs per rule |",
428 " --generate-rules-seed | Num | Force RNG seed set to X |",
429 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
430 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
431 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
432 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
433 " -i, --increment | | Enable mask increment mode |",
434 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
435 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
437 "- [ Hash modes ] -",
439 " # | Name | Category",
440 " ======+==================================================+======================================",
441 " 900 | MD4 | Raw Hash",
442 " 0 | MD5 | Raw Hash",
443 " 5100 | Half MD5 | Raw Hash",
444 " 100 | SHA1 | Raw Hash",
445 " 10800 | SHA-384 | Raw Hash",
446 " 1400 | SHA-256 | Raw Hash",
447 " 1700 | SHA-512 | Raw Hash",
448 " 5000 | SHA-3(Keccak) | Raw Hash",
449 " 10100 | SipHash | Raw Hash",
450 " 6000 | RipeMD160 | Raw Hash",
451 " 6100 | Whirlpool | Raw Hash",
452 " 6900 | GOST R 34.11-94 | Raw Hash",
453 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
454 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
455 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
456 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
457 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
458 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
459 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
461 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
462 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
463 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
464 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
465 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
466 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
467 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
468 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
469 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
470 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
471 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
472 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
473 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
474 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
475 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
480 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
481 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
482 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
483 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
484 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
485 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
486 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
487 " 400 | phpass | Generic KDF",
488 " 8900 | scrypt | Generic KDF",
489 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
490 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
491 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
492 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
493 " 23 | Skype | Network protocols",
494 " 2500 | WPA/WPA2 | Network protocols",
495 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
496 " 5300 | IKE-PSK MD5 | Network protocols",
497 " 5400 | IKE-PSK SHA1 | Network protocols",
498 " 5500 | NetNTLMv1 | Network protocols",
499 " 5500 | NetNTLMv1 + ESS | Network protocols",
500 " 5600 | NetNTLMv2 | Network protocols",
501 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
502 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
503 " 8300 | DNSSEC (NSEC3) | Network protocols",
504 " 10200 | Cram MD5 | Network protocols",
505 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
506 " 11200 | MySQL CRAM (SHA1) | Network protocols",
507 " 11400 | SIP digest authentication (MD5) | Network protocols",
508 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
509 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
510 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
511 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
512 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
513 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
514 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
515 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
516 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
517 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
518 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
519 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
520 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
521 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
522 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
523 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
524 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
525 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
526 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
527 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
528 " 12 | PostgreSQL | Database Server",
529 " 131 | MSSQL(2000) | Database Server",
530 " 132 | MSSQL(2005) | Database Server",
531 " 1731 | MSSQL(2012) | Database Server",
532 " 1731 | MSSQL(2014) | Database Server",
533 " 200 | MySQL323 | Database Server",
534 " 300 | MySQL4.1/MySQL5 | Database Server",
535 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
536 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
537 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
538 " 8000 | Sybase ASE | Database Server",
539 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
540 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
541 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
542 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
543 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
544 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
545 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
546 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
547 " 11500 | CRC32 | Checksums",
548 " 3000 | LM | Operating-Systems",
549 " 1000 | NTLM | Operating-Systems",
550 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
551 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
552 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
553 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
554 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
555 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
556 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
557 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
558 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
559 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
560 " 1722 | OSX v10.7 | Operating-Systems",
561 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
562 " 6300 | AIX {smd5} | Operating-Systems",
563 " 6700 | AIX {ssha1} | Operating-Systems",
564 " 6400 | AIX {ssha256} | Operating-Systems",
565 " 6500 | AIX {ssha512} | Operating-Systems",
566 " 2400 | Cisco-PIX | Operating-Systems",
567 " 2410 | Cisco-ASA | Operating-Systems",
568 " 500 | Cisco-IOS $1$ | Operating-Systems",
569 " 5700 | Cisco-IOS $4$ | Operating-Systems",
570 " 9200 | Cisco-IOS $8$ | Operating-Systems",
571 " 9300 | Cisco-IOS $9$ | Operating-Systems",
572 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
573 " 501 | Juniper IVE | Operating-Systems",
574 " 5800 | Android PIN | Operating-Systems",
575 " 8100 | Citrix Netscaler | Operating-Systems",
576 " 8500 | RACF | Operating-Systems",
577 " 7200 | GRUB 2 | Operating-Systems",
578 " 9900 | Radmin2 | Operating-Systems",
579 " 125 | ArubaOS | Operating-Systems",
580 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
581 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
582 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
583 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
584 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
585 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
586 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
587 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
588 " 11600 | 7-Zip | Archives",
589 " 12500 | RAR3-hp | Archives",
590 " 13000 | RAR5 | Archives",
591 " 13200 | AxCrypt | Archives",
592 " 13300 | AxCrypt in memory SHA1 | Archives",
593 " 13600 | WinZip | Archives",
594 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
595 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
596 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
597 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
598 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
599 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
600 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
601 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
602 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
603 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
604 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
605 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
608 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
609 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
610 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
611 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
612 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
613 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
614 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
615 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
616 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
617 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
618 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
619 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
620 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
621 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
622 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
623 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
624 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
625 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
628 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
629 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
630 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
631 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
632 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
633 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
634 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
635 " 9400 | MS Office 2007 | Documents",
636 " 9500 | MS Office 2010 | Documents",
637 " 9600 | MS Office 2013 | Documents",
638 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
639 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
640 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
641 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
642 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
643 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
644 " 9000 | Password Safe v2 | Password Managers",
645 " 5200 | Password Safe v3 | Password Managers",
646 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
647 " 6600 | 1Password, agilekeychain | Password Managers",
648 " 8200 | 1Password, cloudkeychain | Password Managers",
649 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
650 " 12700 | Blockchain, My Wallet | Password Managers",
651 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
653 "- [ Outfile Formats ] -",
659 " 3 | hash[:salt]:plain",
661 " 5 | hash[:salt]:hex_plain",
662 " 6 | plain:hex_plain",
663 " 7 | hash[:salt]:plain:hex_plain",
665 " 9 | hash[:salt]:crack_pos",
666 " 10 | plain:crack_pos",
667 " 11 | hash[:salt]:plain:crack_pos",
668 " 12 | hex_plain:crack_pos",
669 " 13 | hash[:salt]:hex_plain:crack_pos",
670 " 14 | plain:hex_plain:crack_pos",
671 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
673 "- [ Rule Debugging Modes ] -",
678 " 2 | Original-Word",
679 " 3 | Original-Word:Finding-Rule",
680 " 4 | Original-Word:Finding-Rule:Processed-Word",
682 "- [ Attack Modes ] -",
689 " 6 | Hybrid Wordlist + Mask",
690 " 7 | Hybrid Mask + Wordlist",
692 "- [ Built-in Charsets ] -",
696 " l | abcdefghijklmnopqrstuvwxyz",
697 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
699 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
703 "- [ OpenCL Device Types ] -",
706 " ===+=============",
709 " 3 | FPGA, DSP, Co-Processor",
711 "- [ Workload Profiles ] -",
713 " # | Performance | Runtime | Power Consumption | Desktop Impact",
714 " ===+=============+=========+===================+=================",
715 " 1 | Low | 2 ms | Low | Minimal",
716 " 2 | Default | 12 ms | Economic | Noticeable",
717 " 3 | High | 96 ms | High | Unresponsive",
718 " 4 | Nightmare | 480 ms | Insane | Headless",
720 "If you have no idea what just happened then visit the following pages:",
722 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
723 "* https://hashcat.net/wiki/#frequently_asked_questions",
729 * hashcat specific functions
732 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
734 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
736 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
738 double exec_ms_sum
= 0;
742 for (int i
= 0; i
< last_num_entries
; i
++)
744 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
748 exec_ms_sum
+= exec_ms
;
754 if (exec_ms_cnt
== 0) return 0;
756 return exec_ms_sum
/ exec_ms_cnt
;
759 void status_display_machine_readable ()
763 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
769 fprintf (out
, "SPEED\t");
771 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
773 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
775 if (device_param
->skipped
) continue;
780 for (int i
= 0; i
< SPEED_CACHE
; i
++)
782 speed_cnt
+= device_param
->speed_cnt
[i
];
783 speed_ms
+= device_param
->speed_ms
[i
];
786 speed_cnt
/= SPEED_CACHE
;
787 speed_ms
/= SPEED_CACHE
;
789 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
796 fprintf (out
, "EXEC_RUNTIME\t");
798 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
800 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
802 if (device_param
->skipped
) continue;
804 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
806 fprintf (out
, "%f\t", exec_ms_avg
);
813 u64 words_cur
= get_lowest_words_done ();
815 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
821 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
824 u64 all_rejected
= 0;
825 u64 all_restored
= 0;
827 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
829 all_done
+= data
.words_progress_done
[salt_pos
];
830 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
831 all_restored
+= data
.words_progress_restored
[salt_pos
];
834 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
835 u64 progress_end
= progress_total
;
837 u64 progress_skip
= 0;
841 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
843 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
844 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
845 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
850 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
852 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
853 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
854 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
857 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
858 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
860 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
866 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
867 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
874 if (data
.gpu_temp_disable
== 0)
876 fprintf (out
, "TEMP\t");
878 hc_thread_mutex_lock (mux_adl
);
880 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
884 if (device_param
->skipped
) continue;
886 int temp
= hm_get_temperature_with_device_id (device_id
);
888 fprintf (out
, "%d\t", temp
);
891 hc_thread_mutex_unlock (mux_adl
);
911 void status_display ()
913 if (data
.devices_status
== STATUS_INIT
) return;
914 if (data
.devices_status
== STATUS_STARTING
) return;
915 if (data
.devices_status
== STATUS_BYPASS
) return;
917 if (data
.machine_readable
== 1)
919 status_display_machine_readable ();
924 char tmp_buf
[1000] = { 0 };
928 log_info ("Session.Name...: %s", data
.session
);
930 char *status_type
= strstatus (data
.devices_status
);
932 uint hash_mode
= data
.hash_mode
;
934 char *hash_type
= strhashtype (hash_mode
); // not a bug
936 log_info ("Status.........: %s", status_type
);
942 if (data
.rp_files_cnt
)
946 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
948 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
951 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
953 log_info ("Rules.Type.....: %s", tmp_buf
);
960 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
962 if (data
.rp_gen_seed
)
964 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
972 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
974 if (data
.wordlist_mode
== WL_MODE_FILE
)
976 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
978 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
980 log_info ("Input.Mode.....: Pipe");
983 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
985 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
986 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
988 else if (data
.attack_mode
== ATTACK_MODE_BF
)
990 char *mask
= data
.mask
;
994 uint mask_len
= data
.css_cnt
;
996 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1000 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1002 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1004 mask_len
-= data
.salts_buf
[0].salt_len
;
1008 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1010 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1013 if (data
.maskcnt
> 1)
1015 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1017 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1020 log_info ("Input.Mode.....: %s", tmp_buf
);
1025 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1027 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1028 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1030 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1032 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1033 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1036 if (data
.digests_cnt
== 1)
1038 if (data
.hash_mode
== 2500)
1040 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1042 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1043 (char *) data
.salts_buf
[0].salt_buf
,
1057 else if (data
.hash_mode
== 5200)
1059 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1061 else if (data
.hash_mode
== 9000)
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1065 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1069 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1071 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1075 char out_buf
[HCBUFSIZ
] = { 0 };
1077 ascii_digest (out_buf
, 0, 0);
1080 if (strlen (out_buf
) > 40)
1088 log_info ("Hash.Target....: %s", out_buf
);
1093 if (data
.hash_mode
== 3000)
1095 char out_buf1
[32] = { 0 };
1096 char out_buf2
[32] = { 0 };
1098 ascii_digest (out_buf1
, 0, 0);
1099 ascii_digest (out_buf2
, 0, 1);
1101 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1105 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1109 log_info ("Hash.Type......: %s", hash_type
);
1115 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1116 double speed_ms
[DEVICES_MAX
] = { 0 };
1118 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1120 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1122 if (device_param
->skipped
) continue;
1124 speed_cnt
[device_id
] = 0;
1125 speed_ms
[device_id
] = 0;
1127 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1129 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1130 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1133 speed_cnt
[device_id
] /= SPEED_CACHE
;
1134 speed_ms
[device_id
] /= SPEED_CACHE
;
1137 double hashes_all_ms
= 0;
1139 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1141 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1143 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1145 if (device_param
->skipped
) continue;
1147 hashes_dev_ms
[device_id
] = 0;
1149 if (speed_ms
[device_id
])
1151 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1153 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1161 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1163 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1165 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1167 if (device_param
->skipped
) continue;
1169 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1171 exec_all_ms
[device_id
] = exec_ms_avg
;
1178 double ms_running
= 0;
1180 hc_timer_get (data
.timer_running
, ms_running
);
1182 double ms_paused
= data
.ms_paused
;
1184 if (data
.devices_status
== STATUS_PAUSED
)
1186 double ms_paused_tmp
= 0;
1188 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1190 ms_paused
+= ms_paused_tmp
;
1195 __time64_t sec_run
= ms_running
/ 1000;
1199 time_t sec_run
= ms_running
/ 1000;
1205 char display_run
[32] = { 0 };
1209 struct tm
*tmp
= NULL
;
1213 tmp
= _gmtime64 (&sec_run
);
1217 tmp
= gmtime (&sec_run
);
1223 memset (&tm_run
, 0, sizeof (tm_run
));
1225 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1227 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1229 char *start
= ctime (&data
.proc_start
);
1231 size_t start_len
= strlen (start
);
1233 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1234 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1236 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1241 log_info ("Time.Started...: 0 secs");
1248 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1251 u64 all_rejected
= 0;
1252 u64 all_restored
= 0;
1254 u64 progress_noneed
= 0;
1256 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1258 all_done
+= data
.words_progress_done
[salt_pos
];
1259 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1260 all_restored
+= data
.words_progress_restored
[salt_pos
];
1262 // Important for ETA only
1264 if (data
.salts_shown
[salt_pos
] == 1)
1266 const u64 all
= data
.words_progress_done
[salt_pos
]
1267 + data
.words_progress_rejected
[salt_pos
]
1268 + data
.words_progress_restored
[salt_pos
];
1270 const u64 left
= data
.words_cnt
- all
;
1272 progress_noneed
+= left
;
1276 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1277 u64 progress_end
= progress_total
;
1279 u64 progress_skip
= 0;
1283 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1285 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1286 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1287 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1292 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1294 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1295 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1296 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1299 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1300 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1302 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1304 if (data
.devices_status
!= STATUS_CRACKED
)
1307 __time64_t sec_etc
= 0;
1314 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1316 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1318 sec_etc
= ms_left
/ 1000;
1323 //log_info ("Time.Estimated.: 0 secs");
1325 else if ((u64
) sec_etc
> ETC_MAX
)
1327 log_info ("Time.Estimated.: > 10 Years");
1331 char display_etc
[32] = { 0 };
1335 struct tm
*tmp
= NULL
;
1339 tmp
= _gmtime64 (&sec_etc
);
1343 tmp
= gmtime (&sec_etc
);
1349 memset (&tm_etc
, 0, sizeof (tm_etc
));
1351 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1353 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1361 char *etc
= ctime (&now
);
1363 size_t etc_len
= strlen (etc
);
1365 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1366 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1368 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1374 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1376 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1378 if (device_param
->skipped
) continue;
1380 char display_dev_cur
[16] = { 0 };
1382 strncpy (display_dev_cur
, "0.00", 4);
1384 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1386 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1389 char display_all_cur
[16] = { 0 };
1391 strncpy (display_all_cur
, "0.00", 4);
1393 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1395 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1397 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1398 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1400 log_info ("Recovered......: %u/%u (%.2f%%) Digests, %u/%u (%.2f%%) Salts", data
.digests_done
, data
.digests_cnt
, digests_percent
* 100, data
.salts_done
, data
.salts_cnt
, salts_percent
* 100);
1404 if (data
.digests_cnt
> 100)
1406 time_t now
= time (NULL
);
1408 int cpt_cur_min
= 0;
1409 int cpt_cur_hour
= 0;
1410 int cpt_cur_day
= 0;
1412 for (int i
= 0; i
< CPT_BUF
; i
++)
1414 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1415 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1417 if ((timestamp
+ 60) > now
)
1419 cpt_cur_min
+= cracked
;
1422 if ((timestamp
+ 3600) > now
)
1424 cpt_cur_hour
+= cracked
;
1427 if ((timestamp
+ 86400) > now
)
1429 cpt_cur_day
+= cracked
;
1433 double ms_real
= ms_running
- ms_paused
;
1435 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1436 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1437 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1439 if ((data
.cpt_start
+ 86400) < now
)
1441 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1449 else if ((data
.cpt_start
+ 3600) < now
)
1451 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1458 else if ((data
.cpt_start
+ 60) < now
)
1460 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1468 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1477 u64 restore_point
= get_lowest_words_done ();
1479 u64 restore_total
= data
.words_base
;
1481 float percent_restore
= 0;
1483 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1485 if (progress_end_relative_skip
)
1487 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1489 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1490 float percent_rejected
= 0.0;
1494 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1497 log_info ("Progress.......: %llu/%llu (%.02f%%)", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
, percent_finished
* 100);
1498 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1500 if (data
.restore_disable
== 0)
1502 if (percent_finished
!= 1)
1504 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1511 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1513 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1514 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1516 if (data
.restore_disable
== 0)
1518 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1523 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1524 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1526 // --restore not allowed if stdin is used -- really? why?
1528 //if (data.restore_disable == 0)
1530 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1536 if (data
.gpu_temp_disable
== 0)
1538 hc_thread_mutex_lock (mux_adl
);
1540 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1542 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1544 if (device_param
->skipped
) continue;
1546 #define HM_STR_BUF_SIZE 255
1548 if (data
.hm_device
[device_id
].fan_supported
== 1)
1550 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1551 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1552 char fanspeed
[HM_STR_BUF_SIZE
] = { 0 };
1554 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1555 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1557 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
1559 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1561 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
1563 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1566 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan", device_id
+ 1, utilization
, temperature
, fanspeed
);
1570 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1571 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1573 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1574 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1576 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id
+ 1, utilization
, temperature
);
1580 hc_thread_mutex_unlock (mux_adl
);
1582 #endif // HAVE_HWMON
1585 static void status_benchmark_automate ()
1587 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1588 double speed_ms
[DEVICES_MAX
] = { 0 };
1590 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1592 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1594 if (device_param
->skipped
) continue;
1596 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1597 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1600 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1602 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1604 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1606 if (device_param
->skipped
) continue;
1608 hashes_dev_ms
[device_id
] = 0;
1610 if (speed_ms
[device_id
])
1612 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1616 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1618 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1620 if (device_param
->skipped
) continue;
1622 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1626 static void status_benchmark ()
1628 if (data
.devices_status
== STATUS_INIT
) return;
1629 if (data
.devices_status
== STATUS_STARTING
) return;
1630 if (data
.devices_status
== STATUS_BYPASS
) return;
1632 if (data
.machine_readable
== 1)
1634 status_benchmark_automate ();
1639 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1640 double speed_ms
[DEVICES_MAX
] = { 0 };
1642 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1644 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1646 if (device_param
->skipped
) continue;
1648 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1649 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1652 double hashes_all_ms
= 0;
1654 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1656 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1658 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1660 if (device_param
->skipped
) continue;
1662 hashes_dev_ms
[device_id
] = 0;
1664 if (speed_ms
[device_id
])
1666 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1668 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1676 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1678 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1680 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1682 if (device_param
->skipped
) continue;
1684 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1686 exec_all_ms
[device_id
] = exec_ms_avg
;
1689 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1691 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1693 if (device_param
->skipped
) continue;
1695 char display_dev_cur
[16] = { 0 };
1697 strncpy (display_dev_cur
, "0.00", 4);
1699 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1701 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1704 char display_all_cur
[16] = { 0 };
1706 strncpy (display_all_cur
, "0.00", 4);
1708 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1710 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1714 * hashcat -only- functions
1717 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1719 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1721 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1722 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1723 else if (attack_kern
== ATTACK_KERN_COMBI
)
1724 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1725 else if (attack_kern
== ATTACK_KERN_BF
)
1726 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1729 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1732 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1734 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1736 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1737 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1738 else if (attack_kern
== ATTACK_KERN_COMBI
)
1739 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1740 else if (attack_kern
== ATTACK_KERN_BF
)
1741 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1745 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1749 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1751 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1753 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1757 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1761 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1763 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1765 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1769 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1773 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1775 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1778 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1780 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1783 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1785 if (line_len
& 1) return (line_len
); // not in hex
1787 if (data
.hex_wordlist
== 1)
1792 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1794 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1797 memset (line_buf
+ i
, 0, line_len
- i
);
1801 else if (line_len
>= 6) // $HEX[] = 6
1803 if (line_buf
[0] != '$') return (line_len
);
1804 if (line_buf
[1] != 'H') return (line_len
);
1805 if (line_buf
[2] != 'E') return (line_len
);
1806 if (line_buf
[3] != 'X') return (line_len
);
1807 if (line_buf
[4] != '[') return (line_len
);
1808 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1813 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1815 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1818 memset (line_buf
+ i
, 0, line_len
- i
);
1826 static void clear_prompt ()
1828 fputc ('\r', stdout
);
1830 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1832 fputc (' ', stdout
);
1835 fputc ('\r', stdout
);
1840 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1842 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1845 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1847 char *outfile
= data
.outfile
;
1848 uint quiet
= data
.quiet
;
1849 FILE *pot_fp
= data
.pot_fp
;
1850 uint loopback
= data
.loopback
;
1851 uint debug_mode
= data
.debug_mode
;
1852 char *debug_file
= data
.debug_file
;
1854 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1855 int debug_rule_len
= 0; // -1 error
1856 uint debug_plain_len
= 0;
1858 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1862 char out_buf
[HCBUFSIZ
] = { 0 };
1864 const u32 salt_pos
= plain
->salt_pos
;
1865 const u32 digest_pos
= plain
->digest_pos
; // relative
1866 const u32 gidvid
= plain
->gidvid
;
1867 const u32 il_pos
= plain
->il_pos
;
1869 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1873 u64 crackpos
= device_param
->words_off
;
1875 uint plain_buf
[16] = { 0 };
1877 u8
*plain_ptr
= (u8
*) plain_buf
;
1879 unsigned int plain_len
= 0;
1881 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1885 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1887 for (int i
= 0; i
< 16; i
++)
1889 plain_buf
[i
] = pw
.i
[i
];
1892 plain_len
= pw
.pw_len
;
1894 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1901 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1903 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1905 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1909 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1911 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1913 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1915 debug_plain_len
= plain_len
;
1919 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1922 crackpos
*= data
.kernel_rules_cnt
;
1923 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1925 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1927 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1931 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1933 for (int i
= 0; i
< 16; i
++)
1935 plain_buf
[i
] = pw
.i
[i
];
1938 plain_len
= pw
.pw_len
;
1940 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1941 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1943 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1945 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1949 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1951 memcpy (plain_ptr
, comb_buf
, comb_len
);
1954 plain_len
+= comb_len
;
1957 crackpos
*= data
.combs_cnt
;
1958 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1960 if (data
.pw_max
!= PW_DICTMAX1
)
1962 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1965 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1967 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1968 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1970 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1971 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1973 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1974 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1976 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1977 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1979 plain_len
= data
.css_cnt
;
1982 crackpos
*= data
.bfs_cnt
;
1983 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1985 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1989 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1991 for (int i
= 0; i
< 16; i
++)
1993 plain_buf
[i
] = pw
.i
[i
];
1996 plain_len
= pw
.pw_len
;
1998 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2001 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2003 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2005 plain_len
+= start
+ stop
;
2008 crackpos
*= data
.combs_cnt
;
2009 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2011 if (data
.pw_max
!= PW_DICTMAX1
)
2013 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2016 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2020 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2022 for (int i
= 0; i
< 16; i
++)
2024 plain_buf
[i
] = pw
.i
[i
];
2027 plain_len
= pw
.pw_len
;
2029 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2032 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2034 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2036 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2038 plain_len
+= start
+ stop
;
2041 crackpos
*= data
.combs_cnt
;
2042 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2044 if (data
.pw_max
!= PW_DICTMAX1
)
2046 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2050 if (data
.attack_mode
== ATTACK_MODE_BF
)
2052 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2054 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2056 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2058 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2062 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2064 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2066 plain_ptr
[j
] = plain_ptr
[i
];
2069 plain_len
= plain_len
/ 2;
2074 // if enabled, update also the potfile
2080 fprintf (pot_fp
, "%s:", out_buf
);
2082 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2084 fputc ('\n', pot_fp
);
2088 unlock_file (pot_fp
);
2093 FILE *out_fp
= NULL
;
2095 if (outfile
!= NULL
)
2097 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2099 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2109 if (quiet
== 0) clear_prompt ();
2112 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2114 if (outfile
!= NULL
)
2116 if (out_fp
!= stdout
)
2123 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2125 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2127 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2128 if (quiet
== 0) fflush (stdout
);
2137 char *loopback_file
= data
.loopback_file
;
2141 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2145 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2147 fputc ('\n', fb_fp
);
2153 // (rule) debug mode
2155 // the next check implies that:
2156 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2159 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2161 if (debug_rule_len
< 0) debug_rule_len
= 0;
2163 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2165 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2167 if ((quiet
== 0) && (debug_file
== NULL
))
2169 fprintf (stdout
, "%s", PROMPT
);
2176 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2178 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2182 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2186 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2190 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2192 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, 0, num_cracked
* sizeof (plain_t
), cracked
, 0, NULL
, NULL
);
2194 uint cpt_cracked
= 0;
2196 for (uint i
= 0; i
< num_cracked
; i
++)
2198 const uint hash_pos
= cracked
[i
].hash_pos
;
2200 if (data
.digests_shown
[hash_pos
] == 1) continue;
2202 hc_thread_mutex_lock (mux_display
);
2204 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2206 data
.digests_shown
[hash_pos
] = 1;
2208 data
.digests_done
++;
2212 salt_buf
->digests_done
++;
2214 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2216 data
.salts_shown
[salt_pos
] = 1;
2222 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2224 hc_thread_mutex_unlock (mux_display
);
2226 check_hash (device_param
, &cracked
[i
]);
2231 if (cpt_cracked
> 0)
2233 hc_thread_mutex_lock (mux_display
);
2235 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2236 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2240 data
.cpt_total
+= cpt_cracked
;
2242 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2244 hc_thread_mutex_unlock (mux_display
);
2247 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2249 // we need to reset cracked state on the device
2250 // otherwise host thinks again and again the hash was cracked
2251 // and returns invalid password each time
2253 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2255 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, salt_buf
->digests_offset
* sizeof (uint
), salt_buf
->digests_cnt
* sizeof (uint
), &data
.digests_shown_tmp
[salt_buf
->digests_offset
], 0, NULL
, NULL
);
2260 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2264 static void save_hash ()
2266 char *hashfile
= data
.hashfile
;
2268 char new_hashfile
[256] = { 0 };
2269 char old_hashfile
[256] = { 0 };
2271 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2272 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2274 unlink (new_hashfile
);
2276 char separator
= data
.separator
;
2278 FILE *fp
= fopen (new_hashfile
, "wb");
2282 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2287 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2289 if (data
.salts_shown
[salt_pos
] == 1) continue;
2291 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2293 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2295 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2297 if (data
.digests_shown
[idx
] == 1) continue;
2299 if (data
.hash_mode
!= 2500)
2301 char out_buf
[HCBUFSIZ
] = { 0 };
2303 if (data
.username
== 1)
2305 user_t
*user
= data
.hash_info
[idx
]->user
;
2309 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2311 fputc (separator
, fp
);
2314 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2316 fputs (out_buf
, fp
);
2324 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2326 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2335 unlink (old_hashfile
);
2337 if (rename (hashfile
, old_hashfile
) != 0)
2339 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2346 if (rename (new_hashfile
, hashfile
) != 0)
2348 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2353 unlink (old_hashfile
);
2356 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2358 // function called only in case kernel_power_all > words_left
2360 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2362 kernel_power_div
+= kernel_power_div
/ 100;
2364 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2366 while (kernel_power_new
< total_left
)
2368 kernel_power_div
+= kernel_power_div
/ 100;
2370 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2373 if (data
.quiet
== 0)
2379 log_info ("INFO: approaching final keyspace, workload adjusted");
2382 fprintf (stdout
, "%s", PROMPT
);
2387 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2389 return kernel_power_div
;
2392 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2394 uint num_elements
= num
;
2396 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2397 device_param
->kernel_params_buf32
[31] = num
;
2399 uint kernel_threads
= device_param
->kernel_threads
;
2401 while (num_elements
% kernel_threads
) num_elements
++;
2403 cl_kernel kernel
= NULL
;
2407 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2408 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2409 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2410 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2411 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2414 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2415 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2416 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2417 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2418 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2419 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2420 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2421 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2422 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2423 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2424 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2428 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2430 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2431 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2433 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2437 if (kern_run
== KERN_RUN_2
)
2439 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2441 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2445 while (num_elements
% kernel_threads
) num_elements
++;
2447 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2448 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2450 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2453 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2455 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2459 cl_ulong time_start
;
2462 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2463 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2465 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2467 uint exec_pos
= device_param
->exec_pos
;
2469 device_param
->exec_ms
[exec_pos
] = exec_time
;
2473 if (exec_pos
== EXEC_CACHE
)
2478 device_param
->exec_pos
= exec_pos
;
2481 hc_clReleaseEvent (data
.ocl
, event
);
2483 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2486 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2488 uint num_elements
= num
;
2492 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2493 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2494 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2497 // causes problems with special threads like in bcrypt
2498 // const uint kernel_threads = device_param->kernel_threads;
2500 uint kernel_threads
= device_param
->kernel_threads
;
2502 while (num_elements
% kernel_threads
) num_elements
++;
2504 cl_kernel kernel
= NULL
;
2508 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2509 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2510 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2515 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2516 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2517 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2518 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2519 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2520 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2522 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2523 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2524 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2525 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2526 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2527 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2529 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2530 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2531 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2532 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2533 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2534 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2535 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2539 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2540 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2542 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2544 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2546 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2549 static void run_kernel_tm (hc_device_param_t
*device_param
)
2551 const uint num_elements
= 1024; // fixed
2553 uint kernel_threads
= 32;
2555 cl_kernel kernel
= device_param
->kernel_tm
;
2557 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2558 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2560 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2562 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2564 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2567 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2569 uint num_elements
= num
;
2571 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2572 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2574 // causes problems with special threads like in bcrypt
2575 // const uint kernel_threads = device_param->kernel_threads;
2577 uint kernel_threads
= device_param
->kernel_threads
;
2579 while (num_elements
% kernel_threads
) num_elements
++;
2581 cl_kernel kernel
= device_param
->kernel_amp
;
2583 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2584 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2586 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2587 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2589 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2591 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2593 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2596 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2598 const u32 num16d
= num
/ 16;
2599 const u32 num16m
= num
% 16;
2603 device_param
->kernel_params_memset_buf32
[1] = value
;
2604 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2606 uint kernel_threads
= device_param
->kernel_threads
;
2608 uint num_elements
= num16d
;
2610 while (num_elements
% kernel_threads
) num_elements
++;
2612 cl_kernel kernel
= device_param
->kernel_memset
;
2614 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2615 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2616 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2618 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2619 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2621 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2623 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2625 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2637 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2641 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2643 run_kernel_memset (device_param
, buf
, 0, size
);
2648 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2650 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2652 const cl_uchar zero = 0;
2654 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2659 // NOTE: clEnqueueFillBuffer () always fails with -59
2660 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2661 // How's that possible, OpenCL 1.2 support is advertised??
2662 // We need to workaround...
2664 #define FILLSZ 0x100000
2666 char *tmp = (char *) mymalloc (FILLSZ);
2668 for (size_t i = 0; i < size; i += FILLSZ)
2670 const size_t left = size - i;
2672 const size_t fillsz = MIN (FILLSZ, left);
2674 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2682 static void choose_kernel (hc_device_param_t
*device_param
, const uint attack_exec
, const uint attack_mode
, const uint opts_type
, const salt_t
*salt_buf
, const uint highest_pw_len
, const uint pws_cnt
)
2684 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2686 if (attack_mode
== ATTACK_MODE_BF
)
2688 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2690 const uint size_tm
= 32 * sizeof (bs_word_t
);
2692 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2694 run_kernel_tm (device_param
);
2696 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2700 if (highest_pw_len
< 16)
2702 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2704 else if (highest_pw_len
< 32)
2706 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2710 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2715 run_kernel_amp (device_param
, pws_cnt
);
2717 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2719 if (opts_type
& OPTS_TYPE_HOOK12
)
2721 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2724 uint iter
= salt_buf
->salt_iter
;
2726 uint loop_step
= device_param
->kernel_loops
;
2728 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2730 uint loop_left
= iter
- loop_pos
;
2732 loop_left
= MIN (loop_left
, loop_step
);
2734 device_param
->kernel_params_buf32
[25] = loop_pos
;
2735 device_param
->kernel_params_buf32
[26] = loop_left
;
2737 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2739 if (data
.devices_status
== STATUS_CRACKED
) break;
2740 if (data
.devices_status
== STATUS_ABORTED
) break;
2741 if (data
.devices_status
== STATUS_QUIT
) break;
2747 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2749 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2753 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2755 const u32 speed_pos
= device_param
->speed_pos
;
2757 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2759 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2761 if (data
.benchmark
== 1)
2763 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2767 if (opts_type
& OPTS_TYPE_HOOK23
)
2769 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2771 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2773 // do something with data
2775 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2778 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2782 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2788 else if (rule_len
== 1)
2790 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2796 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2798 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2800 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2804 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2806 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2808 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2810 for (u32 i
= 0; i
< pws_cnt
; i
++)
2812 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2814 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2819 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2821 for (u32 i
= 0; i
< pws_cnt
; i
++)
2823 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2825 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2832 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2834 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2836 for (u32 i
= 0; i
< pws_cnt
; i
++)
2838 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2840 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2845 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2847 for (u32 i
= 0; i
< pws_cnt
; i
++)
2849 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2851 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2858 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2860 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2862 const u64 off
= device_param
->words_off
;
2864 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2866 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2870 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2872 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2874 device_param
->kernel_params_buf32
[25] = 0;
2875 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2876 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2878 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2880 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2884 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2887 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2889 return exec_ms_prev
;
2892 static void autotune (hc_device_param_t
*device_param
)
2894 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2896 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2897 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2899 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2900 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2902 u32 kernel_accel
= kernel_accel_min
;
2903 u32 kernel_loops
= kernel_loops_min
;
2905 // in this case the user specified a fixed -u and -n on the commandline
2906 // no way to tune anything
2907 // but we need to run a few caching rounds
2909 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2911 try_run (device_param
, kernel_accel
, kernel_loops
);
2912 try_run (device_param
, kernel_accel
, kernel_loops
);
2913 try_run (device_param
, kernel_accel
, kernel_loops
);
2914 try_run (device_param
, kernel_accel
, kernel_loops
);
2916 device_param
->kernel_accel
= kernel_accel
;
2917 device_param
->kernel_loops
= kernel_loops
;
2919 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2921 device_param
->kernel_power
= kernel_power
;
2926 // from here it's clear we are allowed to autotune
2927 // so let's init some fake words
2929 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2931 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2933 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2935 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2939 for (u32 i = 0; i < kernel_power_max; i++)
2941 device_param->pws_buf[i].i[0] = i;
2942 device_param->pws_buf[i].i[1] = 0x01234567;
2943 device_param->pws_buf[i].pw_len = 7;
2946 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
2948 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2950 run_kernel_amp (device_param, kernel_power_max);
2954 #define VERIFIER_CNT 1
2956 // first find out highest kernel-loops that stays below target_ms
2958 if (kernel_loops_min
< kernel_loops_max
)
2960 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2962 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2964 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2966 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2968 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2971 if (exec_ms
< target_ms
) break;
2975 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2977 #define STEPS_CNT 10
2979 if (kernel_accel_min
< kernel_accel_max
)
2981 for (int i
= 0; i
< STEPS_CNT
; i
++)
2983 const u32 kernel_accel_try
= 1 << i
;
2985 if (kernel_accel_try
< kernel_accel_min
) continue;
2986 if (kernel_accel_try
> kernel_accel_max
) break;
2988 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2990 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2992 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
2994 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2997 if (exec_ms
> target_ms
) break;
2999 kernel_accel
= kernel_accel_try
;
3003 // at this point we want to know the actual runtime for the following reason:
3004 // we need a reference for the balancing loop following up, and this
3005 // the balancing loop can have an effect that the creates a new opportunity, for example:
3006 // if the target is 95 ms and the current runtime is 48ms the above loop
3007 // stopped the execution because the previous exec_ms was > 95ms
3008 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3009 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3011 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3013 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3015 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3017 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3020 u32 diff
= kernel_loops
- kernel_accel
;
3022 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3024 u32 kernel_accel_orig
= kernel_accel
;
3025 u32 kernel_loops_orig
= kernel_loops
;
3027 for (u32 f
= 1; f
< 1024; f
++)
3029 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3030 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3032 if (kernel_accel_try
> kernel_accel_max
) break;
3033 if (kernel_loops_try
< kernel_loops_min
) break;
3035 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3037 if (diff_new
> diff
) break;
3041 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3043 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3045 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3047 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3050 if (exec_ms
< exec_ms_pre_final
)
3052 exec_ms_pre_final
= exec_ms
;
3054 kernel_accel
= kernel_accel_try
;
3055 kernel_loops
= kernel_loops_try
;
3060 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3062 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3064 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3066 if (exec_accel_min
>= 1.0)
3068 // this is safe to not overflow kernel_accel_max because of accel_left
3070 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3073 // reset them fake words
3076 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3078 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3079 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_amp_buf, CL_TRUE, 0, kernel_power_max * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL);
3082 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3084 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3086 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3091 device_param
->exec_pos
= 0;
3093 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3097 device_param
->kernel_accel
= kernel_accel
;
3098 device_param
->kernel_loops
= kernel_loops
;
3100 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3102 device_param
->kernel_power
= kernel_power
;
3106 if (data
.quiet
== 0)
3110 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3111 "Device #%u: autotuned kernel-loops to %u\n",
3112 device_param
->device_id
+ 1, kernel_accel
,
3113 device_param
->device_id
+ 1, kernel_loops
);
3115 fprintf (stdout
, "%s", PROMPT
);
3123 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3125 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3129 uint speed_pos
= device_param
->speed_pos
;
3132 if (device_param
->timer_speed
.tv_sec
== 0)
3134 hc_timer_set (&device_param
->timer_speed
);
3139 if (device_param
->timer_speed
.QuadPart
== 0)
3141 hc_timer_set (&device_param
->timer_speed
);
3145 // find higest password length, this is for optimization stuff
3147 uint highest_pw_len
= 0;
3149 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3152 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3155 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3157 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3158 + device_param
->kernel_params_mp_l_buf32
[5];
3163 uint innerloop_step
= 0;
3164 uint innerloop_cnt
= 0;
3166 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3167 else innerloop_step
= 1;
3169 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3170 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3171 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3173 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3175 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3177 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3179 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3181 if (data
.devices_status
== STATUS_CRACKED
) break;
3182 if (data
.devices_status
== STATUS_ABORTED
) break;
3183 if (data
.devices_status
== STATUS_QUIT
) break;
3184 if (data
.devices_status
== STATUS_BYPASS
) break;
3186 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3188 device_param
->kernel_params_buf32
[24] = salt_pos
;
3189 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3190 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3192 FILE *combs_fp
= device_param
->combs_fp
;
3194 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3201 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3203 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3205 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3207 if (data
.devices_status
== STATUS_CRACKED
) break;
3208 if (data
.devices_status
== STATUS_ABORTED
) break;
3209 if (data
.devices_status
== STATUS_QUIT
) break;
3210 if (data
.devices_status
== STATUS_BYPASS
) break;
3212 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3214 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3216 device_param
->innerloop_pos
= innerloop_pos
;
3217 device_param
->innerloop_left
= innerloop_left
;
3219 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3221 // i think we can get rid of this
3222 if (innerloop_left
== 0)
3224 puts ("bug, how should this happen????\n");
3229 if (data
.salts_shown
[salt_pos
] == 1)
3231 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3236 // initialize amplifiers
3238 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3242 while (i
< innerloop_left
)
3244 if (feof (combs_fp
)) break;
3246 int line_len
= fgetl (combs_fp
, line_buf
);
3248 if (line_len
>= PW_MAX1
) continue;
3250 line_len
= convert_from_hex (line_buf
, line_len
);
3252 char *line_buf_new
= line_buf
;
3254 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3256 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3258 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3260 if (rule_len_out
< 0)
3262 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3267 line_len
= rule_len_out
;
3269 line_buf_new
= rule_buf_out
;
3272 line_len
= MIN (line_len
, PW_DICTMAX
);
3274 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3276 memcpy (ptr
, line_buf_new
, line_len
);
3278 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3280 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3282 uppercase (ptr
, line_len
);
3285 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3287 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3289 ptr
[line_len
] = 0x80;
3292 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3294 ptr
[line_len
] = 0x01;
3298 device_param
->combs_buf
[i
].pw_len
= line_len
;
3303 for (uint j
= i
; j
< innerloop_left
; j
++)
3305 device_param
->combs_buf
[j
].i
[0] = 0;
3306 device_param
->combs_buf
[j
].i
[1] = 0;
3307 device_param
->combs_buf
[j
].i
[2] = 0;
3308 device_param
->combs_buf
[j
].i
[3] = 0;
3309 device_param
->combs_buf
[j
].i
[4] = 0;
3310 device_param
->combs_buf
[j
].i
[5] = 0;
3311 device_param
->combs_buf
[j
].i
[6] = 0;
3312 device_param
->combs_buf
[j
].i
[7] = 0;
3314 device_param
->combs_buf
[j
].pw_len
= 0;
3319 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3321 u64 off
= innerloop_pos
;
3323 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3325 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3327 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3329 u64 off
= innerloop_pos
;
3331 device_param
->kernel_params_mp_buf64
[3] = off
;
3333 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3335 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3337 u64 off
= innerloop_pos
;
3339 device_param
->kernel_params_mp_buf64
[3] = off
;
3341 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3346 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3348 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (kernel_rule_t
), 0, innerloop_left
* sizeof (kernel_rule_t
), 0, NULL
, NULL
);
3350 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3352 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
3354 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3356 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
3358 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3360 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
3362 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3364 hc_clEnqueueCopyBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
3367 if (data
.benchmark
== 1)
3369 hc_timer_set (&device_param
->timer_speed
);
3372 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3374 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3376 if (data
.devices_status
== STATUS_CRACKED
) break;
3377 if (data
.devices_status
== STATUS_ABORTED
) break;
3378 if (data
.devices_status
== STATUS_QUIT
) break;
3384 check_cracked (device_param
, salt_pos
);
3390 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3392 hc_thread_mutex_lock (mux_counter
);
3394 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3396 hc_thread_mutex_unlock (mux_counter
);
3404 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3406 hc_timer_set (&device_param
->timer_speed
);
3410 //hc_thread_mutex_lock (mux_display);
3412 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3414 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3416 //hc_thread_mutex_unlock (mux_display);
3420 if (speed_pos
== SPEED_CACHE
)
3429 if (data
.benchmark
== 1) break;
3433 device_param
->speed_pos
= speed_pos
;
3438 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3440 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3444 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3446 wl_data
->buf
[wl_data
->cnt
] = 0;
3448 if (wl_data
->cnt
== 0) return;
3450 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3454 if (wl_data
->cnt
== wl_data
->avail
)
3456 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3458 wl_data
->avail
+= wl_data
->incr
;
3461 const int c
= fgetc (fd
);
3463 if (c
== EOF
) break;
3465 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3469 if (c
== '\n') break;
3472 // ensure stream ends with a newline
3474 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3478 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3484 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3488 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3490 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3500 if (*ptr
!= '\n') continue;
3504 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3515 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3519 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3521 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3523 if (*ptr
!= '\n') continue;
3527 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3538 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3542 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3544 if (*ptr
!= '\n') continue;
3548 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3559 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3561 while (wl_data
->pos
< wl_data
->cnt
)
3566 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3568 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3570 wl_data
->pos
+= off
;
3572 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3574 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3576 int rule_len_out
= -1;
3578 if (len
< BLOCK_SIZE
)
3580 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3583 if (rule_len_out
< 0)
3588 if (rule_len_out
> PW_MAX
)
3609 fprintf (stderr
, "BUG feof()!!\n");
3614 load_segment (wl_data
, fd
);
3616 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3620 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3624 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3634 fstat (fileno (fd
), &d
.stat
);
3638 _fstat64 (fileno (fd
), &d
.stat
);
3642 d
.stat
.st_nlink
= 0;
3646 d
.stat
.st_atime
= 0;
3649 d
.stat
.st_blksize
= 0;
3650 d
.stat
.st_blocks
= 0;
3653 if (d
.stat
.st_size
== 0) return 0;
3655 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3657 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3661 u64 cnt
= d_cache
->cnt
;
3665 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3667 keyspace
*= data
.kernel_rules_cnt
;
3669 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3671 keyspace
*= data
.combs_cnt
;
3674 if (data
.quiet
== 0) log_info ("Cache-hit dictionary stats %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) d
.stat
.st_size
, (unsigned long long int) cnt
, (unsigned long long int) keyspace
);
3675 if (data
.quiet
== 0) log_info ("");
3677 hc_signal (sigHandler_default
);
3692 load_segment (wl_data
, fd
);
3694 comp
+= wl_data
->cnt
;
3698 while (i
< wl_data
->cnt
)
3703 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3705 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3707 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3709 int rule_len_out
= -1;
3711 if (len
< BLOCK_SIZE
)
3713 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3716 if (rule_len_out
< 0)
3728 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3730 cnt
+= data
.kernel_rules_cnt
;
3732 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3734 cnt
+= data
.combs_cnt
;
3747 if ((now
- prev
) == 0) continue;
3749 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3751 if (data
.quiet
== 0) log_info_nn ("Generating dictionary stats for %s: %llu bytes (%.2f%%), %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, percent
* 100, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
3756 if (data
.quiet
== 0) log_info ("Generated dictionary stats for %s: %llu bytes, %llu words, %llu keyspace", dictfile
, (unsigned long long int) comp
, (unsigned long long int) cnt2
, (unsigned long long int) cnt
);
3757 if (data
.quiet
== 0) log_info ("");
3759 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3761 hc_signal (sigHandler_default
);
3766 static void *thread_monitor (void *p
)
3768 uint runtime_check
= 0;
3769 uint remove_check
= 0;
3770 uint status_check
= 0;
3771 uint restore_check
= 0;
3773 uint restore_left
= data
.restore_timer
;
3774 uint remove_left
= data
.remove_timer
;
3775 uint status_left
= data
.status_timer
;
3778 uint hwmon_check
= 0;
3780 // these variables are mainly used for fan control (AMD only)
3782 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3784 // temperature controller "loopback" values
3786 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3787 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3790 int temp_threshold
= 1; // degrees celcius
3792 int fan_speed_min
= 15; // in percentage
3793 int fan_speed_max
= 100;
3796 time_t last_temp_check_time
;
3797 #endif // HAVE_HWMON
3799 uint sleep_time
= 1;
3806 if (data
.restore_timer
)
3811 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3816 if (data
.status
== 1)
3822 if (data
.gpu_temp_disable
== 0)
3824 time (&last_temp_check_time
);
3830 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3833 if (hwmon_check
== 0)
3838 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3840 hc_sleep (sleep_time
);
3842 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3845 if (hwmon_check
== 1)
3847 hc_thread_mutex_lock (mux_adl
);
3849 time_t temp_check_time
;
3851 time (&temp_check_time
);
3853 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3855 if (Ta
== 0) Ta
= 1;
3857 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3859 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3861 if (device_param
->skipped
) continue;
3863 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3865 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3867 if (temperature
> (int) data
.gpu_temp_abort
)
3869 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3871 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3877 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3879 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3881 if (data
.hm_device
[device_id
].fan_supported
== 1)
3883 int temp_cur
= temperature
;
3885 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3887 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3889 // calculate Ta value (time difference in seconds between the last check and this check)
3891 last_temp_check_time
= temp_check_time
;
3897 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3899 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[device_id
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[device_id
])) / Ta
);
3901 if (abs (fan_diff_required
) >= temp_threshold
)
3903 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3905 int fan_speed_level
= fan_speed_cur
;
3907 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3909 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3911 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3912 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3914 if (fan_speed_new
!= fan_speed_cur
)
3916 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3917 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3919 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3921 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
3923 fan_speed_chgd
[device_id
] = 1;
3926 temp_diff_old
[device_id
] = temp_diff_new
;
3934 hc_thread_mutex_unlock (mux_adl
);
3936 #endif // HAVE_HWMON
3938 if (restore_check
== 1)
3942 if (restore_left
== 0)
3944 if (data
.restore_disable
== 0) cycle_restore ();
3946 restore_left
= data
.restore_timer
;
3950 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3954 time (&runtime_cur
);
3956 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3958 if (runtime_left
<= 0)
3960 if (data
.benchmark
== 0)
3962 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3965 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3969 if (remove_check
== 1)
3973 if (remove_left
== 0)
3975 if (data
.digests_saved
!= data
.digests_done
)
3977 data
.digests_saved
= data
.digests_done
;
3982 remove_left
= data
.remove_timer
;
3986 if (status_check
== 1)
3990 if (status_left
== 0)
3992 //hc_thread_mutex_lock (mux_display);
3994 if (data
.quiet
== 0) clear_prompt ();
3996 if (data
.quiet
== 0) log_info ("");
4000 if (data
.quiet
== 0) log_info ("");
4002 //hc_thread_mutex_unlock (mux_display);
4004 status_left
= data
.status_timer
;
4010 myfree (fan_speed_chgd
);
4012 myfree (temp_diff_old
);
4013 myfree (temp_diff_sum
);
4021 static void *thread_outfile_remove (void *p
)
4023 // some hash-dependent constants
4024 char *outfile_dir
= data
.outfile_check_directory
;
4025 uint dgst_size
= data
.dgst_size
;
4026 uint isSalted
= data
.isSalted
;
4027 uint esalt_size
= data
.esalt_size
;
4028 uint hash_mode
= data
.hash_mode
;
4030 uint outfile_check_timer
= data
.outfile_check_timer
;
4032 char separator
= data
.separator
;
4034 // some hash-dependent functions
4035 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4036 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4039 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4041 hash_buf
.digest
= mymalloc (dgst_size
);
4043 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4045 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4047 uint digest_buf
[64] = { 0 };
4049 outfile_data_t
*out_info
= NULL
;
4051 char **out_files
= NULL
;
4053 time_t folder_mtime
= 0;
4057 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4059 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4063 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4067 if (check_left
== 0)
4069 struct stat outfile_check_stat
;
4071 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4073 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4077 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4079 char **out_files_new
= scan_directory (outfile_dir
);
4081 int out_cnt_new
= count_dictionaries (out_files_new
);
4083 outfile_data_t
*out_info_new
= NULL
;
4085 if (out_cnt_new
> 0)
4087 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4089 for (int i
= 0; i
< out_cnt_new
; i
++)
4091 out_info_new
[i
].file_name
= out_files_new
[i
];
4093 // check if there are files that we have seen/checked before (and not changed)
4095 for (int j
= 0; j
< out_cnt
; j
++)
4097 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4099 struct stat outfile_stat
;
4101 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4103 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4105 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4106 out_info_new
[i
].seek
= out_info
[j
].seek
;
4114 local_free (out_info
);
4115 local_free (out_files
);
4117 out_files
= out_files_new
;
4118 out_cnt
= out_cnt_new
;
4119 out_info
= out_info_new
;
4121 folder_mtime
= outfile_check_stat
.st_mtime
;
4124 for (int j
= 0; j
< out_cnt
; j
++)
4126 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4130 //hc_thread_mutex_lock (mux_display);
4133 struct stat outfile_stat
;
4135 fstat (fileno (fp
), &outfile_stat
);
4139 struct stat64 outfile_stat
;
4141 _fstat64 (fileno (fp
), &outfile_stat
);
4144 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4146 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4147 out_info
[j
].seek
= 0;
4150 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4152 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4156 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4158 if (ptr
== NULL
) break;
4160 int line_len
= strlen (line_buf
);
4162 if (line_len
<= 0) continue;
4164 int iter
= MAX_CUT_TRIES
;
4166 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4168 if (line_buf
[i
] != separator
) continue;
4170 int parser_status
= PARSER_OK
;
4172 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4174 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4179 if (parser_status
== PARSER_OK
)
4181 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4183 if (data
.salts_shown
[salt_pos
] == 1) continue;
4185 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4187 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4189 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4191 if (data
.digests_shown
[idx
] == 1) continue;
4195 if (hash_mode
== 6800)
4197 if (i
== salt_buf
->salt_len
)
4199 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4202 else if (hash_mode
== 2500)
4204 // BSSID : MAC1 : MAC2 (:plain)
4205 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4207 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4209 if (!cracked
) continue;
4211 // now compare MAC1 and MAC2 too, since we have this additional info
4212 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4213 char *mac2_pos
= mac1_pos
+ 12 + 1;
4215 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4216 wpa_t
*wpa
= &wpas
[salt_pos
];
4218 // compare hex string(s) vs binary MAC address(es)
4220 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4222 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4231 if (!cracked
) continue;
4233 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4235 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4246 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4248 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4250 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4257 data
.digests_shown
[idx
] = 1;
4259 data
.digests_done
++;
4261 salt_buf
->digests_done
++;
4263 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4265 data
.salts_shown
[salt_pos
] = 1;
4269 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4274 if (data
.devices_status
== STATUS_CRACKED
) break;
4280 if (data
.devices_status
== STATUS_CRACKED
) break;
4285 if (data
.devices_status
== STATUS_CRACKED
) break;
4290 out_info
[j
].seek
= ftell (fp
);
4292 //hc_thread_mutex_unlock (mux_display);
4300 check_left
= outfile_check_timer
;
4304 if (esalt_size
) local_free (hash_buf
.esalt
);
4306 if (isSalted
) local_free (hash_buf
.salt
);
4308 local_free (hash_buf
.digest
);
4310 local_free (out_info
);
4312 local_free (out_files
);
4319 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4321 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4323 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4325 u8
*ptr
= (u8
*) pw
->i
;
4327 memcpy (ptr
, pw_buf
, pw_len
);
4329 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4331 pw
->pw_len
= pw_len
;
4333 device_param
->pws_cnt
++;
4337 fprintf (stderr
, "BUG pw_add()!!\n");
4343 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4345 hc_thread_mutex_lock (mux_dispatcher
);
4347 const u64 words_cur
= data
.words_cur
;
4348 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4350 device_param
->words_off
= words_cur
;
4352 const u64 words_left
= words_base
- words_cur
;
4356 if (data
.kernel_power_all
> words_left
)
4358 if (data
.kernel_power_div
== 0)
4360 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4364 if (data
.kernel_power_div
)
4366 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4368 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4370 if (kernel_power_new
< device_param
->kernel_power
)
4372 device_param
->kernel_power
= kernel_power_new
;
4378 const uint kernel_power
= device_param
->kernel_power
;
4380 uint work
= MIN (words_left
, kernel_power
);
4382 work
= MIN (work
, max
);
4384 data
.words_cur
+= work
;
4386 hc_thread_mutex_unlock (mux_dispatcher
);
4391 static void *thread_calc_stdin (void *p
)
4393 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4395 if (device_param
->skipped
) return NULL
;
4397 autotune (device_param
);
4399 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4401 const uint attack_kern
= data
.attack_kern
;
4403 const uint kernel_power
= device_param
->kernel_power
;
4405 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4407 hc_thread_mutex_lock (mux_dispatcher
);
4409 if (feof (stdin
) != 0)
4411 hc_thread_mutex_unlock (mux_dispatcher
);
4418 while (words_cur
< kernel_power
)
4420 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4422 if (line_buf
== NULL
) break;
4424 uint line_len
= in_superchop (line_buf
);
4426 line_len
= convert_from_hex (line_buf
, line_len
);
4428 // post-process rule engine
4430 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4432 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4434 int rule_len_out
= -1;
4436 if (line_len
< BLOCK_SIZE
)
4438 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4441 if (rule_len_out
< 0) continue;
4443 line_buf
= rule_buf_out
;
4444 line_len
= rule_len_out
;
4447 if (line_len
> PW_MAX
)
4452 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4454 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4456 hc_thread_mutex_lock (mux_counter
);
4458 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4460 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4463 hc_thread_mutex_unlock (mux_counter
);
4468 else if (attack_kern
== ATTACK_KERN_COMBI
)
4470 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4471 // since we still need to combine the plains
4473 if (line_len
> data
.pw_max
)
4475 hc_thread_mutex_lock (mux_counter
);
4477 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4479 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4482 hc_thread_mutex_unlock (mux_counter
);
4488 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4492 if (data
.devices_status
== STATUS_CRACKED
) break;
4493 if (data
.devices_status
== STATUS_ABORTED
) break;
4494 if (data
.devices_status
== STATUS_QUIT
) break;
4495 if (data
.devices_status
== STATUS_BYPASS
) break;
4498 hc_thread_mutex_unlock (mux_dispatcher
);
4500 if (data
.devices_status
== STATUS_CRACKED
) break;
4501 if (data
.devices_status
== STATUS_ABORTED
) break;
4502 if (data
.devices_status
== STATUS_QUIT
) break;
4503 if (data
.devices_status
== STATUS_BYPASS
) break;
4507 const uint pws_cnt
= device_param
->pws_cnt
;
4511 run_copy (device_param
, pws_cnt
);
4513 run_cracker (device_param
, pws_cnt
);
4515 device_param
->pws_cnt
= 0;
4519 if (attack_kern == ATTACK_KERN_STRAIGHT)
4521 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4523 else if (attack_kern == ATTACK_KERN_COMBI)
4525 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4531 device_param
->kernel_accel
= 0;
4532 device_param
->kernel_loops
= 0;
4539 static void *thread_calc (void *p
)
4541 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4543 if (device_param
->skipped
) return NULL
;
4545 autotune (device_param
);
4547 const uint attack_mode
= data
.attack_mode
;
4548 const uint attack_kern
= data
.attack_kern
;
4550 if (attack_mode
== ATTACK_MODE_BF
)
4552 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4554 const uint work
= get_work (device_param
, -1, true);
4556 if (work
== 0) break;
4558 const u64 words_off
= device_param
->words_off
;
4559 const u64 words_fin
= words_off
+ work
;
4561 const uint pws_cnt
= work
;
4563 device_param
->pws_cnt
= pws_cnt
;
4567 run_copy (device_param
, pws_cnt
);
4569 run_cracker (device_param
, pws_cnt
);
4571 device_param
->pws_cnt
= 0;
4575 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4579 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4581 if (data
.devices_status
== STATUS_CRACKED
) break;
4582 if (data
.devices_status
== STATUS_ABORTED
) break;
4583 if (data
.devices_status
== STATUS_QUIT
) break;
4584 if (data
.devices_status
== STATUS_BYPASS
) break;
4586 if (data
.benchmark
== 1) break;
4588 device_param
->words_done
= words_fin
;
4593 const uint segment_size
= data
.segment_size
;
4595 char *dictfile
= data
.dictfile
;
4597 if (attack_mode
== ATTACK_MODE_COMBI
)
4599 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4601 dictfile
= data
.dictfile2
;
4605 FILE *fd
= fopen (dictfile
, "rb");
4609 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4614 if (attack_mode
== ATTACK_MODE_COMBI
)
4616 const uint combs_mode
= data
.combs_mode
;
4618 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4620 const char *dictfilec
= data
.dictfile2
;
4622 FILE *combs_fp
= fopen (dictfilec
, "rb");
4624 if (combs_fp
== NULL
)
4626 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4633 device_param
->combs_fp
= combs_fp
;
4635 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4637 const char *dictfilec
= data
.dictfile
;
4639 FILE *combs_fp
= fopen (dictfilec
, "rb");
4641 if (combs_fp
== NULL
)
4643 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4650 device_param
->combs_fp
= combs_fp
;
4654 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4656 wl_data
->buf
= (char *) mymalloc (segment_size
);
4657 wl_data
->avail
= segment_size
;
4658 wl_data
->incr
= segment_size
;
4664 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4669 bool allow_div
= true;
4675 const uint work
= get_work (device_param
, max
, allow_div
);
4679 if (work
== 0) break;
4681 words_off
= device_param
->words_off
;
4682 words_fin
= words_off
+ work
;
4687 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4691 for ( ; words_cur
< words_fin
; words_cur
++)
4693 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4695 line_len
= convert_from_hex (line_buf
, line_len
);
4697 // post-process rule engine
4699 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4701 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4703 int rule_len_out
= -1;
4705 if (line_len
< BLOCK_SIZE
)
4707 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4710 if (rule_len_out
< 0) continue;
4712 line_buf
= rule_buf_out
;
4713 line_len
= rule_len_out
;
4716 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4718 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4722 hc_thread_mutex_lock (mux_counter
);
4724 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4726 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4729 hc_thread_mutex_unlock (mux_counter
);
4734 else if (attack_kern
== ATTACK_KERN_COMBI
)
4736 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4737 // since we still need to combine the plains
4739 if (line_len
> data
.pw_max
)
4743 hc_thread_mutex_lock (mux_counter
);
4745 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4747 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4750 hc_thread_mutex_unlock (mux_counter
);
4756 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4758 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4760 if (data
.devices_status
== STATUS_CRACKED
) break;
4761 if (data
.devices_status
== STATUS_ABORTED
) break;
4762 if (data
.devices_status
== STATUS_QUIT
) break;
4763 if (data
.devices_status
== STATUS_BYPASS
) break;
4766 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4768 if (data
.devices_status
== STATUS_CRACKED
) break;
4769 if (data
.devices_status
== STATUS_ABORTED
) break;
4770 if (data
.devices_status
== STATUS_QUIT
) break;
4771 if (data
.devices_status
== STATUS_BYPASS
) break;
4774 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4776 if (data
.devices_status
== STATUS_CRACKED
) break;
4777 if (data
.devices_status
== STATUS_ABORTED
) break;
4778 if (data
.devices_status
== STATUS_QUIT
) break;
4779 if (data
.devices_status
== STATUS_BYPASS
) break;
4785 const uint pws_cnt
= device_param
->pws_cnt
;
4789 run_copy (device_param
, pws_cnt
);
4791 run_cracker (device_param
, pws_cnt
);
4793 device_param
->pws_cnt
= 0;
4797 if (attack_kern == ATTACK_KERN_STRAIGHT)
4799 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4801 else if (attack_kern == ATTACK_KERN_COMBI)
4803 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4808 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4810 if (data
.devices_status
== STATUS_CRACKED
) break;
4811 if (data
.devices_status
== STATUS_ABORTED
) break;
4812 if (data
.devices_status
== STATUS_QUIT
) break;
4813 if (data
.devices_status
== STATUS_BYPASS
) break;
4815 if (words_fin
== 0) break;
4817 device_param
->words_done
= words_fin
;
4820 if (attack_mode
== ATTACK_MODE_COMBI
)
4822 fclose (device_param
->combs_fp
);
4825 free (wl_data
->buf
);
4831 device_param
->kernel_accel
= 0;
4832 device_param
->kernel_loops
= 0;
4837 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4841 log_error ("ERROR: %s : Invalid argument", __func__
);
4846 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4848 device_param
->kernel_params_buf32
[24] = salt_pos
;
4849 device_param
->kernel_params_buf32
[27] = 1;
4850 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4851 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4852 device_param
->kernel_params_buf32
[30] = 0;
4853 device_param
->kernel_params_buf32
[31] = 1;
4855 char *dictfile_old
= data
.dictfile
;
4857 const char *weak_hash_check
= "weak-hash-check";
4859 data
.dictfile
= (char *) weak_hash_check
;
4861 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4863 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4869 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4871 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4875 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4877 uint loop_step
= 16;
4879 const uint iter
= salt_buf
->salt_iter
;
4881 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4883 uint loop_left
= iter
- loop_pos
;
4885 loop_left
= MIN (loop_left
, loop_step
);
4887 device_param
->kernel_params_buf32
[25] = loop_pos
;
4888 device_param
->kernel_params_buf32
[26] = loop_left
;
4890 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4893 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4900 check_cracked (device_param
, salt_pos
);
4906 device_param
->kernel_params_buf32
[24] = 0;
4907 device_param
->kernel_params_buf32
[25] = 0;
4908 device_param
->kernel_params_buf32
[26] = 0;
4909 device_param
->kernel_params_buf32
[27] = 0;
4910 device_param
->kernel_params_buf32
[28] = 0;
4911 device_param
->kernel_params_buf32
[29] = 0;
4912 device_param
->kernel_params_buf32
[30] = 0;
4913 device_param
->kernel_params_buf32
[31] = 0;
4915 data
.dictfile
= dictfile_old
;
4917 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4922 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4924 if (data
.username
== 0)
4926 *hashbuf_pos
= line_buf
;
4927 *hashbuf_len
= line_len
;
4931 char *pos
= line_buf
;
4934 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4936 if (line_buf
[i
] == data
.separator
)
4951 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
4958 for (int i
= 0; i
< line_len
; i
++)
4960 if (line_buf
[i
] == data
.separator
)
4969 if (pos
== NULL
) pos
= line_buf
+ i
;
4981 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
4988 for (int i
= 0; i
< line_len
; i
++)
4990 if (line_buf
[i
] == ':')
4997 if (sep_cnt
== 2) sep2_len
++;
4998 if (sep_cnt
== 3) sep3_len
++;
5001 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5006 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5013 for (int i
= 0; i
< line_len
; i
++)
5015 if (line_buf
[i
] == ':')
5022 if (data
.hash_mode
== 1000)
5026 if (pos
== NULL
) pos
= line_buf
+ i
;
5031 else if (data
.hash_mode
== 3000)
5035 if (pos
== NULL
) pos
= line_buf
+ i
;
5046 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5053 for (int i
= 0; i
< line_len
; i
++)
5055 if (line_buf
[i
] == ':')
5064 if (pos
== NULL
) pos
= line_buf
+ i
;
5076 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5080 char sep5_first
= 0;
5081 char sep6_first
= 0;
5083 for (int i
= 0; i
< line_len
; i
++)
5085 if (line_buf
[i
] == ':')
5092 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5093 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5096 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5101 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5108 for (int i
= 0; i
< line_len
; i
++)
5110 if (line_buf
[i
] == ':')
5119 if (pos
== NULL
) pos
= line_buf
+ i
;
5129 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5136 for (int i
= 0; i
< line_len
; i
++)
5138 if (line_buf
[i
] == ':')
5147 if (pos
== NULL
) pos
= line_buf
+ i
;
5159 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5163 for (int i
= 0; i
< line_len
; i
++)
5165 if (line_buf
[i
] == ':') sep_cnt
++;
5168 if (sep_cnt
== 8) return 1;
5173 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5175 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5178 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5180 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5185 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5187 switch (hashfile_format
)
5189 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5190 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5191 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5192 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5196 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5198 switch (hashfile_format
)
5200 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5201 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5202 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5203 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5207 char *strhlfmt (const uint hashfile_format
)
5209 switch (hashfile_format
)
5211 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5212 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5213 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5214 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5215 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5216 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5217 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5218 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5219 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5220 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5223 return ((char *) "Unknown");
5226 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5228 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5230 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5231 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5233 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5237 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5241 int line_len
= fgetl (fp
, line_buf
);
5243 if (line_len
== 0) continue;
5245 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5246 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5247 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5249 if (num_check
== max_check
) break;
5256 uint hashlist_format
= HLFMT_HASHCAT
;
5258 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5260 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5262 hashlist_format
= i
;
5267 return hashlist_format
;
5271 * some further helper function
5274 // wrapper around mymalloc for ADL
5276 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5277 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5279 return mymalloc (iSize
);
5283 static uint
generate_bitmaps (const uint digests_cnt
, const uint dgst_size
, const uint dgst_shifts
, char *digests_buf_ptr
, const uint bitmap_mask
, const uint bitmap_size
, uint
*bitmap_a
, uint
*bitmap_b
, uint
*bitmap_c
, uint
*bitmap_d
, const u64 collisions_max
)
5287 const uint dgst_pos0
= data
.dgst_pos0
;
5288 const uint dgst_pos1
= data
.dgst_pos1
;
5289 const uint dgst_pos2
= data
.dgst_pos2
;
5290 const uint dgst_pos3
= data
.dgst_pos3
;
5292 memset (bitmap_a
, 0, bitmap_size
);
5293 memset (bitmap_b
, 0, bitmap_size
);
5294 memset (bitmap_c
, 0, bitmap_size
);
5295 memset (bitmap_d
, 0, bitmap_size
);
5297 for (uint i
= 0; i
< digests_cnt
; i
++)
5299 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5301 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5303 digests_buf_ptr
+= dgst_size
;
5305 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5306 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5307 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5308 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5310 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5311 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5312 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5313 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5315 if (bitmap_a
[idx0
] & val0
) collisions
++;
5316 if (bitmap_b
[idx1
] & val1
) collisions
++;
5317 if (bitmap_c
[idx2
] & val2
) collisions
++;
5318 if (bitmap_d
[idx3
] & val3
) collisions
++;
5320 bitmap_a
[idx0
] |= val0
;
5321 bitmap_b
[idx1
] |= val1
;
5322 bitmap_c
[idx2
] |= val2
;
5323 bitmap_d
[idx3
] |= val3
;
5325 if (collisions
>= collisions_max
) return 0x7fffffff;
5335 int main (int argc
, char **argv
)
5338 * To help users a bit
5341 char *compute
= getenv ("COMPUTE");
5345 static char display
[100];
5347 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5353 if (getenv ("DISPLAY") == NULL
)
5354 putenv ((char *) "DISPLAY=:0");
5357 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5358 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5360 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5361 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5363 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5364 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5366 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5367 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5369 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5370 putenv ((char *) "POCL_KERNEL_CACHE=0");
5378 memset (&data
, 0, sizeof (hc_global_data_t
));
5384 data
.proc_start
= proc_start
;
5387 char **myargv
= argv
;
5389 hc_thread_mutex_init (mux_dispatcher
);
5390 hc_thread_mutex_init (mux_counter
);
5391 hc_thread_mutex_init (mux_display
);
5392 hc_thread_mutex_init (mux_adl
);
5395 * commandline parameters
5399 uint version
= VERSION
;
5401 uint benchmark
= BENCHMARK
;
5404 uint username
= USERNAME
;
5405 uint remove
= REMOVE
;
5406 uint remove_timer
= REMOVE_TIMER
;
5409 uint keyspace
= KEYSPACE
;
5410 uint potfile_disable
= POTFILE_DISABLE
;
5411 char *potfile_path
= NULL
;
5412 uint debug_mode
= DEBUG_MODE
;
5413 char *debug_file
= NULL
;
5414 char *induction_dir
= NULL
;
5415 char *outfile_check_dir
= NULL
;
5417 uint runtime
= RUNTIME
;
5418 uint hash_mode
= HASH_MODE
;
5419 uint attack_mode
= ATTACK_MODE
;
5420 uint markov_disable
= MARKOV_DISABLE
;
5421 uint markov_classic
= MARKOV_CLASSIC
;
5422 uint markov_threshold
= MARKOV_THRESHOLD
;
5423 char *markov_hcstat
= NULL
;
5424 char *outfile
= NULL
;
5425 uint outfile_format
= OUTFILE_FORMAT
;
5426 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5427 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5428 uint restore
= RESTORE
;
5429 uint restore_timer
= RESTORE_TIMER
;
5430 uint restore_disable
= RESTORE_DISABLE
;
5431 uint status
= STATUS
;
5432 uint status_timer
= STATUS_TIMER
;
5433 uint machine_readable
= MACHINE_READABLE
;
5434 uint loopback
= LOOPBACK
;
5435 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5436 char *session
= NULL
;
5437 uint hex_charset
= HEX_CHARSET
;
5438 uint hex_salt
= HEX_SALT
;
5439 uint hex_wordlist
= HEX_WORDLIST
;
5440 uint rp_gen
= RP_GEN
;
5441 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5442 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5443 uint rp_gen_seed
= RP_GEN_SEED
;
5444 char *rule_buf_l
= (char *) RULE_BUF_L
;
5445 char *rule_buf_r
= (char *) RULE_BUF_R
;
5446 uint increment
= INCREMENT
;
5447 uint increment_min
= INCREMENT_MIN
;
5448 uint increment_max
= INCREMENT_MAX
;
5449 char *cpu_affinity
= NULL
;
5450 OCL_PTR
*ocl
= NULL
;
5451 char *opencl_devices
= NULL
;
5452 char *opencl_platforms
= NULL
;
5453 char *opencl_device_types
= NULL
;
5454 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5455 char *truecrypt_keyfiles
= NULL
;
5456 char *veracrypt_keyfiles
= NULL
;
5457 uint veracrypt_pim
= 0;
5458 uint workload_profile
= WORKLOAD_PROFILE
;
5459 uint kernel_accel
= KERNEL_ACCEL
;
5460 uint kernel_loops
= KERNEL_LOOPS
;
5461 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5463 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5464 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5466 uint powertune_enable
= POWERTUNE_ENABLE
;
5469 uint logfile_disable
= LOGFILE_DISABLE
;
5470 uint segment_size
= SEGMENT_SIZE
;
5471 uint scrypt_tmto
= SCRYPT_TMTO
;
5472 char separator
= SEPARATOR
;
5473 uint bitmap_min
= BITMAP_MIN
;
5474 uint bitmap_max
= BITMAP_MAX
;
5475 char *custom_charset_1
= NULL
;
5476 char *custom_charset_2
= NULL
;
5477 char *custom_charset_3
= NULL
;
5478 char *custom_charset_4
= NULL
;
5480 #define IDX_HELP 'h'
5481 #define IDX_VERSION 'V'
5482 #define IDX_VERSION_LOWER 'v'
5483 #define IDX_QUIET 0xff02
5484 #define IDX_SHOW 0xff03
5485 #define IDX_LEFT 0xff04
5486 #define IDX_REMOVE 0xff05
5487 #define IDX_REMOVE_TIMER 0xff37
5488 #define IDX_SKIP 's'
5489 #define IDX_LIMIT 'l'
5490 #define IDX_KEYSPACE 0xff35
5491 #define IDX_POTFILE_DISABLE 0xff06
5492 #define IDX_POTFILE_PATH 0xffe0
5493 #define IDX_DEBUG_MODE 0xff43
5494 #define IDX_DEBUG_FILE 0xff44
5495 #define IDX_INDUCTION_DIR 0xff46
5496 #define IDX_OUTFILE_CHECK_DIR 0xff47
5497 #define IDX_USERNAME 0xff07
5498 #define IDX_FORCE 0xff08
5499 #define IDX_RUNTIME 0xff09
5500 #define IDX_BENCHMARK 'b'
5501 #define IDX_HASH_MODE 'm'
5502 #define IDX_ATTACK_MODE 'a'
5503 #define IDX_RP_FILE 'r'
5504 #define IDX_RP_GEN 'g'
5505 #define IDX_RP_GEN_FUNC_MIN 0xff10
5506 #define IDX_RP_GEN_FUNC_MAX 0xff11
5507 #define IDX_RP_GEN_SEED 0xff34
5508 #define IDX_RULE_BUF_L 'j'
5509 #define IDX_RULE_BUF_R 'k'
5510 #define IDX_INCREMENT 'i'
5511 #define IDX_INCREMENT_MIN 0xff12
5512 #define IDX_INCREMENT_MAX 0xff13
5513 #define IDX_OUTFILE 'o'
5514 #define IDX_OUTFILE_FORMAT 0xff14
5515 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5516 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5517 #define IDX_RESTORE 0xff15
5518 #define IDX_RESTORE_DISABLE 0xff27
5519 #define IDX_STATUS 0xff17
5520 #define IDX_STATUS_TIMER 0xff18
5521 #define IDX_MACHINE_READABLE 0xff50
5522 #define IDX_LOOPBACK 0xff38
5523 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5524 #define IDX_SESSION 0xff19
5525 #define IDX_HEX_CHARSET 0xff20
5526 #define IDX_HEX_SALT 0xff21
5527 #define IDX_HEX_WORDLIST 0xff40
5528 #define IDX_MARKOV_DISABLE 0xff22
5529 #define IDX_MARKOV_CLASSIC 0xff23
5530 #define IDX_MARKOV_THRESHOLD 't'
5531 #define IDX_MARKOV_HCSTAT 0xff24
5532 #define IDX_CPU_AFFINITY 0xff25
5533 #define IDX_OPENCL_DEVICES 'd'
5534 #define IDX_OPENCL_PLATFORMS 0xff72
5535 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5536 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5537 #define IDX_WORKLOAD_PROFILE 'w'
5538 #define IDX_KERNEL_ACCEL 'n'
5539 #define IDX_KERNEL_LOOPS 'u'
5540 #define IDX_GPU_TEMP_DISABLE 0xff29
5541 #define IDX_GPU_TEMP_ABORT 0xff30
5542 #define IDX_GPU_TEMP_RETAIN 0xff31
5543 #define IDX_POWERTUNE_ENABLE 0xff41
5544 #define IDX_LOGFILE_DISABLE 0xff51
5545 #define IDX_TRUECRYPT_KEYFILES 0xff52
5546 #define IDX_VERACRYPT_KEYFILES 0xff53
5547 #define IDX_VERACRYPT_PIM 0xff54
5548 #define IDX_SCRYPT_TMTO 0xff61
5549 #define IDX_SEGMENT_SIZE 'c'
5550 #define IDX_SEPARATOR 'p'
5551 #define IDX_BITMAP_MIN 0xff70
5552 #define IDX_BITMAP_MAX 0xff71
5553 #define IDX_CUSTOM_CHARSET_1 '1'
5554 #define IDX_CUSTOM_CHARSET_2 '2'
5555 #define IDX_CUSTOM_CHARSET_3 '3'
5556 #define IDX_CUSTOM_CHARSET_4 '4'
5558 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5560 struct option long_options
[] =
5562 {"help", no_argument
, 0, IDX_HELP
},
5563 {"version", no_argument
, 0, IDX_VERSION
},
5564 {"quiet", no_argument
, 0, IDX_QUIET
},
5565 {"show", no_argument
, 0, IDX_SHOW
},
5566 {"left", no_argument
, 0, IDX_LEFT
},
5567 {"username", no_argument
, 0, IDX_USERNAME
},
5568 {"remove", no_argument
, 0, IDX_REMOVE
},
5569 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5570 {"skip", required_argument
, 0, IDX_SKIP
},
5571 {"limit", required_argument
, 0, IDX_LIMIT
},
5572 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5573 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5574 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5575 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5576 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5577 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5578 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5579 {"force", no_argument
, 0, IDX_FORCE
},
5580 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5581 {"restore", no_argument
, 0, IDX_RESTORE
},
5582 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5583 {"status", no_argument
, 0, IDX_STATUS
},
5584 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5585 {"machine-readable", no_argument
, 0, IDX_MACHINE_READABLE
},
5586 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5587 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5588 {"session", required_argument
, 0, IDX_SESSION
},
5589 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5590 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5591 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5592 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5593 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5594 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5595 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5596 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5597 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5598 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5599 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5600 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5601 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5602 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5603 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5604 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5605 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5606 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5607 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5608 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5609 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5610 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5611 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5612 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5613 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5614 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5615 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5616 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5617 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5618 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5620 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5621 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5623 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5625 #endif // HAVE_HWMON
5626 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5627 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5628 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5629 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5630 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5631 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5632 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5633 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5634 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5635 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5636 {"increment", no_argument
, 0, IDX_INCREMENT
},
5637 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5638 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5639 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5640 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5641 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5642 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5646 uint rp_files_cnt
= 0;
5648 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5650 int option_index
= 0;
5656 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5660 case IDX_HELP
: usage
= 1; break;
5662 case IDX_VERSION_LOWER
: version
= 1; break;
5663 case IDX_RESTORE
: restore
= 1; break;
5664 case IDX_SESSION
: session
= optarg
; break;
5665 case IDX_SHOW
: show
= 1; break;
5666 case IDX_LEFT
: left
= 1; break;
5667 case '?': return (-1);
5673 log_error ("ERROR: Invalid argument specified");
5684 log_info ("%s", VERSION_TAG
);
5691 usage_big_print (PROGNAME
);
5697 * session needs to be set, always!
5700 if (session
== NULL
) session
= (char *) PROGNAME
;
5703 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5706 char *exec_path
= get_exec_path ();
5710 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5711 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5713 char *install_dir
= get_install_dir (resolved_exec_path
);
5714 char *profile_dir
= NULL
;
5715 char *session_dir
= NULL
;
5716 char *shared_dir
= NULL
;
5718 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5720 struct passwd
*pw
= getpwuid (getuid ());
5722 const char *homedir
= pw
->pw_dir
;
5724 profile_dir
= get_profile_dir (homedir
);
5725 session_dir
= get_session_dir (profile_dir
);
5726 shared_dir
= strdup (SHARED_FOLDER
);
5728 mkdir (profile_dir
, 0700);
5729 mkdir (session_dir
, 0700);
5733 profile_dir
= install_dir
;
5734 session_dir
= install_dir
;
5735 shared_dir
= install_dir
;
5738 myfree (resolved_install_folder
);
5739 myfree (resolved_exec_path
);
5743 char *install_dir
= get_install_dir (exec_path
);
5744 char *profile_dir
= install_dir
;
5745 char *session_dir
= install_dir
;
5746 char *shared_dir
= install_dir
;
5750 data
.install_dir
= install_dir
;
5751 data
.profile_dir
= profile_dir
;
5752 data
.session_dir
= session_dir
;
5753 data
.shared_dir
= shared_dir
;
5758 * kernel cache, we need to make sure folder exist
5761 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5763 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5765 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5767 mkdir (kernels_folder
, 0700);
5769 myfree (kernels_folder
);
5775 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5777 data
.session
= session
;
5779 char *eff_restore_file
= (char *) mymalloc (session_size
);
5780 char *new_restore_file
= (char *) mymalloc (session_size
);
5782 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5783 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5785 data
.eff_restore_file
= eff_restore_file
;
5786 data
.new_restore_file
= new_restore_file
;
5788 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5790 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5791 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5796 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5797 if ((show
== 1) || (left
== 1))
5799 restore_disable
= 1;
5804 data
.restore_disable
= restore_disable
;
5806 restore_data_t
*rd
= init_restore (argc
, argv
);
5816 read_restore (eff_restore_file
, rd
);
5818 if (rd
->version_bin
< RESTORE_MIN
)
5820 log_error ("ERROR: Incompatible restore-file version");
5829 rd
->pid
= getpid ();
5831 rd
->pid
= GetCurrentProcessId ();
5835 uint hash_mode_chgd
= 0;
5836 uint runtime_chgd
= 0;
5837 uint kernel_loops_chgd
= 0;
5838 uint kernel_accel_chgd
= 0;
5839 uint attack_mode_chgd
= 0;
5840 uint outfile_format_chgd
= 0;
5841 uint rp_gen_seed_chgd
= 0;
5842 uint remove_timer_chgd
= 0;
5843 uint increment_min_chgd
= 0;
5844 uint increment_max_chgd
= 0;
5845 uint workload_profile_chgd
= 0;
5846 uint opencl_vector_width_chgd
= 0;
5848 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5849 uint gpu_temp_retain_chgd
= 0;
5850 uint gpu_temp_abort_chgd
= 0;
5857 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5861 //case IDX_HELP: usage = 1; break;
5862 //case IDX_VERSION: version = 1; break;
5863 //case IDX_RESTORE: restore = 1; break;
5864 case IDX_QUIET
: quiet
= 1; break;
5865 //case IDX_SHOW: show = 1; break;
5866 case IDX_SHOW
: break;
5867 //case IDX_LEFT: left = 1; break;
5868 case IDX_LEFT
: break;
5869 case IDX_USERNAME
: username
= 1; break;
5870 case IDX_REMOVE
: remove
= 1; break;
5871 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5872 remove_timer_chgd
= 1; break;
5873 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5874 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5875 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5876 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5877 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5878 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5879 case IDX_FORCE
: force
= 1; break;
5880 case IDX_SKIP
: skip
= atoll (optarg
); break;
5881 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5882 case IDX_KEYSPACE
: keyspace
= 1; break;
5883 case IDX_BENCHMARK
: benchmark
= 1; break;
5884 case IDX_RESTORE
: break;
5885 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5886 case IDX_STATUS
: status
= 1; break;
5887 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5888 case IDX_MACHINE_READABLE
: machine_readable
= 1; break;
5889 case IDX_LOOPBACK
: loopback
= 1; break;
5890 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5891 //case IDX_SESSION: session = optarg; break;
5892 case IDX_SESSION
: break;
5893 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5894 hash_mode_chgd
= 1; break;
5895 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5896 runtime_chgd
= 1; break;
5897 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5898 attack_mode_chgd
= 1; break;
5899 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5900 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5901 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5902 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5903 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5904 rp_gen_seed_chgd
= 1; break;
5905 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5906 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5907 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5908 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5909 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5910 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5911 case IDX_OUTFILE
: outfile
= optarg
; break;
5912 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5913 outfile_format_chgd
= 1; break;
5914 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
5915 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
5916 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5917 case IDX_HEX_SALT
: hex_salt
= 1; break;
5918 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5919 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5920 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
5921 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
5922 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
5923 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
5924 opencl_vector_width_chgd
= 1; break;
5925 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
5926 workload_profile_chgd
= 1; break;
5927 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
5928 kernel_accel_chgd
= 1; break;
5929 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
5930 kernel_loops_chgd
= 1; break;
5931 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5933 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
5935 gpu_temp_abort_chgd
= 1;
5938 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
5940 gpu_temp_retain_chgd
= 1;
5944 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5946 #endif // HAVE_HWMON
5947 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5948 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5949 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
5950 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
5951 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5952 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5953 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5954 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5955 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5956 case IDX_INCREMENT
: increment
= 1; break;
5957 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5958 increment_min_chgd
= 1; break;
5959 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5960 increment_max_chgd
= 1; break;
5961 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5962 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5963 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5964 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5967 log_error ("ERROR: Invalid argument specified");
5974 log_error ("ERROR: Invalid argument specified");
5980 * Inform user things getting started,
5981 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5982 * - we do not need to check algorithm_pos
5989 if (machine_readable
== 0)
5991 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
5996 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
5999 else if (restore
== 1)
6001 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6006 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6015 if (attack_mode
> 7)
6017 log_error ("ERROR: Invalid attack-mode specified");
6022 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6024 log_error ("ERROR: Invalid runtime specified");
6029 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6031 log_error ("ERROR: Invalid hash-type specified");
6036 // renamed hash modes
6050 log_error ("Old -m specified, use -m %d instead", n
);
6058 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6060 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6066 if (outfile_format
> 16)
6068 log_error ("ERROR: Invalid outfile-format specified");
6075 if (outfile_format_chgd
== 1)
6077 if (outfile_format
> 1)
6079 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6086 outfile_format
= OUTFILE_FMT_HASH
;
6092 if (outfile_format_chgd
== 1)
6094 if ((outfile_format
> 7) && (outfile_format
< 16))
6096 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6103 if (increment_min
< INCREMENT_MIN
)
6105 log_error ("ERROR: Invalid increment-min specified");
6110 if (increment_max
> INCREMENT_MAX
)
6112 log_error ("ERROR: Invalid increment-max specified");
6117 if (increment_min
> increment_max
)
6119 log_error ("ERROR: Invalid increment-min specified");
6124 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6126 log_error ("ERROR: increment is not allowed in attack-mode 0");
6131 if ((increment
== 0) && (increment_min_chgd
== 1))
6133 log_error ("ERROR: increment-min is only supported together with increment switch");
6138 if ((increment
== 0) && (increment_max_chgd
== 1))
6140 log_error ("ERROR: increment-max is only supported together with increment switch");
6145 if (rp_files_cnt
&& rp_gen
)
6147 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6152 if (rp_files_cnt
|| rp_gen
)
6154 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6156 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6162 if (rp_gen_func_min
> rp_gen_func_max
)
6164 log_error ("ERROR: Invalid rp-gen-func-min specified");
6169 if (kernel_accel_chgd
== 1)
6173 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6174 log_info ("Please consider using the option -w instead");
6175 log_info ("You can use --force to override this but do not post error reports if you do so");
6181 if (kernel_accel
< 1)
6183 log_error ("ERROR: Invalid kernel-accel specified");
6188 if (kernel_accel
> 1024)
6190 log_error ("ERROR: Invalid kernel-accel specified");
6196 if (kernel_loops_chgd
== 1)
6200 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6201 log_info ("Please consider using the option -w instead");
6202 log_info ("You can use --force to override this but do not post error reports if you do so");
6208 if (kernel_loops
< 1)
6210 log_error ("ERROR: Invalid kernel-loops specified");
6215 if (kernel_loops
> 1024)
6217 log_error ("ERROR: Invalid kernel-loops specified");
6223 if ((workload_profile
< 1) || (workload_profile
> 4))
6225 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6230 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6232 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6237 if (show
== 1 || left
== 1)
6239 attack_mode
= ATTACK_MODE_NONE
;
6243 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6248 if (potfile_disable
== 1)
6250 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6256 uint attack_kern
= ATTACK_KERN_NONE
;
6258 switch (attack_mode
)
6260 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6261 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6262 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6263 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6264 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6271 int num_additional_params
= 1;
6273 if (attack_kern
== ATTACK_KERN_COMBI
)
6275 num_additional_params
= 2;
6278 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6280 if (keyspace_wordlist_specified
== 0) optind
--;
6283 if (attack_kern
== ATTACK_KERN_NONE
)
6285 if ((optind
+ 1) != myargc
)
6287 usage_mini_print (myargv
[0]);
6292 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6294 if ((optind
+ 1) > myargc
)
6296 usage_mini_print (myargv
[0]);
6301 else if (attack_kern
== ATTACK_KERN_COMBI
)
6303 if ((optind
+ 3) != myargc
)
6305 usage_mini_print (myargv
[0]);
6310 else if (attack_kern
== ATTACK_KERN_BF
)
6312 if ((optind
+ 1) > myargc
)
6314 usage_mini_print (myargv
[0]);
6321 usage_mini_print (myargv
[0]);
6328 if (myargv
[optind
] != 0)
6330 log_error ("ERROR: Invalid argument for benchmark mode specified");
6335 if (attack_mode_chgd
== 1)
6337 if (attack_mode
!= ATTACK_MODE_BF
)
6339 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6346 if (skip
!= 0 && limit
!= 0)
6355 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6361 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6366 potfile_disable
= 1;
6368 restore_disable
= 1;
6372 weak_hash_threshold
= 0;
6377 if (remove_timer_chgd
== 1)
6381 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6386 if (remove_timer
< 1)
6388 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6396 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6398 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6400 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6407 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6415 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6417 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6422 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6424 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6432 log_error ("ERROR: Invalid debug-mode specified");
6437 if (debug_file
!= NULL
)
6441 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6447 if (induction_dir
!= NULL
)
6449 if (attack_mode
== ATTACK_MODE_BF
)
6451 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6457 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6459 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6461 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6466 weak_hash_threshold
= 0;
6470 * induction directory
6473 char *induction_directory
= NULL
;
6475 if (attack_mode
!= ATTACK_MODE_BF
)
6477 if (induction_dir
== NULL
)
6479 induction_directory
= (char *) mymalloc (session_size
);
6481 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6483 // create induction folder if it does not already exist
6487 if (rmdir (induction_directory
) == -1)
6489 if (errno
== ENOENT
)
6491 // good, we can ignore
6493 else if (errno
== ENOTEMPTY
)
6495 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6497 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6499 if (rename (induction_directory
, induction_directory_mv
) != 0)
6501 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6508 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6514 if (mkdir (induction_directory
, 0700) == -1)
6516 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6524 induction_directory
= induction_dir
;
6528 data
.induction_directory
= induction_directory
;
6534 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6536 char *loopback_file
= (char *) mymalloc (loopback_size
);
6542 char tuning_db_file
[256] = { 0 };
6544 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6546 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6549 * outfile-check directory
6552 char *outfile_check_directory
= NULL
;
6554 if (outfile_check_dir
== NULL
)
6556 outfile_check_directory
= (char *) mymalloc (session_size
);
6558 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6562 outfile_check_directory
= outfile_check_dir
;
6565 data
.outfile_check_directory
= outfile_check_directory
;
6569 struct stat outfile_check_stat
;
6571 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6573 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6577 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6582 else if (outfile_check_dir
== NULL
)
6584 if (mkdir (outfile_check_directory
, 0700) == -1)
6586 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6594 * special other stuff
6597 if (hash_mode
== 9710)
6600 outfile_format_chgd
= 1;
6603 if (hash_mode
== 9810)
6606 outfile_format_chgd
= 1;
6609 if (hash_mode
== 10410)
6612 outfile_format_chgd
= 1;
6619 data
.hash_mode
= hash_mode
;
6620 data
.restore
= restore
;
6621 data
.restore_timer
= restore_timer
;
6622 data
.restore_disable
= restore_disable
;
6623 data
.status
= status
;
6624 data
.status_timer
= status_timer
;
6625 data
.machine_readable
= machine_readable
;
6626 data
.loopback
= loopback
;
6627 data
.runtime
= runtime
;
6628 data
.remove
= remove
;
6629 data
.remove_timer
= remove_timer
;
6630 data
.debug_mode
= debug_mode
;
6631 data
.debug_file
= debug_file
;
6632 data
.username
= username
;
6634 data
.outfile
= outfile
;
6635 data
.outfile_format
= outfile_format
;
6636 data
.outfile_autohex
= outfile_autohex
;
6637 data
.hex_charset
= hex_charset
;
6638 data
.hex_salt
= hex_salt
;
6639 data
.hex_wordlist
= hex_wordlist
;
6640 data
.separator
= separator
;
6641 data
.rp_files
= rp_files
;
6642 data
.rp_files_cnt
= rp_files_cnt
;
6643 data
.rp_gen
= rp_gen
;
6644 data
.rp_gen_seed
= rp_gen_seed
;
6646 data
.benchmark
= benchmark
;
6651 data
.powertune_enable
= powertune_enable
;
6654 data
.logfile_disable
= logfile_disable
;
6655 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6656 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6657 data
.veracrypt_pim
= veracrypt_pim
;
6658 data
.scrypt_tmto
= scrypt_tmto
;
6659 data
.workload_profile
= workload_profile
;
6667 set_cpu_affinity (cpu_affinity
);
6670 if (rp_gen_seed_chgd
== 0)
6676 srand (rp_gen_seed
);
6683 if (logfile_disable
== 0)
6685 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6687 char *logfile
= (char *) mymalloc (logfile_size
);
6689 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6691 data
.logfile
= logfile
;
6693 char *topid
= logfile_generate_topid ();
6698 // logfile_append() checks for logfile_disable internally to make it easier from here
6700 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6701 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6702 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6703 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6704 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6705 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6706 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6707 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6708 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6709 #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));
6711 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6712 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6713 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6714 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6715 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6716 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6717 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6718 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6720 logfile_top_msg ("START");
6722 logfile_top_uint (attack_mode
);
6723 logfile_top_uint (attack_kern
);
6724 logfile_top_uint (benchmark
);
6725 logfile_top_uint (bitmap_min
);
6726 logfile_top_uint (bitmap_max
);
6727 logfile_top_uint (debug_mode
);
6728 logfile_top_uint (force
);
6729 logfile_top_uint (kernel_accel
);
6730 logfile_top_uint (kernel_loops
);
6731 logfile_top_uint (gpu_temp_disable
);
6733 logfile_top_uint (gpu_temp_abort
);
6734 logfile_top_uint (gpu_temp_retain
);
6736 logfile_top_uint (hash_mode
);
6737 logfile_top_uint (hex_charset
);
6738 logfile_top_uint (hex_salt
);
6739 logfile_top_uint (hex_wordlist
);
6740 logfile_top_uint (increment
);
6741 logfile_top_uint (increment_max
);
6742 logfile_top_uint (increment_min
);
6743 logfile_top_uint (keyspace
);
6744 logfile_top_uint (left
);
6745 logfile_top_uint (logfile_disable
);
6746 logfile_top_uint (loopback
);
6747 logfile_top_uint (markov_classic
);
6748 logfile_top_uint (markov_disable
);
6749 logfile_top_uint (markov_threshold
);
6750 logfile_top_uint (outfile_autohex
);
6751 logfile_top_uint (outfile_check_timer
);
6752 logfile_top_uint (outfile_format
);
6753 logfile_top_uint (potfile_disable
);
6754 logfile_top_string (potfile_path
);
6755 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6756 logfile_top_uint (powertune_enable
);
6758 logfile_top_uint (scrypt_tmto
);
6759 logfile_top_uint (quiet
);
6760 logfile_top_uint (remove
);
6761 logfile_top_uint (remove_timer
);
6762 logfile_top_uint (restore
);
6763 logfile_top_uint (restore_disable
);
6764 logfile_top_uint (restore_timer
);
6765 logfile_top_uint (rp_gen
);
6766 logfile_top_uint (rp_gen_func_max
);
6767 logfile_top_uint (rp_gen_func_min
);
6768 logfile_top_uint (rp_gen_seed
);
6769 logfile_top_uint (runtime
);
6770 logfile_top_uint (segment_size
);
6771 logfile_top_uint (show
);
6772 logfile_top_uint (status
);
6773 logfile_top_uint (machine_readable
);
6774 logfile_top_uint (status_timer
);
6775 logfile_top_uint (usage
);
6776 logfile_top_uint (username
);
6777 logfile_top_uint (version
);
6778 logfile_top_uint (weak_hash_threshold
);
6779 logfile_top_uint (workload_profile
);
6780 logfile_top_uint64 (limit
);
6781 logfile_top_uint64 (skip
);
6782 logfile_top_char (separator
);
6783 logfile_top_string (cpu_affinity
);
6784 logfile_top_string (custom_charset_1
);
6785 logfile_top_string (custom_charset_2
);
6786 logfile_top_string (custom_charset_3
);
6787 logfile_top_string (custom_charset_4
);
6788 logfile_top_string (debug_file
);
6789 logfile_top_string (opencl_devices
);
6790 logfile_top_string (opencl_platforms
);
6791 logfile_top_string (opencl_device_types
);
6792 logfile_top_uint (opencl_vector_width
);
6793 logfile_top_string (induction_dir
);
6794 logfile_top_string (markov_hcstat
);
6795 logfile_top_string (outfile
);
6796 logfile_top_string (outfile_check_dir
);
6797 logfile_top_string (rule_buf_l
);
6798 logfile_top_string (rule_buf_r
);
6799 logfile_top_string (session
);
6800 logfile_top_string (truecrypt_keyfiles
);
6801 logfile_top_string (veracrypt_keyfiles
);
6802 logfile_top_uint (veracrypt_pim
);
6805 * Init OpenCL library loader
6810 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6818 * OpenCL platform selection
6821 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6824 * OpenCL device selection
6827 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6830 * OpenCL device type selection
6833 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6842 * disable useless stuff for benchmark
6847 restore_disable
= 1;
6848 potfile_disable
= 1;
6849 weak_hash_threshold
= 0;
6850 gpu_temp_disable
= 1;
6852 data
.status_timer
= status_timer
;
6853 data
.restore_timer
= restore_timer
;
6854 data
.restore_disable
= restore_disable
;
6857 * force attack mode to be bruteforce
6860 attack_mode
= ATTACK_MODE_BF
;
6861 attack_kern
= ATTACK_KERN_BF
;
6863 if (workload_profile_chgd
== 0)
6865 workload_profile
= 3;
6867 data
.workload_profile
= workload_profile
;
6877 uint attack_exec
= 0;
6881 uint esalt_size
= 0;
6883 uint dgst_pos0
= -1;
6884 uint dgst_pos1
= -1;
6885 uint dgst_pos2
= -1;
6886 uint dgst_pos3
= -1;
6888 int (*parse_func
) (char *, uint
, hash_t
*);
6889 int (*sort_by_digest
) (const void *, const void *);
6891 uint algorithm_pos
= 0;
6892 uint algorithm_max
= 1;
6894 uint
*algorithms
= default_benchmark_algorithms
;
6896 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6898 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6901 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6902 * the following algos are skipped entirely
6905 if (algorithm_pos
> 0)
6909 rd
= init_restore (argc
, argv
);
6915 * update hash_mode in case of multihash benchmark
6920 if (hash_mode_chgd
== 0)
6922 hash_mode
= algorithms
[algorithm_pos
];
6924 data
.hash_mode
= hash_mode
;
6934 case 0: hash_type
= HASH_TYPE_MD5
;
6935 salt_type
= SALT_TYPE_NONE
;
6936 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6937 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6938 | OPTS_TYPE_PT_ADD80
6939 | OPTS_TYPE_PT_ADDBITS14
;
6940 kern_type
= KERN_TYPE_MD5
;
6941 dgst_size
= DGST_SIZE_4_4
;
6942 parse_func
= md5_parse_hash
;
6943 sort_by_digest
= sort_by_digest_4_4
;
6944 opti_type
= OPTI_TYPE_ZERO_BYTE
6945 | OPTI_TYPE_PRECOMPUTE_INIT
6946 | OPTI_TYPE_PRECOMPUTE_MERKLE
6947 | OPTI_TYPE_MEET_IN_MIDDLE
6948 | OPTI_TYPE_EARLY_SKIP
6949 | OPTI_TYPE_NOT_ITERATED
6950 | OPTI_TYPE_NOT_SALTED
6951 | OPTI_TYPE_RAW_HASH
;
6958 case 10: hash_type
= HASH_TYPE_MD5
;
6959 salt_type
= SALT_TYPE_INTERN
;
6960 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6961 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6962 | OPTS_TYPE_ST_ADD80
6963 | OPTS_TYPE_ST_ADDBITS14
;
6964 kern_type
= KERN_TYPE_MD5_PWSLT
;
6965 dgst_size
= DGST_SIZE_4_4
;
6966 parse_func
= md5s_parse_hash
;
6967 sort_by_digest
= sort_by_digest_4_4
;
6968 opti_type
= OPTI_TYPE_ZERO_BYTE
6969 | OPTI_TYPE_PRECOMPUTE_INIT
6970 | OPTI_TYPE_PRECOMPUTE_MERKLE
6971 | OPTI_TYPE_MEET_IN_MIDDLE
6972 | OPTI_TYPE_EARLY_SKIP
6973 | OPTI_TYPE_NOT_ITERATED
6974 | OPTI_TYPE_APPENDED_SALT
6975 | OPTI_TYPE_RAW_HASH
;
6982 case 11: hash_type
= HASH_TYPE_MD5
;
6983 salt_type
= SALT_TYPE_INTERN
;
6984 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6985 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6986 | OPTS_TYPE_ST_ADD80
6987 | OPTS_TYPE_ST_ADDBITS14
;
6988 kern_type
= KERN_TYPE_MD5_PWSLT
;
6989 dgst_size
= DGST_SIZE_4_4
;
6990 parse_func
= joomla_parse_hash
;
6991 sort_by_digest
= sort_by_digest_4_4
;
6992 opti_type
= OPTI_TYPE_ZERO_BYTE
6993 | OPTI_TYPE_PRECOMPUTE_INIT
6994 | OPTI_TYPE_PRECOMPUTE_MERKLE
6995 | OPTI_TYPE_MEET_IN_MIDDLE
6996 | OPTI_TYPE_EARLY_SKIP
6997 | OPTI_TYPE_NOT_ITERATED
6998 | OPTI_TYPE_APPENDED_SALT
6999 | OPTI_TYPE_RAW_HASH
;
7006 case 12: hash_type
= HASH_TYPE_MD5
;
7007 salt_type
= SALT_TYPE_INTERN
;
7008 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7009 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7010 | OPTS_TYPE_ST_ADD80
7011 | OPTS_TYPE_ST_ADDBITS14
;
7012 kern_type
= KERN_TYPE_MD5_PWSLT
;
7013 dgst_size
= DGST_SIZE_4_4
;
7014 parse_func
= postgresql_parse_hash
;
7015 sort_by_digest
= sort_by_digest_4_4
;
7016 opti_type
= OPTI_TYPE_ZERO_BYTE
7017 | OPTI_TYPE_PRECOMPUTE_INIT
7018 | OPTI_TYPE_PRECOMPUTE_MERKLE
7019 | OPTI_TYPE_MEET_IN_MIDDLE
7020 | OPTI_TYPE_EARLY_SKIP
7021 | OPTI_TYPE_NOT_ITERATED
7022 | OPTI_TYPE_APPENDED_SALT
7023 | OPTI_TYPE_RAW_HASH
;
7030 case 20: hash_type
= HASH_TYPE_MD5
;
7031 salt_type
= SALT_TYPE_INTERN
;
7032 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7033 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7034 | OPTS_TYPE_PT_ADD80
7035 | OPTS_TYPE_PT_ADDBITS14
;
7036 kern_type
= KERN_TYPE_MD5_SLTPW
;
7037 dgst_size
= DGST_SIZE_4_4
;
7038 parse_func
= md5s_parse_hash
;
7039 sort_by_digest
= sort_by_digest_4_4
;
7040 opti_type
= OPTI_TYPE_ZERO_BYTE
7041 | OPTI_TYPE_PRECOMPUTE_INIT
7042 | OPTI_TYPE_PRECOMPUTE_MERKLE
7043 | OPTI_TYPE_EARLY_SKIP
7044 | OPTI_TYPE_NOT_ITERATED
7045 | OPTI_TYPE_PREPENDED_SALT
7046 | OPTI_TYPE_RAW_HASH
;
7053 case 21: hash_type
= HASH_TYPE_MD5
;
7054 salt_type
= SALT_TYPE_INTERN
;
7055 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7056 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7057 | OPTS_TYPE_PT_ADD80
7058 | OPTS_TYPE_PT_ADDBITS14
;
7059 kern_type
= KERN_TYPE_MD5_SLTPW
;
7060 dgst_size
= DGST_SIZE_4_4
;
7061 parse_func
= osc_parse_hash
;
7062 sort_by_digest
= sort_by_digest_4_4
;
7063 opti_type
= OPTI_TYPE_ZERO_BYTE
7064 | OPTI_TYPE_PRECOMPUTE_INIT
7065 | OPTI_TYPE_PRECOMPUTE_MERKLE
7066 | OPTI_TYPE_EARLY_SKIP
7067 | OPTI_TYPE_NOT_ITERATED
7068 | OPTI_TYPE_PREPENDED_SALT
7069 | OPTI_TYPE_RAW_HASH
;
7076 case 22: hash_type
= HASH_TYPE_MD5
;
7077 salt_type
= SALT_TYPE_EMBEDDED
;
7078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7079 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7080 | OPTS_TYPE_PT_ADD80
7081 | OPTS_TYPE_PT_ADDBITS14
;
7082 kern_type
= KERN_TYPE_MD5_SLTPW
;
7083 dgst_size
= DGST_SIZE_4_4
;
7084 parse_func
= netscreen_parse_hash
;
7085 sort_by_digest
= sort_by_digest_4_4
;
7086 opti_type
= OPTI_TYPE_ZERO_BYTE
7087 | OPTI_TYPE_PRECOMPUTE_INIT
7088 | OPTI_TYPE_PRECOMPUTE_MERKLE
7089 | OPTI_TYPE_EARLY_SKIP
7090 | OPTI_TYPE_NOT_ITERATED
7091 | OPTI_TYPE_PREPENDED_SALT
7092 | OPTI_TYPE_RAW_HASH
;
7099 case 23: hash_type
= HASH_TYPE_MD5
;
7100 salt_type
= SALT_TYPE_EMBEDDED
;
7101 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7102 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7103 | OPTS_TYPE_PT_ADD80
7104 | OPTS_TYPE_PT_ADDBITS14
;
7105 kern_type
= KERN_TYPE_MD5_SLTPW
;
7106 dgst_size
= DGST_SIZE_4_4
;
7107 parse_func
= skype_parse_hash
;
7108 sort_by_digest
= sort_by_digest_4_4
;
7109 opti_type
= OPTI_TYPE_ZERO_BYTE
7110 | OPTI_TYPE_PRECOMPUTE_INIT
7111 | OPTI_TYPE_PRECOMPUTE_MERKLE
7112 | OPTI_TYPE_EARLY_SKIP
7113 | OPTI_TYPE_NOT_ITERATED
7114 | OPTI_TYPE_PREPENDED_SALT
7115 | OPTI_TYPE_RAW_HASH
;
7122 case 30: hash_type
= HASH_TYPE_MD5
;
7123 salt_type
= SALT_TYPE_INTERN
;
7124 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7125 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7126 | OPTS_TYPE_PT_UNICODE
7127 | OPTS_TYPE_ST_ADD80
7128 | OPTS_TYPE_ST_ADDBITS14
;
7129 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7130 dgst_size
= DGST_SIZE_4_4
;
7131 parse_func
= md5s_parse_hash
;
7132 sort_by_digest
= sort_by_digest_4_4
;
7133 opti_type
= OPTI_TYPE_ZERO_BYTE
7134 | OPTI_TYPE_PRECOMPUTE_INIT
7135 | OPTI_TYPE_PRECOMPUTE_MERKLE
7136 | OPTI_TYPE_MEET_IN_MIDDLE
7137 | OPTI_TYPE_EARLY_SKIP
7138 | OPTI_TYPE_NOT_ITERATED
7139 | OPTI_TYPE_APPENDED_SALT
7140 | OPTI_TYPE_RAW_HASH
;
7147 case 40: hash_type
= HASH_TYPE_MD5
;
7148 salt_type
= SALT_TYPE_INTERN
;
7149 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7150 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7151 | OPTS_TYPE_PT_ADD80
7152 | OPTS_TYPE_PT_ADDBITS14
7153 | OPTS_TYPE_PT_UNICODE
;
7154 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7155 dgst_size
= DGST_SIZE_4_4
;
7156 parse_func
= md5s_parse_hash
;
7157 sort_by_digest
= sort_by_digest_4_4
;
7158 opti_type
= OPTI_TYPE_ZERO_BYTE
7159 | OPTI_TYPE_PRECOMPUTE_INIT
7160 | OPTI_TYPE_PRECOMPUTE_MERKLE
7161 | OPTI_TYPE_EARLY_SKIP
7162 | OPTI_TYPE_NOT_ITERATED
7163 | OPTI_TYPE_PREPENDED_SALT
7164 | OPTI_TYPE_RAW_HASH
;
7171 case 50: hash_type
= HASH_TYPE_MD5
;
7172 salt_type
= SALT_TYPE_INTERN
;
7173 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7174 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7175 | OPTS_TYPE_ST_ADD80
7176 | OPTS_TYPE_ST_ADDBITS14
;
7177 kern_type
= KERN_TYPE_HMACMD5_PW
;
7178 dgst_size
= DGST_SIZE_4_4
;
7179 parse_func
= hmacmd5_parse_hash
;
7180 sort_by_digest
= sort_by_digest_4_4
;
7181 opti_type
= OPTI_TYPE_ZERO_BYTE
7182 | OPTI_TYPE_NOT_ITERATED
;
7189 case 60: hash_type
= HASH_TYPE_MD5
;
7190 salt_type
= SALT_TYPE_INTERN
;
7191 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7192 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7193 | OPTS_TYPE_PT_ADD80
7194 | OPTS_TYPE_PT_ADDBITS14
;
7195 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7196 dgst_size
= DGST_SIZE_4_4
;
7197 parse_func
= hmacmd5_parse_hash
;
7198 sort_by_digest
= sort_by_digest_4_4
;
7199 opti_type
= OPTI_TYPE_ZERO_BYTE
7200 | OPTI_TYPE_NOT_ITERATED
;
7207 case 100: hash_type
= HASH_TYPE_SHA1
;
7208 salt_type
= SALT_TYPE_NONE
;
7209 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7210 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7211 | OPTS_TYPE_PT_ADD80
7212 | OPTS_TYPE_PT_ADDBITS15
;
7213 kern_type
= KERN_TYPE_SHA1
;
7214 dgst_size
= DGST_SIZE_4_5
;
7215 parse_func
= sha1_parse_hash
;
7216 sort_by_digest
= sort_by_digest_4_5
;
7217 opti_type
= OPTI_TYPE_ZERO_BYTE
7218 | OPTI_TYPE_PRECOMPUTE_INIT
7219 | OPTI_TYPE_PRECOMPUTE_MERKLE
7220 | OPTI_TYPE_EARLY_SKIP
7221 | OPTI_TYPE_NOT_ITERATED
7222 | OPTI_TYPE_NOT_SALTED
7223 | OPTI_TYPE_RAW_HASH
;
7230 case 101: hash_type
= HASH_TYPE_SHA1
;
7231 salt_type
= SALT_TYPE_NONE
;
7232 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7233 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7234 | OPTS_TYPE_PT_ADD80
7235 | OPTS_TYPE_PT_ADDBITS15
;
7236 kern_type
= KERN_TYPE_SHA1
;
7237 dgst_size
= DGST_SIZE_4_5
;
7238 parse_func
= sha1b64_parse_hash
;
7239 sort_by_digest
= sort_by_digest_4_5
;
7240 opti_type
= OPTI_TYPE_ZERO_BYTE
7241 | OPTI_TYPE_PRECOMPUTE_INIT
7242 | OPTI_TYPE_PRECOMPUTE_MERKLE
7243 | OPTI_TYPE_EARLY_SKIP
7244 | OPTI_TYPE_NOT_ITERATED
7245 | OPTI_TYPE_NOT_SALTED
7246 | OPTI_TYPE_RAW_HASH
;
7253 case 110: hash_type
= HASH_TYPE_SHA1
;
7254 salt_type
= SALT_TYPE_INTERN
;
7255 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7256 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7257 | OPTS_TYPE_ST_ADD80
7258 | OPTS_TYPE_ST_ADDBITS15
;
7259 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7260 dgst_size
= DGST_SIZE_4_5
;
7261 parse_func
= sha1s_parse_hash
;
7262 sort_by_digest
= sort_by_digest_4_5
;
7263 opti_type
= OPTI_TYPE_ZERO_BYTE
7264 | OPTI_TYPE_PRECOMPUTE_INIT
7265 | OPTI_TYPE_PRECOMPUTE_MERKLE
7266 | OPTI_TYPE_EARLY_SKIP
7267 | OPTI_TYPE_NOT_ITERATED
7268 | OPTI_TYPE_APPENDED_SALT
7269 | OPTI_TYPE_RAW_HASH
;
7276 case 111: hash_type
= HASH_TYPE_SHA1
;
7277 salt_type
= SALT_TYPE_EMBEDDED
;
7278 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7279 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7280 | OPTS_TYPE_ST_ADD80
7281 | OPTS_TYPE_ST_ADDBITS15
;
7282 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7283 dgst_size
= DGST_SIZE_4_5
;
7284 parse_func
= sha1b64s_parse_hash
;
7285 sort_by_digest
= sort_by_digest_4_5
;
7286 opti_type
= OPTI_TYPE_ZERO_BYTE
7287 | OPTI_TYPE_PRECOMPUTE_INIT
7288 | OPTI_TYPE_PRECOMPUTE_MERKLE
7289 | OPTI_TYPE_EARLY_SKIP
7290 | OPTI_TYPE_NOT_ITERATED
7291 | OPTI_TYPE_APPENDED_SALT
7292 | OPTI_TYPE_RAW_HASH
;
7299 case 112: hash_type
= HASH_TYPE_SHA1
;
7300 salt_type
= SALT_TYPE_INTERN
;
7301 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7302 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7303 | OPTS_TYPE_ST_ADD80
7304 | OPTS_TYPE_ST_ADDBITS15
7306 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7307 dgst_size
= DGST_SIZE_4_5
;
7308 parse_func
= oracles_parse_hash
;
7309 sort_by_digest
= sort_by_digest_4_5
;
7310 opti_type
= OPTI_TYPE_ZERO_BYTE
7311 | OPTI_TYPE_PRECOMPUTE_INIT
7312 | OPTI_TYPE_PRECOMPUTE_MERKLE
7313 | OPTI_TYPE_EARLY_SKIP
7314 | OPTI_TYPE_NOT_ITERATED
7315 | OPTI_TYPE_APPENDED_SALT
7316 | OPTI_TYPE_RAW_HASH
;
7323 case 120: hash_type
= HASH_TYPE_SHA1
;
7324 salt_type
= SALT_TYPE_INTERN
;
7325 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7326 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7327 | OPTS_TYPE_PT_ADD80
7328 | OPTS_TYPE_PT_ADDBITS15
;
7329 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7330 dgst_size
= DGST_SIZE_4_5
;
7331 parse_func
= sha1s_parse_hash
;
7332 sort_by_digest
= sort_by_digest_4_5
;
7333 opti_type
= OPTI_TYPE_ZERO_BYTE
7334 | OPTI_TYPE_PRECOMPUTE_INIT
7335 | OPTI_TYPE_PRECOMPUTE_MERKLE
7336 | OPTI_TYPE_EARLY_SKIP
7337 | OPTI_TYPE_NOT_ITERATED
7338 | OPTI_TYPE_PREPENDED_SALT
7339 | OPTI_TYPE_RAW_HASH
;
7346 case 121: hash_type
= HASH_TYPE_SHA1
;
7347 salt_type
= SALT_TYPE_INTERN
;
7348 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7349 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7350 | OPTS_TYPE_PT_ADD80
7351 | OPTS_TYPE_PT_ADDBITS15
7352 | OPTS_TYPE_ST_LOWER
;
7353 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7354 dgst_size
= DGST_SIZE_4_5
;
7355 parse_func
= smf_parse_hash
;
7356 sort_by_digest
= sort_by_digest_4_5
;
7357 opti_type
= OPTI_TYPE_ZERO_BYTE
7358 | OPTI_TYPE_PRECOMPUTE_INIT
7359 | OPTI_TYPE_PRECOMPUTE_MERKLE
7360 | OPTI_TYPE_EARLY_SKIP
7361 | OPTI_TYPE_NOT_ITERATED
7362 | OPTI_TYPE_PREPENDED_SALT
7363 | OPTI_TYPE_RAW_HASH
;
7370 case 122: hash_type
= HASH_TYPE_SHA1
;
7371 salt_type
= SALT_TYPE_EMBEDDED
;
7372 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7373 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7374 | OPTS_TYPE_PT_ADD80
7375 | OPTS_TYPE_PT_ADDBITS15
7377 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7378 dgst_size
= DGST_SIZE_4_5
;
7379 parse_func
= osx1_parse_hash
;
7380 sort_by_digest
= sort_by_digest_4_5
;
7381 opti_type
= OPTI_TYPE_ZERO_BYTE
7382 | OPTI_TYPE_PRECOMPUTE_INIT
7383 | OPTI_TYPE_PRECOMPUTE_MERKLE
7384 | OPTI_TYPE_EARLY_SKIP
7385 | OPTI_TYPE_NOT_ITERATED
7386 | OPTI_TYPE_PREPENDED_SALT
7387 | OPTI_TYPE_RAW_HASH
;
7394 case 124: hash_type
= HASH_TYPE_SHA1
;
7395 salt_type
= SALT_TYPE_EMBEDDED
;
7396 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7397 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7398 | OPTS_TYPE_PT_ADD80
7399 | OPTS_TYPE_PT_ADDBITS15
;
7400 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7401 dgst_size
= DGST_SIZE_4_5
;
7402 parse_func
= djangosha1_parse_hash
;
7403 sort_by_digest
= sort_by_digest_4_5
;
7404 opti_type
= OPTI_TYPE_ZERO_BYTE
7405 | OPTI_TYPE_PRECOMPUTE_INIT
7406 | OPTI_TYPE_PRECOMPUTE_MERKLE
7407 | OPTI_TYPE_EARLY_SKIP
7408 | OPTI_TYPE_NOT_ITERATED
7409 | OPTI_TYPE_PREPENDED_SALT
7410 | OPTI_TYPE_RAW_HASH
;
7417 case 125: hash_type
= HASH_TYPE_SHA1
;
7418 salt_type
= SALT_TYPE_EMBEDDED
;
7419 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7420 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7421 | OPTS_TYPE_PT_ADD80
7422 | OPTS_TYPE_PT_ADDBITS15
7424 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7425 dgst_size
= DGST_SIZE_4_5
;
7426 parse_func
= arubaos_parse_hash
;
7427 sort_by_digest
= sort_by_digest_4_5
;
7428 opti_type
= OPTI_TYPE_ZERO_BYTE
7429 | OPTI_TYPE_PRECOMPUTE_INIT
7430 | OPTI_TYPE_PRECOMPUTE_MERKLE
7431 | OPTI_TYPE_EARLY_SKIP
7432 | OPTI_TYPE_NOT_ITERATED
7433 | OPTI_TYPE_PREPENDED_SALT
7434 | OPTI_TYPE_RAW_HASH
;
7441 case 130: hash_type
= HASH_TYPE_SHA1
;
7442 salt_type
= SALT_TYPE_INTERN
;
7443 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7444 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7445 | OPTS_TYPE_PT_UNICODE
7446 | OPTS_TYPE_ST_ADD80
7447 | OPTS_TYPE_ST_ADDBITS15
;
7448 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7449 dgst_size
= DGST_SIZE_4_5
;
7450 parse_func
= sha1s_parse_hash
;
7451 sort_by_digest
= sort_by_digest_4_5
;
7452 opti_type
= OPTI_TYPE_ZERO_BYTE
7453 | OPTI_TYPE_PRECOMPUTE_INIT
7454 | OPTI_TYPE_PRECOMPUTE_MERKLE
7455 | OPTI_TYPE_EARLY_SKIP
7456 | OPTI_TYPE_NOT_ITERATED
7457 | OPTI_TYPE_APPENDED_SALT
7458 | OPTI_TYPE_RAW_HASH
;
7465 case 131: hash_type
= HASH_TYPE_SHA1
;
7466 salt_type
= SALT_TYPE_EMBEDDED
;
7467 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7468 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7469 | OPTS_TYPE_PT_UNICODE
7470 | OPTS_TYPE_PT_UPPER
7471 | OPTS_TYPE_ST_ADD80
7472 | OPTS_TYPE_ST_ADDBITS15
7474 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7475 dgst_size
= DGST_SIZE_4_5
;
7476 parse_func
= mssql2000_parse_hash
;
7477 sort_by_digest
= sort_by_digest_4_5
;
7478 opti_type
= OPTI_TYPE_ZERO_BYTE
7479 | OPTI_TYPE_PRECOMPUTE_INIT
7480 | OPTI_TYPE_PRECOMPUTE_MERKLE
7481 | OPTI_TYPE_EARLY_SKIP
7482 | OPTI_TYPE_NOT_ITERATED
7483 | OPTI_TYPE_APPENDED_SALT
7484 | OPTI_TYPE_RAW_HASH
;
7491 case 132: hash_type
= HASH_TYPE_SHA1
;
7492 salt_type
= SALT_TYPE_EMBEDDED
;
7493 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7494 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7495 | OPTS_TYPE_PT_UNICODE
7496 | OPTS_TYPE_ST_ADD80
7497 | OPTS_TYPE_ST_ADDBITS15
7499 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7500 dgst_size
= DGST_SIZE_4_5
;
7501 parse_func
= mssql2005_parse_hash
;
7502 sort_by_digest
= sort_by_digest_4_5
;
7503 opti_type
= OPTI_TYPE_ZERO_BYTE
7504 | OPTI_TYPE_PRECOMPUTE_INIT
7505 | OPTI_TYPE_PRECOMPUTE_MERKLE
7506 | OPTI_TYPE_EARLY_SKIP
7507 | OPTI_TYPE_NOT_ITERATED
7508 | OPTI_TYPE_APPENDED_SALT
7509 | OPTI_TYPE_RAW_HASH
;
7516 case 133: hash_type
= HASH_TYPE_SHA1
;
7517 salt_type
= SALT_TYPE_EMBEDDED
;
7518 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7519 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7520 | OPTS_TYPE_PT_UNICODE
7521 | OPTS_TYPE_ST_ADD80
7522 | OPTS_TYPE_ST_ADDBITS15
;
7523 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7524 dgst_size
= DGST_SIZE_4_5
;
7525 parse_func
= peoplesoft_parse_hash
;
7526 sort_by_digest
= sort_by_digest_4_5
;
7527 opti_type
= OPTI_TYPE_ZERO_BYTE
7528 | OPTI_TYPE_PRECOMPUTE_INIT
7529 | OPTI_TYPE_PRECOMPUTE_MERKLE
7530 | OPTI_TYPE_EARLY_SKIP
7531 | OPTI_TYPE_NOT_ITERATED
7532 | OPTI_TYPE_APPENDED_SALT
7533 | OPTI_TYPE_RAW_HASH
;
7540 case 140: hash_type
= HASH_TYPE_SHA1
;
7541 salt_type
= SALT_TYPE_INTERN
;
7542 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7543 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7544 | OPTS_TYPE_PT_ADD80
7545 | OPTS_TYPE_PT_ADDBITS15
7546 | OPTS_TYPE_PT_UNICODE
;
7547 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7548 dgst_size
= DGST_SIZE_4_5
;
7549 parse_func
= sha1s_parse_hash
;
7550 sort_by_digest
= sort_by_digest_4_5
;
7551 opti_type
= OPTI_TYPE_ZERO_BYTE
7552 | OPTI_TYPE_PRECOMPUTE_INIT
7553 | OPTI_TYPE_PRECOMPUTE_MERKLE
7554 | OPTI_TYPE_EARLY_SKIP
7555 | OPTI_TYPE_NOT_ITERATED
7556 | OPTI_TYPE_PREPENDED_SALT
7557 | OPTI_TYPE_RAW_HASH
;
7564 case 141: hash_type
= HASH_TYPE_SHA1
;
7565 salt_type
= SALT_TYPE_EMBEDDED
;
7566 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7567 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7568 | OPTS_TYPE_PT_ADD80
7569 | OPTS_TYPE_PT_ADDBITS15
7570 | OPTS_TYPE_PT_UNICODE
7571 | OPTS_TYPE_ST_BASE64
;
7572 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7573 dgst_size
= DGST_SIZE_4_5
;
7574 parse_func
= episerver_parse_hash
;
7575 sort_by_digest
= sort_by_digest_4_5
;
7576 opti_type
= OPTI_TYPE_ZERO_BYTE
7577 | OPTI_TYPE_PRECOMPUTE_INIT
7578 | OPTI_TYPE_PRECOMPUTE_MERKLE
7579 | OPTI_TYPE_EARLY_SKIP
7580 | OPTI_TYPE_NOT_ITERATED
7581 | OPTI_TYPE_PREPENDED_SALT
7582 | OPTI_TYPE_RAW_HASH
;
7589 case 150: hash_type
= HASH_TYPE_SHA1
;
7590 salt_type
= SALT_TYPE_INTERN
;
7591 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7592 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7593 | OPTS_TYPE_ST_ADD80
7594 | OPTS_TYPE_ST_ADDBITS15
;
7595 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7596 dgst_size
= DGST_SIZE_4_5
;
7597 parse_func
= hmacsha1_parse_hash
;
7598 sort_by_digest
= sort_by_digest_4_5
;
7599 opti_type
= OPTI_TYPE_ZERO_BYTE
7600 | OPTI_TYPE_NOT_ITERATED
;
7607 case 160: hash_type
= HASH_TYPE_SHA1
;
7608 salt_type
= SALT_TYPE_INTERN
;
7609 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7610 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7611 | OPTS_TYPE_PT_ADD80
7612 | OPTS_TYPE_PT_ADDBITS15
;
7613 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7614 dgst_size
= DGST_SIZE_4_5
;
7615 parse_func
= hmacsha1_parse_hash
;
7616 sort_by_digest
= sort_by_digest_4_5
;
7617 opti_type
= OPTI_TYPE_ZERO_BYTE
7618 | OPTI_TYPE_NOT_ITERATED
;
7625 case 190: hash_type
= HASH_TYPE_SHA1
;
7626 salt_type
= SALT_TYPE_NONE
;
7627 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7628 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7629 | OPTS_TYPE_PT_ADD80
7630 | OPTS_TYPE_PT_ADDBITS15
;
7631 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7632 dgst_size
= DGST_SIZE_4_5
;
7633 parse_func
= sha1linkedin_parse_hash
;
7634 sort_by_digest
= sort_by_digest_4_5
;
7635 opti_type
= OPTI_TYPE_ZERO_BYTE
7636 | OPTI_TYPE_PRECOMPUTE_INIT
7637 | OPTI_TYPE_EARLY_SKIP
7638 | OPTI_TYPE_NOT_ITERATED
7639 | OPTI_TYPE_NOT_SALTED
;
7646 case 200: hash_type
= HASH_TYPE_MYSQL
;
7647 salt_type
= SALT_TYPE_NONE
;
7648 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7650 kern_type
= KERN_TYPE_MYSQL
;
7651 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7652 parse_func
= mysql323_parse_hash
;
7653 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7654 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7661 case 300: hash_type
= HASH_TYPE_SHA1
;
7662 salt_type
= SALT_TYPE_NONE
;
7663 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7664 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7665 | OPTS_TYPE_PT_ADD80
7666 | OPTS_TYPE_PT_ADDBITS15
;
7667 kern_type
= KERN_TYPE_MYSQL41
;
7668 dgst_size
= DGST_SIZE_4_5
;
7669 parse_func
= sha1_parse_hash
;
7670 sort_by_digest
= sort_by_digest_4_5
;
7671 opti_type
= OPTI_TYPE_ZERO_BYTE
7672 | OPTI_TYPE_PRECOMPUTE_INIT
7673 | OPTI_TYPE_PRECOMPUTE_MERKLE
7674 | OPTI_TYPE_EARLY_SKIP
7675 | OPTI_TYPE_NOT_ITERATED
7676 | OPTI_TYPE_NOT_SALTED
;
7683 case 400: hash_type
= HASH_TYPE_MD5
;
7684 salt_type
= SALT_TYPE_EMBEDDED
;
7685 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7686 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7687 kern_type
= KERN_TYPE_PHPASS
;
7688 dgst_size
= DGST_SIZE_4_4
;
7689 parse_func
= phpass_parse_hash
;
7690 sort_by_digest
= sort_by_digest_4_4
;
7691 opti_type
= OPTI_TYPE_ZERO_BYTE
7692 | OPTI_TYPE_SLOW_HASH_SIMD
;
7699 case 500: hash_type
= HASH_TYPE_MD5
;
7700 salt_type
= SALT_TYPE_EMBEDDED
;
7701 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7702 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7703 kern_type
= KERN_TYPE_MD5CRYPT
;
7704 dgst_size
= DGST_SIZE_4_4
;
7705 parse_func
= md5crypt_parse_hash
;
7706 sort_by_digest
= sort_by_digest_4_4
;
7707 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7714 case 501: hash_type
= HASH_TYPE_MD5
;
7715 salt_type
= SALT_TYPE_EMBEDDED
;
7716 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7717 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7718 | OPTS_TYPE_HASH_COPY
;
7719 kern_type
= KERN_TYPE_MD5CRYPT
;
7720 dgst_size
= DGST_SIZE_4_4
;
7721 parse_func
= juniper_parse_hash
;
7722 sort_by_digest
= sort_by_digest_4_4
;
7723 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7730 case 900: hash_type
= HASH_TYPE_MD4
;
7731 salt_type
= SALT_TYPE_NONE
;
7732 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7734 | OPTS_TYPE_PT_ADD80
7735 | OPTS_TYPE_PT_ADDBITS14
;
7736 kern_type
= KERN_TYPE_MD4
;
7737 dgst_size
= DGST_SIZE_4_4
;
7738 parse_func
= md4_parse_hash
;
7739 sort_by_digest
= sort_by_digest_4_4
;
7740 opti_type
= OPTI_TYPE_ZERO_BYTE
7741 | OPTI_TYPE_PRECOMPUTE_INIT
7742 | OPTI_TYPE_PRECOMPUTE_MERKLE
7743 | OPTI_TYPE_MEET_IN_MIDDLE
7744 | OPTI_TYPE_EARLY_SKIP
7745 | OPTI_TYPE_NOT_ITERATED
7746 | OPTI_TYPE_NOT_SALTED
7747 | OPTI_TYPE_RAW_HASH
;
7754 case 1000: hash_type
= HASH_TYPE_MD4
;
7755 salt_type
= SALT_TYPE_NONE
;
7756 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7758 | OPTS_TYPE_PT_ADD80
7759 | OPTS_TYPE_PT_ADDBITS14
7760 | OPTS_TYPE_PT_UNICODE
;
7761 kern_type
= KERN_TYPE_MD4_PWU
;
7762 dgst_size
= DGST_SIZE_4_4
;
7763 parse_func
= md4_parse_hash
;
7764 sort_by_digest
= sort_by_digest_4_4
;
7765 opti_type
= OPTI_TYPE_ZERO_BYTE
7766 | OPTI_TYPE_PRECOMPUTE_INIT
7767 | OPTI_TYPE_PRECOMPUTE_MERKLE
7768 | OPTI_TYPE_MEET_IN_MIDDLE
7769 | OPTI_TYPE_EARLY_SKIP
7770 | OPTI_TYPE_NOT_ITERATED
7771 | OPTI_TYPE_NOT_SALTED
7772 | OPTI_TYPE_RAW_HASH
;
7779 case 1100: hash_type
= HASH_TYPE_MD4
;
7780 salt_type
= SALT_TYPE_INTERN
;
7781 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7782 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7783 | OPTS_TYPE_PT_ADD80
7784 | OPTS_TYPE_PT_ADDBITS14
7785 | OPTS_TYPE_PT_UNICODE
7786 | OPTS_TYPE_ST_ADD80
7787 | OPTS_TYPE_ST_UNICODE
7788 | OPTS_TYPE_ST_LOWER
;
7789 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7790 dgst_size
= DGST_SIZE_4_4
;
7791 parse_func
= dcc_parse_hash
;
7792 sort_by_digest
= sort_by_digest_4_4
;
7793 opti_type
= OPTI_TYPE_ZERO_BYTE
7794 | OPTI_TYPE_PRECOMPUTE_INIT
7795 | OPTI_TYPE_PRECOMPUTE_MERKLE
7796 | OPTI_TYPE_EARLY_SKIP
7797 | OPTI_TYPE_NOT_ITERATED
;
7804 case 1400: hash_type
= HASH_TYPE_SHA256
;
7805 salt_type
= SALT_TYPE_NONE
;
7806 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7807 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7808 | OPTS_TYPE_PT_ADD80
7809 | OPTS_TYPE_PT_ADDBITS15
;
7810 kern_type
= KERN_TYPE_SHA256
;
7811 dgst_size
= DGST_SIZE_4_8
;
7812 parse_func
= sha256_parse_hash
;
7813 sort_by_digest
= sort_by_digest_4_8
;
7814 opti_type
= OPTI_TYPE_ZERO_BYTE
7815 | OPTI_TYPE_PRECOMPUTE_INIT
7816 | OPTI_TYPE_PRECOMPUTE_MERKLE
7817 | OPTI_TYPE_EARLY_SKIP
7818 | OPTI_TYPE_NOT_ITERATED
7819 | OPTI_TYPE_NOT_SALTED
7820 | OPTI_TYPE_RAW_HASH
;
7827 case 1410: hash_type
= HASH_TYPE_SHA256
;
7828 salt_type
= SALT_TYPE_INTERN
;
7829 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7830 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7831 | OPTS_TYPE_ST_ADD80
7832 | OPTS_TYPE_ST_ADDBITS15
;
7833 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7834 dgst_size
= DGST_SIZE_4_8
;
7835 parse_func
= sha256s_parse_hash
;
7836 sort_by_digest
= sort_by_digest_4_8
;
7837 opti_type
= OPTI_TYPE_ZERO_BYTE
7838 | OPTI_TYPE_PRECOMPUTE_INIT
7839 | OPTI_TYPE_PRECOMPUTE_MERKLE
7840 | OPTI_TYPE_EARLY_SKIP
7841 | OPTI_TYPE_NOT_ITERATED
7842 | OPTI_TYPE_APPENDED_SALT
7843 | OPTI_TYPE_RAW_HASH
;
7850 case 1420: hash_type
= HASH_TYPE_SHA256
;
7851 salt_type
= SALT_TYPE_INTERN
;
7852 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7853 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7854 | OPTS_TYPE_PT_ADD80
7855 | OPTS_TYPE_PT_ADDBITS15
;
7856 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7857 dgst_size
= DGST_SIZE_4_8
;
7858 parse_func
= sha256s_parse_hash
;
7859 sort_by_digest
= sort_by_digest_4_8
;
7860 opti_type
= OPTI_TYPE_ZERO_BYTE
7861 | OPTI_TYPE_PRECOMPUTE_INIT
7862 | OPTI_TYPE_PRECOMPUTE_MERKLE
7863 | OPTI_TYPE_EARLY_SKIP
7864 | OPTI_TYPE_NOT_ITERATED
7865 | OPTI_TYPE_PREPENDED_SALT
7866 | OPTI_TYPE_RAW_HASH
;
7873 case 1421: hash_type
= HASH_TYPE_SHA256
;
7874 salt_type
= SALT_TYPE_EMBEDDED
;
7875 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7876 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7877 | OPTS_TYPE_PT_ADD80
7878 | OPTS_TYPE_PT_ADDBITS15
;
7879 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7880 dgst_size
= DGST_SIZE_4_8
;
7881 parse_func
= hmailserver_parse_hash
;
7882 sort_by_digest
= sort_by_digest_4_8
;
7883 opti_type
= OPTI_TYPE_ZERO_BYTE
7884 | OPTI_TYPE_PRECOMPUTE_INIT
7885 | OPTI_TYPE_PRECOMPUTE_MERKLE
7886 | OPTI_TYPE_EARLY_SKIP
7887 | OPTI_TYPE_NOT_ITERATED
7888 | OPTI_TYPE_PREPENDED_SALT
7889 | OPTI_TYPE_RAW_HASH
;
7896 case 1430: hash_type
= HASH_TYPE_SHA256
;
7897 salt_type
= SALT_TYPE_INTERN
;
7898 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7899 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7900 | OPTS_TYPE_PT_UNICODE
7901 | OPTS_TYPE_ST_ADD80
7902 | OPTS_TYPE_ST_ADDBITS15
;
7903 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7904 dgst_size
= DGST_SIZE_4_8
;
7905 parse_func
= sha256s_parse_hash
;
7906 sort_by_digest
= sort_by_digest_4_8
;
7907 opti_type
= OPTI_TYPE_ZERO_BYTE
7908 | OPTI_TYPE_PRECOMPUTE_INIT
7909 | OPTI_TYPE_PRECOMPUTE_MERKLE
7910 | OPTI_TYPE_EARLY_SKIP
7911 | OPTI_TYPE_NOT_ITERATED
7912 | OPTI_TYPE_APPENDED_SALT
7913 | OPTI_TYPE_RAW_HASH
;
7920 case 1440: hash_type
= HASH_TYPE_SHA256
;
7921 salt_type
= SALT_TYPE_INTERN
;
7922 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7923 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7924 | OPTS_TYPE_PT_ADD80
7925 | OPTS_TYPE_PT_ADDBITS15
7926 | OPTS_TYPE_PT_UNICODE
;
7927 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7928 dgst_size
= DGST_SIZE_4_8
;
7929 parse_func
= sha256s_parse_hash
;
7930 sort_by_digest
= sort_by_digest_4_8
;
7931 opti_type
= OPTI_TYPE_ZERO_BYTE
7932 | OPTI_TYPE_PRECOMPUTE_INIT
7933 | OPTI_TYPE_PRECOMPUTE_MERKLE
7934 | OPTI_TYPE_EARLY_SKIP
7935 | OPTI_TYPE_NOT_ITERATED
7936 | OPTI_TYPE_PREPENDED_SALT
7937 | OPTI_TYPE_RAW_HASH
;
7944 case 1441: hash_type
= HASH_TYPE_SHA256
;
7945 salt_type
= SALT_TYPE_EMBEDDED
;
7946 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7947 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7948 | OPTS_TYPE_PT_ADD80
7949 | OPTS_TYPE_PT_ADDBITS15
7950 | OPTS_TYPE_PT_UNICODE
7951 | OPTS_TYPE_ST_BASE64
;
7952 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7953 dgst_size
= DGST_SIZE_4_8
;
7954 parse_func
= episerver4_parse_hash
;
7955 sort_by_digest
= sort_by_digest_4_8
;
7956 opti_type
= OPTI_TYPE_ZERO_BYTE
7957 | OPTI_TYPE_PRECOMPUTE_INIT
7958 | OPTI_TYPE_PRECOMPUTE_MERKLE
7959 | OPTI_TYPE_EARLY_SKIP
7960 | OPTI_TYPE_NOT_ITERATED
7961 | OPTI_TYPE_PREPENDED_SALT
7962 | OPTI_TYPE_RAW_HASH
;
7969 case 1450: hash_type
= HASH_TYPE_SHA256
;
7970 salt_type
= SALT_TYPE_INTERN
;
7971 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7972 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7973 | OPTS_TYPE_ST_ADD80
;
7974 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7975 dgst_size
= DGST_SIZE_4_8
;
7976 parse_func
= hmacsha256_parse_hash
;
7977 sort_by_digest
= sort_by_digest_4_8
;
7978 opti_type
= OPTI_TYPE_ZERO_BYTE
7979 | OPTI_TYPE_NOT_ITERATED
;
7986 case 1460: hash_type
= HASH_TYPE_SHA256
;
7987 salt_type
= SALT_TYPE_INTERN
;
7988 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7989 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7990 | OPTS_TYPE_PT_ADD80
7991 | OPTS_TYPE_PT_ADDBITS15
;
7992 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7993 dgst_size
= DGST_SIZE_4_8
;
7994 parse_func
= hmacsha256_parse_hash
;
7995 sort_by_digest
= sort_by_digest_4_8
;
7996 opti_type
= OPTI_TYPE_ZERO_BYTE
7997 | OPTI_TYPE_NOT_ITERATED
;
8004 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8005 salt_type
= SALT_TYPE_EMBEDDED
;
8006 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8007 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8008 | OPTS_TYPE_PT_BITSLICE
;
8009 kern_type
= KERN_TYPE_DESCRYPT
;
8010 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8011 parse_func
= descrypt_parse_hash
;
8012 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8013 opti_type
= OPTI_TYPE_ZERO_BYTE
8014 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8021 case 1600: hash_type
= HASH_TYPE_MD5
;
8022 salt_type
= SALT_TYPE_EMBEDDED
;
8023 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8025 kern_type
= KERN_TYPE_APR1CRYPT
;
8026 dgst_size
= DGST_SIZE_4_4
;
8027 parse_func
= md5apr1_parse_hash
;
8028 sort_by_digest
= sort_by_digest_4_4
;
8029 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8036 case 1700: hash_type
= HASH_TYPE_SHA512
;
8037 salt_type
= SALT_TYPE_NONE
;
8038 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8039 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8040 | OPTS_TYPE_PT_ADD80
8041 | OPTS_TYPE_PT_ADDBITS15
;
8042 kern_type
= KERN_TYPE_SHA512
;
8043 dgst_size
= DGST_SIZE_8_8
;
8044 parse_func
= sha512_parse_hash
;
8045 sort_by_digest
= sort_by_digest_8_8
;
8046 opti_type
= OPTI_TYPE_ZERO_BYTE
8047 | OPTI_TYPE_PRECOMPUTE_INIT
8048 | OPTI_TYPE_PRECOMPUTE_MERKLE
8049 | OPTI_TYPE_EARLY_SKIP
8050 | OPTI_TYPE_NOT_ITERATED
8051 | OPTI_TYPE_NOT_SALTED
8052 | OPTI_TYPE_USES_BITS_64
8053 | OPTI_TYPE_RAW_HASH
;
8060 case 1710: hash_type
= HASH_TYPE_SHA512
;
8061 salt_type
= SALT_TYPE_INTERN
;
8062 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8063 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8064 | OPTS_TYPE_ST_ADD80
8065 | OPTS_TYPE_ST_ADDBITS15
;
8066 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8067 dgst_size
= DGST_SIZE_8_8
;
8068 parse_func
= sha512s_parse_hash
;
8069 sort_by_digest
= sort_by_digest_8_8
;
8070 opti_type
= OPTI_TYPE_ZERO_BYTE
8071 | OPTI_TYPE_PRECOMPUTE_INIT
8072 | OPTI_TYPE_PRECOMPUTE_MERKLE
8073 | OPTI_TYPE_EARLY_SKIP
8074 | OPTI_TYPE_NOT_ITERATED
8075 | OPTI_TYPE_APPENDED_SALT
8076 | OPTI_TYPE_USES_BITS_64
8077 | OPTI_TYPE_RAW_HASH
;
8084 case 1711: hash_type
= HASH_TYPE_SHA512
;
8085 salt_type
= SALT_TYPE_EMBEDDED
;
8086 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8087 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8088 | OPTS_TYPE_ST_ADD80
8089 | OPTS_TYPE_ST_ADDBITS15
;
8090 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8091 dgst_size
= DGST_SIZE_8_8
;
8092 parse_func
= sha512b64s_parse_hash
;
8093 sort_by_digest
= sort_by_digest_8_8
;
8094 opti_type
= OPTI_TYPE_ZERO_BYTE
8095 | OPTI_TYPE_PRECOMPUTE_INIT
8096 | OPTI_TYPE_PRECOMPUTE_MERKLE
8097 | OPTI_TYPE_EARLY_SKIP
8098 | OPTI_TYPE_NOT_ITERATED
8099 | OPTI_TYPE_APPENDED_SALT
8100 | OPTI_TYPE_USES_BITS_64
8101 | OPTI_TYPE_RAW_HASH
;
8108 case 1720: hash_type
= HASH_TYPE_SHA512
;
8109 salt_type
= SALT_TYPE_INTERN
;
8110 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8111 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8112 | OPTS_TYPE_PT_ADD80
8113 | OPTS_TYPE_PT_ADDBITS15
;
8114 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8115 dgst_size
= DGST_SIZE_8_8
;
8116 parse_func
= sha512s_parse_hash
;
8117 sort_by_digest
= sort_by_digest_8_8
;
8118 opti_type
= OPTI_TYPE_ZERO_BYTE
8119 | OPTI_TYPE_PRECOMPUTE_INIT
8120 | OPTI_TYPE_PRECOMPUTE_MERKLE
8121 | OPTI_TYPE_EARLY_SKIP
8122 | OPTI_TYPE_NOT_ITERATED
8123 | OPTI_TYPE_PREPENDED_SALT
8124 | OPTI_TYPE_USES_BITS_64
8125 | OPTI_TYPE_RAW_HASH
;
8132 case 1722: hash_type
= HASH_TYPE_SHA512
;
8133 salt_type
= SALT_TYPE_EMBEDDED
;
8134 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8135 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8136 | OPTS_TYPE_PT_ADD80
8137 | OPTS_TYPE_PT_ADDBITS15
8139 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8140 dgst_size
= DGST_SIZE_8_8
;
8141 parse_func
= osx512_parse_hash
;
8142 sort_by_digest
= sort_by_digest_8_8
;
8143 opti_type
= OPTI_TYPE_ZERO_BYTE
8144 | OPTI_TYPE_PRECOMPUTE_INIT
8145 | OPTI_TYPE_PRECOMPUTE_MERKLE
8146 | OPTI_TYPE_EARLY_SKIP
8147 | OPTI_TYPE_NOT_ITERATED
8148 | OPTI_TYPE_PREPENDED_SALT
8149 | OPTI_TYPE_USES_BITS_64
8150 | OPTI_TYPE_RAW_HASH
;
8157 case 1730: hash_type
= HASH_TYPE_SHA512
;
8158 salt_type
= SALT_TYPE_INTERN
;
8159 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8160 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8161 | OPTS_TYPE_PT_UNICODE
8162 | OPTS_TYPE_ST_ADD80
8163 | OPTS_TYPE_ST_ADDBITS15
;
8164 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8165 dgst_size
= DGST_SIZE_8_8
;
8166 parse_func
= sha512s_parse_hash
;
8167 sort_by_digest
= sort_by_digest_8_8
;
8168 opti_type
= OPTI_TYPE_ZERO_BYTE
8169 | OPTI_TYPE_PRECOMPUTE_INIT
8170 | OPTI_TYPE_PRECOMPUTE_MERKLE
8171 | OPTI_TYPE_EARLY_SKIP
8172 | OPTI_TYPE_NOT_ITERATED
8173 | OPTI_TYPE_APPENDED_SALT
8174 | OPTI_TYPE_USES_BITS_64
8175 | OPTI_TYPE_RAW_HASH
;
8182 case 1731: hash_type
= HASH_TYPE_SHA512
;
8183 salt_type
= SALT_TYPE_EMBEDDED
;
8184 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8185 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8186 | OPTS_TYPE_PT_UNICODE
8187 | OPTS_TYPE_ST_ADD80
8188 | OPTS_TYPE_ST_ADDBITS15
8190 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8191 dgst_size
= DGST_SIZE_8_8
;
8192 parse_func
= mssql2012_parse_hash
;
8193 sort_by_digest
= sort_by_digest_8_8
;
8194 opti_type
= OPTI_TYPE_ZERO_BYTE
8195 | OPTI_TYPE_PRECOMPUTE_INIT
8196 | OPTI_TYPE_PRECOMPUTE_MERKLE
8197 | OPTI_TYPE_EARLY_SKIP
8198 | OPTI_TYPE_NOT_ITERATED
8199 | OPTI_TYPE_APPENDED_SALT
8200 | OPTI_TYPE_USES_BITS_64
8201 | OPTI_TYPE_RAW_HASH
;
8208 case 1740: hash_type
= HASH_TYPE_SHA512
;
8209 salt_type
= SALT_TYPE_INTERN
;
8210 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8211 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8212 | OPTS_TYPE_PT_ADD80
8213 | OPTS_TYPE_PT_ADDBITS15
8214 | OPTS_TYPE_PT_UNICODE
;
8215 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8216 dgst_size
= DGST_SIZE_8_8
;
8217 parse_func
= sha512s_parse_hash
;
8218 sort_by_digest
= sort_by_digest_8_8
;
8219 opti_type
= OPTI_TYPE_ZERO_BYTE
8220 | OPTI_TYPE_PRECOMPUTE_INIT
8221 | OPTI_TYPE_PRECOMPUTE_MERKLE
8222 | OPTI_TYPE_EARLY_SKIP
8223 | OPTI_TYPE_NOT_ITERATED
8224 | OPTI_TYPE_PREPENDED_SALT
8225 | OPTI_TYPE_USES_BITS_64
8226 | OPTI_TYPE_RAW_HASH
;
8233 case 1750: hash_type
= HASH_TYPE_SHA512
;
8234 salt_type
= SALT_TYPE_INTERN
;
8235 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8236 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8237 | OPTS_TYPE_ST_ADD80
;
8238 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8239 dgst_size
= DGST_SIZE_8_8
;
8240 parse_func
= hmacsha512_parse_hash
;
8241 sort_by_digest
= sort_by_digest_8_8
;
8242 opti_type
= OPTI_TYPE_ZERO_BYTE
8243 | OPTI_TYPE_USES_BITS_64
8244 | OPTI_TYPE_NOT_ITERATED
;
8251 case 1760: hash_type
= HASH_TYPE_SHA512
;
8252 salt_type
= SALT_TYPE_INTERN
;
8253 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8254 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8255 | OPTS_TYPE_PT_ADD80
8256 | OPTS_TYPE_PT_ADDBITS15
;
8257 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8258 dgst_size
= DGST_SIZE_8_8
;
8259 parse_func
= hmacsha512_parse_hash
;
8260 sort_by_digest
= sort_by_digest_8_8
;
8261 opti_type
= OPTI_TYPE_ZERO_BYTE
8262 | OPTI_TYPE_USES_BITS_64
8263 | OPTI_TYPE_NOT_ITERATED
;
8270 case 1800: hash_type
= HASH_TYPE_SHA512
;
8271 salt_type
= SALT_TYPE_EMBEDDED
;
8272 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8273 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8274 kern_type
= KERN_TYPE_SHA512CRYPT
;
8275 dgst_size
= DGST_SIZE_8_8
;
8276 parse_func
= sha512crypt_parse_hash
;
8277 sort_by_digest
= sort_by_digest_8_8
;
8278 opti_type
= OPTI_TYPE_ZERO_BYTE
8279 | OPTI_TYPE_USES_BITS_64
;
8286 case 2100: hash_type
= HASH_TYPE_DCC2
;
8287 salt_type
= SALT_TYPE_EMBEDDED
;
8288 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8289 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8290 | OPTS_TYPE_ST_LOWER
8291 | OPTS_TYPE_ST_UNICODE
;
8292 kern_type
= KERN_TYPE_DCC2
;
8293 dgst_size
= DGST_SIZE_4_4
;
8294 parse_func
= dcc2_parse_hash
;
8295 sort_by_digest
= sort_by_digest_4_4
;
8296 opti_type
= OPTI_TYPE_ZERO_BYTE
8297 | OPTI_TYPE_SLOW_HASH_SIMD
;
8304 case 2400: hash_type
= HASH_TYPE_MD5
;
8305 salt_type
= SALT_TYPE_NONE
;
8306 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8307 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8308 kern_type
= KERN_TYPE_MD5PIX
;
8309 dgst_size
= DGST_SIZE_4_4
;
8310 parse_func
= md5pix_parse_hash
;
8311 sort_by_digest
= sort_by_digest_4_4
;
8312 opti_type
= OPTI_TYPE_ZERO_BYTE
8313 | OPTI_TYPE_PRECOMPUTE_INIT
8314 | OPTI_TYPE_PRECOMPUTE_MERKLE
8315 | OPTI_TYPE_EARLY_SKIP
8316 | OPTI_TYPE_NOT_ITERATED
8317 | OPTI_TYPE_NOT_SALTED
;
8324 case 2410: hash_type
= HASH_TYPE_MD5
;
8325 salt_type
= SALT_TYPE_INTERN
;
8326 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8327 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8328 kern_type
= KERN_TYPE_MD5ASA
;
8329 dgst_size
= DGST_SIZE_4_4
;
8330 parse_func
= md5asa_parse_hash
;
8331 sort_by_digest
= sort_by_digest_4_4
;
8332 opti_type
= OPTI_TYPE_ZERO_BYTE
8333 | OPTI_TYPE_PRECOMPUTE_INIT
8334 | OPTI_TYPE_PRECOMPUTE_MERKLE
8335 | OPTI_TYPE_EARLY_SKIP
8336 | OPTI_TYPE_NOT_ITERATED
;
8343 case 2500: hash_type
= HASH_TYPE_WPA
;
8344 salt_type
= SALT_TYPE_EMBEDDED
;
8345 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8346 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8347 kern_type
= KERN_TYPE_WPA
;
8348 dgst_size
= DGST_SIZE_4_4
;
8349 parse_func
= wpa_parse_hash
;
8350 sort_by_digest
= sort_by_digest_4_4
;
8351 opti_type
= OPTI_TYPE_ZERO_BYTE
8352 | OPTI_TYPE_SLOW_HASH_SIMD
;
8359 case 2600: hash_type
= HASH_TYPE_MD5
;
8360 salt_type
= SALT_TYPE_VIRTUAL
;
8361 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8363 | OPTS_TYPE_PT_ADD80
8364 | OPTS_TYPE_PT_ADDBITS14
8365 | OPTS_TYPE_ST_ADD80
;
8366 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8367 dgst_size
= DGST_SIZE_4_4
;
8368 parse_func
= md5md5_parse_hash
;
8369 sort_by_digest
= sort_by_digest_4_4
;
8370 opti_type
= OPTI_TYPE_ZERO_BYTE
8371 | OPTI_TYPE_PRECOMPUTE_INIT
8372 | OPTI_TYPE_PRECOMPUTE_MERKLE
8373 | OPTI_TYPE_EARLY_SKIP
;
8380 case 2611: hash_type
= HASH_TYPE_MD5
;
8381 salt_type
= SALT_TYPE_INTERN
;
8382 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8383 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8384 | OPTS_TYPE_PT_ADD80
8385 | OPTS_TYPE_PT_ADDBITS14
8386 | OPTS_TYPE_ST_ADD80
;
8387 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8388 dgst_size
= DGST_SIZE_4_4
;
8389 parse_func
= vb3_parse_hash
;
8390 sort_by_digest
= sort_by_digest_4_4
;
8391 opti_type
= OPTI_TYPE_ZERO_BYTE
8392 | OPTI_TYPE_PRECOMPUTE_INIT
8393 | OPTI_TYPE_PRECOMPUTE_MERKLE
8394 | OPTI_TYPE_EARLY_SKIP
;
8401 case 2612: hash_type
= HASH_TYPE_MD5
;
8402 salt_type
= SALT_TYPE_EMBEDDED
;
8403 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8404 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8405 | OPTS_TYPE_PT_ADD80
8406 | OPTS_TYPE_PT_ADDBITS14
8407 | OPTS_TYPE_ST_ADD80
8409 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8410 dgst_size
= DGST_SIZE_4_4
;
8411 parse_func
= phps_parse_hash
;
8412 sort_by_digest
= sort_by_digest_4_4
;
8413 opti_type
= OPTI_TYPE_ZERO_BYTE
8414 | OPTI_TYPE_PRECOMPUTE_INIT
8415 | OPTI_TYPE_PRECOMPUTE_MERKLE
8416 | OPTI_TYPE_EARLY_SKIP
;
8423 case 2711: hash_type
= HASH_TYPE_MD5
;
8424 salt_type
= SALT_TYPE_INTERN
;
8425 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8426 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8427 | OPTS_TYPE_PT_ADD80
8428 | OPTS_TYPE_PT_ADDBITS14
8429 | OPTS_TYPE_ST_ADD80
;
8430 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8431 dgst_size
= DGST_SIZE_4_4
;
8432 parse_func
= vb30_parse_hash
;
8433 sort_by_digest
= sort_by_digest_4_4
;
8434 opti_type
= OPTI_TYPE_ZERO_BYTE
8435 | OPTI_TYPE_PRECOMPUTE_INIT
8436 | OPTI_TYPE_EARLY_SKIP
;
8443 case 2811: hash_type
= HASH_TYPE_MD5
;
8444 salt_type
= SALT_TYPE_INTERN
;
8445 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8446 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8447 | OPTS_TYPE_PT_ADD80
8448 | OPTS_TYPE_PT_ADDBITS14
;
8449 kern_type
= KERN_TYPE_MD55_SLTPW
;
8450 dgst_size
= DGST_SIZE_4_4
;
8451 parse_func
= ipb2_parse_hash
;
8452 sort_by_digest
= sort_by_digest_4_4
;
8453 opti_type
= OPTI_TYPE_ZERO_BYTE
8454 | OPTI_TYPE_PRECOMPUTE_INIT
8455 | OPTI_TYPE_EARLY_SKIP
;
8462 case 3000: hash_type
= HASH_TYPE_LM
;
8463 salt_type
= SALT_TYPE_NONE
;
8464 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8465 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8466 | OPTS_TYPE_PT_UPPER
8467 | OPTS_TYPE_PT_BITSLICE
;
8468 kern_type
= KERN_TYPE_LM
;
8469 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8470 parse_func
= lm_parse_hash
;
8471 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8472 opti_type
= OPTI_TYPE_ZERO_BYTE
8473 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8480 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8481 salt_type
= SALT_TYPE_INTERN
;
8482 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8483 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8484 | OPTS_TYPE_PT_UPPER
8485 | OPTS_TYPE_ST_UPPER
;
8486 kern_type
= KERN_TYPE_ORACLEH
;
8487 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8488 parse_func
= oracleh_parse_hash
;
8489 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8490 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8497 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8498 salt_type
= SALT_TYPE_EMBEDDED
;
8499 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8501 | OPTS_TYPE_ST_GENERATE_LE
;
8502 kern_type
= KERN_TYPE_BCRYPT
;
8503 dgst_size
= DGST_SIZE_4_6
;
8504 parse_func
= bcrypt_parse_hash
;
8505 sort_by_digest
= sort_by_digest_4_6
;
8506 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8513 case 3710: hash_type
= HASH_TYPE_MD5
;
8514 salt_type
= SALT_TYPE_INTERN
;
8515 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8516 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8517 | OPTS_TYPE_PT_ADD80
8518 | OPTS_TYPE_PT_ADDBITS14
;
8519 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8520 dgst_size
= DGST_SIZE_4_4
;
8521 parse_func
= md5s_parse_hash
;
8522 sort_by_digest
= sort_by_digest_4_4
;
8523 opti_type
= OPTI_TYPE_ZERO_BYTE
8524 | OPTI_TYPE_PRECOMPUTE_INIT
8525 | OPTI_TYPE_PRECOMPUTE_MERKLE
8526 | OPTI_TYPE_EARLY_SKIP
;
8533 case 3711: hash_type
= HASH_TYPE_MD5
;
8534 salt_type
= SALT_TYPE_EMBEDDED
;
8535 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8537 | OPTS_TYPE_PT_ADD80
8538 | OPTS_TYPE_PT_ADDBITS14
;
8539 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8540 dgst_size
= DGST_SIZE_4_4
;
8541 parse_func
= mediawiki_b_parse_hash
;
8542 sort_by_digest
= sort_by_digest_4_4
;
8543 opti_type
= OPTI_TYPE_ZERO_BYTE
8544 | OPTI_TYPE_PRECOMPUTE_INIT
8545 | OPTI_TYPE_PRECOMPUTE_MERKLE
8546 | OPTI_TYPE_EARLY_SKIP
;
8553 case 3800: hash_type
= HASH_TYPE_MD5
;
8554 salt_type
= SALT_TYPE_INTERN
;
8555 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8556 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8557 | OPTS_TYPE_ST_ADDBITS14
;
8558 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8559 dgst_size
= DGST_SIZE_4_4
;
8560 parse_func
= md5s_parse_hash
;
8561 sort_by_digest
= sort_by_digest_4_4
;
8562 opti_type
= OPTI_TYPE_ZERO_BYTE
8563 | OPTI_TYPE_PRECOMPUTE_INIT
8564 | OPTI_TYPE_PRECOMPUTE_MERKLE
8565 | OPTI_TYPE_EARLY_SKIP
8566 | OPTI_TYPE_NOT_ITERATED
8567 | OPTI_TYPE_RAW_HASH
;
8574 case 4300: hash_type
= HASH_TYPE_MD5
;
8575 salt_type
= SALT_TYPE_VIRTUAL
;
8576 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8577 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8578 | OPTS_TYPE_PT_ADD80
8579 | OPTS_TYPE_PT_ADDBITS14
8580 | OPTS_TYPE_ST_ADD80
;
8581 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8582 dgst_size
= DGST_SIZE_4_4
;
8583 parse_func
= md5md5_parse_hash
;
8584 sort_by_digest
= sort_by_digest_4_4
;
8585 opti_type
= OPTI_TYPE_ZERO_BYTE
8586 | OPTI_TYPE_PRECOMPUTE_INIT
8587 | OPTI_TYPE_PRECOMPUTE_MERKLE
8588 | OPTI_TYPE_EARLY_SKIP
;
8596 case 4400: hash_type
= HASH_TYPE_MD5
;
8597 salt_type
= SALT_TYPE_NONE
;
8598 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8599 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8600 | OPTS_TYPE_PT_ADD80
8601 | OPTS_TYPE_PT_ADDBITS15
;
8602 kern_type
= KERN_TYPE_MD5_SHA1
;
8603 dgst_size
= DGST_SIZE_4_4
;
8604 parse_func
= md5_parse_hash
;
8605 sort_by_digest
= sort_by_digest_4_4
;
8606 opti_type
= OPTI_TYPE_ZERO_BYTE
8607 | OPTI_TYPE_PRECOMPUTE_INIT
8608 | OPTI_TYPE_PRECOMPUTE_MERKLE
8609 | OPTI_TYPE_EARLY_SKIP
8610 | OPTI_TYPE_NOT_ITERATED
8611 | OPTI_TYPE_NOT_SALTED
8612 | OPTI_TYPE_RAW_HASH
;
8619 case 4500: hash_type
= HASH_TYPE_SHA1
;
8620 salt_type
= SALT_TYPE_NONE
;
8621 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8622 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8623 | OPTS_TYPE_PT_ADD80
8624 | OPTS_TYPE_PT_ADDBITS15
;
8625 kern_type
= KERN_TYPE_SHA11
;
8626 dgst_size
= DGST_SIZE_4_5
;
8627 parse_func
= sha1_parse_hash
;
8628 sort_by_digest
= sort_by_digest_4_5
;
8629 opti_type
= OPTI_TYPE_ZERO_BYTE
8630 | OPTI_TYPE_PRECOMPUTE_INIT
8631 | OPTI_TYPE_PRECOMPUTE_MERKLE
8632 | OPTI_TYPE_EARLY_SKIP
8633 | OPTI_TYPE_NOT_SALTED
;
8640 case 4700: hash_type
= HASH_TYPE_SHA1
;
8641 salt_type
= SALT_TYPE_NONE
;
8642 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8643 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8644 | OPTS_TYPE_PT_ADD80
8645 | OPTS_TYPE_PT_ADDBITS14
;
8646 kern_type
= KERN_TYPE_SHA1_MD5
;
8647 dgst_size
= DGST_SIZE_4_5
;
8648 parse_func
= sha1_parse_hash
;
8649 sort_by_digest
= sort_by_digest_4_5
;
8650 opti_type
= OPTI_TYPE_ZERO_BYTE
8651 | OPTI_TYPE_PRECOMPUTE_INIT
8652 | OPTI_TYPE_PRECOMPUTE_MERKLE
8653 | OPTI_TYPE_EARLY_SKIP
8654 | OPTI_TYPE_NOT_ITERATED
8655 | OPTI_TYPE_NOT_SALTED
8656 | OPTI_TYPE_RAW_HASH
;
8663 case 4800: hash_type
= HASH_TYPE_MD5
;
8664 salt_type
= SALT_TYPE_EMBEDDED
;
8665 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8666 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8667 | OPTS_TYPE_PT_ADDBITS14
;
8668 kern_type
= KERN_TYPE_MD5_CHAP
;
8669 dgst_size
= DGST_SIZE_4_4
;
8670 parse_func
= chap_parse_hash
;
8671 sort_by_digest
= sort_by_digest_4_4
;
8672 opti_type
= OPTI_TYPE_ZERO_BYTE
8673 | OPTI_TYPE_PRECOMPUTE_INIT
8674 | OPTI_TYPE_PRECOMPUTE_MERKLE
8675 | OPTI_TYPE_MEET_IN_MIDDLE
8676 | OPTI_TYPE_EARLY_SKIP
8677 | OPTI_TYPE_NOT_ITERATED
8678 | OPTI_TYPE_RAW_HASH
;
8685 case 4900: hash_type
= HASH_TYPE_SHA1
;
8686 salt_type
= SALT_TYPE_INTERN
;
8687 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8688 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8689 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8690 dgst_size
= DGST_SIZE_4_5
;
8691 parse_func
= sha1s_parse_hash
;
8692 sort_by_digest
= sort_by_digest_4_5
;
8693 opti_type
= OPTI_TYPE_ZERO_BYTE
8694 | OPTI_TYPE_PRECOMPUTE_INIT
8695 | OPTI_TYPE_PRECOMPUTE_MERKLE
8696 | OPTI_TYPE_EARLY_SKIP
;
8703 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8704 salt_type
= SALT_TYPE_EMBEDDED
;
8705 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8706 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8707 | OPTS_TYPE_PT_ADD01
;
8708 kern_type
= KERN_TYPE_KECCAK
;
8709 dgst_size
= DGST_SIZE_8_25
;
8710 parse_func
= keccak_parse_hash
;
8711 sort_by_digest
= sort_by_digest_8_25
;
8712 opti_type
= OPTI_TYPE_ZERO_BYTE
8713 | OPTI_TYPE_USES_BITS_64
8714 | OPTI_TYPE_RAW_HASH
;
8721 case 5100: hash_type
= HASH_TYPE_MD5H
;
8722 salt_type
= SALT_TYPE_NONE
;
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 kern_type
= KERN_TYPE_MD5H
;
8728 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8729 parse_func
= md5half_parse_hash
;
8730 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8731 opti_type
= OPTI_TYPE_ZERO_BYTE
8732 | OPTI_TYPE_RAW_HASH
;
8739 case 5200: hash_type
= HASH_TYPE_SHA256
;
8740 salt_type
= SALT_TYPE_EMBEDDED
;
8741 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8742 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8743 kern_type
= KERN_TYPE_PSAFE3
;
8744 dgst_size
= DGST_SIZE_4_8
;
8745 parse_func
= psafe3_parse_hash
;
8746 sort_by_digest
= sort_by_digest_4_8
;
8747 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8754 case 5300: hash_type
= HASH_TYPE_MD5
;
8755 salt_type
= SALT_TYPE_EMBEDDED
;
8756 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8758 | OPTS_TYPE_ST_ADD80
;
8759 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8760 dgst_size
= DGST_SIZE_4_4
;
8761 parse_func
= ikepsk_md5_parse_hash
;
8762 sort_by_digest
= sort_by_digest_4_4
;
8763 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8770 case 5400: hash_type
= HASH_TYPE_SHA1
;
8771 salt_type
= SALT_TYPE_EMBEDDED
;
8772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8773 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8774 | OPTS_TYPE_ST_ADD80
;
8775 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8776 dgst_size
= DGST_SIZE_4_5
;
8777 parse_func
= ikepsk_sha1_parse_hash
;
8778 sort_by_digest
= sort_by_digest_4_5
;
8779 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8786 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8787 salt_type
= SALT_TYPE_EMBEDDED
;
8788 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8789 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8790 | OPTS_TYPE_PT_ADD80
8791 | OPTS_TYPE_PT_ADDBITS14
8792 | OPTS_TYPE_PT_UNICODE
8794 kern_type
= KERN_TYPE_NETNTLMv1
;
8795 dgst_size
= DGST_SIZE_4_4
;
8796 parse_func
= netntlmv1_parse_hash
;
8797 sort_by_digest
= sort_by_digest_4_4
;
8798 opti_type
= OPTI_TYPE_ZERO_BYTE
8799 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8806 case 5600: hash_type
= HASH_TYPE_MD5
;
8807 salt_type
= SALT_TYPE_EMBEDDED
;
8808 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8810 | OPTS_TYPE_PT_ADD80
8811 | OPTS_TYPE_PT_ADDBITS14
8812 | OPTS_TYPE_PT_UNICODE
;
8813 kern_type
= KERN_TYPE_NETNTLMv2
;
8814 dgst_size
= DGST_SIZE_4_4
;
8815 parse_func
= netntlmv2_parse_hash
;
8816 sort_by_digest
= sort_by_digest_4_4
;
8817 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8824 case 5700: hash_type
= HASH_TYPE_SHA256
;
8825 salt_type
= SALT_TYPE_NONE
;
8826 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8827 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8828 | OPTS_TYPE_PT_ADD80
8829 | OPTS_TYPE_PT_ADDBITS15
;
8830 kern_type
= KERN_TYPE_SHA256
;
8831 dgst_size
= DGST_SIZE_4_8
;
8832 parse_func
= cisco4_parse_hash
;
8833 sort_by_digest
= sort_by_digest_4_8
;
8834 opti_type
= OPTI_TYPE_ZERO_BYTE
8835 | OPTI_TYPE_PRECOMPUTE_INIT
8836 | OPTI_TYPE_PRECOMPUTE_MERKLE
8837 | OPTI_TYPE_EARLY_SKIP
8838 | OPTI_TYPE_NOT_ITERATED
8839 | OPTI_TYPE_NOT_SALTED
8840 | OPTI_TYPE_RAW_HASH
;
8847 case 5800: hash_type
= HASH_TYPE_SHA1
;
8848 salt_type
= SALT_TYPE_INTERN
;
8849 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8850 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8851 | OPTS_TYPE_ST_ADD80
;
8852 kern_type
= KERN_TYPE_ANDROIDPIN
;
8853 dgst_size
= DGST_SIZE_4_5
;
8854 parse_func
= androidpin_parse_hash
;
8855 sort_by_digest
= sort_by_digest_4_5
;
8856 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8863 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8864 salt_type
= SALT_TYPE_NONE
;
8865 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8867 | OPTS_TYPE_PT_ADD80
;
8868 kern_type
= KERN_TYPE_RIPEMD160
;
8869 dgst_size
= DGST_SIZE_4_5
;
8870 parse_func
= ripemd160_parse_hash
;
8871 sort_by_digest
= sort_by_digest_4_5
;
8872 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8879 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8880 salt_type
= SALT_TYPE_NONE
;
8881 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8882 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8883 | OPTS_TYPE_PT_ADD80
;
8884 kern_type
= KERN_TYPE_WHIRLPOOL
;
8885 dgst_size
= DGST_SIZE_4_16
;
8886 parse_func
= whirlpool_parse_hash
;
8887 sort_by_digest
= sort_by_digest_4_16
;
8888 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8895 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8896 salt_type
= SALT_TYPE_EMBEDDED
;
8897 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8898 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8899 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8900 dgst_size
= DGST_SIZE_4_5
;
8901 parse_func
= truecrypt_parse_hash_2k
;
8902 sort_by_digest
= sort_by_digest_4_5
;
8903 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8910 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8911 salt_type
= SALT_TYPE_EMBEDDED
;
8912 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8913 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8914 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8915 dgst_size
= DGST_SIZE_4_5
;
8916 parse_func
= truecrypt_parse_hash_2k
;
8917 sort_by_digest
= sort_by_digest_4_5
;
8918 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8925 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8926 salt_type
= SALT_TYPE_EMBEDDED
;
8927 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8928 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8929 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8930 dgst_size
= DGST_SIZE_4_5
;
8931 parse_func
= truecrypt_parse_hash_2k
;
8932 sort_by_digest
= sort_by_digest_4_5
;
8933 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8940 case 6221: hash_type
= HASH_TYPE_SHA512
;
8941 salt_type
= SALT_TYPE_EMBEDDED
;
8942 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8943 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8944 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8945 dgst_size
= DGST_SIZE_8_8
;
8946 parse_func
= truecrypt_parse_hash_1k
;
8947 sort_by_digest
= sort_by_digest_8_8
;
8948 opti_type
= OPTI_TYPE_ZERO_BYTE
8949 | OPTI_TYPE_USES_BITS_64
;
8956 case 6222: hash_type
= HASH_TYPE_SHA512
;
8957 salt_type
= SALT_TYPE_EMBEDDED
;
8958 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8959 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8960 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8961 dgst_size
= DGST_SIZE_8_8
;
8962 parse_func
= truecrypt_parse_hash_1k
;
8963 sort_by_digest
= sort_by_digest_8_8
;
8964 opti_type
= OPTI_TYPE_ZERO_BYTE
8965 | OPTI_TYPE_USES_BITS_64
;
8972 case 6223: hash_type
= HASH_TYPE_SHA512
;
8973 salt_type
= SALT_TYPE_EMBEDDED
;
8974 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8975 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8976 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8977 dgst_size
= DGST_SIZE_8_8
;
8978 parse_func
= truecrypt_parse_hash_1k
;
8979 sort_by_digest
= sort_by_digest_8_8
;
8980 opti_type
= OPTI_TYPE_ZERO_BYTE
8981 | OPTI_TYPE_USES_BITS_64
;
8988 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8989 salt_type
= SALT_TYPE_EMBEDDED
;
8990 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8991 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8992 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8993 dgst_size
= DGST_SIZE_4_8
;
8994 parse_func
= truecrypt_parse_hash_1k
;
8995 sort_by_digest
= sort_by_digest_4_8
;
8996 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9003 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9004 salt_type
= SALT_TYPE_EMBEDDED
;
9005 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9006 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9007 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9008 dgst_size
= DGST_SIZE_4_8
;
9009 parse_func
= truecrypt_parse_hash_1k
;
9010 sort_by_digest
= sort_by_digest_4_8
;
9011 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9018 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9019 salt_type
= SALT_TYPE_EMBEDDED
;
9020 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9021 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9022 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9023 dgst_size
= DGST_SIZE_4_8
;
9024 parse_func
= truecrypt_parse_hash_1k
;
9025 sort_by_digest
= sort_by_digest_4_8
;
9026 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9033 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9034 salt_type
= SALT_TYPE_EMBEDDED
;
9035 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9036 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9037 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9038 dgst_size
= DGST_SIZE_4_5
;
9039 parse_func
= truecrypt_parse_hash_1k
;
9040 sort_by_digest
= sort_by_digest_4_5
;
9041 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9048 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9049 salt_type
= SALT_TYPE_EMBEDDED
;
9050 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9051 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9052 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9053 dgst_size
= DGST_SIZE_4_5
;
9054 parse_func
= truecrypt_parse_hash_1k
;
9055 sort_by_digest
= sort_by_digest_4_5
;
9056 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9063 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9064 salt_type
= SALT_TYPE_EMBEDDED
;
9065 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9066 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9067 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9068 dgst_size
= DGST_SIZE_4_5
;
9069 parse_func
= truecrypt_parse_hash_1k
;
9070 sort_by_digest
= sort_by_digest_4_5
;
9071 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9078 case 6300: hash_type
= HASH_TYPE_MD5
;
9079 salt_type
= SALT_TYPE_EMBEDDED
;
9080 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9081 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9082 kern_type
= KERN_TYPE_MD5AIX
;
9083 dgst_size
= DGST_SIZE_4_4
;
9084 parse_func
= md5aix_parse_hash
;
9085 sort_by_digest
= sort_by_digest_4_4
;
9086 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9093 case 6400: hash_type
= HASH_TYPE_SHA256
;
9094 salt_type
= SALT_TYPE_EMBEDDED
;
9095 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9096 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9097 kern_type
= KERN_TYPE_SHA256AIX
;
9098 dgst_size
= DGST_SIZE_4_8
;
9099 parse_func
= sha256aix_parse_hash
;
9100 sort_by_digest
= sort_by_digest_4_8
;
9101 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9108 case 6500: hash_type
= HASH_TYPE_SHA512
;
9109 salt_type
= SALT_TYPE_EMBEDDED
;
9110 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9111 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9112 kern_type
= KERN_TYPE_SHA512AIX
;
9113 dgst_size
= DGST_SIZE_8_8
;
9114 parse_func
= sha512aix_parse_hash
;
9115 sort_by_digest
= sort_by_digest_8_8
;
9116 opti_type
= OPTI_TYPE_ZERO_BYTE
9117 | OPTI_TYPE_USES_BITS_64
;
9124 case 6600: hash_type
= HASH_TYPE_AES
;
9125 salt_type
= SALT_TYPE_EMBEDDED
;
9126 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9127 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9128 kern_type
= KERN_TYPE_AGILEKEY
;
9129 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9130 parse_func
= agilekey_parse_hash
;
9131 sort_by_digest
= sort_by_digest_4_5
;
9132 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9139 case 6700: hash_type
= HASH_TYPE_SHA1
;
9140 salt_type
= SALT_TYPE_EMBEDDED
;
9141 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9142 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9143 kern_type
= KERN_TYPE_SHA1AIX
;
9144 dgst_size
= DGST_SIZE_4_5
;
9145 parse_func
= sha1aix_parse_hash
;
9146 sort_by_digest
= sort_by_digest_4_5
;
9147 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9154 case 6800: hash_type
= HASH_TYPE_AES
;
9155 salt_type
= SALT_TYPE_EMBEDDED
;
9156 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9157 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9158 kern_type
= KERN_TYPE_LASTPASS
;
9159 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9160 parse_func
= lastpass_parse_hash
;
9161 sort_by_digest
= sort_by_digest_4_8
;
9162 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9169 case 6900: hash_type
= HASH_TYPE_GOST
;
9170 salt_type
= SALT_TYPE_NONE
;
9171 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9172 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9173 kern_type
= KERN_TYPE_GOST
;
9174 dgst_size
= DGST_SIZE_4_8
;
9175 parse_func
= gost_parse_hash
;
9176 sort_by_digest
= sort_by_digest_4_8
;
9177 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9184 case 7100: hash_type
= HASH_TYPE_SHA512
;
9185 salt_type
= SALT_TYPE_EMBEDDED
;
9186 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9187 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9188 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9189 dgst_size
= DGST_SIZE_8_16
;
9190 parse_func
= sha512osx_parse_hash
;
9191 sort_by_digest
= sort_by_digest_8_16
;
9192 opti_type
= OPTI_TYPE_ZERO_BYTE
9193 | OPTI_TYPE_USES_BITS_64
9194 | OPTI_TYPE_SLOW_HASH_SIMD
;
9201 case 7200: hash_type
= HASH_TYPE_SHA512
;
9202 salt_type
= SALT_TYPE_EMBEDDED
;
9203 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9204 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9205 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9206 dgst_size
= DGST_SIZE_8_16
;
9207 parse_func
= sha512grub_parse_hash
;
9208 sort_by_digest
= sort_by_digest_8_16
;
9209 opti_type
= OPTI_TYPE_ZERO_BYTE
9210 | OPTI_TYPE_USES_BITS_64
9211 | OPTI_TYPE_SLOW_HASH_SIMD
;
9218 case 7300: hash_type
= HASH_TYPE_SHA1
;
9219 salt_type
= SALT_TYPE_EMBEDDED
;
9220 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9221 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9222 | OPTS_TYPE_ST_ADD80
9223 | OPTS_TYPE_ST_ADDBITS15
;
9224 kern_type
= KERN_TYPE_RAKP
;
9225 dgst_size
= DGST_SIZE_4_5
;
9226 parse_func
= rakp_parse_hash
;
9227 sort_by_digest
= sort_by_digest_4_5
;
9228 opti_type
= OPTI_TYPE_ZERO_BYTE
9229 | OPTI_TYPE_NOT_ITERATED
;
9236 case 7400: hash_type
= HASH_TYPE_SHA256
;
9237 salt_type
= SALT_TYPE_EMBEDDED
;
9238 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9239 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9240 kern_type
= KERN_TYPE_SHA256CRYPT
;
9241 dgst_size
= DGST_SIZE_4_8
;
9242 parse_func
= sha256crypt_parse_hash
;
9243 sort_by_digest
= sort_by_digest_4_8
;
9244 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9251 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9252 salt_type
= SALT_TYPE_EMBEDDED
;
9253 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9254 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9255 kern_type
= KERN_TYPE_KRB5PA
;
9256 dgst_size
= DGST_SIZE_4_4
;
9257 parse_func
= krb5pa_parse_hash
;
9258 sort_by_digest
= sort_by_digest_4_4
;
9259 opti_type
= OPTI_TYPE_ZERO_BYTE
9260 | OPTI_TYPE_NOT_ITERATED
;
9267 case 7600: hash_type
= HASH_TYPE_SHA1
;
9268 salt_type
= SALT_TYPE_INTERN
;
9269 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9270 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9271 | OPTS_TYPE_PT_ADD80
9272 | OPTS_TYPE_PT_ADDBITS15
;
9273 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9274 dgst_size
= DGST_SIZE_4_5
;
9275 parse_func
= redmine_parse_hash
;
9276 sort_by_digest
= sort_by_digest_4_5
;
9277 opti_type
= OPTI_TYPE_ZERO_BYTE
9278 | OPTI_TYPE_PRECOMPUTE_INIT
9279 | OPTI_TYPE_EARLY_SKIP
9280 | OPTI_TYPE_NOT_ITERATED
9281 | OPTI_TYPE_PREPENDED_SALT
;
9288 case 7700: hash_type
= HASH_TYPE_SAPB
;
9289 salt_type
= SALT_TYPE_EMBEDDED
;
9290 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9291 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9292 | OPTS_TYPE_PT_UPPER
9293 | OPTS_TYPE_ST_UPPER
;
9294 kern_type
= KERN_TYPE_SAPB
;
9295 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9296 parse_func
= sapb_parse_hash
;
9297 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9298 opti_type
= OPTI_TYPE_ZERO_BYTE
9299 | OPTI_TYPE_PRECOMPUTE_INIT
9300 | OPTI_TYPE_NOT_ITERATED
;
9307 case 7800: hash_type
= HASH_TYPE_SAPG
;
9308 salt_type
= SALT_TYPE_EMBEDDED
;
9309 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9310 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9311 | OPTS_TYPE_ST_ADD80
9312 | OPTS_TYPE_ST_UPPER
;
9313 kern_type
= KERN_TYPE_SAPG
;
9314 dgst_size
= DGST_SIZE_4_5
;
9315 parse_func
= sapg_parse_hash
;
9316 sort_by_digest
= sort_by_digest_4_5
;
9317 opti_type
= OPTI_TYPE_ZERO_BYTE
9318 | OPTI_TYPE_PRECOMPUTE_INIT
9319 | OPTI_TYPE_NOT_ITERATED
;
9326 case 7900: hash_type
= HASH_TYPE_SHA512
;
9327 salt_type
= SALT_TYPE_EMBEDDED
;
9328 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9329 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9330 kern_type
= KERN_TYPE_DRUPAL7
;
9331 dgst_size
= DGST_SIZE_8_8
;
9332 parse_func
= drupal7_parse_hash
;
9333 sort_by_digest
= sort_by_digest_8_8
;
9334 opti_type
= OPTI_TYPE_ZERO_BYTE
9335 | OPTI_TYPE_USES_BITS_64
;
9342 case 8000: hash_type
= HASH_TYPE_SHA256
;
9343 salt_type
= SALT_TYPE_EMBEDDED
;
9344 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9345 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9346 | OPTS_TYPE_PT_UNICODE
9347 | OPTS_TYPE_ST_ADD80
9349 kern_type
= KERN_TYPE_SYBASEASE
;
9350 dgst_size
= DGST_SIZE_4_8
;
9351 parse_func
= sybasease_parse_hash
;
9352 sort_by_digest
= sort_by_digest_4_8
;
9353 opti_type
= OPTI_TYPE_ZERO_BYTE
9354 | OPTI_TYPE_PRECOMPUTE_INIT
9355 | OPTI_TYPE_EARLY_SKIP
9356 | OPTI_TYPE_NOT_ITERATED
9357 | OPTI_TYPE_RAW_HASH
;
9364 case 8100: hash_type
= HASH_TYPE_SHA1
;
9365 salt_type
= SALT_TYPE_EMBEDDED
;
9366 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9367 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9368 kern_type
= KERN_TYPE_NETSCALER
;
9369 dgst_size
= DGST_SIZE_4_5
;
9370 parse_func
= netscaler_parse_hash
;
9371 sort_by_digest
= sort_by_digest_4_5
;
9372 opti_type
= OPTI_TYPE_ZERO_BYTE
9373 | OPTI_TYPE_PRECOMPUTE_INIT
9374 | OPTI_TYPE_PRECOMPUTE_MERKLE
9375 | OPTI_TYPE_EARLY_SKIP
9376 | OPTI_TYPE_NOT_ITERATED
9377 | OPTI_TYPE_PREPENDED_SALT
9378 | OPTI_TYPE_RAW_HASH
;
9385 case 8200: hash_type
= HASH_TYPE_SHA256
;
9386 salt_type
= SALT_TYPE_EMBEDDED
;
9387 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9388 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9389 kern_type
= KERN_TYPE_CLOUDKEY
;
9390 dgst_size
= DGST_SIZE_4_8
;
9391 parse_func
= cloudkey_parse_hash
;
9392 sort_by_digest
= sort_by_digest_4_8
;
9393 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9400 case 8300: hash_type
= HASH_TYPE_SHA1
;
9401 salt_type
= SALT_TYPE_EMBEDDED
;
9402 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9403 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9405 | OPTS_TYPE_ST_ADD80
;
9406 kern_type
= KERN_TYPE_NSEC3
;
9407 dgst_size
= DGST_SIZE_4_5
;
9408 parse_func
= nsec3_parse_hash
;
9409 sort_by_digest
= sort_by_digest_4_5
;
9410 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9417 case 8400: hash_type
= HASH_TYPE_SHA1
;
9418 salt_type
= SALT_TYPE_INTERN
;
9419 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9420 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9421 | OPTS_TYPE_PT_ADD80
9422 | OPTS_TYPE_PT_ADDBITS15
;
9423 kern_type
= KERN_TYPE_WBB3
;
9424 dgst_size
= DGST_SIZE_4_5
;
9425 parse_func
= wbb3_parse_hash
;
9426 sort_by_digest
= sort_by_digest_4_5
;
9427 opti_type
= OPTI_TYPE_ZERO_BYTE
9428 | OPTI_TYPE_PRECOMPUTE_INIT
9429 | OPTI_TYPE_NOT_ITERATED
;
9436 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9437 salt_type
= SALT_TYPE_EMBEDDED
;
9438 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9440 | OPTS_TYPE_ST_UPPER
;
9441 kern_type
= KERN_TYPE_RACF
;
9442 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9443 parse_func
= racf_parse_hash
;
9444 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9445 opti_type
= OPTI_TYPE_ZERO_BYTE
9446 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9453 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9454 salt_type
= SALT_TYPE_NONE
;
9455 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9456 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9457 kern_type
= KERN_TYPE_LOTUS5
;
9458 dgst_size
= DGST_SIZE_4_4
;
9459 parse_func
= lotus5_parse_hash
;
9460 sort_by_digest
= sort_by_digest_4_4
;
9461 opti_type
= OPTI_TYPE_EARLY_SKIP
9462 | OPTI_TYPE_NOT_ITERATED
9463 | OPTI_TYPE_NOT_SALTED
9464 | OPTI_TYPE_RAW_HASH
;
9471 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9472 salt_type
= SALT_TYPE_EMBEDDED
;
9473 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9474 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9475 kern_type
= KERN_TYPE_LOTUS6
;
9476 dgst_size
= DGST_SIZE_4_4
;
9477 parse_func
= lotus6_parse_hash
;
9478 sort_by_digest
= sort_by_digest_4_4
;
9479 opti_type
= OPTI_TYPE_EARLY_SKIP
9480 | OPTI_TYPE_NOT_ITERATED
9481 | OPTI_TYPE_RAW_HASH
;
9488 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9489 salt_type
= SALT_TYPE_EMBEDDED
;
9490 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9492 kern_type
= KERN_TYPE_ANDROIDFDE
;
9493 dgst_size
= DGST_SIZE_4_4
;
9494 parse_func
= androidfde_parse_hash
;
9495 sort_by_digest
= sort_by_digest_4_4
;
9496 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9503 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9504 salt_type
= SALT_TYPE_EMBEDDED
;
9505 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9506 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9507 kern_type
= KERN_TYPE_SCRYPT
;
9508 dgst_size
= DGST_SIZE_4_8
;
9509 parse_func
= scrypt_parse_hash
;
9510 sort_by_digest
= sort_by_digest_4_8
;
9511 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9518 case 9000: hash_type
= HASH_TYPE_SHA1
;
9519 salt_type
= SALT_TYPE_EMBEDDED
;
9520 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9522 | OPTS_TYPE_ST_GENERATE_LE
;
9523 kern_type
= KERN_TYPE_PSAFE2
;
9524 dgst_size
= DGST_SIZE_4_5
;
9525 parse_func
= psafe2_parse_hash
;
9526 sort_by_digest
= sort_by_digest_4_5
;
9527 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9534 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9535 salt_type
= SALT_TYPE_EMBEDDED
;
9536 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9537 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9538 kern_type
= KERN_TYPE_LOTUS8
;
9539 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9540 parse_func
= lotus8_parse_hash
;
9541 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9542 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9549 case 9200: hash_type
= HASH_TYPE_SHA256
;
9550 salt_type
= SALT_TYPE_EMBEDDED
;
9551 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9553 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9554 dgst_size
= DGST_SIZE_4_32
;
9555 parse_func
= cisco8_parse_hash
;
9556 sort_by_digest
= sort_by_digest_4_32
;
9557 opti_type
= OPTI_TYPE_ZERO_BYTE
9558 | OPTI_TYPE_SLOW_HASH_SIMD
;
9565 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9566 salt_type
= SALT_TYPE_EMBEDDED
;
9567 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9568 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9569 kern_type
= KERN_TYPE_SCRYPT
;
9570 dgst_size
= DGST_SIZE_4_8
;
9571 parse_func
= cisco9_parse_hash
;
9572 sort_by_digest
= sort_by_digest_4_8
;
9573 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9580 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9581 salt_type
= SALT_TYPE_EMBEDDED
;
9582 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9583 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9584 kern_type
= KERN_TYPE_OFFICE2007
;
9585 dgst_size
= DGST_SIZE_4_4
;
9586 parse_func
= office2007_parse_hash
;
9587 sort_by_digest
= sort_by_digest_4_4
;
9588 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9595 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9596 salt_type
= SALT_TYPE_EMBEDDED
;
9597 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9599 kern_type
= KERN_TYPE_OFFICE2010
;
9600 dgst_size
= DGST_SIZE_4_4
;
9601 parse_func
= office2010_parse_hash
;
9602 sort_by_digest
= sort_by_digest_4_4
;
9603 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9610 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9611 salt_type
= SALT_TYPE_EMBEDDED
;
9612 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9613 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9614 kern_type
= KERN_TYPE_OFFICE2013
;
9615 dgst_size
= DGST_SIZE_4_4
;
9616 parse_func
= office2013_parse_hash
;
9617 sort_by_digest
= sort_by_digest_4_4
;
9618 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9625 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9626 salt_type
= SALT_TYPE_EMBEDDED
;
9627 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9628 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9629 | OPTS_TYPE_PT_ADD80
9630 | OPTS_TYPE_PT_UNICODE
;
9631 kern_type
= KERN_TYPE_OLDOFFICE01
;
9632 dgst_size
= DGST_SIZE_4_4
;
9633 parse_func
= oldoffice01_parse_hash
;
9634 sort_by_digest
= sort_by_digest_4_4
;
9635 opti_type
= OPTI_TYPE_ZERO_BYTE
9636 | OPTI_TYPE_PRECOMPUTE_INIT
9637 | OPTI_TYPE_NOT_ITERATED
;
9644 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9645 salt_type
= SALT_TYPE_EMBEDDED
;
9646 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9647 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9648 | OPTS_TYPE_PT_ADD80
;
9649 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9650 dgst_size
= DGST_SIZE_4_4
;
9651 parse_func
= oldoffice01cm1_parse_hash
;
9652 sort_by_digest
= sort_by_digest_4_4
;
9653 opti_type
= OPTI_TYPE_ZERO_BYTE
9654 | OPTI_TYPE_PRECOMPUTE_INIT
9655 | OPTI_TYPE_NOT_ITERATED
;
9662 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9663 salt_type
= SALT_TYPE_EMBEDDED
;
9664 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9666 | OPTS_TYPE_PT_ADD80
9667 | OPTS_TYPE_PT_UNICODE
9668 | OPTS_TYPE_PT_NEVERCRACK
;
9669 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9670 dgst_size
= DGST_SIZE_4_4
;
9671 parse_func
= oldoffice01cm2_parse_hash
;
9672 sort_by_digest
= sort_by_digest_4_4
;
9673 opti_type
= OPTI_TYPE_ZERO_BYTE
9674 | OPTI_TYPE_PRECOMPUTE_INIT
9675 | OPTI_TYPE_NOT_ITERATED
;
9682 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9683 salt_type
= SALT_TYPE_EMBEDDED
;
9684 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9685 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9686 | OPTS_TYPE_PT_ADD80
9687 | OPTS_TYPE_PT_UNICODE
;
9688 kern_type
= KERN_TYPE_OLDOFFICE34
;
9689 dgst_size
= DGST_SIZE_4_4
;
9690 parse_func
= oldoffice34_parse_hash
;
9691 sort_by_digest
= sort_by_digest_4_4
;
9692 opti_type
= OPTI_TYPE_ZERO_BYTE
9693 | OPTI_TYPE_PRECOMPUTE_INIT
9694 | OPTI_TYPE_NOT_ITERATED
;
9701 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9702 salt_type
= SALT_TYPE_EMBEDDED
;
9703 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9704 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9705 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9706 dgst_size
= DGST_SIZE_4_4
;
9707 parse_func
= oldoffice34cm1_parse_hash
;
9708 sort_by_digest
= sort_by_digest_4_4
;
9709 opti_type
= OPTI_TYPE_ZERO_BYTE
9710 | OPTI_TYPE_PRECOMPUTE_INIT
9711 | OPTI_TYPE_NOT_ITERATED
;
9718 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9719 salt_type
= SALT_TYPE_EMBEDDED
;
9720 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9721 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9722 | OPTS_TYPE_PT_ADD80
9723 | OPTS_TYPE_PT_UNICODE
9724 | OPTS_TYPE_PT_NEVERCRACK
;
9725 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9726 dgst_size
= DGST_SIZE_4_4
;
9727 parse_func
= oldoffice34cm2_parse_hash
;
9728 sort_by_digest
= sort_by_digest_4_4
;
9729 opti_type
= OPTI_TYPE_ZERO_BYTE
9730 | OPTI_TYPE_PRECOMPUTE_INIT
9731 | OPTI_TYPE_NOT_ITERATED
;
9738 case 9900: hash_type
= HASH_TYPE_MD5
;
9739 salt_type
= SALT_TYPE_NONE
;
9740 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9741 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9742 kern_type
= KERN_TYPE_RADMIN2
;
9743 dgst_size
= DGST_SIZE_4_4
;
9744 parse_func
= radmin2_parse_hash
;
9745 sort_by_digest
= sort_by_digest_4_4
;
9746 opti_type
= OPTI_TYPE_ZERO_BYTE
9747 | OPTI_TYPE_PRECOMPUTE_INIT
9748 | OPTI_TYPE_EARLY_SKIP
9749 | OPTI_TYPE_NOT_ITERATED
9750 | OPTI_TYPE_NOT_SALTED
;
9757 case 10000: hash_type
= HASH_TYPE_SHA256
;
9758 salt_type
= SALT_TYPE_EMBEDDED
;
9759 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9760 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9761 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9762 dgst_size
= DGST_SIZE_4_32
;
9763 parse_func
= djangopbkdf2_parse_hash
;
9764 sort_by_digest
= sort_by_digest_4_32
;
9765 opti_type
= OPTI_TYPE_ZERO_BYTE
9766 | OPTI_TYPE_SLOW_HASH_SIMD
;
9773 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9774 salt_type
= SALT_TYPE_EMBEDDED
;
9775 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9777 kern_type
= KERN_TYPE_SIPHASH
;
9778 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9779 parse_func
= siphash_parse_hash
;
9780 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9781 opti_type
= OPTI_TYPE_ZERO_BYTE
9782 | OPTI_TYPE_NOT_ITERATED
9783 | OPTI_TYPE_RAW_HASH
;
9790 case 10200: hash_type
= HASH_TYPE_MD5
;
9791 salt_type
= SALT_TYPE_EMBEDDED
;
9792 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9793 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9794 | OPTS_TYPE_ST_ADD80
9795 | OPTS_TYPE_ST_ADDBITS14
;
9796 kern_type
= KERN_TYPE_HMACMD5_PW
;
9797 dgst_size
= DGST_SIZE_4_4
;
9798 parse_func
= crammd5_parse_hash
;
9799 sort_by_digest
= sort_by_digest_4_4
;
9800 opti_type
= OPTI_TYPE_ZERO_BYTE
9801 | OPTI_TYPE_NOT_ITERATED
;
9808 case 10300: hash_type
= HASH_TYPE_SHA1
;
9809 salt_type
= SALT_TYPE_EMBEDDED
;
9810 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9811 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9812 kern_type
= KERN_TYPE_SAPH_SHA1
;
9813 dgst_size
= DGST_SIZE_4_5
;
9814 parse_func
= saph_sha1_parse_hash
;
9815 sort_by_digest
= sort_by_digest_4_5
;
9816 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9823 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9824 salt_type
= SALT_TYPE_EMBEDDED
;
9825 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9826 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9827 kern_type
= KERN_TYPE_PDF11
;
9828 dgst_size
= DGST_SIZE_4_4
;
9829 parse_func
= pdf11_parse_hash
;
9830 sort_by_digest
= sort_by_digest_4_4
;
9831 opti_type
= OPTI_TYPE_ZERO_BYTE
9832 | OPTI_TYPE_NOT_ITERATED
;
9839 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9840 salt_type
= SALT_TYPE_EMBEDDED
;
9841 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9842 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9843 kern_type
= KERN_TYPE_PDF11CM1
;
9844 dgst_size
= DGST_SIZE_4_4
;
9845 parse_func
= pdf11cm1_parse_hash
;
9846 sort_by_digest
= sort_by_digest_4_4
;
9847 opti_type
= OPTI_TYPE_ZERO_BYTE
9848 | OPTI_TYPE_NOT_ITERATED
;
9855 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9856 salt_type
= SALT_TYPE_EMBEDDED
;
9857 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9858 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9859 kern_type
= KERN_TYPE_PDF11CM2
;
9860 dgst_size
= DGST_SIZE_4_4
;
9861 parse_func
= pdf11cm2_parse_hash
;
9862 sort_by_digest
= sort_by_digest_4_4
;
9863 opti_type
= OPTI_TYPE_ZERO_BYTE
9864 | OPTI_TYPE_NOT_ITERATED
;
9871 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9872 salt_type
= SALT_TYPE_EMBEDDED
;
9873 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9874 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9875 kern_type
= KERN_TYPE_PDF14
;
9876 dgst_size
= DGST_SIZE_4_4
;
9877 parse_func
= pdf14_parse_hash
;
9878 sort_by_digest
= sort_by_digest_4_4
;
9879 opti_type
= OPTI_TYPE_ZERO_BYTE
9880 | OPTI_TYPE_NOT_ITERATED
;
9887 case 10600: hash_type
= HASH_TYPE_SHA256
;
9888 salt_type
= SALT_TYPE_EMBEDDED
;
9889 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9890 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9891 | OPTS_TYPE_ST_ADD80
9892 | OPTS_TYPE_ST_ADDBITS15
9893 | OPTS_TYPE_HASH_COPY
;
9894 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9895 dgst_size
= DGST_SIZE_4_8
;
9896 parse_func
= pdf17l3_parse_hash
;
9897 sort_by_digest
= sort_by_digest_4_8
;
9898 opti_type
= OPTI_TYPE_ZERO_BYTE
9899 | OPTI_TYPE_PRECOMPUTE_INIT
9900 | OPTI_TYPE_PRECOMPUTE_MERKLE
9901 | OPTI_TYPE_EARLY_SKIP
9902 | OPTI_TYPE_NOT_ITERATED
9903 | OPTI_TYPE_APPENDED_SALT
9904 | OPTI_TYPE_RAW_HASH
;
9911 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9912 salt_type
= SALT_TYPE_EMBEDDED
;
9913 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9914 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9915 | OPTS_TYPE_HASH_COPY
;
9916 kern_type
= KERN_TYPE_PDF17L8
;
9917 dgst_size
= DGST_SIZE_4_8
;
9918 parse_func
= pdf17l8_parse_hash
;
9919 sort_by_digest
= sort_by_digest_4_8
;
9920 opti_type
= OPTI_TYPE_ZERO_BYTE
9921 | OPTI_TYPE_NOT_ITERATED
;
9928 case 10800: hash_type
= HASH_TYPE_SHA384
;
9929 salt_type
= SALT_TYPE_NONE
;
9930 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9931 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9932 | OPTS_TYPE_PT_ADD80
9933 | OPTS_TYPE_PT_ADDBITS15
;
9934 kern_type
= KERN_TYPE_SHA384
;
9935 dgst_size
= DGST_SIZE_8_8
;
9936 parse_func
= sha384_parse_hash
;
9937 sort_by_digest
= sort_by_digest_8_8
;
9938 opti_type
= OPTI_TYPE_ZERO_BYTE
9939 | OPTI_TYPE_PRECOMPUTE_INIT
9940 | OPTI_TYPE_PRECOMPUTE_MERKLE
9941 | OPTI_TYPE_EARLY_SKIP
9942 | OPTI_TYPE_NOT_ITERATED
9943 | OPTI_TYPE_NOT_SALTED
9944 | OPTI_TYPE_USES_BITS_64
9945 | OPTI_TYPE_RAW_HASH
;
9952 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9953 salt_type
= SALT_TYPE_EMBEDDED
;
9954 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9955 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9956 | OPTS_TYPE_ST_BASE64
9957 | OPTS_TYPE_HASH_COPY
;
9958 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9959 dgst_size
= DGST_SIZE_4_32
;
9960 parse_func
= pbkdf2_sha256_parse_hash
;
9961 sort_by_digest
= sort_by_digest_4_32
;
9962 opti_type
= OPTI_TYPE_ZERO_BYTE
9963 | OPTI_TYPE_SLOW_HASH_SIMD
;
9970 case 11000: hash_type
= HASH_TYPE_MD5
;
9971 salt_type
= SALT_TYPE_INTERN
;
9972 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9973 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9974 | OPTS_TYPE_PT_ADD80
;
9975 kern_type
= KERN_TYPE_PRESTASHOP
;
9976 dgst_size
= DGST_SIZE_4_4
;
9977 parse_func
= prestashop_parse_hash
;
9978 sort_by_digest
= sort_by_digest_4_4
;
9979 opti_type
= OPTI_TYPE_ZERO_BYTE
9980 | OPTI_TYPE_PRECOMPUTE_INIT
9981 | OPTI_TYPE_NOT_ITERATED
9982 | OPTI_TYPE_PREPENDED_SALT
;
9989 case 11100: hash_type
= HASH_TYPE_MD5
;
9990 salt_type
= SALT_TYPE_EMBEDDED
;
9991 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9992 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9993 | OPTS_TYPE_ST_ADD80
;
9994 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9995 dgst_size
= DGST_SIZE_4_4
;
9996 parse_func
= postgresql_auth_parse_hash
;
9997 sort_by_digest
= sort_by_digest_4_4
;
9998 opti_type
= OPTI_TYPE_ZERO_BYTE
9999 | OPTI_TYPE_PRECOMPUTE_INIT
10000 | OPTI_TYPE_PRECOMPUTE_MERKLE
10001 | OPTI_TYPE_EARLY_SKIP
;
10008 case 11200: hash_type
= HASH_TYPE_SHA1
;
10009 salt_type
= SALT_TYPE_EMBEDDED
;
10010 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10011 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10012 | OPTS_TYPE_PT_ADD80
10013 | OPTS_TYPE_ST_HEX
;
10014 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10015 dgst_size
= DGST_SIZE_4_5
;
10016 parse_func
= mysql_auth_parse_hash
;
10017 sort_by_digest
= sort_by_digest_4_5
;
10018 opti_type
= OPTI_TYPE_ZERO_BYTE
10019 | OPTI_TYPE_EARLY_SKIP
;
10026 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10027 salt_type
= SALT_TYPE_EMBEDDED
;
10028 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10029 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10031 | OPTS_TYPE_ST_ADD80
;
10032 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10033 dgst_size
= DGST_SIZE_4_4
;
10034 parse_func
= bitcoin_wallet_parse_hash
;
10035 sort_by_digest
= sort_by_digest_4_4
;
10036 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10043 case 11400: hash_type
= HASH_TYPE_MD5
;
10044 salt_type
= SALT_TYPE_EMBEDDED
;
10045 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10046 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10047 | OPTS_TYPE_PT_ADD80
10048 | OPTS_TYPE_HASH_COPY
;
10049 kern_type
= KERN_TYPE_SIP_AUTH
;
10050 dgst_size
= DGST_SIZE_4_4
;
10051 parse_func
= sip_auth_parse_hash
;
10052 sort_by_digest
= sort_by_digest_4_4
;
10053 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10060 case 11500: hash_type
= HASH_TYPE_CRC32
;
10061 salt_type
= SALT_TYPE_INTERN
;
10062 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10063 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10064 | OPTS_TYPE_ST_GENERATE_LE
10065 | OPTS_TYPE_ST_HEX
;
10066 kern_type
= KERN_TYPE_CRC32
;
10067 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10068 parse_func
= crc32_parse_hash
;
10069 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10070 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10077 case 11600: hash_type
= HASH_TYPE_AES
;
10078 salt_type
= SALT_TYPE_EMBEDDED
;
10079 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10081 | OPTS_TYPE_PT_NEVERCRACK
;
10082 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10083 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10084 parse_func
= seven_zip_parse_hash
;
10085 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10086 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10093 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
10094 salt_type
= SALT_TYPE_NONE
;
10095 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10096 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10097 | OPTS_TYPE_PT_ADD01
;
10098 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
10099 dgst_size
= DGST_SIZE_4_8
;
10100 parse_func
= gost2012sbog_256_parse_hash
;
10101 sort_by_digest
= sort_by_digest_4_8
;
10102 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10109 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10110 salt_type
= SALT_TYPE_NONE
;
10111 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10112 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10113 | OPTS_TYPE_PT_ADD01
;
10114 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10115 dgst_size
= DGST_SIZE_4_16
;
10116 parse_func
= gost2012sbog_512_parse_hash
;
10117 sort_by_digest
= sort_by_digest_4_16
;
10118 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10125 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10126 salt_type
= SALT_TYPE_EMBEDDED
;
10127 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10129 | OPTS_TYPE_ST_BASE64
10130 | OPTS_TYPE_HASH_COPY
;
10131 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10132 dgst_size
= DGST_SIZE_4_32
;
10133 parse_func
= pbkdf2_md5_parse_hash
;
10134 sort_by_digest
= sort_by_digest_4_32
;
10135 opti_type
= OPTI_TYPE_ZERO_BYTE
10136 | OPTI_TYPE_SLOW_HASH_SIMD
;
10143 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10144 salt_type
= SALT_TYPE_EMBEDDED
;
10145 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10146 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10147 | OPTS_TYPE_ST_BASE64
10148 | OPTS_TYPE_HASH_COPY
;
10149 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10150 dgst_size
= DGST_SIZE_4_32
;
10151 parse_func
= pbkdf2_sha1_parse_hash
;
10152 sort_by_digest
= sort_by_digest_4_32
;
10153 opti_type
= OPTI_TYPE_ZERO_BYTE
10154 | OPTI_TYPE_SLOW_HASH_SIMD
;
10161 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10162 salt_type
= SALT_TYPE_EMBEDDED
;
10163 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10164 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10165 | OPTS_TYPE_ST_BASE64
10166 | OPTS_TYPE_HASH_COPY
;
10167 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10168 dgst_size
= DGST_SIZE_8_16
;
10169 parse_func
= pbkdf2_sha512_parse_hash
;
10170 sort_by_digest
= sort_by_digest_8_16
;
10171 opti_type
= OPTI_TYPE_ZERO_BYTE
10172 | OPTI_TYPE_USES_BITS_64
10173 | OPTI_TYPE_SLOW_HASH_SIMD
;
10180 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
10181 salt_type
= SALT_TYPE_EMBEDDED
;
10182 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10183 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10184 kern_type
= KERN_TYPE_ECRYPTFS
;
10185 dgst_size
= DGST_SIZE_8_8
;
10186 parse_func
= ecryptfs_parse_hash
;
10187 sort_by_digest
= sort_by_digest_8_8
;
10188 opti_type
= OPTI_TYPE_ZERO_BYTE
10189 | OPTI_TYPE_USES_BITS_64
;
10196 case 12300: hash_type
= HASH_TYPE_ORACLET
;
10197 salt_type
= SALT_TYPE_EMBEDDED
;
10198 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10199 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10200 kern_type
= KERN_TYPE_ORACLET
;
10201 dgst_size
= DGST_SIZE_8_16
;
10202 parse_func
= oraclet_parse_hash
;
10203 sort_by_digest
= sort_by_digest_8_16
;
10204 opti_type
= OPTI_TYPE_ZERO_BYTE
10205 | OPTI_TYPE_USES_BITS_64
;
10212 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
10213 salt_type
= SALT_TYPE_EMBEDDED
;
10214 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10215 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10216 kern_type
= KERN_TYPE_BSDICRYPT
;
10217 dgst_size
= DGST_SIZE_4_4
;
10218 parse_func
= bsdicrypt_parse_hash
;
10219 sort_by_digest
= sort_by_digest_4_4
;
10220 opti_type
= OPTI_TYPE_ZERO_BYTE
10221 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10228 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10229 salt_type
= SALT_TYPE_EMBEDDED
;
10230 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10231 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10232 kern_type
= KERN_TYPE_RAR3
;
10233 dgst_size
= DGST_SIZE_4_4
;
10234 parse_func
= rar3hp_parse_hash
;
10235 sort_by_digest
= sort_by_digest_4_4
;
10236 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10243 case 12600: hash_type
= HASH_TYPE_SHA256
;
10244 salt_type
= SALT_TYPE_INTERN
;
10245 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10246 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10247 | OPTS_TYPE_PT_ADD80
;
10248 kern_type
= KERN_TYPE_CF10
;
10249 dgst_size
= DGST_SIZE_4_8
;
10250 parse_func
= cf10_parse_hash
;
10251 sort_by_digest
= sort_by_digest_4_8
;
10252 opti_type
= OPTI_TYPE_ZERO_BYTE
10253 | OPTI_TYPE_PRECOMPUTE_INIT
10254 | OPTI_TYPE_EARLY_SKIP
10255 | OPTI_TYPE_NOT_ITERATED
;
10262 case 12700: hash_type
= HASH_TYPE_AES
;
10263 salt_type
= SALT_TYPE_EMBEDDED
;
10264 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10265 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10266 | OPTS_TYPE_HASH_COPY
;
10267 kern_type
= KERN_TYPE_MYWALLET
;
10268 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10269 parse_func
= mywallet_parse_hash
;
10270 sort_by_digest
= sort_by_digest_4_5
;
10271 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10278 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10279 salt_type
= SALT_TYPE_EMBEDDED
;
10280 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10281 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10282 kern_type
= KERN_TYPE_MS_DRSR
;
10283 dgst_size
= DGST_SIZE_4_8
;
10284 parse_func
= ms_drsr_parse_hash
;
10285 sort_by_digest
= sort_by_digest_4_8
;
10286 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10293 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10294 salt_type
= SALT_TYPE_EMBEDDED
;
10295 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10296 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10297 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10298 dgst_size
= DGST_SIZE_4_8
;
10299 parse_func
= androidfde_samsung_parse_hash
;
10300 sort_by_digest
= sort_by_digest_4_8
;
10301 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10308 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10309 salt_type
= SALT_TYPE_EMBEDDED
;
10310 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10311 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10312 kern_type
= KERN_TYPE_RAR5
;
10313 dgst_size
= DGST_SIZE_4_4
;
10314 parse_func
= rar5_parse_hash
;
10315 sort_by_digest
= sort_by_digest_4_4
;
10316 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10323 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10324 salt_type
= SALT_TYPE_EMBEDDED
;
10325 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10326 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10327 kern_type
= KERN_TYPE_KRB5TGS
;
10328 dgst_size
= DGST_SIZE_4_4
;
10329 parse_func
= krb5tgs_parse_hash
;
10330 sort_by_digest
= sort_by_digest_4_4
;
10331 opti_type
= OPTI_TYPE_ZERO_BYTE
10332 | OPTI_TYPE_NOT_ITERATED
;
10339 case 13200: hash_type
= HASH_TYPE_AES
;
10340 salt_type
= SALT_TYPE_EMBEDDED
;
10341 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10343 kern_type
= KERN_TYPE_AXCRYPT
;
10344 dgst_size
= DGST_SIZE_4_4
;
10345 parse_func
= axcrypt_parse_hash
;
10346 sort_by_digest
= sort_by_digest_4_4
;
10347 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10354 case 13300: hash_type
= HASH_TYPE_SHA1
;
10355 salt_type
= SALT_TYPE_NONE
;
10356 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10357 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10358 | OPTS_TYPE_PT_ADD80
10359 | OPTS_TYPE_PT_ADDBITS15
;
10360 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10361 dgst_size
= DGST_SIZE_4_5
;
10362 parse_func
= sha1axcrypt_parse_hash
;
10363 sort_by_digest
= sort_by_digest_4_5
;
10364 opti_type
= OPTI_TYPE_ZERO_BYTE
10365 | OPTI_TYPE_PRECOMPUTE_INIT
10366 | OPTI_TYPE_EARLY_SKIP
10367 | OPTI_TYPE_NOT_ITERATED
10368 | OPTI_TYPE_NOT_SALTED
;
10375 case 13400: hash_type
= HASH_TYPE_AES
;
10376 salt_type
= SALT_TYPE_EMBEDDED
;
10377 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10378 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10379 kern_type
= KERN_TYPE_KEEPASS
;
10380 dgst_size
= DGST_SIZE_4_4
;
10381 parse_func
= keepass_parse_hash
;
10382 sort_by_digest
= sort_by_digest_4_4
;
10383 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10390 case 13500: hash_type
= HASH_TYPE_SHA1
;
10391 salt_type
= SALT_TYPE_EMBEDDED
;
10392 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10393 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10394 | OPTS_TYPE_PT_UNICODE
10395 | OPTS_TYPE_PT_ADD80
;
10396 kern_type
= KERN_TYPE_PSTOKEN
;
10397 dgst_size
= DGST_SIZE_4_5
;
10398 parse_func
= pstoken_parse_hash
;
10399 sort_by_digest
= sort_by_digest_4_5
;
10400 opti_type
= OPTI_TYPE_ZERO_BYTE
10401 | OPTI_TYPE_PRECOMPUTE_INIT
10402 | OPTI_TYPE_EARLY_SKIP
10403 | OPTI_TYPE_NOT_ITERATED
10404 | OPTI_TYPE_PREPENDED_SALT
10405 | OPTI_TYPE_RAW_HASH
;
10412 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10413 salt_type
= SALT_TYPE_EMBEDDED
;
10414 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10415 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10416 kern_type
= KERN_TYPE_ZIP2
;
10417 dgst_size
= DGST_SIZE_4_4
;
10418 parse_func
= zip2_parse_hash
;
10419 sort_by_digest
= sort_by_digest_4_4
;
10420 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10427 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10428 salt_type
= SALT_TYPE_EMBEDDED
;
10429 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10430 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10431 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10432 dgst_size
= DGST_SIZE_4_5
;
10433 parse_func
= veracrypt_parse_hash_655331
;
10434 sort_by_digest
= sort_by_digest_4_5
;
10435 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10442 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10443 salt_type
= SALT_TYPE_EMBEDDED
;
10444 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10445 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10446 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10447 dgst_size
= DGST_SIZE_4_5
;
10448 parse_func
= veracrypt_parse_hash_655331
;
10449 sort_by_digest
= sort_by_digest_4_5
;
10450 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10457 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10458 salt_type
= SALT_TYPE_EMBEDDED
;
10459 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10460 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10461 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10462 dgst_size
= DGST_SIZE_4_5
;
10463 parse_func
= veracrypt_parse_hash_655331
;
10464 sort_by_digest
= sort_by_digest_4_5
;
10465 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10472 case 13721: hash_type
= HASH_TYPE_SHA512
;
10473 salt_type
= SALT_TYPE_EMBEDDED
;
10474 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10476 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
10477 dgst_size
= DGST_SIZE_8_8
;
10478 parse_func
= veracrypt_parse_hash_500000
;
10479 sort_by_digest
= sort_by_digest_8_8
;
10480 opti_type
= OPTI_TYPE_ZERO_BYTE
10481 | OPTI_TYPE_USES_BITS_64
;
10488 case 13722: hash_type
= HASH_TYPE_SHA512
;
10489 salt_type
= SALT_TYPE_EMBEDDED
;
10490 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10492 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
10493 dgst_size
= DGST_SIZE_8_8
;
10494 parse_func
= veracrypt_parse_hash_500000
;
10495 sort_by_digest
= sort_by_digest_8_8
;
10496 opti_type
= OPTI_TYPE_ZERO_BYTE
10497 | OPTI_TYPE_USES_BITS_64
;
10504 case 13723: hash_type
= HASH_TYPE_SHA512
;
10505 salt_type
= SALT_TYPE_EMBEDDED
;
10506 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10507 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10508 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10509 dgst_size
= DGST_SIZE_8_8
;
10510 parse_func
= veracrypt_parse_hash_500000
;
10511 sort_by_digest
= sort_by_digest_8_8
;
10512 opti_type
= OPTI_TYPE_ZERO_BYTE
10513 | OPTI_TYPE_USES_BITS_64
;
10520 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10521 salt_type
= SALT_TYPE_EMBEDDED
;
10522 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10523 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10524 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10525 dgst_size
= DGST_SIZE_4_8
;
10526 parse_func
= veracrypt_parse_hash_500000
;
10527 sort_by_digest
= sort_by_digest_4_8
;
10528 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10535 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10536 salt_type
= SALT_TYPE_EMBEDDED
;
10537 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10538 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10539 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10540 dgst_size
= DGST_SIZE_4_8
;
10541 parse_func
= veracrypt_parse_hash_500000
;
10542 sort_by_digest
= sort_by_digest_4_8
;
10543 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10550 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10551 salt_type
= SALT_TYPE_EMBEDDED
;
10552 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10554 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10555 dgst_size
= DGST_SIZE_4_8
;
10556 parse_func
= veracrypt_parse_hash_500000
;
10557 sort_by_digest
= sort_by_digest_4_8
;
10558 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10565 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10566 salt_type
= SALT_TYPE_EMBEDDED
;
10567 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10568 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10569 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10570 dgst_size
= DGST_SIZE_4_5
;
10571 parse_func
= veracrypt_parse_hash_327661
;
10572 sort_by_digest
= sort_by_digest_4_5
;
10573 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10580 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10581 salt_type
= SALT_TYPE_EMBEDDED
;
10582 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10583 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10584 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10585 dgst_size
= DGST_SIZE_4_5
;
10586 parse_func
= veracrypt_parse_hash_327661
;
10587 sort_by_digest
= sort_by_digest_4_5
;
10588 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10595 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10596 salt_type
= SALT_TYPE_EMBEDDED
;
10597 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10599 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10600 dgst_size
= DGST_SIZE_4_5
;
10601 parse_func
= veracrypt_parse_hash_327661
;
10602 sort_by_digest
= sort_by_digest_4_5
;
10603 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10610 case 13751: hash_type
= HASH_TYPE_SHA256
;
10611 salt_type
= SALT_TYPE_EMBEDDED
;
10612 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10613 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10614 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10615 dgst_size
= DGST_SIZE_4_8
;
10616 parse_func
= veracrypt_parse_hash_500000
;
10617 sort_by_digest
= sort_by_digest_4_8
;
10618 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10625 case 13752: hash_type
= HASH_TYPE_SHA256
;
10626 salt_type
= SALT_TYPE_EMBEDDED
;
10627 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10628 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10629 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10630 dgst_size
= DGST_SIZE_4_8
;
10631 parse_func
= veracrypt_parse_hash_500000
;
10632 sort_by_digest
= sort_by_digest_4_8
;
10633 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10640 case 13753: hash_type
= HASH_TYPE_SHA256
;
10641 salt_type
= SALT_TYPE_EMBEDDED
;
10642 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10643 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10644 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10645 dgst_size
= DGST_SIZE_4_8
;
10646 parse_func
= veracrypt_parse_hash_500000
;
10647 sort_by_digest
= sort_by_digest_4_8
;
10648 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10655 case 13761: hash_type
= HASH_TYPE_SHA256
;
10656 salt_type
= SALT_TYPE_EMBEDDED
;
10657 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10658 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10659 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10660 dgst_size
= DGST_SIZE_4_8
;
10661 parse_func
= veracrypt_parse_hash_200000
;
10662 sort_by_digest
= sort_by_digest_4_8
;
10663 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10670 case 13762: hash_type
= HASH_TYPE_SHA256
;
10671 salt_type
= SALT_TYPE_EMBEDDED
;
10672 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10673 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10674 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10675 dgst_size
= DGST_SIZE_4_8
;
10676 parse_func
= veracrypt_parse_hash_200000
;
10677 sort_by_digest
= sort_by_digest_4_8
;
10678 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10685 case 13763: hash_type
= HASH_TYPE_SHA256
;
10686 salt_type
= SALT_TYPE_EMBEDDED
;
10687 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10688 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10689 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10690 dgst_size
= DGST_SIZE_4_8
;
10691 parse_func
= veracrypt_parse_hash_200000
;
10692 sort_by_digest
= sort_by_digest_4_8
;
10693 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10701 default: usage_mini_print (PROGNAME
); return (-1);
10708 data
.parse_func
= parse_func
;
10716 if (salt_type
== SALT_TYPE_INTERN
)
10718 opts_type
|= OPTS_TYPE_ST_HEX
;
10722 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10728 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10729 | (salt_type
== SALT_TYPE_EXTERN
)
10730 | (salt_type
== SALT_TYPE_EMBEDDED
)
10731 | (salt_type
== SALT_TYPE_VIRTUAL
));
10733 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10735 data
.hash_type
= hash_type
;
10736 data
.attack_mode
= attack_mode
;
10737 data
.attack_kern
= attack_kern
;
10738 data
.attack_exec
= attack_exec
;
10739 data
.kern_type
= kern_type
;
10740 data
.opts_type
= opts_type
;
10741 data
.dgst_size
= dgst_size
;
10742 data
.salt_type
= salt_type
;
10743 data
.isSalted
= isSalted
;
10744 data
.sort_by_digest
= sort_by_digest
;
10745 data
.dgst_pos0
= dgst_pos0
;
10746 data
.dgst_pos1
= dgst_pos1
;
10747 data
.dgst_pos2
= dgst_pos2
;
10748 data
.dgst_pos3
= dgst_pos3
;
10754 case 2500: esalt_size
= sizeof (wpa_t
); break;
10755 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10756 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10757 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10758 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10759 case 6211: esalt_size
= sizeof (tc_t
); break;
10760 case 6212: esalt_size
= sizeof (tc_t
); break;
10761 case 6213: esalt_size
= sizeof (tc_t
); break;
10762 case 6221: esalt_size
= sizeof (tc_t
); break;
10763 case 6222: esalt_size
= sizeof (tc_t
); break;
10764 case 6223: esalt_size
= sizeof (tc_t
); break;
10765 case 6231: esalt_size
= sizeof (tc_t
); break;
10766 case 6232: esalt_size
= sizeof (tc_t
); break;
10767 case 6233: esalt_size
= sizeof (tc_t
); break;
10768 case 6241: esalt_size
= sizeof (tc_t
); break;
10769 case 6242: esalt_size
= sizeof (tc_t
); break;
10770 case 6243: esalt_size
= sizeof (tc_t
); break;
10771 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10772 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10773 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10774 case 7300: esalt_size
= sizeof (rakp_t
); break;
10775 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10776 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10777 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10778 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10779 case 9400: esalt_size
= sizeof (office2007_t
); break;
10780 case 9500: esalt_size
= sizeof (office2010_t
); break;
10781 case 9600: esalt_size
= sizeof (office2013_t
); break;
10782 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10783 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10784 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10785 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10786 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10787 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10788 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10789 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10790 case 10400: esalt_size
= sizeof (pdf_t
); break;
10791 case 10410: esalt_size
= sizeof (pdf_t
); break;
10792 case 10420: esalt_size
= sizeof (pdf_t
); break;
10793 case 10500: esalt_size
= sizeof (pdf_t
); break;
10794 case 10600: esalt_size
= sizeof (pdf_t
); break;
10795 case 10700: esalt_size
= sizeof (pdf_t
); break;
10796 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10797 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10798 case 11400: esalt_size
= sizeof (sip_t
); break;
10799 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10800 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10801 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10802 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10803 case 13000: esalt_size
= sizeof (rar5_t
); break;
10804 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10805 case 13400: esalt_size
= sizeof (keepass_t
); break;
10806 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10807 case 13600: esalt_size
= sizeof (zip2_t
); break;
10808 case 13711: esalt_size
= sizeof (tc_t
); break;
10809 case 13712: esalt_size
= sizeof (tc_t
); break;
10810 case 13713: esalt_size
= sizeof (tc_t
); break;
10811 case 13721: esalt_size
= sizeof (tc_t
); break;
10812 case 13722: esalt_size
= sizeof (tc_t
); break;
10813 case 13723: esalt_size
= sizeof (tc_t
); break;
10814 case 13731: esalt_size
= sizeof (tc_t
); break;
10815 case 13732: esalt_size
= sizeof (tc_t
); break;
10816 case 13733: esalt_size
= sizeof (tc_t
); break;
10817 case 13741: esalt_size
= sizeof (tc_t
); break;
10818 case 13742: esalt_size
= sizeof (tc_t
); break;
10819 case 13743: esalt_size
= sizeof (tc_t
); break;
10820 case 13751: esalt_size
= sizeof (tc_t
); break;
10821 case 13752: esalt_size
= sizeof (tc_t
); break;
10822 case 13753: esalt_size
= sizeof (tc_t
); break;
10823 case 13761: esalt_size
= sizeof (tc_t
); break;
10824 case 13762: esalt_size
= sizeof (tc_t
); break;
10825 case 13763: esalt_size
= sizeof (tc_t
); break;
10828 data
.esalt_size
= esalt_size
;
10831 * choose dictionary parser
10834 if (hash_type
== HASH_TYPE_LM
)
10836 get_next_word_func
= get_next_word_lm
;
10838 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10840 get_next_word_func
= get_next_word_uc
;
10844 get_next_word_func
= get_next_word_std
;
10851 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10854 size_t dictstat_nmemb
= 0;
10858 uint dictstat_nmemb
= 0;
10861 char dictstat
[256] = { 0 };
10863 FILE *dictstat_fp
= NULL
;
10867 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10869 dictstat_fp
= fopen (dictstat
, "rb");
10874 struct stat tmpstat
;
10876 fstat (fileno (dictstat_fp
), &tmpstat
);
10880 struct stat64 tmpstat
;
10882 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10885 if (tmpstat
.st_mtime
< COMPTIME
)
10887 /* with v0.15 the format changed so we have to ensure user is using a good version
10888 since there is no version-header in the dictstat file */
10890 fclose (dictstat_fp
);
10896 while (!feof (dictstat_fp
))
10900 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
10902 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
10904 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
10906 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
10912 fclose (dictstat_fp
);
10921 char potfile
[256] = { 0 };
10923 if (potfile_path
== NULL
)
10925 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
10929 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
10932 data
.pot_fp
= NULL
;
10934 FILE *out_fp
= NULL
;
10935 FILE *pot_fp
= NULL
;
10937 if (show
== 1 || left
== 1)
10939 pot_fp
= fopen (potfile
, "rb");
10941 if (pot_fp
== NULL
)
10943 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10948 if (outfile
!= NULL
)
10950 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
10952 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
10966 if (potfile_disable
== 0)
10968 pot_fp
= fopen (potfile
, "ab");
10970 if (pot_fp
== NULL
)
10972 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10977 data
.pot_fp
= pot_fp
;
10984 uint pot_avail
= 0;
10986 if (show
== 1 || left
== 1)
10988 SUPPRESS_OUTPUT
= 1;
10990 pot_avail
= count_lines (pot_fp
);
10994 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
10996 uint pot_hashes_avail
= 0;
11000 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11002 while (!feof (pot_fp
))
11006 int line_len
= fgetl (pot_fp
, line_buf
);
11008 if (line_len
== 0) continue;
11010 char *plain_buf
= line_buf
+ line_len
;
11012 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11014 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11016 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11017 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11019 if (pot_cnt
== pot_hashes_avail
)
11023 for (pos
= 0; pos
< INCR_POT
; pos
++)
11025 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11027 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11029 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11031 tmp_hash
->digest
= mymalloc (dgst_size
);
11035 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11040 tmp_hash
->esalt
= mymalloc (esalt_size
);
11043 pot_hashes_avail
++;
11051 int iter
= MAX_CUT_TRIES
;
11055 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11057 if (line_buf
[i
] == ':')
11065 if (data
.hash_mode
!= 2500)
11067 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11071 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11073 if (line_len
> max_salt_size
)
11075 parser_status
= PARSER_GLOBAL_LENGTH
;
11079 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11081 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11083 hashes_buf
->salt
->salt_len
= line_len
;
11085 parser_status
= PARSER_OK
;
11089 // if NOT parsed without error, we add the ":" to the plain
11091 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11097 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11099 if (parser_status
< PARSER_GLOBAL_ZERO
)
11101 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11106 if (plain_len
>= 255) continue;
11108 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11110 pot_ptr
->plain_len
= plain_len
;
11119 SUPPRESS_OUTPUT
= 0;
11121 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11128 uint pw_min
= PW_MIN
;
11129 uint pw_max
= PW_MAX
;
11133 case 125: if (pw_max
> 32) pw_max
= 32;
11135 case 400: if (pw_max
> 40) pw_max
= 40;
11137 case 500: if (pw_max
> 16) pw_max
= 16;
11139 case 1500: if (pw_max
> 8) pw_max
= 8;
11141 case 1600: if (pw_max
> 16) pw_max
= 16;
11143 case 1800: if (pw_max
> 16) pw_max
= 16;
11145 case 2100: if (pw_max
> 16) pw_max
= 16;
11147 case 2500: if (pw_min
< 8) pw_min
= 8;
11149 case 3000: if (pw_max
> 7) pw_max
= 7;
11151 case 5200: if (pw_max
> 24) pw_max
= 24;
11153 case 5800: if (pw_max
> 16) pw_max
= 16;
11155 case 6300: if (pw_max
> 16) pw_max
= 16;
11157 case 7400: if (pw_max
> 16) pw_max
= 16;
11159 case 7500: if (pw_max
> 8) pw_max
= 8;
11161 case 7900: if (pw_max
> 48) pw_max
= 48;
11163 case 8500: if (pw_max
> 8) pw_max
= 8;
11165 case 8600: if (pw_max
> 16) pw_max
= 16;
11167 case 9710: pw_min
= 5;
11170 case 9810: pw_min
= 5;
11173 case 10410: pw_min
= 5;
11176 case 10300: if (pw_max
< 3) pw_min
= 3;
11177 if (pw_max
> 40) pw_max
= 40;
11179 case 10500: if (pw_max
< 3) pw_min
= 3;
11180 if (pw_max
> 40) pw_max
= 40;
11182 case 10700: if (pw_max
> 16) pw_max
= 16;
11184 case 11300: if (pw_max
> 40) pw_max
= 40;
11186 case 11600: if (pw_max
> 32) pw_max
= 32;
11188 case 12500: if (pw_max
> 20) pw_max
= 20;
11190 case 12800: if (pw_max
> 24) pw_max
= 24;
11194 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11196 switch (attack_kern
)
11198 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11200 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11206 * charsets : keep them together for more easy maintainnce
11209 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11210 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11212 mp_setup_sys (mp_sys
);
11214 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11215 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11216 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11217 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11220 * load hashes, part I: find input mode, count hashes
11223 uint hashlist_mode
= 0;
11224 uint hashlist_format
= HLFMT_HASHCAT
;
11226 uint hashes_avail
= 0;
11228 if (benchmark
== 0)
11232 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11234 if ((hash_mode
== 2500) ||
11235 (hash_mode
== 5200) ||
11236 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11237 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11238 (hash_mode
== 9000))
11240 hashlist_mode
= HL_MODE_ARG
;
11242 char *hashfile
= myargv
[optind
];
11244 data
.hashfile
= hashfile
;
11246 logfile_top_var_string ("target", hashfile
);
11249 if (hashlist_mode
== HL_MODE_ARG
)
11251 if (hash_mode
== 2500)
11255 if (stat (data
.hashfile
, &st
) == -1)
11257 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11262 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11269 else if (hashlist_mode
== HL_MODE_FILE
)
11271 char *hashfile
= myargv
[optind
];
11273 data
.hashfile
= hashfile
;
11275 logfile_top_var_string ("target", hashfile
);
11279 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11281 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11286 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11288 hashes_avail
= count_lines (fp
);
11292 if (hashes_avail
== 0)
11294 log_error ("ERROR: hashfile is empty or corrupt");
11301 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11303 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11305 log_error ("ERROR: remove not supported in native hashfile-format mode");
11317 hashlist_mode
= HL_MODE_ARG
;
11322 if (hash_mode
== 3000) hashes_avail
*= 2;
11324 data
.hashlist_mode
= hashlist_mode
;
11325 data
.hashlist_format
= hashlist_format
;
11327 logfile_top_uint (hashlist_mode
);
11328 logfile_top_uint (hashlist_format
);
11331 * load hashes, part II: allocate required memory, set pointers
11334 hash_t
*hashes_buf
= NULL
;
11335 void *digests_buf
= NULL
;
11336 salt_t
*salts_buf
= NULL
;
11337 void *esalts_buf
= NULL
;
11339 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11341 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11343 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11347 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11349 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11351 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11353 if (username
&& (remove
|| show
|| left
))
11355 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11360 hash_info
->orighash
= (char *) mymalloc (256);
11367 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11371 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11376 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11379 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11381 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11385 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11389 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11394 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11399 * load hashes, part III: parse hashes or generate them if benchmark
11402 uint hashes_cnt
= 0;
11404 if (benchmark
== 0)
11408 // useless to read hash file for keyspace, cheat a little bit w/ optind
11410 else if (hashes_avail
== 0)
11413 else if (hashlist_mode
== HL_MODE_ARG
)
11415 char *input_buf
= myargv
[optind
];
11417 uint input_len
= strlen (input_buf
);
11419 logfile_top_var_string ("target", input_buf
);
11421 char *hash_buf
= NULL
;
11424 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11426 bool hash_fmt_error
= 0;
11428 if (hash_len
< 1) hash_fmt_error
= 1;
11429 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11431 if (hash_fmt_error
)
11433 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11437 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11439 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11441 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11446 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11449 int parser_status
= PARSER_OK
;
11451 if (hash_mode
== 2500)
11455 log_error ("ERROR: hccap file not specified");
11460 hashlist_mode
= HL_MODE_FILE
;
11462 data
.hashlist_mode
= hashlist_mode
;
11464 FILE *fp
= fopen (hash_buf
, "rb");
11468 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11473 if (hashes_avail
< 1)
11475 log_error ("ERROR: hccap file is empty or corrupt");
11482 uint hccap_size
= sizeof (hccap_t
);
11484 char *in
= (char *) mymalloc (hccap_size
);
11488 int n
= fread (in
, hccap_size
, 1, fp
);
11492 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11497 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11499 if (parser_status
!= PARSER_OK
)
11501 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11506 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11508 if ((show
== 1) || (left
== 1))
11510 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11512 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11514 int cur_pos
= tmp_salt
->salt_len
;
11515 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11517 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11519 // do the appending task
11521 snprintf (salt_ptr
+ cur_pos
,
11523 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11535 wpa
->orig_mac2
[5]);
11537 // memset () the remaining part of the salt
11539 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11540 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11542 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11544 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11547 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
);
11548 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
);
11557 else if (hash_mode
== 3000)
11559 if (hash_len
== 32)
11561 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11563 hash_t
*lm_hash_left
= NULL
;
11565 if (parser_status
== PARSER_OK
)
11567 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11573 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11576 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11578 hash_t
*lm_hash_right
= NULL
;
11580 if (parser_status
== PARSER_OK
)
11582 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11588 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11593 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11595 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
);
11596 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
);
11601 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11603 if (parser_status
== PARSER_OK
)
11605 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11606 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11609 if (parser_status
== PARSER_OK
)
11615 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11621 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11623 if (parser_status
== PARSER_OK
)
11625 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11626 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11629 if (parser_status
== PARSER_OK
)
11635 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11640 else if (hashlist_mode
== HL_MODE_FILE
)
11642 char *hashfile
= data
.hashfile
;
11646 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11648 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11655 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11661 int line_len
= fgetl (fp
, line_buf
);
11663 if (line_len
== 0) continue;
11665 char *hash_buf
= NULL
;
11668 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11670 bool hash_fmt_error
= 0;
11672 if (hash_len
< 1) hash_fmt_error
= 1;
11673 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11675 if (hash_fmt_error
)
11677 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11684 char *user_buf
= NULL
;
11687 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11689 if (remove
|| show
)
11691 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11693 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11695 user_t
*user_ptr
= *user
;
11697 if (user_buf
!= NULL
)
11699 user_ptr
->user_name
= mystrdup (user_buf
);
11703 user_ptr
->user_name
= mystrdup ("");
11706 user_ptr
->user_len
= user_len
;
11710 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11712 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11714 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11719 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11722 if (hash_mode
== 3000)
11724 if (hash_len
== 32)
11726 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11728 if (parser_status
< PARSER_GLOBAL_ZERO
)
11730 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11735 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11739 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11741 if (parser_status
< PARSER_GLOBAL_ZERO
)
11743 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11748 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11750 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);
11756 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
);
11757 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
);
11761 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11763 if (parser_status
< PARSER_GLOBAL_ZERO
)
11765 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11770 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);
11772 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11773 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11780 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11782 if (parser_status
< PARSER_GLOBAL_ZERO
)
11784 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11789 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
11791 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11792 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11802 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11804 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11811 hashes_buf
[0].salt
->salt_len
= 8;
11813 // special salt handling
11817 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11818 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11820 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11822 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11824 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11826 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11828 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11830 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11832 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11834 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11836 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11838 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11839 hashes_buf
[0].salt
->scrypt_N
= 1024;
11840 hashes_buf
[0].salt
->scrypt_r
= 1;
11841 hashes_buf
[0].salt
->scrypt_p
= 1;
11843 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11845 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11846 hashes_buf
[0].salt
->scrypt_N
= 16384;
11847 hashes_buf
[0].salt
->scrypt_r
= 1;
11848 hashes_buf
[0].salt
->scrypt_p
= 1;
11850 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11852 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11854 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11856 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11858 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11860 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11862 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11864 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11866 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11868 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11870 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11872 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11874 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11876 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11878 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11882 // special esalt handling
11886 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11888 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11889 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11891 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11892 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11894 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11895 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11896 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11897 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11899 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11900 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11901 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11902 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11904 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
11906 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11907 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11908 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11910 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11911 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11912 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11914 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11915 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11916 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11918 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11919 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11920 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11922 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11923 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11924 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11926 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11927 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11928 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11930 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
11931 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
11932 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
11934 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
11936 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
11938 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
11939 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
11940 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
11949 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
11951 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
11953 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
11955 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
11957 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
11959 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
11961 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
11963 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
11965 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
11967 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
11969 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
11971 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
11973 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
11975 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
11977 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
11979 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
11981 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
11983 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
11985 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
11987 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
11989 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
11991 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
11993 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
11995 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
11997 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
11999 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12001 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12003 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12005 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12007 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12009 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12011 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12013 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12015 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12017 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12019 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12023 // set default iterations
12027 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12029 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12031 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12033 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12035 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12037 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12039 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12041 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12043 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12045 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12047 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12049 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12051 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12053 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12055 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12057 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12059 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12061 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12063 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12065 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12067 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12069 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12071 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12073 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12075 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12077 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12079 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12081 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12083 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12085 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12087 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12089 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12091 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12093 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12095 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12097 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12099 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12101 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12103 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12105 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12107 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12109 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12111 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12113 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12115 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12117 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12119 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12121 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12123 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12125 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12127 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12129 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12131 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12133 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12135 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12137 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12139 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12141 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12143 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12145 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12147 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12149 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12151 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12153 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12155 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12157 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12159 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12161 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12163 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12165 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12167 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12169 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12171 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12173 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12175 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12177 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12179 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12181 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12183 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12185 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12187 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12189 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12196 if (show
== 1 || left
== 1)
12198 for (uint i
= 0; i
< pot_cnt
; i
++)
12200 pot_t
*pot_ptr
= &pot
[i
];
12202 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12204 local_free (hashes_buf
->digest
);
12208 local_free (hashes_buf
->salt
);
12214 if (data
.quiet
== 0) log_info_nn ("");
12221 if (hashes_cnt
== 0)
12223 log_error ("ERROR: No hashes loaded");
12230 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12233 if (data
.outfile
!= NULL
)
12235 if (data
.hashfile
!= NULL
)
12238 struct stat tmpstat_outfile
;
12239 struct stat tmpstat_hashfile
;
12243 struct stat64 tmpstat_outfile
;
12244 struct stat64 tmpstat_hashfile
;
12247 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12249 if (tmp_outfile_fp
)
12252 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12256 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12259 fclose (tmp_outfile_fp
);
12262 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12264 if (tmp_hashfile_fp
)
12267 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12271 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12274 fclose (tmp_hashfile_fp
);
12277 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12279 tmpstat_outfile
.st_mode
= 0;
12280 tmpstat_outfile
.st_nlink
= 0;
12281 tmpstat_outfile
.st_uid
= 0;
12282 tmpstat_outfile
.st_gid
= 0;
12283 tmpstat_outfile
.st_rdev
= 0;
12284 tmpstat_outfile
.st_atime
= 0;
12286 tmpstat_hashfile
.st_mode
= 0;
12287 tmpstat_hashfile
.st_nlink
= 0;
12288 tmpstat_hashfile
.st_uid
= 0;
12289 tmpstat_hashfile
.st_gid
= 0;
12290 tmpstat_hashfile
.st_rdev
= 0;
12291 tmpstat_hashfile
.st_atime
= 0;
12294 tmpstat_outfile
.st_blksize
= 0;
12295 tmpstat_outfile
.st_blocks
= 0;
12297 tmpstat_hashfile
.st_blksize
= 0;
12298 tmpstat_hashfile
.st_blocks
= 0;
12302 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12304 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12311 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12313 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12323 * Remove duplicates
12326 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12330 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12334 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12337 uint hashes_cnt_orig
= hashes_cnt
;
12341 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12345 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12347 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12352 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12355 if (hashes_pos
> hashes_cnt
)
12357 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12367 uint potfile_remove_cracks
= 0;
12369 if (potfile_disable
== 0)
12373 hash_buf
.digest
= mymalloc (dgst_size
);
12374 hash_buf
.salt
= NULL
;
12375 hash_buf
.esalt
= NULL
;
12376 hash_buf
.hash_info
= NULL
;
12377 hash_buf
.cracked
= 0;
12381 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12386 hash_buf
.esalt
= mymalloc (esalt_size
);
12389 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12391 // no solution for these special hash types (for instane because they use hashfile in output etc)
12392 if ((hash_mode
!= 5200) &&
12393 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12394 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12395 (hash_mode
!= 9000))
12397 FILE *fp
= fopen (potfile
, "rb");
12401 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12403 // to be safe work with a copy (because of line_len loop, i etc)
12404 // moved up here because it's easier to handle continue case
12407 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12411 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12413 if (ptr
== NULL
) break;
12415 int line_len
= strlen (line_buf
);
12417 if (line_len
== 0) continue;
12419 int iter
= MAX_CUT_TRIES
;
12421 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12423 if (line_buf
[i
] != ':') continue;
12427 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12430 hash_t
*found
= NULL
;
12432 if (hash_mode
== 6800)
12434 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12436 // manipulate salt_buf
12437 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12439 hash_buf
.salt
->salt_len
= i
;
12441 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12444 else if (hash_mode
== 2500)
12446 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12448 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12449 // manipulate salt_buf
12451 memcpy (line_buf_cpy
, line_buf
, i
);
12453 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12455 if (mac2_pos
== NULL
) continue;
12460 if (strlen (mac2_pos
) != 12) continue;
12462 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12464 if (mac1_pos
== NULL
) continue;
12469 if (strlen (mac1_pos
) != 12) continue;
12471 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12473 // here we need the ESSID
12474 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12476 hash_buf
.salt
->salt_len
= essid_length
;
12478 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12482 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12484 // compare hex string(s) vs binary MAC address(es)
12486 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12488 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12497 if (!found
) continue;
12499 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12501 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12513 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12515 if (parser_status
== PARSER_OK
)
12519 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12523 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12528 if (found
== NULL
) continue;
12530 if (!found
->cracked
) potfile_remove_cracks
++;
12532 found
->cracked
= 1;
12540 myfree (line_buf_cpy
);
12550 local_free (hash_buf
.esalt
);
12555 local_free (hash_buf
.salt
);
12558 local_free (hash_buf
.digest
);
12562 * Now generate all the buffers required for later
12565 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12567 salt_t
*salts_buf_new
= NULL
;
12568 void *esalts_buf_new
= NULL
;
12572 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12576 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12581 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12584 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12586 uint digests_cnt
= hashes_cnt
;
12587 uint digests_done
= 0;
12589 size_t size_digests
= digests_cnt
* dgst_size
;
12590 size_t size_shown
= digests_cnt
* sizeof (uint
);
12592 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12593 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12595 uint salts_cnt
= 0;
12596 uint salts_done
= 0;
12598 hashinfo_t
**hash_info
= NULL
;
12600 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12602 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12604 if (username
&& (remove
|| show
))
12608 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12610 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12612 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12617 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12622 // copied from inner loop
12624 salt_buf
= &salts_buf_new
[salts_cnt
];
12626 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12630 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12633 salt_buf
->digests_cnt
= 0;
12634 salt_buf
->digests_done
= 0;
12635 salt_buf
->digests_offset
= 0;
12640 if (hashes_buf
[0].cracked
== 1)
12642 digests_shown
[0] = 1;
12646 salt_buf
->digests_done
++;
12649 salt_buf
->digests_cnt
++;
12651 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12653 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12655 hash_info
[0] = hashes_buf
[0].hash_info
;
12658 // copy from inner loop
12660 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12664 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12666 salt_buf
= &salts_buf_new
[salts_cnt
];
12668 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12672 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12675 salt_buf
->digests_cnt
= 0;
12676 salt_buf
->digests_done
= 0;
12677 salt_buf
->digests_offset
= hashes_pos
;
12683 if (hashes_buf
[hashes_pos
].cracked
== 1)
12685 digests_shown
[hashes_pos
] = 1;
12689 salt_buf
->digests_done
++;
12692 salt_buf
->digests_cnt
++;
12694 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12696 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12698 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12702 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12704 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12706 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12708 salts_shown
[salt_pos
] = 1;
12713 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12716 local_free (digests_buf
);
12717 local_free (salts_buf
);
12718 local_free (esalts_buf
);
12720 digests_buf
= digests_buf_new
;
12721 salts_buf
= salts_buf_new
;
12722 esalts_buf
= esalts_buf_new
;
12724 local_free (hashes_buf
);
12727 * special modification not set from parser
12732 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12733 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12734 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12735 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12736 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12737 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12738 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12739 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12740 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12741 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12742 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12743 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12744 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12745 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12746 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12747 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12748 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12749 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12750 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12751 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12752 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12753 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12754 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12755 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12756 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12757 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12758 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12759 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12760 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12761 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12764 if (truecrypt_keyfiles
)
12766 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12768 char *keyfiles
= strdup (truecrypt_keyfiles
);
12770 char *keyfile
= strtok (keyfiles
, ",");
12774 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12776 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12781 if (veracrypt_keyfiles
)
12783 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12785 char *keyfiles
= strdup (veracrypt_keyfiles
);
12787 char *keyfile
= strtok (keyfiles
, ",");
12791 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12793 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12798 data
.digests_cnt
= digests_cnt
;
12799 data
.digests_done
= digests_done
;
12800 data
.digests_buf
= digests_buf
;
12801 data
.digests_shown
= digests_shown
;
12802 data
.digests_shown_tmp
= digests_shown_tmp
;
12804 data
.salts_cnt
= salts_cnt
;
12805 data
.salts_done
= salts_done
;
12806 data
.salts_buf
= salts_buf
;
12807 data
.salts_shown
= salts_shown
;
12809 data
.esalts_buf
= esalts_buf
;
12810 data
.hash_info
= hash_info
;
12813 * Automatic Optimizers
12816 if (salts_cnt
== 1)
12817 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12819 if (digests_cnt
== 1)
12820 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12822 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12823 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12825 if (attack_mode
== ATTACK_MODE_BF
)
12826 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12828 data
.opti_type
= opti_type
;
12830 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12832 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12834 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12836 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12838 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12839 opts_type
|= OPTS_TYPE_PT_ADD80
;
12842 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12844 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12845 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12848 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12850 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12851 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12858 * Some algorithm, like descrypt, can benefit from JIT compilation
12861 int force_jit_compilation
= -1;
12863 if (hash_mode
== 8900)
12865 force_jit_compilation
= 8900;
12867 else if (hash_mode
== 9300)
12869 force_jit_compilation
= 8900;
12871 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12873 force_jit_compilation
= 1500;
12877 * generate bitmap tables
12880 const uint bitmap_shift1
= 5;
12881 const uint bitmap_shift2
= 13;
12883 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12885 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12886 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12887 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12888 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12889 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12890 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12891 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12892 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12899 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12901 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12903 bitmap_nums
= 1 << bitmap_bits
;
12905 bitmap_mask
= bitmap_nums
- 1;
12907 bitmap_size
= bitmap_nums
* sizeof (uint
);
12909 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12911 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;
12912 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;
12917 bitmap_nums
= 1 << bitmap_bits
;
12919 bitmap_mask
= bitmap_nums
- 1;
12921 bitmap_size
= bitmap_nums
* sizeof (uint
);
12923 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);
12924 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);
12927 * prepare quick rule
12930 data
.rule_buf_l
= rule_buf_l
;
12931 data
.rule_buf_r
= rule_buf_r
;
12933 int rule_len_l
= (int) strlen (rule_buf_l
);
12934 int rule_len_r
= (int) strlen (rule_buf_r
);
12936 data
.rule_len_l
= rule_len_l
;
12937 data
.rule_len_r
= rule_len_r
;
12943 uint
*all_kernel_rules_cnt
= NULL
;
12945 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
12949 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12951 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
12954 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
12958 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12960 uint kernel_rules_avail
= 0;
12962 uint kernel_rules_cnt
= 0;
12964 kernel_rule_t
*kernel_rules_buf
= NULL
;
12966 char *rp_file
= rp_files
[i
];
12968 char in
[BLOCK_SIZE
] = { 0 };
12969 char out
[BLOCK_SIZE
] = { 0 };
12973 uint rule_line
= 0;
12975 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12977 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12984 memset (rule_buf
, 0, HCBUFSIZ
);
12986 rule_len
= fgetl (fp
, rule_buf
);
12990 if (rule_len
== 0) continue;
12992 if (rule_buf
[0] == '#') continue;
12994 if (kernel_rules_avail
== kernel_rules_cnt
)
12996 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
12998 kernel_rules_avail
+= INCR_RULES
;
13001 memset (in
, 0, BLOCK_SIZE
);
13002 memset (out
, 0, BLOCK_SIZE
);
13004 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13008 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13013 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13015 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13017 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13023 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13025 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13031 kernel_rules_cnt
++;
13036 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13038 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13042 * merge rules or automatic rule generator
13045 uint kernel_rules_cnt
= 0;
13047 kernel_rule_t
*kernel_rules_buf
= NULL
;
13049 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13053 kernel_rules_cnt
= 1;
13055 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13057 repeats
[0] = kernel_rules_cnt
;
13059 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13061 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13063 repeats
[i
+ 1] = kernel_rules_cnt
;
13066 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13068 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13070 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13074 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13076 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13078 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13081 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13083 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13085 if (out_pos
== RULES_MAX
- 1)
13087 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13092 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13097 local_free (repeats
);
13101 uint kernel_rules_avail
= 0;
13103 while (kernel_rules_cnt
< rp_gen
)
13105 if (kernel_rules_avail
== kernel_rules_cnt
)
13107 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13109 kernel_rules_avail
+= INCR_RULES
;
13112 memset (rule_buf
, 0, HCBUFSIZ
);
13114 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13116 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13118 kernel_rules_cnt
++;
13126 * generate NOP rules
13129 if (kernel_rules_cnt
== 0)
13131 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13133 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13135 kernel_rules_cnt
++;
13138 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13139 data
.kernel_rules_buf
= kernel_rules_buf
;
13142 * OpenCL platforms: detect
13145 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13146 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13148 cl_uint platforms_cnt
= 0;
13149 cl_uint platform_devices_cnt
= 0;
13153 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13155 if (platforms_cnt
== 0)
13158 log_info ("ATTENTION! No OpenCL compatible platform found");
13160 log_info ("You're probably missing the OpenCL runtime installation");
13161 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13162 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13163 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13169 if (opencl_platforms_filter
!= (uint
) -1)
13171 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13173 if (opencl_platforms_filter
> platform_cnt_mask
)
13175 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13183 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13186 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13188 cl_platform_id platform
= platforms
[platform_id
];
13190 char platform_vendor
[INFOSZ
] = { 0 };
13192 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13195 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13196 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13198 // make sure that we do not directly control the fan for NVidia
13200 gpu_temp_retain
= 0;
13202 data
.gpu_temp_retain
= gpu_temp_retain
;
13204 #endif // HAVE_NVML || HAVE_NVAPI
13209 * OpenCL device types:
13210 * 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.
13211 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13214 if (opencl_device_types
== NULL
)
13216 cl_device_type device_types_all
= 0;
13218 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13220 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13222 cl_platform_id platform
= platforms
[platform_id
];
13224 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13226 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13228 cl_device_id device
= platform_devices
[platform_devices_id
];
13230 cl_device_type device_type
;
13232 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13234 device_types_all
|= device_type
;
13238 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13240 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13245 * OpenCL devices: simply push all devices from all platforms into the same device array
13248 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13250 data
.devices_param
= devices_param
;
13252 uint devices_cnt
= 0;
13254 uint devices_active
= 0;
13256 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13258 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13260 cl_platform_id platform
= platforms
[platform_id
];
13262 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13264 char platform_vendor
[INFOSZ
] = { 0 };
13266 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13268 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13269 // this causes trouble with vendor id based macros
13270 // we'll assign generic to those without special optimization available
13272 cl_uint platform_vendor_id
= 0;
13274 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13276 platform_vendor_id
= VENDOR_ID_AMD
;
13278 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13280 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13282 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13284 platform_vendor_id
= VENDOR_ID_APPLE
;
13286 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13288 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13290 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13292 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13294 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13296 platform_vendor_id
= VENDOR_ID_MESA
;
13298 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13300 platform_vendor_id
= VENDOR_ID_NV
;
13302 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13304 platform_vendor_id
= VENDOR_ID_POCL
;
13308 platform_vendor_id
= VENDOR_ID_GENERIC
;
13311 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13313 size_t param_value_size
= 0;
13315 const uint device_id
= devices_cnt
;
13317 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13319 device_param
->platform_vendor_id
= platform_vendor_id
;
13321 device_param
->device
= platform_devices
[platform_devices_id
];
13323 device_param
->device_id
= device_id
;
13325 device_param
->platform_devices_id
= platform_devices_id
;
13329 cl_device_type device_type
;
13331 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13333 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13335 device_param
->device_type
= device_type
;
13339 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13341 char *device_name
= (char *) mymalloc (param_value_size
);
13343 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13345 device_param
->device_name
= device_name
;
13349 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13351 char *device_vendor
= (char *) mymalloc (param_value_size
);
13353 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13355 device_param
->device_vendor
= device_vendor
;
13357 cl_uint device_vendor_id
= 0;
13359 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13361 device_vendor_id
= VENDOR_ID_AMD
;
13363 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13365 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13367 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13369 device_vendor_id
= VENDOR_ID_APPLE
;
13371 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13373 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13375 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13377 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13379 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13381 device_vendor_id
= VENDOR_ID_MESA
;
13383 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13385 device_vendor_id
= VENDOR_ID_NV
;
13387 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13389 device_vendor_id
= VENDOR_ID_POCL
;
13393 device_vendor_id
= VENDOR_ID_GENERIC
;
13396 device_param
->device_vendor_id
= device_vendor_id
;
13400 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13404 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13406 char *device_version
= (char *) mymalloc (param_value_size
);
13408 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13410 device_param
->device_version
= device_version
;
13412 // device_opencl_version
13414 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13416 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13418 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13420 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13422 myfree (device_opencl_version
);
13426 cl_uint vector_width
;
13428 if (opencl_vector_width_chgd
== 0)
13430 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13432 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13434 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13438 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13443 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13448 vector_width
= opencl_vector_width
;
13451 if (vector_width
> 16) vector_width
= 16;
13453 device_param
->vector_width
= vector_width
;
13455 // max_compute_units
13457 cl_uint device_processors
;
13459 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13461 device_param
->device_processors
= device_processors
;
13463 // device_maxmem_alloc
13464 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13466 cl_ulong device_maxmem_alloc
;
13468 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13470 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13472 // device_global_mem
13474 cl_ulong device_global_mem
;
13476 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13478 device_param
->device_global_mem
= device_global_mem
;
13480 // max_work_group_size
13482 size_t device_maxworkgroup_size
;
13484 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13486 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13488 // max_clock_frequency
13490 cl_uint device_maxclock_frequency
;
13492 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13494 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13496 // device_endian_little
13498 cl_bool device_endian_little
;
13500 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13502 if (device_endian_little
== CL_FALSE
)
13504 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13506 device_param
->skipped
= 1;
13509 // device_available
13511 cl_bool device_available
;
13513 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13515 if (device_available
== CL_FALSE
)
13517 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13519 device_param
->skipped
= 1;
13522 // device_compiler_available
13524 cl_bool device_compiler_available
;
13526 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13528 if (device_compiler_available
== CL_FALSE
)
13530 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13532 device_param
->skipped
= 1;
13535 // device_execution_capabilities
13537 cl_device_exec_capabilities device_execution_capabilities
;
13539 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13541 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13543 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13545 device_param
->skipped
= 1;
13548 // device_extensions
13550 size_t device_extensions_size
;
13552 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13554 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13556 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13558 if (strstr (device_extensions
, "base_atomics") == 0)
13560 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13562 device_param
->skipped
= 1;
13565 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13567 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13569 device_param
->skipped
= 1;
13572 myfree (device_extensions
);
13574 // device_local_mem_size
13576 cl_ulong device_local_mem_size
;
13578 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13580 if (device_local_mem_size
< 32768)
13582 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13584 device_param
->skipped
= 1;
13587 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13588 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13589 // This results in both utilizing it for 50%
13590 // However, Intel has much better SIMD control over their own hardware
13591 // It makes sense to give them full control over their own hardware
13593 if (device_type
& CL_DEVICE_TYPE_CPU
)
13595 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13597 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13599 device_param
->skipped
= 1;
13605 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13606 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13610 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13612 char *driver_version
= (char *) mymalloc (param_value_size
);
13614 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13616 device_param
->driver_version
= driver_version
;
13618 // device_name_chksum
13620 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13623 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
);
13625 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
);
13628 uint device_name_digest
[4] = { 0 };
13630 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13632 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13634 device_param
->device_name_chksum
= device_name_chksum
;
13636 // device_processor_cores
13638 if (device_type
& CL_DEVICE_TYPE_CPU
)
13640 cl_uint device_processor_cores
= 1;
13642 device_param
->device_processor_cores
= device_processor_cores
;
13645 if (device_type
& CL_DEVICE_TYPE_GPU
)
13647 if (device_vendor_id
== VENDOR_ID_AMD
)
13649 cl_uint device_processor_cores
= 0;
13651 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13653 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13655 device_param
->device_processor_cores
= device_processor_cores
;
13657 else if (device_vendor_id
== VENDOR_ID_NV
)
13659 cl_uint kernel_exec_timeout
= 0;
13661 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13663 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13665 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13667 cl_uint device_processor_cores
= 0;
13669 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13671 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13673 device_param
->device_processor_cores
= device_processor_cores
;
13675 cl_uint sm_minor
= 0;
13676 cl_uint sm_major
= 0;
13678 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13679 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13681 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13682 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13684 device_param
->sm_minor
= sm_minor
;
13685 device_param
->sm_major
= sm_major
;
13689 cl_uint device_processor_cores
= 1;
13691 device_param
->device_processor_cores
= device_processor_cores
;
13697 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13699 if (machine_readable
== 0)
13701 if (device_param
->skipped
== 0)
13703 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %dMhz, %uMCU",
13706 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13707 (unsigned int) (device_global_mem
/ 1024 / 1024),
13708 (unsigned int) (device_maxclock_frequency
),
13709 (unsigned int) device_processors
);
13713 log_info ("Device #%u: %s, skipped",
13720 // common driver check
13722 if (device_param
->skipped
== 0)
13724 if (device_type
& CL_DEVICE_TYPE_GPU
)
13726 if (platform_vendor_id
== VENDOR_ID_AMD
)
13728 int catalyst_check
= (force
== 1) ? 0 : 1;
13730 int catalyst_warn
= 0;
13732 int catalyst_broken
= 0;
13734 if (catalyst_check
== 1)
13738 // v14.9 and higher
13739 if (atoi (device_param
->driver_version
) >= 1573)
13744 catalyst_check
= 0;
13747 if (catalyst_broken
== 1)
13750 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13751 log_info ("It will pass over cracked hashes and does not report them as cracked");
13752 log_info ("You are STRONGLY encouraged not to use it");
13753 log_info ("You can use --force to override this but do not post error reports if you do so");
13759 if (catalyst_warn
== 1)
13762 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13763 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13764 log_info ("See hashcat's homepage for official supported catalyst drivers");
13766 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13768 log_info ("You can use --force to override this but do not post error reports if you do so");
13774 else if (platform_vendor_id
== VENDOR_ID_NV
)
13776 if (device_param
->kernel_exec_timeout
!= 0)
13778 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);
13779 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13784 /* turns out pocl still creates segfaults (because of llvm)
13785 if (device_type & CL_DEVICE_TYPE_CPU)
13787 if (platform_vendor_id == VENDOR_ID_AMD)
13792 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13793 log_info ("You are STRONGLY encouraged not to use it");
13794 log_info ("You can use --force to override this but do not post error reports if you do so");
13795 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13805 * kernel accel and loops tuning db adjustment
13808 device_param
->kernel_accel_min
= 1;
13809 device_param
->kernel_accel_max
= 1024;
13811 device_param
->kernel_loops_min
= 1;
13812 device_param
->kernel_loops_max
= 1024;
13814 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13816 if (tuningdb_entry
)
13818 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13819 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13823 device_param
->kernel_accel_min
= _kernel_accel
;
13824 device_param
->kernel_accel_max
= _kernel_accel
;
13829 if (workload_profile
== 1)
13831 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13833 else if (workload_profile
== 2)
13835 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13838 device_param
->kernel_loops_min
= _kernel_loops
;
13839 device_param
->kernel_loops_max
= _kernel_loops
;
13843 // commandline parameters overwrite tuningdb entries
13847 device_param
->kernel_accel_min
= kernel_accel
;
13848 device_param
->kernel_accel_max
= kernel_accel
;
13853 device_param
->kernel_loops_min
= kernel_loops
;
13854 device_param
->kernel_loops_max
= kernel_loops
;
13870 if (keyspace
== 0 && devices_active
== 0)
13872 log_error ("ERROR: No devices found/left");
13877 // 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)
13879 if (devices_filter
!= (uint
) -1)
13881 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13883 if (devices_filter
> devices_cnt_mask
)
13885 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13891 data
.devices_cnt
= devices_cnt
;
13893 data
.devices_active
= devices_active
;
13895 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13897 if (machine_readable
== 0)
13908 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13909 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13913 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13916 if (gpu_temp_disable
== 0)
13918 #if defined(WIN) && defined(HAVE_NVAPI)
13919 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
13921 if (nvapi_init (nvapi
) == 0)
13922 data
.hm_nv
= nvapi
;
13926 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
13928 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13930 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
13934 for (int i
= 0; i
< tmp_in
; i
++)
13936 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
13939 for (int i
= 0; i
< tmp_out
; i
++)
13941 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
13943 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
13945 if (hm_NvAPI_GPU_GetCoolerSettings (data
.hm_nv
, hm_adapters_nv
[i
].adapter_index
.nv
, 0, &pCoolerSettings
) != NVAPI_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
13949 #endif // WIN && HAVE_NVAPI
13951 #if defined(LINUX) && defined(HAVE_NVML)
13952 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
13954 if (nvml_init (nvml
) == 0)
13959 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
13961 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13963 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
13967 for (int i
= 0; i
< tmp_in
; i
++)
13969 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
13972 for (int i
= 0; i
< tmp_out
; i
++)
13974 unsigned int speed
;
13976 if (hm_NVML_nvmlDeviceGetFanSpeed (data
.hm_nv
, 1, hm_adapters_nv
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapters_nv
[i
].fan_supported
= 1;
13980 #endif // LINUX && HAVE_NVML
13982 data
.hm_amd
= NULL
;
13985 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
13987 if (adl_init (adl
) == 0)
13992 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
13994 // total number of adapters
13996 int hm_adapters_num
;
13998 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14002 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14004 if (lpAdapterInfo
== NULL
) return (-1);
14006 // get a list (of ids of) valid/usable adapters
14008 int num_adl_adapters
= 0;
14010 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14012 if (num_adl_adapters
> 0)
14014 hc_thread_mutex_lock (mux_adl
);
14016 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14018 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14020 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14021 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14023 hc_thread_mutex_unlock (mux_adl
);
14026 myfree (valid_adl_device_list
);
14027 myfree (lpAdapterInfo
);
14032 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14034 gpu_temp_disable
= 1;
14039 * OpenCL devices: allocate buffer for device specific information
14043 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14046 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14048 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14053 * enable custom signal handler(s)
14056 if (benchmark
== 0)
14058 hc_signal (sigHandler_default
);
14062 hc_signal (sigHandler_benchmark
);
14066 * User-defined GPU temp handling
14070 if (gpu_temp_disable
== 1)
14072 gpu_temp_abort
= 0;
14073 gpu_temp_retain
= 0;
14076 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14078 if (gpu_temp_abort
< gpu_temp_retain
)
14080 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14086 data
.gpu_temp_disable
= gpu_temp_disable
;
14087 data
.gpu_temp_abort
= gpu_temp_abort
;
14088 data
.gpu_temp_retain
= gpu_temp_retain
;
14095 if (data
.quiet
== 0)
14097 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14099 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
);
14101 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14103 log_info ("Rules: %u", kernel_rules_cnt
);
14108 log_info ("Applicable Optimizers:");
14110 for (uint i
= 0; i
< 32; i
++)
14112 const uint opti_bit
= 1u << i
;
14114 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14119 * Watchdog and Temperature balance
14123 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14125 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14128 if (gpu_temp_abort
== 0)
14130 log_info ("Watchdog: Temperature abort trigger disabled");
14134 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14137 if (gpu_temp_retain
== 0)
14139 log_info ("Watchdog: Temperature retain trigger disabled");
14143 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14146 if (data
.quiet
== 0) log_info ("");
14154 if (gpu_temp_disable
== 0)
14156 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14158 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14160 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14162 if (device_param
->skipped
) continue;
14164 const uint platform_devices_id
= device_param
->platform_devices_id
;
14166 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14167 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14169 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14174 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14176 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14184 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14185 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14186 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14187 * Driver / ADL bug?
14191 if (powertune_enable
== 1)
14193 hc_thread_mutex_lock (mux_adl
);
14195 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14197 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14199 if (device_param
->skipped
) continue;
14201 if (data
.hm_device
[device_id
].od_version
== 6)
14203 // set powertune value only
14205 int powertune_supported
= 0;
14209 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14211 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14216 if (powertune_supported
!= 0)
14219 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14221 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14223 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14228 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14230 log_error ("ERROR: Failed to set new ADL PowerControl values");
14238 hc_thread_mutex_unlock (mux_adl
);
14241 #endif // HAVE_HWMON
14244 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14247 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14249 uint kernel_power_all
= 0;
14251 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14257 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14259 if (device_param
->skipped
) continue;
14262 * device properties
14265 const char *device_name_chksum
= device_param
->device_name_chksum
;
14266 const u32 device_processors
= device_param
->device_processors
;
14267 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14270 * create context for each device
14273 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14276 * create command-queue
14279 // not supported with NV
14280 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14282 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14285 * kernel threads: some algorithms need a fixed kernel-threads count
14286 * because of shared memory usage or bitslice
14287 * there needs to be some upper limit, otherwise there's too much overhead
14290 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14292 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14294 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14297 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14298 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14299 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14300 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14301 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14302 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14303 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14304 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14305 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14306 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14307 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14308 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14309 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14312 * create input buffers on device : calculate size of fixed memory buffers
14315 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14316 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14318 device_param
->size_root_css
= size_root_css
;
14319 device_param
->size_markov_css
= size_markov_css
;
14321 size_t size_results
= sizeof (uint
);
14323 device_param
->size_results
= size_results
;
14325 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14326 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14328 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14329 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14330 size_t size_esalts
= salts_cnt
* esalt_size
;
14332 device_param
->size_plains
= size_plains
;
14333 device_param
->size_digests
= size_digests
;
14334 device_param
->size_shown
= size_shown
;
14335 device_param
->size_salts
= size_salts
;
14337 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14338 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14339 size_t size_tm
= 32 * sizeof (bs_word_t
);
14343 size_t size_scryptV
= 1;
14345 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14347 uint tmto_start
= 0;
14348 uint tmto_stop
= 10;
14352 tmto_start
= scrypt_tmto
;
14356 // in case the user did not specify the tmto manually
14357 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14358 // but set the lower end only in case the user has a device with too less memory
14360 if (hash_mode
== 8900)
14362 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14366 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14371 else if (hash_mode
== 9300)
14373 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14377 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14384 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14386 // TODO: in theory the following calculation needs to be done per salt, not global
14387 // we assume all hashes have the same scrypt settings
14389 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14391 size_scryptV
/= 1 << tmto
;
14393 size_scryptV
*= device_processors
* device_processor_cores
;
14395 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14397 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14402 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14404 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14405 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14411 if (data
.salts_buf
[0].scrypt_phy
== 0)
14413 log_error ("ERROR: can't allocate enough device memory");
14418 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14422 * some algorithms need a fixed kernel-loops count
14425 if (hash_mode
== 1500)
14427 const u32 kernel_loops_fixed
= 1024;
14429 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14430 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14433 if (hash_mode
== 3000)
14435 const u32 kernel_loops_fixed
= 1024;
14437 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14438 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14441 if (hash_mode
== 8900)
14443 const u32 kernel_loops_fixed
= 1;
14445 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14446 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14449 if (hash_mode
== 9300)
14451 const u32 kernel_loops_fixed
= 1;
14453 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14454 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14457 if (hash_mode
== 12500)
14459 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14461 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14462 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14466 * some algorithms have a maximum kernel-loops count
14469 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14471 u32 innerloop_cnt
= 0;
14473 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14475 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14476 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14477 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14481 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14484 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14485 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14487 device_param
->kernel_loops_max
= innerloop_cnt
;
14491 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14492 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14494 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14496 size_t size_pws
= 4;
14497 size_t size_tmps
= 4;
14498 size_t size_hooks
= 4;
14500 while (kernel_accel_max
>= kernel_accel_min
)
14502 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14506 size_pws
= kernel_power_max
* sizeof (pw_t
);
14512 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14513 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14514 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14515 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14516 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14517 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14518 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14519 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14520 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14521 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14522 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14523 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14524 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14525 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14526 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14527 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14528 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14529 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14530 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14531 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14532 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14533 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14534 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14535 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14536 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14537 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14538 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14539 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14540 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14541 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14542 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14543 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14544 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14545 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14546 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14547 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14548 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14549 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14550 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14551 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14552 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14553 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14554 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14555 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14556 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14557 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14558 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14559 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14560 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14561 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14562 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14563 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14564 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14565 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14566 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14567 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14568 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14569 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14570 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14571 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14572 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14573 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14574 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14575 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14576 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14577 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14578 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14579 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14580 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14581 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14582 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14583 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14584 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14585 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14586 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14587 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14588 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14589 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14590 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14591 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14592 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14593 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14598 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14603 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14604 // if not, decrease amplifier and try again
14608 const u64 size_total
14625 + size_pws
// not a bug
14636 // Don't ask me, ask AMD!
14638 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14639 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14643 kernel_accel_max
--;
14652 if (kernel_accel_max == 0)
14654 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14660 device_param
->kernel_accel_min
= kernel_accel_min
;
14661 device_param
->kernel_accel_max
= kernel_accel_max
;
14664 if (kernel_accel_max < kernel_accel)
14666 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14668 device_param->kernel_accel = kernel_accel_max;
14672 device_param
->size_bfs
= size_bfs
;
14673 device_param
->size_combs
= size_combs
;
14674 device_param
->size_rules
= size_rules
;
14675 device_param
->size_rules_c
= size_rules_c
;
14676 device_param
->size_pws
= size_pws
;
14677 device_param
->size_tmps
= size_tmps
;
14678 device_param
->size_hooks
= size_hooks
;
14680 // do not confuse kernel_accel_max with kernel_accel here
14682 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14684 device_param
->kernel_threads
= kernel_threads
;
14685 device_param
->kernel_power_user
= kernel_power
;
14687 kernel_power_all
+= kernel_power
;
14690 * default building options
14693 char build_opts
[1024] = { 0 };
14695 // we don't have sm_* on vendors not NV but it doesn't matter
14698 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s\\OpenCL\\\" -I '%s\\OpenCL\\' -I %s\\OpenCL\\ -I\"%s\\OpenCL\\\" -I'%s\\OpenCL\\' -I%s\\OpenCL\\", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14700 snprintf (build_opts
, sizeof (build_opts
) - 1, "-I \"%s/OpenCL/\" -I '%s/OpenCL/' -I %s/OpenCL/ -I\"%s/OpenCL/\" -I'%s/OpenCL/' -I%s/OpenCL/", shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
, shared_dir
);
14703 char build_opts_new
[1024] = { 0 };
14705 snprintf (build_opts_new
, sizeof (build_opts_new
) - 1, "%s -DVENDOR_ID=%u -DCUDA_ARCH=%d -DVECT_SIZE=%u -DDEVICE_TYPE=%u -DKERN_TYPE=%u -D_unroll -cl-std=CL1.1", build_opts
, device_param
->device_vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
, device_param
->vector_width
, (u32
) device_param
->device_type
, kern_type
);
14707 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14710 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14712 // we do vectorizing much better than the auto-vectorizer
14714 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14716 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14721 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14730 * kernel source filename
14733 char source_file
[256] = { 0 };
14735 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14739 if (stat (source_file
, &sst
) == -1)
14741 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14747 * kernel cached filename
14750 char cached_file
[256] = { 0 };
14752 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14758 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14764 * kernel compile or load
14767 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14769 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14771 if (force_jit_compilation
== -1)
14775 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14777 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14779 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14781 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14784 size_t build_log_size
= 0;
14786 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14788 if (build_log_size
> 1)
14790 char *build_log
= (char *) malloc (build_log_size
+ 1);
14792 memset (build_log
, 0, build_log_size
+ 1);
14794 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14804 device_param
->skipped
= true;
14806 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14811 size_t binary_size
;
14813 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14815 u8
*binary
= (u8
*) mymalloc (binary_size
);
14817 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14819 writeProgramBin (cached_file
, binary
, binary_size
);
14821 local_free (binary
);
14826 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14829 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14831 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14833 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14839 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14842 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14844 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14846 char build_opts_update
[1024] = { 0 };
14848 if (force_jit_compilation
== 1500)
14850 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14852 else if (force_jit_compilation
== 8900)
14854 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DSCRYPT_N=%d -DSCRYPT_R=%d -DSCRYPT_P=%d -DSCRYPT_TMTO=%d", build_opts
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, 1 << data
.salts_buf
[0].scrypt_tmto
);
14858 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14861 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14864 size_t build_log_size
= 0;
14866 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14868 if (build_log_size
> 1)
14870 char *build_log
= (char *) malloc (build_log_size
+ 1);
14872 memset (build_log
, 0, build_log_size
+ 1);
14874 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14884 device_param
->skipped
= true;
14886 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14890 local_free (kernel_lengths
);
14891 local_free (kernel_sources
[0]);
14892 local_free (kernel_sources
);
14896 * word generator kernel
14899 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14902 * kernel mp source filename
14905 char source_file
[256] = { 0 };
14907 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14911 if (stat (source_file
, &sst
) == -1)
14913 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14919 * kernel mp cached filename
14922 char cached_file
[256] = { 0 };
14924 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
14930 if (stat (cached_file
, &cst
) == -1)
14936 * kernel compile or load
14939 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14941 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14945 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14946 if (quiet
== 0) log_info ("");
14948 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14950 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14952 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14956 device_param
->skipped
= true;
14958 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14963 size_t binary_size
;
14965 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14967 u8
*binary
= (u8
*) mymalloc (binary_size
);
14969 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14971 writeProgramBin (cached_file
, binary
, binary_size
);
14973 local_free (binary
);
14978 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14981 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14983 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14985 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14988 local_free (kernel_lengths
);
14989 local_free (kernel_sources
[0]);
14990 local_free (kernel_sources
);
14997 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15004 * kernel amp source filename
15007 char source_file
[256] = { 0 };
15009 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15013 if (stat (source_file
, &sst
) == -1)
15015 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15021 * kernel amp cached filename
15024 char cached_file
[256] = { 0 };
15026 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15032 if (stat (cached_file
, &cst
) == -1)
15038 * kernel compile or load
15041 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15043 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15047 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15048 if (quiet
== 0) log_info ("");
15050 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15052 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15054 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15058 device_param
->skipped
= true;
15060 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15065 size_t binary_size
;
15067 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15069 u8
*binary
= (u8
*) mymalloc (binary_size
);
15071 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15073 writeProgramBin (cached_file
, binary
, binary_size
);
15075 local_free (binary
);
15080 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15083 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15085 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15087 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15090 local_free (kernel_lengths
);
15091 local_free (kernel_sources
[0]);
15092 local_free (kernel_sources
);
15095 // some algorithm collide too fast, make that impossible
15097 if (benchmark
== 1)
15099 ((uint
*) digests_buf
)[0] = -1;
15100 ((uint
*) digests_buf
)[1] = -1;
15101 ((uint
*) digests_buf
)[2] = -1;
15102 ((uint
*) digests_buf
)[3] = -1;
15109 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15110 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15111 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15112 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15113 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15114 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15115 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15116 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15117 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15118 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15119 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15120 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15121 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15122 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15123 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15124 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15125 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15126 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15128 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
);
15129 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
);
15130 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
);
15131 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
);
15132 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
);
15133 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
);
15134 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
);
15135 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
);
15136 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15137 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15138 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15144 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15146 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15147 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15149 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15151 else if (attack_kern
== ATTACK_KERN_COMBI
)
15153 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15154 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15155 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15156 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15158 else if (attack_kern
== ATTACK_KERN_BF
)
15160 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15161 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15162 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15163 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15164 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15169 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15171 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15178 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15180 device_param
->pws_buf
= pws_buf
;
15182 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15184 device_param
->combs_buf
= combs_buf
;
15186 void *hooks_buf
= mymalloc (size_hooks
);
15188 device_param
->hooks_buf
= hooks_buf
;
15194 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15195 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15196 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15197 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15198 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15199 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15200 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15201 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15202 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15203 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15204 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15206 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15207 ? &device_param
->d_pws_buf
15208 : &device_param
->d_pws_amp_buf
;
15209 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15210 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15211 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15212 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15213 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15214 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15215 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15216 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15217 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15218 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15219 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15220 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15221 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15222 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15223 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15224 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15225 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15226 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15227 device_param
->kernel_params
[19] = &device_param
->d_result
;
15228 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15229 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15230 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15231 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15232 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15233 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15234 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15235 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15236 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15237 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15238 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15239 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15241 device_param
->kernel_params_mp_buf64
[3] = 0;
15242 device_param
->kernel_params_mp_buf32
[4] = 0;
15243 device_param
->kernel_params_mp_buf32
[5] = 0;
15244 device_param
->kernel_params_mp_buf32
[6] = 0;
15245 device_param
->kernel_params_mp_buf32
[7] = 0;
15246 device_param
->kernel_params_mp_buf32
[8] = 0;
15248 device_param
->kernel_params_mp
[0] = NULL
;
15249 device_param
->kernel_params_mp
[1] = NULL
;
15250 device_param
->kernel_params_mp
[2] = NULL
;
15251 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15252 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15253 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15254 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15255 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15256 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15258 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15259 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15260 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15261 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15262 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15263 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15264 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15266 device_param
->kernel_params_mp_l
[0] = NULL
;
15267 device_param
->kernel_params_mp_l
[1] = NULL
;
15268 device_param
->kernel_params_mp_l
[2] = NULL
;
15269 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15270 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15271 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15272 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15273 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15274 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15275 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15277 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15278 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15279 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15280 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15281 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15282 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15284 device_param
->kernel_params_mp_r
[0] = NULL
;
15285 device_param
->kernel_params_mp_r
[1] = NULL
;
15286 device_param
->kernel_params_mp_r
[2] = NULL
;
15287 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15288 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15289 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15290 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15291 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15292 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15294 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15295 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15297 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15298 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15299 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15300 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15301 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15302 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15303 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15305 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15306 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15308 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15309 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15311 device_param
->kernel_params_memset
[0] = NULL
;
15312 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15313 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15319 size_t kernel_wgs_tmp
;
15321 char kernel_name
[64] = { 0 };
15323 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15325 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15327 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15329 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15331 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15333 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15335 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15337 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15341 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15343 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15345 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15347 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15349 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15351 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15354 if (data
.attack_mode
== ATTACK_MODE_BF
)
15356 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15358 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15360 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15362 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
);
15368 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15370 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15372 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15374 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15376 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15378 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15380 if (opts_type
& OPTS_TYPE_HOOK12
)
15382 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15384 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15386 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
);
15389 if (opts_type
& OPTS_TYPE_HOOK23
)
15391 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15393 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15395 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
);
15399 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
);
15400 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
);
15401 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
);
15403 for (uint i
= 0; i
<= 20; i
++)
15405 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15406 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15407 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15409 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15410 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15413 for (uint i
= 21; i
<= 31; i
++)
15415 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15416 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15417 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15419 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15420 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15425 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15427 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
);
15429 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15430 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15431 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15435 if (attack_mode
== ATTACK_MODE_BF
)
15437 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15438 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15440 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
);
15441 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
);
15443 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15445 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15446 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15449 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15451 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15453 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
);
15455 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15457 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15459 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
);
15462 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15468 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15470 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
);
15473 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15479 for (uint i
= 0; i
< 5; i
++)
15481 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15484 for (uint i
= 5; i
< 7; i
++)
15486 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15490 // maybe this has been updated by clGetKernelWorkGroupInfo()
15491 // value can only be decreased, so we don't need to reallocate buffers
15493 device_param
->kernel_threads
= kernel_threads
;
15495 // zero some data buffers
15497 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15498 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15499 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15500 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15501 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15502 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15508 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15510 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15512 else if (attack_kern
== ATTACK_KERN_COMBI
)
15514 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15515 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15516 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15517 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15519 else if (attack_kern
== ATTACK_KERN_BF
)
15521 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15522 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15523 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15524 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15525 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15529 * Store initial fanspeed if gpu_temp_retain is enabled
15532 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15533 int gpu_temp_retain_set
= 0;
15535 if (gpu_temp_disable
== 0)
15537 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15539 hc_thread_mutex_lock (mux_adl
);
15541 if (data
.hm_device
[device_id
].fan_supported
== 1)
15543 if (gpu_temp_retain_chgd
== 0)
15546 uint default_temp
= 0;
15548 int ADL_rc
= hm_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
15550 if (ADL_rc
== ADL_OK
)
15552 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15554 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15556 // special case with multi gpu setups: always use minimum retain
15558 if (gpu_temp_retain_set
== 0)
15560 gpu_temp_retain
= gpu_temp_retain_target
;
15561 gpu_temp_retain_set
= 1;
15565 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15568 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15572 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15574 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15576 if (fan_speed
== -1)
15578 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15580 temp_retain_fanspeed_value
[device_id
] = 0;
15584 hc_thread_mutex_unlock (mux_adl
);
15589 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15592 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15594 hc_thread_mutex_lock (mux_adl
);
15596 if (data
.hm_device
[device_id
].od_version
== 6)
15600 // check powertune capabilities first, if not available then skip device
15602 int powertune_supported
= 0;
15604 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15606 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15611 if (powertune_supported
!= 0)
15613 // powercontrol settings
15615 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15617 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15619 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15622 if (ADL_rc
!= ADL_OK
)
15624 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15629 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15631 log_error ("ERROR: Failed to set new ADL PowerControl values");
15638 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15640 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15642 if ((ADL_rc
= hm_ADL_Overdrive_StateInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
15644 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15649 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15651 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15653 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15655 log_error ("ERROR: Failed to get ADL device capabilities");
15660 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15661 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15663 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15664 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15666 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15667 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15669 // warning if profile has too low max values
15671 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15673 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15676 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15678 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15681 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15683 performance_state
->iNumberOfPerformanceLevels
= 2;
15685 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15686 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15687 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15688 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15690 if ((ADL_rc
= hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15692 log_info ("ERROR: Failed to set ADL performance state");
15697 local_free (performance_state
);
15701 hc_thread_mutex_unlock (mux_adl
);
15703 #endif // HAVE_HWMON && HAVE_ADL
15706 data
.kernel_power_all
= kernel_power_all
;
15708 if (data
.quiet
== 0) log_info_nn ("");
15711 * In benchmark-mode, inform user which algorithm is checked
15714 if (benchmark
== 1)
15716 if (machine_readable
== 0)
15720 data
.quiet
= quiet
;
15722 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15724 log_info ("Hashtype: %s", hash_type
);
15730 * keep track of the progress
15733 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15734 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15735 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15742 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15744 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15749 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15751 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15756 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15758 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15768 segment_size
*= (1024 * 1024);
15770 data
.segment_size
= segment_size
;
15772 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15774 wl_data
->buf
= (char *) mymalloc (segment_size
);
15775 wl_data
->avail
= segment_size
;
15776 wl_data
->incr
= segment_size
;
15780 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15782 data
.wordlist_mode
= wordlist_mode
;
15784 cs_t
*css_buf
= NULL
;
15788 char **masks
= NULL
;
15789 char **dictfiles
= NULL
;
15791 uint mask_from_file
= 0;
15793 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15795 if (wordlist_mode
== WL_MODE_FILE
)
15797 int wls_left
= myargc
- (optind
+ 1);
15799 for (int i
= 0; i
< wls_left
; i
++)
15801 char *l0_filename
= myargv
[optind
+ 1 + i
];
15803 struct stat l0_stat
;
15805 if (stat (l0_filename
, &l0_stat
) == -1)
15807 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15812 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15816 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15820 dictfiles
[dictcnt
- 1] = l0_filename
;
15824 // do not allow --keyspace w/ a directory
15828 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15833 char **dictionary_files
= NULL
;
15835 dictionary_files
= scan_directory (l0_filename
);
15837 if (dictionary_files
!= NULL
)
15839 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15841 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15843 char *l1_filename
= dictionary_files
[d
];
15845 struct stat l1_stat
;
15847 if (stat (l1_filename
, &l1_stat
) == -1)
15849 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15854 if (S_ISREG (l1_stat
.st_mode
))
15856 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15860 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15865 local_free (dictionary_files
);
15871 log_error ("ERROR: No usable dictionary file found.");
15876 else if (wordlist_mode
== WL_MODE_STDIN
)
15881 else if (attack_mode
== ATTACK_MODE_COMBI
)
15885 char *dictfile1
= myargv
[optind
+ 1 + 0];
15886 char *dictfile2
= myargv
[optind
+ 1 + 1];
15888 // find the bigger dictionary and use as base
15893 struct stat tmp_stat
;
15895 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15897 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15902 if (stat (dictfile1
, &tmp_stat
) == -1)
15904 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15911 if (S_ISDIR (tmp_stat
.st_mode
))
15913 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
15920 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
15922 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15929 if (stat (dictfile2
, &tmp_stat
) == -1)
15931 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15939 if (S_ISDIR (tmp_stat
.st_mode
))
15941 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
15949 data
.combs_cnt
= 1;
15953 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
15955 data
.quiet
= quiet
;
15957 if (words1_cnt
== 0)
15959 log_error ("ERROR: %s: empty file", dictfile1
);
15967 data
.combs_cnt
= 1;
15971 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15973 data
.quiet
= quiet
;
15975 if (words2_cnt
== 0)
15977 log_error ("ERROR: %s: empty file", dictfile2
);
15988 data
.dictfile
= dictfile1
;
15989 data
.dictfile2
= dictfile2
;
15991 if (words1_cnt
>= words2_cnt
)
15993 data
.combs_cnt
= words2_cnt
;
15994 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
15996 dictfiles
= &data
.dictfile
;
16002 data
.combs_cnt
= words1_cnt
;
16003 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16005 dictfiles
= &data
.dictfile2
;
16009 // we also have to switch wordlist related rules!
16011 char *tmpc
= data
.rule_buf_l
;
16013 data
.rule_buf_l
= data
.rule_buf_r
;
16014 data
.rule_buf_r
= tmpc
;
16016 int tmpi
= data
.rule_len_l
;
16018 data
.rule_len_l
= data
.rule_len_r
;
16019 data
.rule_len_r
= tmpi
;
16022 else if (attack_mode
== ATTACK_MODE_BF
)
16028 if (benchmark
== 0)
16030 mask
= myargv
[optind
+ 1];
16032 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16034 if ((optind
+ 2) <= myargc
)
16036 struct stat file_stat
;
16038 if (stat (mask
, &file_stat
) == -1)
16042 masks
[maskcnt
- 1] = mystrdup (mask
);
16046 int wls_left
= myargc
- (optind
+ 1);
16048 uint masks_avail
= INCR_MASKS
;
16050 for (int i
= 0; i
< wls_left
; i
++)
16054 mask
= myargv
[optind
+ 1 + i
];
16056 if (stat (mask
, &file_stat
) == -1)
16058 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16064 uint is_file
= S_ISREG (file_stat
.st_mode
);
16070 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16072 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16077 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16079 while (!feof (mask_fp
))
16081 memset (line_buf
, 0, HCBUFSIZ
);
16083 int line_len
= fgetl (mask_fp
, line_buf
);
16085 if (line_len
== 0) continue;
16087 if (line_buf
[0] == '#') continue;
16089 if (masks_avail
== maskcnt
)
16091 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16093 masks_avail
+= INCR_MASKS
;
16096 masks
[maskcnt
] = mystrdup (line_buf
);
16107 log_error ("ERROR: %s: unsupported file-type", mask
);
16113 mask_from_file
= 1;
16118 custom_charset_1
= (char *) "?l?d?u";
16119 custom_charset_2
= (char *) "?l?d";
16120 custom_charset_3
= (char *) "?l?d*!$@_";
16122 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16123 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16124 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16126 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16128 wordlist_mode
= WL_MODE_MASK
;
16130 data
.wordlist_mode
= wordlist_mode
;
16140 * generate full masks and charsets
16143 masks
= (char **) mymalloc (sizeof (char *));
16147 case 1731: pw_min
= 5;
16149 mask
= mystrdup ("?b?b?b?b?b");
16151 case 12500: pw_min
= 5;
16153 mask
= mystrdup ("?b?b?b?b?b");
16155 default: pw_min
= 7;
16157 mask
= mystrdup ("?b?b?b?b?b?b?b");
16163 masks
[maskcnt
- 1] = mystrdup (mask
);
16165 wordlist_mode
= WL_MODE_MASK
;
16167 data
.wordlist_mode
= wordlist_mode
;
16172 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16176 if (increment_min
> pw_min
) pw_min
= increment_min
;
16178 if (increment_max
< pw_max
) pw_max
= increment_max
;
16181 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16183 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16187 char *mask
= myargv
[myargc
- 1];
16191 masks
= (char **) mymalloc (1 * sizeof (char *));
16195 struct stat file_stat
;
16197 if (stat (mask
, &file_stat
) == -1)
16201 masks
[maskcnt
- 1] = mystrdup (mask
);
16205 uint is_file
= S_ISREG (file_stat
.st_mode
);
16211 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16213 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16218 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16220 uint masks_avail
= 1;
16222 while (!feof (mask_fp
))
16224 memset (line_buf
, 0, HCBUFSIZ
);
16226 int line_len
= fgetl (mask_fp
, line_buf
);
16228 if (line_len
== 0) continue;
16230 if (line_buf
[0] == '#') continue;
16232 if (masks_avail
== maskcnt
)
16234 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16236 masks_avail
+= INCR_MASKS
;
16239 masks
[maskcnt
] = mystrdup (line_buf
);
16248 mask_from_file
= 1;
16254 masks
[maskcnt
- 1] = mystrdup (mask
);
16260 int wls_left
= myargc
- (optind
+ 2);
16262 for (int i
= 0; i
< wls_left
; i
++)
16264 char *filename
= myargv
[optind
+ 1 + i
];
16266 struct stat file_stat
;
16268 if (stat (filename
, &file_stat
) == -1)
16270 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16275 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16279 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16283 dictfiles
[dictcnt
- 1] = filename
;
16287 // do not allow --keyspace w/ a directory
16291 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16296 char **dictionary_files
= NULL
;
16298 dictionary_files
= scan_directory (filename
);
16300 if (dictionary_files
!= NULL
)
16302 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16304 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16306 char *l1_filename
= dictionary_files
[d
];
16308 struct stat l1_stat
;
16310 if (stat (l1_filename
, &l1_stat
) == -1)
16312 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16317 if (S_ISREG (l1_stat
.st_mode
))
16319 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16323 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16328 local_free (dictionary_files
);
16334 log_error ("ERROR: No usable dictionary file found.");
16343 uint mask_min
= increment_min
; // we can't reject smaller masks here
16344 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16346 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16348 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16350 if (cur_mask
== NULL
) break;
16352 masks
[maskcnt
] = cur_mask
;
16356 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16360 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16362 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16366 char *mask
= myargv
[optind
+ 1 + 0];
16370 masks
= (char **) mymalloc (1 * sizeof (char *));
16374 struct stat file_stat
;
16376 if (stat (mask
, &file_stat
) == -1)
16380 masks
[maskcnt
- 1] = mystrdup (mask
);
16384 uint is_file
= S_ISREG (file_stat
.st_mode
);
16390 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16392 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16397 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16399 uint masks_avail
= 1;
16401 while (!feof (mask_fp
))
16403 memset (line_buf
, 0, HCBUFSIZ
);
16405 int line_len
= fgetl (mask_fp
, line_buf
);
16407 if (line_len
== 0) continue;
16409 if (line_buf
[0] == '#') continue;
16411 if (masks_avail
== maskcnt
)
16413 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16415 masks_avail
+= INCR_MASKS
;
16418 masks
[maskcnt
] = mystrdup (line_buf
);
16427 mask_from_file
= 1;
16433 masks
[maskcnt
- 1] = mystrdup (mask
);
16439 int wls_left
= myargc
- (optind
+ 2);
16441 for (int i
= 0; i
< wls_left
; i
++)
16443 char *filename
= myargv
[optind
+ 2 + i
];
16445 struct stat file_stat
;
16447 if (stat (filename
, &file_stat
) == -1)
16449 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16454 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16458 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16462 dictfiles
[dictcnt
- 1] = filename
;
16466 // do not allow --keyspace w/ a directory
16470 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16475 char **dictionary_files
= NULL
;
16477 dictionary_files
= scan_directory (filename
);
16479 if (dictionary_files
!= NULL
)
16481 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16483 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16485 char *l1_filename
= dictionary_files
[d
];
16487 struct stat l1_stat
;
16489 if (stat (l1_filename
, &l1_stat
) == -1)
16491 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16496 if (S_ISREG (l1_stat
.st_mode
))
16498 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16502 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16507 local_free (dictionary_files
);
16513 log_error ("ERROR: No usable dictionary file found.");
16522 uint mask_min
= increment_min
; // we can't reject smaller masks here
16523 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16525 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16527 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16529 if (cur_mask
== NULL
) break;
16531 masks
[maskcnt
] = cur_mask
;
16535 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16540 data
.pw_min
= pw_min
;
16541 data
.pw_max
= pw_max
;
16547 if (weak_hash_threshold
>= salts_cnt
)
16549 hc_device_param_t
*device_param
= NULL
;
16551 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16553 device_param
= &data
.devices_param
[device_id
];
16555 if (device_param
->skipped
) continue;
16560 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16562 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16564 weak_hash_check (device_param
, salt_pos
);
16567 // Display hack, guarantee that there is at least one \r before real start
16569 //if (data.quiet == 0) log_info ("");
16573 * status and monitor threads
16576 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16578 hc_thread_t i_thread
= 0;
16580 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16582 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16585 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16587 uint ni_threads_cnt
= 0;
16589 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16591 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16601 if (outfile_check_timer
!= 0)
16603 if (data
.outfile_check_directory
!= NULL
)
16605 if ((hash_mode
!= 5200) &&
16606 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16607 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16608 (hash_mode
!= 9000))
16610 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16616 outfile_check_timer
= 0;
16621 outfile_check_timer
= 0;
16627 * Inform the user if we got some hashes remove because of the pot file remove feature
16630 if (data
.quiet
== 0)
16632 if (potfile_remove_cracks
> 0)
16634 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16635 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16639 data
.outfile_check_timer
= outfile_check_timer
;
16645 char **induction_dictionaries
= NULL
;
16647 int induction_dictionaries_cnt
= 0;
16649 hcstat_table_t
*root_table_buf
= NULL
;
16650 hcstat_table_t
*markov_table_buf
= NULL
;
16652 uint initial_restore_done
= 0;
16654 data
.maskcnt
= maskcnt
;
16656 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16658 if (data
.devices_status
== STATUS_CRACKED
) break;
16660 data
.devices_status
= STATUS_INIT
;
16662 if (maskpos
> rd
->maskpos
)
16667 rd
->maskpos
= maskpos
;
16668 data
.maskpos
= maskpos
;
16670 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16672 char *mask
= masks
[maskpos
];
16674 if (mask_from_file
== 1)
16676 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16681 uint mask_offset
= 0;
16683 uint separator_cnt
;
16685 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16687 str_ptr
= strstr (mask
+ mask_offset
, ",");
16689 if (str_ptr
== NULL
) break;
16691 str_pos
= str_ptr
- mask
;
16693 // escaped separator, i.e. "\,"
16697 if (mask
[str_pos
- 1] == '\\')
16701 mask_offset
= str_pos
+ 1;
16707 // reset the offset
16711 mask
[str_pos
] = '\0';
16713 switch (separator_cnt
)
16716 mp_reset_usr (mp_usr
, 0);
16718 custom_charset_1
= mask
;
16719 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16723 mp_reset_usr (mp_usr
, 1);
16725 custom_charset_2
= mask
;
16726 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16730 mp_reset_usr (mp_usr
, 2);
16732 custom_charset_3
= mask
;
16733 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16737 mp_reset_usr (mp_usr
, 3);
16739 custom_charset_4
= mask
;
16740 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16744 mask
= mask
+ str_pos
+ 1;
16748 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16752 local_free (css_buf
);
16753 local_free (data
.root_css_buf
);
16754 local_free (data
.markov_css_buf
);
16756 local_free (masks
[maskpos
- 1]);
16759 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16762 data
.css_cnt
= css_cnt
;
16763 data
.css_buf
= css_buf
;
16765 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16767 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16769 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16770 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16772 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16774 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16776 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16777 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16779 data
.root_css_buf
= root_css_buf
;
16780 data
.markov_css_buf
= markov_css_buf
;
16782 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16784 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16786 local_free (root_table_buf
);
16787 local_free (markov_table_buf
);
16791 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16793 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16795 if (device_param
->skipped
) continue;
16797 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16798 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16799 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16801 device_param
->kernel_params_mp_buf64
[3] = 0;
16802 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16803 device_param
->kernel_params_mp_buf32
[5] = 0;
16804 device_param
->kernel_params_mp_buf32
[6] = 0;
16805 device_param
->kernel_params_mp_buf32
[7] = 0;
16807 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16809 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16810 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16811 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16812 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16814 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16816 device_param
->kernel_params_mp_buf32
[5] = 0;
16817 device_param
->kernel_params_mp_buf32
[6] = 0;
16818 device_param
->kernel_params_mp_buf32
[7] = 0;
16821 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
16822 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
16823 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
16825 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
);
16826 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
);
16829 else if (attack_mode
== ATTACK_MODE_BF
)
16831 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16835 for (uint i
= 0; i
< dictcnt
; i
++)
16837 local_free (dictfiles
[i
]);
16840 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16842 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16844 if (l1_filename
== NULL
) break;
16848 dictfiles
[dictcnt
- 1] = l1_filename
;
16855 dictfiles
[dictcnt
- 1] = mask
;
16860 log_error ("ERROR: Mask is too small");
16867 free (induction_dictionaries
);
16869 // induction_dictionaries_cnt = 0; // implied
16871 if (attack_mode
!= ATTACK_MODE_BF
)
16875 induction_dictionaries
= scan_directory (induction_directory
);
16877 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16881 if (induction_dictionaries_cnt
)
16883 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16887 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16891 if ((maskcnt
> 1) || (dictcnt
> 1))
16893 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16899 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
16901 char *subid
= logfile_generate_subid ();
16903 data
.subid
= subid
;
16905 logfile_sub_msg ("START");
16907 data
.devices_status
= STATUS_INIT
;
16909 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
16910 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
16911 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
16913 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
16917 data
.cpt_start
= time (NULL
);
16919 data
.cpt_total
= 0;
16921 if (data
.restore
== 0)
16923 rd
->words_cur
= skip
;
16930 data
.ms_paused
= 0;
16932 data
.words_cur
= rd
->words_cur
;
16934 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16936 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16938 if (device_param
->skipped
) continue;
16940 device_param
->speed_pos
= 0;
16942 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
16943 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
16945 device_param
->exec_pos
= 0;
16947 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
16949 device_param
->kernel_power
= device_param
->kernel_power_user
;
16951 device_param
->outerloop_pos
= 0;
16952 device_param
->outerloop_left
= 0;
16953 device_param
->innerloop_pos
= 0;
16954 device_param
->innerloop_left
= 0;
16956 // some more resets:
16958 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
16960 device_param
->pws_cnt
= 0;
16962 device_param
->words_off
= 0;
16963 device_param
->words_done
= 0;
16966 data
.kernel_power_div
= 0;
16968 // figure out some workload
16970 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
16972 if (data
.wordlist_mode
== WL_MODE_FILE
)
16974 char *dictfile
= NULL
;
16976 if (induction_dictionaries_cnt
)
16978 dictfile
= induction_dictionaries
[0];
16982 dictfile
= dictfiles
[dictpos
];
16985 data
.dictfile
= dictfile
;
16987 logfile_sub_string (dictfile
);
16989 for (uint i
= 0; i
< rp_files_cnt
; i
++)
16991 logfile_sub_var_string ("rulefile", rp_files
[i
]);
16994 FILE *fd2
= fopen (dictfile
, "rb");
16998 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17003 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17007 if (data
.words_cnt
== 0)
17009 if (data
.devices_status
== STATUS_CRACKED
) break;
17010 if (data
.devices_status
== STATUS_ABORTED
) break;
17018 else if (attack_mode
== ATTACK_MODE_COMBI
)
17020 char *dictfile
= data
.dictfile
;
17021 char *dictfile2
= data
.dictfile2
;
17023 logfile_sub_string (dictfile
);
17024 logfile_sub_string (dictfile2
);
17026 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17028 FILE *fd2
= fopen (dictfile
, "rb");
17032 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17037 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17041 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17043 FILE *fd2
= fopen (dictfile2
, "rb");
17047 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17052 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17057 if (data
.words_cnt
== 0)
17059 if (data
.devices_status
== STATUS_CRACKED
) break;
17060 if (data
.devices_status
== STATUS_ABORTED
) break;
17067 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17069 char *dictfile
= NULL
;
17071 if (induction_dictionaries_cnt
)
17073 dictfile
= induction_dictionaries
[0];
17077 dictfile
= dictfiles
[dictpos
];
17080 data
.dictfile
= dictfile
;
17082 char *mask
= data
.mask
;
17084 logfile_sub_string (dictfile
);
17085 logfile_sub_string (mask
);
17087 FILE *fd2
= fopen (dictfile
, "rb");
17091 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17096 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17100 if (data
.words_cnt
== 0)
17102 if (data
.devices_status
== STATUS_CRACKED
) break;
17103 if (data
.devices_status
== STATUS_ABORTED
) break;
17110 else if (attack_mode
== ATTACK_MODE_BF
)
17112 local_free (css_buf
);
17113 local_free (data
.root_css_buf
);
17114 local_free (data
.markov_css_buf
);
17116 char *mask
= dictfiles
[dictpos
];
17118 logfile_sub_string (mask
);
17122 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17124 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17126 uint css_cnt_unicode
= css_cnt
* 2;
17128 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17130 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17132 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17134 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17135 css_buf_unicode
[j
+ 1].cs_len
= 1;
17140 css_buf
= css_buf_unicode
;
17141 css_cnt
= css_cnt_unicode
;
17144 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17146 uint mask_min
= pw_min
;
17147 uint mask_max
= pw_max
;
17149 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17155 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17157 if (css_cnt
< mask_min
)
17159 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17162 if (css_cnt
> mask_max
)
17164 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17167 // skip to next mask
17171 rd
->dictpos
= dictpos
;
17173 logfile_sub_msg ("STOP");
17178 uint save_css_cnt
= css_cnt
;
17180 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17182 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17184 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17185 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17187 uint css_cnt_salt
= css_cnt
+ salt_len
;
17189 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17191 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17193 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17195 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17196 css_buf_salt
[j
].cs_len
= 1;
17201 css_buf
= css_buf_salt
;
17202 css_cnt
= css_cnt_salt
;
17207 data
.css_cnt
= css_cnt
;
17208 data
.css_buf
= css_buf
;
17210 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17212 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17214 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17216 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17217 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17219 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17221 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17223 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17224 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17226 data
.root_css_buf
= root_css_buf
;
17227 data
.markov_css_buf
= markov_css_buf
;
17229 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17231 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17233 local_free (root_table_buf
);
17234 local_free (markov_table_buf
);
17238 uint css_cnt_l
= css_cnt
;
17241 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17243 if (save_css_cnt
< 6)
17247 else if (save_css_cnt
== 6)
17253 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17255 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17266 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17281 /* unfinished code?
17282 int sum = css_buf[css_cnt_r - 1].cs_len;
17284 for (uint i = 1; i < 4 && i < css_cnt; i++)
17286 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17290 sum *= css_buf[css_cnt_r - 1].cs_len;
17295 css_cnt_l
-= css_cnt_r
;
17297 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17299 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17301 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17303 if (device_param
->skipped
) continue;
17305 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17306 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17307 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17309 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17310 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17311 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17312 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17313 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17314 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17316 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17317 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17318 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17319 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17321 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17322 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17323 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17325 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17326 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17327 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17328 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17329 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17331 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
17332 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
17333 for (uint i
= 4; i
< 9; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
17335 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
17336 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
17337 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (data
.ocl
, device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
17339 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
);
17340 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
);
17344 u64 words_base
= data
.words_cnt
;
17346 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17348 if (data
.kernel_rules_cnt
)
17350 words_base
/= data
.kernel_rules_cnt
;
17353 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17355 if (data
.combs_cnt
)
17357 words_base
/= data
.combs_cnt
;
17360 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17364 words_base
/= data
.bfs_cnt
;
17368 data
.words_base
= words_base
;
17372 log_info ("%llu", (unsigned long long int) words_base
);
17377 if (data
.words_cur
> data
.words_base
)
17379 log_error ("ERROR: restore value greater keyspace");
17384 if (data
.words_cur
)
17386 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17388 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17390 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17393 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17395 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17397 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17400 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17402 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17404 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17410 * Inform user about possible slow speeds
17413 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17415 if (data
.words_base
< kernel_power_all
)
17419 log_info ("ATTENTION!");
17420 log_info (" The wordlist or mask you are using is too small.");
17421 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17422 log_info (" The cracking speed will drop.");
17423 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17430 * Update loopback file
17439 uint random_num
= get_random_num (0, 9999);
17441 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17443 data
.loopback_file
= loopback_file
;
17447 * Update dictionary statistic
17452 dictstat_fp
= fopen (dictstat
, "wb");
17456 lock_file (dictstat_fp
);
17458 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17460 fclose (dictstat_fp
);
17464 data
.devices_status
= STATUS_RUNNING
;
17466 if (initial_restore_done
== 0)
17468 if (data
.restore_disable
== 0) cycle_restore ();
17470 initial_restore_done
= 1;
17473 hc_timer_set (&data
.timer_running
);
17475 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17477 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17479 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17480 if (quiet
== 0) fflush (stdout
);
17483 else if (wordlist_mode
== WL_MODE_STDIN
)
17485 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17486 if (data
.quiet
== 0) log_info ("");
17489 time_t runtime_start
;
17491 time (&runtime_start
);
17493 data
.runtime_start
= runtime_start
;
17496 * create cracker threads
17499 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17501 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17503 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17505 if (wordlist_mode
== WL_MODE_STDIN
)
17507 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17511 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17515 // wait for crack threads to exit
17517 hc_thread_wait (data
.devices_cnt
, c_threads
);
17519 local_free (c_threads
);
17525 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17527 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17529 if (data
.devices_status
== STATUS_CRACKED
) break;
17530 if (data
.devices_status
== STATUS_ABORTED
) break;
17532 if (data
.devices_status
== STATUS_BYPASS
)
17534 data
.devices_status
= STATUS_RUNNING
;
17537 if (induction_dictionaries_cnt
)
17539 unlink (induction_dictionaries
[0]);
17542 free (induction_dictionaries
);
17544 if (attack_mode
!= ATTACK_MODE_BF
)
17546 induction_dictionaries
= scan_directory (induction_directory
);
17548 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17551 if (benchmark
== 0)
17553 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17555 if (quiet
== 0) clear_prompt ();
17557 if (quiet
== 0) log_info ("");
17565 if (quiet
== 0) status_display ();
17568 if (quiet
== 0) log_info ("");
17572 if (attack_mode
== ATTACK_MODE_BF
)
17576 rd
->dictpos
= dictpos
;
17580 if (induction_dictionaries_cnt
)
17582 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17588 rd
->dictpos
= dictpos
;
17592 time_t runtime_stop
;
17594 time (&runtime_stop
);
17596 data
.runtime_stop
= runtime_stop
;
17598 logfile_sub_uint (runtime_start
);
17599 logfile_sub_uint (runtime_stop
);
17601 logfile_sub_msg ("STOP");
17603 global_free (subid
);
17606 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17608 if (data
.devices_status
== STATUS_CRACKED
) break;
17609 if (data
.devices_status
== STATUS_ABORTED
) break;
17610 if (data
.devices_status
== STATUS_QUIT
) break;
17612 if (data
.devices_status
== STATUS_BYPASS
)
17614 data
.devices_status
= STATUS_RUNNING
;
17618 // 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
17620 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17622 if (data
.wordlist_mode
== WL_MODE_FILE
)
17624 if (data
.dictfile
== NULL
)
17626 if (dictfiles
!= NULL
)
17628 data
.dictfile
= dictfiles
[0];
17630 hc_timer_set (&data
.timer_running
);
17635 // NOTE: combi is okay because it is already set beforehand
17636 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17638 if (data
.dictfile
== NULL
)
17640 if (dictfiles
!= NULL
)
17642 hc_timer_set (&data
.timer_running
);
17644 data
.dictfile
= dictfiles
[0];
17648 else if (attack_mode
== ATTACK_MODE_BF
)
17650 if (data
.mask
== NULL
)
17652 hc_timer_set (&data
.timer_running
);
17654 data
.mask
= masks
[0];
17658 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17660 data
.devices_status
= STATUS_EXHAUSTED
;
17663 // if cracked / aborted remove last induction dictionary
17665 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17667 struct stat induct_stat
;
17669 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17671 unlink (induction_dictionaries
[file_pos
]);
17675 // wait for non-interactive threads
17677 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17679 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17682 local_free (ni_threads
);
17684 // wait for interactive threads
17686 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17688 hc_thread_wait (1, &i_thread
);
17691 // we dont need restore file anymore
17692 if (data
.restore_disable
== 0)
17694 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17696 unlink (eff_restore_file
);
17697 unlink (new_restore_file
);
17705 // finally save left hashes
17707 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17716 if (benchmark
== 1)
17718 status_benchmark ();
17720 if (machine_readable
== 0)
17727 if (quiet
== 0) clear_prompt ();
17729 if (quiet
== 0) log_info ("");
17737 if (quiet
== 0) status_display ();
17740 if (quiet
== 0) log_info ("");
17743 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17745 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17747 if (device_param
->skipped
) continue;
17749 local_free (device_param
->combs_buf
);
17751 local_free (device_param
->hooks_buf
);
17753 local_free (device_param
->device_name
);
17755 local_free (device_param
->device_name_chksum
);
17757 local_free (device_param
->device_version
);
17759 local_free (device_param
->driver_version
);
17761 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17762 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17763 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17764 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17765 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17766 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17767 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17768 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17769 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17770 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17771 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17772 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17773 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17774 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17775 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17776 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17777 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17778 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17779 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17780 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17781 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17782 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17783 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17784 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17785 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17786 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17787 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17788 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17789 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17791 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17792 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17793 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17794 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17795 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17796 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17797 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17798 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17799 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17800 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17801 if (device_param
->kernel_memset
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_memset
);
17803 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17804 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17805 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17807 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17808 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17811 // reset default fan speed
17814 if (gpu_temp_disable
== 0)
17817 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17819 hc_thread_mutex_lock (mux_adl
);
17821 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17823 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17825 if (device_param
->skipped
) continue;
17827 if (data
.hm_device
[device_id
].fan_supported
== 1)
17829 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17831 if (fanspeed
== -1) continue;
17833 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17835 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17839 hc_thread_mutex_unlock (mux_adl
);
17845 // reset power tuning
17847 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17849 hc_thread_mutex_lock (mux_adl
);
17851 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17853 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17855 if (device_param
->skipped
) continue;
17857 if (data
.hm_device
[device_id
].od_version
== 6)
17859 // check powertune capabilities first, if not available then skip device
17861 int powertune_supported
= 0;
17863 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17865 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17870 if (powertune_supported
!= 0)
17872 // powercontrol settings
17874 if ((hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, od_power_control_status
[device_id
])) != ADL_OK
)
17876 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17883 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17885 performance_state
->iNumberOfPerformanceLevels
= 2;
17887 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17888 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17889 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17890 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17892 if ((hm_ADL_Overdrive_State_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
17894 log_info ("ERROR: Failed to restore ADL performance state");
17899 local_free (performance_state
);
17904 hc_thread_mutex_unlock (mux_adl
);
17908 if (gpu_temp_disable
== 0)
17910 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
17913 #if defined(LINUX) && defined(HAVE_NVML)
17915 hm_NVML_nvmlShutdown (data
.hm_nv
);
17917 nvml_close (data
.hm_nv
);
17919 #elif defined(WIN) && (HAVE_NVAPI)
17921 hm_NvAPI_Unload (data
.hm_nv
);
17923 nvapi_close (data
.hm_nv
);
17934 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
17936 adl_close (data
.hm_amd
);
17937 data
.hm_amd
= NULL
;
17941 #endif // HAVE_HWMON
17945 local_free (masks
);
17947 local_free (dictstat_base
);
17949 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
17951 pot_t
*pot_ptr
= &pot
[pot_pos
];
17953 hash_t
*hash
= &pot_ptr
->hash
;
17955 local_free (hash
->digest
);
17959 local_free (hash
->salt
);
17965 local_free (all_kernel_rules_cnt
);
17966 local_free (all_kernel_rules_buf
);
17968 local_free (wl_data
->buf
);
17969 local_free (wl_data
);
17971 local_free (bitmap_s1_a
);
17972 local_free (bitmap_s1_b
);
17973 local_free (bitmap_s1_c
);
17974 local_free (bitmap_s1_d
);
17975 local_free (bitmap_s2_a
);
17976 local_free (bitmap_s2_b
);
17977 local_free (bitmap_s2_c
);
17978 local_free (bitmap_s2_d
);
17981 local_free (temp_retain_fanspeed_value
);
17983 local_free (od_clock_mem_status
);
17984 local_free (od_power_control_status
);
17988 global_free (devices_param
);
17990 global_free (kernel_rules_buf
);
17992 global_free (root_css_buf
);
17993 global_free (markov_css_buf
);
17995 global_free (digests_buf
);
17996 global_free (digests_shown
);
17997 global_free (digests_shown_tmp
);
17999 global_free (salts_buf
);
18000 global_free (salts_shown
);
18002 global_free (esalts_buf
);
18004 global_free (words_progress_done
);
18005 global_free (words_progress_rejected
);
18006 global_free (words_progress_restored
);
18008 if (pot_fp
) fclose (pot_fp
);
18010 if (data
.devices_status
== STATUS_QUIT
) break;
18013 // destroy others mutex
18015 hc_thread_mutex_delete (mux_dispatcher
);
18016 hc_thread_mutex_delete (mux_counter
);
18017 hc_thread_mutex_delete (mux_display
);
18018 hc_thread_mutex_delete (mux_adl
);
18022 local_free (eff_restore_file
);
18023 local_free (new_restore_file
);
18029 tuning_db_destroy (tuning_db
);
18033 local_free (loopback_file
);
18035 if (loopback
== 1) unlink (loopback_file
);
18037 // induction directory
18039 if (induction_dir
== NULL
)
18041 if (attack_mode
!= ATTACK_MODE_BF
)
18043 if (rmdir (induction_directory
) == -1)
18045 if (errno
== ENOENT
)
18047 // good, we can ignore
18049 else if (errno
== ENOTEMPTY
)
18051 // good, we can ignore
18055 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18061 local_free (induction_directory
);
18065 // outfile-check directory
18067 if (outfile_check_dir
== NULL
)
18069 if (rmdir (outfile_check_directory
) == -1)
18071 if (errno
== ENOENT
)
18073 // good, we can ignore
18075 else if (errno
== ENOTEMPTY
)
18077 // good, we can ignore
18081 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18087 local_free (outfile_check_directory
);
18094 logfile_top_uint (proc_start
);
18095 logfile_top_uint (proc_stop
);
18097 logfile_top_msg ("STOP");
18099 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18100 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18102 if (data
.ocl
) ocl_close (data
.ocl
);
18104 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18105 if (data
.devices_status
== STATUS_QUIT
) return 2;
18106 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18107 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18108 if (data
.devices_status
== STATUS_CRACKED
) return 0;