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 STATUS_AUTOMAT 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]...",
356 " Options Short / Long | Type | Description | Example",
357 "===============================|======|======================================================|=======================",
358 " -m, --hash-type | Num | Hash-type, see references below | -m 1000",
359 " -a, --attack-mode | Num | Attack-mode, see references below | -a 3",
360 " -V, --version | | Print version |",
361 " -h, --help | | Print help |",
362 " --quiet | | Suppress output |",
363 " --hex-charset | | Assume charset is given in hex |",
364 " --hex-salt | | Assume salt is given in hex |",
365 " --hex-wordlist | | Assume words in wordlist is given in hex |",
366 " --force | | Ignore warnings |",
367 " --status | | Enable automatic update of the status-screen |",
368 " --status-timer | Num | Sets seconds between status-screen update to X | --status-timer=1",
369 " --status-automat | | Display the status view in a machine readable format |",
370 " --loopback | | Add new plains to induct directory |",
371 " --weak-hash-threshold | Num | Threshold X when to stop checking for weak hashes | --weak=0",
372 " --markov-hcstat | File | Specify hcstat file to use | --markov-hc=my.hcstat",
373 " --markov-disable | | Disables markov-chains, emulates classic brute-force |",
374 " --markov-classic | | Enables classic markov-chains, no per-position |",
375 " -t, --markov-threshold | Num | Threshold X when to stop accepting new markov-chains | -t 50",
376 " --runtime | Num | Abort session after X seconds of runtime | --runtime=10",
377 " --session | Str | Define specific session name | --session=mysession",
378 " --restore | | Restore session from --session |",
379 " --restore-disable | | Do not write restore file |",
380 " -o, --outfile | File | Define outfile for recovered hash | -o outfile.txt",
381 " --outfile-format | Num | Define outfile-format X for recovered hash | --outfile-format=7",
382 " --outfile-autohex-disable | | Disable the use of $HEX[] in output plains |",
383 " --outfile-check-timer | Num | Sets seconds between outfile checks to X | --outfile-check=30",
384 " -p, --separator | Char | Separator char for hashlists and outfile | -p :",
385 " --show | | Show cracked passwords only |",
386 " --left | | Show un-cracked passwords only |",
387 " --username | | Enable ignoring of usernames in hashfile |",
388 " --remove | | Enable remove of hash once it is cracked |",
389 " --remove-timer | Num | Update input hash file each X seconds | --remove-timer=30",
390 " --potfile-disable | | Do not write potfile |",
391 " --potfile-path | Dir | Specific path to potfile | --potfile-path=my.pot",
392 " --debug-mode | Num | Defines the debug mode (hybrid only by using rules) | --debug-mode=4",
393 " --debug-file | File | Output file for debugging rules | --debug-file=good.log",
394 " --induction-dir | Dir | Specify the induction directory to use for loopback | --induction=inducts",
395 " --outfile-check-dir | Dir | Specify the outfile directory to monitor for plains | --outfile-check-dir=x",
396 " --logfile-disable | | Disable the logfile |",
397 " --truecrypt-keyfiles | File | Keyfiles used, separate with comma | --truecrypt-key=x.png",
398 " --veracrypt-keyfiles | File | Keyfiles used, separate with comma | --veracrypt-key=x.txt",
399 " --veracrypt-pim | Num | VeraCrypt personal iterations multiplier | --veracrypt-pim=1000",
400 " -b, --benchmark | | Run benchmark |",
401 " -c, --segment-size | Num | Sets size in MB to cache from the wordfile to X | -c 32",
402 " --bitmap-min | Num | Sets minimum bits allowed for bitmaps to X | --bitmap-min=24",
403 " --bitmap-max | Num | Sets maximum bits allowed for bitmaps to X | --bitmap-min=24",
404 " --cpu-affinity | Str | Locks to CPU devices, separate with comma | --cpu-affinity=1,2,3",
405 " --opencl-platforms | Str | OpenCL platforms to use, separate with comma | --opencl-platforms=2",
406 " -d, --opencl-devices | Str | OpenCL devices to use, separate with comma | -d 1",
407 " --opencl-device-types | Str | OpenCL device-types to use, separate with comma | --opencl-device-type=1",
408 " --opencl-vector-width | Num | Manual override OpenCL vector-width to X | --opencl-vector=4",
409 " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3",
410 " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64",
411 " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256",
412 " --gpu-temp-disable | | Disable temperature and fanspeed reads and triggers |",
414 " --gpu-temp-abort | Num | Abort if GPU temperature reaches X degrees celsius | --gpu-temp-abort=100",
415 " --gpu-temp-retain | Num | Try to retain GPU temperature at X degrees celsius | --gpu-temp-retain=95",
417 " --powertune-enable | | Enable automatic power tuning (AMD OverDrive 6 only) |",
420 " --scrypt-tmto | Num | Manually override TMTO value for scrypt to X | --scrypt-tmto=3",
421 " -s, --skip | Num | Skip X words from the start | -s 1000000",
422 " -l, --limit | Num | Limit X words from the start + skipped words | -l 1000000",
423 " --keyspace | | Show keyspace base:mod values and quit |",
424 " -j, --rule-left | Rule | Single Rule applied to each word from left wordlist | -j 'c'",
425 " -k, --rule-right | Rule | Single Rule applied to each word from right wordlist | -k '^-'",
426 " -r, --rules-file | File | Multiple Rules applied to each word from wordlists | -r rules/best64.rule",
427 " -g, --generate-rules | Num | Generate X random rules | -g 10000",
428 " --generate-rules-func-min | Num | Force min X funcs per rule |",
429 " --generate-rules-func-max | Num | Force max X funcs per rule |",
430 " --generate-rules-seed | Num | Force RNG seed set to X |",
431 " -1, --custom-charset1 | CS | User-defined charset ?1 | -1 ?l?d?u",
432 " -2, --custom-charset2 | CS | User-defined charset ?2 | -2 ?l?d?s",
433 " -3, --custom-charset3 | CS | User-defined charset ?3 |",
434 " -4, --custom-charset4 | CS | User-defined charset ?4 |",
435 " -i, --increment | | Enable mask increment mode |",
436 " --increment-min | Num | Start mask incrementing at X | --increment-min=4",
437 " --increment-max | Num | Stop mask incrementing at X | --increment-max=8",
443 " # | Name | Category",
444 " ------+--------------------------------------------------+--------------------------------------",
445 " 900 | MD4 | Raw Hash",
446 " 0 | MD5 | Raw Hash",
447 " 5100 | Half MD5 | Raw Hash",
448 " 100 | SHA1 | Raw Hash",
449 " 10800 | SHA-384 | Raw Hash",
450 " 1400 | SHA-256 | Raw Hash",
451 " 1700 | SHA-512 | Raw Hash",
452 " 5000 | SHA-3(Keccak) | Raw Hash",
453 " 10100 | SipHash | Raw Hash",
454 " 6000 | RipeMD160 | Raw Hash",
455 " 6100 | Whirlpool | Raw Hash",
456 " 6900 | GOST R 34.11-94 | Raw Hash",
457 " 11700 | GOST R 34.11-2012 (Streebog) 256-bit | Raw Hash",
458 " 11800 | GOST R 34.11-2012 (Streebog) 512-bit | Raw Hash",
459 " 10 | md5($pass.$salt) | Raw Hash, Salted and / or Iterated",
460 " 20 | md5($salt.$pass) | Raw Hash, Salted and / or Iterated",
461 " 30 | md5(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
462 " 40 | md5($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
463 " 3800 | md5($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
464 " 3710 | md5($salt.md5($pass)) | Raw Hash, Salted and / or Iterated",
465 " 2600 | md5(md5($pass) | Raw Hash, Salted and / or Iterated",
466 " 4300 | md5(strtoupper(md5($pass))) | Raw Hash, Salted and / or Iterated",
467 " 4400 | md5(sha1($pass)) | Raw Hash, Salted and / or Iterated",
468 " 110 | sha1($pass.$salt) | Raw Hash, Salted and / or Iterated",
469 " 120 | sha1($salt.$pass) | Raw Hash, Salted and / or Iterated",
470 " 130 | sha1(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
471 " 140 | sha1($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
472 " 4500 | sha1(sha1($pass) | Raw Hash, Salted and / or Iterated",
473 " 4700 | sha1(md5($pass)) | Raw Hash, Salted and / or Iterated",
474 " 4900 | sha1($salt.$pass.$salt) | Raw Hash, Salted and / or Iterated",
475 " 1410 | sha256($pass.$salt) | Raw Hash, Salted and / or Iterated",
476 " 1420 | sha256($salt.$pass) | Raw Hash, Salted and / or Iterated",
477 " 1430 | sha256(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
478 " 1440 | sha256($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
479 " 1710 | sha512($pass.$salt) | Raw Hash, Salted and / or Iterated",
480 " 1720 | sha512($salt.$pass) | Raw Hash, Salted and / or Iterated",
481 " 1730 | sha512(unicode($pass).$salt) | Raw Hash, Salted and / or Iterated",
482 " 1740 | sha512($salt.unicode($pass)) | Raw Hash, Salted and / or Iterated",
483 " 50 | HMAC-MD5 (key = $pass) | Raw Hash, Authenticated",
484 " 60 | HMAC-MD5 (key = $salt) | Raw Hash, Authenticated",
485 " 150 | HMAC-SHA1 (key = $pass) | Raw Hash, Authenticated",
486 " 160 | HMAC-SHA1 (key = $salt) | Raw Hash, Authenticated",
487 " 1450 | HMAC-SHA256 (key = $pass) | Raw Hash, Authenticated",
488 " 1460 | HMAC-SHA256 (key = $salt) | Raw Hash, Authenticated",
489 " 1750 | HMAC-SHA512 (key = $pass) | Raw Hash, Authenticated",
490 " 1760 | HMAC-SHA512 (key = $salt) | Raw Hash, Authenticated",
491 " 400 | phpass | Generic KDF",
492 " 8900 | scrypt | Generic KDF",
493 " 11900 | PBKDF2-HMAC-MD5 | Generic KDF",
494 " 12000 | PBKDF2-HMAC-SHA1 | Generic KDF",
495 " 10900 | PBKDF2-HMAC-SHA256 | Generic KDF",
496 " 12100 | PBKDF2-HMAC-SHA512 | Generic KDF",
497 " 23 | Skype | Network protocols",
498 " 2500 | WPA/WPA2 | Network protocols",
499 " 4800 | iSCSI CHAP authentication, MD5(Chap) | Network protocols",
500 " 5300 | IKE-PSK MD5 | Network protocols",
501 " 5400 | IKE-PSK SHA1 | Network protocols",
502 " 5500 | NetNTLMv1 | Network protocols",
503 " 5500 | NetNTLMv1 + ESS | Network protocols",
504 " 5600 | NetNTLMv2 | Network protocols",
505 " 7300 | IPMI2 RAKP HMAC-SHA1 | Network protocols",
506 " 7500 | Kerberos 5 AS-REQ Pre-Auth etype 23 | Network protocols",
507 " 8300 | DNSSEC (NSEC3) | Network protocols",
508 " 10200 | Cram MD5 | Network protocols",
509 " 11100 | PostgreSQL CRAM (MD5) | Network protocols",
510 " 11200 | MySQL CRAM (SHA1) | Network protocols",
511 " 11400 | SIP digest authentication (MD5) | Network protocols",
512 " 13100 | Kerberos 5 TGS-REP etype 23 | Network protocols",
513 " 121 | SMF (Simple Machines Forum) | Forums, CMS, E-Commerce, Frameworks",
514 " 400 | phpBB3 | Forums, CMS, E-Commerce, Frameworks",
515 " 2611 | vBulletin < v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
516 " 2711 | vBulletin > v3.8.5 | Forums, CMS, E-Commerce, Frameworks",
517 " 2811 | MyBB | Forums, CMS, E-Commerce, Frameworks",
518 " 2811 | IPB (Invison Power Board) | Forums, CMS, E-Commerce, Frameworks",
519 " 8400 | WBB3 (Woltlab Burning Board) | Forums, CMS, E-Commerce, Frameworks",
520 " 11 | Joomla < 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
521 " 400 | Joomla > 2.5.18 | Forums, CMS, E-Commerce, Frameworks",
522 " 400 | Wordpress | Forums, CMS, E-Commerce, Frameworks",
523 " 2612 | PHPS | Forums, CMS, E-Commerce, Frameworks",
524 " 7900 | Drupal7 | Forums, CMS, E-Commerce, Frameworks",
525 " 21 | osCommerce | Forums, CMS, E-Commerce, Frameworks",
526 " 21 | xt:Commerce | Forums, CMS, E-Commerce, Frameworks",
527 " 11000 | PrestaShop | Forums, CMS, E-Commerce, Frameworks",
528 " 124 | Django (SHA-1) | Forums, CMS, E-Commerce, Frameworks",
529 " 10000 | Django (PBKDF2-SHA256) | Forums, CMS, E-Commerce, Frameworks",
530 " 3711 | Mediawiki B type | Forums, CMS, E-Commerce, Frameworks",
531 " 7600 | Redmine | Forums, CMS, E-Commerce, Frameworks",
532 " 12 | PostgreSQL | Database Server",
533 " 131 | MSSQL(2000) | Database Server",
534 " 132 | MSSQL(2005) | Database Server",
535 " 1731 | MSSQL(2012) | Database Server",
536 " 1731 | MSSQL(2014) | Database Server",
537 " 200 | MySQL323 | Database Server",
538 " 300 | MySQL4.1/MySQL5 | Database Server",
539 " 3100 | Oracle H: Type (Oracle 7+) | Database Server",
540 " 112 | Oracle S: Type (Oracle 11+) | Database Server",
541 " 12300 | Oracle T: Type (Oracle 12+) | Database Server",
542 " 8000 | Sybase ASE | Database Server",
543 " 141 | EPiServer 6.x < v4 | HTTP, SMTP, LDAP Server",
544 " 1441 | EPiServer 6.x > v4 | HTTP, SMTP, LDAP Server",
545 " 1600 | Apache $apr1$ | HTTP, SMTP, LDAP Server",
546 " 12600 | ColdFusion 10+ | HTTP, SMTP, LDAP Server",
547 " 1421 | hMailServer | HTTP, SMTP, LDAP Server",
548 " 101 | nsldap, SHA-1(Base64), Netscape LDAP SHA | HTTP, SMTP, LDAP Server",
549 " 111 | nsldaps, SSHA-1(Base64), Netscape LDAP SSHA | HTTP, SMTP, LDAP Server",
550 " 1711 | SSHA-512(Base64), LDAP {SSHA512} | HTTP, SMTP, LDAP Server",
551 " 11500 | CRC32 | Checksums",
552 " 3000 | LM | Operating-Systems",
553 " 1000 | NTLM | Operating-Systems",
554 " 1100 | Domain Cached Credentials (DCC), MS Cache | Operating-Systems",
555 " 2100 | Domain Cached Credentials 2 (DCC2), MS Cache 2 | Operating-Systems",
556 " 12800 | MS-AzureSync PBKDF2-HMAC-SHA256 | Operating-Systems",
557 " 1500 | descrypt, DES(Unix), Traditional DES | Operating-Systems",
558 " 12400 | BSDiCrypt, Extended DES | Operating-Systems",
559 " 500 | md5crypt $1$, MD5(Unix) | Operating-Systems",
560 " 3200 | bcrypt $2*$, Blowfish(Unix) | Operating-Systems",
561 " 7400 | sha256crypt $5$, SHA256(Unix) | Operating-Systems",
562 " 1800 | sha512crypt $6$, SHA512(Unix) | Operating-Systems",
563 " 122 | OSX v10.4, OSX v10.5, OSX v10.6 | Operating-Systems",
564 " 1722 | OSX v10.7 | Operating-Systems",
565 " 7100 | OSX v10.8, OSX v10.9, OSX v10.10 | Operating-Systems",
566 " 6300 | AIX {smd5} | Operating-Systems",
567 " 6700 | AIX {ssha1} | Operating-Systems",
568 " 6400 | AIX {ssha256} | Operating-Systems",
569 " 6500 | AIX {ssha512} | Operating-Systems",
570 " 2400 | Cisco-PIX | Operating-Systems",
571 " 2410 | Cisco-ASA | Operating-Systems",
572 " 500 | Cisco-IOS $1$ | Operating-Systems",
573 " 5700 | Cisco-IOS $4$ | Operating-Systems",
574 " 9200 | Cisco-IOS $8$ | Operating-Systems",
575 " 9300 | Cisco-IOS $9$ | Operating-Systems",
576 " 22 | Juniper Netscreen/SSG (ScreenOS) | Operating-Systems",
577 " 501 | Juniper IVE | Operating-Systems",
578 " 5800 | Android PIN | Operating-Systems",
579 " 8100 | Citrix Netscaler | Operating-Systems",
580 " 8500 | RACF | Operating-Systems",
581 " 7200 | GRUB 2 | Operating-Systems",
582 " 9900 | Radmin2 | Operating-Systems",
583 " 125 | ArubaOS | Operating-Systems",
584 " 7700 | SAP CODVN B (BCODE) | Enterprise Application Software (EAS)",
585 " 7800 | SAP CODVN F/G (PASSCODE) | Enterprise Application Software (EAS)",
586 " 10300 | SAP CODVN H (PWDSALTEDHASH) iSSHA-1 | Enterprise Application Software (EAS)",
587 " 8600 | Lotus Notes/Domino 5 | Enterprise Application Software (EAS)",
588 " 8700 | Lotus Notes/Domino 6 | Enterprise Application Software (EAS)",
589 " 9100 | Lotus Notes/Domino 8 | Enterprise Application Software (EAS)",
590 " 133 | PeopleSoft | Enterprise Application Software (EAS)",
591 " 13500 | PeopleSoft Token | Enterprise Application Software (EAS)",
592 " 11600 | 7-Zip | Archives",
593 " 12500 | RAR3-hp | Archives",
594 " 13000 | RAR5 | Archives",
595 " 13200 | AxCrypt | Archives",
596 " 13300 | AxCrypt in memory SHA1 | Archives",
597 " 13600 | WinZip | Archives",
598 " 62XY | TrueCrypt | Full-Disk encryptions (FDE)",
599 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
600 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
601 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
602 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
603 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
604 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
605 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
606 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
607 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
608 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
609 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
610 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
611 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
612 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
613 " 8800 | Android FDE < v4.3 | Full-Disk encryptions (FDE)",
614 " 12900 | Android FDE (Samsung DEK) | Full-Disk encryptions (FDE)",
615 " 12200 | eCryptfs | Full-Disk encryptions (FDE)",
616 " 137XY | VeraCrypt | Full-Disk encryptions (FDE)",
617 " X | 1 = PBKDF2-HMAC-RipeMD160 | Full-Disk encryptions (FDE)",
618 " X | 2 = PBKDF2-HMAC-SHA512 | Full-Disk encryptions (FDE)",
619 " X | 3 = PBKDF2-HMAC-Whirlpool | Full-Disk encryptions (FDE)",
620 " X | 4 = PBKDF2-HMAC-RipeMD160 + boot-mode | Full-Disk encryptions (FDE)",
621 " X | 5 = PBKDF2-HMAC-SHA256 | Full-Disk encryptions (FDE)",
622 " X | 6 = PBKDF2-HMAC-SHA256 + boot-mode | Full-Disk encryptions (FDE)",
623 " Y | 1 = XTS 512 bit pure AES | Full-Disk encryptions (FDE)",
624 " Y | 1 = XTS 512 bit pure Serpent | Full-Disk encryptions (FDE)",
625 " Y | 1 = XTS 512 bit pure Twofish | Full-Disk encryptions (FDE)",
626 " Y | 2 = XTS 1024 bit pure AES | Full-Disk encryptions (FDE)",
627 " Y | 2 = XTS 1024 bit pure Serpent | Full-Disk encryptions (FDE)",
628 " Y | 2 = XTS 1024 bit pure Twofish | Full-Disk encryptions (FDE)",
629 " Y | 2 = XTS 1024 bit cascaded AES-Twofish | Full-Disk encryptions (FDE)",
630 " Y | 2 = XTS 1024 bit cascaded Serpent-AES | Full-Disk encryptions (FDE)",
631 " Y | 2 = XTS 1024 bit cascaded Twofish-Serpent | Full-Disk encryptions (FDE)",
632 " Y | 3 = XTS 1536 bit all | Full-Disk encryptions (FDE)",
633 " 9700 | MS Office <= 2003 $0|$1, MD5 + RC4 | Documents",
634 " 9710 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #1 | Documents",
635 " 9720 | MS Office <= 2003 $0|$1, MD5 + RC4, collider #2 | Documents",
636 " 9800 | MS Office <= 2003 $3|$4, SHA1 + RC4 | Documents",
637 " 9810 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #1 | Documents",
638 " 9820 | MS Office <= 2003 $3|$4, SHA1 + RC4, collider #2 | Documents",
639 " 9400 | MS Office 2007 | Documents",
640 " 9500 | MS Office 2010 | Documents",
641 " 9600 | MS Office 2013 | Documents",
642 " 10400 | PDF 1.1 - 1.3 (Acrobat 2 - 4) | Documents",
643 " 10410 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #1 | Documents",
644 " 10420 | PDF 1.1 - 1.3 (Acrobat 2 - 4), collider #2 | Documents",
645 " 10500 | PDF 1.4 - 1.6 (Acrobat 5 - 8) | Documents",
646 " 10600 | PDF 1.7 Level 3 (Acrobat 9) | Documents",
647 " 10700 | PDF 1.7 Level 8 (Acrobat 10 - 11) | Documents",
648 " 9000 | Password Safe v2 | Password Managers",
649 " 5200 | Password Safe v3 | Password Managers",
650 " 6800 | Lastpass + Lastpass sniffed | Password Managers",
651 " 6600 | 1Password, agilekeychain | Password Managers",
652 " 8200 | 1Password, cloudkeychain | Password Managers",
653 " 11300 | Bitcoin/Litecoin wallet.dat | Password Managers",
654 " 12700 | Blockchain, My Wallet | Password Managers",
655 " 13400 | Keepass 1 (AES/Twofish) and Keepass 2 (AES) | Password Managers",
657 "#####################",
658 "## Outfile Formats ##",
659 "#####################",
665 " 3 | hash[:salt]:plain",
667 " 5 | hash[:salt]:hex_plain",
668 " 6 | plain:hex_plain",
669 " 7 | hash[:salt]:plain:hex_plain",
671 " 9 | hash[:salt]:crack_pos",
672 " 10 | plain:crack_pos",
673 " 11 | hash[:salt]:plain:crack_pos",
674 " 12 | hex_plain:crack_pos",
675 " 13 | hash[:salt]:hex_plain:crack_pos",
676 " 14 | plain:hex_plain:crack_pos",
677 " 15 | hash[:salt]:plain:hex_plain:crack_pos",
679 "##########################",
680 "## Rule Debugging Modes ##",
681 "##########################",
686 " 2 | Original-Word",
687 " 3 | Original-Word:Finding-Rule",
688 " 4 | Original-Word:Finding-Rule:Processed-Word",
690 "##################",
691 "## Attack Modes ##",
692 "##################",
699 " 6 | Hybrid Wordlist + Mask",
700 " 7 | Hybrid Mask + Wordlist",
702 "#######################",
703 "## Built-in Charsets ##",
704 "#######################",
708 " l | abcdefghijklmnopqrstuvwxyz",
709 " u | ABCDEFGHIJKLMNOPQRSTUVWXYZ",
711 " s | !\"#$%%&'()*+,-./:;<=>?@[\\]^_`{|}~",
715 "#########################",
716 "## OpenCL Device Types ##",
717 "#########################",
720 " ---+-------------",
723 " 3 | FPGA, DSP, Co-Processor",
725 "#######################",
726 "## Workload Profiles ##",
727 "#######################",
729 " # | Performance | Runtime | Power Consumption | Desktop Impact",
730 " ---+-------------+---------+-------------------+----------------",
731 " 1 | Low | 2 ms | Low | Minimal",
732 " 2 | Default | 12 ms | Economic | Noticeable",
733 " 3 | High | 96 ms | High | Unresponsive",
734 " 4 | Nightmare | 480 ms | Insane | Headless",
736 "If you have no idea what just happened then visit the following pages:",
738 "* https://hashcat.net/wiki/#howtos_videos_papers_articles_etc_in_the_wild",
739 "* https://hashcat.net/wiki/#frequently_asked_questions",
745 * hashcat specific functions
748 static double get_avg_exec_time (hc_device_param_t
*device_param
, const int last_num_entries
)
750 int exec_pos
= (int) device_param
->exec_pos
- last_num_entries
;
752 if (exec_pos
< 0) exec_pos
+= EXEC_CACHE
;
754 double exec_ms_sum
= 0;
758 for (int i
= 0; i
< last_num_entries
; i
++)
760 double exec_ms
= device_param
->exec_ms
[(exec_pos
+ i
) % EXEC_CACHE
];
764 exec_ms_sum
+= exec_ms
;
770 if (exec_ms_cnt
== 0) return 0;
772 return exec_ms_sum
/ exec_ms_cnt
;
775 void status_display_automat ()
779 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
785 fprintf (out
, "SPEED\t");
787 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
789 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
791 if (device_param
->skipped
) continue;
796 for (int i
= 0; i
< SPEED_CACHE
; i
++)
798 speed_cnt
+= device_param
->speed_cnt
[i
];
799 speed_ms
+= device_param
->speed_ms
[i
];
802 speed_cnt
/= SPEED_CACHE
;
803 speed_ms
/= SPEED_CACHE
;
805 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
812 fprintf (out
, "EXEC_RUNTIME\t");
814 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
816 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
818 if (device_param
->skipped
) continue;
820 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
822 fprintf (out
, "%f\t", exec_ms_avg
);
829 u64 words_cur
= get_lowest_words_done ();
831 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
837 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
840 u64 all_rejected
= 0;
841 u64 all_restored
= 0;
843 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
845 all_done
+= data
.words_progress_done
[salt_pos
];
846 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
847 all_restored
+= data
.words_progress_restored
[salt_pos
];
850 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
851 u64 progress_end
= progress_total
;
853 u64 progress_skip
= 0;
857 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
859 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
860 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
861 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
866 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
868 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
869 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
870 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
873 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
874 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
876 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
882 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
883 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
890 if (data
.gpu_temp_disable
== 0)
892 fprintf (out
, "TEMP\t");
894 hc_thread_mutex_lock (mux_adl
);
896 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
898 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
900 if (device_param
->skipped
) continue;
902 int temp
= hm_get_temperature_with_device_id (device_id
);
904 fprintf (out
, "%d\t", temp
);
907 hc_thread_mutex_unlock (mux_adl
);
927 void status_display ()
929 if (data
.devices_status
== STATUS_INIT
) return;
930 if (data
.devices_status
== STATUS_STARTING
) return;
931 if (data
.devices_status
== STATUS_BYPASS
) return;
933 if (data
.status_automat
== 1)
935 status_display_automat ();
940 char tmp_buf
[1000] = { 0 };
944 log_info ("Session.Name...: %s", data
.session
);
946 char *status_type
= strstatus (data
.devices_status
);
948 uint hash_mode
= data
.hash_mode
;
950 char *hash_type
= strhashtype (hash_mode
); // not a bug
952 log_info ("Status.........: %s", status_type
);
958 if (data
.rp_files_cnt
)
962 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
964 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
967 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
969 log_info ("Rules.Type.....: %s", tmp_buf
);
976 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
978 if (data
.rp_gen_seed
)
980 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
988 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
990 if (data
.wordlist_mode
== WL_MODE_FILE
)
992 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
994 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
996 log_info ("Input.Mode.....: Pipe");
999 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1001 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1002 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
1004 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1006 char *mask
= data
.mask
;
1010 uint mask_len
= data
.css_cnt
;
1012 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
1016 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1018 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1020 mask_len
-= data
.salts_buf
[0].salt_len
;
1024 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
1026 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
1029 if (data
.maskcnt
> 1)
1031 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
1033 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
1036 log_info ("Input.Mode.....: %s", tmp_buf
);
1041 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1043 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
1044 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1046 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1048 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
1049 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
1052 if (data
.digests_cnt
== 1)
1054 if (data
.hash_mode
== 2500)
1056 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
1058 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1059 (char *) data
.salts_buf
[0].salt_buf
,
1073 else if (data
.hash_mode
== 5200)
1075 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1077 else if (data
.hash_mode
== 9000)
1079 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1081 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1083 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1085 else if ((data
.hash_mode
>= 13700) && (data
.hash_mode
<= 13799))
1087 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1091 char out_buf
[HCBUFSIZ
] = { 0 };
1093 ascii_digest (out_buf
, 0, 0);
1096 if (strlen (out_buf
) > 40)
1104 log_info ("Hash.Target....: %s", out_buf
);
1109 if (data
.hash_mode
== 3000)
1111 char out_buf1
[32] = { 0 };
1112 char out_buf2
[32] = { 0 };
1114 ascii_digest (out_buf1
, 0, 0);
1115 ascii_digest (out_buf2
, 0, 1);
1117 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1121 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1125 log_info ("Hash.Type......: %s", hash_type
);
1131 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1132 double speed_ms
[DEVICES_MAX
] = { 0 };
1134 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1136 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1138 if (device_param
->skipped
) continue;
1140 speed_cnt
[device_id
] = 0;
1141 speed_ms
[device_id
] = 0;
1143 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1145 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1146 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1149 speed_cnt
[device_id
] /= SPEED_CACHE
;
1150 speed_ms
[device_id
] /= SPEED_CACHE
;
1153 double hashes_all_ms
= 0;
1155 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1157 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1159 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1161 if (device_param
->skipped
) continue;
1163 hashes_dev_ms
[device_id
] = 0;
1165 if (speed_ms
[device_id
])
1167 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1169 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1177 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1179 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1181 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1183 if (device_param
->skipped
) continue;
1185 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1187 exec_all_ms
[device_id
] = exec_ms_avg
;
1194 double ms_running
= 0;
1196 hc_timer_get (data
.timer_running
, ms_running
);
1198 double ms_paused
= data
.ms_paused
;
1200 if (data
.devices_status
== STATUS_PAUSED
)
1202 double ms_paused_tmp
= 0;
1204 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1206 ms_paused
+= ms_paused_tmp
;
1211 __time64_t sec_run
= ms_running
/ 1000;
1215 time_t sec_run
= ms_running
/ 1000;
1221 char display_run
[32] = { 0 };
1225 struct tm
*tmp
= NULL
;
1229 tmp
= _gmtime64 (&sec_run
);
1233 tmp
= gmtime (&sec_run
);
1239 memset (&tm_run
, 0, sizeof (tm_run
));
1241 memcpy (&tm_run
, tmp
, sizeof (tm_run
));
1243 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1245 char *start
= ctime (&data
.proc_start
);
1247 size_t start_len
= strlen (start
);
1249 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1250 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1252 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1257 log_info ("Time.Started...: 0 secs");
1264 u64 progress_total
= data
.words_cnt
* data
.salts_cnt
;
1267 u64 all_rejected
= 0;
1268 u64 all_restored
= 0;
1270 u64 progress_noneed
= 0;
1272 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1274 all_done
+= data
.words_progress_done
[salt_pos
];
1275 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1276 all_restored
+= data
.words_progress_restored
[salt_pos
];
1278 // Important for ETA only
1280 if (data
.salts_shown
[salt_pos
] == 1)
1282 const u64 all
= data
.words_progress_done
[salt_pos
]
1283 + data
.words_progress_rejected
[salt_pos
]
1284 + data
.words_progress_restored
[salt_pos
];
1286 const u64 left
= data
.words_cnt
- all
;
1288 progress_noneed
+= left
;
1292 u64 progress_cur
= all_restored
+ all_done
+ all_rejected
;
1293 u64 progress_end
= progress_total
;
1295 u64 progress_skip
= 0;
1299 progress_skip
= MIN (data
.skip
, data
.words_base
) * data
.salts_cnt
;
1301 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.kernel_rules_cnt
;
1302 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1303 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1308 progress_end
= MIN (data
.limit
, data
.words_base
) * data
.salts_cnt
;
1310 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.kernel_rules_cnt
;
1311 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1312 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1315 u64 progress_cur_relative_skip
= progress_cur
- progress_skip
;
1316 u64 progress_end_relative_skip
= progress_end
- progress_skip
;
1318 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1320 if (data
.devices_status
!= STATUS_CRACKED
)
1323 __time64_t sec_etc
= 0;
1330 u64 progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1332 u64 ms_left
= (progress_left_relative_skip
- progress_noneed
) / hashes_all_ms
;
1334 sec_etc
= ms_left
/ 1000;
1339 //log_info ("Time.Estimated.: 0 secs");
1341 else if ((u64
) sec_etc
> ETC_MAX
)
1343 log_info ("Time.Estimated.: > 10 Years");
1347 char display_etc
[32] = { 0 };
1351 struct tm
*tmp
= NULL
;
1355 tmp
= _gmtime64 (&sec_etc
);
1359 tmp
= gmtime (&sec_etc
);
1365 memset (&tm_etc
, 0, sizeof (tm_etc
));
1367 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1369 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1377 char *etc
= ctime (&now
);
1379 size_t etc_len
= strlen (etc
);
1381 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1382 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1384 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1390 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1392 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1394 if (device_param
->skipped
) continue;
1396 char display_dev_cur
[16] = { 0 };
1398 strncpy (display_dev_cur
, "0.00", 4);
1400 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1402 log_info ("Speed.Dev.#%d...: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1405 char display_all_cur
[16] = { 0 };
1407 strncpy (display_all_cur
, "0.00", 4);
1409 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1411 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*...: %9sH/s", display_all_cur
);
1413 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1414 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1416 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);
1420 if (data
.digests_cnt
> 100)
1422 time_t now
= time (NULL
);
1424 int cpt_cur_min
= 0;
1425 int cpt_cur_hour
= 0;
1426 int cpt_cur_day
= 0;
1428 for (int i
= 0; i
< CPT_BUF
; i
++)
1430 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1431 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1433 if ((timestamp
+ 60) > now
)
1435 cpt_cur_min
+= cracked
;
1438 if ((timestamp
+ 3600) > now
)
1440 cpt_cur_hour
+= cracked
;
1443 if ((timestamp
+ 86400) > now
)
1445 cpt_cur_day
+= cracked
;
1449 double ms_real
= ms_running
- ms_paused
;
1451 float cpt_avg_min
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 60);
1452 float cpt_avg_hour
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 3600);
1453 float cpt_avg_day
= (float) data
.cpt_total
/ ((ms_real
/ 1000) / 86400);
1455 if ((data
.cpt_start
+ 86400) < now
)
1457 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1465 else if ((data
.cpt_start
+ 3600) < now
)
1467 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1474 else if ((data
.cpt_start
+ 60) < now
)
1476 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1484 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1493 u64 restore_point
= get_lowest_words_done ();
1495 u64 restore_total
= data
.words_base
;
1497 float percent_restore
= 0;
1499 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1501 if (progress_end_relative_skip
)
1503 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1505 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1506 float percent_rejected
= 0.0;
1510 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1513 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);
1514 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1516 if (data
.restore_disable
== 0)
1518 if (percent_finished
!= 1)
1520 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1527 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1529 log_info ("Progress.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1530 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1532 if (data
.restore_disable
== 0)
1534 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (u64
) 0, (u64
) 0, (float) 100);
1539 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1540 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1542 // --restore not allowed if stdin is used -- really? why?
1544 //if (data.restore_disable == 0)
1546 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1552 if (data
.gpu_temp_disable
== 0)
1554 hc_thread_mutex_lock (mux_adl
);
1556 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1558 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1560 if (device_param
->skipped
) continue;
1562 #define HM_STR_BUF_SIZE 255
1564 if (data
.hm_device
[device_id
].fan_supported
== 1)
1566 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1567 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1568 char fanspeed
[HM_STR_BUF_SIZE
] = { 0 };
1570 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1571 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1573 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
1575 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1577 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
1579 hm_device_val_to_str ((char *) fanspeed
, HM_STR_BUF_SIZE
, "%", hm_get_fanspeed_with_device_id (device_id
));
1582 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, %s Fan", device_id
+ 1, utilization
, temperature
, fanspeed
);
1586 char utilization
[HM_STR_BUF_SIZE
] = { 0 };
1587 char temperature
[HM_STR_BUF_SIZE
] = { 0 };
1589 hm_device_val_to_str ((char *) utilization
, HM_STR_BUF_SIZE
, "%", hm_get_utilization_with_device_id (device_id
));
1590 hm_device_val_to_str ((char *) temperature
, HM_STR_BUF_SIZE
, "c", hm_get_temperature_with_device_id (device_id
));
1592 log_info ("HWMon.GPU.#%d...: %s Util, %s Temp, N/A Fan", device_id
+ 1, utilization
, temperature
);
1596 hc_thread_mutex_unlock (mux_adl
);
1598 #endif // HAVE_HWMON
1601 static void status_benchmark_automat ()
1603 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1604 double speed_ms
[DEVICES_MAX
] = { 0 };
1606 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1608 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1610 if (device_param
->skipped
) continue;
1612 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1613 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1616 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1618 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1620 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1622 if (device_param
->skipped
) continue;
1624 hashes_dev_ms
[device_id
] = 0;
1626 if (speed_ms
[device_id
])
1628 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1632 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1634 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1636 if (device_param
->skipped
) continue;
1638 log_info ("%u:%u:%llu", device_id
+ 1, data
.hash_mode
, (unsigned long long int) (hashes_dev_ms
[device_id
] * 1000));
1642 static void status_benchmark ()
1644 if (data
.devices_status
== STATUS_INIT
) return;
1645 if (data
.devices_status
== STATUS_STARTING
) return;
1646 if (data
.devices_status
== STATUS_BYPASS
) return;
1648 if (data
.status_automat
== 1)
1650 status_benchmark_automat ();
1655 u64 speed_cnt
[DEVICES_MAX
] = { 0 };
1656 double speed_ms
[DEVICES_MAX
] = { 0 };
1658 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1660 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1662 if (device_param
->skipped
) continue;
1664 speed_cnt
[device_id
] = device_param
->speed_cnt
[0];
1665 speed_ms
[device_id
] = device_param
->speed_ms
[0];
1668 double hashes_all_ms
= 0;
1670 double hashes_dev_ms
[DEVICES_MAX
] = { 0 };
1672 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1674 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1676 if (device_param
->skipped
) continue;
1678 hashes_dev_ms
[device_id
] = 0;
1680 if (speed_ms
[device_id
])
1682 hashes_dev_ms
[device_id
] = (double) speed_cnt
[device_id
] / speed_ms
[device_id
];
1684 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1692 double exec_all_ms
[DEVICES_MAX
] = { 0 };
1694 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1696 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1698 if (device_param
->skipped
) continue;
1700 double exec_ms_avg
= get_avg_exec_time (device_param
, EXEC_CACHE
);
1702 exec_all_ms
[device_id
] = exec_ms_avg
;
1705 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1707 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1709 if (device_param
->skipped
) continue;
1711 char display_dev_cur
[16] = { 0 };
1713 strncpy (display_dev_cur
, "0.00", 4);
1715 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1717 log_info ("Speed.Dev.#%d.: %9sH/s (%0.2fms)", device_id
+ 1, display_dev_cur
, exec_all_ms
[device_id
]);
1720 char display_all_cur
[16] = { 0 };
1722 strncpy (display_all_cur
, "0.00", 4);
1724 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1726 if (data
.devices_active
> 1) log_info ("Speed.Dev.#*.: %9sH/s", display_all_cur
);
1730 * hashcat -only- functions
1733 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *shared_dir
, char *source_file
)
1735 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1737 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1738 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", shared_dir
, (int) kern_type
);
1739 else if (attack_kern
== ATTACK_KERN_COMBI
)
1740 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1741 else if (attack_kern
== ATTACK_KERN_BF
)
1742 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1745 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1748 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
)
1750 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
1752 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1753 snprintf (cached_file
, 255, "%s/kernels/m%05d_a0.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1754 else if (attack_kern
== ATTACK_KERN_COMBI
)
1755 snprintf (cached_file
, 255, "%s/kernels/m%05d_a1.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1756 else if (attack_kern
== ATTACK_KERN_BF
)
1757 snprintf (cached_file
, 255, "%s/kernels/m%05d_a3.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1761 snprintf (cached_file
, 255, "%s/kernels/m%05d.%s.kernel", profile_dir
, (int) kern_type
, device_name_chksum
);
1765 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *shared_dir
, char *source_file
)
1767 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1769 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", shared_dir
);
1773 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1777 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
)
1779 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1781 snprintf (cached_file
, 255, "%s/kernels/markov_be.%s.kernel", profile_dir
, device_name_chksum
);
1785 snprintf (cached_file
, 255, "%s/kernels/markov_le.%s.kernel", profile_dir
, device_name_chksum
);
1789 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1791 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1794 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_dir
, const char *device_name_chksum
, char *cached_file
)
1796 snprintf (cached_file
, 255, "%s/kernels/amp_a%d.%s.kernel", profile_dir
, attack_kern
, device_name_chksum
);
1799 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1801 if (line_len
& 1) return (line_len
); // not in hex
1803 if (data
.hex_wordlist
== 1)
1808 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1810 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1813 memset (line_buf
+ i
, 0, line_len
- i
);
1817 else if (line_len
>= 6) // $HEX[] = 6
1819 if (line_buf
[0] != '$') return (line_len
);
1820 if (line_buf
[1] != 'H') return (line_len
);
1821 if (line_buf
[2] != 'E') return (line_len
);
1822 if (line_buf
[3] != 'X') return (line_len
);
1823 if (line_buf
[4] != '[') return (line_len
);
1824 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1829 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1831 line_buf
[i
] = hex_to_u8 ((const u8
*) &line_buf
[j
]);
1834 memset (line_buf
+ i
, 0, line_len
- i
);
1842 static void clear_prompt ()
1844 fputc ('\r', stdout
);
1846 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1848 fputc (' ', stdout
);
1851 fputc ('\r', stdout
);
1856 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const u64 gidd
, pw_t
*pw
)
1858 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
);
1861 static void check_hash (hc_device_param_t
*device_param
, plain_t
*plain
)
1863 char *outfile
= data
.outfile
;
1864 uint quiet
= data
.quiet
;
1865 FILE *pot_fp
= data
.pot_fp
;
1866 uint loopback
= data
.loopback
;
1867 uint debug_mode
= data
.debug_mode
;
1868 char *debug_file
= data
.debug_file
;
1870 char debug_rule_buf
[BLOCK_SIZE
] = { 0 };
1871 int debug_rule_len
= 0; // -1 error
1872 uint debug_plain_len
= 0;
1874 u8 debug_plain_ptr
[BLOCK_SIZE
] = { 0 };
1878 char out_buf
[HCBUFSIZ
] = { 0 };
1880 const u32 salt_pos
= plain
->salt_pos
;
1881 const u32 digest_pos
= plain
->digest_pos
; // relative
1882 const u32 gidvid
= plain
->gidvid
;
1883 const u32 il_pos
= plain
->il_pos
;
1885 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1889 u64 crackpos
= device_param
->words_off
;
1891 uint plain_buf
[16] = { 0 };
1893 u8
*plain_ptr
= (u8
*) plain_buf
;
1895 unsigned int plain_len
= 0;
1897 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1901 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1903 for (int i
= 0; i
< 16; i
++)
1905 plain_buf
[i
] = pw
.i
[i
];
1908 plain_len
= pw
.pw_len
;
1910 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1917 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1919 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1921 debug_rule_len
= kernel_rule_to_cpu_rule (debug_rule_buf
, &data
.kernel_rules_buf
[off
]);
1925 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1927 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1929 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1931 debug_plain_len
= plain_len
;
1935 plain_len
= apply_rules (data
.kernel_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1938 crackpos
*= data
.kernel_rules_cnt
;
1939 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1941 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1943 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1947 gidd_to_pw_t (device_param
, gidvid
, &pw
);
1949 for (int i
= 0; i
< 16; i
++)
1951 plain_buf
[i
] = pw
.i
[i
];
1954 plain_len
= pw
.pw_len
;
1956 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1957 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1959 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1961 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1965 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1967 memcpy (plain_ptr
, comb_buf
, comb_len
);
1970 plain_len
+= comb_len
;
1973 crackpos
*= data
.combs_cnt
;
1974 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1976 if (data
.pw_max
!= PW_DICTMAX1
)
1978 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1981 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1983 u64 l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1984 u64 r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1986 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1987 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1989 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1990 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1992 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1993 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1995 plain_len
= data
.css_cnt
;
1998 crackpos
*= data
.bfs_cnt
;
1999 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2001 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2005 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2007 for (int i
= 0; i
< 16; i
++)
2009 plain_buf
[i
] = pw
.i
[i
];
2012 plain_len
= pw
.pw_len
;
2014 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2017 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2019 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2021 plain_len
+= start
+ stop
;
2024 crackpos
*= data
.combs_cnt
;
2025 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2027 if (data
.pw_max
!= PW_DICTMAX1
)
2029 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2032 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2036 gidd_to_pw_t (device_param
, gidvid
, &pw
);
2038 for (int i
= 0; i
< 16; i
++)
2040 plain_buf
[i
] = pw
.i
[i
];
2043 plain_len
= pw
.pw_len
;
2045 u64 off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
2048 uint stop
= device_param
->kernel_params_mp_buf32
[4];
2050 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
2052 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
2054 plain_len
+= start
+ stop
;
2057 crackpos
*= data
.combs_cnt
;
2058 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
2060 if (data
.pw_max
!= PW_DICTMAX1
)
2062 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
2066 if (data
.attack_mode
== ATTACK_MODE_BF
)
2068 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
2070 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
2072 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
2074 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2078 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2080 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2082 plain_ptr
[j
] = plain_ptr
[i
];
2085 plain_len
= plain_len
/ 2;
2090 // if enabled, update also the potfile
2096 fprintf (pot_fp
, "%s:", out_buf
);
2098 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2100 fputc ('\n', pot_fp
);
2104 unlock_file (pot_fp
);
2109 FILE *out_fp
= NULL
;
2111 if (outfile
!= NULL
)
2113 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2115 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2125 if (quiet
== 0) clear_prompt ();
2128 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2130 if (outfile
!= NULL
)
2132 if (out_fp
!= stdout
)
2139 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2141 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2143 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2144 if (quiet
== 0) fflush (stdout
);
2153 char *loopback_file
= data
.loopback_file
;
2157 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2161 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2163 fputc ('\n', fb_fp
);
2169 // (rule) debug mode
2171 // the next check implies that:
2172 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2175 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2177 if (debug_rule_len
< 0) debug_rule_len
= 0;
2179 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2181 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2183 if ((quiet
== 0) && (debug_file
== NULL
))
2185 fprintf (stdout
, "%s", PROMPT
);
2192 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2194 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2198 hc_clEnqueueReadBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2202 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2206 plain_t
*cracked
= (plain_t
*) mycalloc (num_cracked
, sizeof (plain_t
));
2208 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
);
2210 uint cpt_cracked
= 0;
2212 for (uint i
= 0; i
< num_cracked
; i
++)
2214 const uint hash_pos
= cracked
[i
].hash_pos
;
2216 if (data
.digests_shown
[hash_pos
] == 1) continue;
2218 hc_thread_mutex_lock (mux_display
);
2220 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2222 data
.digests_shown
[hash_pos
] = 1;
2224 data
.digests_done
++;
2228 salt_buf
->digests_done
++;
2230 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2232 data
.salts_shown
[salt_pos
] = 1;
2238 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2240 hc_thread_mutex_unlock (mux_display
);
2242 check_hash (device_param
, &cracked
[i
]);
2247 if (cpt_cracked
> 0)
2249 hc_thread_mutex_lock (mux_display
);
2251 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2252 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2256 data
.cpt_total
+= cpt_cracked
;
2258 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2260 hc_thread_mutex_unlock (mux_display
);
2263 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2265 // we need to reset cracked state on the device
2266 // otherwise host thinks again and again the hash was cracked
2267 // and returns invalid password each time
2269 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2271 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
);
2276 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, sizeof (u32
), &num_cracked
, 0, NULL
, NULL
);
2280 static void save_hash ()
2282 char *hashfile
= data
.hashfile
;
2284 char new_hashfile
[256] = { 0 };
2285 char old_hashfile
[256] = { 0 };
2287 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2288 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2290 unlink (new_hashfile
);
2292 char separator
= data
.separator
;
2294 FILE *fp
= fopen (new_hashfile
, "wb");
2298 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2303 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2305 if (data
.salts_shown
[salt_pos
] == 1) continue;
2307 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2309 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2311 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2313 if (data
.digests_shown
[idx
] == 1) continue;
2315 if (data
.hash_mode
!= 2500)
2317 char out_buf
[HCBUFSIZ
] = { 0 };
2319 if (data
.username
== 1)
2321 user_t
*user
= data
.hash_info
[idx
]->user
;
2325 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2327 fputc (separator
, fp
);
2330 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2332 fputs (out_buf
, fp
);
2340 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2342 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2351 unlink (old_hashfile
);
2353 if (rename (hashfile
, old_hashfile
) != 0)
2355 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2362 if (rename (new_hashfile
, hashfile
) != 0)
2364 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2369 unlink (old_hashfile
);
2372 static float find_kernel_power_div (const u64 total_left
, const uint kernel_power_all
)
2374 // function called only in case kernel_power_all > words_left
2376 float kernel_power_div
= (float) (total_left
) / kernel_power_all
;
2378 kernel_power_div
+= kernel_power_div
/ 100;
2380 u32 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2382 while (kernel_power_new
< total_left
)
2384 kernel_power_div
+= kernel_power_div
/ 100;
2386 kernel_power_new
= (u32
) (kernel_power_all
* kernel_power_div
);
2389 if (data
.quiet
== 0)
2395 log_info ("INFO: approaching final keyspace, workload adjusted");
2398 fprintf (stdout
, "%s", PROMPT
);
2403 if ((kernel_power_all
* kernel_power_div
) < 8) return 1;
2405 return kernel_power_div
;
2408 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
, const uint event_update
)
2410 uint num_elements
= num
;
2412 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2413 device_param
->kernel_params_buf32
[31] = num
;
2415 uint kernel_threads
= device_param
->kernel_threads
;
2417 while (num_elements
% kernel_threads
) num_elements
++;
2419 cl_kernel kernel
= NULL
;
2423 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2424 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2425 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2426 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2427 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2430 hc_clSetKernelArg (data
.ocl
, kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2431 hc_clSetKernelArg (data
.ocl
, kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2432 hc_clSetKernelArg (data
.ocl
, kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2433 hc_clSetKernelArg (data
.ocl
, kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2434 hc_clSetKernelArg (data
.ocl
, kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2435 hc_clSetKernelArg (data
.ocl
, kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2436 hc_clSetKernelArg (data
.ocl
, kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2437 hc_clSetKernelArg (data
.ocl
, kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2438 hc_clSetKernelArg (data
.ocl
, kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2439 hc_clSetKernelArg (data
.ocl
, kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2440 hc_clSetKernelArg (data
.ocl
, kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2444 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2446 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2447 const size_t local_work_size
[3] = { kernel_threads
/ 32, 32, 1 };
2449 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2453 if (kern_run
== KERN_RUN_2
)
2455 if (data
.opti_type
& OPTI_TYPE_SLOW_HASH_SIMD
)
2457 num_elements
= CEIL ((float) num_elements
/ device_param
->vector_width
);
2461 while (num_elements
% kernel_threads
) num_elements
++;
2463 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2464 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2466 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, &event
);
2469 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2471 hc_clWaitForEvents (data
.ocl
, 1, &event
);
2475 cl_ulong time_start
;
2478 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_START
, sizeof (time_start
), &time_start
, NULL
);
2479 hc_clGetEventProfilingInfo (data
.ocl
, event
, CL_PROFILING_COMMAND_END
, sizeof (time_end
), &time_end
, NULL
);
2481 const double exec_time
= (double) (time_end
- time_start
) / 1000000.0;
2483 uint exec_pos
= device_param
->exec_pos
;
2485 device_param
->exec_ms
[exec_pos
] = exec_time
;
2489 if (exec_pos
== EXEC_CACHE
)
2494 device_param
->exec_pos
= exec_pos
;
2497 hc_clReleaseEvent (data
.ocl
, event
);
2499 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2502 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2504 uint num_elements
= num
;
2508 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2509 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2510 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2513 // causes problems with special threads like in bcrypt
2514 // const uint kernel_threads = device_param->kernel_threads;
2516 uint kernel_threads
= device_param
->kernel_threads
;
2518 while (num_elements
% kernel_threads
) num_elements
++;
2520 cl_kernel kernel
= NULL
;
2524 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2525 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2526 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2531 case KERN_RUN_MP
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2532 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2533 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2534 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2535 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2536 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2538 case KERN_RUN_MP_R
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2539 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2540 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2541 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2542 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2543 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2545 case KERN_RUN_MP_L
: hc_clSetKernelArg (data
.ocl
, kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2546 hc_clSetKernelArg (data
.ocl
, kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2547 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2548 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2549 hc_clSetKernelArg (data
.ocl
, kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2550 hc_clSetKernelArg (data
.ocl
, kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2551 hc_clSetKernelArg (data
.ocl
, kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2555 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2556 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2558 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2560 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2562 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2565 static void run_kernel_tm (hc_device_param_t
*device_param
)
2567 const uint num_elements
= 1024; // fixed
2569 uint kernel_threads
= 32;
2571 cl_kernel kernel
= device_param
->kernel_tm
;
2573 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2574 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2576 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2578 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2580 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2583 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2585 uint num_elements
= num
;
2587 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2588 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2590 // causes problems with special threads like in bcrypt
2591 // const uint kernel_threads = device_param->kernel_threads;
2593 uint kernel_threads
= device_param
->kernel_threads
;
2595 while (num_elements
% kernel_threads
) num_elements
++;
2597 cl_kernel kernel
= device_param
->kernel_amp
;
2599 hc_clSetKernelArg (data
.ocl
, kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2600 hc_clSetKernelArg (data
.ocl
, kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2602 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2603 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2605 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2607 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2609 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2612 static void run_kernel_memset (hc_device_param_t
*device_param
, cl_mem buf
, const uint value
, const uint num
)
2614 const u32 num16d
= num
/ 16;
2615 const u32 num16m
= num
% 16;
2619 device_param
->kernel_params_memset_buf32
[1] = value
;
2620 device_param
->kernel_params_memset_buf32
[2] = num16d
;
2622 uint kernel_threads
= device_param
->kernel_threads
;
2624 uint num_elements
= num16d
;
2626 while (num_elements
% kernel_threads
) num_elements
++;
2628 cl_kernel kernel
= device_param
->kernel_memset
;
2630 hc_clSetKernelArg (data
.ocl
, kernel
, 0, sizeof (cl_mem
), (void *) &buf
);
2631 hc_clSetKernelArg (data
.ocl
, kernel
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
2632 hc_clSetKernelArg (data
.ocl
, kernel
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
2634 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2635 const size_t local_work_size
[3] = { kernel_threads
, 1, 1 };
2637 hc_clEnqueueNDRangeKernel (data
.ocl
, device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2639 hc_clFlush (data
.ocl
, device_param
->command_queue
);
2641 hc_clFinish (data
.ocl
, device_param
->command_queue
);
2653 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, buf
, CL_TRUE
, num16d
* 16, num16m
, tmp
, 0, NULL
, NULL
);
2657 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const size_t size
)
2659 run_kernel_memset (device_param
, buf
, 0, size
);
2664 if (device_param->opencl_v12 && device_param->platform_vendor_id == VENDOR_ID_AMD)
2666 // So far tested, amd is the only supporting this OpenCL 1.2 function without segfaulting
2668 const cl_uchar zero = 0;
2670 rc = hc_clEnqueueFillBuffer (data.ocl, device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2675 // NOTE: clEnqueueFillBuffer () always fails with -59
2676 // IOW, it's not supported by Nvidia drivers <= 352.21, also pocl segfaults, also on apple
2677 // How's that possible, OpenCL 1.2 support is advertised??
2678 // We need to workaround...
2680 #define FILLSZ 0x100000
2682 char *tmp = (char *) mymalloc (FILLSZ);
2684 for (size_t i = 0; i < size; i += FILLSZ)
2686 const size_t left = size - i;
2688 const size_t fillsz = MIN (FILLSZ, left);
2690 hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, buf, CL_TRUE, i, fillsz, tmp, 0, NULL, NULL);
2698 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
)
2700 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2702 if (attack_mode
== ATTACK_MODE_BF
)
2704 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
2706 const uint size_tm
= 32 * sizeof (bs_word_t
);
2708 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2710 run_kernel_tm (device_param
);
2712 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
);
2716 if (highest_pw_len
< 16)
2718 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, true);
2720 else if (highest_pw_len
< 32)
2722 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2726 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, true);
2731 run_kernel_amp (device_param
, pws_cnt
);
2733 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
, false);
2735 if (opts_type
& OPTS_TYPE_HOOK12
)
2737 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
, false);
2740 uint iter
= salt_buf
->salt_iter
;
2742 uint loop_step
= device_param
->kernel_loops
;
2744 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
2746 uint loop_left
= iter
- loop_pos
;
2748 loop_left
= MIN (loop_left
, loop_step
);
2750 device_param
->kernel_params_buf32
[25] = loop_pos
;
2751 device_param
->kernel_params_buf32
[26] = loop_left
;
2753 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
, true);
2755 if (data
.devices_status
== STATUS_CRACKED
) break;
2756 if (data
.devices_status
== STATUS_ABORTED
) break;
2757 if (data
.devices_status
== STATUS_QUIT
) break;
2763 const float iter_part
= (float) (loop_pos
+ loop_left
) / iter
;
2765 const u64 perf_sum_all
= pws_cnt
* iter_part
;
2769 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2771 const u32 speed_pos
= device_param
->speed_pos
;
2773 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2775 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2777 if (data
.benchmark
== 1)
2779 if (speed_ms
> 4096) data
.devices_status
= STATUS_ABORTED
;
2783 if (opts_type
& OPTS_TYPE_HOOK23
)
2785 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
, false);
2787 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
);
2789 // do something with data
2791 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
);
2794 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
, false);
2798 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2804 else if (rule_len
== 1)
2806 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2812 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2814 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2816 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
);
2818 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2820 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2822 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
2824 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2826 for (u32 i
= 0; i
< pws_cnt
; i
++)
2828 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2830 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2835 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2837 for (u32 i
= 0; i
< pws_cnt
; i
++)
2839 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2841 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2848 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2850 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2852 for (u32 i
= 0; i
< pws_cnt
; i
++)
2854 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2856 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2861 else if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2863 for (u32 i
= 0; i
< pws_cnt
; i
++)
2865 const u32 pw_len
= device_param
->pws_buf
[i
].pw_len
;
2867 u8
*ptr
= (u8
*) device_param
->pws_buf
[i
].i
;
2874 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
);
2876 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2878 const u64 off
= device_param
->words_off
;
2880 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2882 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2886 static double try_run (hc_device_param_t
*device_param
, const u32 kernel_accel
, const u32 kernel_loops
)
2888 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel
;
2890 device_param
->kernel_params_buf32
[25] = 0;
2891 device_param
->kernel_params_buf32
[26] = kernel_loops
; // not a bug, both need to be set
2892 device_param
->kernel_params_buf32
[27] = kernel_loops
; // because there's two variables for inner iters for slow and fast hashes
2894 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
2896 run_kernel (KERN_RUN_1
, device_param
, kernel_power
, true);
2900 run_kernel (KERN_RUN_2
, device_param
, kernel_power
, true);
2903 const double exec_ms_prev
= get_avg_exec_time (device_param
, 1);
2905 return exec_ms_prev
;
2908 static void autotune (hc_device_param_t
*device_param
)
2910 const double target_ms
= TARGET_MS_PROFILE
[data
.workload_profile
- 1];
2912 const u32 kernel_accel_min
= device_param
->kernel_accel_min
;
2913 const u32 kernel_accel_max
= device_param
->kernel_accel_max
;
2915 const u32 kernel_loops_min
= device_param
->kernel_loops_min
;
2916 const u32 kernel_loops_max
= device_param
->kernel_loops_max
;
2918 u32 kernel_accel
= kernel_accel_min
;
2919 u32 kernel_loops
= kernel_loops_min
;
2921 // in this case the user specified a fixed -u and -n on the commandline
2922 // no way to tune anything
2923 // but we need to run a few caching rounds
2925 if ((kernel_loops_min
== kernel_loops_max
) && (kernel_accel_min
== kernel_accel_max
))
2927 try_run (device_param
, kernel_accel
, kernel_loops
);
2928 try_run (device_param
, kernel_accel
, kernel_loops
);
2929 try_run (device_param
, kernel_accel
, kernel_loops
);
2930 try_run (device_param
, kernel_accel
, kernel_loops
);
2932 device_param
->kernel_accel
= kernel_accel
;
2933 device_param
->kernel_loops
= kernel_loops
;
2935 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
2937 device_param
->kernel_power
= kernel_power
;
2942 // from here it's clear we are allowed to autotune
2943 // so let's init some fake words
2945 const u32 kernel_power_max
= device_param
->device_processors
* device_param
->kernel_threads
* kernel_accel_max
;
2947 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2949 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
2951 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 7, kernel_power_max
* sizeof (pw_t
));
2955 for (u32 i = 0; i < kernel_power_max; i++)
2957 device_param->pws_buf[i].i[0] = i;
2958 device_param->pws_buf[i].i[1] = 0x01234567;
2959 device_param->pws_buf[i].pw_len = 7;
2962 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);
2964 if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL)
2966 run_kernel_amp (device_param, kernel_power_max);
2970 #define VERIFIER_CNT 1
2972 // first find out highest kernel-loops that stays below target_ms
2974 if (kernel_loops_min
< kernel_loops_max
)
2976 for (kernel_loops
= kernel_loops_max
; kernel_loops
> kernel_loops_min
; kernel_loops
>>= 1)
2978 double exec_ms
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2980 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
2982 double exec_ms_v
= try_run (device_param
, kernel_accel_min
, kernel_loops
);
2984 exec_ms
= MIN (exec_ms
, exec_ms_v
);
2987 if (exec_ms
< target_ms
) break;
2991 // now the same for kernel-accel but with the new kernel-loops from previous loop set
2993 #define STEPS_CNT 10
2995 if (kernel_accel_min
< kernel_accel_max
)
2997 for (int i
= 0; i
< STEPS_CNT
; i
++)
2999 const u32 kernel_accel_try
= 1 << i
;
3001 if (kernel_accel_try
< kernel_accel_min
) continue;
3002 if (kernel_accel_try
> kernel_accel_max
) break;
3004 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3006 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3008 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops
);
3010 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3013 if (exec_ms
> target_ms
) break;
3015 kernel_accel
= kernel_accel_try
;
3019 // at this point we want to know the actual runtime for the following reason:
3020 // we need a reference for the balancing loop following up, and this
3021 // the balancing loop can have an effect that the creates a new opportunity, for example:
3022 // if the target is 95 ms and the current runtime is 48ms the above loop
3023 // stopped the execution because the previous exec_ms was > 95ms
3024 // due to the rebalance it's possible that the runtime reduces from 48ms to 47ms
3025 // and this creates the possibility to double the workload -> 47 * 2 = 95ms, which is < 96ms
3027 double exec_ms_pre_final
= try_run (device_param
, kernel_accel
, kernel_loops
);
3029 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3031 double exec_ms_pre_final_v
= try_run (device_param
, kernel_accel
, kernel_loops
);
3033 exec_ms_pre_final
= MIN (exec_ms_pre_final
, exec_ms_pre_final_v
);
3036 u32 diff
= kernel_loops
- kernel_accel
;
3038 if ((kernel_loops_min
< kernel_loops_max
) && (kernel_accel_min
< kernel_accel_max
))
3040 u32 kernel_accel_orig
= kernel_accel
;
3041 u32 kernel_loops_orig
= kernel_loops
;
3043 for (u32 f
= 1; f
< 1024; f
++)
3045 const u32 kernel_accel_try
= (float) kernel_accel_orig
* f
;
3046 const u32 kernel_loops_try
= (float) kernel_loops_orig
/ f
;
3048 if (kernel_accel_try
> kernel_accel_max
) break;
3049 if (kernel_loops_try
< kernel_loops_min
) break;
3051 u32 diff_new
= kernel_loops_try
- kernel_accel_try
;
3053 if (diff_new
> diff
) break;
3057 double exec_ms
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3059 for (int i
= 0; i
< VERIFIER_CNT
; i
++)
3061 double exec_ms_v
= try_run (device_param
, kernel_accel_try
, kernel_loops_try
);
3063 exec_ms
= MIN (exec_ms
, exec_ms_v
);
3066 if (exec_ms
< exec_ms_pre_final
)
3068 exec_ms_pre_final
= exec_ms
;
3070 kernel_accel
= kernel_accel_try
;
3071 kernel_loops
= kernel_loops_try
;
3076 const double exec_left
= target_ms
/ exec_ms_pre_final
;
3078 const double accel_left
= kernel_accel_max
/ kernel_accel
;
3080 const double exec_accel_min
= MIN (exec_left
, accel_left
); // we want that to be int
3082 if (exec_accel_min
>= 1.0)
3084 // this is safe to not overflow kernel_accel_max because of accel_left
3086 kernel_accel
= (double) kernel_accel
* exec_accel_min
;
3089 // reset them fake words
3092 memset (device_param->pws_buf, 0, kernel_power_max * sizeof (pw_t));
3094 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);
3095 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);
3098 run_kernel_memset (device_param
, device_param
->d_pws_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3100 if (data
.attack_exec
== ATTACK_EXEC_OUTSIDE_KERNEL
)
3102 run_kernel_memset (device_param
, device_param
->d_pws_amp_buf
, 0, kernel_power_max
* sizeof (pw_t
));
3107 device_param
->exec_pos
= 0;
3109 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
3113 device_param
->kernel_accel
= kernel_accel
;
3114 device_param
->kernel_loops
= kernel_loops
;
3116 const u32 kernel_power
= device_param
->device_processors
* device_param
->kernel_threads
* device_param
->kernel_accel
;
3118 device_param
->kernel_power
= kernel_power
;
3122 if (data
.quiet
== 0)
3126 log_info ("Device #%u: autotuned kernel-accel to %u\n"
3127 "Device #%u: autotuned kernel-loops to %u\n",
3128 device_param
->device_id
+ 1, kernel_accel
,
3129 device_param
->device_id
+ 1, kernel_loops
);
3131 fprintf (stdout
, "%s", PROMPT
);
3139 static void run_cracker (hc_device_param_t
*device_param
, const uint pws_cnt
)
3141 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
3145 uint speed_pos
= device_param
->speed_pos
;
3148 if (device_param
->timer_speed
.tv_sec
== 0)
3150 hc_timer_set (&device_param
->timer_speed
);
3155 if (device_param
->timer_speed
.QuadPart
== 0)
3157 hc_timer_set (&device_param
->timer_speed
);
3161 // find higest password length, this is for optimization stuff
3163 uint highest_pw_len
= 0;
3165 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3168 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3171 else if (data
.attack_kern
== ATTACK_KERN_BF
)
3173 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
3174 + device_param
->kernel_params_mp_l_buf32
[5];
3179 uint innerloop_step
= 0;
3180 uint innerloop_cnt
= 0;
3182 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
) innerloop_step
= device_param
->kernel_loops
;
3183 else innerloop_step
= 1;
3185 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
3186 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
3187 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
3189 // loop start: most outer loop = salt iteration, then innerloops (if multi)
3191 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3193 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3195 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3197 if (data
.devices_status
== STATUS_CRACKED
) break;
3198 if (data
.devices_status
== STATUS_ABORTED
) break;
3199 if (data
.devices_status
== STATUS_QUIT
) break;
3200 if (data
.devices_status
== STATUS_BYPASS
) break;
3202 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3204 device_param
->kernel_params_buf32
[24] = salt_pos
;
3205 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
3206 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
3208 FILE *combs_fp
= device_param
->combs_fp
;
3210 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3217 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
3219 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
3221 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3223 if (data
.devices_status
== STATUS_CRACKED
) break;
3224 if (data
.devices_status
== STATUS_ABORTED
) break;
3225 if (data
.devices_status
== STATUS_QUIT
) break;
3226 if (data
.devices_status
== STATUS_BYPASS
) break;
3228 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
3230 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
3232 device_param
->innerloop_pos
= innerloop_pos
;
3233 device_param
->innerloop_left
= innerloop_left
;
3235 device_param
->kernel_params_buf32
[27] = innerloop_left
;
3237 // i think we can get rid of this
3238 if (innerloop_left
== 0)
3240 puts ("bug, how should this happen????\n");
3245 if (data
.salts_shown
[salt_pos
] == 1)
3247 data
.words_progress_done
[salt_pos
] += (u64
) pws_cnt
* (u64
) innerloop_left
;
3252 // initialize amplifiers
3254 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3258 while (i
< innerloop_left
)
3260 if (feof (combs_fp
)) break;
3262 int line_len
= fgetl (combs_fp
, line_buf
);
3264 if (line_len
>= PW_MAX1
) continue;
3266 line_len
= convert_from_hex (line_buf
, line_len
);
3268 char *line_buf_new
= line_buf
;
3270 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
3272 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3274 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
3276 if (rule_len_out
< 0)
3278 data
.words_progress_rejected
[salt_pos
] += pws_cnt
;
3283 line_len
= rule_len_out
;
3285 line_buf_new
= rule_buf_out
;
3288 line_len
= MIN (line_len
, PW_DICTMAX
);
3290 u8
*ptr
= (u8
*) device_param
->combs_buf
[i
].i
;
3292 memcpy (ptr
, line_buf_new
, line_len
);
3294 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
3296 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
3298 uppercase (ptr
, line_len
);
3301 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
3303 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
3305 ptr
[line_len
] = 0x80;
3308 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
3310 ptr
[line_len
] = 0x01;
3314 device_param
->combs_buf
[i
].pw_len
= line_len
;
3319 for (uint j
= i
; j
< innerloop_left
; j
++)
3321 device_param
->combs_buf
[j
].i
[0] = 0;
3322 device_param
->combs_buf
[j
].i
[1] = 0;
3323 device_param
->combs_buf
[j
].i
[2] = 0;
3324 device_param
->combs_buf
[j
].i
[3] = 0;
3325 device_param
->combs_buf
[j
].i
[4] = 0;
3326 device_param
->combs_buf
[j
].i
[5] = 0;
3327 device_param
->combs_buf
[j
].i
[6] = 0;
3328 device_param
->combs_buf
[j
].i
[7] = 0;
3330 device_param
->combs_buf
[j
].pw_len
= 0;
3335 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3337 u64 off
= innerloop_pos
;
3339 device_param
->kernel_params_mp_r_buf64
[3] = off
;
3341 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
3343 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3345 u64 off
= innerloop_pos
;
3347 device_param
->kernel_params_mp_buf64
[3] = off
;
3349 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3351 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3353 u64 off
= innerloop_pos
;
3355 device_param
->kernel_params_mp_buf64
[3] = off
;
3357 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
3362 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
3364 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
);
3366 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
3368 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
);
3370 else if (data
.attack_mode
== ATTACK_MODE_BF
)
3372 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
);
3374 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
3376 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
);
3378 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
3380 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
);
3383 if (data
.benchmark
== 1)
3385 hc_timer_set (&device_param
->timer_speed
);
3388 choose_kernel (device_param
, data
.attack_exec
, data
.attack_mode
, data
.opts_type
, salt_buf
, highest_pw_len
, pws_cnt
);
3390 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
3392 if (data
.devices_status
== STATUS_CRACKED
) break;
3393 if (data
.devices_status
== STATUS_ABORTED
) break;
3394 if (data
.devices_status
== STATUS_QUIT
) break;
3400 check_cracked (device_param
, salt_pos
);
3406 u64 perf_sum_all
= (u64
) pws_cnt
* (u64
) innerloop_left
;
3408 hc_thread_mutex_lock (mux_counter
);
3410 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
3412 hc_thread_mutex_unlock (mux_counter
);
3420 hc_timer_get (device_param
->timer_speed
, speed_ms
);
3422 hc_timer_set (&device_param
->timer_speed
);
3426 //hc_thread_mutex_lock (mux_display);
3428 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
3430 device_param
->speed_ms
[speed_pos
] = speed_ms
;
3432 //hc_thread_mutex_unlock (mux_display);
3436 if (speed_pos
== SPEED_CACHE
)
3445 if (data
.benchmark
== 1) break;
3449 device_param
->speed_pos
= speed_pos
;
3454 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
3456 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
3460 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
3462 wl_data
->buf
[wl_data
->cnt
] = 0;
3464 if (wl_data
->cnt
== 0) return;
3466 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
3470 if (wl_data
->cnt
== wl_data
->avail
)
3472 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
3474 wl_data
->avail
+= wl_data
->incr
;
3477 const int c
= fgetc (fd
);
3479 if (c
== EOF
) break;
3481 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
3485 if (c
== '\n') break;
3488 // ensure stream ends with a newline
3490 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
3494 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3500 static void get_next_word_lm (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3504 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3506 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3516 if (*ptr
!= '\n') continue;
3520 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3531 static void get_next_word_uc (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3535 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3537 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3539 if (*ptr
!= '\n') continue;
3543 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3554 static void get_next_word_std (char *buf
, u32 sz
, u32
*len
, u32
*off
)
3558 for (u32 i
= 0; i
< sz
; i
++, ptr
++)
3560 if (*ptr
!= '\n') continue;
3564 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3575 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3577 while (wl_data
->pos
< wl_data
->cnt
)
3582 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3584 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3586 wl_data
->pos
+= off
;
3588 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3590 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3592 int rule_len_out
= -1;
3594 if (len
< BLOCK_SIZE
)
3596 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3599 if (rule_len_out
< 0)
3604 if (rule_len_out
> PW_MAX
)
3625 fprintf (stderr
, "BUG feof()!!\n");
3630 load_segment (wl_data
, fd
);
3632 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3636 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3640 static u64
count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3650 fstat (fileno (fd
), &d
.stat
);
3654 _fstat64 (fileno (fd
), &d
.stat
);
3658 d
.stat
.st_nlink
= 0;
3662 d
.stat
.st_atime
= 0;
3665 d
.stat
.st_blksize
= 0;
3666 d
.stat
.st_blocks
= 0;
3669 if (d
.stat
.st_size
== 0) return 0;
3671 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3673 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3677 u64 cnt
= d_cache
->cnt
;
3681 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3683 keyspace
*= data
.kernel_rules_cnt
;
3685 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3687 keyspace
*= data
.combs_cnt
;
3690 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
);
3691 if (data
.quiet
== 0) log_info ("");
3693 hc_signal (sigHandler_default
);
3708 load_segment (wl_data
, fd
);
3710 comp
+= wl_data
->cnt
;
3714 while (i
< wl_data
->cnt
)
3719 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3721 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3723 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
3725 int rule_len_out
= -1;
3727 if (len
< BLOCK_SIZE
)
3729 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3732 if (rule_len_out
< 0)
3744 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3746 cnt
+= data
.kernel_rules_cnt
;
3748 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3750 cnt
+= data
.combs_cnt
;
3763 if ((now
- prev
) == 0) continue;
3765 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3767 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
);
3772 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
);
3773 if (data
.quiet
== 0) log_info ("");
3775 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3777 hc_signal (sigHandler_default
);
3782 static void *thread_monitor (void *p
)
3784 uint runtime_check
= 0;
3785 uint remove_check
= 0;
3786 uint status_check
= 0;
3787 uint restore_check
= 0;
3789 uint restore_left
= data
.restore_timer
;
3790 uint remove_left
= data
.remove_timer
;
3791 uint status_left
= data
.status_timer
;
3794 uint hwmon_check
= 0;
3796 // these variables are mainly used for fan control (AMD only)
3798 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3800 // temperature controller "loopback" values
3802 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3803 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3806 int temp_threshold
= 1; // degrees celcius
3808 int fan_speed_min
= 15; // in percentage
3809 int fan_speed_max
= 100;
3812 time_t last_temp_check_time
;
3813 #endif // HAVE_HWMON
3815 uint sleep_time
= 1;
3822 if (data
.restore_timer
)
3827 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3832 if (data
.status
== 1)
3838 if (data
.gpu_temp_disable
== 0)
3840 time (&last_temp_check_time
);
3846 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (restore_check
== 0))
3849 if (hwmon_check
== 0)
3854 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3856 hc_sleep (sleep_time
);
3858 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3861 if (hwmon_check
== 1)
3863 hc_thread_mutex_lock (mux_adl
);
3865 time_t temp_check_time
;
3867 time (&temp_check_time
);
3869 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3871 if (Ta
== 0) Ta
= 1;
3873 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
3875 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
3877 if (device_param
->skipped
) continue;
3879 if ((data
.devices_param
[device_id
].device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
3881 const int temperature
= hm_get_temperature_with_device_id (device_id
);
3883 if (temperature
> (int) data
.gpu_temp_abort
)
3885 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", device_id
+ 1);
3887 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3893 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3895 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3897 if (data
.hm_device
[device_id
].fan_supported
== 1)
3899 int temp_cur
= temperature
;
3901 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3903 temp_diff_sum
[device_id
] = temp_diff_sum
[device_id
] + temp_diff_new
;
3905 // calculate Ta value (time difference in seconds between the last check and this check)
3907 last_temp_check_time
= temp_check_time
;
3913 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3915 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
);
3917 if (abs (fan_diff_required
) >= temp_threshold
)
3919 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (device_id
);
3921 int fan_speed_level
= fan_speed_cur
;
3923 if (fan_speed_chgd
[device_id
] == 0) fan_speed_level
= temp_cur
;
3925 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3927 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3928 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3930 if (fan_speed_new
!= fan_speed_cur
)
3932 int freely_change_fan_speed
= (fan_speed_chgd
[device_id
] == 1);
3933 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3935 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3937 hm_set_fanspeed_with_device_id_amd (device_id
, fan_speed_new
);
3939 fan_speed_chgd
[device_id
] = 1;
3942 temp_diff_old
[device_id
] = temp_diff_new
;
3950 hc_thread_mutex_unlock (mux_adl
);
3952 #endif // HAVE_HWMON
3954 if (restore_check
== 1)
3958 if (restore_left
== 0)
3960 if (data
.restore_disable
== 0) cycle_restore ();
3962 restore_left
= data
.restore_timer
;
3966 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3970 time (&runtime_cur
);
3972 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3974 if (runtime_left
<= 0)
3976 if (data
.benchmark
== 0)
3978 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3981 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3985 if (remove_check
== 1)
3989 if (remove_left
== 0)
3991 if (data
.digests_saved
!= data
.digests_done
)
3993 data
.digests_saved
= data
.digests_done
;
3998 remove_left
= data
.remove_timer
;
4002 if (status_check
== 1)
4006 if (status_left
== 0)
4008 //hc_thread_mutex_lock (mux_display);
4010 if (data
.quiet
== 0) clear_prompt ();
4012 if (data
.quiet
== 0) log_info ("");
4016 if (data
.quiet
== 0) log_info ("");
4018 //hc_thread_mutex_unlock (mux_display);
4020 status_left
= data
.status_timer
;
4026 myfree (fan_speed_chgd
);
4028 myfree (temp_diff_old
);
4029 myfree (temp_diff_sum
);
4037 static void *thread_outfile_remove (void *p
)
4039 // some hash-dependent constants
4040 char *outfile_dir
= data
.outfile_check_directory
;
4041 uint dgst_size
= data
.dgst_size
;
4042 uint isSalted
= data
.isSalted
;
4043 uint esalt_size
= data
.esalt_size
;
4044 uint hash_mode
= data
.hash_mode
;
4046 uint outfile_check_timer
= data
.outfile_check_timer
;
4048 char separator
= data
.separator
;
4050 // some hash-dependent functions
4051 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
4052 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
4055 hash_t hash_buf
= { 0, 0, 0, 0, 0 };
4057 hash_buf
.digest
= mymalloc (dgst_size
);
4059 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
4061 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
4063 uint digest_buf
[64] = { 0 };
4065 outfile_data_t
*out_info
= NULL
;
4067 char **out_files
= NULL
;
4069 time_t folder_mtime
= 0;
4073 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
4075 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4079 if (data
.devices_status
!= STATUS_RUNNING
) continue;
4083 if (check_left
== 0)
4085 struct stat outfile_check_stat
;
4087 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
4089 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
4093 if (outfile_check_stat
.st_mtime
> folder_mtime
)
4095 char **out_files_new
= scan_directory (outfile_dir
);
4097 int out_cnt_new
= count_dictionaries (out_files_new
);
4099 outfile_data_t
*out_info_new
= NULL
;
4101 if (out_cnt_new
> 0)
4103 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
4105 for (int i
= 0; i
< out_cnt_new
; i
++)
4107 out_info_new
[i
].file_name
= out_files_new
[i
];
4109 // check if there are files that we have seen/checked before (and not changed)
4111 for (int j
= 0; j
< out_cnt
; j
++)
4113 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
4115 struct stat outfile_stat
;
4117 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
4119 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
4121 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
4122 out_info_new
[i
].seek
= out_info
[j
].seek
;
4130 local_free (out_info
);
4131 local_free (out_files
);
4133 out_files
= out_files_new
;
4134 out_cnt
= out_cnt_new
;
4135 out_info
= out_info_new
;
4137 folder_mtime
= outfile_check_stat
.st_mtime
;
4140 for (int j
= 0; j
< out_cnt
; j
++)
4142 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
4146 //hc_thread_mutex_lock (mux_display);
4149 struct stat outfile_stat
;
4151 fstat (fileno (fp
), &outfile_stat
);
4155 struct stat64 outfile_stat
;
4157 _fstat64 (fileno (fp
), &outfile_stat
);
4160 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
4162 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
4163 out_info
[j
].seek
= 0;
4166 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
4168 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
4172 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
4174 if (ptr
== NULL
) break;
4176 int line_len
= strlen (line_buf
);
4178 if (line_len
<= 0) continue;
4180 int iter
= MAX_CUT_TRIES
;
4182 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
4184 if (line_buf
[i
] != separator
) continue;
4186 int parser_status
= PARSER_OK
;
4188 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
4190 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
4195 if (parser_status
== PARSER_OK
)
4197 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
4199 if (data
.salts_shown
[salt_pos
] == 1) continue;
4201 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4203 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
4205 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
4207 if (data
.digests_shown
[idx
] == 1) continue;
4211 if (hash_mode
== 6800)
4213 if (i
== salt_buf
->salt_len
)
4215 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4218 else if (hash_mode
== 2500)
4220 // BSSID : MAC1 : MAC2 (:plain)
4221 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
4223 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
4225 if (!cracked
) continue;
4227 // now compare MAC1 and MAC2 too, since we have this additional info
4228 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
4229 char *mac2_pos
= mac1_pos
+ 12 + 1;
4231 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
4232 wpa_t
*wpa
= &wpas
[salt_pos
];
4234 // compare hex string(s) vs binary MAC address(es)
4236 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4238 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
4247 if (!cracked
) continue;
4249 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
4251 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
4262 char *digests_buf_ptr
= (char *) data
.digests_buf
;
4264 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
4266 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
4273 data
.digests_shown
[idx
] = 1;
4275 data
.digests_done
++;
4277 salt_buf
->digests_done
++;
4279 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
4281 data
.salts_shown
[salt_pos
] = 1;
4285 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
4290 if (data
.devices_status
== STATUS_CRACKED
) break;
4296 if (data
.devices_status
== STATUS_CRACKED
) break;
4301 if (data
.devices_status
== STATUS_CRACKED
) break;
4306 out_info
[j
].seek
= ftell (fp
);
4308 //hc_thread_mutex_unlock (mux_display);
4316 check_left
= outfile_check_timer
;
4320 if (esalt_size
) local_free (hash_buf
.esalt
);
4322 if (isSalted
) local_free (hash_buf
.salt
);
4324 local_free (hash_buf
.digest
);
4326 local_free (out_info
);
4328 local_free (out_files
);
4335 static void pw_add (hc_device_param_t
*device_param
, const u8
*pw_buf
, const int pw_len
)
4337 if (device_param
->pws_cnt
< device_param
->kernel_power
)
4339 pw_t
*pw
= (pw_t
*) device_param
->pws_buf
+ device_param
->pws_cnt
;
4341 u8
*ptr
= (u8
*) pw
->i
;
4343 memcpy (ptr
, pw_buf
, pw_len
);
4345 memset (ptr
+ pw_len
, 0, sizeof (pw
->i
) - pw_len
);
4347 pw
->pw_len
= pw_len
;
4349 device_param
->pws_cnt
++;
4353 fprintf (stderr
, "BUG pw_add()!!\n");
4359 static uint
get_work (hc_device_param_t
*device_param
, const u64 max
, const bool allow_div
)
4361 hc_thread_mutex_lock (mux_dispatcher
);
4363 const u64 words_cur
= data
.words_cur
;
4364 const u64 words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
4366 device_param
->words_off
= words_cur
;
4368 const u64 words_left
= words_base
- words_cur
;
4372 if (data
.kernel_power_all
> words_left
)
4374 if (data
.kernel_power_div
== 0)
4376 data
.kernel_power_div
= find_kernel_power_div (words_left
, data
.kernel_power_all
);
4380 if (data
.kernel_power_div
)
4382 if (device_param
->kernel_power
== device_param
->kernel_power_user
)
4384 const u32 kernel_power_new
= (float) device_param
->kernel_power
* data
.kernel_power_div
;
4386 if (kernel_power_new
< device_param
->kernel_power
)
4388 device_param
->kernel_power
= kernel_power_new
;
4394 const uint kernel_power
= device_param
->kernel_power
;
4396 uint work
= MIN (words_left
, kernel_power
);
4398 work
= MIN (work
, max
);
4400 data
.words_cur
+= work
;
4402 hc_thread_mutex_unlock (mux_dispatcher
);
4407 static void *thread_calc_stdin (void *p
)
4409 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4411 if (device_param
->skipped
) return NULL
;
4413 autotune (device_param
);
4415 char *buf
= (char *) mymalloc (HCBUFSIZ
);
4417 const uint attack_kern
= data
.attack_kern
;
4419 const uint kernel_power
= device_param
->kernel_power
;
4421 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4423 hc_thread_mutex_lock (mux_dispatcher
);
4425 if (feof (stdin
) != 0)
4427 hc_thread_mutex_unlock (mux_dispatcher
);
4434 while (words_cur
< kernel_power
)
4436 char *line_buf
= fgets (buf
, HCBUFSIZ
- 1, stdin
);
4438 if (line_buf
== NULL
) break;
4440 uint line_len
= in_superchop (line_buf
);
4442 line_len
= convert_from_hex (line_buf
, line_len
);
4444 // post-process rule engine
4446 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4448 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4450 int rule_len_out
= -1;
4452 if (line_len
< BLOCK_SIZE
)
4454 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4457 if (rule_len_out
< 0) continue;
4459 line_buf
= rule_buf_out
;
4460 line_len
= rule_len_out
;
4463 if (line_len
> PW_MAX
)
4468 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4470 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4472 hc_thread_mutex_lock (mux_counter
);
4474 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4476 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4479 hc_thread_mutex_unlock (mux_counter
);
4484 else if (attack_kern
== ATTACK_KERN_COMBI
)
4486 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4487 // since we still need to combine the plains
4489 if (line_len
> data
.pw_max
)
4491 hc_thread_mutex_lock (mux_counter
);
4493 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4495 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4498 hc_thread_mutex_unlock (mux_counter
);
4504 pw_add (device_param
, (u8
*) line_buf
, line_len
);
4508 if (data
.devices_status
== STATUS_CRACKED
) break;
4509 if (data
.devices_status
== STATUS_ABORTED
) break;
4510 if (data
.devices_status
== STATUS_QUIT
) break;
4511 if (data
.devices_status
== STATUS_BYPASS
) break;
4514 hc_thread_mutex_unlock (mux_dispatcher
);
4516 if (data
.devices_status
== STATUS_CRACKED
) break;
4517 if (data
.devices_status
== STATUS_ABORTED
) break;
4518 if (data
.devices_status
== STATUS_QUIT
) break;
4519 if (data
.devices_status
== STATUS_BYPASS
) break;
4523 const uint pws_cnt
= device_param
->pws_cnt
;
4527 run_copy (device_param
, pws_cnt
);
4529 run_cracker (device_param
, pws_cnt
);
4531 device_param
->pws_cnt
= 0;
4535 if (attack_kern == ATTACK_KERN_STRAIGHT)
4537 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4539 else if (attack_kern == ATTACK_KERN_COMBI)
4541 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4547 device_param
->kernel_accel
= 0;
4548 device_param
->kernel_loops
= 0;
4555 static void *thread_calc (void *p
)
4557 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4559 if (device_param
->skipped
) return NULL
;
4561 autotune (device_param
);
4563 const uint attack_mode
= data
.attack_mode
;
4564 const uint attack_kern
= data
.attack_kern
;
4566 if (attack_mode
== ATTACK_MODE_BF
)
4568 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4570 const uint work
= get_work (device_param
, -1, true);
4572 if (work
== 0) break;
4574 const u64 words_off
= device_param
->words_off
;
4575 const u64 words_fin
= words_off
+ work
;
4577 const uint pws_cnt
= work
;
4579 device_param
->pws_cnt
= pws_cnt
;
4583 run_copy (device_param
, pws_cnt
);
4585 run_cracker (device_param
, pws_cnt
);
4587 device_param
->pws_cnt
= 0;
4591 run_kernel_bzero (device_param, device_param->d_bfs_c, device_param->size_bfs);
4595 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4597 if (data
.devices_status
== STATUS_CRACKED
) break;
4598 if (data
.devices_status
== STATUS_ABORTED
) break;
4599 if (data
.devices_status
== STATUS_QUIT
) break;
4600 if (data
.devices_status
== STATUS_BYPASS
) break;
4602 if (data
.benchmark
== 1) break;
4604 device_param
->words_done
= words_fin
;
4609 const uint segment_size
= data
.segment_size
;
4611 char *dictfile
= data
.dictfile
;
4613 if (attack_mode
== ATTACK_MODE_COMBI
)
4615 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4617 dictfile
= data
.dictfile2
;
4621 FILE *fd
= fopen (dictfile
, "rb");
4625 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4630 if (attack_mode
== ATTACK_MODE_COMBI
)
4632 const uint combs_mode
= data
.combs_mode
;
4634 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4636 const char *dictfilec
= data
.dictfile2
;
4638 FILE *combs_fp
= fopen (dictfilec
, "rb");
4640 if (combs_fp
== NULL
)
4642 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4649 device_param
->combs_fp
= combs_fp
;
4651 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4653 const char *dictfilec
= data
.dictfile
;
4655 FILE *combs_fp
= fopen (dictfilec
, "rb");
4657 if (combs_fp
== NULL
)
4659 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4666 device_param
->combs_fp
= combs_fp
;
4670 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4672 wl_data
->buf
= (char *) mymalloc (segment_size
);
4673 wl_data
->avail
= segment_size
;
4674 wl_data
->incr
= segment_size
;
4680 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4685 bool allow_div
= true;
4691 const uint work
= get_work (device_param
, max
, allow_div
);
4695 if (work
== 0) break;
4697 words_off
= device_param
->words_off
;
4698 words_fin
= words_off
+ work
;
4703 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4707 for ( ; words_cur
< words_fin
; words_cur
++)
4709 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4711 line_len
= convert_from_hex (line_buf
, line_len
);
4713 // post-process rule engine
4715 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4717 char rule_buf_out
[BLOCK_SIZE
] = { 0 };
4719 int rule_len_out
= -1;
4721 if (line_len
< BLOCK_SIZE
)
4723 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4726 if (rule_len_out
< 0) continue;
4728 line_buf
= rule_buf_out
;
4729 line_len
= rule_len_out
;
4732 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4734 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4738 hc_thread_mutex_lock (mux_counter
);
4740 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4742 data
.words_progress_rejected
[salt_pos
] += data
.kernel_rules_cnt
;
4745 hc_thread_mutex_unlock (mux_counter
);
4750 else if (attack_kern
== ATTACK_KERN_COMBI
)
4752 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4753 // since we still need to combine the plains
4755 if (line_len
> data
.pw_max
)
4759 hc_thread_mutex_lock (mux_counter
);
4761 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4763 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4766 hc_thread_mutex_unlock (mux_counter
);
4772 pw_add (device_param
, (u8
*) line_buf
, line_len
);
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;
4782 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4784 if (data
.devices_status
== STATUS_CRACKED
) break;
4785 if (data
.devices_status
== STATUS_ABORTED
) break;
4786 if (data
.devices_status
== STATUS_QUIT
) break;
4787 if (data
.devices_status
== STATUS_BYPASS
) break;
4790 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4792 if (data
.devices_status
== STATUS_CRACKED
) break;
4793 if (data
.devices_status
== STATUS_ABORTED
) break;
4794 if (data
.devices_status
== STATUS_QUIT
) break;
4795 if (data
.devices_status
== STATUS_BYPASS
) break;
4801 const uint pws_cnt
= device_param
->pws_cnt
;
4805 run_copy (device_param
, pws_cnt
);
4807 run_cracker (device_param
, pws_cnt
);
4809 device_param
->pws_cnt
= 0;
4813 if (attack_kern == ATTACK_KERN_STRAIGHT)
4815 run_kernel_bzero (device_param, device_param->d_rules_c, device_param->size_rules_c);
4817 else if (attack_kern == ATTACK_KERN_COMBI)
4819 run_kernel_bzero (device_param, device_param->d_combs_c, device_param->size_combs);
4824 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4826 if (data
.devices_status
== STATUS_CRACKED
) break;
4827 if (data
.devices_status
== STATUS_ABORTED
) break;
4828 if (data
.devices_status
== STATUS_QUIT
) break;
4829 if (data
.devices_status
== STATUS_BYPASS
) break;
4831 if (words_fin
== 0) break;
4833 device_param
->words_done
= words_fin
;
4836 if (attack_mode
== ATTACK_MODE_COMBI
)
4838 fclose (device_param
->combs_fp
);
4841 free (wl_data
->buf
);
4847 device_param
->kernel_accel
= 0;
4848 device_param
->kernel_loops
= 0;
4853 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
)
4857 log_error ("ERROR: %s : Invalid argument", __func__
);
4862 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4864 device_param
->kernel_params_buf32
[24] = salt_pos
;
4865 device_param
->kernel_params_buf32
[27] = 1;
4866 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4867 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4868 device_param
->kernel_params_buf32
[30] = 0;
4869 device_param
->kernel_params_buf32
[31] = 1;
4871 char *dictfile_old
= data
.dictfile
;
4873 const char *weak_hash_check
= "weak-hash-check";
4875 data
.dictfile
= (char *) weak_hash_check
;
4877 uint cmd0_rule_old
= data
.kernel_rules_buf
[0].cmds
[0];
4879 data
.kernel_rules_buf
[0].cmds
[0] = 0;
4885 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
4887 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4891 run_kernel (KERN_RUN_1
, device_param
, 1, false);
4893 uint loop_step
= 16;
4895 const uint iter
= salt_buf
->salt_iter
;
4897 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= loop_step
)
4899 uint loop_left
= iter
- loop_pos
;
4901 loop_left
= MIN (loop_left
, loop_step
);
4903 device_param
->kernel_params_buf32
[25] = loop_pos
;
4904 device_param
->kernel_params_buf32
[26] = loop_left
;
4906 run_kernel (KERN_RUN_2
, device_param
, 1, false);
4909 run_kernel (KERN_RUN_3
, device_param
, 1, false);
4916 check_cracked (device_param
, salt_pos
);
4922 device_param
->kernel_params_buf32
[24] = 0;
4923 device_param
->kernel_params_buf32
[25] = 0;
4924 device_param
->kernel_params_buf32
[26] = 0;
4925 device_param
->kernel_params_buf32
[27] = 0;
4926 device_param
->kernel_params_buf32
[28] = 0;
4927 device_param
->kernel_params_buf32
[29] = 0;
4928 device_param
->kernel_params_buf32
[30] = 0;
4929 device_param
->kernel_params_buf32
[31] = 0;
4931 data
.dictfile
= dictfile_old
;
4933 data
.kernel_rules_buf
[0].cmds
[0] = cmd0_rule_old
;
4938 static void hlfmt_hash_hashcat (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4940 if (data
.username
== 0)
4942 *hashbuf_pos
= line_buf
;
4943 *hashbuf_len
= line_len
;
4947 char *pos
= line_buf
;
4950 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4952 if (line_buf
[i
] == data
.separator
)
4967 static void hlfmt_user_hashcat (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
4974 for (int i
= 0; i
< line_len
; i
++)
4976 if (line_buf
[i
] == data
.separator
)
4985 if (pos
== NULL
) pos
= line_buf
+ i
;
4997 static int hlfmt_detect_pwdump (char *line_buf
, int line_len
)
5004 for (int i
= 0; i
< line_len
; i
++)
5006 if (line_buf
[i
] == ':')
5013 if (sep_cnt
== 2) sep2_len
++;
5014 if (sep_cnt
== 3) sep3_len
++;
5017 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
5022 static void hlfmt_hash_pwdump (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5029 for (int i
= 0; i
< line_len
; i
++)
5031 if (line_buf
[i
] == ':')
5038 if (data
.hash_mode
== 1000)
5042 if (pos
== NULL
) pos
= line_buf
+ i
;
5047 else if (data
.hash_mode
== 3000)
5051 if (pos
== NULL
) pos
= line_buf
+ i
;
5062 static void hlfmt_user_pwdump (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5069 for (int i
= 0; i
< line_len
; i
++)
5071 if (line_buf
[i
] == ':')
5080 if (pos
== NULL
) pos
= line_buf
+ i
;
5092 static int hlfmt_detect_passwd (char *line_buf
, int line_len
)
5096 char sep5_first
= 0;
5097 char sep6_first
= 0;
5099 for (int i
= 0; i
< line_len
; i
++)
5101 if (line_buf
[i
] == ':')
5108 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
5109 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
5112 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
5117 static void hlfmt_hash_passwd (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5124 for (int i
= 0; i
< line_len
; i
++)
5126 if (line_buf
[i
] == ':')
5135 if (pos
== NULL
) pos
= line_buf
+ i
;
5145 static void hlfmt_user_passwd (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5152 for (int i
= 0; i
< line_len
; i
++)
5154 if (line_buf
[i
] == ':')
5163 if (pos
== NULL
) pos
= line_buf
+ i
;
5175 static int hlfmt_detect_shadow (char *line_buf
, int line_len
)
5179 for (int i
= 0; i
< line_len
; i
++)
5181 if (line_buf
[i
] == ':') sep_cnt
++;
5184 if (sep_cnt
== 8) return 1;
5189 static void hlfmt_hash_shadow (char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5191 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
5194 static void hlfmt_user_shadow (char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5196 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
5201 static void hlfmt_hash (uint hashfile_format
, char *line_buf
, int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
5203 switch (hashfile_format
)
5205 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5206 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5207 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5208 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
5212 static void hlfmt_user (uint hashfile_format
, char *line_buf
, int line_len
, char **userbuf_pos
, int *userbuf_len
)
5214 switch (hashfile_format
)
5216 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5217 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5218 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5219 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
5223 char *strhlfmt (const uint hashfile_format
)
5225 switch (hashfile_format
)
5227 case HLFMT_HASHCAT
: return ((char *) HLFMT_TEXT_HASHCAT
); break;
5228 case HLFMT_PWDUMP
: return ((char *) HLFMT_TEXT_PWDUMP
); break;
5229 case HLFMT_PASSWD
: return ((char *) HLFMT_TEXT_PASSWD
); break;
5230 case HLFMT_SHADOW
: return ((char *) HLFMT_TEXT_SHADOW
); break;
5231 case HLFMT_DCC
: return ((char *) HLFMT_TEXT_DCC
); break;
5232 case HLFMT_DCC2
: return ((char *) HLFMT_TEXT_DCC2
); break;
5233 case HLFMT_NETNTLM1
: return ((char *) HLFMT_TEXT_NETNTLM1
); break;
5234 case HLFMT_NETNTLM2
: return ((char *) HLFMT_TEXT_NETNTLM2
); break;
5235 case HLFMT_NSLDAP
: return ((char *) HLFMT_TEXT_NSLDAP
); break;
5236 case HLFMT_NSLDAPS
: return ((char *) HLFMT_TEXT_NSLDAPS
); break;
5239 return ((char *) "Unknown");
5242 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
5244 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
5246 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
5247 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
5249 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
5253 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
5257 int line_len
= fgetl (fp
, line_buf
);
5259 if (line_len
== 0) continue;
5261 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
5262 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
5263 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
5265 if (num_check
== max_check
) break;
5272 uint hashlist_format
= HLFMT_HASHCAT
;
5274 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
5276 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
5278 hashlist_format
= i
;
5283 return hashlist_format
;
5287 * some further helper function
5290 // wrapper around mymalloc for ADL
5292 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5293 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
5295 return mymalloc (iSize
);
5299 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
)
5303 const uint dgst_pos0
= data
.dgst_pos0
;
5304 const uint dgst_pos1
= data
.dgst_pos1
;
5305 const uint dgst_pos2
= data
.dgst_pos2
;
5306 const uint dgst_pos3
= data
.dgst_pos3
;
5308 memset (bitmap_a
, 0, bitmap_size
);
5309 memset (bitmap_b
, 0, bitmap_size
);
5310 memset (bitmap_c
, 0, bitmap_size
);
5311 memset (bitmap_d
, 0, bitmap_size
);
5313 for (uint i
= 0; i
< digests_cnt
; i
++)
5315 if (data
.digests_shown
[i
] == 1) continue; // can happen with potfile
5317 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
5319 digests_buf_ptr
+= dgst_size
;
5321 const uint val0
= 1u << (digest_ptr
[dgst_pos0
] & 0x1f);
5322 const uint val1
= 1u << (digest_ptr
[dgst_pos1
] & 0x1f);
5323 const uint val2
= 1u << (digest_ptr
[dgst_pos2
] & 0x1f);
5324 const uint val3
= 1u << (digest_ptr
[dgst_pos3
] & 0x1f);
5326 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
5327 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
5328 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
5329 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
5331 if (bitmap_a
[idx0
] & val0
) collisions
++;
5332 if (bitmap_b
[idx1
] & val1
) collisions
++;
5333 if (bitmap_c
[idx2
] & val2
) collisions
++;
5334 if (bitmap_d
[idx3
] & val3
) collisions
++;
5336 bitmap_a
[idx0
] |= val0
;
5337 bitmap_b
[idx1
] |= val1
;
5338 bitmap_c
[idx2
] |= val2
;
5339 bitmap_d
[idx3
] |= val3
;
5341 if (collisions
>= collisions_max
) return 0x7fffffff;
5351 int main (int argc
, char **argv
)
5354 * To help users a bit
5357 char *compute
= getenv ("COMPUTE");
5361 static char display
[100];
5363 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
5369 if (getenv ("DISPLAY") == NULL
)
5370 putenv ((char *) "DISPLAY=:0");
5373 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL
)
5374 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
5376 if (getenv ("CPU_MAX_ALLOC_PERCENT") == NULL
)
5377 putenv ((char *) "CPU_MAX_ALLOC_PERCENT=100");
5379 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL
)
5380 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5382 if (getenv ("CUDA_CACHE_DISABLE") == NULL
)
5383 putenv ((char *) "CUDA_CACHE_DISABLE=1");
5385 if (getenv ("POCL_KERNEL_CACHE") == NULL
)
5386 putenv ((char *) "POCL_KERNEL_CACHE=0");
5394 memset (&data
, 0, sizeof (hc_global_data_t
));
5400 data
.proc_start
= proc_start
;
5403 char **myargv
= argv
;
5405 hc_thread_mutex_init (mux_dispatcher
);
5406 hc_thread_mutex_init (mux_counter
);
5407 hc_thread_mutex_init (mux_display
);
5408 hc_thread_mutex_init (mux_adl
);
5411 * commandline parameters
5415 uint version
= VERSION
;
5417 uint benchmark
= BENCHMARK
;
5420 uint username
= USERNAME
;
5421 uint remove
= REMOVE
;
5422 uint remove_timer
= REMOVE_TIMER
;
5425 uint keyspace
= KEYSPACE
;
5426 uint potfile_disable
= POTFILE_DISABLE
;
5427 char *potfile_path
= NULL
;
5428 uint debug_mode
= DEBUG_MODE
;
5429 char *debug_file
= NULL
;
5430 char *induction_dir
= NULL
;
5431 char *outfile_check_dir
= NULL
;
5433 uint runtime
= RUNTIME
;
5434 uint hash_mode
= HASH_MODE
;
5435 uint attack_mode
= ATTACK_MODE
;
5436 uint markov_disable
= MARKOV_DISABLE
;
5437 uint markov_classic
= MARKOV_CLASSIC
;
5438 uint markov_threshold
= MARKOV_THRESHOLD
;
5439 char *markov_hcstat
= NULL
;
5440 char *outfile
= NULL
;
5441 uint outfile_format
= OUTFILE_FORMAT
;
5442 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5443 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5444 uint restore
= RESTORE
;
5445 uint restore_timer
= RESTORE_TIMER
;
5446 uint restore_disable
= RESTORE_DISABLE
;
5447 uint status
= STATUS
;
5448 uint status_timer
= STATUS_TIMER
;
5449 uint status_automat
= STATUS_AUTOMAT
;
5450 uint loopback
= LOOPBACK
;
5451 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5452 char *session
= NULL
;
5453 uint hex_charset
= HEX_CHARSET
;
5454 uint hex_salt
= HEX_SALT
;
5455 uint hex_wordlist
= HEX_WORDLIST
;
5456 uint rp_gen
= RP_GEN
;
5457 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5458 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5459 uint rp_gen_seed
= RP_GEN_SEED
;
5460 char *rule_buf_l
= (char *) RULE_BUF_L
;
5461 char *rule_buf_r
= (char *) RULE_BUF_R
;
5462 uint increment
= INCREMENT
;
5463 uint increment_min
= INCREMENT_MIN
;
5464 uint increment_max
= INCREMENT_MAX
;
5465 char *cpu_affinity
= NULL
;
5466 OCL_PTR
*ocl
= NULL
;
5467 char *opencl_devices
= NULL
;
5468 char *opencl_platforms
= NULL
;
5469 char *opencl_device_types
= NULL
;
5470 uint opencl_vector_width
= OPENCL_VECTOR_WIDTH
;
5471 char *truecrypt_keyfiles
= NULL
;
5472 char *veracrypt_keyfiles
= NULL
;
5473 uint veracrypt_pim
= 0;
5474 uint workload_profile
= WORKLOAD_PROFILE
;
5475 uint kernel_accel
= KERNEL_ACCEL
;
5476 uint kernel_loops
= KERNEL_LOOPS
;
5477 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5479 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5480 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5482 uint powertune_enable
= POWERTUNE_ENABLE
;
5485 uint logfile_disable
= LOGFILE_DISABLE
;
5486 uint segment_size
= SEGMENT_SIZE
;
5487 uint scrypt_tmto
= SCRYPT_TMTO
;
5488 char separator
= SEPARATOR
;
5489 uint bitmap_min
= BITMAP_MIN
;
5490 uint bitmap_max
= BITMAP_MAX
;
5491 char *custom_charset_1
= NULL
;
5492 char *custom_charset_2
= NULL
;
5493 char *custom_charset_3
= NULL
;
5494 char *custom_charset_4
= NULL
;
5496 #define IDX_HELP 'h'
5497 #define IDX_VERSION 'V'
5498 #define IDX_VERSION_LOWER 'v'
5499 #define IDX_QUIET 0xff02
5500 #define IDX_SHOW 0xff03
5501 #define IDX_LEFT 0xff04
5502 #define IDX_REMOVE 0xff05
5503 #define IDX_REMOVE_TIMER 0xff37
5504 #define IDX_SKIP 's'
5505 #define IDX_LIMIT 'l'
5506 #define IDX_KEYSPACE 0xff35
5507 #define IDX_POTFILE_DISABLE 0xff06
5508 #define IDX_POTFILE_PATH 0xffe0
5509 #define IDX_DEBUG_MODE 0xff43
5510 #define IDX_DEBUG_FILE 0xff44
5511 #define IDX_INDUCTION_DIR 0xff46
5512 #define IDX_OUTFILE_CHECK_DIR 0xff47
5513 #define IDX_USERNAME 0xff07
5514 #define IDX_FORCE 0xff08
5515 #define IDX_RUNTIME 0xff09
5516 #define IDX_BENCHMARK 'b'
5517 #define IDX_HASH_MODE 'm'
5518 #define IDX_ATTACK_MODE 'a'
5519 #define IDX_RP_FILE 'r'
5520 #define IDX_RP_GEN 'g'
5521 #define IDX_RP_GEN_FUNC_MIN 0xff10
5522 #define IDX_RP_GEN_FUNC_MAX 0xff11
5523 #define IDX_RP_GEN_SEED 0xff34
5524 #define IDX_RULE_BUF_L 'j'
5525 #define IDX_RULE_BUF_R 'k'
5526 #define IDX_INCREMENT 'i'
5527 #define IDX_INCREMENT_MIN 0xff12
5528 #define IDX_INCREMENT_MAX 0xff13
5529 #define IDX_OUTFILE 'o'
5530 #define IDX_OUTFILE_FORMAT 0xff14
5531 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5532 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5533 #define IDX_RESTORE 0xff15
5534 #define IDX_RESTORE_DISABLE 0xff27
5535 #define IDX_STATUS 0xff17
5536 #define IDX_STATUS_TIMER 0xff18
5537 #define IDX_STATUS_AUTOMAT 0xff50
5538 #define IDX_LOOPBACK 0xff38
5539 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5540 #define IDX_SESSION 0xff19
5541 #define IDX_HEX_CHARSET 0xff20
5542 #define IDX_HEX_SALT 0xff21
5543 #define IDX_HEX_WORDLIST 0xff40
5544 #define IDX_MARKOV_DISABLE 0xff22
5545 #define IDX_MARKOV_CLASSIC 0xff23
5546 #define IDX_MARKOV_THRESHOLD 't'
5547 #define IDX_MARKOV_HCSTAT 0xff24
5548 #define IDX_CPU_AFFINITY 0xff25
5549 #define IDX_OPENCL_DEVICES 'd'
5550 #define IDX_OPENCL_PLATFORMS 0xff72
5551 #define IDX_OPENCL_DEVICE_TYPES 0xff73
5552 #define IDX_OPENCL_VECTOR_WIDTH 0xff74
5553 #define IDX_WORKLOAD_PROFILE 'w'
5554 #define IDX_KERNEL_ACCEL 'n'
5555 #define IDX_KERNEL_LOOPS 'u'
5556 #define IDX_GPU_TEMP_DISABLE 0xff29
5557 #define IDX_GPU_TEMP_ABORT 0xff30
5558 #define IDX_GPU_TEMP_RETAIN 0xff31
5559 #define IDX_POWERTUNE_ENABLE 0xff41
5560 #define IDX_LOGFILE_DISABLE 0xff51
5561 #define IDX_TRUECRYPT_KEYFILES 0xff52
5562 #define IDX_VERACRYPT_KEYFILES 0xff53
5563 #define IDX_VERACRYPT_PIM 0xff54
5564 #define IDX_SCRYPT_TMTO 0xff61
5565 #define IDX_SEGMENT_SIZE 'c'
5566 #define IDX_SEPARATOR 'p'
5567 #define IDX_BITMAP_MIN 0xff70
5568 #define IDX_BITMAP_MAX 0xff71
5569 #define IDX_CUSTOM_CHARSET_1 '1'
5570 #define IDX_CUSTOM_CHARSET_2 '2'
5571 #define IDX_CUSTOM_CHARSET_3 '3'
5572 #define IDX_CUSTOM_CHARSET_4 '4'
5574 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5576 struct option long_options
[] =
5578 {"help", no_argument
, 0, IDX_HELP
},
5579 {"version", no_argument
, 0, IDX_VERSION
},
5580 {"quiet", no_argument
, 0, IDX_QUIET
},
5581 {"show", no_argument
, 0, IDX_SHOW
},
5582 {"left", no_argument
, 0, IDX_LEFT
},
5583 {"username", no_argument
, 0, IDX_USERNAME
},
5584 {"remove", no_argument
, 0, IDX_REMOVE
},
5585 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5586 {"skip", required_argument
, 0, IDX_SKIP
},
5587 {"limit", required_argument
, 0, IDX_LIMIT
},
5588 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5589 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5590 {"potfile-path", required_argument
, 0, IDX_POTFILE_PATH
},
5591 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5592 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5593 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5594 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5595 {"force", no_argument
, 0, IDX_FORCE
},
5596 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5597 {"restore", no_argument
, 0, IDX_RESTORE
},
5598 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5599 {"status", no_argument
, 0, IDX_STATUS
},
5600 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5601 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5602 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5603 {"weak-hash-threshold", required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5604 {"session", required_argument
, 0, IDX_SESSION
},
5605 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5606 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5607 {"generate-rules-func-min", required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5608 {"generate-rules-func-max", required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5609 {"generate-rules-seed", required_argument
, 0, IDX_RP_GEN_SEED
},
5610 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5611 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5612 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5613 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5614 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5615 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5616 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5617 {"outfile-autohex-disable", no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5618 {"outfile-check-timer", required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5619 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5620 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5621 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5622 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5623 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5624 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5625 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5626 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5627 {"opencl-devices", required_argument
, 0, IDX_OPENCL_DEVICES
},
5628 {"opencl-platforms", required_argument
, 0, IDX_OPENCL_PLATFORMS
},
5629 {"opencl-device-types", required_argument
, 0, IDX_OPENCL_DEVICE_TYPES
},
5630 {"opencl-vector-width", required_argument
, 0, IDX_OPENCL_VECTOR_WIDTH
},
5631 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5632 {"kernel-accel", required_argument
, 0, IDX_KERNEL_ACCEL
},
5633 {"kernel-loops", required_argument
, 0, IDX_KERNEL_LOOPS
},
5634 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5636 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5637 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5639 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5641 #endif // HAVE_HWMON
5642 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5643 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5644 {"veracrypt-keyfiles", required_argument
, 0, IDX_VERACRYPT_KEYFILES
},
5645 {"veracrypt-pim", required_argument
, 0, IDX_VERACRYPT_PIM
},
5646 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5647 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5648 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5649 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5650 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5651 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5652 {"increment", no_argument
, 0, IDX_INCREMENT
},
5653 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5654 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5655 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5656 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5657 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5658 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5662 uint rp_files_cnt
= 0;
5664 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5666 int option_index
= 0;
5672 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5676 case IDX_HELP
: usage
= 1; break;
5678 case IDX_VERSION_LOWER
: version
= 1; break;
5679 case IDX_RESTORE
: restore
= 1; break;
5680 case IDX_SESSION
: session
= optarg
; break;
5681 case IDX_SHOW
: show
= 1; break;
5682 case IDX_LEFT
: left
= 1; break;
5683 case '?': return (-1);
5689 log_error ("ERROR: Invalid argument specified");
5700 log_info ("%s", VERSION_TAG
);
5707 usage_big_print (PROGNAME
);
5713 * session needs to be set, always!
5716 if (session
== NULL
) session
= (char *) PROGNAME
;
5719 * folders, as discussed on https://github.com/hashcat/hashcat/issues/20
5722 char *exec_path
= get_exec_path ();
5726 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5727 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5729 char *install_dir
= get_install_dir (resolved_exec_path
);
5730 char *profile_dir
= NULL
;
5731 char *session_dir
= NULL
;
5732 char *shared_dir
= NULL
;
5734 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5736 struct passwd
*pw
= getpwuid (getuid ());
5738 const char *homedir
= pw
->pw_dir
;
5740 profile_dir
= get_profile_dir (homedir
);
5741 session_dir
= get_session_dir (profile_dir
);
5742 shared_dir
= strdup (SHARED_FOLDER
);
5744 mkdir (profile_dir
, 0700);
5745 mkdir (session_dir
, 0700);
5749 profile_dir
= install_dir
;
5750 session_dir
= install_dir
;
5751 shared_dir
= install_dir
;
5754 myfree (resolved_install_folder
);
5755 myfree (resolved_exec_path
);
5759 char *install_dir
= get_install_dir (exec_path
);
5760 char *profile_dir
= install_dir
;
5761 char *session_dir
= install_dir
;
5762 char *shared_dir
= install_dir
;
5766 data
.install_dir
= install_dir
;
5767 data
.profile_dir
= profile_dir
;
5768 data
.session_dir
= session_dir
;
5769 data
.shared_dir
= shared_dir
;
5774 * kernel cache, we need to make sure folder exist
5777 int kernels_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 1;
5779 char *kernels_folder
= (char *) mymalloc (kernels_folder_size
);
5781 snprintf (kernels_folder
, kernels_folder_size
- 1, "%s/kernels", profile_dir
);
5783 mkdir (kernels_folder
, 0700);
5785 myfree (kernels_folder
);
5791 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5793 data
.session
= session
;
5795 char *eff_restore_file
= (char *) mymalloc (session_size
);
5796 char *new_restore_file
= (char *) mymalloc (session_size
);
5798 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5799 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5801 data
.eff_restore_file
= eff_restore_file
;
5802 data
.new_restore_file
= new_restore_file
;
5804 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5806 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5807 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5812 // this allows the user to use --show and --left while cracking (i.e. while another instance of hashcat is running)
5813 if ((show
== 1) || (left
== 1))
5815 restore_disable
= 1;
5820 data
.restore_disable
= restore_disable
;
5822 restore_data_t
*rd
= init_restore (argc
, argv
);
5832 read_restore (eff_restore_file
, rd
);
5834 if (rd
->version_bin
< RESTORE_MIN
)
5836 log_error ("ERROR: Incompatible restore-file version");
5845 rd
->pid
= getpid ();
5847 rd
->pid
= GetCurrentProcessId ();
5851 uint hash_mode_chgd
= 0;
5852 uint runtime_chgd
= 0;
5853 uint kernel_loops_chgd
= 0;
5854 uint kernel_accel_chgd
= 0;
5855 uint attack_mode_chgd
= 0;
5856 uint outfile_format_chgd
= 0;
5857 uint rp_gen_seed_chgd
= 0;
5858 uint remove_timer_chgd
= 0;
5859 uint increment_min_chgd
= 0;
5860 uint increment_max_chgd
= 0;
5861 uint workload_profile_chgd
= 0;
5862 uint opencl_vector_width_chgd
= 0;
5864 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
5865 uint gpu_temp_retain_chgd
= 0;
5866 uint gpu_temp_abort_chgd
= 0;
5873 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5877 //case IDX_HELP: usage = 1; break;
5878 //case IDX_VERSION: version = 1; break;
5879 //case IDX_RESTORE: restore = 1; break;
5880 case IDX_QUIET
: quiet
= 1; break;
5881 //case IDX_SHOW: show = 1; break;
5882 case IDX_SHOW
: break;
5883 //case IDX_LEFT: left = 1; break;
5884 case IDX_LEFT
: break;
5885 case IDX_USERNAME
: username
= 1; break;
5886 case IDX_REMOVE
: remove
= 1; break;
5887 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5888 remove_timer_chgd
= 1; break;
5889 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5890 case IDX_POTFILE_PATH
: potfile_path
= optarg
; break;
5891 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5892 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5893 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5894 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5895 case IDX_FORCE
: force
= 1; break;
5896 case IDX_SKIP
: skip
= atoll (optarg
); break;
5897 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5898 case IDX_KEYSPACE
: keyspace
= 1; break;
5899 case IDX_BENCHMARK
: benchmark
= 1; break;
5900 case IDX_RESTORE
: break;
5901 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5902 case IDX_STATUS
: status
= 1; break;
5903 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5904 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5905 case IDX_LOOPBACK
: loopback
= 1; break;
5906 case IDX_WEAK_HASH_THRESHOLD
: weak_hash_threshold
= atoi (optarg
); break;
5907 //case IDX_SESSION: session = optarg; break;
5908 case IDX_SESSION
: break;
5909 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5910 hash_mode_chgd
= 1; break;
5911 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5912 runtime_chgd
= 1; break;
5913 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5914 attack_mode_chgd
= 1; break;
5915 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5916 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5917 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5918 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5919 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5920 rp_gen_seed_chgd
= 1; break;
5921 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5922 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5923 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5924 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5925 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5926 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5927 case IDX_OUTFILE
: outfile
= optarg
; break;
5928 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5929 outfile_format_chgd
= 1; break;
5930 case IDX_OUTFILE_AUTOHEX_DISABLE
: outfile_autohex
= 0; break;
5931 case IDX_OUTFILE_CHECK_TIMER
: outfile_check_timer
= atoi (optarg
); break;
5932 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5933 case IDX_HEX_SALT
: hex_salt
= 1; break;
5934 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5935 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5936 case IDX_OPENCL_DEVICES
: opencl_devices
= optarg
; break;
5937 case IDX_OPENCL_PLATFORMS
: opencl_platforms
= optarg
; break;
5938 case IDX_OPENCL_DEVICE_TYPES
: opencl_device_types
= optarg
; break;
5939 case IDX_OPENCL_VECTOR_WIDTH
: opencl_vector_width
= atoi (optarg
);
5940 opencl_vector_width_chgd
= 1; break;
5941 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
);
5942 workload_profile_chgd
= 1; break;
5943 case IDX_KERNEL_ACCEL
: kernel_accel
= atoi (optarg
);
5944 kernel_accel_chgd
= 1; break;
5945 case IDX_KERNEL_LOOPS
: kernel_loops
= atoi (optarg
);
5946 kernel_loops_chgd
= 1; break;
5947 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5949 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort
= atoi (optarg
);
5951 gpu_temp_abort_chgd
= 1;
5954 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain
= atoi (optarg
);
5956 gpu_temp_retain_chgd
= 1;
5960 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5962 #endif // HAVE_HWMON
5963 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5964 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5965 case IDX_VERACRYPT_KEYFILES
: veracrypt_keyfiles
= optarg
; break;
5966 case IDX_VERACRYPT_PIM
: veracrypt_pim
= atoi (optarg
); break;
5967 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5968 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5969 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5970 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5971 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5972 case IDX_INCREMENT
: increment
= 1; break;
5973 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5974 increment_min_chgd
= 1; break;
5975 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5976 increment_max_chgd
= 1; break;
5977 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5978 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5979 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5980 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5983 log_error ("ERROR: Invalid argument specified");
5990 log_error ("ERROR: Invalid argument specified");
5996 * Inform user things getting started,
5997 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5998 * - we do not need to check algorithm_pos
6005 if (status_automat
== 0)
6007 log_info ("%s (%s) starting in benchmark-mode...", PROGNAME
, VERSION_TAG
);
6012 log_info ("# %s (%s) %s", PROGNAME
, VERSION_TAG
, ctime (&proc_start
));
6015 else if (restore
== 1)
6017 log_info ("%s (%s) starting in restore-mode...", PROGNAME
, VERSION_TAG
);
6022 log_info ("%s (%s) starting...", PROGNAME
, VERSION_TAG
);
6031 if (attack_mode
> 7)
6033 log_error ("ERROR: Invalid attack-mode specified");
6038 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
6040 log_error ("ERROR: Invalid runtime specified");
6045 if (hash_mode_chgd
&& hash_mode
> 13799) // just added to remove compiler warnings for hash_mode_chgd
6047 log_error ("ERROR: Invalid hash-type specified");
6052 // renamed hash modes
6066 log_error ("Old -m specified, use -m %d instead", n
);
6074 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)) || ((hash_mode
>= 13700) && (hash_mode
<= 13799)))
6076 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
6082 if (outfile_format
> 16)
6084 log_error ("ERROR: Invalid outfile-format specified");
6091 if (outfile_format_chgd
== 1)
6093 if (outfile_format
> 1)
6095 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
6102 outfile_format
= OUTFILE_FMT_HASH
;
6108 if (outfile_format_chgd
== 1)
6110 if ((outfile_format
> 7) && (outfile_format
< 16))
6112 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
6119 if (increment_min
< INCREMENT_MIN
)
6121 log_error ("ERROR: Invalid increment-min specified");
6126 if (increment_max
> INCREMENT_MAX
)
6128 log_error ("ERROR: Invalid increment-max specified");
6133 if (increment_min
> increment_max
)
6135 log_error ("ERROR: Invalid increment-min specified");
6140 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
6142 log_error ("ERROR: increment is not allowed in attack-mode 0");
6147 if ((increment
== 0) && (increment_min_chgd
== 1))
6149 log_error ("ERROR: increment-min is only supported together with increment switch");
6154 if ((increment
== 0) && (increment_max_chgd
== 1))
6156 log_error ("ERROR: increment-max is only supported together with increment switch");
6161 if (rp_files_cnt
&& rp_gen
)
6163 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
6168 if (rp_files_cnt
|| rp_gen
)
6170 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6172 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
6178 if (rp_gen_func_min
> rp_gen_func_max
)
6180 log_error ("ERROR: Invalid rp-gen-func-min specified");
6185 if (kernel_accel_chgd
== 1)
6189 log_info ("The manual use of the option -n (or --kernel-accel) is outdated");
6190 log_info ("Please consider using the option -w instead");
6191 log_info ("You can use --force to override this but do not post error reports if you do so");
6197 if (kernel_accel
< 1)
6199 log_error ("ERROR: Invalid kernel-accel specified");
6204 if (kernel_accel
> 1024)
6206 log_error ("ERROR: Invalid kernel-accel specified");
6212 if (kernel_loops_chgd
== 1)
6216 log_info ("The manual use of the option -u (or --kernel-loops) is outdated");
6217 log_info ("Please consider using the option -w instead");
6218 log_info ("You can use --force to override this but do not post error reports if you do so");
6224 if (kernel_loops
< 1)
6226 log_error ("ERROR: Invalid kernel-loops specified");
6231 if (kernel_loops
> 1024)
6233 log_error ("ERROR: Invalid kernel-loops specified");
6239 if ((workload_profile
< 1) || (workload_profile
> 4))
6241 log_error ("ERROR: workload-profile %i not available", workload_profile
);
6246 if (opencl_vector_width_chgd
&& (!is_power_of_2(opencl_vector_width
) || opencl_vector_width
> 16))
6248 log_error ("ERROR: opencl-vector-width %i not allowed", opencl_vector_width
);
6253 if (show
== 1 || left
== 1)
6255 attack_mode
= ATTACK_MODE_NONE
;
6259 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
6264 if (potfile_disable
== 1)
6266 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
6272 uint attack_kern
= ATTACK_KERN_NONE
;
6274 switch (attack_mode
)
6276 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
6277 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
6278 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
6279 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
6280 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
6287 int num_additional_params
= 1;
6289 if (attack_kern
== ATTACK_KERN_COMBI
)
6291 num_additional_params
= 2;
6294 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
6296 if (keyspace_wordlist_specified
== 0) optind
--;
6299 if (attack_kern
== ATTACK_KERN_NONE
)
6301 if ((optind
+ 1) != myargc
)
6303 usage_mini_print (myargv
[0]);
6308 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
6310 if ((optind
+ 1) > myargc
)
6312 usage_mini_print (myargv
[0]);
6317 else if (attack_kern
== ATTACK_KERN_COMBI
)
6319 if ((optind
+ 3) != myargc
)
6321 usage_mini_print (myargv
[0]);
6326 else if (attack_kern
== ATTACK_KERN_BF
)
6328 if ((optind
+ 1) > myargc
)
6330 usage_mini_print (myargv
[0]);
6337 usage_mini_print (myargv
[0]);
6344 if (myargv
[optind
] != 0)
6346 log_error ("ERROR: Invalid argument for benchmark mode specified");
6351 if (attack_mode_chgd
== 1)
6353 if (attack_mode
!= ATTACK_MODE_BF
)
6355 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
6362 if (skip
!= 0 && limit
!= 0)
6371 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
6377 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
6382 potfile_disable
= 1;
6384 restore_disable
= 1;
6388 weak_hash_threshold
= 0;
6393 if (remove_timer_chgd
== 1)
6397 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
6402 if (remove_timer
< 1)
6404 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
6412 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
6414 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6416 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6423 log_error ("ERROR: Parameter loopback allowed in attack-mode 0 only");
6431 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6433 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6438 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6440 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6448 log_error ("ERROR: Invalid debug-mode specified");
6453 if (debug_file
!= NULL
)
6457 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6463 if (induction_dir
!= NULL
)
6465 if (attack_mode
== ATTACK_MODE_BF
)
6467 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6473 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6475 if ((weak_hash_threshold
!= WEAK_HASH_THRESHOLD
) && (weak_hash_threshold
!= 0))
6477 log_error ("ERROR: setting --weak-hash-threshold allowed only in straight-attack mode");
6482 weak_hash_threshold
= 0;
6486 * induction directory
6489 char *induction_directory
= NULL
;
6491 if (attack_mode
!= ATTACK_MODE_BF
)
6493 if (induction_dir
== NULL
)
6495 induction_directory
= (char *) mymalloc (session_size
);
6497 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6499 // create induction folder if it does not already exist
6503 if (rmdir (induction_directory
) == -1)
6505 if (errno
== ENOENT
)
6507 // good, we can ignore
6509 else if (errno
== ENOTEMPTY
)
6511 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6513 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6515 if (rename (induction_directory
, induction_directory_mv
) != 0)
6517 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6524 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6530 if (mkdir (induction_directory
, 0700) == -1)
6532 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6540 induction_directory
= induction_dir
;
6544 data
.induction_directory
= induction_directory
;
6550 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6552 char *loopback_file
= (char *) mymalloc (loopback_size
);
6558 char tuning_db_file
[256] = { 0 };
6560 snprintf (tuning_db_file
, sizeof (tuning_db_file
) - 1, "%s/%s", shared_dir
, TUNING_DB_FILE
);
6562 tuning_db_t
*tuning_db
= tuning_db_init (tuning_db_file
);
6565 * outfile-check directory
6568 char *outfile_check_directory
= NULL
;
6570 if (outfile_check_dir
== NULL
)
6572 outfile_check_directory
= (char *) mymalloc (session_size
);
6574 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6578 outfile_check_directory
= outfile_check_dir
;
6581 data
.outfile_check_directory
= outfile_check_directory
;
6585 struct stat outfile_check_stat
;
6587 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6589 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6593 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6598 else if (outfile_check_dir
== NULL
)
6600 if (mkdir (outfile_check_directory
, 0700) == -1)
6602 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6610 * special other stuff
6613 if (hash_mode
== 9710)
6616 outfile_format_chgd
= 1;
6619 if (hash_mode
== 9810)
6622 outfile_format_chgd
= 1;
6625 if (hash_mode
== 10410)
6628 outfile_format_chgd
= 1;
6635 data
.hash_mode
= hash_mode
;
6636 data
.restore
= restore
;
6637 data
.restore_timer
= restore_timer
;
6638 data
.restore_disable
= restore_disable
;
6639 data
.status
= status
;
6640 data
.status_timer
= status_timer
;
6641 data
.status_automat
= status_automat
;
6642 data
.loopback
= loopback
;
6643 data
.runtime
= runtime
;
6644 data
.remove
= remove
;
6645 data
.remove_timer
= remove_timer
;
6646 data
.debug_mode
= debug_mode
;
6647 data
.debug_file
= debug_file
;
6648 data
.username
= username
;
6650 data
.outfile
= outfile
;
6651 data
.outfile_format
= outfile_format
;
6652 data
.outfile_autohex
= outfile_autohex
;
6653 data
.hex_charset
= hex_charset
;
6654 data
.hex_salt
= hex_salt
;
6655 data
.hex_wordlist
= hex_wordlist
;
6656 data
.separator
= separator
;
6657 data
.rp_files
= rp_files
;
6658 data
.rp_files_cnt
= rp_files_cnt
;
6659 data
.rp_gen
= rp_gen
;
6660 data
.rp_gen_seed
= rp_gen_seed
;
6662 data
.benchmark
= benchmark
;
6667 data
.powertune_enable
= powertune_enable
;
6670 data
.logfile_disable
= logfile_disable
;
6671 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6672 data
.veracrypt_keyfiles
= veracrypt_keyfiles
;
6673 data
.veracrypt_pim
= veracrypt_pim
;
6674 data
.scrypt_tmto
= scrypt_tmto
;
6675 data
.workload_profile
= workload_profile
;
6683 set_cpu_affinity (cpu_affinity
);
6686 if (rp_gen_seed_chgd
== 0)
6692 srand (rp_gen_seed
);
6699 if (logfile_disable
== 0)
6701 size_t logfile_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
6703 char *logfile
= (char *) mymalloc (logfile_size
);
6705 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6707 data
.logfile
= logfile
;
6709 char *topid
= logfile_generate_topid ();
6714 // logfile_append() checks for logfile_disable internally to make it easier from here
6716 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6717 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6718 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6719 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6720 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6721 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6722 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6723 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6724 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6725 #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));
6727 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6728 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6729 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6730 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6731 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6732 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6733 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6734 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6736 logfile_top_msg ("START");
6738 logfile_top_uint (attack_mode
);
6739 logfile_top_uint (attack_kern
);
6740 logfile_top_uint (benchmark
);
6741 logfile_top_uint (bitmap_min
);
6742 logfile_top_uint (bitmap_max
);
6743 logfile_top_uint (debug_mode
);
6744 logfile_top_uint (force
);
6745 logfile_top_uint (kernel_accel
);
6746 logfile_top_uint (kernel_loops
);
6747 logfile_top_uint (gpu_temp_disable
);
6749 logfile_top_uint (gpu_temp_abort
);
6750 logfile_top_uint (gpu_temp_retain
);
6752 logfile_top_uint (hash_mode
);
6753 logfile_top_uint (hex_charset
);
6754 logfile_top_uint (hex_salt
);
6755 logfile_top_uint (hex_wordlist
);
6756 logfile_top_uint (increment
);
6757 logfile_top_uint (increment_max
);
6758 logfile_top_uint (increment_min
);
6759 logfile_top_uint (keyspace
);
6760 logfile_top_uint (left
);
6761 logfile_top_uint (logfile_disable
);
6762 logfile_top_uint (loopback
);
6763 logfile_top_uint (markov_classic
);
6764 logfile_top_uint (markov_disable
);
6765 logfile_top_uint (markov_threshold
);
6766 logfile_top_uint (outfile_autohex
);
6767 logfile_top_uint (outfile_check_timer
);
6768 logfile_top_uint (outfile_format
);
6769 logfile_top_uint (potfile_disable
);
6770 logfile_top_string (potfile_path
);
6771 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
6772 logfile_top_uint (powertune_enable
);
6774 logfile_top_uint (scrypt_tmto
);
6775 logfile_top_uint (quiet
);
6776 logfile_top_uint (remove
);
6777 logfile_top_uint (remove_timer
);
6778 logfile_top_uint (restore
);
6779 logfile_top_uint (restore_disable
);
6780 logfile_top_uint (restore_timer
);
6781 logfile_top_uint (rp_gen
);
6782 logfile_top_uint (rp_gen_func_max
);
6783 logfile_top_uint (rp_gen_func_min
);
6784 logfile_top_uint (rp_gen_seed
);
6785 logfile_top_uint (runtime
);
6786 logfile_top_uint (segment_size
);
6787 logfile_top_uint (show
);
6788 logfile_top_uint (status
);
6789 logfile_top_uint (status_automat
);
6790 logfile_top_uint (status_timer
);
6791 logfile_top_uint (usage
);
6792 logfile_top_uint (username
);
6793 logfile_top_uint (version
);
6794 logfile_top_uint (weak_hash_threshold
);
6795 logfile_top_uint (workload_profile
);
6796 logfile_top_uint64 (limit
);
6797 logfile_top_uint64 (skip
);
6798 logfile_top_char (separator
);
6799 logfile_top_string (cpu_affinity
);
6800 logfile_top_string (custom_charset_1
);
6801 logfile_top_string (custom_charset_2
);
6802 logfile_top_string (custom_charset_3
);
6803 logfile_top_string (custom_charset_4
);
6804 logfile_top_string (debug_file
);
6805 logfile_top_string (opencl_devices
);
6806 logfile_top_string (opencl_platforms
);
6807 logfile_top_string (opencl_device_types
);
6808 logfile_top_uint (opencl_vector_width
);
6809 logfile_top_string (induction_dir
);
6810 logfile_top_string (markov_hcstat
);
6811 logfile_top_string (outfile
);
6812 logfile_top_string (outfile_check_dir
);
6813 logfile_top_string (rule_buf_l
);
6814 logfile_top_string (rule_buf_r
);
6815 logfile_top_string (session
);
6816 logfile_top_string (truecrypt_keyfiles
);
6817 logfile_top_string (veracrypt_keyfiles
);
6818 logfile_top_uint (veracrypt_pim
);
6821 * Init OpenCL library loader
6826 ocl
= (OCL_PTR
*) mymalloc (sizeof (OCL_PTR
));
6834 * OpenCL platform selection
6837 u32 opencl_platforms_filter
= setup_opencl_platforms_filter (opencl_platforms
);
6840 * OpenCL device selection
6843 u32 devices_filter
= setup_devices_filter (opencl_devices
);
6846 * OpenCL device type selection
6849 cl_device_type device_types_filter
= setup_device_types_filter (opencl_device_types
);
6858 * disable useless stuff for benchmark
6863 restore_disable
= 1;
6864 potfile_disable
= 1;
6865 weak_hash_threshold
= 0;
6866 gpu_temp_disable
= 1;
6868 data
.status_timer
= status_timer
;
6869 data
.restore_timer
= restore_timer
;
6870 data
.restore_disable
= restore_disable
;
6873 * force attack mode to be bruteforce
6876 attack_mode
= ATTACK_MODE_BF
;
6877 attack_kern
= ATTACK_KERN_BF
;
6879 if (workload_profile_chgd
== 0)
6881 workload_profile
= 3;
6883 data
.workload_profile
= workload_profile
;
6893 uint attack_exec
= 0;
6897 uint esalt_size
= 0;
6899 uint dgst_pos0
= -1;
6900 uint dgst_pos1
= -1;
6901 uint dgst_pos2
= -1;
6902 uint dgst_pos3
= -1;
6904 int (*parse_func
) (char *, uint
, hash_t
*);
6905 int (*sort_by_digest
) (const void *, const void *);
6907 uint algorithm_pos
= 0;
6908 uint algorithm_max
= 1;
6910 uint
*algorithms
= default_benchmark_algorithms
;
6912 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6914 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6917 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6918 * the following algos are skipped entirely
6921 if (algorithm_pos
> 0)
6925 rd
= init_restore (argc
, argv
);
6931 * update hash_mode in case of multihash benchmark
6936 if (hash_mode_chgd
== 0)
6938 hash_mode
= algorithms
[algorithm_pos
];
6940 data
.hash_mode
= hash_mode
;
6950 case 0: hash_type
= HASH_TYPE_MD5
;
6951 salt_type
= SALT_TYPE_NONE
;
6952 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6953 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6954 | OPTS_TYPE_PT_ADD80
6955 | OPTS_TYPE_PT_ADDBITS14
;
6956 kern_type
= KERN_TYPE_MD5
;
6957 dgst_size
= DGST_SIZE_4_4
;
6958 parse_func
= md5_parse_hash
;
6959 sort_by_digest
= sort_by_digest_4_4
;
6960 opti_type
= OPTI_TYPE_ZERO_BYTE
6961 | OPTI_TYPE_PRECOMPUTE_INIT
6962 | OPTI_TYPE_PRECOMPUTE_MERKLE
6963 | OPTI_TYPE_MEET_IN_MIDDLE
6964 | OPTI_TYPE_EARLY_SKIP
6965 | OPTI_TYPE_NOT_ITERATED
6966 | OPTI_TYPE_NOT_SALTED
6967 | OPTI_TYPE_RAW_HASH
;
6974 case 10: hash_type
= HASH_TYPE_MD5
;
6975 salt_type
= SALT_TYPE_INTERN
;
6976 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
6977 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6978 | OPTS_TYPE_ST_ADD80
6979 | OPTS_TYPE_ST_ADDBITS14
;
6980 kern_type
= KERN_TYPE_MD5_PWSLT
;
6981 dgst_size
= DGST_SIZE_4_4
;
6982 parse_func
= md5s_parse_hash
;
6983 sort_by_digest
= sort_by_digest_4_4
;
6984 opti_type
= OPTI_TYPE_ZERO_BYTE
6985 | OPTI_TYPE_PRECOMPUTE_INIT
6986 | OPTI_TYPE_PRECOMPUTE_MERKLE
6987 | OPTI_TYPE_MEET_IN_MIDDLE
6988 | OPTI_TYPE_EARLY_SKIP
6989 | OPTI_TYPE_NOT_ITERATED
6990 | OPTI_TYPE_APPENDED_SALT
6991 | OPTI_TYPE_RAW_HASH
;
6998 case 11: hash_type
= HASH_TYPE_MD5
;
6999 salt_type
= SALT_TYPE_INTERN
;
7000 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7001 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7002 | OPTS_TYPE_ST_ADD80
7003 | OPTS_TYPE_ST_ADDBITS14
;
7004 kern_type
= KERN_TYPE_MD5_PWSLT
;
7005 dgst_size
= DGST_SIZE_4_4
;
7006 parse_func
= joomla_parse_hash
;
7007 sort_by_digest
= sort_by_digest_4_4
;
7008 opti_type
= OPTI_TYPE_ZERO_BYTE
7009 | OPTI_TYPE_PRECOMPUTE_INIT
7010 | OPTI_TYPE_PRECOMPUTE_MERKLE
7011 | OPTI_TYPE_MEET_IN_MIDDLE
7012 | OPTI_TYPE_EARLY_SKIP
7013 | OPTI_TYPE_NOT_ITERATED
7014 | OPTI_TYPE_APPENDED_SALT
7015 | OPTI_TYPE_RAW_HASH
;
7022 case 12: hash_type
= HASH_TYPE_MD5
;
7023 salt_type
= SALT_TYPE_INTERN
;
7024 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7025 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7026 | OPTS_TYPE_ST_ADD80
7027 | OPTS_TYPE_ST_ADDBITS14
;
7028 kern_type
= KERN_TYPE_MD5_PWSLT
;
7029 dgst_size
= DGST_SIZE_4_4
;
7030 parse_func
= postgresql_parse_hash
;
7031 sort_by_digest
= sort_by_digest_4_4
;
7032 opti_type
= OPTI_TYPE_ZERO_BYTE
7033 | OPTI_TYPE_PRECOMPUTE_INIT
7034 | OPTI_TYPE_PRECOMPUTE_MERKLE
7035 | OPTI_TYPE_MEET_IN_MIDDLE
7036 | OPTI_TYPE_EARLY_SKIP
7037 | OPTI_TYPE_NOT_ITERATED
7038 | OPTI_TYPE_APPENDED_SALT
7039 | OPTI_TYPE_RAW_HASH
;
7046 case 20: hash_type
= HASH_TYPE_MD5
;
7047 salt_type
= SALT_TYPE_INTERN
;
7048 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7049 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7050 | OPTS_TYPE_PT_ADD80
7051 | OPTS_TYPE_PT_ADDBITS14
;
7052 kern_type
= KERN_TYPE_MD5_SLTPW
;
7053 dgst_size
= DGST_SIZE_4_4
;
7054 parse_func
= md5s_parse_hash
;
7055 sort_by_digest
= sort_by_digest_4_4
;
7056 opti_type
= OPTI_TYPE_ZERO_BYTE
7057 | OPTI_TYPE_PRECOMPUTE_INIT
7058 | OPTI_TYPE_PRECOMPUTE_MERKLE
7059 | OPTI_TYPE_EARLY_SKIP
7060 | OPTI_TYPE_NOT_ITERATED
7061 | OPTI_TYPE_PREPENDED_SALT
7062 | OPTI_TYPE_RAW_HASH
;
7069 case 21: hash_type
= HASH_TYPE_MD5
;
7070 salt_type
= SALT_TYPE_INTERN
;
7071 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7072 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7073 | OPTS_TYPE_PT_ADD80
7074 | OPTS_TYPE_PT_ADDBITS14
;
7075 kern_type
= KERN_TYPE_MD5_SLTPW
;
7076 dgst_size
= DGST_SIZE_4_4
;
7077 parse_func
= osc_parse_hash
;
7078 sort_by_digest
= sort_by_digest_4_4
;
7079 opti_type
= OPTI_TYPE_ZERO_BYTE
7080 | OPTI_TYPE_PRECOMPUTE_INIT
7081 | OPTI_TYPE_PRECOMPUTE_MERKLE
7082 | OPTI_TYPE_EARLY_SKIP
7083 | OPTI_TYPE_NOT_ITERATED
7084 | OPTI_TYPE_PREPENDED_SALT
7085 | OPTI_TYPE_RAW_HASH
;
7092 case 22: hash_type
= HASH_TYPE_MD5
;
7093 salt_type
= SALT_TYPE_EMBEDDED
;
7094 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7095 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7096 | OPTS_TYPE_PT_ADD80
7097 | OPTS_TYPE_PT_ADDBITS14
;
7098 kern_type
= KERN_TYPE_MD5_SLTPW
;
7099 dgst_size
= DGST_SIZE_4_4
;
7100 parse_func
= netscreen_parse_hash
;
7101 sort_by_digest
= sort_by_digest_4_4
;
7102 opti_type
= OPTI_TYPE_ZERO_BYTE
7103 | OPTI_TYPE_PRECOMPUTE_INIT
7104 | OPTI_TYPE_PRECOMPUTE_MERKLE
7105 | OPTI_TYPE_EARLY_SKIP
7106 | OPTI_TYPE_NOT_ITERATED
7107 | OPTI_TYPE_PREPENDED_SALT
7108 | OPTI_TYPE_RAW_HASH
;
7115 case 23: hash_type
= HASH_TYPE_MD5
;
7116 salt_type
= SALT_TYPE_EMBEDDED
;
7117 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7118 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7119 | OPTS_TYPE_PT_ADD80
7120 | OPTS_TYPE_PT_ADDBITS14
;
7121 kern_type
= KERN_TYPE_MD5_SLTPW
;
7122 dgst_size
= DGST_SIZE_4_4
;
7123 parse_func
= skype_parse_hash
;
7124 sort_by_digest
= sort_by_digest_4_4
;
7125 opti_type
= OPTI_TYPE_ZERO_BYTE
7126 | OPTI_TYPE_PRECOMPUTE_INIT
7127 | OPTI_TYPE_PRECOMPUTE_MERKLE
7128 | OPTI_TYPE_EARLY_SKIP
7129 | OPTI_TYPE_NOT_ITERATED
7130 | OPTI_TYPE_PREPENDED_SALT
7131 | OPTI_TYPE_RAW_HASH
;
7138 case 30: hash_type
= HASH_TYPE_MD5
;
7139 salt_type
= SALT_TYPE_INTERN
;
7140 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7141 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7142 | OPTS_TYPE_PT_UNICODE
7143 | OPTS_TYPE_ST_ADD80
7144 | OPTS_TYPE_ST_ADDBITS14
;
7145 kern_type
= KERN_TYPE_MD5_PWUSLT
;
7146 dgst_size
= DGST_SIZE_4_4
;
7147 parse_func
= md5s_parse_hash
;
7148 sort_by_digest
= sort_by_digest_4_4
;
7149 opti_type
= OPTI_TYPE_ZERO_BYTE
7150 | OPTI_TYPE_PRECOMPUTE_INIT
7151 | OPTI_TYPE_PRECOMPUTE_MERKLE
7152 | OPTI_TYPE_MEET_IN_MIDDLE
7153 | OPTI_TYPE_EARLY_SKIP
7154 | OPTI_TYPE_NOT_ITERATED
7155 | OPTI_TYPE_APPENDED_SALT
7156 | OPTI_TYPE_RAW_HASH
;
7163 case 40: hash_type
= HASH_TYPE_MD5
;
7164 salt_type
= SALT_TYPE_INTERN
;
7165 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7166 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7167 | OPTS_TYPE_PT_ADD80
7168 | OPTS_TYPE_PT_ADDBITS14
7169 | OPTS_TYPE_PT_UNICODE
;
7170 kern_type
= KERN_TYPE_MD5_SLTPWU
;
7171 dgst_size
= DGST_SIZE_4_4
;
7172 parse_func
= md5s_parse_hash
;
7173 sort_by_digest
= sort_by_digest_4_4
;
7174 opti_type
= OPTI_TYPE_ZERO_BYTE
7175 | OPTI_TYPE_PRECOMPUTE_INIT
7176 | OPTI_TYPE_PRECOMPUTE_MERKLE
7177 | OPTI_TYPE_EARLY_SKIP
7178 | OPTI_TYPE_NOT_ITERATED
7179 | OPTI_TYPE_PREPENDED_SALT
7180 | OPTI_TYPE_RAW_HASH
;
7187 case 50: hash_type
= HASH_TYPE_MD5
;
7188 salt_type
= SALT_TYPE_INTERN
;
7189 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7190 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7191 | OPTS_TYPE_ST_ADD80
7192 | OPTS_TYPE_ST_ADDBITS14
;
7193 kern_type
= KERN_TYPE_HMACMD5_PW
;
7194 dgst_size
= DGST_SIZE_4_4
;
7195 parse_func
= hmacmd5_parse_hash
;
7196 sort_by_digest
= sort_by_digest_4_4
;
7197 opti_type
= OPTI_TYPE_ZERO_BYTE
7198 | OPTI_TYPE_NOT_ITERATED
;
7205 case 60: hash_type
= HASH_TYPE_MD5
;
7206 salt_type
= SALT_TYPE_INTERN
;
7207 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7208 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7209 | OPTS_TYPE_PT_ADD80
7210 | OPTS_TYPE_PT_ADDBITS14
;
7211 kern_type
= KERN_TYPE_HMACMD5_SLT
;
7212 dgst_size
= DGST_SIZE_4_4
;
7213 parse_func
= hmacmd5_parse_hash
;
7214 sort_by_digest
= sort_by_digest_4_4
;
7215 opti_type
= OPTI_TYPE_ZERO_BYTE
7216 | OPTI_TYPE_NOT_ITERATED
;
7223 case 100: hash_type
= HASH_TYPE_SHA1
;
7224 salt_type
= SALT_TYPE_NONE
;
7225 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7226 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7227 | OPTS_TYPE_PT_ADD80
7228 | OPTS_TYPE_PT_ADDBITS15
;
7229 kern_type
= KERN_TYPE_SHA1
;
7230 dgst_size
= DGST_SIZE_4_5
;
7231 parse_func
= sha1_parse_hash
;
7232 sort_by_digest
= sort_by_digest_4_5
;
7233 opti_type
= OPTI_TYPE_ZERO_BYTE
7234 | OPTI_TYPE_PRECOMPUTE_INIT
7235 | OPTI_TYPE_PRECOMPUTE_MERKLE
7236 | OPTI_TYPE_EARLY_SKIP
7237 | OPTI_TYPE_NOT_ITERATED
7238 | OPTI_TYPE_NOT_SALTED
7239 | OPTI_TYPE_RAW_HASH
;
7246 case 101: hash_type
= HASH_TYPE_SHA1
;
7247 salt_type
= SALT_TYPE_NONE
;
7248 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7249 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7250 | OPTS_TYPE_PT_ADD80
7251 | OPTS_TYPE_PT_ADDBITS15
;
7252 kern_type
= KERN_TYPE_SHA1
;
7253 dgst_size
= DGST_SIZE_4_5
;
7254 parse_func
= sha1b64_parse_hash
;
7255 sort_by_digest
= sort_by_digest_4_5
;
7256 opti_type
= OPTI_TYPE_ZERO_BYTE
7257 | OPTI_TYPE_PRECOMPUTE_INIT
7258 | OPTI_TYPE_PRECOMPUTE_MERKLE
7259 | OPTI_TYPE_EARLY_SKIP
7260 | OPTI_TYPE_NOT_ITERATED
7261 | OPTI_TYPE_NOT_SALTED
7262 | OPTI_TYPE_RAW_HASH
;
7269 case 110: hash_type
= HASH_TYPE_SHA1
;
7270 salt_type
= SALT_TYPE_INTERN
;
7271 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7272 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7273 | OPTS_TYPE_ST_ADD80
7274 | OPTS_TYPE_ST_ADDBITS15
;
7275 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7276 dgst_size
= DGST_SIZE_4_5
;
7277 parse_func
= sha1s_parse_hash
;
7278 sort_by_digest
= sort_by_digest_4_5
;
7279 opti_type
= OPTI_TYPE_ZERO_BYTE
7280 | OPTI_TYPE_PRECOMPUTE_INIT
7281 | OPTI_TYPE_PRECOMPUTE_MERKLE
7282 | OPTI_TYPE_EARLY_SKIP
7283 | OPTI_TYPE_NOT_ITERATED
7284 | OPTI_TYPE_APPENDED_SALT
7285 | OPTI_TYPE_RAW_HASH
;
7292 case 111: hash_type
= HASH_TYPE_SHA1
;
7293 salt_type
= SALT_TYPE_EMBEDDED
;
7294 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7295 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7296 | OPTS_TYPE_ST_ADD80
7297 | OPTS_TYPE_ST_ADDBITS15
;
7298 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7299 dgst_size
= DGST_SIZE_4_5
;
7300 parse_func
= sha1b64s_parse_hash
;
7301 sort_by_digest
= sort_by_digest_4_5
;
7302 opti_type
= OPTI_TYPE_ZERO_BYTE
7303 | OPTI_TYPE_PRECOMPUTE_INIT
7304 | OPTI_TYPE_PRECOMPUTE_MERKLE
7305 | OPTI_TYPE_EARLY_SKIP
7306 | OPTI_TYPE_NOT_ITERATED
7307 | OPTI_TYPE_APPENDED_SALT
7308 | OPTI_TYPE_RAW_HASH
;
7315 case 112: hash_type
= HASH_TYPE_SHA1
;
7316 salt_type
= SALT_TYPE_INTERN
;
7317 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7318 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7319 | OPTS_TYPE_ST_ADD80
7320 | OPTS_TYPE_ST_ADDBITS15
7322 kern_type
= KERN_TYPE_SHA1_PWSLT
;
7323 dgst_size
= DGST_SIZE_4_5
;
7324 parse_func
= oracles_parse_hash
;
7325 sort_by_digest
= sort_by_digest_4_5
;
7326 opti_type
= OPTI_TYPE_ZERO_BYTE
7327 | OPTI_TYPE_PRECOMPUTE_INIT
7328 | OPTI_TYPE_PRECOMPUTE_MERKLE
7329 | OPTI_TYPE_EARLY_SKIP
7330 | OPTI_TYPE_NOT_ITERATED
7331 | OPTI_TYPE_APPENDED_SALT
7332 | OPTI_TYPE_RAW_HASH
;
7339 case 120: hash_type
= HASH_TYPE_SHA1
;
7340 salt_type
= SALT_TYPE_INTERN
;
7341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7342 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7343 | OPTS_TYPE_PT_ADD80
7344 | OPTS_TYPE_PT_ADDBITS15
;
7345 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7346 dgst_size
= DGST_SIZE_4_5
;
7347 parse_func
= sha1s_parse_hash
;
7348 sort_by_digest
= sort_by_digest_4_5
;
7349 opti_type
= OPTI_TYPE_ZERO_BYTE
7350 | OPTI_TYPE_PRECOMPUTE_INIT
7351 | OPTI_TYPE_PRECOMPUTE_MERKLE
7352 | OPTI_TYPE_EARLY_SKIP
7353 | OPTI_TYPE_NOT_ITERATED
7354 | OPTI_TYPE_PREPENDED_SALT
7355 | OPTI_TYPE_RAW_HASH
;
7362 case 121: hash_type
= HASH_TYPE_SHA1
;
7363 salt_type
= SALT_TYPE_INTERN
;
7364 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7365 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7366 | OPTS_TYPE_PT_ADD80
7367 | OPTS_TYPE_PT_ADDBITS15
7368 | OPTS_TYPE_ST_LOWER
;
7369 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7370 dgst_size
= DGST_SIZE_4_5
;
7371 parse_func
= smf_parse_hash
;
7372 sort_by_digest
= sort_by_digest_4_5
;
7373 opti_type
= OPTI_TYPE_ZERO_BYTE
7374 | OPTI_TYPE_PRECOMPUTE_INIT
7375 | OPTI_TYPE_PRECOMPUTE_MERKLE
7376 | OPTI_TYPE_EARLY_SKIP
7377 | OPTI_TYPE_NOT_ITERATED
7378 | OPTI_TYPE_PREPENDED_SALT
7379 | OPTI_TYPE_RAW_HASH
;
7386 case 122: hash_type
= HASH_TYPE_SHA1
;
7387 salt_type
= SALT_TYPE_EMBEDDED
;
7388 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7389 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7390 | OPTS_TYPE_PT_ADD80
7391 | OPTS_TYPE_PT_ADDBITS15
7393 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7394 dgst_size
= DGST_SIZE_4_5
;
7395 parse_func
= osx1_parse_hash
;
7396 sort_by_digest
= sort_by_digest_4_5
;
7397 opti_type
= OPTI_TYPE_ZERO_BYTE
7398 | OPTI_TYPE_PRECOMPUTE_INIT
7399 | OPTI_TYPE_PRECOMPUTE_MERKLE
7400 | OPTI_TYPE_EARLY_SKIP
7401 | OPTI_TYPE_NOT_ITERATED
7402 | OPTI_TYPE_PREPENDED_SALT
7403 | OPTI_TYPE_RAW_HASH
;
7410 case 124: hash_type
= HASH_TYPE_SHA1
;
7411 salt_type
= SALT_TYPE_EMBEDDED
;
7412 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7413 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7414 | OPTS_TYPE_PT_ADD80
7415 | OPTS_TYPE_PT_ADDBITS15
;
7416 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7417 dgst_size
= DGST_SIZE_4_5
;
7418 parse_func
= djangosha1_parse_hash
;
7419 sort_by_digest
= sort_by_digest_4_5
;
7420 opti_type
= OPTI_TYPE_ZERO_BYTE
7421 | OPTI_TYPE_PRECOMPUTE_INIT
7422 | OPTI_TYPE_PRECOMPUTE_MERKLE
7423 | OPTI_TYPE_EARLY_SKIP
7424 | OPTI_TYPE_NOT_ITERATED
7425 | OPTI_TYPE_PREPENDED_SALT
7426 | OPTI_TYPE_RAW_HASH
;
7433 case 125: hash_type
= HASH_TYPE_SHA1
;
7434 salt_type
= SALT_TYPE_EMBEDDED
;
7435 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7436 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7437 | OPTS_TYPE_PT_ADD80
7438 | OPTS_TYPE_PT_ADDBITS15
7440 kern_type
= KERN_TYPE_SHA1_SLTPW
;
7441 dgst_size
= DGST_SIZE_4_5
;
7442 parse_func
= arubaos_parse_hash
;
7443 sort_by_digest
= sort_by_digest_4_5
;
7444 opti_type
= OPTI_TYPE_ZERO_BYTE
7445 | OPTI_TYPE_PRECOMPUTE_INIT
7446 | OPTI_TYPE_PRECOMPUTE_MERKLE
7447 | OPTI_TYPE_EARLY_SKIP
7448 | OPTI_TYPE_NOT_ITERATED
7449 | OPTI_TYPE_PREPENDED_SALT
7450 | OPTI_TYPE_RAW_HASH
;
7457 case 130: hash_type
= HASH_TYPE_SHA1
;
7458 salt_type
= SALT_TYPE_INTERN
;
7459 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7460 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7461 | OPTS_TYPE_PT_UNICODE
7462 | OPTS_TYPE_ST_ADD80
7463 | OPTS_TYPE_ST_ADDBITS15
;
7464 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7465 dgst_size
= DGST_SIZE_4_5
;
7466 parse_func
= sha1s_parse_hash
;
7467 sort_by_digest
= sort_by_digest_4_5
;
7468 opti_type
= OPTI_TYPE_ZERO_BYTE
7469 | OPTI_TYPE_PRECOMPUTE_INIT
7470 | OPTI_TYPE_PRECOMPUTE_MERKLE
7471 | OPTI_TYPE_EARLY_SKIP
7472 | OPTI_TYPE_NOT_ITERATED
7473 | OPTI_TYPE_APPENDED_SALT
7474 | OPTI_TYPE_RAW_HASH
;
7481 case 131: hash_type
= HASH_TYPE_SHA1
;
7482 salt_type
= SALT_TYPE_EMBEDDED
;
7483 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7484 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7485 | OPTS_TYPE_PT_UNICODE
7486 | OPTS_TYPE_PT_UPPER
7487 | OPTS_TYPE_ST_ADD80
7488 | OPTS_TYPE_ST_ADDBITS15
7490 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7491 dgst_size
= DGST_SIZE_4_5
;
7492 parse_func
= mssql2000_parse_hash
;
7493 sort_by_digest
= sort_by_digest_4_5
;
7494 opti_type
= OPTI_TYPE_ZERO_BYTE
7495 | OPTI_TYPE_PRECOMPUTE_INIT
7496 | OPTI_TYPE_PRECOMPUTE_MERKLE
7497 | OPTI_TYPE_EARLY_SKIP
7498 | OPTI_TYPE_NOT_ITERATED
7499 | OPTI_TYPE_APPENDED_SALT
7500 | OPTI_TYPE_RAW_HASH
;
7507 case 132: hash_type
= HASH_TYPE_SHA1
;
7508 salt_type
= SALT_TYPE_EMBEDDED
;
7509 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7510 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7511 | OPTS_TYPE_PT_UNICODE
7512 | OPTS_TYPE_ST_ADD80
7513 | OPTS_TYPE_ST_ADDBITS15
7515 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7516 dgst_size
= DGST_SIZE_4_5
;
7517 parse_func
= mssql2005_parse_hash
;
7518 sort_by_digest
= sort_by_digest_4_5
;
7519 opti_type
= OPTI_TYPE_ZERO_BYTE
7520 | OPTI_TYPE_PRECOMPUTE_INIT
7521 | OPTI_TYPE_PRECOMPUTE_MERKLE
7522 | OPTI_TYPE_EARLY_SKIP
7523 | OPTI_TYPE_NOT_ITERATED
7524 | OPTI_TYPE_APPENDED_SALT
7525 | OPTI_TYPE_RAW_HASH
;
7532 case 133: hash_type
= HASH_TYPE_SHA1
;
7533 salt_type
= SALT_TYPE_EMBEDDED
;
7534 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7535 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7536 | OPTS_TYPE_PT_UNICODE
7537 | OPTS_TYPE_ST_ADD80
7538 | OPTS_TYPE_ST_ADDBITS15
;
7539 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7540 dgst_size
= DGST_SIZE_4_5
;
7541 parse_func
= peoplesoft_parse_hash
;
7542 sort_by_digest
= sort_by_digest_4_5
;
7543 opti_type
= OPTI_TYPE_ZERO_BYTE
7544 | OPTI_TYPE_PRECOMPUTE_INIT
7545 | OPTI_TYPE_PRECOMPUTE_MERKLE
7546 | OPTI_TYPE_EARLY_SKIP
7547 | OPTI_TYPE_NOT_ITERATED
7548 | OPTI_TYPE_APPENDED_SALT
7549 | OPTI_TYPE_RAW_HASH
;
7556 case 140: hash_type
= HASH_TYPE_SHA1
;
7557 salt_type
= SALT_TYPE_INTERN
;
7558 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7559 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7560 | OPTS_TYPE_PT_ADD80
7561 | OPTS_TYPE_PT_ADDBITS15
7562 | OPTS_TYPE_PT_UNICODE
;
7563 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7564 dgst_size
= DGST_SIZE_4_5
;
7565 parse_func
= sha1s_parse_hash
;
7566 sort_by_digest
= sort_by_digest_4_5
;
7567 opti_type
= OPTI_TYPE_ZERO_BYTE
7568 | OPTI_TYPE_PRECOMPUTE_INIT
7569 | OPTI_TYPE_PRECOMPUTE_MERKLE
7570 | OPTI_TYPE_EARLY_SKIP
7571 | OPTI_TYPE_NOT_ITERATED
7572 | OPTI_TYPE_PREPENDED_SALT
7573 | OPTI_TYPE_RAW_HASH
;
7580 case 141: hash_type
= HASH_TYPE_SHA1
;
7581 salt_type
= SALT_TYPE_EMBEDDED
;
7582 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7583 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7584 | OPTS_TYPE_PT_ADD80
7585 | OPTS_TYPE_PT_ADDBITS15
7586 | OPTS_TYPE_PT_UNICODE
7587 | OPTS_TYPE_ST_BASE64
;
7588 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7589 dgst_size
= DGST_SIZE_4_5
;
7590 parse_func
= episerver_parse_hash
;
7591 sort_by_digest
= sort_by_digest_4_5
;
7592 opti_type
= OPTI_TYPE_ZERO_BYTE
7593 | OPTI_TYPE_PRECOMPUTE_INIT
7594 | OPTI_TYPE_PRECOMPUTE_MERKLE
7595 | OPTI_TYPE_EARLY_SKIP
7596 | OPTI_TYPE_NOT_ITERATED
7597 | OPTI_TYPE_PREPENDED_SALT
7598 | OPTI_TYPE_RAW_HASH
;
7605 case 150: hash_type
= HASH_TYPE_SHA1
;
7606 salt_type
= SALT_TYPE_INTERN
;
7607 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7608 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7609 | OPTS_TYPE_ST_ADD80
7610 | OPTS_TYPE_ST_ADDBITS15
;
7611 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7612 dgst_size
= DGST_SIZE_4_5
;
7613 parse_func
= hmacsha1_parse_hash
;
7614 sort_by_digest
= sort_by_digest_4_5
;
7615 opti_type
= OPTI_TYPE_ZERO_BYTE
7616 | OPTI_TYPE_NOT_ITERATED
;
7623 case 160: hash_type
= HASH_TYPE_SHA1
;
7624 salt_type
= SALT_TYPE_INTERN
;
7625 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7626 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7627 | OPTS_TYPE_PT_ADD80
7628 | OPTS_TYPE_PT_ADDBITS15
;
7629 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7630 dgst_size
= DGST_SIZE_4_5
;
7631 parse_func
= hmacsha1_parse_hash
;
7632 sort_by_digest
= sort_by_digest_4_5
;
7633 opti_type
= OPTI_TYPE_ZERO_BYTE
7634 | OPTI_TYPE_NOT_ITERATED
;
7641 case 190: hash_type
= HASH_TYPE_SHA1
;
7642 salt_type
= SALT_TYPE_NONE
;
7643 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7644 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7645 | OPTS_TYPE_PT_ADD80
7646 | OPTS_TYPE_PT_ADDBITS15
;
7647 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7648 dgst_size
= DGST_SIZE_4_5
;
7649 parse_func
= sha1linkedin_parse_hash
;
7650 sort_by_digest
= sort_by_digest_4_5
;
7651 opti_type
= OPTI_TYPE_ZERO_BYTE
7652 | OPTI_TYPE_PRECOMPUTE_INIT
7653 | OPTI_TYPE_EARLY_SKIP
7654 | OPTI_TYPE_NOT_ITERATED
7655 | OPTI_TYPE_NOT_SALTED
;
7662 case 200: hash_type
= HASH_TYPE_MYSQL
;
7663 salt_type
= SALT_TYPE_NONE
;
7664 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7666 kern_type
= KERN_TYPE_MYSQL
;
7667 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7668 parse_func
= mysql323_parse_hash
;
7669 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7670 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7677 case 300: hash_type
= HASH_TYPE_SHA1
;
7678 salt_type
= SALT_TYPE_NONE
;
7679 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7680 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7681 | OPTS_TYPE_PT_ADD80
7682 | OPTS_TYPE_PT_ADDBITS15
;
7683 kern_type
= KERN_TYPE_MYSQL41
;
7684 dgst_size
= DGST_SIZE_4_5
;
7685 parse_func
= sha1_parse_hash
;
7686 sort_by_digest
= sort_by_digest_4_5
;
7687 opti_type
= OPTI_TYPE_ZERO_BYTE
7688 | OPTI_TYPE_PRECOMPUTE_INIT
7689 | OPTI_TYPE_PRECOMPUTE_MERKLE
7690 | OPTI_TYPE_EARLY_SKIP
7691 | OPTI_TYPE_NOT_ITERATED
7692 | OPTI_TYPE_NOT_SALTED
;
7699 case 400: 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_PHPASS
;
7704 dgst_size
= DGST_SIZE_4_4
;
7705 parse_func
= phpass_parse_hash
;
7706 sort_by_digest
= sort_by_digest_4_4
;
7707 opti_type
= OPTI_TYPE_ZERO_BYTE
7708 | OPTI_TYPE_SLOW_HASH_SIMD
;
7715 case 500: hash_type
= HASH_TYPE_MD5
;
7716 salt_type
= SALT_TYPE_EMBEDDED
;
7717 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7718 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7719 kern_type
= KERN_TYPE_MD5CRYPT
;
7720 dgst_size
= DGST_SIZE_4_4
;
7721 parse_func
= md5crypt_parse_hash
;
7722 sort_by_digest
= sort_by_digest_4_4
;
7723 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7730 case 501: hash_type
= HASH_TYPE_MD5
;
7731 salt_type
= SALT_TYPE_EMBEDDED
;
7732 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
7733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7734 | OPTS_TYPE_HASH_COPY
;
7735 kern_type
= KERN_TYPE_MD5CRYPT
;
7736 dgst_size
= DGST_SIZE_4_4
;
7737 parse_func
= juniper_parse_hash
;
7738 sort_by_digest
= sort_by_digest_4_4
;
7739 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7746 case 900: hash_type
= HASH_TYPE_MD4
;
7747 salt_type
= SALT_TYPE_NONE
;
7748 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7749 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7750 | OPTS_TYPE_PT_ADD80
7751 | OPTS_TYPE_PT_ADDBITS14
;
7752 kern_type
= KERN_TYPE_MD4
;
7753 dgst_size
= DGST_SIZE_4_4
;
7754 parse_func
= md4_parse_hash
;
7755 sort_by_digest
= sort_by_digest_4_4
;
7756 opti_type
= OPTI_TYPE_ZERO_BYTE
7757 | OPTI_TYPE_PRECOMPUTE_INIT
7758 | OPTI_TYPE_PRECOMPUTE_MERKLE
7759 | OPTI_TYPE_MEET_IN_MIDDLE
7760 | OPTI_TYPE_EARLY_SKIP
7761 | OPTI_TYPE_NOT_ITERATED
7762 | OPTI_TYPE_NOT_SALTED
7763 | OPTI_TYPE_RAW_HASH
;
7770 case 1000: hash_type
= HASH_TYPE_MD4
;
7771 salt_type
= SALT_TYPE_NONE
;
7772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7774 | OPTS_TYPE_PT_ADD80
7775 | OPTS_TYPE_PT_ADDBITS14
7776 | OPTS_TYPE_PT_UNICODE
;
7777 kern_type
= KERN_TYPE_MD4_PWU
;
7778 dgst_size
= DGST_SIZE_4_4
;
7779 parse_func
= md4_parse_hash
;
7780 sort_by_digest
= sort_by_digest_4_4
;
7781 opti_type
= OPTI_TYPE_ZERO_BYTE
7782 | OPTI_TYPE_PRECOMPUTE_INIT
7783 | OPTI_TYPE_PRECOMPUTE_MERKLE
7784 | OPTI_TYPE_MEET_IN_MIDDLE
7785 | OPTI_TYPE_EARLY_SKIP
7786 | OPTI_TYPE_NOT_ITERATED
7787 | OPTI_TYPE_NOT_SALTED
7788 | OPTI_TYPE_RAW_HASH
;
7795 case 1100: hash_type
= HASH_TYPE_MD4
;
7796 salt_type
= SALT_TYPE_INTERN
;
7797 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7798 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7799 | OPTS_TYPE_PT_ADD80
7800 | OPTS_TYPE_PT_ADDBITS14
7801 | OPTS_TYPE_PT_UNICODE
7802 | OPTS_TYPE_ST_ADD80
7803 | OPTS_TYPE_ST_UNICODE
7804 | OPTS_TYPE_ST_LOWER
;
7805 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7806 dgst_size
= DGST_SIZE_4_4
;
7807 parse_func
= dcc_parse_hash
;
7808 sort_by_digest
= sort_by_digest_4_4
;
7809 opti_type
= OPTI_TYPE_ZERO_BYTE
7810 | OPTI_TYPE_PRECOMPUTE_INIT
7811 | OPTI_TYPE_PRECOMPUTE_MERKLE
7812 | OPTI_TYPE_EARLY_SKIP
7813 | OPTI_TYPE_NOT_ITERATED
;
7820 case 1400: hash_type
= HASH_TYPE_SHA256
;
7821 salt_type
= SALT_TYPE_NONE
;
7822 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7823 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7824 | OPTS_TYPE_PT_ADD80
7825 | OPTS_TYPE_PT_ADDBITS15
;
7826 kern_type
= KERN_TYPE_SHA256
;
7827 dgst_size
= DGST_SIZE_4_8
;
7828 parse_func
= sha256_parse_hash
;
7829 sort_by_digest
= sort_by_digest_4_8
;
7830 opti_type
= OPTI_TYPE_ZERO_BYTE
7831 | OPTI_TYPE_PRECOMPUTE_INIT
7832 | OPTI_TYPE_PRECOMPUTE_MERKLE
7833 | OPTI_TYPE_EARLY_SKIP
7834 | OPTI_TYPE_NOT_ITERATED
7835 | OPTI_TYPE_NOT_SALTED
7836 | OPTI_TYPE_RAW_HASH
;
7843 case 1410: hash_type
= HASH_TYPE_SHA256
;
7844 salt_type
= SALT_TYPE_INTERN
;
7845 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7846 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7847 | OPTS_TYPE_ST_ADD80
7848 | OPTS_TYPE_ST_ADDBITS15
;
7849 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7850 dgst_size
= DGST_SIZE_4_8
;
7851 parse_func
= sha256s_parse_hash
;
7852 sort_by_digest
= sort_by_digest_4_8
;
7853 opti_type
= OPTI_TYPE_ZERO_BYTE
7854 | OPTI_TYPE_PRECOMPUTE_INIT
7855 | OPTI_TYPE_PRECOMPUTE_MERKLE
7856 | OPTI_TYPE_EARLY_SKIP
7857 | OPTI_TYPE_NOT_ITERATED
7858 | OPTI_TYPE_APPENDED_SALT
7859 | OPTI_TYPE_RAW_HASH
;
7866 case 1420: hash_type
= HASH_TYPE_SHA256
;
7867 salt_type
= SALT_TYPE_INTERN
;
7868 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7869 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7870 | OPTS_TYPE_PT_ADD80
7871 | OPTS_TYPE_PT_ADDBITS15
;
7872 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7873 dgst_size
= DGST_SIZE_4_8
;
7874 parse_func
= sha256s_parse_hash
;
7875 sort_by_digest
= sort_by_digest_4_8
;
7876 opti_type
= OPTI_TYPE_ZERO_BYTE
7877 | OPTI_TYPE_PRECOMPUTE_INIT
7878 | OPTI_TYPE_PRECOMPUTE_MERKLE
7879 | OPTI_TYPE_EARLY_SKIP
7880 | OPTI_TYPE_NOT_ITERATED
7881 | OPTI_TYPE_PREPENDED_SALT
7882 | OPTI_TYPE_RAW_HASH
;
7889 case 1421: hash_type
= HASH_TYPE_SHA256
;
7890 salt_type
= SALT_TYPE_EMBEDDED
;
7891 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7892 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7893 | OPTS_TYPE_PT_ADD80
7894 | OPTS_TYPE_PT_ADDBITS15
;
7895 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7896 dgst_size
= DGST_SIZE_4_8
;
7897 parse_func
= hmailserver_parse_hash
;
7898 sort_by_digest
= sort_by_digest_4_8
;
7899 opti_type
= OPTI_TYPE_ZERO_BYTE
7900 | OPTI_TYPE_PRECOMPUTE_INIT
7901 | OPTI_TYPE_PRECOMPUTE_MERKLE
7902 | OPTI_TYPE_EARLY_SKIP
7903 | OPTI_TYPE_NOT_ITERATED
7904 | OPTI_TYPE_PREPENDED_SALT
7905 | OPTI_TYPE_RAW_HASH
;
7912 case 1430: hash_type
= HASH_TYPE_SHA256
;
7913 salt_type
= SALT_TYPE_INTERN
;
7914 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7915 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7916 | OPTS_TYPE_PT_UNICODE
7917 | OPTS_TYPE_ST_ADD80
7918 | OPTS_TYPE_ST_ADDBITS15
;
7919 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7920 dgst_size
= DGST_SIZE_4_8
;
7921 parse_func
= sha256s_parse_hash
;
7922 sort_by_digest
= sort_by_digest_4_8
;
7923 opti_type
= OPTI_TYPE_ZERO_BYTE
7924 | OPTI_TYPE_PRECOMPUTE_INIT
7925 | OPTI_TYPE_PRECOMPUTE_MERKLE
7926 | OPTI_TYPE_EARLY_SKIP
7927 | OPTI_TYPE_NOT_ITERATED
7928 | OPTI_TYPE_APPENDED_SALT
7929 | OPTI_TYPE_RAW_HASH
;
7936 case 1440: hash_type
= HASH_TYPE_SHA256
;
7937 salt_type
= SALT_TYPE_INTERN
;
7938 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7939 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7940 | OPTS_TYPE_PT_ADD80
7941 | OPTS_TYPE_PT_ADDBITS15
7942 | OPTS_TYPE_PT_UNICODE
;
7943 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7944 dgst_size
= DGST_SIZE_4_8
;
7945 parse_func
= sha256s_parse_hash
;
7946 sort_by_digest
= sort_by_digest_4_8
;
7947 opti_type
= OPTI_TYPE_ZERO_BYTE
7948 | OPTI_TYPE_PRECOMPUTE_INIT
7949 | OPTI_TYPE_PRECOMPUTE_MERKLE
7950 | OPTI_TYPE_EARLY_SKIP
7951 | OPTI_TYPE_NOT_ITERATED
7952 | OPTI_TYPE_PREPENDED_SALT
7953 | OPTI_TYPE_RAW_HASH
;
7960 case 1441: hash_type
= HASH_TYPE_SHA256
;
7961 salt_type
= SALT_TYPE_EMBEDDED
;
7962 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7963 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7964 | OPTS_TYPE_PT_ADD80
7965 | OPTS_TYPE_PT_ADDBITS15
7966 | OPTS_TYPE_PT_UNICODE
7967 | OPTS_TYPE_ST_BASE64
;
7968 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7969 dgst_size
= DGST_SIZE_4_8
;
7970 parse_func
= episerver4_parse_hash
;
7971 sort_by_digest
= sort_by_digest_4_8
;
7972 opti_type
= OPTI_TYPE_ZERO_BYTE
7973 | OPTI_TYPE_PRECOMPUTE_INIT
7974 | OPTI_TYPE_PRECOMPUTE_MERKLE
7975 | OPTI_TYPE_EARLY_SKIP
7976 | OPTI_TYPE_NOT_ITERATED
7977 | OPTI_TYPE_PREPENDED_SALT
7978 | OPTI_TYPE_RAW_HASH
;
7985 case 1450: hash_type
= HASH_TYPE_SHA256
;
7986 salt_type
= SALT_TYPE_INTERN
;
7987 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
7988 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7989 | OPTS_TYPE_ST_ADD80
;
7990 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7991 dgst_size
= DGST_SIZE_4_8
;
7992 parse_func
= hmacsha256_parse_hash
;
7993 sort_by_digest
= sort_by_digest_4_8
;
7994 opti_type
= OPTI_TYPE_ZERO_BYTE
7995 | OPTI_TYPE_NOT_ITERATED
;
8002 case 1460: hash_type
= HASH_TYPE_SHA256
;
8003 salt_type
= SALT_TYPE_INTERN
;
8004 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8005 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8006 | OPTS_TYPE_PT_ADD80
8007 | OPTS_TYPE_PT_ADDBITS15
;
8008 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
8009 dgst_size
= DGST_SIZE_4_8
;
8010 parse_func
= hmacsha256_parse_hash
;
8011 sort_by_digest
= sort_by_digest_4_8
;
8012 opti_type
= OPTI_TYPE_ZERO_BYTE
8013 | OPTI_TYPE_NOT_ITERATED
;
8020 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
8021 salt_type
= SALT_TYPE_EMBEDDED
;
8022 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8023 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8024 | OPTS_TYPE_PT_BITSLICE
;
8025 kern_type
= KERN_TYPE_DESCRYPT
;
8026 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8027 parse_func
= descrypt_parse_hash
;
8028 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8029 opti_type
= OPTI_TYPE_ZERO_BYTE
8030 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8037 case 1600: hash_type
= HASH_TYPE_MD5
;
8038 salt_type
= SALT_TYPE_EMBEDDED
;
8039 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8040 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8041 kern_type
= KERN_TYPE_APR1CRYPT
;
8042 dgst_size
= DGST_SIZE_4_4
;
8043 parse_func
= md5apr1_parse_hash
;
8044 sort_by_digest
= sort_by_digest_4_4
;
8045 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8052 case 1700: hash_type
= HASH_TYPE_SHA512
;
8053 salt_type
= SALT_TYPE_NONE
;
8054 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8055 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8056 | OPTS_TYPE_PT_ADD80
8057 | OPTS_TYPE_PT_ADDBITS15
;
8058 kern_type
= KERN_TYPE_SHA512
;
8059 dgst_size
= DGST_SIZE_8_8
;
8060 parse_func
= sha512_parse_hash
;
8061 sort_by_digest
= sort_by_digest_8_8
;
8062 opti_type
= OPTI_TYPE_ZERO_BYTE
8063 | OPTI_TYPE_PRECOMPUTE_INIT
8064 | OPTI_TYPE_PRECOMPUTE_MERKLE
8065 | OPTI_TYPE_EARLY_SKIP
8066 | OPTI_TYPE_NOT_ITERATED
8067 | OPTI_TYPE_NOT_SALTED
8068 | OPTI_TYPE_USES_BITS_64
8069 | OPTI_TYPE_RAW_HASH
;
8076 case 1710: hash_type
= HASH_TYPE_SHA512
;
8077 salt_type
= SALT_TYPE_INTERN
;
8078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8079 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8080 | OPTS_TYPE_ST_ADD80
8081 | OPTS_TYPE_ST_ADDBITS15
;
8082 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8083 dgst_size
= DGST_SIZE_8_8
;
8084 parse_func
= sha512s_parse_hash
;
8085 sort_by_digest
= sort_by_digest_8_8
;
8086 opti_type
= OPTI_TYPE_ZERO_BYTE
8087 | OPTI_TYPE_PRECOMPUTE_INIT
8088 | OPTI_TYPE_PRECOMPUTE_MERKLE
8089 | OPTI_TYPE_EARLY_SKIP
8090 | OPTI_TYPE_NOT_ITERATED
8091 | OPTI_TYPE_APPENDED_SALT
8092 | OPTI_TYPE_USES_BITS_64
8093 | OPTI_TYPE_RAW_HASH
;
8100 case 1711: hash_type
= HASH_TYPE_SHA512
;
8101 salt_type
= SALT_TYPE_EMBEDDED
;
8102 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8103 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8104 | OPTS_TYPE_ST_ADD80
8105 | OPTS_TYPE_ST_ADDBITS15
;
8106 kern_type
= KERN_TYPE_SHA512_PWSLT
;
8107 dgst_size
= DGST_SIZE_8_8
;
8108 parse_func
= sha512b64s_parse_hash
;
8109 sort_by_digest
= sort_by_digest_8_8
;
8110 opti_type
= OPTI_TYPE_ZERO_BYTE
8111 | OPTI_TYPE_PRECOMPUTE_INIT
8112 | OPTI_TYPE_PRECOMPUTE_MERKLE
8113 | OPTI_TYPE_EARLY_SKIP
8114 | OPTI_TYPE_NOT_ITERATED
8115 | OPTI_TYPE_APPENDED_SALT
8116 | OPTI_TYPE_USES_BITS_64
8117 | OPTI_TYPE_RAW_HASH
;
8124 case 1720: hash_type
= HASH_TYPE_SHA512
;
8125 salt_type
= SALT_TYPE_INTERN
;
8126 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8127 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8128 | OPTS_TYPE_PT_ADD80
8129 | OPTS_TYPE_PT_ADDBITS15
;
8130 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8131 dgst_size
= DGST_SIZE_8_8
;
8132 parse_func
= sha512s_parse_hash
;
8133 sort_by_digest
= sort_by_digest_8_8
;
8134 opti_type
= OPTI_TYPE_ZERO_BYTE
8135 | OPTI_TYPE_PRECOMPUTE_INIT
8136 | OPTI_TYPE_PRECOMPUTE_MERKLE
8137 | OPTI_TYPE_EARLY_SKIP
8138 | OPTI_TYPE_NOT_ITERATED
8139 | OPTI_TYPE_PREPENDED_SALT
8140 | OPTI_TYPE_USES_BITS_64
8141 | OPTI_TYPE_RAW_HASH
;
8148 case 1722: hash_type
= HASH_TYPE_SHA512
;
8149 salt_type
= SALT_TYPE_EMBEDDED
;
8150 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8151 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8152 | OPTS_TYPE_PT_ADD80
8153 | OPTS_TYPE_PT_ADDBITS15
8155 kern_type
= KERN_TYPE_SHA512_SLTPW
;
8156 dgst_size
= DGST_SIZE_8_8
;
8157 parse_func
= osx512_parse_hash
;
8158 sort_by_digest
= sort_by_digest_8_8
;
8159 opti_type
= OPTI_TYPE_ZERO_BYTE
8160 | OPTI_TYPE_PRECOMPUTE_INIT
8161 | OPTI_TYPE_PRECOMPUTE_MERKLE
8162 | OPTI_TYPE_EARLY_SKIP
8163 | OPTI_TYPE_NOT_ITERATED
8164 | OPTI_TYPE_PREPENDED_SALT
8165 | OPTI_TYPE_USES_BITS_64
8166 | OPTI_TYPE_RAW_HASH
;
8173 case 1730: hash_type
= HASH_TYPE_SHA512
;
8174 salt_type
= SALT_TYPE_INTERN
;
8175 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8176 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8177 | OPTS_TYPE_PT_UNICODE
8178 | OPTS_TYPE_ST_ADD80
8179 | OPTS_TYPE_ST_ADDBITS15
;
8180 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8181 dgst_size
= DGST_SIZE_8_8
;
8182 parse_func
= sha512s_parse_hash
;
8183 sort_by_digest
= sort_by_digest_8_8
;
8184 opti_type
= OPTI_TYPE_ZERO_BYTE
8185 | OPTI_TYPE_PRECOMPUTE_INIT
8186 | OPTI_TYPE_PRECOMPUTE_MERKLE
8187 | OPTI_TYPE_EARLY_SKIP
8188 | OPTI_TYPE_NOT_ITERATED
8189 | OPTI_TYPE_APPENDED_SALT
8190 | OPTI_TYPE_USES_BITS_64
8191 | OPTI_TYPE_RAW_HASH
;
8198 case 1731: hash_type
= HASH_TYPE_SHA512
;
8199 salt_type
= SALT_TYPE_EMBEDDED
;
8200 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8201 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8202 | OPTS_TYPE_PT_UNICODE
8203 | OPTS_TYPE_ST_ADD80
8204 | OPTS_TYPE_ST_ADDBITS15
8206 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
8207 dgst_size
= DGST_SIZE_8_8
;
8208 parse_func
= mssql2012_parse_hash
;
8209 sort_by_digest
= sort_by_digest_8_8
;
8210 opti_type
= OPTI_TYPE_ZERO_BYTE
8211 | OPTI_TYPE_PRECOMPUTE_INIT
8212 | OPTI_TYPE_PRECOMPUTE_MERKLE
8213 | OPTI_TYPE_EARLY_SKIP
8214 | OPTI_TYPE_NOT_ITERATED
8215 | OPTI_TYPE_APPENDED_SALT
8216 | OPTI_TYPE_USES_BITS_64
8217 | OPTI_TYPE_RAW_HASH
;
8224 case 1740: hash_type
= HASH_TYPE_SHA512
;
8225 salt_type
= SALT_TYPE_INTERN
;
8226 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8227 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8228 | OPTS_TYPE_PT_ADD80
8229 | OPTS_TYPE_PT_ADDBITS15
8230 | OPTS_TYPE_PT_UNICODE
;
8231 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
8232 dgst_size
= DGST_SIZE_8_8
;
8233 parse_func
= sha512s_parse_hash
;
8234 sort_by_digest
= sort_by_digest_8_8
;
8235 opti_type
= OPTI_TYPE_ZERO_BYTE
8236 | OPTI_TYPE_PRECOMPUTE_INIT
8237 | OPTI_TYPE_PRECOMPUTE_MERKLE
8238 | OPTI_TYPE_EARLY_SKIP
8239 | OPTI_TYPE_NOT_ITERATED
8240 | OPTI_TYPE_PREPENDED_SALT
8241 | OPTI_TYPE_USES_BITS_64
8242 | OPTI_TYPE_RAW_HASH
;
8249 case 1750: hash_type
= HASH_TYPE_SHA512
;
8250 salt_type
= SALT_TYPE_INTERN
;
8251 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8252 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8253 | OPTS_TYPE_ST_ADD80
;
8254 kern_type
= KERN_TYPE_HMACSHA512_PW
;
8255 dgst_size
= DGST_SIZE_8_8
;
8256 parse_func
= hmacsha512_parse_hash
;
8257 sort_by_digest
= sort_by_digest_8_8
;
8258 opti_type
= OPTI_TYPE_ZERO_BYTE
8259 | OPTI_TYPE_USES_BITS_64
8260 | OPTI_TYPE_NOT_ITERATED
;
8267 case 1760: hash_type
= HASH_TYPE_SHA512
;
8268 salt_type
= SALT_TYPE_INTERN
;
8269 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8270 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8271 | OPTS_TYPE_PT_ADD80
8272 | OPTS_TYPE_PT_ADDBITS15
;
8273 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
8274 dgst_size
= DGST_SIZE_8_8
;
8275 parse_func
= hmacsha512_parse_hash
;
8276 sort_by_digest
= sort_by_digest_8_8
;
8277 opti_type
= OPTI_TYPE_ZERO_BYTE
8278 | OPTI_TYPE_USES_BITS_64
8279 | OPTI_TYPE_NOT_ITERATED
;
8286 case 1800: hash_type
= HASH_TYPE_SHA512
;
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 kern_type
= KERN_TYPE_SHA512CRYPT
;
8291 dgst_size
= DGST_SIZE_8_8
;
8292 parse_func
= sha512crypt_parse_hash
;
8293 sort_by_digest
= sort_by_digest_8_8
;
8294 opti_type
= OPTI_TYPE_ZERO_BYTE
8295 | OPTI_TYPE_USES_BITS_64
;
8302 case 2100: hash_type
= HASH_TYPE_DCC2
;
8303 salt_type
= SALT_TYPE_EMBEDDED
;
8304 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8305 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8306 | OPTS_TYPE_ST_LOWER
8307 | OPTS_TYPE_ST_UNICODE
;
8308 kern_type
= KERN_TYPE_DCC2
;
8309 dgst_size
= DGST_SIZE_4_4
;
8310 parse_func
= dcc2_parse_hash
;
8311 sort_by_digest
= sort_by_digest_4_4
;
8312 opti_type
= OPTI_TYPE_ZERO_BYTE
8313 | OPTI_TYPE_SLOW_HASH_SIMD
;
8320 case 2400: hash_type
= HASH_TYPE_MD5
;
8321 salt_type
= SALT_TYPE_NONE
;
8322 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8323 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8324 kern_type
= KERN_TYPE_MD5PIX
;
8325 dgst_size
= DGST_SIZE_4_4
;
8326 parse_func
= md5pix_parse_hash
;
8327 sort_by_digest
= sort_by_digest_4_4
;
8328 opti_type
= OPTI_TYPE_ZERO_BYTE
8329 | OPTI_TYPE_PRECOMPUTE_INIT
8330 | OPTI_TYPE_PRECOMPUTE_MERKLE
8331 | OPTI_TYPE_EARLY_SKIP
8332 | OPTI_TYPE_NOT_ITERATED
8333 | OPTI_TYPE_NOT_SALTED
;
8340 case 2410: hash_type
= HASH_TYPE_MD5
;
8341 salt_type
= SALT_TYPE_INTERN
;
8342 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8343 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8344 kern_type
= KERN_TYPE_MD5ASA
;
8345 dgst_size
= DGST_SIZE_4_4
;
8346 parse_func
= md5asa_parse_hash
;
8347 sort_by_digest
= sort_by_digest_4_4
;
8348 opti_type
= OPTI_TYPE_ZERO_BYTE
8349 | OPTI_TYPE_PRECOMPUTE_INIT
8350 | OPTI_TYPE_PRECOMPUTE_MERKLE
8351 | OPTI_TYPE_EARLY_SKIP
8352 | OPTI_TYPE_NOT_ITERATED
;
8359 case 2500: hash_type
= HASH_TYPE_WPA
;
8360 salt_type
= SALT_TYPE_EMBEDDED
;
8361 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8363 kern_type
= KERN_TYPE_WPA
;
8364 dgst_size
= DGST_SIZE_4_4
;
8365 parse_func
= wpa_parse_hash
;
8366 sort_by_digest
= sort_by_digest_4_4
;
8367 opti_type
= OPTI_TYPE_ZERO_BYTE
8368 | OPTI_TYPE_SLOW_HASH_SIMD
;
8375 case 2600: hash_type
= HASH_TYPE_MD5
;
8376 salt_type
= SALT_TYPE_VIRTUAL
;
8377 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8378 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8379 | OPTS_TYPE_PT_ADD80
8380 | OPTS_TYPE_PT_ADDBITS14
8381 | OPTS_TYPE_ST_ADD80
;
8382 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8383 dgst_size
= DGST_SIZE_4_4
;
8384 parse_func
= md5md5_parse_hash
;
8385 sort_by_digest
= sort_by_digest_4_4
;
8386 opti_type
= OPTI_TYPE_ZERO_BYTE
8387 | OPTI_TYPE_PRECOMPUTE_INIT
8388 | OPTI_TYPE_PRECOMPUTE_MERKLE
8389 | OPTI_TYPE_EARLY_SKIP
;
8396 case 2611: hash_type
= HASH_TYPE_MD5
;
8397 salt_type
= SALT_TYPE_INTERN
;
8398 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8399 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8400 | OPTS_TYPE_PT_ADD80
8401 | OPTS_TYPE_PT_ADDBITS14
8402 | OPTS_TYPE_ST_ADD80
;
8403 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8404 dgst_size
= DGST_SIZE_4_4
;
8405 parse_func
= vb3_parse_hash
;
8406 sort_by_digest
= sort_by_digest_4_4
;
8407 opti_type
= OPTI_TYPE_ZERO_BYTE
8408 | OPTI_TYPE_PRECOMPUTE_INIT
8409 | OPTI_TYPE_PRECOMPUTE_MERKLE
8410 | OPTI_TYPE_EARLY_SKIP
;
8417 case 2612: hash_type
= HASH_TYPE_MD5
;
8418 salt_type
= SALT_TYPE_EMBEDDED
;
8419 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8420 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8421 | OPTS_TYPE_PT_ADD80
8422 | OPTS_TYPE_PT_ADDBITS14
8423 | OPTS_TYPE_ST_ADD80
8425 kern_type
= KERN_TYPE_MD55_PWSLT1
;
8426 dgst_size
= DGST_SIZE_4_4
;
8427 parse_func
= phps_parse_hash
;
8428 sort_by_digest
= sort_by_digest_4_4
;
8429 opti_type
= OPTI_TYPE_ZERO_BYTE
8430 | OPTI_TYPE_PRECOMPUTE_INIT
8431 | OPTI_TYPE_PRECOMPUTE_MERKLE
8432 | OPTI_TYPE_EARLY_SKIP
;
8439 case 2711: hash_type
= HASH_TYPE_MD5
;
8440 salt_type
= SALT_TYPE_INTERN
;
8441 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8443 | OPTS_TYPE_PT_ADD80
8444 | OPTS_TYPE_PT_ADDBITS14
8445 | OPTS_TYPE_ST_ADD80
;
8446 kern_type
= KERN_TYPE_MD55_PWSLT2
;
8447 dgst_size
= DGST_SIZE_4_4
;
8448 parse_func
= vb30_parse_hash
;
8449 sort_by_digest
= sort_by_digest_4_4
;
8450 opti_type
= OPTI_TYPE_ZERO_BYTE
8451 | OPTI_TYPE_PRECOMPUTE_INIT
8452 | OPTI_TYPE_EARLY_SKIP
;
8459 case 2811: hash_type
= HASH_TYPE_MD5
;
8460 salt_type
= SALT_TYPE_INTERN
;
8461 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8462 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8463 | OPTS_TYPE_PT_ADD80
8464 | OPTS_TYPE_PT_ADDBITS14
;
8465 kern_type
= KERN_TYPE_MD55_SLTPW
;
8466 dgst_size
= DGST_SIZE_4_4
;
8467 parse_func
= ipb2_parse_hash
;
8468 sort_by_digest
= sort_by_digest_4_4
;
8469 opti_type
= OPTI_TYPE_ZERO_BYTE
8470 | OPTI_TYPE_PRECOMPUTE_INIT
8471 | OPTI_TYPE_EARLY_SKIP
;
8478 case 3000: hash_type
= HASH_TYPE_LM
;
8479 salt_type
= SALT_TYPE_NONE
;
8480 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8481 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8482 | OPTS_TYPE_PT_UPPER
8483 | OPTS_TYPE_PT_BITSLICE
;
8484 kern_type
= KERN_TYPE_LM
;
8485 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8486 parse_func
= lm_parse_hash
;
8487 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8488 opti_type
= OPTI_TYPE_ZERO_BYTE
8489 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8496 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
8497 salt_type
= SALT_TYPE_INTERN
;
8498 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8500 | OPTS_TYPE_PT_UPPER
8501 | OPTS_TYPE_ST_UPPER
;
8502 kern_type
= KERN_TYPE_ORACLEH
;
8503 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8504 parse_func
= oracleh_parse_hash
;
8505 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8506 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8513 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
8514 salt_type
= SALT_TYPE_EMBEDDED
;
8515 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8516 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8517 | OPTS_TYPE_ST_GENERATE_LE
;
8518 kern_type
= KERN_TYPE_BCRYPT
;
8519 dgst_size
= DGST_SIZE_4_6
;
8520 parse_func
= bcrypt_parse_hash
;
8521 sort_by_digest
= sort_by_digest_4_6
;
8522 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8529 case 3710: hash_type
= HASH_TYPE_MD5
;
8530 salt_type
= SALT_TYPE_INTERN
;
8531 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8532 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8533 | OPTS_TYPE_PT_ADD80
8534 | OPTS_TYPE_PT_ADDBITS14
;
8535 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8536 dgst_size
= DGST_SIZE_4_4
;
8537 parse_func
= md5s_parse_hash
;
8538 sort_by_digest
= sort_by_digest_4_4
;
8539 opti_type
= OPTI_TYPE_ZERO_BYTE
8540 | OPTI_TYPE_PRECOMPUTE_INIT
8541 | OPTI_TYPE_PRECOMPUTE_MERKLE
8542 | OPTI_TYPE_EARLY_SKIP
;
8549 case 3711: hash_type
= HASH_TYPE_MD5
;
8550 salt_type
= SALT_TYPE_EMBEDDED
;
8551 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8553 | OPTS_TYPE_PT_ADD80
8554 | OPTS_TYPE_PT_ADDBITS14
;
8555 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8556 dgst_size
= DGST_SIZE_4_4
;
8557 parse_func
= mediawiki_b_parse_hash
;
8558 sort_by_digest
= sort_by_digest_4_4
;
8559 opti_type
= OPTI_TYPE_ZERO_BYTE
8560 | OPTI_TYPE_PRECOMPUTE_INIT
8561 | OPTI_TYPE_PRECOMPUTE_MERKLE
8562 | OPTI_TYPE_EARLY_SKIP
;
8569 case 3800: hash_type
= HASH_TYPE_MD5
;
8570 salt_type
= SALT_TYPE_INTERN
;
8571 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8572 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8573 | OPTS_TYPE_ST_ADDBITS14
;
8574 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8575 dgst_size
= DGST_SIZE_4_4
;
8576 parse_func
= md5s_parse_hash
;
8577 sort_by_digest
= sort_by_digest_4_4
;
8578 opti_type
= OPTI_TYPE_ZERO_BYTE
8579 | OPTI_TYPE_PRECOMPUTE_INIT
8580 | OPTI_TYPE_PRECOMPUTE_MERKLE
8581 | OPTI_TYPE_EARLY_SKIP
8582 | OPTI_TYPE_NOT_ITERATED
8583 | OPTI_TYPE_RAW_HASH
;
8590 case 4300: hash_type
= HASH_TYPE_MD5
;
8591 salt_type
= SALT_TYPE_VIRTUAL
;
8592 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8593 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8594 | OPTS_TYPE_PT_ADD80
8595 | OPTS_TYPE_PT_ADDBITS14
8596 | OPTS_TYPE_ST_ADD80
;
8597 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8598 dgst_size
= DGST_SIZE_4_4
;
8599 parse_func
= md5md5_parse_hash
;
8600 sort_by_digest
= sort_by_digest_4_4
;
8601 opti_type
= OPTI_TYPE_ZERO_BYTE
8602 | OPTI_TYPE_PRECOMPUTE_INIT
8603 | OPTI_TYPE_PRECOMPUTE_MERKLE
8604 | OPTI_TYPE_EARLY_SKIP
;
8612 case 4400: hash_type
= HASH_TYPE_MD5
;
8613 salt_type
= SALT_TYPE_NONE
;
8614 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8615 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8616 | OPTS_TYPE_PT_ADD80
8617 | OPTS_TYPE_PT_ADDBITS15
;
8618 kern_type
= KERN_TYPE_MD5_SHA1
;
8619 dgst_size
= DGST_SIZE_4_4
;
8620 parse_func
= md5_parse_hash
;
8621 sort_by_digest
= sort_by_digest_4_4
;
8622 opti_type
= OPTI_TYPE_ZERO_BYTE
8623 | OPTI_TYPE_PRECOMPUTE_INIT
8624 | OPTI_TYPE_PRECOMPUTE_MERKLE
8625 | OPTI_TYPE_EARLY_SKIP
8626 | OPTI_TYPE_NOT_ITERATED
8627 | OPTI_TYPE_NOT_SALTED
8628 | OPTI_TYPE_RAW_HASH
;
8635 case 4500: hash_type
= HASH_TYPE_SHA1
;
8636 salt_type
= SALT_TYPE_NONE
;
8637 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8638 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8639 | OPTS_TYPE_PT_ADD80
8640 | OPTS_TYPE_PT_ADDBITS15
;
8641 kern_type
= KERN_TYPE_SHA11
;
8642 dgst_size
= DGST_SIZE_4_5
;
8643 parse_func
= sha1_parse_hash
;
8644 sort_by_digest
= sort_by_digest_4_5
;
8645 opti_type
= OPTI_TYPE_ZERO_BYTE
8646 | OPTI_TYPE_PRECOMPUTE_INIT
8647 | OPTI_TYPE_PRECOMPUTE_MERKLE
8648 | OPTI_TYPE_EARLY_SKIP
8649 | OPTI_TYPE_NOT_SALTED
;
8656 case 4700: hash_type
= HASH_TYPE_SHA1
;
8657 salt_type
= SALT_TYPE_NONE
;
8658 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8660 | OPTS_TYPE_PT_ADD80
8661 | OPTS_TYPE_PT_ADDBITS14
;
8662 kern_type
= KERN_TYPE_SHA1_MD5
;
8663 dgst_size
= DGST_SIZE_4_5
;
8664 parse_func
= sha1_parse_hash
;
8665 sort_by_digest
= sort_by_digest_4_5
;
8666 opti_type
= OPTI_TYPE_ZERO_BYTE
8667 | OPTI_TYPE_PRECOMPUTE_INIT
8668 | OPTI_TYPE_PRECOMPUTE_MERKLE
8669 | OPTI_TYPE_EARLY_SKIP
8670 | OPTI_TYPE_NOT_ITERATED
8671 | OPTI_TYPE_NOT_SALTED
8672 | OPTI_TYPE_RAW_HASH
;
8679 case 4800: hash_type
= HASH_TYPE_MD5
;
8680 salt_type
= SALT_TYPE_EMBEDDED
;
8681 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8682 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8683 | OPTS_TYPE_PT_ADDBITS14
;
8684 kern_type
= KERN_TYPE_MD5_CHAP
;
8685 dgst_size
= DGST_SIZE_4_4
;
8686 parse_func
= chap_parse_hash
;
8687 sort_by_digest
= sort_by_digest_4_4
;
8688 opti_type
= OPTI_TYPE_ZERO_BYTE
8689 | OPTI_TYPE_PRECOMPUTE_INIT
8690 | OPTI_TYPE_PRECOMPUTE_MERKLE
8691 | OPTI_TYPE_MEET_IN_MIDDLE
8692 | OPTI_TYPE_EARLY_SKIP
8693 | OPTI_TYPE_NOT_ITERATED
8694 | OPTI_TYPE_RAW_HASH
;
8701 case 4900: hash_type
= HASH_TYPE_SHA1
;
8702 salt_type
= SALT_TYPE_INTERN
;
8703 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8704 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8705 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8706 dgst_size
= DGST_SIZE_4_5
;
8707 parse_func
= sha1s_parse_hash
;
8708 sort_by_digest
= sort_by_digest_4_5
;
8709 opti_type
= OPTI_TYPE_ZERO_BYTE
8710 | OPTI_TYPE_PRECOMPUTE_INIT
8711 | OPTI_TYPE_PRECOMPUTE_MERKLE
8712 | OPTI_TYPE_EARLY_SKIP
;
8719 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8720 salt_type
= SALT_TYPE_EMBEDDED
;
8721 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8722 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8723 | OPTS_TYPE_PT_ADD01
;
8724 kern_type
= KERN_TYPE_KECCAK
;
8725 dgst_size
= DGST_SIZE_8_25
;
8726 parse_func
= keccak_parse_hash
;
8727 sort_by_digest
= sort_by_digest_8_25
;
8728 opti_type
= OPTI_TYPE_ZERO_BYTE
8729 | OPTI_TYPE_USES_BITS_64
8730 | OPTI_TYPE_RAW_HASH
;
8737 case 5100: hash_type
= HASH_TYPE_MD5H
;
8738 salt_type
= SALT_TYPE_NONE
;
8739 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8740 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8741 | OPTS_TYPE_PT_ADD80
8742 | OPTS_TYPE_PT_ADDBITS14
;
8743 kern_type
= KERN_TYPE_MD5H
;
8744 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8745 parse_func
= md5half_parse_hash
;
8746 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8747 opti_type
= OPTI_TYPE_ZERO_BYTE
8748 | OPTI_TYPE_RAW_HASH
;
8755 case 5200: hash_type
= HASH_TYPE_SHA256
;
8756 salt_type
= SALT_TYPE_EMBEDDED
;
8757 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8758 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8759 kern_type
= KERN_TYPE_PSAFE3
;
8760 dgst_size
= DGST_SIZE_4_8
;
8761 parse_func
= psafe3_parse_hash
;
8762 sort_by_digest
= sort_by_digest_4_8
;
8763 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8770 case 5300: hash_type
= HASH_TYPE_MD5
;
8771 salt_type
= SALT_TYPE_EMBEDDED
;
8772 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8774 | OPTS_TYPE_ST_ADD80
;
8775 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8776 dgst_size
= DGST_SIZE_4_4
;
8777 parse_func
= ikepsk_md5_parse_hash
;
8778 sort_by_digest
= sort_by_digest_4_4
;
8779 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8786 case 5400: hash_type
= HASH_TYPE_SHA1
;
8787 salt_type
= SALT_TYPE_EMBEDDED
;
8788 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8789 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8790 | OPTS_TYPE_ST_ADD80
;
8791 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8792 dgst_size
= DGST_SIZE_4_5
;
8793 parse_func
= ikepsk_sha1_parse_hash
;
8794 sort_by_digest
= sort_by_digest_4_5
;
8795 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8802 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8803 salt_type
= SALT_TYPE_EMBEDDED
;
8804 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8805 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8806 | OPTS_TYPE_PT_ADD80
8807 | OPTS_TYPE_PT_ADDBITS14
8808 | OPTS_TYPE_PT_UNICODE
8810 kern_type
= KERN_TYPE_NETNTLMv1
;
8811 dgst_size
= DGST_SIZE_4_4
;
8812 parse_func
= netntlmv1_parse_hash
;
8813 sort_by_digest
= sort_by_digest_4_4
;
8814 opti_type
= OPTI_TYPE_ZERO_BYTE
8815 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8822 case 5600: hash_type
= HASH_TYPE_MD5
;
8823 salt_type
= SALT_TYPE_EMBEDDED
;
8824 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8825 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8826 | OPTS_TYPE_PT_ADD80
8827 | OPTS_TYPE_PT_ADDBITS14
8828 | OPTS_TYPE_PT_UNICODE
;
8829 kern_type
= KERN_TYPE_NETNTLMv2
;
8830 dgst_size
= DGST_SIZE_4_4
;
8831 parse_func
= netntlmv2_parse_hash
;
8832 sort_by_digest
= sort_by_digest_4_4
;
8833 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8840 case 5700: hash_type
= HASH_TYPE_SHA256
;
8841 salt_type
= SALT_TYPE_NONE
;
8842 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8843 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8844 | OPTS_TYPE_PT_ADD80
8845 | OPTS_TYPE_PT_ADDBITS15
;
8846 kern_type
= KERN_TYPE_SHA256
;
8847 dgst_size
= DGST_SIZE_4_8
;
8848 parse_func
= cisco4_parse_hash
;
8849 sort_by_digest
= sort_by_digest_4_8
;
8850 opti_type
= OPTI_TYPE_ZERO_BYTE
8851 | OPTI_TYPE_PRECOMPUTE_INIT
8852 | OPTI_TYPE_PRECOMPUTE_MERKLE
8853 | OPTI_TYPE_EARLY_SKIP
8854 | OPTI_TYPE_NOT_ITERATED
8855 | OPTI_TYPE_NOT_SALTED
8856 | OPTI_TYPE_RAW_HASH
;
8863 case 5800: hash_type
= HASH_TYPE_SHA1
;
8864 salt_type
= SALT_TYPE_INTERN
;
8865 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8867 | OPTS_TYPE_ST_ADD80
;
8868 kern_type
= KERN_TYPE_ANDROIDPIN
;
8869 dgst_size
= DGST_SIZE_4_5
;
8870 parse_func
= androidpin_parse_hash
;
8871 sort_by_digest
= sort_by_digest_4_5
;
8872 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8879 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8880 salt_type
= SALT_TYPE_NONE
;
8881 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8882 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8883 | OPTS_TYPE_PT_ADD80
;
8884 kern_type
= KERN_TYPE_RIPEMD160
;
8885 dgst_size
= DGST_SIZE_4_5
;
8886 parse_func
= ripemd160_parse_hash
;
8887 sort_by_digest
= sort_by_digest_4_5
;
8888 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8895 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8896 salt_type
= SALT_TYPE_NONE
;
8897 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
8898 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8899 | OPTS_TYPE_PT_ADD80
;
8900 kern_type
= KERN_TYPE_WHIRLPOOL
;
8901 dgst_size
= DGST_SIZE_4_16
;
8902 parse_func
= whirlpool_parse_hash
;
8903 sort_by_digest
= sort_by_digest_4_16
;
8904 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8911 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8912 salt_type
= SALT_TYPE_EMBEDDED
;
8913 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8914 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8915 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8916 dgst_size
= DGST_SIZE_4_5
;
8917 parse_func
= truecrypt_parse_hash_2k
;
8918 sort_by_digest
= sort_by_digest_4_5
;
8919 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8926 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8927 salt_type
= SALT_TYPE_EMBEDDED
;
8928 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8929 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8930 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8931 dgst_size
= DGST_SIZE_4_5
;
8932 parse_func
= truecrypt_parse_hash_2k
;
8933 sort_by_digest
= sort_by_digest_4_5
;
8934 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8941 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8942 salt_type
= SALT_TYPE_EMBEDDED
;
8943 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8944 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8945 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8946 dgst_size
= DGST_SIZE_4_5
;
8947 parse_func
= truecrypt_parse_hash_2k
;
8948 sort_by_digest
= sort_by_digest_4_5
;
8949 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8956 case 6221: 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_XTS512
;
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 6222: 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_XTS1024
;
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 6223: hash_type
= HASH_TYPE_SHA512
;
8989 salt_type
= SALT_TYPE_EMBEDDED
;
8990 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
8991 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8992 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8993 dgst_size
= DGST_SIZE_8_8
;
8994 parse_func
= truecrypt_parse_hash_1k
;
8995 sort_by_digest
= sort_by_digest_8_8
;
8996 opti_type
= OPTI_TYPE_ZERO_BYTE
8997 | OPTI_TYPE_USES_BITS_64
;
9004 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
9005 salt_type
= SALT_TYPE_EMBEDDED
;
9006 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9007 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9008 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
9009 dgst_size
= DGST_SIZE_4_8
;
9010 parse_func
= truecrypt_parse_hash_1k
;
9011 sort_by_digest
= sort_by_digest_4_8
;
9012 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9019 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
9020 salt_type
= SALT_TYPE_EMBEDDED
;
9021 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9022 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9023 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
9024 dgst_size
= DGST_SIZE_4_8
;
9025 parse_func
= truecrypt_parse_hash_1k
;
9026 sort_by_digest
= sort_by_digest_4_8
;
9027 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9034 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
9035 salt_type
= SALT_TYPE_EMBEDDED
;
9036 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9037 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9038 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
9039 dgst_size
= DGST_SIZE_4_8
;
9040 parse_func
= truecrypt_parse_hash_1k
;
9041 sort_by_digest
= sort_by_digest_4_8
;
9042 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9049 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
9050 salt_type
= SALT_TYPE_EMBEDDED
;
9051 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9052 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9053 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
9054 dgst_size
= DGST_SIZE_4_5
;
9055 parse_func
= truecrypt_parse_hash_1k
;
9056 sort_by_digest
= sort_by_digest_4_5
;
9057 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9064 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
9065 salt_type
= SALT_TYPE_EMBEDDED
;
9066 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9067 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9068 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
9069 dgst_size
= DGST_SIZE_4_5
;
9070 parse_func
= truecrypt_parse_hash_1k
;
9071 sort_by_digest
= sort_by_digest_4_5
;
9072 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9079 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
9080 salt_type
= SALT_TYPE_EMBEDDED
;
9081 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9082 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9083 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
9084 dgst_size
= DGST_SIZE_4_5
;
9085 parse_func
= truecrypt_parse_hash_1k
;
9086 sort_by_digest
= sort_by_digest_4_5
;
9087 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9094 case 6300: hash_type
= HASH_TYPE_MD5
;
9095 salt_type
= SALT_TYPE_EMBEDDED
;
9096 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9097 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9098 kern_type
= KERN_TYPE_MD5AIX
;
9099 dgst_size
= DGST_SIZE_4_4
;
9100 parse_func
= md5aix_parse_hash
;
9101 sort_by_digest
= sort_by_digest_4_4
;
9102 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9109 case 6400: hash_type
= HASH_TYPE_SHA256
;
9110 salt_type
= SALT_TYPE_EMBEDDED
;
9111 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9112 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9113 kern_type
= KERN_TYPE_SHA256AIX
;
9114 dgst_size
= DGST_SIZE_4_8
;
9115 parse_func
= sha256aix_parse_hash
;
9116 sort_by_digest
= sort_by_digest_4_8
;
9117 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9124 case 6500: hash_type
= HASH_TYPE_SHA512
;
9125 salt_type
= SALT_TYPE_EMBEDDED
;
9126 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9127 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9128 kern_type
= KERN_TYPE_SHA512AIX
;
9129 dgst_size
= DGST_SIZE_8_8
;
9130 parse_func
= sha512aix_parse_hash
;
9131 sort_by_digest
= sort_by_digest_8_8
;
9132 opti_type
= OPTI_TYPE_ZERO_BYTE
9133 | OPTI_TYPE_USES_BITS_64
;
9140 case 6600: hash_type
= HASH_TYPE_AES
;
9141 salt_type
= SALT_TYPE_EMBEDDED
;
9142 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9143 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9144 kern_type
= KERN_TYPE_AGILEKEY
;
9145 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9146 parse_func
= agilekey_parse_hash
;
9147 sort_by_digest
= sort_by_digest_4_5
;
9148 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9155 case 6700: hash_type
= HASH_TYPE_SHA1
;
9156 salt_type
= SALT_TYPE_EMBEDDED
;
9157 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9158 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9159 kern_type
= KERN_TYPE_SHA1AIX
;
9160 dgst_size
= DGST_SIZE_4_5
;
9161 parse_func
= sha1aix_parse_hash
;
9162 sort_by_digest
= sort_by_digest_4_5
;
9163 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9170 case 6800: hash_type
= HASH_TYPE_AES
;
9171 salt_type
= SALT_TYPE_EMBEDDED
;
9172 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9173 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9174 kern_type
= KERN_TYPE_LASTPASS
;
9175 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
9176 parse_func
= lastpass_parse_hash
;
9177 sort_by_digest
= sort_by_digest_4_8
;
9178 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9185 case 6900: hash_type
= HASH_TYPE_GOST
;
9186 salt_type
= SALT_TYPE_NONE
;
9187 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9189 kern_type
= KERN_TYPE_GOST
;
9190 dgst_size
= DGST_SIZE_4_8
;
9191 parse_func
= gost_parse_hash
;
9192 sort_by_digest
= sort_by_digest_4_8
;
9193 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9200 case 7100: hash_type
= HASH_TYPE_SHA512
;
9201 salt_type
= SALT_TYPE_EMBEDDED
;
9202 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9204 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9205 dgst_size
= DGST_SIZE_8_16
;
9206 parse_func
= sha512osx_parse_hash
;
9207 sort_by_digest
= sort_by_digest_8_16
;
9208 opti_type
= OPTI_TYPE_ZERO_BYTE
9209 | OPTI_TYPE_USES_BITS_64
9210 | OPTI_TYPE_SLOW_HASH_SIMD
;
9217 case 7200: hash_type
= HASH_TYPE_SHA512
;
9218 salt_type
= SALT_TYPE_EMBEDDED
;
9219 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9220 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9221 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9222 dgst_size
= DGST_SIZE_8_16
;
9223 parse_func
= sha512grub_parse_hash
;
9224 sort_by_digest
= sort_by_digest_8_16
;
9225 opti_type
= OPTI_TYPE_ZERO_BYTE
9226 | OPTI_TYPE_USES_BITS_64
9227 | OPTI_TYPE_SLOW_HASH_SIMD
;
9234 case 7300: hash_type
= HASH_TYPE_SHA1
;
9235 salt_type
= SALT_TYPE_EMBEDDED
;
9236 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9237 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9238 | OPTS_TYPE_ST_ADD80
9239 | OPTS_TYPE_ST_ADDBITS15
;
9240 kern_type
= KERN_TYPE_RAKP
;
9241 dgst_size
= DGST_SIZE_4_5
;
9242 parse_func
= rakp_parse_hash
;
9243 sort_by_digest
= sort_by_digest_4_5
;
9244 opti_type
= OPTI_TYPE_ZERO_BYTE
9245 | OPTI_TYPE_NOT_ITERATED
;
9252 case 7400: hash_type
= HASH_TYPE_SHA256
;
9253 salt_type
= SALT_TYPE_EMBEDDED
;
9254 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9255 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9256 kern_type
= KERN_TYPE_SHA256CRYPT
;
9257 dgst_size
= DGST_SIZE_4_8
;
9258 parse_func
= sha256crypt_parse_hash
;
9259 sort_by_digest
= sort_by_digest_4_8
;
9260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9267 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
9268 salt_type
= SALT_TYPE_EMBEDDED
;
9269 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9270 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9271 kern_type
= KERN_TYPE_KRB5PA
;
9272 dgst_size
= DGST_SIZE_4_4
;
9273 parse_func
= krb5pa_parse_hash
;
9274 sort_by_digest
= sort_by_digest_4_4
;
9275 opti_type
= OPTI_TYPE_ZERO_BYTE
9276 | OPTI_TYPE_NOT_ITERATED
;
9283 case 7600: hash_type
= HASH_TYPE_SHA1
;
9284 salt_type
= SALT_TYPE_INTERN
;
9285 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9286 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9287 | OPTS_TYPE_PT_ADD80
9288 | OPTS_TYPE_PT_ADDBITS15
;
9289 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
9290 dgst_size
= DGST_SIZE_4_5
;
9291 parse_func
= redmine_parse_hash
;
9292 sort_by_digest
= sort_by_digest_4_5
;
9293 opti_type
= OPTI_TYPE_ZERO_BYTE
9294 | OPTI_TYPE_PRECOMPUTE_INIT
9295 | OPTI_TYPE_EARLY_SKIP
9296 | OPTI_TYPE_NOT_ITERATED
9297 | OPTI_TYPE_PREPENDED_SALT
;
9304 case 7700: hash_type
= HASH_TYPE_SAPB
;
9305 salt_type
= SALT_TYPE_EMBEDDED
;
9306 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9307 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9308 | OPTS_TYPE_PT_UPPER
9309 | OPTS_TYPE_ST_UPPER
;
9310 kern_type
= KERN_TYPE_SAPB
;
9311 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9312 parse_func
= sapb_parse_hash
;
9313 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9314 opti_type
= OPTI_TYPE_ZERO_BYTE
9315 | OPTI_TYPE_PRECOMPUTE_INIT
9316 | OPTI_TYPE_NOT_ITERATED
;
9323 case 7800: hash_type
= HASH_TYPE_SAPG
;
9324 salt_type
= SALT_TYPE_EMBEDDED
;
9325 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9326 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9327 | OPTS_TYPE_ST_ADD80
9328 | OPTS_TYPE_ST_UPPER
;
9329 kern_type
= KERN_TYPE_SAPG
;
9330 dgst_size
= DGST_SIZE_4_5
;
9331 parse_func
= sapg_parse_hash
;
9332 sort_by_digest
= sort_by_digest_4_5
;
9333 opti_type
= OPTI_TYPE_ZERO_BYTE
9334 | OPTI_TYPE_PRECOMPUTE_INIT
9335 | OPTI_TYPE_NOT_ITERATED
;
9342 case 7900: hash_type
= HASH_TYPE_SHA512
;
9343 salt_type
= SALT_TYPE_EMBEDDED
;
9344 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9345 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9346 kern_type
= KERN_TYPE_DRUPAL7
;
9347 dgst_size
= DGST_SIZE_8_8
;
9348 parse_func
= drupal7_parse_hash
;
9349 sort_by_digest
= sort_by_digest_8_8
;
9350 opti_type
= OPTI_TYPE_ZERO_BYTE
9351 | OPTI_TYPE_USES_BITS_64
;
9358 case 8000: hash_type
= HASH_TYPE_SHA256
;
9359 salt_type
= SALT_TYPE_EMBEDDED
;
9360 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9361 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9362 | OPTS_TYPE_PT_UNICODE
9363 | OPTS_TYPE_ST_ADD80
9365 kern_type
= KERN_TYPE_SYBASEASE
;
9366 dgst_size
= DGST_SIZE_4_8
;
9367 parse_func
= sybasease_parse_hash
;
9368 sort_by_digest
= sort_by_digest_4_8
;
9369 opti_type
= OPTI_TYPE_ZERO_BYTE
9370 | OPTI_TYPE_PRECOMPUTE_INIT
9371 | OPTI_TYPE_EARLY_SKIP
9372 | OPTI_TYPE_NOT_ITERATED
9373 | OPTI_TYPE_RAW_HASH
;
9380 case 8100: hash_type
= HASH_TYPE_SHA1
;
9381 salt_type
= SALT_TYPE_EMBEDDED
;
9382 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9383 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
9384 kern_type
= KERN_TYPE_NETSCALER
;
9385 dgst_size
= DGST_SIZE_4_5
;
9386 parse_func
= netscaler_parse_hash
;
9387 sort_by_digest
= sort_by_digest_4_5
;
9388 opti_type
= OPTI_TYPE_ZERO_BYTE
9389 | OPTI_TYPE_PRECOMPUTE_INIT
9390 | OPTI_TYPE_PRECOMPUTE_MERKLE
9391 | OPTI_TYPE_EARLY_SKIP
9392 | OPTI_TYPE_NOT_ITERATED
9393 | OPTI_TYPE_PREPENDED_SALT
9394 | OPTI_TYPE_RAW_HASH
;
9401 case 8200: hash_type
= HASH_TYPE_SHA256
;
9402 salt_type
= SALT_TYPE_EMBEDDED
;
9403 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9404 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9405 kern_type
= KERN_TYPE_CLOUDKEY
;
9406 dgst_size
= DGST_SIZE_4_8
;
9407 parse_func
= cloudkey_parse_hash
;
9408 sort_by_digest
= sort_by_digest_4_8
;
9409 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9416 case 8300: hash_type
= HASH_TYPE_SHA1
;
9417 salt_type
= SALT_TYPE_EMBEDDED
;
9418 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9419 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9421 | OPTS_TYPE_ST_ADD80
;
9422 kern_type
= KERN_TYPE_NSEC3
;
9423 dgst_size
= DGST_SIZE_4_5
;
9424 parse_func
= nsec3_parse_hash
;
9425 sort_by_digest
= sort_by_digest_4_5
;
9426 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9433 case 8400: hash_type
= HASH_TYPE_SHA1
;
9434 salt_type
= SALT_TYPE_INTERN
;
9435 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9436 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9437 | OPTS_TYPE_PT_ADD80
9438 | OPTS_TYPE_PT_ADDBITS15
;
9439 kern_type
= KERN_TYPE_WBB3
;
9440 dgst_size
= DGST_SIZE_4_5
;
9441 parse_func
= wbb3_parse_hash
;
9442 sort_by_digest
= sort_by_digest_4_5
;
9443 opti_type
= OPTI_TYPE_ZERO_BYTE
9444 | OPTI_TYPE_PRECOMPUTE_INIT
9445 | OPTI_TYPE_NOT_ITERATED
;
9452 case 8500: hash_type
= HASH_TYPE_DESRACF
;
9453 salt_type
= SALT_TYPE_EMBEDDED
;
9454 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9455 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9456 | OPTS_TYPE_ST_UPPER
;
9457 kern_type
= KERN_TYPE_RACF
;
9458 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9459 parse_func
= racf_parse_hash
;
9460 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9461 opti_type
= OPTI_TYPE_ZERO_BYTE
9462 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9469 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
9470 salt_type
= SALT_TYPE_NONE
;
9471 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9472 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9473 kern_type
= KERN_TYPE_LOTUS5
;
9474 dgst_size
= DGST_SIZE_4_4
;
9475 parse_func
= lotus5_parse_hash
;
9476 sort_by_digest
= sort_by_digest_4_4
;
9477 opti_type
= OPTI_TYPE_EARLY_SKIP
9478 | OPTI_TYPE_NOT_ITERATED
9479 | OPTI_TYPE_NOT_SALTED
9480 | OPTI_TYPE_RAW_HASH
;
9487 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
9488 salt_type
= SALT_TYPE_EMBEDDED
;
9489 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9491 kern_type
= KERN_TYPE_LOTUS6
;
9492 dgst_size
= DGST_SIZE_4_4
;
9493 parse_func
= lotus6_parse_hash
;
9494 sort_by_digest
= sort_by_digest_4_4
;
9495 opti_type
= OPTI_TYPE_EARLY_SKIP
9496 | OPTI_TYPE_NOT_ITERATED
9497 | OPTI_TYPE_RAW_HASH
;
9504 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
9505 salt_type
= SALT_TYPE_EMBEDDED
;
9506 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9507 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9508 kern_type
= KERN_TYPE_ANDROIDFDE
;
9509 dgst_size
= DGST_SIZE_4_4
;
9510 parse_func
= androidfde_parse_hash
;
9511 sort_by_digest
= sort_by_digest_4_4
;
9512 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9519 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
9520 salt_type
= SALT_TYPE_EMBEDDED
;
9521 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9522 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9523 kern_type
= KERN_TYPE_SCRYPT
;
9524 dgst_size
= DGST_SIZE_4_8
;
9525 parse_func
= scrypt_parse_hash
;
9526 sort_by_digest
= sort_by_digest_4_8
;
9527 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9534 case 9000: hash_type
= HASH_TYPE_SHA1
;
9535 salt_type
= SALT_TYPE_EMBEDDED
;
9536 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9537 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9538 | OPTS_TYPE_ST_GENERATE_LE
;
9539 kern_type
= KERN_TYPE_PSAFE2
;
9540 dgst_size
= DGST_SIZE_4_5
;
9541 parse_func
= psafe2_parse_hash
;
9542 sort_by_digest
= sort_by_digest_4_5
;
9543 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9550 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9551 salt_type
= SALT_TYPE_EMBEDDED
;
9552 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9554 kern_type
= KERN_TYPE_LOTUS8
;
9555 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9556 parse_func
= lotus8_parse_hash
;
9557 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9558 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9565 case 9200: hash_type
= HASH_TYPE_SHA256
;
9566 salt_type
= SALT_TYPE_EMBEDDED
;
9567 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9568 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9569 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9570 dgst_size
= DGST_SIZE_4_32
;
9571 parse_func
= cisco8_parse_hash
;
9572 sort_by_digest
= sort_by_digest_4_32
;
9573 opti_type
= OPTI_TYPE_ZERO_BYTE
9574 | OPTI_TYPE_SLOW_HASH_SIMD
;
9581 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9582 salt_type
= SALT_TYPE_EMBEDDED
;
9583 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9584 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9585 kern_type
= KERN_TYPE_SCRYPT
;
9586 dgst_size
= DGST_SIZE_4_8
;
9587 parse_func
= cisco9_parse_hash
;
9588 sort_by_digest
= sort_by_digest_4_8
;
9589 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9596 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9597 salt_type
= SALT_TYPE_EMBEDDED
;
9598 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9599 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9600 kern_type
= KERN_TYPE_OFFICE2007
;
9601 dgst_size
= DGST_SIZE_4_4
;
9602 parse_func
= office2007_parse_hash
;
9603 sort_by_digest
= sort_by_digest_4_4
;
9604 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9611 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9612 salt_type
= SALT_TYPE_EMBEDDED
;
9613 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9614 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9615 kern_type
= KERN_TYPE_OFFICE2010
;
9616 dgst_size
= DGST_SIZE_4_4
;
9617 parse_func
= office2010_parse_hash
;
9618 sort_by_digest
= sort_by_digest_4_4
;
9619 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9626 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9627 salt_type
= SALT_TYPE_EMBEDDED
;
9628 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9629 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9630 kern_type
= KERN_TYPE_OFFICE2013
;
9631 dgst_size
= DGST_SIZE_4_4
;
9632 parse_func
= office2013_parse_hash
;
9633 sort_by_digest
= sort_by_digest_4_4
;
9634 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9641 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9642 salt_type
= SALT_TYPE_EMBEDDED
;
9643 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9645 | OPTS_TYPE_PT_ADD80
9646 | OPTS_TYPE_PT_UNICODE
;
9647 kern_type
= KERN_TYPE_OLDOFFICE01
;
9648 dgst_size
= DGST_SIZE_4_4
;
9649 parse_func
= oldoffice01_parse_hash
;
9650 sort_by_digest
= sort_by_digest_4_4
;
9651 opti_type
= OPTI_TYPE_ZERO_BYTE
9652 | OPTI_TYPE_PRECOMPUTE_INIT
9653 | OPTI_TYPE_NOT_ITERATED
;
9660 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9661 salt_type
= SALT_TYPE_EMBEDDED
;
9662 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9664 | OPTS_TYPE_PT_ADD80
;
9665 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9666 dgst_size
= DGST_SIZE_4_4
;
9667 parse_func
= oldoffice01cm1_parse_hash
;
9668 sort_by_digest
= sort_by_digest_4_4
;
9669 opti_type
= OPTI_TYPE_ZERO_BYTE
9670 | OPTI_TYPE_PRECOMPUTE_INIT
9671 | OPTI_TYPE_NOT_ITERATED
;
9678 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9679 salt_type
= SALT_TYPE_EMBEDDED
;
9680 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9682 | OPTS_TYPE_PT_ADD80
9683 | OPTS_TYPE_PT_UNICODE
9684 | OPTS_TYPE_PT_NEVERCRACK
;
9685 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9686 dgst_size
= DGST_SIZE_4_4
;
9687 parse_func
= oldoffice01cm2_parse_hash
;
9688 sort_by_digest
= sort_by_digest_4_4
;
9689 opti_type
= OPTI_TYPE_ZERO_BYTE
9690 | OPTI_TYPE_PRECOMPUTE_INIT
9691 | OPTI_TYPE_NOT_ITERATED
;
9698 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9699 salt_type
= SALT_TYPE_EMBEDDED
;
9700 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9701 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9702 | OPTS_TYPE_PT_ADD80
9703 | OPTS_TYPE_PT_UNICODE
;
9704 kern_type
= KERN_TYPE_OLDOFFICE34
;
9705 dgst_size
= DGST_SIZE_4_4
;
9706 parse_func
= oldoffice34_parse_hash
;
9707 sort_by_digest
= sort_by_digest_4_4
;
9708 opti_type
= OPTI_TYPE_ZERO_BYTE
9709 | OPTI_TYPE_PRECOMPUTE_INIT
9710 | OPTI_TYPE_NOT_ITERATED
;
9717 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9718 salt_type
= SALT_TYPE_EMBEDDED
;
9719 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9720 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9721 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9722 dgst_size
= DGST_SIZE_4_4
;
9723 parse_func
= oldoffice34cm1_parse_hash
;
9724 sort_by_digest
= sort_by_digest_4_4
;
9725 opti_type
= OPTI_TYPE_ZERO_BYTE
9726 | OPTI_TYPE_PRECOMPUTE_INIT
9727 | OPTI_TYPE_NOT_ITERATED
;
9734 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9735 salt_type
= SALT_TYPE_EMBEDDED
;
9736 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9737 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9738 | OPTS_TYPE_PT_ADD80
9739 | OPTS_TYPE_PT_UNICODE
9740 | OPTS_TYPE_PT_NEVERCRACK
;
9741 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9742 dgst_size
= DGST_SIZE_4_4
;
9743 parse_func
= oldoffice34cm2_parse_hash
;
9744 sort_by_digest
= sort_by_digest_4_4
;
9745 opti_type
= OPTI_TYPE_ZERO_BYTE
9746 | OPTI_TYPE_PRECOMPUTE_INIT
9747 | OPTI_TYPE_NOT_ITERATED
;
9754 case 9900: hash_type
= HASH_TYPE_MD5
;
9755 salt_type
= SALT_TYPE_NONE
;
9756 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9757 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9758 kern_type
= KERN_TYPE_RADMIN2
;
9759 dgst_size
= DGST_SIZE_4_4
;
9760 parse_func
= radmin2_parse_hash
;
9761 sort_by_digest
= sort_by_digest_4_4
;
9762 opti_type
= OPTI_TYPE_ZERO_BYTE
9763 | OPTI_TYPE_PRECOMPUTE_INIT
9764 | OPTI_TYPE_EARLY_SKIP
9765 | OPTI_TYPE_NOT_ITERATED
9766 | OPTI_TYPE_NOT_SALTED
;
9773 case 10000: hash_type
= HASH_TYPE_SHA256
;
9774 salt_type
= SALT_TYPE_EMBEDDED
;
9775 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9777 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9778 dgst_size
= DGST_SIZE_4_32
;
9779 parse_func
= djangopbkdf2_parse_hash
;
9780 sort_by_digest
= sort_by_digest_4_32
;
9781 opti_type
= OPTI_TYPE_ZERO_BYTE
9782 | OPTI_TYPE_SLOW_HASH_SIMD
;
9789 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9790 salt_type
= SALT_TYPE_EMBEDDED
;
9791 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9793 kern_type
= KERN_TYPE_SIPHASH
;
9794 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9795 parse_func
= siphash_parse_hash
;
9796 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9797 opti_type
= OPTI_TYPE_ZERO_BYTE
9798 | OPTI_TYPE_NOT_ITERATED
9799 | OPTI_TYPE_RAW_HASH
;
9806 case 10200: hash_type
= HASH_TYPE_MD5
;
9807 salt_type
= SALT_TYPE_EMBEDDED
;
9808 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9810 | OPTS_TYPE_ST_ADD80
9811 | OPTS_TYPE_ST_ADDBITS14
;
9812 kern_type
= KERN_TYPE_HMACMD5_PW
;
9813 dgst_size
= DGST_SIZE_4_4
;
9814 parse_func
= crammd5_parse_hash
;
9815 sort_by_digest
= sort_by_digest_4_4
;
9816 opti_type
= OPTI_TYPE_ZERO_BYTE
9817 | OPTI_TYPE_NOT_ITERATED
;
9824 case 10300: hash_type
= HASH_TYPE_SHA1
;
9825 salt_type
= SALT_TYPE_EMBEDDED
;
9826 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9827 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9828 kern_type
= KERN_TYPE_SAPH_SHA1
;
9829 dgst_size
= DGST_SIZE_4_5
;
9830 parse_func
= saph_sha1_parse_hash
;
9831 sort_by_digest
= sort_by_digest_4_5
;
9832 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9839 case 10400: 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_PDF11
;
9844 dgst_size
= DGST_SIZE_4_4
;
9845 parse_func
= pdf11_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 10410: 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_PDF11CM1
;
9860 dgst_size
= DGST_SIZE_4_4
;
9861 parse_func
= pdf11cm1_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 10420: hash_type
= HASH_TYPE_PDFU16
;
9872 salt_type
= SALT_TYPE_EMBEDDED
;
9873 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9874 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9875 kern_type
= KERN_TYPE_PDF11CM2
;
9876 dgst_size
= DGST_SIZE_4_4
;
9877 parse_func
= pdf11cm2_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 10500: hash_type
= HASH_TYPE_PDFU16
;
9888 salt_type
= SALT_TYPE_EMBEDDED
;
9889 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9890 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9891 kern_type
= KERN_TYPE_PDF14
;
9892 dgst_size
= DGST_SIZE_4_4
;
9893 parse_func
= pdf14_parse_hash
;
9894 sort_by_digest
= sort_by_digest_4_4
;
9895 opti_type
= OPTI_TYPE_ZERO_BYTE
9896 | OPTI_TYPE_NOT_ITERATED
;
9903 case 10600: hash_type
= HASH_TYPE_SHA256
;
9904 salt_type
= SALT_TYPE_EMBEDDED
;
9905 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9906 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9907 | OPTS_TYPE_ST_ADD80
9908 | OPTS_TYPE_ST_ADDBITS15
9909 | OPTS_TYPE_HASH_COPY
;
9910 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9911 dgst_size
= DGST_SIZE_4_8
;
9912 parse_func
= pdf17l3_parse_hash
;
9913 sort_by_digest
= sort_by_digest_4_8
;
9914 opti_type
= OPTI_TYPE_ZERO_BYTE
9915 | OPTI_TYPE_PRECOMPUTE_INIT
9916 | OPTI_TYPE_PRECOMPUTE_MERKLE
9917 | OPTI_TYPE_EARLY_SKIP
9918 | OPTI_TYPE_NOT_ITERATED
9919 | OPTI_TYPE_APPENDED_SALT
9920 | OPTI_TYPE_RAW_HASH
;
9927 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9928 salt_type
= SALT_TYPE_EMBEDDED
;
9929 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9931 | OPTS_TYPE_HASH_COPY
;
9932 kern_type
= KERN_TYPE_PDF17L8
;
9933 dgst_size
= DGST_SIZE_4_8
;
9934 parse_func
= pdf17l8_parse_hash
;
9935 sort_by_digest
= sort_by_digest_4_8
;
9936 opti_type
= OPTI_TYPE_ZERO_BYTE
9937 | OPTI_TYPE_NOT_ITERATED
;
9944 case 10800: hash_type
= HASH_TYPE_SHA384
;
9945 salt_type
= SALT_TYPE_NONE
;
9946 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9947 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9948 | OPTS_TYPE_PT_ADD80
9949 | OPTS_TYPE_PT_ADDBITS15
;
9950 kern_type
= KERN_TYPE_SHA384
;
9951 dgst_size
= DGST_SIZE_8_8
;
9952 parse_func
= sha384_parse_hash
;
9953 sort_by_digest
= sort_by_digest_8_8
;
9954 opti_type
= OPTI_TYPE_ZERO_BYTE
9955 | OPTI_TYPE_PRECOMPUTE_INIT
9956 | OPTI_TYPE_PRECOMPUTE_MERKLE
9957 | OPTI_TYPE_EARLY_SKIP
9958 | OPTI_TYPE_NOT_ITERATED
9959 | OPTI_TYPE_NOT_SALTED
9960 | OPTI_TYPE_USES_BITS_64
9961 | OPTI_TYPE_RAW_HASH
;
9968 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9969 salt_type
= SALT_TYPE_EMBEDDED
;
9970 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
9971 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9972 | OPTS_TYPE_ST_BASE64
9973 | OPTS_TYPE_HASH_COPY
;
9974 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9975 dgst_size
= DGST_SIZE_4_32
;
9976 parse_func
= pbkdf2_sha256_parse_hash
;
9977 sort_by_digest
= sort_by_digest_4_32
;
9978 opti_type
= OPTI_TYPE_ZERO_BYTE
9979 | OPTI_TYPE_SLOW_HASH_SIMD
;
9986 case 11000: hash_type
= HASH_TYPE_MD5
;
9987 salt_type
= SALT_TYPE_INTERN
;
9988 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
9989 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9990 | OPTS_TYPE_PT_ADD80
;
9991 kern_type
= KERN_TYPE_PRESTASHOP
;
9992 dgst_size
= DGST_SIZE_4_4
;
9993 parse_func
= prestashop_parse_hash
;
9994 sort_by_digest
= sort_by_digest_4_4
;
9995 opti_type
= OPTI_TYPE_ZERO_BYTE
9996 | OPTI_TYPE_PRECOMPUTE_INIT
9997 | OPTI_TYPE_NOT_ITERATED
9998 | OPTI_TYPE_PREPENDED_SALT
;
10005 case 11100: hash_type
= HASH_TYPE_MD5
;
10006 salt_type
= SALT_TYPE_EMBEDDED
;
10007 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10008 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10009 | OPTS_TYPE_ST_ADD80
;
10010 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
10011 dgst_size
= DGST_SIZE_4_4
;
10012 parse_func
= postgresql_auth_parse_hash
;
10013 sort_by_digest
= sort_by_digest_4_4
;
10014 opti_type
= OPTI_TYPE_ZERO_BYTE
10015 | OPTI_TYPE_PRECOMPUTE_INIT
10016 | OPTI_TYPE_PRECOMPUTE_MERKLE
10017 | OPTI_TYPE_EARLY_SKIP
;
10024 case 11200: hash_type
= HASH_TYPE_SHA1
;
10025 salt_type
= SALT_TYPE_EMBEDDED
;
10026 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10027 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10028 | OPTS_TYPE_PT_ADD80
10029 | OPTS_TYPE_ST_HEX
;
10030 kern_type
= KERN_TYPE_MYSQL_AUTH
;
10031 dgst_size
= DGST_SIZE_4_5
;
10032 parse_func
= mysql_auth_parse_hash
;
10033 sort_by_digest
= sort_by_digest_4_5
;
10034 opti_type
= OPTI_TYPE_ZERO_BYTE
10035 | OPTI_TYPE_EARLY_SKIP
;
10042 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
10043 salt_type
= SALT_TYPE_EMBEDDED
;
10044 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10045 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10047 | OPTS_TYPE_ST_ADD80
;
10048 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
10049 dgst_size
= DGST_SIZE_4_4
;
10050 parse_func
= bitcoin_wallet_parse_hash
;
10051 sort_by_digest
= sort_by_digest_4_4
;
10052 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10059 case 11400: hash_type
= HASH_TYPE_MD5
;
10060 salt_type
= SALT_TYPE_EMBEDDED
;
10061 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10062 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10063 | OPTS_TYPE_PT_ADD80
10064 | OPTS_TYPE_HASH_COPY
;
10065 kern_type
= KERN_TYPE_SIP_AUTH
;
10066 dgst_size
= DGST_SIZE_4_4
;
10067 parse_func
= sip_auth_parse_hash
;
10068 sort_by_digest
= sort_by_digest_4_4
;
10069 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10076 case 11500: hash_type
= HASH_TYPE_CRC32
;
10077 salt_type
= SALT_TYPE_INTERN
;
10078 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10079 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10080 | OPTS_TYPE_ST_GENERATE_LE
10081 | OPTS_TYPE_ST_HEX
;
10082 kern_type
= KERN_TYPE_CRC32
;
10083 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10084 parse_func
= crc32_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 11600: hash_type
= HASH_TYPE_AES
;
10094 salt_type
= SALT_TYPE_EMBEDDED
;
10095 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10096 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10097 | OPTS_TYPE_PT_NEVERCRACK
;
10098 kern_type
= KERN_TYPE_SEVEN_ZIP
;
10099 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
10100 parse_func
= seven_zip_parse_hash
;
10101 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
10102 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10109 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
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_256
;
10115 dgst_size
= DGST_SIZE_4_8
;
10116 parse_func
= gost2012sbog_256_parse_hash
;
10117 sort_by_digest
= sort_by_digest_4_8
;
10118 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10125 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
10126 salt_type
= SALT_TYPE_NONE
;
10127 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10129 | OPTS_TYPE_PT_ADD01
;
10130 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
10131 dgst_size
= DGST_SIZE_4_16
;
10132 parse_func
= gost2012sbog_512_parse_hash
;
10133 sort_by_digest
= sort_by_digest_4_16
;
10134 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10141 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
10142 salt_type
= SALT_TYPE_EMBEDDED
;
10143 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10144 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10145 | OPTS_TYPE_ST_BASE64
10146 | OPTS_TYPE_HASH_COPY
;
10147 kern_type
= KERN_TYPE_PBKDF2_MD5
;
10148 dgst_size
= DGST_SIZE_4_32
;
10149 parse_func
= pbkdf2_md5_parse_hash
;
10150 sort_by_digest
= sort_by_digest_4_32
;
10151 opti_type
= OPTI_TYPE_ZERO_BYTE
10152 | OPTI_TYPE_SLOW_HASH_SIMD
;
10159 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10160 salt_type
= SALT_TYPE_EMBEDDED
;
10161 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10162 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10163 | OPTS_TYPE_ST_BASE64
10164 | OPTS_TYPE_HASH_COPY
;
10165 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
10166 dgst_size
= DGST_SIZE_4_32
;
10167 parse_func
= pbkdf2_sha1_parse_hash
;
10168 sort_by_digest
= sort_by_digest_4_32
;
10169 opti_type
= OPTI_TYPE_ZERO_BYTE
10170 | OPTI_TYPE_SLOW_HASH_SIMD
;
10177 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
10178 salt_type
= SALT_TYPE_EMBEDDED
;
10179 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10180 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10181 | OPTS_TYPE_ST_BASE64
10182 | OPTS_TYPE_HASH_COPY
;
10183 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
10184 dgst_size
= DGST_SIZE_8_16
;
10185 parse_func
= pbkdf2_sha512_parse_hash
;
10186 sort_by_digest
= sort_by_digest_8_16
;
10187 opti_type
= OPTI_TYPE_ZERO_BYTE
10188 | OPTI_TYPE_USES_BITS_64
10189 | OPTI_TYPE_SLOW_HASH_SIMD
;
10196 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
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_ECRYPTFS
;
10201 dgst_size
= DGST_SIZE_8_8
;
10202 parse_func
= ecryptfs_parse_hash
;
10203 sort_by_digest
= sort_by_digest_8_8
;
10204 opti_type
= OPTI_TYPE_ZERO_BYTE
10205 | OPTI_TYPE_USES_BITS_64
;
10212 case 12300: hash_type
= HASH_TYPE_ORACLET
;
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_ORACLET
;
10217 dgst_size
= DGST_SIZE_8_16
;
10218 parse_func
= oraclet_parse_hash
;
10219 sort_by_digest
= sort_by_digest_8_16
;
10220 opti_type
= OPTI_TYPE_ZERO_BYTE
10221 | OPTI_TYPE_USES_BITS_64
;
10228 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
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_BSDICRYPT
;
10233 dgst_size
= DGST_SIZE_4_4
;
10234 parse_func
= bsdicrypt_parse_hash
;
10235 sort_by_digest
= sort_by_digest_4_4
;
10236 opti_type
= OPTI_TYPE_ZERO_BYTE
10237 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
10244 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
10245 salt_type
= SALT_TYPE_EMBEDDED
;
10246 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10247 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10248 kern_type
= KERN_TYPE_RAR3
;
10249 dgst_size
= DGST_SIZE_4_4
;
10250 parse_func
= rar3hp_parse_hash
;
10251 sort_by_digest
= sort_by_digest_4_4
;
10252 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10259 case 12600: hash_type
= HASH_TYPE_SHA256
;
10260 salt_type
= SALT_TYPE_INTERN
;
10261 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10262 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10263 | OPTS_TYPE_PT_ADD80
;
10264 kern_type
= KERN_TYPE_CF10
;
10265 dgst_size
= DGST_SIZE_4_8
;
10266 parse_func
= cf10_parse_hash
;
10267 sort_by_digest
= sort_by_digest_4_8
;
10268 opti_type
= OPTI_TYPE_ZERO_BYTE
10269 | OPTI_TYPE_PRECOMPUTE_INIT
10270 | OPTI_TYPE_EARLY_SKIP
10271 | OPTI_TYPE_NOT_ITERATED
;
10278 case 12700: hash_type
= HASH_TYPE_AES
;
10279 salt_type
= SALT_TYPE_EMBEDDED
;
10280 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10281 opts_type
= OPTS_TYPE_PT_GENERATE_LE
10282 | OPTS_TYPE_HASH_COPY
;
10283 kern_type
= KERN_TYPE_MYWALLET
;
10284 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
10285 parse_func
= mywallet_parse_hash
;
10286 sort_by_digest
= sort_by_digest_4_5
;
10287 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10294 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10295 salt_type
= SALT_TYPE_EMBEDDED
;
10296 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10297 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10298 kern_type
= KERN_TYPE_MS_DRSR
;
10299 dgst_size
= DGST_SIZE_4_8
;
10300 parse_func
= ms_drsr_parse_hash
;
10301 sort_by_digest
= sort_by_digest_4_8
;
10302 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10309 case 12900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10310 salt_type
= SALT_TYPE_EMBEDDED
;
10311 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10313 kern_type
= KERN_TYPE_ANDROIDFDE_SAMSUNG
;
10314 dgst_size
= DGST_SIZE_4_8
;
10315 parse_func
= androidfde_samsung_parse_hash
;
10316 sort_by_digest
= sort_by_digest_4_8
;
10317 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10324 case 13000: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
10325 salt_type
= SALT_TYPE_EMBEDDED
;
10326 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10327 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10328 kern_type
= KERN_TYPE_RAR5
;
10329 dgst_size
= DGST_SIZE_4_4
;
10330 parse_func
= rar5_parse_hash
;
10331 sort_by_digest
= sort_by_digest_4_4
;
10332 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10339 case 13100: hash_type
= HASH_TYPE_KRB5TGS
;
10340 salt_type
= SALT_TYPE_EMBEDDED
;
10341 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10342 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10343 kern_type
= KERN_TYPE_KRB5TGS
;
10344 dgst_size
= DGST_SIZE_4_4
;
10345 parse_func
= krb5tgs_parse_hash
;
10346 sort_by_digest
= sort_by_digest_4_4
;
10347 opti_type
= OPTI_TYPE_ZERO_BYTE
10348 | OPTI_TYPE_NOT_ITERATED
;
10355 case 13200: hash_type
= HASH_TYPE_AES
;
10356 salt_type
= SALT_TYPE_EMBEDDED
;
10357 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10358 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10359 kern_type
= KERN_TYPE_AXCRYPT
;
10360 dgst_size
= DGST_SIZE_4_4
;
10361 parse_func
= axcrypt_parse_hash
;
10362 sort_by_digest
= sort_by_digest_4_4
;
10363 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10370 case 13300: hash_type
= HASH_TYPE_SHA1
;
10371 salt_type
= SALT_TYPE_NONE
;
10372 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10373 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10374 | OPTS_TYPE_PT_ADD80
10375 | OPTS_TYPE_PT_ADDBITS15
;
10376 kern_type
= KERN_TYPE_SHA1_AXCRYPT
;
10377 dgst_size
= DGST_SIZE_4_5
;
10378 parse_func
= sha1axcrypt_parse_hash
;
10379 sort_by_digest
= sort_by_digest_4_5
;
10380 opti_type
= OPTI_TYPE_ZERO_BYTE
10381 | OPTI_TYPE_PRECOMPUTE_INIT
10382 | OPTI_TYPE_EARLY_SKIP
10383 | OPTI_TYPE_NOT_ITERATED
10384 | OPTI_TYPE_NOT_SALTED
;
10391 case 13400: hash_type
= HASH_TYPE_AES
;
10392 salt_type
= SALT_TYPE_EMBEDDED
;
10393 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10395 kern_type
= KERN_TYPE_KEEPASS
;
10396 dgst_size
= DGST_SIZE_4_4
;
10397 parse_func
= keepass_parse_hash
;
10398 sort_by_digest
= sort_by_digest_4_4
;
10399 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10406 case 13500: hash_type
= HASH_TYPE_SHA1
;
10407 salt_type
= SALT_TYPE_EMBEDDED
;
10408 attack_exec
= ATTACK_EXEC_INSIDE_KERNEL
;
10409 opts_type
= OPTS_TYPE_PT_GENERATE_BE
10410 | OPTS_TYPE_PT_UNICODE
10411 | OPTS_TYPE_PT_ADD80
;
10412 kern_type
= KERN_TYPE_PSTOKEN
;
10413 dgst_size
= DGST_SIZE_4_5
;
10414 parse_func
= pstoken_parse_hash
;
10415 sort_by_digest
= sort_by_digest_4_5
;
10416 opti_type
= OPTI_TYPE_ZERO_BYTE
10417 | OPTI_TYPE_PRECOMPUTE_INIT
10418 | OPTI_TYPE_EARLY_SKIP
10419 | OPTI_TYPE_NOT_ITERATED
10420 | OPTI_TYPE_PREPENDED_SALT
10421 | OPTI_TYPE_RAW_HASH
;
10428 case 13600: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
10429 salt_type
= SALT_TYPE_EMBEDDED
;
10430 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10431 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10432 kern_type
= KERN_TYPE_ZIP2
;
10433 dgst_size
= DGST_SIZE_4_4
;
10434 parse_func
= zip2_parse_hash
;
10435 sort_by_digest
= sort_by_digest_4_4
;
10436 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10443 case 13711: hash_type
= HASH_TYPE_RIPEMD160
;
10444 salt_type
= SALT_TYPE_EMBEDDED
;
10445 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10446 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10447 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10448 dgst_size
= DGST_SIZE_4_5
;
10449 parse_func
= veracrypt_parse_hash_655331
;
10450 sort_by_digest
= sort_by_digest_4_5
;
10451 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10458 case 13712: hash_type
= HASH_TYPE_RIPEMD160
;
10459 salt_type
= SALT_TYPE_EMBEDDED
;
10460 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10462 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10463 dgst_size
= DGST_SIZE_4_5
;
10464 parse_func
= veracrypt_parse_hash_655331
;
10465 sort_by_digest
= sort_by_digest_4_5
;
10466 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10473 case 13713: hash_type
= HASH_TYPE_RIPEMD160
;
10474 salt_type
= SALT_TYPE_EMBEDDED
;
10475 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10477 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10478 dgst_size
= DGST_SIZE_4_5
;
10479 parse_func
= veracrypt_parse_hash_655331
;
10480 sort_by_digest
= sort_by_digest_4_5
;
10481 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10488 case 13721: 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_XTS512
;
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 13722: 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_XTS1024
;
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 13723: hash_type
= HASH_TYPE_SHA512
;
10521 salt_type
= SALT_TYPE_EMBEDDED
;
10522 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10523 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10524 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
10525 dgst_size
= DGST_SIZE_8_8
;
10526 parse_func
= veracrypt_parse_hash_500000
;
10527 sort_by_digest
= sort_by_digest_8_8
;
10528 opti_type
= OPTI_TYPE_ZERO_BYTE
10529 | OPTI_TYPE_USES_BITS_64
;
10536 case 13731: hash_type
= HASH_TYPE_WHIRLPOOL
;
10537 salt_type
= SALT_TYPE_EMBEDDED
;
10538 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10540 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
10541 dgst_size
= DGST_SIZE_4_8
;
10542 parse_func
= veracrypt_parse_hash_500000
;
10543 sort_by_digest
= sort_by_digest_4_8
;
10544 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10551 case 13732: hash_type
= HASH_TYPE_WHIRLPOOL
;
10552 salt_type
= SALT_TYPE_EMBEDDED
;
10553 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10554 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10555 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
10556 dgst_size
= DGST_SIZE_4_8
;
10557 parse_func
= veracrypt_parse_hash_500000
;
10558 sort_by_digest
= sort_by_digest_4_8
;
10559 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10566 case 13733: hash_type
= HASH_TYPE_WHIRLPOOL
;
10567 salt_type
= SALT_TYPE_EMBEDDED
;
10568 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10569 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10570 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
10571 dgst_size
= DGST_SIZE_4_8
;
10572 parse_func
= veracrypt_parse_hash_500000
;
10573 sort_by_digest
= sort_by_digest_4_8
;
10574 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10581 case 13741: hash_type
= HASH_TYPE_RIPEMD160
;
10582 salt_type
= SALT_TYPE_EMBEDDED
;
10583 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10584 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10585 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
10586 dgst_size
= DGST_SIZE_4_5
;
10587 parse_func
= veracrypt_parse_hash_327661
;
10588 sort_by_digest
= sort_by_digest_4_5
;
10589 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10596 case 13742: hash_type
= HASH_TYPE_RIPEMD160
;
10597 salt_type
= SALT_TYPE_EMBEDDED
;
10598 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10599 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10600 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
10601 dgst_size
= DGST_SIZE_4_5
;
10602 parse_func
= veracrypt_parse_hash_327661
;
10603 sort_by_digest
= sort_by_digest_4_5
;
10604 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10611 case 13743: hash_type
= HASH_TYPE_RIPEMD160
;
10612 salt_type
= SALT_TYPE_EMBEDDED
;
10613 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10614 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
10615 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
10616 dgst_size
= DGST_SIZE_4_5
;
10617 parse_func
= veracrypt_parse_hash_327661
;
10618 sort_by_digest
= sort_by_digest_4_5
;
10619 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10626 case 13751: hash_type
= HASH_TYPE_SHA256
;
10627 salt_type
= SALT_TYPE_EMBEDDED
;
10628 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10629 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10630 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10631 dgst_size
= DGST_SIZE_4_8
;
10632 parse_func
= veracrypt_parse_hash_500000
;
10633 sort_by_digest
= sort_by_digest_4_8
;
10634 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10641 case 13752: hash_type
= HASH_TYPE_SHA256
;
10642 salt_type
= SALT_TYPE_EMBEDDED
;
10643 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10645 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10646 dgst_size
= DGST_SIZE_4_8
;
10647 parse_func
= veracrypt_parse_hash_500000
;
10648 sort_by_digest
= sort_by_digest_4_8
;
10649 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10656 case 13753: hash_type
= HASH_TYPE_SHA256
;
10657 salt_type
= SALT_TYPE_EMBEDDED
;
10658 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10660 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10661 dgst_size
= DGST_SIZE_4_8
;
10662 parse_func
= veracrypt_parse_hash_500000
;
10663 sort_by_digest
= sort_by_digest_4_8
;
10664 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10671 case 13761: hash_type
= HASH_TYPE_SHA256
;
10672 salt_type
= SALT_TYPE_EMBEDDED
;
10673 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10674 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10675 kern_type
= KERN_TYPE_VCSHA256_XTS512
;
10676 dgst_size
= DGST_SIZE_4_8
;
10677 parse_func
= veracrypt_parse_hash_200000
;
10678 sort_by_digest
= sort_by_digest_4_8
;
10679 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10686 case 13762: hash_type
= HASH_TYPE_SHA256
;
10687 salt_type
= SALT_TYPE_EMBEDDED
;
10688 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10689 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10690 kern_type
= KERN_TYPE_VCSHA256_XTS1024
;
10691 dgst_size
= DGST_SIZE_4_8
;
10692 parse_func
= veracrypt_parse_hash_200000
;
10693 sort_by_digest
= sort_by_digest_4_8
;
10694 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10701 case 13763: hash_type
= HASH_TYPE_SHA256
;
10702 salt_type
= SALT_TYPE_EMBEDDED
;
10703 attack_exec
= ATTACK_EXEC_OUTSIDE_KERNEL
;
10704 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
10705 kern_type
= KERN_TYPE_VCSHA256_XTS1536
;
10706 dgst_size
= DGST_SIZE_4_8
;
10707 parse_func
= veracrypt_parse_hash_200000
;
10708 sort_by_digest
= sort_by_digest_4_8
;
10709 opti_type
= OPTI_TYPE_ZERO_BYTE
;
10717 default: usage_mini_print (PROGNAME
); return (-1);
10724 data
.parse_func
= parse_func
;
10732 if (salt_type
== SALT_TYPE_INTERN
)
10734 opts_type
|= OPTS_TYPE_ST_HEX
;
10738 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
10744 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
10745 | (salt_type
== SALT_TYPE_EXTERN
)
10746 | (salt_type
== SALT_TYPE_EMBEDDED
)
10747 | (salt_type
== SALT_TYPE_VIRTUAL
));
10749 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
10751 data
.hash_type
= hash_type
;
10752 data
.attack_mode
= attack_mode
;
10753 data
.attack_kern
= attack_kern
;
10754 data
.attack_exec
= attack_exec
;
10755 data
.kern_type
= kern_type
;
10756 data
.opts_type
= opts_type
;
10757 data
.dgst_size
= dgst_size
;
10758 data
.salt_type
= salt_type
;
10759 data
.isSalted
= isSalted
;
10760 data
.sort_by_digest
= sort_by_digest
;
10761 data
.dgst_pos0
= dgst_pos0
;
10762 data
.dgst_pos1
= dgst_pos1
;
10763 data
.dgst_pos2
= dgst_pos2
;
10764 data
.dgst_pos3
= dgst_pos3
;
10770 case 2500: esalt_size
= sizeof (wpa_t
); break;
10771 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
10772 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
10773 case 5500: esalt_size
= sizeof (netntlm_t
); break;
10774 case 5600: esalt_size
= sizeof (netntlm_t
); break;
10775 case 6211: esalt_size
= sizeof (tc_t
); break;
10776 case 6212: esalt_size
= sizeof (tc_t
); break;
10777 case 6213: esalt_size
= sizeof (tc_t
); break;
10778 case 6221: esalt_size
= sizeof (tc_t
); break;
10779 case 6222: esalt_size
= sizeof (tc_t
); break;
10780 case 6223: esalt_size
= sizeof (tc_t
); break;
10781 case 6231: esalt_size
= sizeof (tc_t
); break;
10782 case 6232: esalt_size
= sizeof (tc_t
); break;
10783 case 6233: esalt_size
= sizeof (tc_t
); break;
10784 case 6241: esalt_size
= sizeof (tc_t
); break;
10785 case 6242: esalt_size
= sizeof (tc_t
); break;
10786 case 6243: esalt_size
= sizeof (tc_t
); break;
10787 case 6600: esalt_size
= sizeof (agilekey_t
); break;
10788 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10789 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10790 case 7300: esalt_size
= sizeof (rakp_t
); break;
10791 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
10792 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
10793 case 8800: esalt_size
= sizeof (androidfde_t
); break;
10794 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10795 case 9400: esalt_size
= sizeof (office2007_t
); break;
10796 case 9500: esalt_size
= sizeof (office2010_t
); break;
10797 case 9600: esalt_size
= sizeof (office2013_t
); break;
10798 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
10799 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
10800 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
10801 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
10802 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
10803 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
10804 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10805 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
10806 case 10400: esalt_size
= sizeof (pdf_t
); break;
10807 case 10410: esalt_size
= sizeof (pdf_t
); break;
10808 case 10420: esalt_size
= sizeof (pdf_t
); break;
10809 case 10500: esalt_size
= sizeof (pdf_t
); break;
10810 case 10600: esalt_size
= sizeof (pdf_t
); break;
10811 case 10700: esalt_size
= sizeof (pdf_t
); break;
10812 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
10813 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
10814 case 11400: esalt_size
= sizeof (sip_t
); break;
10815 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
10816 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
10817 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
10818 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
10819 case 13000: esalt_size
= sizeof (rar5_t
); break;
10820 case 13100: esalt_size
= sizeof (krb5tgs_t
); break;
10821 case 13400: esalt_size
= sizeof (keepass_t
); break;
10822 case 13500: esalt_size
= sizeof (pstoken_t
); break;
10823 case 13600: esalt_size
= sizeof (zip2_t
); break;
10824 case 13711: esalt_size
= sizeof (tc_t
); break;
10825 case 13712: esalt_size
= sizeof (tc_t
); break;
10826 case 13713: esalt_size
= sizeof (tc_t
); break;
10827 case 13721: esalt_size
= sizeof (tc_t
); break;
10828 case 13722: esalt_size
= sizeof (tc_t
); break;
10829 case 13723: esalt_size
= sizeof (tc_t
); break;
10830 case 13731: esalt_size
= sizeof (tc_t
); break;
10831 case 13732: esalt_size
= sizeof (tc_t
); break;
10832 case 13733: esalt_size
= sizeof (tc_t
); break;
10833 case 13741: esalt_size
= sizeof (tc_t
); break;
10834 case 13742: esalt_size
= sizeof (tc_t
); break;
10835 case 13743: esalt_size
= sizeof (tc_t
); break;
10836 case 13751: esalt_size
= sizeof (tc_t
); break;
10837 case 13752: esalt_size
= sizeof (tc_t
); break;
10838 case 13753: esalt_size
= sizeof (tc_t
); break;
10839 case 13761: esalt_size
= sizeof (tc_t
); break;
10840 case 13762: esalt_size
= sizeof (tc_t
); break;
10841 case 13763: esalt_size
= sizeof (tc_t
); break;
10844 data
.esalt_size
= esalt_size
;
10847 * choose dictionary parser
10850 if (hash_type
== HASH_TYPE_LM
)
10852 get_next_word_func
= get_next_word_lm
;
10854 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
10856 get_next_word_func
= get_next_word_uc
;
10860 get_next_word_func
= get_next_word_std
;
10867 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
10870 size_t dictstat_nmemb
= 0;
10874 uint dictstat_nmemb
= 0;
10877 char dictstat
[256] = { 0 };
10879 FILE *dictstat_fp
= NULL
;
10883 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s", profile_dir
, DICTSTAT_FILENAME
);
10885 dictstat_fp
= fopen (dictstat
, "rb");
10890 struct stat tmpstat
;
10892 fstat (fileno (dictstat_fp
), &tmpstat
);
10896 struct stat64 tmpstat
;
10898 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
10901 if (tmpstat
.st_mtime
< COMPTIME
)
10903 /* with v0.15 the format changed so we have to ensure user is using a good version
10904 since there is no version-header in the dictstat file */
10906 fclose (dictstat_fp
);
10912 while (!feof (dictstat_fp
))
10916 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
10918 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
10920 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
10922 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
10928 fclose (dictstat_fp
);
10937 char potfile
[256] = { 0 };
10939 if (potfile_path
== NULL
)
10941 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s", profile_dir
, POTFILE_FILENAME
);
10945 strncpy (potfile
, potfile_path
, sizeof (potfile
) - 1);
10948 data
.pot_fp
= NULL
;
10950 FILE *out_fp
= NULL
;
10951 FILE *pot_fp
= NULL
;
10953 if (show
== 1 || left
== 1)
10955 pot_fp
= fopen (potfile
, "rb");
10957 if (pot_fp
== NULL
)
10959 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10964 if (outfile
!= NULL
)
10966 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
10968 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
10982 if (potfile_disable
== 0)
10984 pot_fp
= fopen (potfile
, "ab");
10986 if (pot_fp
== NULL
)
10988 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10993 data
.pot_fp
= pot_fp
;
11000 uint pot_avail
= 0;
11002 if (show
== 1 || left
== 1)
11004 SUPPRESS_OUTPUT
= 1;
11006 pot_avail
= count_lines (pot_fp
);
11010 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
11012 uint pot_hashes_avail
= 0;
11016 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11018 while (!feof (pot_fp
))
11022 int line_len
= fgetl (pot_fp
, line_buf
);
11024 if (line_len
== 0) continue;
11026 char *plain_buf
= line_buf
+ line_len
;
11028 pot_t
*pot_ptr
= &pot
[pot_cnt
];
11030 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11032 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
11033 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
11035 if (pot_cnt
== pot_hashes_avail
)
11039 for (pos
= 0; pos
< INCR_POT
; pos
++)
11041 if ((pot_cnt
+ pos
) >= pot_avail
) break;
11043 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
11045 hash_t
*tmp_hash
= &tmp_pot
->hash
;
11047 tmp_hash
->digest
= mymalloc (dgst_size
);
11051 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11056 tmp_hash
->esalt
= mymalloc (esalt_size
);
11059 pot_hashes_avail
++;
11067 int iter
= MAX_CUT_TRIES
;
11071 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
11073 if (line_buf
[i
] == ':')
11081 if (data
.hash_mode
!= 2500)
11083 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
11087 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
11089 if (line_len
> max_salt_size
)
11091 parser_status
= PARSER_GLOBAL_LENGTH
;
11095 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
11097 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
11099 hashes_buf
->salt
->salt_len
= line_len
;
11101 parser_status
= PARSER_OK
;
11105 // if NOT parsed without error, we add the ":" to the plain
11107 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
11113 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
11115 if (parser_status
< PARSER_GLOBAL_ZERO
)
11117 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
11122 if (plain_len
>= 255) continue;
11124 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
11126 pot_ptr
->plain_len
= plain_len
;
11135 SUPPRESS_OUTPUT
= 0;
11137 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
11144 uint pw_min
= PW_MIN
;
11145 uint pw_max
= PW_MAX
;
11149 case 125: if (pw_max
> 32) pw_max
= 32;
11151 case 400: if (pw_max
> 40) pw_max
= 40;
11153 case 500: if (pw_max
> 16) pw_max
= 16;
11155 case 1500: if (pw_max
> 8) pw_max
= 8;
11157 case 1600: if (pw_max
> 16) pw_max
= 16;
11159 case 1800: if (pw_max
> 16) pw_max
= 16;
11161 case 2100: if (pw_max
> 16) pw_max
= 16;
11163 case 2500: if (pw_min
< 8) pw_min
= 8;
11165 case 3000: if (pw_max
> 7) pw_max
= 7;
11167 case 5200: if (pw_max
> 24) pw_max
= 24;
11169 case 5800: if (pw_max
> 16) pw_max
= 16;
11171 case 6300: if (pw_max
> 16) pw_max
= 16;
11173 case 7400: if (pw_max
> 16) pw_max
= 16;
11175 case 7500: if (pw_max
> 8) pw_max
= 8;
11177 case 7900: if (pw_max
> 48) pw_max
= 48;
11179 case 8500: if (pw_max
> 8) pw_max
= 8;
11181 case 8600: if (pw_max
> 16) pw_max
= 16;
11183 case 9710: pw_min
= 5;
11186 case 9810: pw_min
= 5;
11189 case 10410: pw_min
= 5;
11192 case 10300: if (pw_max
< 3) pw_min
= 3;
11193 if (pw_max
> 40) pw_max
= 40;
11195 case 10500: if (pw_max
< 3) pw_min
= 3;
11196 if (pw_max
> 40) pw_max
= 40;
11198 case 10700: if (pw_max
> 16) pw_max
= 16;
11200 case 11300: if (pw_max
> 40) pw_max
= 40;
11202 case 11600: if (pw_max
> 32) pw_max
= 32;
11204 case 12500: if (pw_max
> 20) pw_max
= 20;
11206 case 12800: if (pw_max
> 24) pw_max
= 24;
11210 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
11212 switch (attack_kern
)
11214 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11216 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
11222 * charsets : keep them together for more easy maintainnce
11225 cs_t mp_sys
[6] = { { { 0 }, 0 } };
11226 cs_t mp_usr
[4] = { { { 0 }, 0 } };
11228 mp_setup_sys (mp_sys
);
11230 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
11231 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
11232 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
11233 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
11236 * load hashes, part I: find input mode, count hashes
11239 uint hashlist_mode
= 0;
11240 uint hashlist_format
= HLFMT_HASHCAT
;
11242 uint hashes_avail
= 0;
11244 if (benchmark
== 0)
11248 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
11250 if ((hash_mode
== 2500) ||
11251 (hash_mode
== 5200) ||
11252 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
11253 ((hash_mode
>= 13700) && (hash_mode
<= 13799)) ||
11254 (hash_mode
== 9000))
11256 hashlist_mode
= HL_MODE_ARG
;
11258 char *hashfile
= myargv
[optind
];
11260 data
.hashfile
= hashfile
;
11262 logfile_top_var_string ("target", hashfile
);
11265 if (hashlist_mode
== HL_MODE_ARG
)
11267 if (hash_mode
== 2500)
11271 if (stat (data
.hashfile
, &st
) == -1)
11273 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
11278 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
11285 else if (hashlist_mode
== HL_MODE_FILE
)
11287 char *hashfile
= myargv
[optind
];
11289 data
.hashfile
= hashfile
;
11291 logfile_top_var_string ("target", hashfile
);
11295 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11297 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11302 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
11304 hashes_avail
= count_lines (fp
);
11308 if (hashes_avail
== 0)
11310 log_error ("ERROR: hashfile is empty or corrupt");
11317 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
11319 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
11321 log_error ("ERROR: remove not supported in native hashfile-format mode");
11333 hashlist_mode
= HL_MODE_ARG
;
11338 if (hash_mode
== 3000) hashes_avail
*= 2;
11340 data
.hashlist_mode
= hashlist_mode
;
11341 data
.hashlist_format
= hashlist_format
;
11343 logfile_top_uint (hashlist_mode
);
11344 logfile_top_uint (hashlist_format
);
11347 * load hashes, part II: allocate required memory, set pointers
11350 hash_t
*hashes_buf
= NULL
;
11351 void *digests_buf
= NULL
;
11352 salt_t
*salts_buf
= NULL
;
11353 void *esalts_buf
= NULL
;
11355 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
11357 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
11359 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11363 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11365 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
11367 hashes_buf
[hash_pos
].hash_info
= hash_info
;
11369 if (username
&& (remove
|| show
|| left
))
11371 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
11376 hash_info
->orighash
= (char *) mymalloc (256);
11383 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11387 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
11392 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11395 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
11397 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
11401 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
11405 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
11410 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
11415 * load hashes, part III: parse hashes or generate them if benchmark
11418 uint hashes_cnt
= 0;
11420 if (benchmark
== 0)
11424 // useless to read hash file for keyspace, cheat a little bit w/ optind
11426 else if (hashes_avail
== 0)
11429 else if (hashlist_mode
== HL_MODE_ARG
)
11431 char *input_buf
= myargv
[optind
];
11433 uint input_len
= strlen (input_buf
);
11435 logfile_top_var_string ("target", input_buf
);
11437 char *hash_buf
= NULL
;
11440 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
11442 bool hash_fmt_error
= 0;
11444 if (hash_len
< 1) hash_fmt_error
= 1;
11445 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11447 if (hash_fmt_error
)
11449 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11453 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11455 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11457 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11462 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
11465 int parser_status
= PARSER_OK
;
11467 if (hash_mode
== 2500)
11471 log_error ("ERROR: hccap file not specified");
11476 hashlist_mode
= HL_MODE_FILE
;
11478 data
.hashlist_mode
= hashlist_mode
;
11480 FILE *fp
= fopen (hash_buf
, "rb");
11484 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
11489 if (hashes_avail
< 1)
11491 log_error ("ERROR: hccap file is empty or corrupt");
11498 uint hccap_size
= sizeof (hccap_t
);
11500 char *in
= (char *) mymalloc (hccap_size
);
11504 int n
= fread (in
, hccap_size
, 1, fp
);
11508 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
11513 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
11515 if (parser_status
!= PARSER_OK
)
11517 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
11522 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
11524 if ((show
== 1) || (left
== 1))
11526 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
11528 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
11530 int cur_pos
= tmp_salt
->salt_len
;
11531 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11533 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
11535 // do the appending task
11537 snprintf (salt_ptr
+ cur_pos
,
11539 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
11551 wpa
->orig_mac2
[5]);
11553 // memset () the remaining part of the salt
11555 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
11556 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
11558 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
11560 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
11563 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
);
11564 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
);
11573 else if (hash_mode
== 3000)
11575 if (hash_len
== 32)
11577 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11579 hash_t
*lm_hash_left
= NULL
;
11581 if (parser_status
== PARSER_OK
)
11583 lm_hash_left
= &hashes_buf
[hashes_cnt
];
11589 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11592 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11594 hash_t
*lm_hash_right
= NULL
;
11596 if (parser_status
== PARSER_OK
)
11598 lm_hash_right
= &hashes_buf
[hashes_cnt
];
11604 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11609 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
11611 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
);
11612 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
);
11617 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11619 if (parser_status
== PARSER_OK
)
11621 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11622 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11625 if (parser_status
== PARSER_OK
)
11631 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11637 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11639 if (parser_status
== PARSER_OK
)
11641 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11642 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11645 if (parser_status
== PARSER_OK
)
11651 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
11656 else if (hashlist_mode
== HL_MODE_FILE
)
11658 char *hashfile
= data
.hashfile
;
11662 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
11664 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
11671 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
11677 int line_len
= fgetl (fp
, line_buf
);
11679 if (line_len
== 0) continue;
11681 char *hash_buf
= NULL
;
11684 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
11686 bool hash_fmt_error
= 0;
11688 if (hash_len
< 1) hash_fmt_error
= 1;
11689 if (hash_buf
== NULL
) hash_fmt_error
= 1;
11691 if (hash_fmt_error
)
11693 log_info ("WARNING: failed to parse hashes using the '%s' format", strhlfmt (hashlist_format
));
11700 char *user_buf
= NULL
;
11703 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
11705 if (remove
|| show
)
11707 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
11709 *user
= (user_t
*) mymalloc (sizeof (user_t
));
11711 user_t
*user_ptr
= *user
;
11713 if (user_buf
!= NULL
)
11715 user_ptr
->user_name
= mystrdup (user_buf
);
11719 user_ptr
->user_name
= mystrdup ("");
11722 user_ptr
->user_len
= user_len
;
11726 if (opts_type
& OPTS_TYPE_HASH_COPY
)
11728 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
11730 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
11735 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
11738 if (hash_mode
== 3000)
11740 if (hash_len
== 32)
11742 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
11744 if (parser_status
< PARSER_GLOBAL_ZERO
)
11746 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11751 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
11755 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
11757 if (parser_status
< PARSER_GLOBAL_ZERO
)
11759 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11764 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
11766 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_lm (pot
, pot_cnt
, line_buf
, line_len
, lm_hash_left
, lm_hash_right
, sort_by_pot
, out_fp
);
11773 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
);
11777 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11779 if (parser_status
< PARSER_GLOBAL_ZERO
)
11781 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11786 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);
11788 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11789 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11796 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
11798 if (parser_status
< PARSER_GLOBAL_ZERO
)
11800 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
11805 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);
11807 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11808 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
11818 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
11820 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
11827 hashes_buf
[0].salt
->salt_len
= 8;
11829 // special salt handling
11833 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
11834 hashes_buf
[0].salt
->salt_buf
[0] = 388; // pure magic
11836 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
11838 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
11840 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
11842 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
11844 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
11846 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
11848 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
11850 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
11852 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
11854 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
11855 hashes_buf
[0].salt
->scrypt_N
= 1024;
11856 hashes_buf
[0].salt
->scrypt_r
= 1;
11857 hashes_buf
[0].salt
->scrypt_p
= 1;
11859 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
11861 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
11862 hashes_buf
[0].salt
->scrypt_N
= 16384;
11863 hashes_buf
[0].salt
->scrypt_r
= 1;
11864 hashes_buf
[0].salt
->scrypt_p
= 1;
11866 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
11868 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
11870 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
11872 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
11874 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
11876 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
11878 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
11880 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
11882 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
11884 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
11886 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
11888 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
11890 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
11892 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
11894 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
11898 // special esalt handling
11902 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
11904 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11905 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11907 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
11908 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
11910 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11911 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11912 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11913 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11915 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
11916 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
11917 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
11918 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
11920 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
11922 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11923 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11924 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11926 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11927 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11928 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11930 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11931 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11932 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11934 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11935 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
11936 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
11938 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11939 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11940 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11942 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
11943 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
11944 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
11946 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
11947 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
11948 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
11950 case 13400: ((keepass_t
*) hashes_buf
[0].esalt
)->version
= 2;
11952 case 13500: ((pstoken_t
*) hashes_buf
[0].esalt
)->salt_len
= 113;
11954 case 13600: ((zip2_t
*) hashes_buf
[0].esalt
)->salt_len
= 16;
11955 ((zip2_t
*) hashes_buf
[0].esalt
)->data_len
= 32;
11956 ((zip2_t
*) hashes_buf
[0].esalt
)->mode
= 3;
11965 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
11967 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
11969 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
11971 case 6211: data
.hashfile
= mystrdup ("hashcat.tc");
11973 case 6212: data
.hashfile
= mystrdup ("hashcat.tc");
11975 case 6213: data
.hashfile
= mystrdup ("hashcat.tc");
11977 case 6221: data
.hashfile
= mystrdup ("hashcat.tc");
11979 case 6222: data
.hashfile
= mystrdup ("hashcat.tc");
11981 case 6223: data
.hashfile
= mystrdup ("hashcat.tc");
11983 case 6231: data
.hashfile
= mystrdup ("hashcat.tc");
11985 case 6232: data
.hashfile
= mystrdup ("hashcat.tc");
11987 case 6233: data
.hashfile
= mystrdup ("hashcat.tc");
11989 case 6241: data
.hashfile
= mystrdup ("hashcat.tc");
11991 case 6242: data
.hashfile
= mystrdup ("hashcat.tc");
11993 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
11995 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
11997 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
11999 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
12001 case 13711: data
.hashfile
= mystrdup ("hashcat.vc");
12003 case 13712: data
.hashfile
= mystrdup ("hashcat.vc");
12005 case 13713: data
.hashfile
= mystrdup ("hashcat.vc");
12007 case 13721: data
.hashfile
= mystrdup ("hashcat.vc");
12009 case 13722: data
.hashfile
= mystrdup ("hashcat.vc");
12011 case 13723: data
.hashfile
= mystrdup ("hashcat.vc");
12013 case 13731: data
.hashfile
= mystrdup ("hashcat.vc");
12015 case 13732: data
.hashfile
= mystrdup ("hashcat.vc");
12017 case 13733: data
.hashfile
= mystrdup ("hashcat.vc");
12019 case 13741: data
.hashfile
= mystrdup ("hashcat.vc");
12021 case 13742: data
.hashfile
= mystrdup ("hashcat.vc");
12023 case 13743: data
.hashfile
= mystrdup ("hashcat.vc");
12025 case 13751: data
.hashfile
= mystrdup ("hashcat.vc");
12027 case 13752: data
.hashfile
= mystrdup ("hashcat.vc");
12029 case 13753: data
.hashfile
= mystrdup ("hashcat.vc");
12031 case 13761: data
.hashfile
= mystrdup ("hashcat.vc");
12033 case 13762: data
.hashfile
= mystrdup ("hashcat.vc");
12035 case 13763: data
.hashfile
= mystrdup ("hashcat.vc");
12039 // set default iterations
12043 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
12045 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12047 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12049 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12051 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
12053 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
12055 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
12057 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
12059 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
12061 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
12063 case 6211: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12065 case 6212: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12067 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
12069 case 6221: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12071 case 6222: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12073 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12075 case 6231: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12077 case 6232: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12079 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12081 case 6241: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12083 case 6242: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12085 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
12087 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
12089 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
12091 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
12093 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
12095 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
12097 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
12099 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
12101 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
12103 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
12105 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
12107 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
12109 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
12111 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
12113 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
12115 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
12117 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
12119 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
12121 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
12123 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
12125 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
12127 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
12129 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
12131 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
12133 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
12135 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
12137 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
12139 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
12141 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
12143 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
12145 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
12147 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
12149 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
12151 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
12153 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
12155 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
12157 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
12159 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
12161 case 12900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE_SAMSUNG
- 1;
12163 case 13000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR5
- 1;
12165 case 13200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AXCRYPT
;
12167 case 13400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_KEEPASS
;
12169 case 13600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ZIP2
;
12171 case 13711: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12173 case 13712: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12175 case 13713: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_655331
;
12177 case 13721: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12179 case 13722: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12181 case 13723: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12183 case 13731: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12185 case 13732: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12187 case 13733: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12189 case 13741: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12191 case 13742: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12193 case 13743: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_327661
;
12195 case 13751: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12197 case 13752: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12199 case 13753: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_500000
;
12201 case 13761: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12203 case 13762: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12205 case 13763: hashes_buf
[0].salt
->salt_iter
= ROUNDS_VERACRYPT_200000
;
12212 if (show
== 1 || left
== 1)
12214 for (uint i
= 0; i
< pot_cnt
; i
++)
12216 pot_t
*pot_ptr
= &pot
[i
];
12218 hash_t
*hashes_buf
= &pot_ptr
->hash
;
12220 local_free (hashes_buf
->digest
);
12224 local_free (hashes_buf
->salt
);
12230 if (data
.quiet
== 0) log_info_nn ("");
12237 if (hashes_cnt
== 0)
12239 log_error ("ERROR: No hashes loaded");
12246 * Sanity check for hashfile vs outfile (should not point to the same physical file)
12249 if (data
.outfile
!= NULL
)
12251 if (data
.hashfile
!= NULL
)
12254 struct stat tmpstat_outfile
;
12255 struct stat tmpstat_hashfile
;
12259 struct stat64 tmpstat_outfile
;
12260 struct stat64 tmpstat_hashfile
;
12263 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
12265 if (tmp_outfile_fp
)
12268 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12272 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
12275 fclose (tmp_outfile_fp
);
12278 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
12280 if (tmp_hashfile_fp
)
12283 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12287 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
12290 fclose (tmp_hashfile_fp
);
12293 if (tmp_outfile_fp
&& tmp_outfile_fp
)
12295 tmpstat_outfile
.st_mode
= 0;
12296 tmpstat_outfile
.st_nlink
= 0;
12297 tmpstat_outfile
.st_uid
= 0;
12298 tmpstat_outfile
.st_gid
= 0;
12299 tmpstat_outfile
.st_rdev
= 0;
12300 tmpstat_outfile
.st_atime
= 0;
12302 tmpstat_hashfile
.st_mode
= 0;
12303 tmpstat_hashfile
.st_nlink
= 0;
12304 tmpstat_hashfile
.st_uid
= 0;
12305 tmpstat_hashfile
.st_gid
= 0;
12306 tmpstat_hashfile
.st_rdev
= 0;
12307 tmpstat_hashfile
.st_atime
= 0;
12310 tmpstat_outfile
.st_blksize
= 0;
12311 tmpstat_outfile
.st_blocks
= 0;
12313 tmpstat_hashfile
.st_blksize
= 0;
12314 tmpstat_hashfile
.st_blocks
= 0;
12318 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
12320 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12327 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
12329 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
12339 * Remove duplicates
12342 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
12346 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12350 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12353 uint hashes_cnt_orig
= hashes_cnt
;
12357 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
12361 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
12363 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12368 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
12371 if (hashes_pos
> hashes_cnt
)
12373 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
12383 uint potfile_remove_cracks
= 0;
12385 if (potfile_disable
== 0)
12389 hash_buf
.digest
= mymalloc (dgst_size
);
12390 hash_buf
.salt
= NULL
;
12391 hash_buf
.esalt
= NULL
;
12392 hash_buf
.hash_info
= NULL
;
12393 hash_buf
.cracked
= 0;
12397 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
12402 hash_buf
.esalt
= mymalloc (esalt_size
);
12405 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
12407 // no solution for these special hash types (for instane because they use hashfile in output etc)
12408 if ((hash_mode
!= 5200) &&
12409 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
12410 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
12411 (hash_mode
!= 9000))
12413 FILE *fp
= fopen (potfile
, "rb");
12417 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
12419 // to be safe work with a copy (because of line_len loop, i etc)
12420 // moved up here because it's easier to handle continue case
12423 char *line_buf_cpy
= (char *) mymalloc (HCBUFSIZ
);
12427 char *ptr
= fgets (line_buf
, HCBUFSIZ
- 1, fp
);
12429 if (ptr
== NULL
) break;
12431 int line_len
= strlen (line_buf
);
12433 if (line_len
== 0) continue;
12435 int iter
= MAX_CUT_TRIES
;
12437 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
12439 if (line_buf
[i
] != ':') continue;
12443 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
12446 hash_t
*found
= NULL
;
12448 if (hash_mode
== 6800)
12450 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12452 // manipulate salt_buf
12453 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
12455 hash_buf
.salt
->salt_len
= i
;
12457 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
12460 else if (hash_mode
== 2500)
12462 if (i
< 64) // 64 = 16 * uint in salt_buf[]
12464 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
12465 // manipulate salt_buf
12467 memcpy (line_buf_cpy
, line_buf
, i
);
12469 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
12471 if (mac2_pos
== NULL
) continue;
12476 if (strlen (mac2_pos
) != 12) continue;
12478 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
12480 if (mac1_pos
== NULL
) continue;
12485 if (strlen (mac1_pos
) != 12) continue;
12487 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
12489 // here we need the ESSID
12490 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
12492 hash_buf
.salt
->salt_len
= essid_length
;
12494 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
12498 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
12500 // compare hex string(s) vs binary MAC address(es)
12502 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12504 if (wpa
->orig_mac1
[i
] != hex_to_u8 ((const u8
*) &mac1_pos
[j
]))
12513 if (!found
) continue;
12515 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
12517 if (wpa
->orig_mac2
[i
] != hex_to_u8 ((const u8
*) &mac2_pos
[j
]))
12529 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
12531 if (parser_status
== PARSER_OK
)
12535 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
12539 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
12544 if (found
== NULL
) continue;
12546 if (!found
->cracked
) potfile_remove_cracks
++;
12548 found
->cracked
= 1;
12556 myfree (line_buf_cpy
);
12566 local_free (hash_buf
.esalt
);
12571 local_free (hash_buf
.salt
);
12574 local_free (hash_buf
.digest
);
12578 * Now generate all the buffers required for later
12581 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
12583 salt_t
*salts_buf_new
= NULL
;
12584 void *esalts_buf_new
= NULL
;
12588 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
12592 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
12597 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
12600 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
12602 uint digests_cnt
= hashes_cnt
;
12603 uint digests_done
= 0;
12605 size_t size_digests
= digests_cnt
* dgst_size
;
12606 size_t size_shown
= digests_cnt
* sizeof (uint
);
12608 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
12609 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
12611 uint salts_cnt
= 0;
12612 uint salts_done
= 0;
12614 hashinfo_t
**hash_info
= NULL
;
12616 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12618 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
12620 if (username
&& (remove
|| show
))
12624 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
12626 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
12628 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
12633 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
12638 // copied from inner loop
12640 salt_buf
= &salts_buf_new
[salts_cnt
];
12642 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
12646 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
12649 salt_buf
->digests_cnt
= 0;
12650 salt_buf
->digests_done
= 0;
12651 salt_buf
->digests_offset
= 0;
12656 if (hashes_buf
[0].cracked
== 1)
12658 digests_shown
[0] = 1;
12662 salt_buf
->digests_done
++;
12665 salt_buf
->digests_cnt
++;
12667 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
12669 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12671 hash_info
[0] = hashes_buf
[0].hash_info
;
12674 // copy from inner loop
12676 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
12680 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
12682 salt_buf
= &salts_buf_new
[salts_cnt
];
12684 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
12688 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
12691 salt_buf
->digests_cnt
= 0;
12692 salt_buf
->digests_done
= 0;
12693 salt_buf
->digests_offset
= hashes_pos
;
12699 if (hashes_buf
[hashes_pos
].cracked
== 1)
12701 digests_shown
[hashes_pos
] = 1;
12705 salt_buf
->digests_done
++;
12708 salt_buf
->digests_cnt
++;
12710 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
12712 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
12714 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
12718 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
12720 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
12722 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
12724 salts_shown
[salt_pos
] = 1;
12729 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
12732 local_free (digests_buf
);
12733 local_free (salts_buf
);
12734 local_free (esalts_buf
);
12736 digests_buf
= digests_buf_new
;
12737 salts_buf
= salts_buf_new
;
12738 esalts_buf
= esalts_buf_new
;
12740 local_free (hashes_buf
);
12743 * special modification not set from parser
12748 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12749 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12750 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12751 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12752 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12753 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12754 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12755 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12756 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12757 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12758 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12759 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12760 case 13711: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12761 case 13712: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12762 case 13713: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12763 case 13721: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12764 case 13722: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12765 case 13723: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12766 case 13731: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12767 case 13732: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12768 case 13733: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12769 case 13741: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12770 case 13742: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12771 case 13743: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12772 case 13751: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12773 case 13752: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12774 case 13753: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12775 case 13761: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
12776 case 13762: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
12777 case 13763: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
12780 if (truecrypt_keyfiles
)
12782 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12784 char *keyfiles
= strdup (truecrypt_keyfiles
);
12786 char *keyfile
= strtok (keyfiles
, ",");
12790 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12792 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12797 if (veracrypt_keyfiles
)
12799 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
12801 char *keyfiles
= strdup (veracrypt_keyfiles
);
12803 char *keyfile
= strtok (keyfiles
, ",");
12807 truecrypt_crc32 (keyfile
, (u8
*) keyfile_buf
);
12809 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
12814 data
.digests_cnt
= digests_cnt
;
12815 data
.digests_done
= digests_done
;
12816 data
.digests_buf
= digests_buf
;
12817 data
.digests_shown
= digests_shown
;
12818 data
.digests_shown_tmp
= digests_shown_tmp
;
12820 data
.salts_cnt
= salts_cnt
;
12821 data
.salts_done
= salts_done
;
12822 data
.salts_buf
= salts_buf
;
12823 data
.salts_shown
= salts_shown
;
12825 data
.esalts_buf
= esalts_buf
;
12826 data
.hash_info
= hash_info
;
12829 * Automatic Optimizers
12832 if (salts_cnt
== 1)
12833 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
12835 if (digests_cnt
== 1)
12836 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
12838 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
12839 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
12841 if (attack_mode
== ATTACK_MODE_BF
)
12842 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
12844 data
.opti_type
= opti_type
;
12846 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
12848 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
12850 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
12852 if (opts_type
& OPTS_TYPE_ST_ADD80
)
12854 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
12855 opts_type
|= OPTS_TYPE_PT_ADD80
;
12858 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
12860 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
12861 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
12864 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
12866 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
12867 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
12874 * Some algorithm, like descrypt, can benefit from JIT compilation
12877 int force_jit_compilation
= -1;
12879 if (hash_mode
== 8900)
12881 force_jit_compilation
= 8900;
12883 else if (hash_mode
== 9300)
12885 force_jit_compilation
= 8900;
12887 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
12889 force_jit_compilation
= 1500;
12893 * generate bitmap tables
12896 const uint bitmap_shift1
= 5;
12897 const uint bitmap_shift2
= 13;
12899 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12901 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12902 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12903 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12904 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12905 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12906 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12907 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12908 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12915 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12917 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12919 bitmap_nums
= 1 << bitmap_bits
;
12921 bitmap_mask
= bitmap_nums
- 1;
12923 bitmap_size
= bitmap_nums
* sizeof (uint
);
12925 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12927 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;
12928 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;
12933 bitmap_nums
= 1 << bitmap_bits
;
12935 bitmap_mask
= bitmap_nums
- 1;
12937 bitmap_size
= bitmap_nums
* sizeof (uint
);
12939 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);
12940 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);
12943 * prepare quick rule
12946 data
.rule_buf_l
= rule_buf_l
;
12947 data
.rule_buf_r
= rule_buf_r
;
12949 int rule_len_l
= (int) strlen (rule_buf_l
);
12950 int rule_len_r
= (int) strlen (rule_buf_r
);
12952 data
.rule_len_l
= rule_len_l
;
12953 data
.rule_len_r
= rule_len_r
;
12959 uint
*all_kernel_rules_cnt
= NULL
;
12961 kernel_rule_t
**all_kernel_rules_buf
= NULL
;
12965 all_kernel_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12967 all_kernel_rules_buf
= (kernel_rule_t
**) mycalloc (rp_files_cnt
, sizeof (kernel_rule_t
*));
12970 char *rule_buf
= (char *) mymalloc (HCBUFSIZ
);
12974 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12976 uint kernel_rules_avail
= 0;
12978 uint kernel_rules_cnt
= 0;
12980 kernel_rule_t
*kernel_rules_buf
= NULL
;
12982 char *rp_file
= rp_files
[i
];
12984 char in
[BLOCK_SIZE
] = { 0 };
12985 char out
[BLOCK_SIZE
] = { 0 };
12989 uint rule_line
= 0;
12991 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12993 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
13000 memset (rule_buf
, 0, HCBUFSIZ
);
13002 rule_len
= fgetl (fp
, rule_buf
);
13006 if (rule_len
== 0) continue;
13008 if (rule_buf
[0] == '#') continue;
13010 if (kernel_rules_avail
== kernel_rules_cnt
)
13012 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13014 kernel_rules_avail
+= INCR_RULES
;
13017 memset (in
, 0, BLOCK_SIZE
);
13018 memset (out
, 0, BLOCK_SIZE
);
13020 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
13024 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13029 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1)
13031 log_info ("WARNING: Cannot convert rule for use on device in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
13033 memset (&kernel_rules_buf
[kernel_rules_cnt
], 0, sizeof (kernel_rule_t
)); // needs to be cleared otherwise we could have some remaining data
13039 if (rulefind (&kernel_rules_buf[kernel_rules_cnt], kernel_rules_buf, kernel_rules_cnt, sizeof (kernel_rule_t), sort_by_kernel_rule))
13041 log_info ("Duplicate rule for use on device in file %s in line %u: %s", rp_file, rule_line, rule_buf);
13047 kernel_rules_cnt
++;
13052 all_kernel_rules_cnt
[i
] = kernel_rules_cnt
;
13054 all_kernel_rules_buf
[i
] = kernel_rules_buf
;
13058 * merge rules or automatic rule generator
13061 uint kernel_rules_cnt
= 0;
13063 kernel_rule_t
*kernel_rules_buf
= NULL
;
13065 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13069 kernel_rules_cnt
= 1;
13071 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
13073 repeats
[0] = kernel_rules_cnt
;
13075 for (uint i
= 0; i
< rp_files_cnt
; i
++)
13077 kernel_rules_cnt
*= all_kernel_rules_cnt
[i
];
13079 repeats
[i
+ 1] = kernel_rules_cnt
;
13082 kernel_rules_buf
= (kernel_rule_t
*) mycalloc (kernel_rules_cnt
, sizeof (kernel_rule_t
));
13084 memset (kernel_rules_buf
, 0, kernel_rules_cnt
* sizeof (kernel_rule_t
));
13086 for (uint i
= 0; i
< kernel_rules_cnt
; i
++)
13090 kernel_rule_t
*out
= &kernel_rules_buf
[i
];
13092 for (uint j
= 0; j
< rp_files_cnt
; j
++)
13094 uint in_off
= (i
/ repeats
[j
]) % all_kernel_rules_cnt
[j
];
13097 kernel_rule_t
*in
= &all_kernel_rules_buf
[j
][in_off
];
13099 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
13101 if (out_pos
== RULES_MAX
- 1)
13103 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
13108 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
13113 local_free (repeats
);
13117 uint kernel_rules_avail
= 0;
13119 while (kernel_rules_cnt
< rp_gen
)
13121 if (kernel_rules_avail
== kernel_rules_cnt
)
13123 kernel_rules_buf
= (kernel_rule_t
*) myrealloc (kernel_rules_buf
, kernel_rules_avail
* sizeof (kernel_rule_t
), INCR_RULES
* sizeof (kernel_rule_t
));
13125 kernel_rules_avail
+= INCR_RULES
;
13128 memset (rule_buf
, 0, HCBUFSIZ
);
13130 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
13132 if (cpu_rule_to_kernel_rule (rule_buf
, rule_len
, &kernel_rules_buf
[kernel_rules_cnt
]) == -1) continue;
13134 kernel_rules_cnt
++;
13142 * generate NOP rules
13145 if (kernel_rules_cnt
== 0)
13147 kernel_rules_buf
= (kernel_rule_t
*) mymalloc (sizeof (kernel_rule_t
));
13149 kernel_rules_buf
[kernel_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
13151 kernel_rules_cnt
++;
13154 data
.kernel_rules_cnt
= kernel_rules_cnt
;
13155 data
.kernel_rules_buf
= kernel_rules_buf
;
13158 * OpenCL platforms: detect
13161 cl_platform_id platforms
[CL_PLATFORMS_MAX
] = { 0 };
13162 cl_device_id platform_devices
[DEVICES_MAX
] = { 0 };
13164 cl_uint platforms_cnt
= 0;
13165 cl_uint platform_devices_cnt
= 0;
13169 hc_clGetPlatformIDs (data
.ocl
, CL_PLATFORMS_MAX
, platforms
, &platforms_cnt
);
13171 if (platforms_cnt
== 0)
13174 log_info ("ATTENTION! No OpenCL compatible platform found");
13176 log_info ("You're probably missing the OpenCL runtime installation");
13177 log_info (" AMD users require AMD drivers 14.9 or later (recommended 15.12 or later)");
13178 log_info (" Intel users require Intel OpenCL Runtime 14.2 or later (recommended 15.1 or later)");
13179 log_info (" NVidia users require NVidia drivers 346.59 or later (recommended 361.x or later)");
13185 if (opencl_platforms_filter
!= (uint
) -1)
13187 uint platform_cnt_mask
= ~(((uint
) -1 >> platforms_cnt
) << platforms_cnt
);
13189 if (opencl_platforms_filter
> platform_cnt_mask
)
13191 log_error ("ERROR: The platform selected by the --opencl-platforms parameter is larger than the number of available platforms (%d)", platforms_cnt
);
13199 * OpenCL platforms: For each platform check if we need to unset features that we can not use, eg: temp_retain
13202 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13204 cl_platform_id platform
= platforms
[platform_id
];
13206 char platform_vendor
[INFOSZ
] = { 0 };
13208 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13211 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13212 if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13214 // make sure that we do not directly control the fan for NVidia
13216 gpu_temp_retain
= 0;
13218 data
.gpu_temp_retain
= gpu_temp_retain
;
13220 #endif // HAVE_NVML || HAVE_NVAPI
13225 * OpenCL device types:
13226 * 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.
13227 * In such a case, automatically enable CPU device type support, since it's disabled by default.
13230 if (opencl_device_types
== NULL
)
13232 cl_device_type device_types_all
= 0;
13234 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13236 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13238 cl_platform_id platform
= platforms
[platform_id
];
13240 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13242 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13244 cl_device_id device
= platform_devices
[platform_devices_id
];
13246 cl_device_type device_type
;
13248 hc_clGetDeviceInfo (data
.ocl
, device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13250 device_types_all
|= device_type
;
13254 if ((device_types_all
& (CL_DEVICE_TYPE_GPU
| CL_DEVICE_TYPE_ACCELERATOR
)) == 0)
13256 device_types_filter
|= CL_DEVICE_TYPE_CPU
;
13261 * OpenCL devices: simply push all devices from all platforms into the same device array
13264 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (DEVICES_MAX
, sizeof (hc_device_param_t
));
13266 data
.devices_param
= devices_param
;
13268 uint devices_cnt
= 0;
13270 uint devices_active
= 0;
13272 for (uint platform_id
= 0; platform_id
< platforms_cnt
; platform_id
++)
13274 if ((opencl_platforms_filter
& (1 << platform_id
)) == 0) continue;
13276 cl_platform_id platform
= platforms
[platform_id
];
13278 hc_clGetDeviceIDs (data
.ocl
, platform
, CL_DEVICE_TYPE_ALL
, DEVICES_MAX
, platform_devices
, &platform_devices_cnt
);
13280 char platform_vendor
[INFOSZ
] = { 0 };
13282 hc_clGetPlatformInfo (data
.ocl
, platform
, CL_PLATFORM_VENDOR
, sizeof (platform_vendor
), platform_vendor
, NULL
);
13284 // find our own platform vendor because pocl and mesa are pushing original vendor_id through opencl
13285 // this causes trouble with vendor id based macros
13286 // we'll assign generic to those without special optimization available
13288 cl_uint platform_vendor_id
= 0;
13290 if (strcmp (platform_vendor
, CL_VENDOR_AMD
) == 0)
13292 platform_vendor_id
= VENDOR_ID_AMD
;
13294 else if (strcmp (platform_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13296 platform_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13298 else if (strcmp (platform_vendor
, CL_VENDOR_APPLE
) == 0)
13300 platform_vendor_id
= VENDOR_ID_APPLE
;
13302 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13304 platform_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13306 else if (strcmp (platform_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13308 platform_vendor_id
= VENDOR_ID_INTEL_SDK
;
13310 else if (strcmp (platform_vendor
, CL_VENDOR_MESA
) == 0)
13312 platform_vendor_id
= VENDOR_ID_MESA
;
13314 else if (strcmp (platform_vendor
, CL_VENDOR_NV
) == 0)
13316 platform_vendor_id
= VENDOR_ID_NV
;
13318 else if (strcmp (platform_vendor
, CL_VENDOR_POCL
) == 0)
13320 platform_vendor_id
= VENDOR_ID_POCL
;
13324 platform_vendor_id
= VENDOR_ID_GENERIC
;
13327 for (uint platform_devices_id
= 0; platform_devices_id
< platform_devices_cnt
; platform_devices_id
++)
13329 size_t param_value_size
= 0;
13331 const uint device_id
= devices_cnt
;
13333 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
13335 device_param
->platform_vendor_id
= platform_vendor_id
;
13337 device_param
->device
= platform_devices
[platform_devices_id
];
13339 device_param
->device_id
= device_id
;
13341 device_param
->platform_devices_id
= platform_devices_id
;
13345 cl_device_type device_type
;
13347 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_TYPE
, sizeof (device_type
), &device_type
, NULL
);
13349 device_type
&= ~CL_DEVICE_TYPE_DEFAULT
;
13351 device_param
->device_type
= device_type
;
13355 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, 0, NULL
, ¶m_value_size
);
13357 char *device_name
= (char *) mymalloc (param_value_size
);
13359 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NAME
, param_value_size
, device_name
, NULL
);
13361 device_param
->device_name
= device_name
;
13365 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, 0, NULL
, ¶m_value_size
);
13367 char *device_vendor
= (char *) mymalloc (param_value_size
);
13369 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VENDOR
, param_value_size
, device_vendor
, NULL
);
13371 device_param
->device_vendor
= device_vendor
;
13373 cl_uint device_vendor_id
= 0;
13375 if (strcmp (device_vendor
, CL_VENDOR_AMD
) == 0)
13377 device_vendor_id
= VENDOR_ID_AMD
;
13379 else if (strcmp (device_vendor
, CL_VENDOR_AMD_USE_INTEL
) == 0)
13381 device_vendor_id
= VENDOR_ID_AMD_USE_INTEL
;
13383 else if (strcmp (device_vendor
, CL_VENDOR_APPLE
) == 0)
13385 device_vendor_id
= VENDOR_ID_APPLE
;
13387 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_BEIGNET
) == 0)
13389 device_vendor_id
= VENDOR_ID_INTEL_BEIGNET
;
13391 else if (strcmp (device_vendor
, CL_VENDOR_INTEL_SDK
) == 0)
13393 device_vendor_id
= VENDOR_ID_INTEL_SDK
;
13395 else if (strcmp (device_vendor
, CL_VENDOR_MESA
) == 0)
13397 device_vendor_id
= VENDOR_ID_MESA
;
13399 else if (strcmp (device_vendor
, CL_VENDOR_NV
) == 0)
13401 device_vendor_id
= VENDOR_ID_NV
;
13403 else if (strcmp (device_vendor
, CL_VENDOR_POCL
) == 0)
13405 device_vendor_id
= VENDOR_ID_POCL
;
13409 device_vendor_id
= VENDOR_ID_GENERIC
;
13412 device_param
->device_vendor_id
= device_vendor_id
;
13416 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13420 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, 0, NULL
, ¶m_value_size
);
13422 char *device_version
= (char *) mymalloc (param_value_size
);
13424 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_VERSION
, param_value_size
, device_version
, NULL
);
13426 device_param
->device_version
= device_version
;
13428 // device_opencl_version
13430 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, 0, NULL
, ¶m_value_size
);
13432 char *device_opencl_version
= (char *) mymalloc (param_value_size
);
13434 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_OPENCL_C_VERSION
, param_value_size
, device_opencl_version
, NULL
);
13436 device_param
->opencl_v12
= device_opencl_version
[9] > '1' || device_opencl_version
[11] >= '2';
13438 myfree (device_opencl_version
);
13442 cl_uint vector_width
;
13444 if (opencl_vector_width_chgd
== 0)
13446 if (tuningdb_entry
== NULL
|| tuningdb_entry
->vector_width
== -1)
13448 if (opti_type
& OPTI_TYPE_USES_BITS_64
)
13450 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG
, sizeof (vector_width
), &vector_width
, NULL
);
13454 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT
, sizeof (vector_width
), &vector_width
, NULL
);
13459 vector_width
= (cl_uint
) tuningdb_entry
->vector_width
;
13464 vector_width
= opencl_vector_width
;
13467 if (vector_width
> 16) vector_width
= 16;
13469 device_param
->vector_width
= vector_width
;
13471 // max_compute_units
13473 cl_uint device_processors
;
13475 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (device_processors
), &device_processors
, NULL
);
13477 device_param
->device_processors
= device_processors
;
13479 // device_maxmem_alloc
13480 // note we'll limit to 2gb, otherwise this causes all kinds of weird errors because of possible integer overflows in opencl runtimes
13482 cl_ulong device_maxmem_alloc
;
13484 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (device_maxmem_alloc
), &device_maxmem_alloc
, NULL
);
13486 device_param
->device_maxmem_alloc
= MIN (device_maxmem_alloc
, 0x7fffffff);
13488 // device_global_mem
13490 cl_ulong device_global_mem
;
13492 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (device_global_mem
), &device_global_mem
, NULL
);
13494 device_param
->device_global_mem
= device_global_mem
;
13496 // max_work_group_size
13498 size_t device_maxworkgroup_size
;
13500 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_WORK_GROUP_SIZE
, sizeof (device_maxworkgroup_size
), &device_maxworkgroup_size
, NULL
);
13502 device_param
->device_maxworkgroup_size
= device_maxworkgroup_size
;
13504 // max_clock_frequency
13506 cl_uint device_maxclock_frequency
;
13508 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (device_maxclock_frequency
), &device_maxclock_frequency
, NULL
);
13510 device_param
->device_maxclock_frequency
= device_maxclock_frequency
;
13512 // device_endian_little
13514 cl_bool device_endian_little
;
13516 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_ENDIAN_LITTLE
, sizeof (device_endian_little
), &device_endian_little
, NULL
);
13518 if (device_endian_little
== CL_FALSE
)
13520 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not little endian device", device_id
+ 1);
13522 device_param
->skipped
= 1;
13525 // device_available
13527 cl_bool device_available
;
13529 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_AVAILABLE
, sizeof (device_available
), &device_available
, NULL
);
13531 if (device_available
== CL_FALSE
)
13533 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device not available", device_id
+ 1);
13535 device_param
->skipped
= 1;
13538 // device_compiler_available
13540 cl_bool device_compiler_available
;
13542 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPILER_AVAILABLE
, sizeof (device_compiler_available
), &device_compiler_available
, NULL
);
13544 if (device_compiler_available
== CL_FALSE
)
13546 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device no compiler available", device_id
+ 1);
13548 device_param
->skipped
= 1;
13551 // device_execution_capabilities
13553 cl_device_exec_capabilities device_execution_capabilities
;
13555 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXECUTION_CAPABILITIES
, sizeof (device_execution_capabilities
), &device_execution_capabilities
, NULL
);
13557 if ((device_execution_capabilities
& CL_EXEC_KERNEL
) == 0)
13559 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support executing kernels", device_id
+ 1);
13561 device_param
->skipped
= 1;
13564 // device_extensions
13566 size_t device_extensions_size
;
13568 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, 0, NULL
, &device_extensions_size
);
13570 char *device_extensions
= mymalloc (device_extensions_size
+ 1);
13572 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_EXTENSIONS
, device_extensions_size
, device_extensions
, NULL
);
13574 if (strstr (device_extensions
, "base_atomics") == 0)
13576 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support base atomics", device_id
+ 1);
13578 device_param
->skipped
= 1;
13581 if (strstr (device_extensions
, "byte_addressable_store") == 0)
13583 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device does not support byte addressable store", device_id
+ 1);
13585 device_param
->skipped
= 1;
13588 myfree (device_extensions
);
13590 // device_local_mem_size
13592 cl_ulong device_local_mem_size
;
13594 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_LOCAL_MEM_SIZE
, sizeof (device_local_mem_size
), &device_local_mem_size
, NULL
);
13596 if (device_local_mem_size
< 32768)
13598 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: device local mem size is too small", device_id
+ 1);
13600 device_param
->skipped
= 1;
13603 // If there's both an Intel CPU and an AMD OpenCL runtime it's a tricky situation
13604 // Both platforms support CPU device types and therefore both will try to use 100% of the physical resources
13605 // This results in both utilizing it for 50%
13606 // However, Intel has much better SIMD control over their own hardware
13607 // It makes sense to give them full control over their own hardware
13609 if (device_type
& CL_DEVICE_TYPE_CPU
)
13611 if (device_param
->device_vendor_id
== VENDOR_ID_AMD_USE_INTEL
)
13613 if (data
.quiet
== 0) log_info ("Device #%u: WARNING: not native intel opencl platform", device_id
+ 1);
13615 device_param
->skipped
= 1;
13621 device_param
->skipped
|= ((devices_filter
& (1 << device_id
)) == 0);
13622 device_param
->skipped
|= ((device_types_filter
& (device_type
)) == 0);
13626 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, 0, NULL
, ¶m_value_size
);
13628 char *driver_version
= (char *) mymalloc (param_value_size
);
13630 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DRIVER_VERSION
, param_value_size
, driver_version
, NULL
);
13632 device_param
->driver_version
= driver_version
;
13634 // device_name_chksum
13636 char *device_name_chksum
= (char *) mymalloc (INFOSZ
);
13639 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
);
13641 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
);
13644 uint device_name_digest
[4] = { 0 };
13646 md5_64 ((uint
*) device_name_chksum
, device_name_digest
);
13648 snprintf (device_name_chksum
, INFOSZ
- 1, "%08x", device_name_digest
[0]);
13650 device_param
->device_name_chksum
= device_name_chksum
;
13652 // device_processor_cores
13654 if (device_type
& CL_DEVICE_TYPE_CPU
)
13656 cl_uint device_processor_cores
= 1;
13658 device_param
->device_processor_cores
= device_processor_cores
;
13661 if (device_type
& CL_DEVICE_TYPE_GPU
)
13663 if (device_vendor_id
== VENDOR_ID_AMD
)
13665 cl_uint device_processor_cores
= 0;
13667 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
13669 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13671 device_param
->device_processor_cores
= device_processor_cores
;
13673 else if (device_vendor_id
== VENDOR_ID_NV
)
13675 cl_uint kernel_exec_timeout
= 0;
13677 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
13679 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
13681 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
13683 cl_uint device_processor_cores
= 0;
13685 #define CL_DEVICE_WARP_SIZE_NV 0x4003
13687 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (device_processor_cores
), &device_processor_cores
, NULL
);
13689 device_param
->device_processor_cores
= device_processor_cores
;
13691 cl_uint sm_minor
= 0;
13692 cl_uint sm_major
= 0;
13694 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
13695 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
13697 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
13698 hc_clGetDeviceInfo (data
.ocl
, device_param
->device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
13700 device_param
->sm_minor
= sm_minor
;
13701 device_param
->sm_major
= sm_major
;
13705 cl_uint device_processor_cores
= 1;
13707 device_param
->device_processor_cores
= device_processor_cores
;
13713 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13715 if (status_automat
== 0)
13717 if (device_param
->skipped
== 0)
13719 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %dMhz, %uMCU",
13722 (unsigned int) (device_maxmem_alloc
/ 1024 / 1024),
13723 (unsigned int) (device_global_mem
/ 1024 / 1024),
13724 (unsigned int) (device_maxclock_frequency
),
13725 (unsigned int) device_processors
);
13729 log_info ("Device #%u: %s, skipped",
13736 // common driver check
13738 if (device_param
->skipped
== 0)
13740 if (device_type
& CL_DEVICE_TYPE_GPU
)
13742 if (platform_vendor_id
== VENDOR_ID_AMD
)
13744 int catalyst_check
= (force
== 1) ? 0 : 1;
13746 int catalyst_warn
= 0;
13748 int catalyst_broken
= 0;
13750 if (catalyst_check
== 1)
13754 // v14.9 and higher
13755 if (atoi (device_param
->driver_version
) >= 1573)
13760 catalyst_check
= 0;
13763 if (catalyst_broken
== 1)
13766 log_info ("ATTENTION! The installed catalyst driver in your system is known to be broken!");
13767 log_info ("It will pass over cracked hashes and does not report them as cracked");
13768 log_info ("You are STRONGLY encouraged not to use it");
13769 log_info ("You can use --force to override this but do not post error reports if you do so");
13775 if (catalyst_warn
== 1)
13778 log_info ("ATTENTION! Unsupported or incorrect installed catalyst driver detected!");
13779 log_info ("You are STRONGLY encouraged to use the official supported catalyst driver for good reasons");
13780 log_info ("See hashcat's homepage for official supported catalyst drivers");
13782 log_info ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
13784 log_info ("You can use --force to override this but do not post error reports if you do so");
13790 else if (platform_vendor_id
== VENDOR_ID_NV
)
13792 if (device_param
->kernel_exec_timeout
!= 0)
13794 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);
13795 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
13800 /* turns out pocl still creates segfaults (because of llvm)
13801 if (device_type & CL_DEVICE_TYPE_CPU)
13803 if (platform_vendor_id == VENDOR_ID_AMD)
13808 log_info ("ATTENTION! OpenCL support for CPU of catalyst driver is not reliable.");
13809 log_info ("You are STRONGLY encouraged not to use it");
13810 log_info ("You can use --force to override this but do not post error reports if you do so");
13811 log_info ("A good alternative is the free pocl >= v0.13, but make sure to use a LLVM >= v3.8");
13821 * kernel accel and loops tuning db adjustment
13824 device_param
->kernel_accel_min
= 1;
13825 device_param
->kernel_accel_max
= 1024;
13827 device_param
->kernel_loops_min
= 1;
13828 device_param
->kernel_loops_max
= 1024;
13830 tuning_db_entry_t
*tuningdb_entry
= tuning_db_search (tuning_db
, device_param
, attack_mode
, hash_mode
);
13832 if (tuningdb_entry
)
13834 u32 _kernel_accel
= tuningdb_entry
->kernel_accel
;
13835 u32 _kernel_loops
= tuningdb_entry
->kernel_loops
;
13839 device_param
->kernel_accel_min
= _kernel_accel
;
13840 device_param
->kernel_accel_max
= _kernel_accel
;
13845 if (workload_profile
== 1)
13847 _kernel_loops
= (_kernel_loops
> 8) ? _kernel_loops
/ 8 : 1;
13849 else if (workload_profile
== 2)
13851 _kernel_loops
= (_kernel_loops
> 4) ? _kernel_loops
/ 4 : 1;
13854 device_param
->kernel_loops_min
= _kernel_loops
;
13855 device_param
->kernel_loops_max
= _kernel_loops
;
13859 // commandline parameters overwrite tuningdb entries
13863 device_param
->kernel_accel_min
= kernel_accel
;
13864 device_param
->kernel_accel_max
= kernel_accel
;
13869 device_param
->kernel_loops_min
= kernel_loops
;
13870 device_param
->kernel_loops_max
= kernel_loops
;
13886 if (keyspace
== 0 && devices_active
== 0)
13888 log_error ("ERROR: No devices found/left");
13893 // 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)
13895 if (devices_filter
!= (uint
) -1)
13897 uint devices_cnt_mask
= ~(((uint
) -1 >> devices_cnt
) << devices_cnt
);
13899 if (devices_filter
> devices_cnt_mask
)
13901 log_error ("ERROR: The device specified by the --opencl-devices parameter is larger than the number of available devices (%d)", devices_cnt
);
13907 data
.devices_cnt
= devices_cnt
;
13909 data
.devices_active
= devices_active
;
13911 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
13913 if (status_automat
== 0)
13924 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
13925 hm_attrs_t hm_adapters_nv
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13929 hm_attrs_t hm_adapters_amd
[DEVICES_MAX
] = { { { 0 }, 0, 0 } };
13932 if (gpu_temp_disable
== 0)
13934 #if defined(WIN) && defined(HAVE_NVAPI)
13935 NVAPI_PTR
*nvapi
= (NVAPI_PTR
*) mymalloc (sizeof (NVAPI_PTR
));
13937 if (nvapi_init (nvapi
) == 0)
13938 data
.hm_nv
= nvapi
;
13942 if (hm_NvAPI_Initialize (data
.hm_nv
) == NVAPI_OK
)
13944 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13946 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
13950 for (int i
= 0; i
< tmp_in
; i
++)
13952 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
13955 for (int i
= 0; i
< tmp_out
; i
++)
13957 NV_GPU_COOLER_SETTINGS pCoolerSettings
;
13959 pCoolerSettings
.Version
= GPU_COOLER_SETTINGS_VER
| sizeof (NV_GPU_COOLER_SETTINGS
);
13961 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;
13965 #endif // WIN && HAVE_NVAPI
13967 #if defined(LINUX) && defined(HAVE_NVML)
13968 NVML_PTR
*nvml
= (NVML_PTR
*) mymalloc (sizeof (NVML_PTR
));
13970 if (nvml_init (nvml
) == 0)
13975 if (hm_NVML_nvmlInit (data
.hm_nv
) == NVML_SUCCESS
)
13977 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
] = { 0 };
13979 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
13983 for (int i
= 0; i
< tmp_in
; i
++)
13985 hm_adapters_nv
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
13988 for (int i
= 0; i
< tmp_out
; i
++)
13990 unsigned int speed
;
13992 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;
13996 #endif // LINUX && HAVE_NVML
13998 data
.hm_amd
= NULL
;
14001 ADL_PTR
*adl
= (ADL_PTR
*) mymalloc (sizeof (ADL_PTR
));
14003 if (adl_init (adl
) == 0)
14008 if (hm_ADL_Main_Control_Create (data
.hm_amd
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
14010 // total number of adapters
14012 int hm_adapters_num
;
14014 if (get_adapters_num_amd (data
.hm_amd
, &hm_adapters_num
) != 0) return (-1);
14018 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (data
.hm_amd
, hm_adapters_num
);
14020 if (lpAdapterInfo
== NULL
) return (-1);
14022 // get a list (of ids of) valid/usable adapters
14024 int num_adl_adapters
= 0;
14026 u32
*valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
14028 if (num_adl_adapters
> 0)
14030 hc_thread_mutex_lock (mux_adl
);
14032 // hm_get_opencl_busid_devid (hm_adapters_amd, devices_all_cnt, devices_all);
14034 hm_get_adapter_index_amd (hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14036 hm_get_overdrive_version (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14037 hm_check_fanspeed_control (data
.hm_amd
, hm_adapters_amd
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
14039 hc_thread_mutex_unlock (mux_adl
);
14042 myfree (valid_adl_device_list
);
14043 myfree (lpAdapterInfo
);
14048 if (data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14050 gpu_temp_disable
= 1;
14055 * OpenCL devices: allocate buffer for device specific information
14059 int *temp_retain_fanspeed_value
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14062 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (data
.devices_cnt
, sizeof (ADLOD6MemClockState
));
14064 int *od_power_control_status
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
14069 * enable custom signal handler(s)
14072 if (benchmark
== 0)
14074 hc_signal (sigHandler_default
);
14078 hc_signal (sigHandler_benchmark
);
14082 * User-defined GPU temp handling
14086 if (gpu_temp_disable
== 1)
14088 gpu_temp_abort
= 0;
14089 gpu_temp_retain
= 0;
14092 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
14094 if (gpu_temp_abort
< gpu_temp_retain
)
14096 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
14102 data
.gpu_temp_disable
= gpu_temp_disable
;
14103 data
.gpu_temp_abort
= gpu_temp_abort
;
14104 data
.gpu_temp_retain
= gpu_temp_retain
;
14111 if (data
.quiet
== 0)
14113 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
14115 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
);
14117 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14119 log_info ("Rules: %u", kernel_rules_cnt
);
14124 log_info ("Applicable Optimizers:");
14126 for (uint i
= 0; i
< 32; i
++)
14128 const uint opti_bit
= 1u << i
;
14130 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
14135 * Watchdog and Temperature balance
14139 if (gpu_temp_disable
== 0 && data
.hm_amd
== NULL
&& data
.hm_nv
== NULL
)
14141 log_info ("Watchdog: Hardware Monitoring Interface not found on your system");
14144 if (gpu_temp_abort
== 0)
14146 log_info ("Watchdog: Temperature abort trigger disabled");
14150 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
14153 if (gpu_temp_retain
== 0)
14155 log_info ("Watchdog: Temperature retain trigger disabled");
14159 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
14162 if (data
.quiet
== 0) log_info ("");
14170 if (gpu_temp_disable
== 0)
14172 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14174 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14176 if ((device_param
->device_type
& CL_DEVICE_TYPE_GPU
) == 0) continue;
14178 if (device_param
->skipped
) continue;
14180 const uint platform_devices_id
= device_param
->platform_devices_id
;
14182 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
14183 if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14185 memcpy (&data
.hm_device
[device_id
], &hm_adapters_nv
[platform_devices_id
], sizeof (hm_attrs_t
));
14190 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14192 memcpy (&data
.hm_device
[device_id
], &hm_adapters_amd
[platform_devices_id
], sizeof (hm_attrs_t
));
14200 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
14201 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
14202 * were not working @ full speed (setting hm_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
14203 * Driver / ADL bug?
14207 if (powertune_enable
== 1)
14209 hc_thread_mutex_lock (mux_adl
);
14211 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14213 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14215 if (device_param
->skipped
) continue;
14217 if (data
.hm_device
[device_id
].od_version
== 6)
14219 // set powertune value only
14221 int powertune_supported
= 0;
14225 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
14227 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
14232 if (powertune_supported
!= 0)
14235 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
14237 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
14239 log_error ("ERROR: Failed to get current ADL PowerControl settings");
14244 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
14246 log_error ("ERROR: Failed to set new ADL PowerControl values");
14254 hc_thread_mutex_unlock (mux_adl
);
14257 #endif // HAVE_HWMON
14260 if (benchmark
== 1) log_info ("Hashmode: %d", data
.hash_mode
);
14263 if (data
.quiet
== 0) log_info_nn ("Initializing device kernels and memory...");
14265 uint kernel_power_all
= 0;
14267 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
14273 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14275 if (device_param
->skipped
) continue;
14278 * device properties
14281 const char *device_name_chksum
= device_param
->device_name_chksum
;
14282 const u32 device_processors
= device_param
->device_processors
;
14283 const u32 device_processor_cores
= device_param
->device_processor_cores
;
14286 * create context for each device
14289 device_param
->context
= hc_clCreateContext (data
.ocl
, NULL
, 1, &device_param
->device
, NULL
, NULL
);
14292 * create command-queue
14295 // not supported with NV
14296 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
14298 device_param
->command_queue
= hc_clCreateCommandQueue (data
.ocl
, device_param
->context
, device_param
->device
, CL_QUEUE_PROFILING_ENABLE
);
14301 * kernel threads: some algorithms need a fixed kernel-threads count
14302 * because of shared memory usage or bitslice
14303 * there needs to be some upper limit, otherwise there's too much overhead
14306 uint kernel_threads
= MIN (KERNEL_THREADS_MAX
, device_param
->device_maxworkgroup_size
);
14308 if (device_param
->device_type
& CL_DEVICE_TYPE_CPU
)
14310 kernel_threads
= KERNEL_THREADS_MAX_CPU
;
14313 if (hash_mode
== 1500) kernel_threads
= 64; // DES
14314 if (hash_mode
== 3000) kernel_threads
= 64; // DES
14315 if (hash_mode
== 3200) kernel_threads
= 8; // Blowfish
14316 if (hash_mode
== 7500) kernel_threads
= 64; // RC4
14317 if (hash_mode
== 9000) kernel_threads
= 8; // Blowfish
14318 if (hash_mode
== 9700) kernel_threads
= 64; // RC4
14319 if (hash_mode
== 9710) kernel_threads
= 64; // RC4
14320 if (hash_mode
== 9800) kernel_threads
= 64; // RC4
14321 if (hash_mode
== 9810) kernel_threads
= 64; // RC4
14322 if (hash_mode
== 10400) kernel_threads
= 64; // RC4
14323 if (hash_mode
== 10410) kernel_threads
= 64; // RC4
14324 if (hash_mode
== 10500) kernel_threads
= 64; // RC4
14325 if (hash_mode
== 13100) kernel_threads
= 64; // RC4
14328 * create input buffers on device : calculate size of fixed memory buffers
14331 size_t size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
14332 size_t size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
14334 device_param
->size_root_css
= size_root_css
;
14335 device_param
->size_markov_css
= size_markov_css
;
14337 size_t size_results
= sizeof (uint
);
14339 device_param
->size_results
= size_results
;
14341 size_t size_rules
= kernel_rules_cnt
* sizeof (kernel_rule_t
);
14342 size_t size_rules_c
= KERNEL_RULES
* sizeof (kernel_rule_t
);
14344 size_t size_plains
= digests_cnt
* sizeof (plain_t
);
14345 size_t size_salts
= salts_cnt
* sizeof (salt_t
);
14346 size_t size_esalts
= salts_cnt
* esalt_size
;
14348 device_param
->size_plains
= size_plains
;
14349 device_param
->size_digests
= size_digests
;
14350 device_param
->size_shown
= size_shown
;
14351 device_param
->size_salts
= size_salts
;
14353 size_t size_combs
= KERNEL_COMBS
* sizeof (comb_t
);
14354 size_t size_bfs
= KERNEL_BFS
* sizeof (bf_t
);
14355 size_t size_tm
= 32 * sizeof (bs_word_t
);
14359 size_t size_scryptV
= 1;
14361 if ((hash_mode
== 8900) || (hash_mode
== 9300))
14363 uint tmto_start
= 0;
14364 uint tmto_stop
= 10;
14368 tmto_start
= scrypt_tmto
;
14372 // in case the user did not specify the tmto manually
14373 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
14374 // but set the lower end only in case the user has a device with too less memory
14376 if (hash_mode
== 8900)
14378 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14382 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14387 else if (hash_mode
== 9300)
14389 if (device_param
->device_vendor_id
== VENDOR_ID_AMD
)
14393 else if (device_param
->device_vendor_id
== VENDOR_ID_NV
)
14400 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
14402 // TODO: in theory the following calculation needs to be done per salt, not global
14403 // we assume all hashes have the same scrypt settings
14405 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
14407 size_scryptV
/= 1 << tmto
;
14409 size_scryptV
*= device_processors
* device_processor_cores
;
14411 if (size_scryptV
> device_param
->device_maxmem_alloc
)
14413 if (quiet
== 0) log_info ("WARNING: not enough device memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
14418 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
14420 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
14421 data
.salts_buf
[salts_pos
].scrypt_phy
= device_processors
* device_processor_cores
;
14427 if (data
.salts_buf
[0].scrypt_phy
== 0)
14429 log_error ("ERROR: can't allocate enough device memory");
14434 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
14438 * some algorithms need a fixed kernel-loops count
14441 if (hash_mode
== 1500)
14443 const u32 kernel_loops_fixed
= 1024;
14445 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14446 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14449 if (hash_mode
== 3000)
14451 const u32 kernel_loops_fixed
= 1024;
14453 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14454 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14457 if (hash_mode
== 8900)
14459 const u32 kernel_loops_fixed
= 1;
14461 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14462 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14465 if (hash_mode
== 9300)
14467 const u32 kernel_loops_fixed
= 1;
14469 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14470 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14473 if (hash_mode
== 12500)
14475 const u32 kernel_loops_fixed
= ROUNDS_RAR3
/ 16;
14477 device_param
->kernel_loops_min
= kernel_loops_fixed
;
14478 device_param
->kernel_loops_max
= kernel_loops_fixed
;
14482 * some algorithms have a maximum kernel-loops count
14485 if (device_param
->kernel_loops_min
< device_param
->kernel_loops_max
)
14487 u32 innerloop_cnt
= 0;
14489 if (data
.attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
14491 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.kernel_rules_cnt
;
14492 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
14493 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
14497 innerloop_cnt
= data
.salts_buf
[0].salt_iter
;
14500 if ((innerloop_cnt
>= device_param
->kernel_loops_min
) &&
14501 (innerloop_cnt
<= device_param
->kernel_loops_max
))
14503 device_param
->kernel_loops_max
= innerloop_cnt
;
14507 u32 kernel_accel_min
= device_param
->kernel_accel_min
;
14508 u32 kernel_accel_max
= device_param
->kernel_accel_max
;
14510 // find out if we would request too much memory on memory blocks which are based on kernel_accel
14512 size_t size_pws
= 4;
14513 size_t size_tmps
= 4;
14514 size_t size_hooks
= 4;
14516 while (kernel_accel_max
>= kernel_accel_min
)
14518 const u32 kernel_power_max
= device_processors
* kernel_threads
* kernel_accel_max
;
14522 size_pws
= kernel_power_max
* sizeof (pw_t
);
14528 case 400: size_tmps
= kernel_power_max
* sizeof (phpass_tmp_t
); break;
14529 case 500: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14530 case 501: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14531 case 1600: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14532 case 1800: size_tmps
= kernel_power_max
* sizeof (sha512crypt_tmp_t
); break;
14533 case 2100: size_tmps
= kernel_power_max
* sizeof (dcc2_tmp_t
); break;
14534 case 2500: size_tmps
= kernel_power_max
* sizeof (wpa_tmp_t
); break;
14535 case 3200: size_tmps
= kernel_power_max
* sizeof (bcrypt_tmp_t
); break;
14536 case 5200: size_tmps
= kernel_power_max
* sizeof (pwsafe3_tmp_t
); break;
14537 case 5800: size_tmps
= kernel_power_max
* sizeof (androidpin_tmp_t
); break;
14538 case 6211: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14539 case 6212: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14540 case 6213: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14541 case 6221: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14542 case 6222: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14543 case 6223: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14544 case 6231: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14545 case 6232: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14546 case 6233: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14547 case 6241: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14548 case 6242: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14549 case 6243: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14550 case 6300: size_tmps
= kernel_power_max
* sizeof (md5crypt_tmp_t
); break;
14551 case 6400: size_tmps
= kernel_power_max
* sizeof (sha256aix_tmp_t
); break;
14552 case 6500: size_tmps
= kernel_power_max
* sizeof (sha512aix_tmp_t
); break;
14553 case 6600: size_tmps
= kernel_power_max
* sizeof (agilekey_tmp_t
); break;
14554 case 6700: size_tmps
= kernel_power_max
* sizeof (sha1aix_tmp_t
); break;
14555 case 6800: size_tmps
= kernel_power_max
* sizeof (lastpass_tmp_t
); break;
14556 case 7100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14557 case 7200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14558 case 7400: size_tmps
= kernel_power_max
* sizeof (sha256crypt_tmp_t
); break;
14559 case 7900: size_tmps
= kernel_power_max
* sizeof (drupal7_tmp_t
); break;
14560 case 8200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14561 case 8800: size_tmps
= kernel_power_max
* sizeof (androidfde_tmp_t
); break;
14562 case 8900: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14563 case 9000: size_tmps
= kernel_power_max
* sizeof (pwsafe2_tmp_t
); break;
14564 case 9100: size_tmps
= kernel_power_max
* sizeof (lotus8_tmp_t
); break;
14565 case 9200: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14566 case 9300: size_tmps
= kernel_power_max
* sizeof (scrypt_tmp_t
); break;
14567 case 9400: size_tmps
= kernel_power_max
* sizeof (office2007_tmp_t
); break;
14568 case 9500: size_tmps
= kernel_power_max
* sizeof (office2010_tmp_t
); break;
14569 case 9600: size_tmps
= kernel_power_max
* sizeof (office2013_tmp_t
); break;
14570 case 10000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14571 case 10200: size_tmps
= kernel_power_max
* sizeof (cram_md5_t
); break;
14572 case 10300: size_tmps
= kernel_power_max
* sizeof (saph_sha1_tmp_t
); break;
14573 case 10500: size_tmps
= kernel_power_max
* sizeof (pdf14_tmp_t
); break;
14574 case 10700: size_tmps
= kernel_power_max
* sizeof (pdf17l8_tmp_t
); break;
14575 case 10900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14576 case 11300: size_tmps
= kernel_power_max
* sizeof (bitcoin_wallet_tmp_t
); break;
14577 case 11600: size_tmps
= kernel_power_max
* sizeof (seven_zip_tmp_t
); break;
14578 case 11900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_md5_tmp_t
); break;
14579 case 12000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14580 case 12100: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha512_tmp_t
); break;
14581 case 12200: size_tmps
= kernel_power_max
* sizeof (ecryptfs_tmp_t
); break;
14582 case 12300: size_tmps
= kernel_power_max
* sizeof (oraclet_tmp_t
); break;
14583 case 12400: size_tmps
= kernel_power_max
* sizeof (bsdicrypt_tmp_t
); break;
14584 case 12500: size_tmps
= kernel_power_max
* sizeof (rar3_tmp_t
); break;
14585 case 12700: size_tmps
= kernel_power_max
* sizeof (mywallet_tmp_t
); break;
14586 case 12800: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14587 case 12900: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14588 case 13000: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha256_tmp_t
); break;
14589 case 13200: size_tmps
= kernel_power_max
* sizeof (axcrypt_tmp_t
); break;
14590 case 13400: size_tmps
= kernel_power_max
* sizeof (keepass_tmp_t
); break;
14591 case 13600: size_tmps
= kernel_power_max
* sizeof (pbkdf2_sha1_tmp_t
); break;
14592 case 13711: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14593 case 13712: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14594 case 13713: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14595 case 13721: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14596 case 13722: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14597 case 13723: size_tmps
= kernel_power_max
* sizeof (tc64_tmp_t
); break;
14598 case 13731: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14599 case 13732: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14600 case 13733: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14601 case 13741: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14602 case 13742: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14603 case 13743: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14604 case 13751: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14605 case 13752: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14606 case 13753: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14607 case 13761: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14608 case 13762: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14609 case 13763: size_tmps
= kernel_power_max
* sizeof (tc_tmp_t
); break;
14614 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
14619 // now check if all device-memory sizes which depend on the kernel_accel_max amplifier are within its boundaries
14620 // if not, decrease amplifier and try again
14624 const u64 size_total
14641 + size_pws
// not a bug
14652 // Don't ask me, ask AMD!
14654 if (size_total
> device_param
->device_maxmem_alloc
) skip
= 1;
14655 if (size_total
> device_param
->device_global_mem
) skip
= 1;
14659 kernel_accel_max
--;
14668 if (kernel_accel_max == 0)
14670 log_error ("Device #%u: Device does not provide enough allocatable device-memory to handle hash-type %u", device_id + 1, data.hash_mode);
14676 device_param
->kernel_accel_min
= kernel_accel_min
;
14677 device_param
->kernel_accel_max
= kernel_accel_max
;
14680 if (kernel_accel_max < kernel_accel)
14682 if (quiet == 0) log_info ("Device #%u: Reduced maximum kernel-accel to %u", device_id + 1, kernel_accel_max);
14684 device_param->kernel_accel = kernel_accel_max;
14688 device_param
->size_bfs
= size_bfs
;
14689 device_param
->size_combs
= size_combs
;
14690 device_param
->size_rules
= size_rules
;
14691 device_param
->size_rules_c
= size_rules_c
;
14692 device_param
->size_pws
= size_pws
;
14693 device_param
->size_tmps
= size_tmps
;
14694 device_param
->size_hooks
= size_hooks
;
14696 // do not confuse kernel_accel_max with kernel_accel here
14698 const u32 kernel_power
= device_processors
* kernel_threads
* kernel_accel_max
;
14700 device_param
->kernel_threads
= kernel_threads
;
14701 device_param
->kernel_power_user
= kernel_power
;
14703 kernel_power_all
+= kernel_power
;
14706 * default building options
14709 char build_opts
[1024] = { 0 };
14711 // we don't have sm_* on vendors not NV but it doesn't matter
14714 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
);
14716 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
);
14719 char build_opts_new
[1024] = { 0 };
14721 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
);
14723 strncpy (build_opts
, build_opts_new
, sizeof (build_opts
) - 1);
14726 if (device_param->device_vendor_id == VENDOR_ID_INTEL_SDK)
14728 // we do vectorizing much better than the auto-vectorizer
14730 snprintf (build_opts_new, sizeof (build_opts_new) - 1, "%s -cl-opt-disable", build_opts);
14732 strncpy (build_opts, build_opts_new, sizeof (build_opts) - 1);
14737 log_info ("Device #%u: build_opts '%s'\n", device_id
+ 1, build_opts
);
14746 * kernel source filename
14749 char source_file
[256] = { 0 };
14751 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
14755 if (stat (source_file
, &sst
) == -1)
14757 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14763 * kernel cached filename
14766 char cached_file
[256] = { 0 };
14768 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name_chksum
, cached_file
);
14774 if ((stat (cached_file
, &cst
) == -1) || cst
.st_size
== 0)
14780 * kernel compile or load
14783 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14785 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14787 if (force_jit_compilation
== -1)
14791 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14793 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14795 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14797 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14800 size_t build_log_size
= 0;
14802 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14804 if (build_log_size
> 1)
14806 char *build_log
= (char *) malloc (build_log_size
+ 1);
14808 memset (build_log
, 0, build_log_size
+ 1);
14810 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14820 device_param
->skipped
= true;
14822 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14827 size_t binary_size
;
14829 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14831 u8
*binary
= (u8
*) mymalloc (binary_size
);
14833 hc_clGetProgramInfo (data
.ocl
, device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14835 writeProgramBin (cached_file
, binary
, binary_size
);
14837 local_free (binary
);
14842 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14845 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14847 device_param
->program
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
14849 hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
14855 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
14858 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14860 device_param
->program
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14862 char build_opts_update
[1024] = { 0 };
14864 if (force_jit_compilation
== 1500)
14866 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
14868 else if (force_jit_compilation
== 8900)
14870 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
);
14874 snprintf (build_opts_update
, sizeof (build_opts_update
) - 1, "%s", build_opts
);
14877 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program
, 1, &device_param
->device
, build_opts_update
, NULL
, NULL
, false);
14880 size_t build_log_size
= 0;
14882 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &build_log_size
);
14884 if (build_log_size
> 1)
14886 char *build_log
= (char *) malloc (build_log_size
+ 1);
14888 memset (build_log
, 0, build_log_size
+ 1);
14890 hc_clGetProgramBuildInfo (data
.ocl
, device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, build_log_size
, build_log
, NULL
);
14900 device_param
->skipped
= true;
14902 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14906 local_free (kernel_lengths
);
14907 local_free (kernel_sources
[0]);
14908 local_free (kernel_sources
);
14912 * word generator kernel
14915 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
14918 * kernel mp source filename
14921 char source_file
[256] = { 0 };
14923 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
14927 if (stat (source_file
, &sst
) == -1)
14929 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
14935 * kernel mp cached filename
14938 char cached_file
[256] = { 0 };
14940 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name_chksum
, cached_file
);
14946 if (stat (cached_file
, &cst
) == -1)
14952 * kernel compile or load
14955 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
14957 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
14961 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
14962 if (quiet
== 0) log_info ("");
14964 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
14966 device_param
->program_mp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
14968 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
14972 device_param
->skipped
= true;
14974 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
14979 size_t binary_size
;
14981 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
14983 u8
*binary
= (u8
*) mymalloc (binary_size
);
14985 hc_clGetProgramInfo (data
.ocl
, device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
14987 writeProgramBin (cached_file
, binary
, binary_size
);
14989 local_free (binary
);
14994 log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
14997 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
14999 device_param
->program_mp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15001 hc_clBuildProgram (data
.ocl
, device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15004 local_free (kernel_lengths
);
15005 local_free (kernel_sources
[0]);
15006 local_free (kernel_sources
);
15013 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15020 * kernel amp source filename
15023 char source_file
[256] = { 0 };
15025 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
15029 if (stat (source_file
, &sst
) == -1)
15031 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
15037 * kernel amp cached filename
15040 char cached_file
[256] = { 0 };
15042 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name_chksum
, cached_file
);
15048 if (stat (cached_file
, &cst
) == -1)
15054 * kernel compile or load
15057 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
15059 const u8
**kernel_sources
= (const u8
**) mymalloc (sizeof (u8
*));
15063 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
15064 if (quiet
== 0) log_info ("");
15066 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
15068 device_param
->program_amp
= hc_clCreateProgramWithSource (data
.ocl
, device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
15070 int rc
= hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, false);
15074 device_param
->skipped
= true;
15076 log_info ("Device #%u: Kernel %s build failure. Proceed without this device.", device_id
+ 1, source_file
);
15081 size_t binary_size
;
15083 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
15085 u8
*binary
= (u8
*) mymalloc (binary_size
);
15087 hc_clGetProgramInfo (data
.ocl
, device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
15089 writeProgramBin (cached_file
, binary
, binary_size
);
15091 local_free (binary
);
15096 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
15099 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
15101 device_param
->program_amp
= hc_clCreateProgramWithBinary (data
.ocl
, device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const u8
**) kernel_sources
, NULL
);
15103 hc_clBuildProgram (data
.ocl
, device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
, true);
15106 local_free (kernel_lengths
);
15107 local_free (kernel_sources
[0]);
15108 local_free (kernel_sources
);
15111 // some algorithm collide too fast, make that impossible
15113 if (benchmark
== 1)
15115 ((uint
*) digests_buf
)[0] = -1;
15116 ((uint
*) digests_buf
)[1] = -1;
15117 ((uint
*) digests_buf
)[2] = -1;
15118 ((uint
*) digests_buf
)[3] = -1;
15125 device_param
->d_pws_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15126 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
15127 device_param
->d_tmps
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
15128 device_param
->d_hooks
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
15129 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15130 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15131 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15132 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15133 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15134 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15135 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15136 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
15137 device_param
->d_plain_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
15138 device_param
->d_digests_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
15139 device_param
->d_digests_shown
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
15140 device_param
->d_salt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
15141 device_param
->d_result
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
15142 device_param
->d_scryptV_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
15144 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
);
15145 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
);
15146 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
);
15147 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
);
15148 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
);
15149 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
);
15150 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
);
15151 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
);
15152 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
15153 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
15154 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
15160 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15162 device_param
->d_rules
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
15163 device_param
->d_rules_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
15165 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, kernel_rules_buf
, 0, NULL
, NULL
);
15167 else if (attack_kern
== ATTACK_KERN_COMBI
)
15169 device_param
->d_combs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15170 device_param
->d_combs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
15171 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15172 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15174 else if (attack_kern
== ATTACK_KERN_BF
)
15176 device_param
->d_bfs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15177 device_param
->d_bfs_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
15178 device_param
->d_tm_c
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
15179 device_param
->d_root_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
15180 device_param
->d_markov_css_buf
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
15185 device_param
->d_esalt_bufs
= hc_clCreateBuffer (data
.ocl
, device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
15187 hc_clEnqueueWriteBuffer (data
.ocl
, device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
15194 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
15196 device_param
->pws_buf
= pws_buf
;
15198 comb_t
*combs_buf
= (comb_t
*) mycalloc (KERNEL_COMBS
, sizeof (comb_t
));
15200 device_param
->combs_buf
= combs_buf
;
15202 void *hooks_buf
= mymalloc (size_hooks
);
15204 device_param
->hooks_buf
= hooks_buf
;
15210 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
15211 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
15212 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
15213 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
15214 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
15215 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
15216 device_param
->kernel_params_buf32
[27] = 0; // kernel_rules_cnt
15217 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
15218 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
15219 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
15220 device_param
->kernel_params_buf32
[31] = 0; // gid_max
15222 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15223 ? &device_param
->d_pws_buf
15224 : &device_param
->d_pws_amp_buf
;
15225 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
15226 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
15227 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
15228 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
15229 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
15230 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
15231 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
15232 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
15233 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
15234 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
15235 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
15236 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
15237 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
15238 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
15239 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
15240 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
15241 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
15242 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
15243 device_param
->kernel_params
[19] = &device_param
->d_result
;
15244 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
15245 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
15246 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
15247 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
15248 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
15249 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
15250 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
15251 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
15252 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
15253 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
15254 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
15255 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
15257 device_param
->kernel_params_mp_buf64
[3] = 0;
15258 device_param
->kernel_params_mp_buf32
[4] = 0;
15259 device_param
->kernel_params_mp_buf32
[5] = 0;
15260 device_param
->kernel_params_mp_buf32
[6] = 0;
15261 device_param
->kernel_params_mp_buf32
[7] = 0;
15262 device_param
->kernel_params_mp_buf32
[8] = 0;
15264 device_param
->kernel_params_mp
[0] = NULL
;
15265 device_param
->kernel_params_mp
[1] = NULL
;
15266 device_param
->kernel_params_mp
[2] = NULL
;
15267 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
15268 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
15269 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
15270 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
15271 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
15272 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
15274 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15275 device_param
->kernel_params_mp_l_buf32
[4] = 0;
15276 device_param
->kernel_params_mp_l_buf32
[5] = 0;
15277 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15278 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15279 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15280 device_param
->kernel_params_mp_l_buf32
[9] = 0;
15282 device_param
->kernel_params_mp_l
[0] = NULL
;
15283 device_param
->kernel_params_mp_l
[1] = NULL
;
15284 device_param
->kernel_params_mp_l
[2] = NULL
;
15285 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
15286 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
15287 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
15288 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
15289 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
15290 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
15291 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
15293 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15294 device_param
->kernel_params_mp_r_buf32
[4] = 0;
15295 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15296 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15297 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15298 device_param
->kernel_params_mp_r_buf32
[8] = 0;
15300 device_param
->kernel_params_mp_r
[0] = NULL
;
15301 device_param
->kernel_params_mp_r
[1] = NULL
;
15302 device_param
->kernel_params_mp_r
[2] = NULL
;
15303 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
15304 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
15305 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
15306 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
15307 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
15308 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
15310 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
15311 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
15313 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
15314 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
15315 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
15316 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
15317 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
15318 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
15319 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
15321 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
15322 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
15324 device_param
->kernel_params_memset_buf32
[1] = 0; // value
15325 device_param
->kernel_params_memset_buf32
[2] = 0; // gid_max
15327 device_param
->kernel_params_memset
[0] = NULL
;
15328 device_param
->kernel_params_memset
[1] = &device_param
->kernel_params_memset_buf32
[1];
15329 device_param
->kernel_params_memset
[2] = &device_param
->kernel_params_memset_buf32
[2];
15335 size_t kernel_wgs_tmp
;
15337 char kernel_name
[64] = { 0 };
15339 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15341 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15343 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
15345 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15347 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
15349 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15351 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
15353 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15357 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
15359 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15361 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
15363 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15365 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
15367 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15370 if (data
.attack_mode
== ATTACK_MODE_BF
)
15372 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15374 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
15376 device_param
->kernel_tm
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15378 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
);
15384 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
15386 device_param
->kernel1
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15388 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
15390 device_param
->kernel2
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15392 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
15394 device_param
->kernel3
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15396 if (opts_type
& OPTS_TYPE_HOOK12
)
15398 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
15400 device_param
->kernel12
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15402 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
);
15405 if (opts_type
& OPTS_TYPE_HOOK23
)
15407 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
15409 device_param
->kernel23
= hc_clCreateKernel (data
.ocl
, device_param
->program
, kernel_name
);
15411 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
);
15415 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
);
15416 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
);
15417 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
);
15419 for (uint i
= 0; i
<= 20; i
++)
15421 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15422 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15423 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15425 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15426 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
15429 for (uint i
= 21; i
<= 31; i
++)
15431 hc_clSetKernelArg (data
.ocl
, device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15432 hc_clSetKernelArg (data
.ocl
, device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15433 hc_clSetKernelArg (data
.ocl
, device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15435 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15436 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (data
.ocl
, device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
15441 device_param
->kernel_memset
= hc_clCreateKernel (data
.ocl
, device_param
->program
, "gpu_memset");
15443 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
);
15445 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 0, sizeof (cl_mem
), device_param
->kernel_params_memset
[0]);
15446 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 1, sizeof (cl_uint
), device_param
->kernel_params_memset
[1]);
15447 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_memset
, 2, sizeof (cl_uint
), device_param
->kernel_params_memset
[2]);
15451 if (attack_mode
== ATTACK_MODE_BF
)
15453 device_param
->kernel_mp_l
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "l_markov");
15454 device_param
->kernel_mp_r
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "r_markov");
15456 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
);
15457 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
);
15459 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
15461 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
15462 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
15465 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
15467 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15469 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
);
15471 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15473 device_param
->kernel_mp
= hc_clCreateKernel (data
.ocl
, device_param
->program_mp
, "C_markov");
15475 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
);
15478 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15484 device_param
->kernel_amp
= hc_clCreateKernel (data
.ocl
, device_param
->program_amp
, "amp");
15486 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
);
15489 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
15495 for (uint i
= 0; i
< 5; i
++)
15497 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
15500 for (uint i
= 5; i
< 7; i
++)
15502 hc_clSetKernelArg (data
.ocl
, device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
15506 // maybe this has been updated by clGetKernelWorkGroupInfo()
15507 // value can only be decreased, so we don't need to reallocate buffers
15509 device_param
->kernel_threads
= kernel_threads
;
15511 // zero some data buffers
15513 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
15514 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
15515 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
15516 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
15517 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
15518 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
15524 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
15526 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
15528 else if (attack_kern
== ATTACK_KERN_COMBI
)
15530 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
15531 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
15532 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15533 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15535 else if (attack_kern
== ATTACK_KERN_BF
)
15537 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
15538 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
15539 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
15540 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
15541 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
15545 * Store initial fanspeed if gpu_temp_retain is enabled
15548 #if defined(HAVE_HWMON) && defined(HAVE_ADL)
15549 int gpu_temp_retain_set
= 0;
15551 if (gpu_temp_disable
== 0)
15553 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
15555 hc_thread_mutex_lock (mux_adl
);
15557 if (data
.hm_device
[device_id
].fan_supported
== 1)
15559 if (gpu_temp_retain_chgd
== 0)
15562 uint default_temp
= 0;
15564 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
);
15566 if (ADL_rc
== ADL_OK
)
15568 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
15570 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
15572 // special case with multi gpu setups: always use minimum retain
15574 if (gpu_temp_retain_set
== 0)
15576 gpu_temp_retain
= gpu_temp_retain_target
;
15577 gpu_temp_retain_set
= 1;
15581 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
15584 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
15588 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
15590 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
15592 if (fan_speed
== -1)
15594 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
15596 temp_retain_fanspeed_value
[device_id
] = 0;
15600 hc_thread_mutex_unlock (mux_adl
);
15605 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
15608 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
15610 hc_thread_mutex_lock (mux_adl
);
15612 if (data
.hm_device
[device_id
].od_version
== 6)
15616 // check powertune capabilities first, if not available then skip device
15618 int powertune_supported
= 0;
15620 if ((ADL_rc
= hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15622 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15627 if (powertune_supported
!= 0)
15629 // powercontrol settings
15631 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
15633 if ((ADL_rc
= hm_ADL_Overdrive_PowerControlInfo_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
15635 ADL_rc
= hm_ADL_Overdrive_PowerControl_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
15638 if (ADL_rc
!= ADL_OK
)
15640 log_error ("ERROR: Failed to get current ADL PowerControl settings");
15645 if ((ADL_rc
= hm_ADL_Overdrive_PowerControl_Set (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
15647 log_error ("ERROR: Failed to set new ADL PowerControl values");
15654 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
15656 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
15658 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
)
15660 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
15665 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
15667 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
15669 if ((ADL_rc
= hm_ADL_Overdrive_Capabilities_Get (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
15671 log_error ("ERROR: Failed to get ADL device capabilities");
15676 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
15677 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
15679 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
15680 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
15682 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
15683 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
15685 // warning if profile has too low max values
15687 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
15689 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
15692 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
15694 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
15697 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15699 performance_state
->iNumberOfPerformanceLevels
= 2;
15701 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
15702 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
15703 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
15704 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
15706 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
)
15708 log_info ("ERROR: Failed to set ADL performance state");
15713 local_free (performance_state
);
15717 hc_thread_mutex_unlock (mux_adl
);
15719 #endif // HAVE_HWMON && HAVE_ADL
15722 data
.kernel_power_all
= kernel_power_all
;
15724 if (data
.quiet
== 0) log_info_nn ("");
15727 * In benchmark-mode, inform user which algorithm is checked
15730 if (benchmark
== 1)
15732 if (status_automat
== 0)
15736 data
.quiet
= quiet
;
15738 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
15740 log_info ("Hashtype: %s", hash_type
);
15746 * keep track of the progress
15749 data
.words_progress_done
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15750 data
.words_progress_rejected
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15751 data
.words_progress_restored
= (u64
*) mycalloc (data
.salts_cnt
, sizeof (u64
));
15758 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
15760 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
15765 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
15767 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
15772 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
15774 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
15784 segment_size
*= (1024 * 1024);
15786 data
.segment_size
= segment_size
;
15788 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
15790 wl_data
->buf
= (char *) mymalloc (segment_size
);
15791 wl_data
->avail
= segment_size
;
15792 wl_data
->incr
= segment_size
;
15796 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
15798 data
.wordlist_mode
= wordlist_mode
;
15800 cs_t
*css_buf
= NULL
;
15804 char **masks
= NULL
;
15805 char **dictfiles
= NULL
;
15807 uint mask_from_file
= 0;
15809 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15811 if (wordlist_mode
== WL_MODE_FILE
)
15813 int wls_left
= myargc
- (optind
+ 1);
15815 for (int i
= 0; i
< wls_left
; i
++)
15817 char *l0_filename
= myargv
[optind
+ 1 + i
];
15819 struct stat l0_stat
;
15821 if (stat (l0_filename
, &l0_stat
) == -1)
15823 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
15828 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
15832 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15836 dictfiles
[dictcnt
- 1] = l0_filename
;
15840 // do not allow --keyspace w/ a directory
15844 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
15849 char **dictionary_files
= NULL
;
15851 dictionary_files
= scan_directory (l0_filename
);
15853 if (dictionary_files
!= NULL
)
15855 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
15857 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
15859 char *l1_filename
= dictionary_files
[d
];
15861 struct stat l1_stat
;
15863 if (stat (l1_filename
, &l1_stat
) == -1)
15865 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
15870 if (S_ISREG (l1_stat
.st_mode
))
15872 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
15876 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
15881 local_free (dictionary_files
);
15887 log_error ("ERROR: No usable dictionary file found.");
15892 else if (wordlist_mode
== WL_MODE_STDIN
)
15897 else if (attack_mode
== ATTACK_MODE_COMBI
)
15901 char *dictfile1
= myargv
[optind
+ 1 + 0];
15902 char *dictfile2
= myargv
[optind
+ 1 + 1];
15904 // find the bigger dictionary and use as base
15909 struct stat tmp_stat
;
15911 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
15913 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15918 if (stat (dictfile1
, &tmp_stat
) == -1)
15920 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
15927 if (S_ISDIR (tmp_stat
.st_mode
))
15929 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
15936 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
15938 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15945 if (stat (dictfile2
, &tmp_stat
) == -1)
15947 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15955 if (S_ISDIR (tmp_stat
.st_mode
))
15957 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
15965 data
.combs_cnt
= 1;
15969 const u64 words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
15971 data
.quiet
= quiet
;
15973 if (words1_cnt
== 0)
15975 log_error ("ERROR: %s: empty file", dictfile1
);
15983 data
.combs_cnt
= 1;
15987 const u64 words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15989 data
.quiet
= quiet
;
15991 if (words2_cnt
== 0)
15993 log_error ("ERROR: %s: empty file", dictfile2
);
16004 data
.dictfile
= dictfile1
;
16005 data
.dictfile2
= dictfile2
;
16007 if (words1_cnt
>= words2_cnt
)
16009 data
.combs_cnt
= words2_cnt
;
16010 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16012 dictfiles
= &data
.dictfile
;
16018 data
.combs_cnt
= words1_cnt
;
16019 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16021 dictfiles
= &data
.dictfile2
;
16025 // we also have to switch wordlist related rules!
16027 char *tmpc
= data
.rule_buf_l
;
16029 data
.rule_buf_l
= data
.rule_buf_r
;
16030 data
.rule_buf_r
= tmpc
;
16032 int tmpi
= data
.rule_len_l
;
16034 data
.rule_len_l
= data
.rule_len_r
;
16035 data
.rule_len_r
= tmpi
;
16038 else if (attack_mode
== ATTACK_MODE_BF
)
16044 if (benchmark
== 0)
16046 mask
= myargv
[optind
+ 1];
16048 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
16050 if ((optind
+ 2) <= myargc
)
16052 struct stat file_stat
;
16054 if (stat (mask
, &file_stat
) == -1)
16058 masks
[maskcnt
- 1] = mystrdup (mask
);
16062 int wls_left
= myargc
- (optind
+ 1);
16064 uint masks_avail
= INCR_MASKS
;
16066 for (int i
= 0; i
< wls_left
; i
++)
16070 mask
= myargv
[optind
+ 1 + i
];
16072 if (stat (mask
, &file_stat
) == -1)
16074 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16080 uint is_file
= S_ISREG (file_stat
.st_mode
);
16086 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16088 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16093 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16095 while (!feof (mask_fp
))
16097 memset (line_buf
, 0, HCBUFSIZ
);
16099 int line_len
= fgetl (mask_fp
, line_buf
);
16101 if (line_len
== 0) continue;
16103 if (line_buf
[0] == '#') continue;
16105 if (masks_avail
== maskcnt
)
16107 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16109 masks_avail
+= INCR_MASKS
;
16112 masks
[maskcnt
] = mystrdup (line_buf
);
16123 log_error ("ERROR: %s: unsupported file-type", mask
);
16129 mask_from_file
= 1;
16134 custom_charset_1
= (char *) "?l?d?u";
16135 custom_charset_2
= (char *) "?l?d";
16136 custom_charset_3
= (char *) "?l?d*!$@_";
16138 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16139 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16140 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16142 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
16144 wordlist_mode
= WL_MODE_MASK
;
16146 data
.wordlist_mode
= wordlist_mode
;
16156 * generate full masks and charsets
16159 masks
= (char **) mymalloc (sizeof (char *));
16163 case 1731: pw_min
= 5;
16165 mask
= mystrdup ("?b?b?b?b?b");
16167 case 12500: pw_min
= 5;
16169 mask
= mystrdup ("?b?b?b?b?b");
16171 default: pw_min
= 7;
16173 mask
= mystrdup ("?b?b?b?b?b?b?b");
16179 masks
[maskcnt
- 1] = mystrdup (mask
);
16181 wordlist_mode
= WL_MODE_MASK
;
16183 data
.wordlist_mode
= wordlist_mode
;
16188 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
16192 if (increment_min
> pw_min
) pw_min
= increment_min
;
16194 if (increment_max
< pw_max
) pw_max
= increment_max
;
16197 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
16199 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
16203 char *mask
= myargv
[myargc
- 1];
16207 masks
= (char **) mymalloc (1 * sizeof (char *));
16211 struct stat file_stat
;
16213 if (stat (mask
, &file_stat
) == -1)
16217 masks
[maskcnt
- 1] = mystrdup (mask
);
16221 uint is_file
= S_ISREG (file_stat
.st_mode
);
16227 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16229 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16234 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16236 uint masks_avail
= 1;
16238 while (!feof (mask_fp
))
16240 memset (line_buf
, 0, HCBUFSIZ
);
16242 int line_len
= fgetl (mask_fp
, line_buf
);
16244 if (line_len
== 0) continue;
16246 if (line_buf
[0] == '#') continue;
16248 if (masks_avail
== maskcnt
)
16250 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16252 masks_avail
+= INCR_MASKS
;
16255 masks
[maskcnt
] = mystrdup (line_buf
);
16264 mask_from_file
= 1;
16270 masks
[maskcnt
- 1] = mystrdup (mask
);
16276 int wls_left
= myargc
- (optind
+ 2);
16278 for (int i
= 0; i
< wls_left
; i
++)
16280 char *filename
= myargv
[optind
+ 1 + i
];
16282 struct stat file_stat
;
16284 if (stat (filename
, &file_stat
) == -1)
16286 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16291 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16295 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16299 dictfiles
[dictcnt
- 1] = filename
;
16303 // do not allow --keyspace w/ a directory
16307 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16312 char **dictionary_files
= NULL
;
16314 dictionary_files
= scan_directory (filename
);
16316 if (dictionary_files
!= NULL
)
16318 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16320 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16322 char *l1_filename
= dictionary_files
[d
];
16324 struct stat l1_stat
;
16326 if (stat (l1_filename
, &l1_stat
) == -1)
16328 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16333 if (S_ISREG (l1_stat
.st_mode
))
16335 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16339 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16344 local_free (dictionary_files
);
16350 log_error ("ERROR: No usable dictionary file found.");
16359 uint mask_min
= increment_min
; // we can't reject smaller masks here
16360 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16362 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16364 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16366 if (cur_mask
== NULL
) break;
16368 masks
[maskcnt
] = cur_mask
;
16372 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16376 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16378 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
16382 char *mask
= myargv
[optind
+ 1 + 0];
16386 masks
= (char **) mymalloc (1 * sizeof (char *));
16390 struct stat file_stat
;
16392 if (stat (mask
, &file_stat
) == -1)
16396 masks
[maskcnt
- 1] = mystrdup (mask
);
16400 uint is_file
= S_ISREG (file_stat
.st_mode
);
16406 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
16408 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
16413 char *line_buf
= (char *) mymalloc (HCBUFSIZ
);
16415 uint masks_avail
= 1;
16417 while (!feof (mask_fp
))
16419 memset (line_buf
, 0, HCBUFSIZ
);
16421 int line_len
= fgetl (mask_fp
, line_buf
);
16423 if (line_len
== 0) continue;
16425 if (line_buf
[0] == '#') continue;
16427 if (masks_avail
== maskcnt
)
16429 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
16431 masks_avail
+= INCR_MASKS
;
16434 masks
[maskcnt
] = mystrdup (line_buf
);
16443 mask_from_file
= 1;
16449 masks
[maskcnt
- 1] = mystrdup (mask
);
16455 int wls_left
= myargc
- (optind
+ 2);
16457 for (int i
= 0; i
< wls_left
; i
++)
16459 char *filename
= myargv
[optind
+ 2 + i
];
16461 struct stat file_stat
;
16463 if (stat (filename
, &file_stat
) == -1)
16465 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
16470 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
16474 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16478 dictfiles
[dictcnt
- 1] = filename
;
16482 // do not allow --keyspace w/ a directory
16486 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
16491 char **dictionary_files
= NULL
;
16493 dictionary_files
= scan_directory (filename
);
16495 if (dictionary_files
!= NULL
)
16497 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
16499 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
16501 char *l1_filename
= dictionary_files
[d
];
16503 struct stat l1_stat
;
16505 if (stat (l1_filename
, &l1_stat
) == -1)
16507 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
16512 if (S_ISREG (l1_stat
.st_mode
))
16514 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
16518 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
16523 local_free (dictionary_files
);
16529 log_error ("ERROR: No usable dictionary file found.");
16538 uint mask_min
= increment_min
; // we can't reject smaller masks here
16539 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
16541 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
16543 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
16545 if (cur_mask
== NULL
) break;
16547 masks
[maskcnt
] = cur_mask
;
16551 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
16556 data
.pw_min
= pw_min
;
16557 data
.pw_max
= pw_max
;
16563 if (weak_hash_threshold
>= salts_cnt
)
16565 hc_device_param_t
*device_param
= NULL
;
16567 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16569 device_param
= &data
.devices_param
[device_id
];
16571 if (device_param
->skipped
) continue;
16576 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
16578 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
16580 weak_hash_check (device_param
, salt_pos
);
16583 // Display hack, guarantee that there is at least one \r before real start
16585 //if (data.quiet == 0) log_info ("");
16589 * status and monitor threads
16592 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
16594 hc_thread_t i_thread
= 0;
16596 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16598 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
16601 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
16603 uint ni_threads_cnt
= 0;
16605 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
16607 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
16617 if (outfile_check_timer
!= 0)
16619 if (data
.outfile_check_directory
!= NULL
)
16621 if ((hash_mode
!= 5200) &&
16622 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
16623 !((hash_mode
>= 13700) && (hash_mode
<= 13799)) &&
16624 (hash_mode
!= 9000))
16626 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
16632 outfile_check_timer
= 0;
16637 outfile_check_timer
= 0;
16643 * Inform the user if we got some hashes remove because of the pot file remove feature
16646 if (data
.quiet
== 0)
16648 if (potfile_remove_cracks
> 0)
16650 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
16651 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
16655 data
.outfile_check_timer
= outfile_check_timer
;
16661 char **induction_dictionaries
= NULL
;
16663 int induction_dictionaries_cnt
= 0;
16665 hcstat_table_t
*root_table_buf
= NULL
;
16666 hcstat_table_t
*markov_table_buf
= NULL
;
16668 uint initial_restore_done
= 0;
16670 data
.maskcnt
= maskcnt
;
16672 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
16674 if (data
.devices_status
== STATUS_CRACKED
) break;
16676 data
.devices_status
= STATUS_INIT
;
16678 if (maskpos
> rd
->maskpos
)
16683 rd
->maskpos
= maskpos
;
16684 data
.maskpos
= maskpos
;
16686 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
16688 char *mask
= masks
[maskpos
];
16690 if (mask_from_file
== 1)
16692 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
16697 uint mask_offset
= 0;
16699 uint separator_cnt
;
16701 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
16703 str_ptr
= strstr (mask
+ mask_offset
, ",");
16705 if (str_ptr
== NULL
) break;
16707 str_pos
= str_ptr
- mask
;
16709 // escaped separator, i.e. "\,"
16713 if (mask
[str_pos
- 1] == '\\')
16717 mask_offset
= str_pos
+ 1;
16723 // reset the offset
16727 mask
[str_pos
] = '\0';
16729 switch (separator_cnt
)
16732 mp_reset_usr (mp_usr
, 0);
16734 custom_charset_1
= mask
;
16735 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
16739 mp_reset_usr (mp_usr
, 1);
16741 custom_charset_2
= mask
;
16742 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
16746 mp_reset_usr (mp_usr
, 2);
16748 custom_charset_3
= mask
;
16749 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
16753 mp_reset_usr (mp_usr
, 3);
16755 custom_charset_4
= mask
;
16756 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
16760 mask
= mask
+ str_pos
+ 1;
16764 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
16768 local_free (css_buf
);
16769 local_free (data
.root_css_buf
);
16770 local_free (data
.markov_css_buf
);
16772 local_free (masks
[maskpos
- 1]);
16775 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
16778 data
.css_cnt
= css_cnt
;
16779 data
.css_buf
= css_buf
;
16781 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
16783 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
16785 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
16786 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
16788 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
16790 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
16792 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
16793 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
16795 data
.root_css_buf
= root_css_buf
;
16796 data
.markov_css_buf
= markov_css_buf
;
16798 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
16800 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
16802 local_free (root_table_buf
);
16803 local_free (markov_table_buf
);
16807 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16809 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16811 if (device_param
->skipped
) continue;
16813 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
16814 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
16815 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
16817 device_param
->kernel_params_mp_buf64
[3] = 0;
16818 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
16819 device_param
->kernel_params_mp_buf32
[5] = 0;
16820 device_param
->kernel_params_mp_buf32
[6] = 0;
16821 device_param
->kernel_params_mp_buf32
[7] = 0;
16823 if (attack_mode
== ATTACK_MODE_HYBRID1
)
16825 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
16826 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
16827 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
16828 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
16830 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
16832 device_param
->kernel_params_mp_buf32
[5] = 0;
16833 device_param
->kernel_params_mp_buf32
[6] = 0;
16834 device_param
->kernel_params_mp_buf32
[7] = 0;
16837 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
]);
16838 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
]);
16839 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
]);
16841 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
);
16842 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
);
16845 else if (attack_mode
== ATTACK_MODE_BF
)
16847 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
16851 for (uint i
= 0; i
< dictcnt
; i
++)
16853 local_free (dictfiles
[i
]);
16856 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
16858 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
16860 if (l1_filename
== NULL
) break;
16864 dictfiles
[dictcnt
- 1] = l1_filename
;
16871 dictfiles
[dictcnt
- 1] = mask
;
16876 log_error ("ERROR: Mask is too small");
16883 free (induction_dictionaries
);
16885 // induction_dictionaries_cnt = 0; // implied
16887 if (attack_mode
!= ATTACK_MODE_BF
)
16891 induction_dictionaries
= scan_directory (induction_directory
);
16893 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
16897 if (induction_dictionaries_cnt
)
16899 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
16903 * prevent the user from using --keyspace together w/ maskfile and or dictfile
16907 if ((maskcnt
> 1) || (dictcnt
> 1))
16909 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
16915 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
16917 char *subid
= logfile_generate_subid ();
16919 data
.subid
= subid
;
16921 logfile_sub_msg ("START");
16923 data
.devices_status
= STATUS_INIT
;
16925 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (u64
));
16926 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (u64
));
16927 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (u64
));
16929 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
16933 data
.cpt_start
= time (NULL
);
16935 data
.cpt_total
= 0;
16937 if (data
.restore
== 0)
16939 rd
->words_cur
= skip
;
16946 data
.ms_paused
= 0;
16948 data
.words_cur
= rd
->words_cur
;
16950 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
16952 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16954 if (device_param
->skipped
) continue;
16956 device_param
->speed_pos
= 0;
16958 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (u64
));
16959 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (double));
16961 device_param
->exec_pos
= 0;
16963 memset (device_param
->exec_ms
, 0, EXEC_CACHE
* sizeof (double));
16965 device_param
->kernel_power
= device_param
->kernel_power_user
;
16967 device_param
->outerloop_pos
= 0;
16968 device_param
->outerloop_left
= 0;
16969 device_param
->innerloop_pos
= 0;
16970 device_param
->innerloop_left
= 0;
16972 // some more resets:
16974 if (device_param
->pws_buf
) memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
16976 device_param
->pws_cnt
= 0;
16978 device_param
->words_off
= 0;
16979 device_param
->words_done
= 0;
16982 data
.kernel_power_div
= 0;
16984 // figure out some workload
16986 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
16988 if (data
.wordlist_mode
== WL_MODE_FILE
)
16990 char *dictfile
= NULL
;
16992 if (induction_dictionaries_cnt
)
16994 dictfile
= induction_dictionaries
[0];
16998 dictfile
= dictfiles
[dictpos
];
17001 data
.dictfile
= dictfile
;
17003 logfile_sub_string (dictfile
);
17005 for (uint i
= 0; i
< rp_files_cnt
; i
++)
17007 logfile_sub_var_string ("rulefile", rp_files
[i
]);
17010 FILE *fd2
= fopen (dictfile
, "rb");
17014 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17019 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17023 if (data
.words_cnt
== 0)
17025 if (data
.devices_status
== STATUS_CRACKED
) break;
17026 if (data
.devices_status
== STATUS_ABORTED
) break;
17034 else if (attack_mode
== ATTACK_MODE_COMBI
)
17036 char *dictfile
= data
.dictfile
;
17037 char *dictfile2
= data
.dictfile2
;
17039 logfile_sub_string (dictfile
);
17040 logfile_sub_string (dictfile2
);
17042 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
17044 FILE *fd2
= fopen (dictfile
, "rb");
17048 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17053 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17057 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
17059 FILE *fd2
= fopen (dictfile2
, "rb");
17063 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
17068 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
17073 if (data
.words_cnt
== 0)
17075 if (data
.devices_status
== STATUS_CRACKED
) break;
17076 if (data
.devices_status
== STATUS_ABORTED
) break;
17083 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
17085 char *dictfile
= NULL
;
17087 if (induction_dictionaries_cnt
)
17089 dictfile
= induction_dictionaries
[0];
17093 dictfile
= dictfiles
[dictpos
];
17096 data
.dictfile
= dictfile
;
17098 char *mask
= data
.mask
;
17100 logfile_sub_string (dictfile
);
17101 logfile_sub_string (mask
);
17103 FILE *fd2
= fopen (dictfile
, "rb");
17107 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
17112 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
17116 if (data
.words_cnt
== 0)
17118 if (data
.devices_status
== STATUS_CRACKED
) break;
17119 if (data
.devices_status
== STATUS_ABORTED
) break;
17126 else if (attack_mode
== ATTACK_MODE_BF
)
17128 local_free (css_buf
);
17129 local_free (data
.root_css_buf
);
17130 local_free (data
.markov_css_buf
);
17132 char *mask
= dictfiles
[dictpos
];
17134 logfile_sub_string (mask
);
17138 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
17140 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17142 uint css_cnt_unicode
= css_cnt
* 2;
17144 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
17146 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
17148 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
17150 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
17151 css_buf_unicode
[j
+ 1].cs_len
= 1;
17156 css_buf
= css_buf_unicode
;
17157 css_cnt
= css_cnt_unicode
;
17160 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
17162 uint mask_min
= pw_min
;
17163 uint mask_max
= pw_max
;
17165 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17171 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
17173 if (css_cnt
< mask_min
)
17175 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
17178 if (css_cnt
> mask_max
)
17180 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
17183 // skip to next mask
17187 rd
->dictpos
= dictpos
;
17189 logfile_sub_msg ("STOP");
17194 uint save_css_cnt
= css_cnt
;
17196 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
17198 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
17200 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
17201 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
17203 uint css_cnt_salt
= css_cnt
+ salt_len
;
17205 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
17207 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
17209 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
17211 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
17212 css_buf_salt
[j
].cs_len
= 1;
17217 css_buf
= css_buf_salt
;
17218 css_cnt
= css_cnt_salt
;
17223 data
.css_cnt
= css_cnt
;
17224 data
.css_buf
= css_buf
;
17226 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
17228 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
] = { { 0 } };
17230 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
17232 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
17233 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
17235 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
17237 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
17239 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
17240 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
17242 data
.root_css_buf
= root_css_buf
;
17243 data
.markov_css_buf
= markov_css_buf
;
17245 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
17247 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
17249 local_free (root_table_buf
);
17250 local_free (markov_table_buf
);
17254 uint css_cnt_l
= css_cnt
;
17257 if (attack_exec
== ATTACK_EXEC_INSIDE_KERNEL
)
17259 if (save_css_cnt
< 6)
17263 else if (save_css_cnt
== 6)
17269 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
17271 if (save_css_cnt
== 8 || save_css_cnt
== 10)
17282 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
17297 /* unfinished code?
17298 int sum = css_buf[css_cnt_r - 1].cs_len;
17300 for (uint i = 1; i < 4 && i < css_cnt; i++)
17302 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
17306 sum *= css_buf[css_cnt_r - 1].cs_len;
17311 css_cnt_l
-= css_cnt_r
;
17313 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
17315 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17317 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17319 if (device_param
->skipped
) continue;
17321 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
17322 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
17323 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
17325 device_param
->kernel_params_mp_l_buf64
[3] = 0;
17326 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
17327 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
17328 device_param
->kernel_params_mp_l_buf32
[6] = 0;
17329 device_param
->kernel_params_mp_l_buf32
[7] = 0;
17330 device_param
->kernel_params_mp_l_buf32
[8] = 0;
17332 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
17333 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
17334 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
17335 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
17337 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
17338 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
17339 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
17341 device_param
->kernel_params_mp_r_buf64
[3] = 0;
17342 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
17343 device_param
->kernel_params_mp_r_buf32
[5] = 0;
17344 device_param
->kernel_params_mp_r_buf32
[6] = 0;
17345 device_param
->kernel_params_mp_r_buf32
[7] = 0;
17347 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
]);
17348 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
]);
17349 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
]);
17351 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
]);
17352 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
]);
17353 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
]);
17355 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
);
17356 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
);
17360 u64 words_base
= data
.words_cnt
;
17362 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17364 if (data
.kernel_rules_cnt
)
17366 words_base
/= data
.kernel_rules_cnt
;
17369 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17371 if (data
.combs_cnt
)
17373 words_base
/= data
.combs_cnt
;
17376 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17380 words_base
/= data
.bfs_cnt
;
17384 data
.words_base
= words_base
;
17388 log_info ("%llu", (unsigned long long int) words_base
);
17393 if (data
.words_cur
> data
.words_base
)
17395 log_error ("ERROR: restore value greater keyspace");
17400 if (data
.words_cur
)
17402 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
17404 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17406 data
.words_progress_restored
[i
] = data
.words_cur
* data
.kernel_rules_cnt
;
17409 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
17411 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17413 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
17416 else if (data
.attack_kern
== ATTACK_KERN_BF
)
17418 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
17420 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
17426 * Inform user about possible slow speeds
17429 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17431 if (data
.words_base
< kernel_power_all
)
17435 log_info ("ATTENTION!");
17436 log_info (" The wordlist or mask you are using is too small.");
17437 log_info (" Therefore, hashcat is unable to utilize the full parallelization power of your device(s).");
17438 log_info (" The cracking speed will drop.");
17439 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
17446 * Update loopback file
17455 uint random_num
= get_random_num (0, 9999);
17457 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
17459 data
.loopback_file
= loopback_file
;
17463 * Update dictionary statistic
17468 dictstat_fp
= fopen (dictstat
, "wb");
17472 lock_file (dictstat_fp
);
17474 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
17476 fclose (dictstat_fp
);
17480 data
.devices_status
= STATUS_RUNNING
;
17482 if (initial_restore_done
== 0)
17484 if (data
.restore_disable
== 0) cycle_restore ();
17486 initial_restore_done
= 1;
17489 hc_timer_set (&data
.timer_running
);
17491 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
17493 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
17495 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
17496 if (quiet
== 0) fflush (stdout
);
17499 else if (wordlist_mode
== WL_MODE_STDIN
)
17501 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
17502 if (data
.quiet
== 0) log_info ("");
17505 time_t runtime_start
;
17507 time (&runtime_start
);
17509 data
.runtime_start
= runtime_start
;
17512 * create cracker threads
17515 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (data
.devices_cnt
, sizeof (hc_thread_t
));
17517 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17519 hc_device_param_t
*device_param
= &devices_param
[device_id
];
17521 if (wordlist_mode
== WL_MODE_STDIN
)
17523 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
17527 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
17531 // wait for crack threads to exit
17533 hc_thread_wait (data
.devices_cnt
, c_threads
);
17535 local_free (c_threads
);
17541 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
17543 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17545 if (data
.devices_status
== STATUS_CRACKED
) break;
17546 if (data
.devices_status
== STATUS_ABORTED
) break;
17548 if (data
.devices_status
== STATUS_BYPASS
)
17550 data
.devices_status
= STATUS_RUNNING
;
17553 if (induction_dictionaries_cnt
)
17555 unlink (induction_dictionaries
[0]);
17558 free (induction_dictionaries
);
17560 if (attack_mode
!= ATTACK_MODE_BF
)
17562 induction_dictionaries
= scan_directory (induction_directory
);
17564 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
17567 if (benchmark
== 0)
17569 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
17571 if (quiet
== 0) clear_prompt ();
17573 if (quiet
== 0) log_info ("");
17581 if (quiet
== 0) status_display ();
17584 if (quiet
== 0) log_info ("");
17588 if (attack_mode
== ATTACK_MODE_BF
)
17592 rd
->dictpos
= dictpos
;
17596 if (induction_dictionaries_cnt
)
17598 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
17604 rd
->dictpos
= dictpos
;
17608 time_t runtime_stop
;
17610 time (&runtime_stop
);
17612 data
.runtime_stop
= runtime_stop
;
17614 logfile_sub_uint (runtime_start
);
17615 logfile_sub_uint (runtime_stop
);
17617 logfile_sub_msg ("STOP");
17619 global_free (subid
);
17622 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
17624 if (data
.devices_status
== STATUS_CRACKED
) break;
17625 if (data
.devices_status
== STATUS_ABORTED
) break;
17626 if (data
.devices_status
== STATUS_QUIT
) break;
17628 if (data
.devices_status
== STATUS_BYPASS
)
17630 data
.devices_status
= STATUS_RUNNING
;
17634 // 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
17636 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
17638 if (data
.wordlist_mode
== WL_MODE_FILE
)
17640 if (data
.dictfile
== NULL
)
17642 if (dictfiles
!= NULL
)
17644 data
.dictfile
= dictfiles
[0];
17646 hc_timer_set (&data
.timer_running
);
17651 // NOTE: combi is okay because it is already set beforehand
17652 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
17654 if (data
.dictfile
== NULL
)
17656 if (dictfiles
!= NULL
)
17658 hc_timer_set (&data
.timer_running
);
17660 data
.dictfile
= dictfiles
[0];
17664 else if (attack_mode
== ATTACK_MODE_BF
)
17666 if (data
.mask
== NULL
)
17668 hc_timer_set (&data
.timer_running
);
17670 data
.mask
= masks
[0];
17674 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
17676 data
.devices_status
= STATUS_EXHAUSTED
;
17679 // if cracked / aborted remove last induction dictionary
17681 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
17683 struct stat induct_stat
;
17685 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
17687 unlink (induction_dictionaries
[file_pos
]);
17691 // wait for non-interactive threads
17693 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
17695 hc_thread_wait (1, &ni_threads
[thread_idx
]);
17698 local_free (ni_threads
);
17700 // wait for interactive threads
17702 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
17704 hc_thread_wait (1, &i_thread
);
17707 // we dont need restore file anymore
17708 if (data
.restore_disable
== 0)
17710 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
17712 unlink (eff_restore_file
);
17713 unlink (new_restore_file
);
17721 // finally save left hashes
17723 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
17732 if (benchmark
== 1)
17734 status_benchmark ();
17736 if (status_automat
== 0)
17743 if (quiet
== 0) clear_prompt ();
17745 if (quiet
== 0) log_info ("");
17753 if (quiet
== 0) status_display ();
17756 if (quiet
== 0) log_info ("");
17759 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17761 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17763 if (device_param
->skipped
) continue;
17765 local_free (device_param
->combs_buf
);
17767 local_free (device_param
->hooks_buf
);
17769 local_free (device_param
->device_name
);
17771 local_free (device_param
->device_name_chksum
);
17773 local_free (device_param
->device_version
);
17775 local_free (device_param
->driver_version
);
17777 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
17778 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_buf
);
17779 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_pws_amp_buf
);
17780 if (device_param
->d_rules
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules
);
17781 if (device_param
->d_rules_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_rules_c
);
17782 if (device_param
->d_combs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs
);
17783 if (device_param
->d_combs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_combs_c
);
17784 if (device_param
->d_bfs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs
);
17785 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bfs_c
);
17786 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_a
);
17787 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_b
);
17788 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_c
);
17789 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s1_d
);
17790 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_a
);
17791 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_b
);
17792 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_c
);
17793 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_bitmap_s2_d
);
17794 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_plain_bufs
);
17795 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_buf
);
17796 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_digests_shown
);
17797 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_salt_bufs
);
17798 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_esalt_bufs
);
17799 if (device_param
->d_tmps
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tmps
);
17800 if (device_param
->d_hooks
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_hooks
);
17801 if (device_param
->d_result
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_result
);
17802 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_scryptV_buf
);
17803 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_root_css_buf
);
17804 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_markov_css_buf
);
17805 if (device_param
->d_tm_c
) hc_clReleaseMemObject (data
.ocl
, device_param
->d_tm_c
);
17807 if (device_param
->kernel1
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel1
);
17808 if (device_param
->kernel12
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel12
);
17809 if (device_param
->kernel2
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel2
);
17810 if (device_param
->kernel23
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel23
);
17811 if (device_param
->kernel3
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel3
);
17812 if (device_param
->kernel_mp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp
);
17813 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_l
);
17814 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_mp_r
);
17815 if (device_param
->kernel_tm
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_tm
);
17816 if (device_param
->kernel_amp
) hc_clReleaseKernel (data
.ocl
, device_param
->kernel_amp
);
17818 if (device_param
->program
) hc_clReleaseProgram (data
.ocl
, device_param
->program
);
17819 if (device_param
->program_mp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_mp
);
17820 if (device_param
->program_amp
) hc_clReleaseProgram (data
.ocl
, device_param
->program_amp
);
17822 if (device_param
->command_queue
) hc_clReleaseCommandQueue (data
.ocl
, device_param
->command_queue
);
17823 if (device_param
->context
) hc_clReleaseContext (data
.ocl
, device_param
->context
);
17826 // reset default fan speed
17829 if (gpu_temp_disable
== 0)
17832 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
17834 hc_thread_mutex_lock (mux_adl
);
17836 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17838 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17840 if (device_param
->skipped
) continue;
17842 if (data
.hm_device
[device_id
].fan_supported
== 1)
17844 int fanspeed
= temp_retain_fanspeed_value
[device_id
];
17846 if (fanspeed
== -1) continue;
17848 int rc
= hm_set_fanspeed_with_device_id_amd (device_id
, fanspeed
);
17850 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", device_id
);
17854 hc_thread_mutex_unlock (mux_adl
);
17860 // reset power tuning
17862 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
17864 hc_thread_mutex_lock (mux_adl
);
17866 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
17868 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
17870 if (device_param
->skipped
) continue;
17872 if (data
.hm_device
[device_id
].od_version
== 6)
17874 // check powertune capabilities first, if not available then skip device
17876 int powertune_supported
= 0;
17878 if ((hm_ADL_Overdrive6_PowerControl_Caps (data
.hm_amd
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
17880 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
17885 if (powertune_supported
!= 0)
17887 // powercontrol settings
17889 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
)
17891 log_info ("ERROR: Failed to restore the ADL PowerControl values");
17898 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
17900 performance_state
->iNumberOfPerformanceLevels
= 2;
17902 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iEngineClock
;
17903 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
17904 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[0].iMemoryClock
;
17905 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
17907 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
)
17909 log_info ("ERROR: Failed to restore ADL performance state");
17914 local_free (performance_state
);
17919 hc_thread_mutex_unlock (mux_adl
);
17923 if (gpu_temp_disable
== 0)
17925 #if defined(HAVE_NVML) || defined(HAVE_NVAPI)
17928 #if defined(LINUX) && defined(HAVE_NVML)
17930 hm_NVML_nvmlShutdown (data
.hm_nv
);
17932 nvml_close (data
.hm_nv
);
17934 #elif defined(WIN) && (HAVE_NVAPI)
17936 hm_NvAPI_Unload (data
.hm_nv
);
17938 nvapi_close (data
.hm_nv
);
17949 hm_ADL_Main_Control_Destroy (data
.hm_amd
);
17951 adl_close (data
.hm_amd
);
17952 data
.hm_amd
= NULL
;
17956 #endif // HAVE_HWMON
17960 local_free (masks
);
17962 local_free (dictstat_base
);
17964 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
17966 pot_t
*pot_ptr
= &pot
[pot_pos
];
17968 hash_t
*hash
= &pot_ptr
->hash
;
17970 local_free (hash
->digest
);
17974 local_free (hash
->salt
);
17980 local_free (all_kernel_rules_cnt
);
17981 local_free (all_kernel_rules_buf
);
17983 local_free (wl_data
->buf
);
17984 local_free (wl_data
);
17986 local_free (bitmap_s1_a
);
17987 local_free (bitmap_s1_b
);
17988 local_free (bitmap_s1_c
);
17989 local_free (bitmap_s1_d
);
17990 local_free (bitmap_s2_a
);
17991 local_free (bitmap_s2_b
);
17992 local_free (bitmap_s2_c
);
17993 local_free (bitmap_s2_d
);
17996 local_free (temp_retain_fanspeed_value
);
17998 local_free (od_clock_mem_status
);
17999 local_free (od_power_control_status
);
18003 global_free (devices_param
);
18005 global_free (kernel_rules_buf
);
18007 global_free (root_css_buf
);
18008 global_free (markov_css_buf
);
18010 global_free (digests_buf
);
18011 global_free (digests_shown
);
18012 global_free (digests_shown_tmp
);
18014 global_free (salts_buf
);
18015 global_free (salts_shown
);
18017 global_free (esalts_buf
);
18019 global_free (words_progress_done
);
18020 global_free (words_progress_rejected
);
18021 global_free (words_progress_restored
);
18023 if (pot_fp
) fclose (pot_fp
);
18025 if (data
.devices_status
== STATUS_QUIT
) break;
18028 // destroy others mutex
18030 hc_thread_mutex_delete (mux_dispatcher
);
18031 hc_thread_mutex_delete (mux_counter
);
18032 hc_thread_mutex_delete (mux_display
);
18033 hc_thread_mutex_delete (mux_adl
);
18037 local_free (eff_restore_file
);
18038 local_free (new_restore_file
);
18044 tuning_db_destroy (tuning_db
);
18048 local_free (loopback_file
);
18050 if (loopback
== 1) unlink (loopback_file
);
18052 // induction directory
18054 if (induction_dir
== NULL
)
18056 if (attack_mode
!= ATTACK_MODE_BF
)
18058 if (rmdir (induction_directory
) == -1)
18060 if (errno
== ENOENT
)
18062 // good, we can ignore
18064 else if (errno
== ENOTEMPTY
)
18066 // good, we can ignore
18070 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
18076 local_free (induction_directory
);
18080 // outfile-check directory
18082 if (outfile_check_dir
== NULL
)
18084 if (rmdir (outfile_check_directory
) == -1)
18086 if (errno
== ENOENT
)
18088 // good, we can ignore
18090 else if (errno
== ENOTEMPTY
)
18092 // good, we can ignore
18096 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
18102 local_free (outfile_check_directory
);
18109 logfile_top_uint (proc_start
);
18110 logfile_top_uint (proc_stop
);
18112 logfile_top_msg ("STOP");
18114 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
18115 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
18117 if (data
.ocl
) ocl_close (data
.ocl
);
18119 if (data
.devices_status
== STATUS_ABORTED
) return 2;
18120 if (data
.devices_status
== STATUS_QUIT
) return 2;
18121 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
18122 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
18123 if (data
.devices_status
== STATUS_CRACKED
) return 0;