2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include <rp_gpu_on_cpu.h>
11 const char *PROGNAME
= "oclHashcat";
12 const char *VERSION_TXT
= "2.01";
13 const uint VERSION_BIN
= 201;
14 const uint RESTORE_MIN
= 201;
16 #define INCR_RULES 10000
17 #define INCR_SALTS 100000
18 #define INCR_MASKS 1000
24 #define MARKOV_THRESHOLD 0
25 #define MARKOV_DISABLE 0
26 #define MARKOV_CLASSIC 0
28 #define BENCHMARK_MODE 1
30 #define RESTORE_TIMER 60
31 #define RESTORE_DISABLE 0
33 #define STATUS_TIMER 10
34 #define STATUS_AUTOMAT 0
36 #define WEAK_HASH_THRESHOLD 100
41 #define REMOVE_TIMER 60
45 #define POTFILE_DISABLE 0
48 #define RP_GEN_FUNC_MIN 1
49 #define RP_GEN_FUNC_MAX 4
51 #define RULE_BUF_L ":"
52 #define RULE_BUF_R ":"
57 #define HEX_WORDLIST 0
58 #define OUTFILE_FORMAT 3
59 #define OUTFILE_AUTOHEX 1
60 #define OUTFILE_CHECK_TIMER 5
63 #define SEGMENT_SIZE 32
65 #define INCREMENT_MIN 1
66 #define INCREMENT_MAX PW_MAX
70 #define GPU_TEMP_DISABLE 0
71 #define GPU_TEMP_ABORT 90
72 #define GPU_TEMP_RETAIN 80
73 #define WORKLOAD_PROFILE 2
76 #define GPU_RULES 1024
77 #define GPU_COMBS 1024
79 #define GPU_THREADS 64
80 #define POWERTUNE_ENABLE 0
81 #define LOGFILE_DISABLE 0
84 #define WL_MODE_STDIN 1
85 #define WL_MODE_FILE 2
86 #define WL_MODE_MASK 3
88 #define HL_MODE_FILE 4
91 #define HLFMT_HASHCAT 0
92 #define HLFMT_PWDUMP 1
93 #define HLFMT_PASSWD 2
94 #define HLFMT_SHADOW 3
97 #define HLFMT_NETNTLM1 7
98 #define HLFMT_NETNTLM2 8
99 #define HLFMT_NSLDAP 9
100 #define HLFMT_NSLDAPS 10
101 #define HLFMTS_CNT 11
103 #define ATTACK_MODE_STRAIGHT 0
104 #define ATTACK_MODE_COMBI 1
105 #define ATTACK_MODE_TOGGLE 2
106 #define ATTACK_MODE_BF 3
107 #define ATTACK_MODE_PERM 4
108 #define ATTACK_MODE_TABLE 5
109 #define ATTACK_MODE_HYBRID1 6
110 #define ATTACK_MODE_HYBRID2 7
111 #define ATTACK_MODE_NONE 100
113 #define ATTACK_KERN_STRAIGHT 0
114 #define ATTACK_KERN_COMBI 1
115 #define ATTACK_KERN_BF 3
116 #define ATTACK_KERN_NONE 100
118 #define ATTACK_EXEC_ON_CPU 10
119 #define ATTACK_EXEC_ON_GPU 11
121 #define COMBINATOR_MODE_BASE_LEFT 10001
122 #define COMBINATOR_MODE_BASE_RIGHT 10002
124 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
125 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
127 #define MAX_CUT_TRIES 4
129 #define MAX_DICTSTAT 10000
131 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 128
133 #define global_free(attr) \
135 myfree ((void *) data.attr); \
140 #define local_free(attr) \
142 myfree ((void *) attr); \
147 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
283 static void (*get_next_word_func
) (char *, uint32_t, uint32_t *, uint32_t *);
289 static unsigned int full01
= 0x01010101;
290 static unsigned int full80
= 0x80808080;
292 int SUPPRESS_OUTPUT
= 0;
294 hc_thread_mutex_t mux_adl
;
295 hc_thread_mutex_t mux_counter
;
296 hc_thread_mutex_t mux_dispatcher
;
297 hc_thread_mutex_t mux_display
;
299 hc_global_data_t data
;
301 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
303 const char *USAGE_MINI
[] =
305 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
307 "Try --help for more help.",
311 const char *USAGE_BIG
[] =
313 "%s, advanced password recovery",
315 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
323 " -m, --hash-type=NUM Hash-type, see references below",
324 " -a, --attack-mode=NUM Attack-mode, see references below",
325 " -V, --version Print version",
326 " -h, --help Print help",
327 " --quiet Suppress output",
331 " -b, --benchmark Run benchmark",
332 " --benchmark-mode=NUM Benchmark-mode, see references below",
336 " --hex-charset Assume charset is given in hex",
337 " --hex-salt Assume salt is given in hex",
338 " --hex-wordlist Assume words in wordlist is given in hex",
339 " --force Ignore warnings",
340 " --status Enable automatic update of the status-screen",
341 " --status-timer=NUM Seconds between status-screen update",
342 " --status-automat Display the status view in a machine readable format",
343 " --loopback Add new plains to induct directory",
344 " --weak-hash-threshold=NUM Threshold when to stop checking for weak hashes, default is 100 salts",
348 " --markov-hcstat=FILE Specify hcstat file to use, default is hashcat.hcstat",
349 " --markov-disable Disables markov-chains, emulates classic brute-force",
350 " --markov-classic Enables classic markov-chains, no per-position enhancement",
351 " -t, --markov-threshold=NUM Threshold when to stop accepting new markov-chains",
355 " --runtime=NUM Abort session after NUM seconds of runtime",
356 " --session=STR Define specific session name",
357 " --restore Restore session from --session",
358 " --restore-disable Do not write restore file",
362 " -o, --outfile=FILE Define outfile for recovered hash",
363 " --outfile-format=NUM Define outfile-format for recovered hash, see references below",
364 " --outfile-autohex-disable Disable the use of $HEX[] in output plains",
365 " --outfile-check-timer=NUM Seconds between outfile checks",
366 " -p, --separator=CHAR Separator char for hashlists and outfile",
367 " --show Show cracked passwords only",
368 " --left Show un-cracked passwords only",
369 " --username Enable ignoring of usernames in hashfile (recommended: also use --show)",
370 " --remove Enable remove of hash once it is cracked",
371 " --remove-timer=NUM Update input hash file each NUM seconds",
372 " --potfile-disable Do not write potfile",
373 " --debug-mode=NUM Defines the debug mode (hybrid only by using rules), see references below",
374 " --debug-file=FILE Output file for debugging rules (see also --debug-mode)",
375 " --induction-dir=FOLDER Specify induction directory to use, default is $session.induct",
376 " --outfile-check-dir=FOLDER Specify the outfile directory which should be monitored, default is $session.outfiles",
377 " --logfile-disable Disable the logfile",
378 " --truecrypt-keyfiles=FILE Keyfiles used, seperate with comma",
382 " -c, --segment-size=NUM Size in MB to cache from the wordfile",
383 " --bitmap-min=NUM Minimum number of bits allowed for bitmaps",
384 " --bitmap-max=NUM Maximum number of bits allowed for bitmaps",
385 " --cpu-affinity=STR Locks to CPU devices, seperate with comma",
386 " -d, --gpu-devices=STR OpenCL devices to use, separate with comma",
387 " --gpu-platform=STR OpenCL platform to use, in case multiple OpenCL platforms are present",
388 " -w, --workload-profile=NUM Enable a specific workload profile, see references below",
389 " -n, --gpu-accel=NUM Workload tuning: 1, 8, 40, 80, 160",
390 " -u, --gpu-loops=NUM Workload fine-tuning: 8 - 1024",
391 " --gpu-temp-disable Disable temperature and fanspeed readings and triggers",
392 " --gpu-temp-abort=NUM Abort session if GPU temperature reaches NUM degrees celsius",
393 " --gpu-temp-retain=NUM Try to retain GPU temperature at NUM degrees celsius (AMD only)",
394 " --powertune-enable Enable automatic power tuning option (AMD OverDrive 6 only)",
395 " --scrypt-tmto=NUM Manually override automatically calculated TMTO value for scrypt",
399 " -s, --skip=NUM Skip number of words",
400 " -l, --limit=NUM Limit number of words",
401 " --keyspace Show keyspace base:mod values and quit",
405 " -j, --rule-left=RULE Single rule applied to each word from left dict",
406 " -k, --rule-right=RULE Single rule applied to each word from right dict",
407 " -r, --rules-file=FILE Rules-file, multi use: -r 1.rule -r 2.rule",
408 " -g, --generate-rules=NUM Generate NUM random rules",
409 " --generate-rules-func-min=NUM Force NUM functions per random rule min",
410 " --generate-rules-func-max=NUM Force NUM functions per random rule max",
411 " --generate-rules-seed=NUM Force RNG seed to NUM",
413 "* Custom charsets:",
415 " -1, --custom-charset1=CS User-defined charsets",
416 " -2, --custom-charset2=CS Example:",
417 " -3, --custom-charset3=CS --custom-charset1=?dabcdef : sets charset ?1 to 0123456789abcdef",
418 " -4, --custom-charset4=CS -2 mycharset.hcchr : sets charset ?2 to chars contained in file",
422 " -i, --increment Enable increment mode",
423 " --increment-min=NUM Start incrementing at NUM",
424 " --increment-max=NUM Stop incrementing at NUM",
430 "* Workload Profile:",
432 " 1 = Reduced performance profile (low latency desktop)",
433 " 2 = Default performance profile",
434 " 3 = Tuned performance profile (high latency desktop)",
436 "* Benchmark Settings:",
438 " 0 = Manual Tuning",
439 " 1 = Performance Tuning, default",
441 "* Outfile Formats:",
445 " 3 = hash[:salt]:plain",
447 " 5 = hash[:salt]:hex_plain",
448 " 6 = plain:hex_plain",
449 " 7 = hash[:salt]:plain:hex_plain",
451 " 9 = hash[:salt]:crackpos",
452 " 10 = plain:crackpos",
453 " 11 = hash[:salt]:plain:crackpos",
454 " 12 = hex_plain:crackpos",
455 " 13 = hash[:salt]:hex_plain:crackpos",
456 " 14 = plain:hex_plain:crackpos",
457 " 15 = hash[:salt]:plain:hex_plain:crackpos",
459 "* Debug mode output formats (for hybrid mode only, by using rules):",
461 " 1 = save finding rule",
462 " 2 = save original word",
463 " 3 = save original word and finding rule",
464 " 4 = save original word, finding rule and modified plain",
466 "* Built-in charsets:",
468 " ?l = abcdefghijklmnopqrstuvwxyz",
469 " ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ",
471 " ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
480 " 6 = Hybrid dict + mask",
481 " 7 = Hybrid mask + dict",
485 "[[ Roll-your-own: Raw Hashes ]]",
494 " 5000 = SHA-3(Keccak)",
498 " 6900 = GOST R 34.11-94",
499 " 11700 = GOST R 34.11-2012 (Streebog) 256-bit",
500 " 11800 = GOST R 34.11-2012 (Streebog) 512-bit",
502 "[[ Roll-your-own: Iterated and / or Salted Hashes ]]",
504 " 10 = md5($pass.$salt)",
505 " 20 = md5($salt.$pass)",
506 " 30 = md5(unicode($pass).$salt)",
507 " 40 = md5($salt.unicode($pass))",
508 " 3800 = md5($salt.$pass.$salt)",
509 " 3710 = md5($salt.md5($pass))",
510 " 2600 = md5(md5($pass)",
511 " 4300 = md5(strtoupper(md5($pass)))",
512 " 4400 = md5(sha1($pass))",
513 " 110 = sha1($pass.$salt)",
514 " 120 = sha1($salt.$pass)",
515 " 130 = sha1(unicode($pass).$salt)",
516 " 140 = sha1($salt.unicode($pass))",
517 " 4500 = sha1(sha1($pass)",
518 " 4700 = sha1(md5($pass))",
519 " 4900 = sha1($salt.$pass.$salt)",
520 " 1410 = sha256($pass.$salt)",
521 " 1420 = sha256($salt.$pass)",
522 " 1430 = sha256(unicode($pass).$salt)",
523 " 1440 = sha256($salt.unicode($pass))",
524 " 1710 = sha512($pass.$salt)",
525 " 1720 = sha512($salt.$pass)",
526 " 1730 = sha512(unicode($pass).$salt)",
527 " 1740 = sha512($salt.unicode($pass))",
529 "[[ Roll-your-own: Authenticated Hashes ]]",
531 " 50 = HMAC-MD5 (key = $pass)",
532 " 60 = HMAC-MD5 (key = $salt)",
533 " 150 = HMAC-SHA1 (key = $pass)",
534 " 160 = HMAC-SHA1 (key = $salt)",
535 " 1450 = HMAC-SHA256 (key = $pass)",
536 " 1460 = HMAC-SHA256 (key = $salt)",
537 " 1750 = HMAC-SHA512 (key = $pass)",
538 " 1760 = HMAC-SHA512 (key = $salt)",
544 " 11900 = PBKDF2-HMAC-MD5",
545 " 12000 = PBKDF2-HMAC-SHA1",
546 " 10900 = PBKDF2-HMAC-SHA256",
547 " 12100 = PBKDF2-HMAC-SHA512",
549 "[[ Network protocols, Challenge-Response ]]",
553 " 4800 = iSCSI CHAP authentication, MD5(Chap)",
554 " 5300 = IKE-PSK MD5",
555 " 5400 = IKE-PSK SHA1",
557 " 5500 = NetNTLMv1 + ESS",
559 " 7300 = IPMI2 RAKP HMAC-SHA1",
560 " 7500 = Kerberos 5 AS-REQ Pre-Auth etype 23",
561 " 8300 = DNSSEC (NSEC3)",
563 " 11100 = PostgreSQL Challenge-Response Authentication (MD5)",
564 " 11200 = MySQL Challenge-Response Authentication (SHA1)",
565 " 11400 = SIP digest authentication (MD5)",
567 "[[ Forums, CMS, E-Commerce, Frameworks, Middleware, Wiki, Management ]]",
569 " 121 = SMF (Simple Machines Forum)",
571 " 2611 = vBulletin < v3.8.5",
572 " 2711 = vBulletin > v3.8.5",
574 " 2811 = IPB (Invison Power Board)",
575 " 8400 = WBB3 (Woltlab Burning Board)",
576 " 11 = Joomla < 2.5.18",
577 " 400 = Joomla > 2.5.18",
583 " 11000 = PrestaShop",
584 " 124 = Django (SHA-1)",
585 " 10000 = Django (PBKDF2-SHA256)",
586 " 3711 = Mediawiki B type",
589 "[[ Database Server ]]",
592 " 131 = MSSQL(2000)",
593 " 132 = MSSQL(2005)",
594 " 1731 = MSSQL(2012)",
595 " 1731 = MSSQL(2014)",
597 " 300 = MySQL4.1/MySQL5",
598 " 3100 = Oracle H: Type (Oracle 7+)",
599 " 112 = Oracle S: Type (Oracle 11+)",
600 " 12300 = Oracle T: Type (Oracle 12+)",
601 " 8000 = Sybase ASE",
603 "[[ HTTP, SMTP, LDAP Server]]",
605 " 141 = EPiServer 6.x < v4",
606 " 1441 = EPiServer 6.x > v4",
607 " 1600 = Apache $apr1$",
608 " 12600 = ColdFusion 10+",
609 " 1421 = hMailServer",
610 " 101 = nsldap, SHA-1(Base64), Netscape LDAP SHA",
611 " 111 = nsldaps, SSHA-1(Base64), Netscape LDAP SSHA",
612 " 1711 = SSHA-512(Base64), LDAP {SSHA512}",
618 "[[ Operating-Systems ]]",
622 " 1100 = Domain Cached Credentials (DCC), MS Cache",
623 " 2100 = Domain Cached Credentials 2 (DCC2), MS Cache 2",
624 " 12800 = MS-AzureSync PBKDF2-HMAC-SHA256",
625 " 1500 = descrypt, DES(Unix), Traditional DES",
626 " 12400 = BSDiCrypt, Extended DES",
627 " 500 = md5crypt $1$, MD5(Unix)",
628 " 3200 = bcrypt $2*$, Blowfish(Unix)",
629 " 7400 = sha256crypt $5$, SHA256(Unix)",
630 " 1800 = sha512crypt $6$, SHA512(Unix)",
637 " 7100 = OSX v10.10",
638 " 6300 = AIX {smd5}",
639 " 6700 = AIX {ssha1}",
640 " 6400 = AIX {ssha256}",
641 " 6500 = AIX {ssha512}",
644 " 500 = Cisco-IOS $1$",
645 " 5700 = Cisco-IOS $4$",
646 " 9200 = Cisco-IOS $8$",
647 " 9300 = Cisco-IOS $9$",
648 " 22 = Juniper Netscreen/SSG (ScreenOS)",
649 " 501 = Juniper IVE",
650 " 5800 = Android PIN",
651 " 8100 = Citrix Netscaler",
656 "[[ Enterprise Application Software (EAS) ]]",
658 " 7700 = SAP CODVN B (BCODE)",
659 " 7800 = SAP CODVN F/G (PASSCODE)",
660 " 10300 = SAP CODVN H (PWDSALTEDHASH) iSSHA-1",
661 " 8600 = Lotus Notes/Domino 5",
662 " 8700 = Lotus Notes/Domino 6",
663 " 9100 = Lotus Notes/Domino 8",
671 "[[ Full-Disk encryptions (FDE) ]]",
673 " 62XY = TrueCrypt 5.0+",
674 " X = 1 = PBKDF2-HMAC-RipeMD160",
675 " X = 2 = PBKDF2-HMAC-SHA512",
676 " X = 3 = PBKDF2-HMAC-Whirlpool",
677 " X = 4 = PBKDF2-HMAC-RipeMD160 + boot-mode",
678 " Y = 1 = XTS 512 bit (Ciphers: AES or Serpent or Twofish)",
679 " Y = 2 = XTS 1024 bit (Ciphers: AES or Serpent or Twofish or AES-Twofish or Serpent-AES or Twofish-Serpent)",
680 " Y = 3 = XTS 1536 bit (Ciphers: All)",
681 " 8800 = Android FDE < v4.3",
686 " 9700 = MS Office <= 2003 MD5 + RC4, oldoffice$0, oldoffice$1",
687 " 9710 = MS Office <= 2003 MD5 + RC4, collider-mode #1",
688 " 9720 = MS Office <= 2003 MD5 + RC4, collider-mode #2",
689 " 9800 = MS Office <= 2003 SHA1 + RC4, oldoffice$3, oldoffice$4",
690 " 9810 = MS Office <= 2003 SHA1 + RC4, collider-mode #1",
691 " 9820 = MS Office <= 2003 SHA1 + RC4, collider-mode #2",
692 " 9400 = MS Office 2007",
693 " 9500 = MS Office 2010",
694 " 9600 = MS Office 2013",
695 " 10400 = PDF 1.1 - 1.3 (Acrobat 2 - 4)",
696 " 10410 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #1",
697 " 10420 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #2",
698 " 10500 = PDF 1.4 - 1.6 (Acrobat 5 - 8)",
699 " 10600 = PDF 1.7 Level 3 (Acrobat 9)",
700 " 10700 = PDF 1.7 Level 8 (Acrobat 10 - 11)",
702 "[[ Password Managers ]]",
704 " 9000 = Password Safe v2",
705 " 5200 = Password Safe v3",
707 " 6600 = 1Password, agilekeychain",
708 " 8200 = 1Password, cloudkeychain",
709 " 11300 = Bitcoin/Litecoin wallet.dat",
710 " 12700 = Blockchain, My Wallet",
716 * oclHashcat specific functions
719 void status_display_automat ()
723 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
729 fprintf (out
, "SPEED\t");
731 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
733 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
735 uint64_t speed_cnt
= 0;
738 for (int i
= 0; i
< SPEED_CACHE
; i
++)
742 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
744 if (rec_ms
> SPEED_MAXAGE
) continue;
746 speed_cnt
+= device_param
->speed_cnt
[i
];
747 speed_ms
+= device_param
->speed_ms
[i
];
750 speed_cnt
/= SPEED_CACHE
;
751 speed_ms
/= SPEED_CACHE
;
753 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
760 uint64_t words_cur
= get_lowest_words_done ();
762 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
768 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
770 if (salts_left
== 0) salts_left
= 1;
772 uint64_t progress_total
= data
.words_cnt
* salts_left
;
774 uint64_t all_done
= 0;
775 uint64_t all_rejected
= 0;
776 uint64_t all_restored
= 0;
778 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
782 // otherwise the final cracked status shows 0/XXX progress
784 if (data
.salts_shown
[salt_pos
] == 1) continue;
787 all_done
+= data
.words_progress_done
[salt_pos
];
788 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
789 all_restored
+= data
.words_progress_restored
[salt_pos
];
792 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
793 uint64_t progress_end
= progress_total
;
795 uint64_t progress_skip
= 0;
799 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
801 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
802 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
803 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
808 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
810 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
811 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
812 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
815 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
816 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
818 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
824 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
825 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
831 if (data
.gpu_temp_disable
== 0)
833 fprintf (out
, "TEMP\t");
835 hc_thread_mutex_lock (mux_adl
);
837 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
839 int temp
= hm_get_temperature_with_device_id (i
);
841 fprintf (out
, "%d\t", temp
);
844 hc_thread_mutex_unlock (mux_adl
);
859 void status_display ()
861 if (data
.devices_status
== STATUS_INIT
) return;
862 if (data
.devices_status
== STATUS_STARTING
) return;
863 if (data
.devices_status
== STATUS_BYPASS
) return;
865 if (data
.status_automat
== 1)
867 status_display_automat ();
876 log_info ("Session.Name...: %s", data
.session
);
878 char *status_type
= strstatus (data
.devices_status
);
880 uint hash_mode
= data
.hash_mode
;
882 char *hash_type
= strhashtype (hash_mode
); // not a bug
884 log_info ("Status.........: %s", status_type
);
890 if (data
.rp_files_cnt
)
894 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
896 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
899 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
901 log_info ("Rules.Type.....: %s", tmp_buf
);
908 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
910 if (data
.rp_gen_seed
)
912 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
920 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
922 if (data
.wordlist_mode
== WL_MODE_FILE
)
924 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
926 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
928 log_info ("Input.Mode.....: Pipe");
931 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
933 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
934 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
936 else if (data
.attack_mode
== ATTACK_MODE_BF
)
938 char *mask
= data
.mask
;
942 uint mask_len
= data
.css_cnt
;
944 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
948 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
950 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
952 mask_len
-= data
.salts_buf
[0].salt_len
;
956 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
958 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
961 if (data
.maskcnt
> 1)
963 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
965 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
968 log_info ("Input.Mode.....: %s", tmp_buf
);
973 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
975 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
976 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
978 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
980 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
981 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
984 if (data
.digests_cnt
== 1)
986 if (data
.hash_mode
== 2500)
988 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
992 char *pke_ptr
= (char *) pke
;
994 for (uint i
= 0; i
< 25; i
++)
996 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
1002 memcpy (mac1
, pke_ptr
+ 23, 6);
1003 memcpy (mac2
, pke_ptr
+ 29, 6);
1005 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1006 (char *) data
.salts_buf
[0].salt_buf
,
1020 else if (data
.hash_mode
== 5200)
1022 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1024 else if (data
.hash_mode
== 9000)
1026 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1028 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1030 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1036 ascii_digest (out_buf
, 0, 0);
1039 if (strlen (out_buf
) > 40)
1047 log_info ("Hash.Target....: %s", out_buf
);
1052 if (data
.hash_mode
== 3000)
1054 char out_buf1
[4096];
1055 char out_buf2
[4096];
1057 ascii_digest (out_buf1
, 0, 0);
1058 ascii_digest (out_buf2
, 0, 1);
1060 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1064 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1068 log_info ("Hash.Type......: %s", hash_type
);
1074 uint64_t speed_cnt
[DEVICES_MAX
];
1075 float speed_ms
[DEVICES_MAX
];
1077 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1079 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1081 // we need to clear values (set to 0) because in case the gpu does
1082 // not get new candidates it idles around but speed display would
1083 // show it as working.
1084 // if we instantly set it to 0 after reading it happens that the
1085 // speed can be shown as zero if the users refreshs to fast.
1086 // therefore, we add a timestamp when a stat was recorded and if its
1087 // to old we will not use it
1089 speed_cnt
[device_id
] = 0;
1090 speed_ms
[device_id
] = 0;
1092 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1096 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
1098 if (rec_ms
> SPEED_MAXAGE
) continue;
1100 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1101 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1104 speed_cnt
[device_id
] /= SPEED_CACHE
;
1105 speed_ms
[device_id
] /= SPEED_CACHE
;
1108 float hashes_all_ms
= 0;
1110 float hashes_dev_ms
[DEVICES_MAX
];
1112 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1114 hashes_dev_ms
[device_id
] = 0;
1116 if (speed_ms
[device_id
])
1118 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1120 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1128 float ms_running
= 0;
1130 hc_timer_get (data
.timer_running
, ms_running
);
1132 float ms_paused
= data
.ms_paused
;
1134 if (data
.devices_status
== STATUS_PAUSED
)
1136 float ms_paused_tmp
= 0;
1138 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1140 ms_paused
+= ms_paused_tmp
;
1145 __time64_t sec_run
= ms_running
/ 1000;
1149 time_t sec_run
= ms_running
/ 1000;
1155 char display_run
[32];
1163 tmp
= _gmtime64 (&sec_run
);
1167 tmp
= gmtime (&sec_run
);
1173 memcpy (&tm_run
, tmp
, sizeof (struct tm
));
1175 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1177 char *start
= ctime (&data
.proc_start
);
1179 size_t start_len
= strlen (start
);
1181 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1182 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1184 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1189 log_info ("Time.Started...: 0 secs");
1196 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
1198 if (salts_left
== 0) salts_left
= 1;
1200 uint64_t progress_total
= data
.words_cnt
* salts_left
;
1202 uint64_t all_done
= 0;
1203 uint64_t all_rejected
= 0;
1204 uint64_t all_restored
= 0;
1206 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1210 // otherwise the final cracked status shows 0/XXX progress
1212 if (data
.salts_shown
[salt_pos
] == 1) continue;
1215 all_done
+= data
.words_progress_done
[salt_pos
];
1216 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1217 all_restored
+= data
.words_progress_restored
[salt_pos
];
1220 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
1221 uint64_t progress_end
= progress_total
;
1223 uint64_t progress_skip
= 0;
1227 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
1229 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
1230 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1231 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1236 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
1238 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
1239 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1240 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1243 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
1244 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
1246 float speed_ms_real
= ms_running
- ms_paused
;
1247 uint64_t speed_plains_real
= all_done
;
1249 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1251 if (data
.devices_status
!= STATUS_CRACKED
)
1253 uint64_t words_per_ms
= 0;
1255 if (speed_plains_real
&& speed_ms_real
)
1257 words_per_ms
= speed_plains_real
/ speed_ms_real
;
1261 __time64_t sec_etc
= 0;
1268 uint64_t progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1270 uint64_t ms_left
= progress_left_relative_skip
/ words_per_ms
;
1272 sec_etc
= ms_left
/ 1000;
1277 log_info ("Time.Estimated.: 0 secs");
1279 else if ((uint64_t) sec_etc
> ETC_MAX
)
1281 log_info ("Time.Estimated.: > 10 Years");
1285 char display_etc
[32];
1293 tmp
= _gmtime64 (&sec_etc
);
1297 tmp
= gmtime (&sec_etc
);
1303 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1305 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1313 char *etc
= ctime (&now
);
1315 size_t etc_len
= strlen (etc
);
1317 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1318 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1320 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1326 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1328 char display_dev_cur
[16];
1330 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1332 strncpy (display_dev_cur
, "0.00", 4);
1334 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1336 log_info ("Speed.GPU.#%d...: %9sH/s", device_id
+ 1, display_dev_cur
);
1339 char display_all_cur
[16];
1341 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1343 strncpy (display_all_cur
, "0.00", 4);
1345 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1347 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*...: %9sH/s", display_all_cur
);
1349 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1350 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1352 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);
1356 if (data
.digests_cnt
> 100)
1358 time_t now
= time (NULL
);
1360 int cpt_cur_min
= 0;
1361 int cpt_cur_hour
= 0;
1362 int cpt_cur_day
= 0;
1364 for (int i
= 0; i
< CPT_BUF
; i
++)
1366 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1367 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1369 if ((timestamp
+ 60) > now
)
1371 cpt_cur_min
+= cracked
;
1374 if ((timestamp
+ 3600) > now
)
1376 cpt_cur_hour
+= cracked
;
1379 if ((timestamp
+ 86400) > now
)
1381 cpt_cur_day
+= cracked
;
1385 float cpt_avg_min
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 60);
1386 float cpt_avg_hour
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 3600);
1387 float cpt_avg_day
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 86400);
1389 if ((data
.cpt_start
+ 86400) < now
)
1391 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1399 else if ((data
.cpt_start
+ 3600) < now
)
1401 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1408 else if ((data
.cpt_start
+ 60) < now
)
1410 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1418 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1427 uint64_t restore_point
= get_lowest_words_done ();
1429 uint64_t restore_total
= data
.words_base
;
1431 float percent_restore
= 0;
1433 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1435 if (progress_end_relative_skip
)
1437 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1439 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1440 float percent_rejected
= 0.0;
1444 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1447 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);
1448 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1450 if (data
.restore_disable
== 0)
1452 if (percent_finished
!= 1)
1454 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1461 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1463 log_info ("Progress.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1464 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1466 if (data
.restore_disable
== 0)
1468 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1473 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1474 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1476 // --restore not allowed if stdin is used -- really? why?
1478 //if (data.restore_disable == 0)
1480 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1485 if (data
.gpu_temp_disable
== 0)
1487 hc_thread_mutex_lock (mux_adl
);
1489 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
1491 if (data
.hm_device
[i
].fan_supported
== 1)
1493 const int temperature
= hm_get_temperature_with_device_id (i
);
1494 const int utilization
= hm_get_utilization_with_device_id (i
);
1495 const int fanspeed
= hm_get_fanspeed_with_device_id (i
);
1497 if (data
.vendor_id
== VENDOR_ID_AMD
)
1499 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1502 if (data
.vendor_id
== VENDOR_ID_NV
)
1505 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1507 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2drpm Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1513 const int temperature
= hm_get_temperature_with_device_id (i
);
1514 const int utilization
= hm_get_utilization_with_device_id (i
);
1516 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, N/A Fan", i
+ 1, utilization
, temperature
);
1520 hc_thread_mutex_unlock (mux_adl
);
1524 static void status_benchmark ()
1526 if (data
.devices_status
== STATUS_INIT
) return;
1527 if (data
.devices_status
== STATUS_STARTING
) return;
1529 if (data
.words_cnt
== 0) return;
1531 uint64_t speed_cnt
[DEVICES_MAX
];
1532 float speed_ms
[DEVICES_MAX
];
1536 for (device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1538 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1540 speed_cnt
[device_id
] = 0;
1541 speed_ms
[device_id
] = 0;
1543 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1545 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1546 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1549 speed_cnt
[device_id
] /= SPEED_CACHE
;
1550 speed_ms
[device_id
] /= SPEED_CACHE
;
1553 float hashes_all_ms
= 0;
1555 float hashes_dev_ms
[DEVICES_MAX
];
1557 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1559 hashes_dev_ms
[device_id
] = 0;
1561 if (speed_ms
[device_id
])
1563 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1565 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1569 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1571 char display_dev_cur
[16];
1573 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1575 strncpy (display_dev_cur
, "0.00", 4);
1577 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1579 log_info ("Speed.GPU.#%d.: %9sH/s", device_id
+ 1, display_dev_cur
);
1582 char display_all_cur
[16];
1584 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1586 strncpy (display_all_cur
, "0.00", 4);
1588 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1590 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*.: %9sH/s", display_all_cur
);
1594 * oclHashcat -only- functions
1597 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *source_file
)
1599 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1601 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1602 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", install_dir
, (int) kern_type
);
1603 else if (attack_kern
== ATTACK_KERN_COMBI
)
1604 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", install_dir
, (int) kern_type
);
1605 else if (attack_kern
== ATTACK_KERN_BF
)
1606 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", install_dir
, (int) kern_type
);
1609 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", install_dir
, (int) kern_type
);
1612 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1614 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1616 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1617 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a0.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1618 else if (attack_kern
== ATTACK_KERN_COMBI
)
1619 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a1.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1620 else if (attack_kern
== ATTACK_KERN_BF
)
1621 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a3.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1625 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1629 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *install_dir
, char *source_file
)
1631 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1633 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", install_dir
);
1637 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", install_dir
);
1641 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1643 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1645 snprintf (cached_file
, 255, "%s/kernels/%d/markov_be.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, device_name
, device_version
, driver_version
, COMPTIME
);
1649 snprintf (cached_file
, 255, "%s/kernels/%d/markov_le.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, device_name
, device_version
, driver_version
, COMPTIME
);
1653 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *install_dir
, char *source_file
)
1655 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
1658 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1660 snprintf (cached_file
, 255, "%s/kernels/%d/amp_a%d.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, attack_kern
, device_name
, device_version
, driver_version
, COMPTIME
);
1663 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1665 if (line_len
& 1) return (line_len
); // not in hex
1667 if (data
.hex_wordlist
== 1)
1672 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1674 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1677 memset (line_buf
+ i
, 0, line_len
- i
);
1681 else if (line_len
>= 6) // $HEX[] = 6
1683 if (line_buf
[0] != '$') return (line_len
);
1684 if (line_buf
[1] != 'H') return (line_len
);
1685 if (line_buf
[2] != 'E') return (line_len
);
1686 if (line_buf
[3] != 'X') return (line_len
);
1687 if (line_buf
[4] != '[') return (line_len
);
1688 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1693 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1695 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1698 memset (line_buf
+ i
, 0, line_len
- i
);
1706 static uint
count_lines (FILE *fd
)
1710 char *buf
= (char *) mymalloc (BUFSIZ
);
1712 size_t nread_tmp
= 0;
1718 size_t nread
= fread (buf
, sizeof (char), BUFSIZ
, fd
);
1721 if (nread
< 1) continue;
1727 if (*ptr
++ == '\n') cnt
++;
1732 // special case (if last line did not contain a newline char ... at the very end of the file)
1742 if (*ptr
!= '\n') // needed ? different on windows systems?
1754 static void clear_prompt ()
1756 fputc ('\r', stdout
);
1758 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1760 fputc (' ', stdout
);
1763 fputc ('\r', stdout
);
1768 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const uint64_t gidd
, pw_t
*pw
)
1770 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1773 static void check_hash (hc_device_param_t
*device_param
, const uint salt_pos
, const uint digest_pos
)
1775 char *outfile
= data
.outfile
;
1776 uint quiet
= data
.quiet
;
1777 FILE *pot_fp
= data
.pot_fp
;
1778 uint loopback
= data
.loopback
;
1779 uint debug_mode
= data
.debug_mode
;
1780 char *debug_file
= data
.debug_file
;
1782 char debug_rule_buf
[BLOCK_SIZE
];
1783 int debug_rule_len
= 0; // -1 error
1784 uint debug_plain_len
= 0;
1786 unsigned char debug_plain_ptr
[BLOCK_SIZE
];
1790 char out_buf
[4096]; memset (out_buf
, 0, sizeof (out_buf
));
1792 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1794 uint idx
= data
.salts_buf
[salt_pos
].digests_offset
+ digest_pos
;
1800 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, idx
* sizeof (plain_t
), sizeof (plain_t
), &plain
, 0, NULL
, NULL
);
1802 uint gidvid
= plain
.gidvid
;
1803 uint il_pos
= plain
.il_pos
;
1805 uint64_t crackpos
= device_param
->words_off
;
1809 unsigned char *plain_ptr
= (unsigned char *) plain_buf
;
1810 unsigned int plain_len
= 0;
1812 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1814 uint64_t gidd
= gidvid
;
1819 gidd_to_pw_t (device_param
, gidd
, &pw
);
1821 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1823 plain_buf
[i
] = pw
.hi1
[0][j
];
1826 plain_len
= pw
.pw_len
;
1828 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1835 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1837 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1839 debug_rule_len
= gpu_rule_to_cpu_rule (debug_rule_buf
, &data
.gpu_rules_buf
[off
]);
1843 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1845 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1847 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1849 debug_plain_len
= plain_len
;
1853 plain_len
= apply_rules (data
.gpu_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1856 crackpos
*= data
.gpu_rules_cnt
;
1857 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1859 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1861 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1863 uint64_t gidd
= gidvid
;
1868 gidd_to_pw_t (device_param
, gidd
, &pw
);
1870 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1872 plain_buf
[i
] = pw
.hi1
[0][j
];
1875 plain_len
= pw
.pw_len
;
1877 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1878 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1880 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1882 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1886 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1888 memcpy (plain_ptr
, comb_buf
, comb_len
);
1891 plain_len
+= comb_len
;
1894 crackpos
*= data
.combs_cnt
;
1895 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1897 if (data
.pw_max
!= PW_DICTMAX1
)
1899 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1902 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1904 uint64_t l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1905 uint64_t r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1907 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1908 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1910 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1911 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1913 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1914 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1916 plain_len
= data
.css_cnt
;
1919 crackpos
*= data
.bfs_cnt
;
1920 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1922 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1924 uint64_t gidd
= gidvid
;
1929 gidd_to_pw_t (device_param
, gidd
, &pw
);
1931 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1933 plain_buf
[i
] = pw
.hi1
[0][j
];
1936 plain_len
= pw
.pw_len
;
1938 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1941 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1943 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1945 plain_len
+= start
+ stop
;
1948 crackpos
*= data
.combs_cnt
;
1949 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1951 if (data
.pw_max
!= PW_DICTMAX1
)
1953 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1956 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1958 uint64_t gidd
= gidvid
;
1963 gidd_to_pw_t (device_param
, gidd
, &pw
);
1965 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1967 plain_buf
[i
] = pw
.hi1
[0][j
];
1970 plain_len
= pw
.pw_len
;
1972 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1975 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1977 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
1979 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1981 plain_len
+= start
+ stop
;
1984 crackpos
*= data
.combs_cnt
;
1985 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1987 if (data
.pw_max
!= PW_DICTMAX1
)
1989 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1993 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
1995 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1997 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1999 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2003 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2005 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2007 plain_ptr
[j
] = plain_ptr
[i
];
2010 plain_len
= plain_len
/ 2;
2014 // if enabled, update also the potfile
2018 fprintf (pot_fp
, "%s:", out_buf
);
2020 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2022 fputc ('\n', pot_fp
);
2029 FILE *out_fp
= NULL
;
2031 if (outfile
!= NULL
)
2033 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2035 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2044 if (quiet
== 0) clear_prompt ();
2047 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2049 if (outfile
!= NULL
)
2051 if (out_fp
!= stdout
)
2058 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2060 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2062 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2063 if (quiet
== 0) fflush (stdout
);
2072 char *loopback_file
= data
.loopback_file
;
2076 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2078 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2080 fputc ('\n', fb_fp
);
2086 // (rule) debug mode
2088 // the next check implies that:
2089 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2092 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2094 if (debug_rule_len
< 0) debug_rule_len
= 0;
2096 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2098 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2100 if ((quiet
== 0) && (debug_file
== NULL
))
2102 fprintf (stdout
, "%s", PROMPT
);
2108 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2110 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2114 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2116 for (uint i
= 0; i
< GPU_THREADS
; i
++) if (device_param
->result
[i
] == 1) found
= 1;
2120 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2124 hc_clEnqueueReadBuffer (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
);
2126 uint cpt_cracked
= 0;
2128 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2130 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2132 if (data
.digests_shown_tmp
[idx
] == 0) continue;
2134 if (data
.digests_shown
[idx
] == 1) continue;
2136 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2138 data
.digests_shown
[idx
] = 1;
2140 data
.digests_done
++;
2144 salt_buf
->digests_done
++;
2146 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2148 data
.salts_shown
[salt_pos
] = 1;
2154 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2156 check_hash (device_param
, salt_pos
, digest_pos
);
2159 if (cpt_cracked
> 0)
2161 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2162 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2166 data
.cpt_total
+= cpt_cracked
;
2168 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2171 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2173 // we need to reset cracked state on the gpu
2174 // otherwise host thinks again and again the hash was cracked
2175 // and returns invalid password each time
2177 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2179 hc_clEnqueueWriteBuffer (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
);
2182 memset (device_param
->result
, 0, device_param
->size_results
);
2184 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2188 static void save_hash ()
2190 char *hashfile
= data
.hashfile
;
2192 char new_hashfile
[256];
2193 char old_hashfile
[256];
2195 memset (new_hashfile
, 0, sizeof (new_hashfile
));
2196 memset (old_hashfile
, 0, sizeof (old_hashfile
));
2198 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2199 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2201 unlink (new_hashfile
);
2203 char separator
= data
.separator
;
2205 FILE *fp
= fopen (new_hashfile
, "wb");
2209 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2214 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2216 if (data
.salts_shown
[salt_pos
] == 1) continue;
2218 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2220 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2222 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2224 if (data
.digests_shown
[idx
] == 1) continue;
2226 if (data
.hash_mode
!= 2500)
2230 memset (out_buf
, 0, sizeof (out_buf
));
2232 if (data
.username
== 1)
2234 user_t
*user
= data
.hash_info
[idx
]->user
;
2238 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2240 fputc (separator
, fp
);
2243 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2245 fputs (out_buf
, fp
);
2253 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2255 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2264 unlink (old_hashfile
);
2266 if (rename (hashfile
, old_hashfile
) != 0)
2268 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2275 if (rename (new_hashfile
, hashfile
) != 0)
2277 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2282 unlink (old_hashfile
);
2285 static float find_gpu_blocks_div (const uint64_t total_left
, const uint gpu_blocks_all
)
2287 // function called only in case gpu_blocks_all > words_left)
2289 float gpu_blocks_div
= (float) (total_left
) / gpu_blocks_all
;
2291 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2293 uint32_t gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2295 while (gpu_blocks_new
< total_left
)
2297 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2299 gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2302 if (data
.quiet
== 0)
2308 log_info ("INFO: approaching final keyspace, workload adjusted");
2312 fprintf (stdout
, "%s", PROMPT
);
2317 if ((gpu_blocks_all
* gpu_blocks_div
) < 8) return 1;
2319 return gpu_blocks_div
;
2322 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2324 uint num_elements
= num
;
2326 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2327 device_param
->kernel_params_buf32
[31] = num
;
2329 uint gpu_threads
= device_param
->gpu_threads
;
2331 while (num_elements
% gpu_threads
) num_elements
++;
2333 cl_kernel kernel
= NULL
;
2337 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2338 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2339 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2340 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2341 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2344 hc_clSetKernelArg (kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2345 hc_clSetKernelArg (kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2346 hc_clSetKernelArg (kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2347 hc_clSetKernelArg (kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2348 hc_clSetKernelArg (kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2349 hc_clSetKernelArg (kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2350 hc_clSetKernelArg (kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2351 hc_clSetKernelArg (kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2352 hc_clSetKernelArg (kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2353 hc_clSetKernelArg (kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2354 hc_clSetKernelArg (kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2356 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2358 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2359 const size_t local_work_size
[3] = { gpu_threads
/ 32, 32, 1 };
2361 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2365 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2366 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2368 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2371 hc_clFlush (device_param
->command_queue
);
2373 hc_clFinish (device_param
->command_queue
);
2376 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2378 uint num_elements
= num
;
2382 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2383 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2384 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2387 // causes problems with special threads like in bcrypt
2388 // const uint gpu_threads = device_param->gpu_threads;
2390 const uint gpu_threads
= GPU_THREADS
;
2392 while (num_elements
% gpu_threads
) num_elements
++;
2394 cl_kernel kernel
= NULL
;
2398 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2399 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2400 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2405 case KERN_RUN_MP
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2406 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2407 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2408 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2409 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2410 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2412 case KERN_RUN_MP_R
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2413 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2414 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2415 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2416 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2417 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2419 case KERN_RUN_MP_L
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2420 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2421 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2422 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2423 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2424 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2425 hc_clSetKernelArg (kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2429 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2430 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2432 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2434 hc_clFlush (device_param
->command_queue
);
2436 hc_clFinish (device_param
->command_queue
);
2439 static void run_kernel_tb (hc_device_param_t
*device_param
, const uint num
)
2441 uint num_elements
= num
;
2443 uint gpu_threads
= device_param
->gpu_threads
;
2445 while (num_elements
% gpu_threads
) num_elements
++;
2447 cl_kernel kernel
= device_param
->kernel_tb
;
2449 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2450 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2452 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2454 hc_clFlush (device_param
->command_queue
);
2456 hc_clFinish (device_param
->command_queue
);
2459 static void run_kernel_tm (hc_device_param_t
*device_param
)
2461 const uint num_elements
= 1024; // fixed
2463 const uint gpu_threads
= 32;
2465 cl_kernel kernel
= device_param
->kernel_tm
;
2467 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2468 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2470 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2472 hc_clFlush (device_param
->command_queue
);
2474 hc_clFinish (device_param
->command_queue
);
2477 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2479 uint num_elements
= num
;
2481 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2482 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2484 // causes problems with special threads like in bcrypt
2485 // const uint gpu_threads = device_param->gpu_threads;
2487 const uint gpu_threads
= GPU_THREADS
;
2489 while (num_elements
% gpu_threads
) num_elements
++;
2491 cl_kernel kernel
= device_param
->kernel_amp
;
2493 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2494 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2496 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2497 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2499 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2501 hc_clFlush (device_param
->command_queue
);
2503 hc_clFinish (device_param
->command_queue
);
2506 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const uint size
)
2508 if (data
.vendor_id
== VENDOR_ID_AMD
)
2510 const cl_uchar zero
= 0;
2512 hc_clEnqueueFillBuffer (device_param
->command_queue
, buf
, &zero
, sizeof (cl_uchar
), 0, size
, 0, NULL
, NULL
);
2515 if (data
.vendor_id
== VENDOR_ID_NV
)
2517 // NOTE: clEnqueueFillBuffer () always fails with -59
2518 // IOW, it's not supported by Nvidia ForceWare <= 352.21,
2519 // How's that possible, OpenCL 1.2 support is advertised??
2520 // We need to workaround...
2522 #define FILLSZ 0x100000
2524 char *tmp
= (char *) mymalloc (FILLSZ
);
2526 memset (tmp
, 0, FILLSZ
);
2528 for (uint i
= 0; i
< size
; i
+= FILLSZ
)
2530 const int left
= size
- i
;
2532 const int fillsz
= MIN (FILLSZ
, left
);
2534 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, i
, fillsz
, tmp
, 0, NULL
, NULL
);
2541 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2547 else if (rule_len
== 1)
2549 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2555 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2557 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2559 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2561 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2563 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2565 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2567 const uint64_t off
= device_param
->words_off
;
2569 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2571 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2575 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2577 const uint gpu_loops
= data
.gpu_loops
;
2581 uint speed_pos
= device_param
->speed_pos
;
2584 if (device_param
->timer_speed
.tv_sec
== 0)
2586 hc_timer_set (&device_param
->timer_speed
);
2591 if (device_param
->timer_speed
.QuadPart
== 0)
2593 hc_timer_set (&device_param
->timer_speed
);
2597 // find higest password length, this is for optimization stuff
2599 uint highest_pw_len
= 0;
2601 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2604 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2607 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2609 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2610 + device_param
->kernel_params_mp_l_buf32
[5];
2613 // bitslice optimization stuff
2615 if (data
.attack_mode
== ATTACK_MODE_BF
)
2617 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2619 run_kernel_tb (device_param
, pws_cnt
);
2625 uint innerloop_step
= 0;
2626 uint innerloop_cnt
= 0;
2628 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2629 else innerloop_step
= 1;
2631 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2632 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2633 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2635 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2637 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2639 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2641 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2643 if (data
.devices_status
== STATUS_CRACKED
) break;
2644 if (data
.devices_status
== STATUS_ABORTED
) break;
2645 if (data
.devices_status
== STATUS_QUIT
) break;
2646 if (data
.devices_status
== STATUS_BYPASS
) break;
2648 if (data
.salts_shown
[salt_pos
] == 1) continue;
2650 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2652 device_param
->kernel_params_buf32
[24] = salt_pos
;
2653 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2654 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2656 FILE *combs_fp
= device_param
->combs_fp
;
2658 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2665 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2667 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2669 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2671 if (data
.devices_status
== STATUS_CRACKED
) break;
2672 if (data
.devices_status
== STATUS_ABORTED
) break;
2673 if (data
.devices_status
== STATUS_QUIT
) break;
2674 if (data
.devices_status
== STATUS_BYPASS
) break;
2676 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2678 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2680 device_param
->innerloop_pos
= innerloop_pos
;
2681 device_param
->innerloop_left
= innerloop_left
;
2683 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2685 if (innerloop_left
== 0) continue;
2687 // initialize amplifiers
2689 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2691 char line_buf
[BUFSIZ
];
2695 while (i
< innerloop_left
)
2697 if (feof (combs_fp
)) break;
2699 int line_len
= fgetl (combs_fp
, line_buf
);
2701 if (line_len
>= PW_MAX1
) continue;
2703 line_len
= convert_from_hex (line_buf
, line_len
);
2705 char *line_buf_new
= line_buf
;
2707 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2709 char rule_buf_out
[BLOCK_SIZE
];
2711 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2713 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2715 if (rule_len_out
< 0)
2717 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2722 line_len
= rule_len_out
;
2724 line_buf_new
= rule_buf_out
;
2727 line_len
= MIN (line_len
, PW_DICTMAX
);
2729 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2731 memcpy (ptr
, line_buf_new
, line_len
);
2733 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2735 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2737 uppercase (ptr
, line_len
);
2740 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2742 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2744 ptr
[line_len
] = 0x80;
2747 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2749 ptr
[line_len
] = 0x01;
2753 device_param
->combs_buf
[i
].pw_len
= line_len
;
2758 for (uint j
= i
; j
< innerloop_left
; j
++)
2760 device_param
->combs_buf
[j
].i
[0] = 0;
2761 device_param
->combs_buf
[j
].i
[1] = 0;
2762 device_param
->combs_buf
[j
].i
[2] = 0;
2763 device_param
->combs_buf
[j
].i
[3] = 0;
2764 device_param
->combs_buf
[j
].i
[4] = 0;
2765 device_param
->combs_buf
[j
].i
[5] = 0;
2766 device_param
->combs_buf
[j
].i
[6] = 0;
2767 device_param
->combs_buf
[j
].i
[7] = 0;
2769 device_param
->combs_buf
[j
].pw_len
= 0;
2774 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2776 uint64_t off
= innerloop_pos
;
2778 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2780 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2782 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2784 uint64_t off
= innerloop_pos
;
2786 device_param
->kernel_params_mp_buf64
[3] = off
;
2788 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2790 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2792 uint64_t off
= innerloop_pos
;
2794 device_param
->kernel_params_mp_buf64
[3] = off
;
2796 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2801 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2803 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_rules
, device_param
->d_rules_c
, innerloop_pos
* sizeof (gpu_rule_t
), 0, innerloop_left
* sizeof (gpu_rule_t
), 0, NULL
, NULL
);
2805 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2807 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_combs_c
, CL_TRUE
, 0, innerloop_left
* sizeof (comb_t
), device_param
->combs_buf
, 0, NULL
, NULL
);
2809 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2811 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_bfs
, device_param
->d_bfs_c
, 0, 0, innerloop_left
* sizeof (bf_t
), 0, NULL
, NULL
);
2813 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2815 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
2817 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2819 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
2822 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2824 if (data
.attack_mode
== ATTACK_MODE_BF
)
2826 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2828 const uint size_tm
= 32 * sizeof (bs_word_t
);
2830 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2832 run_kernel_tm (device_param
);
2834 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2838 if (highest_pw_len
< 16)
2840 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2842 else if (highest_pw_len
< 32)
2844 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2848 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2853 run_kernel_amp (device_param
, pws_cnt
);
2855 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2857 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2859 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2862 uint iter
= salt_buf
->salt_iter
;
2864 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2866 uint loop_left
= iter
- loop_pos
;
2868 loop_left
= MIN (loop_left
, gpu_loops
);
2870 device_param
->kernel_params_buf32
[25] = loop_pos
;
2871 device_param
->kernel_params_buf32
[26] = loop_left
;
2873 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2875 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2877 if (data
.devices_status
== STATUS_CRACKED
) break;
2878 if (data
.devices_status
== STATUS_ABORTED
) break;
2879 if (data
.devices_status
== STATUS_QUIT
) break;
2882 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2884 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2886 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2888 // do something with data
2890 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2893 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2896 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2898 if (data
.devices_status
== STATUS_CRACKED
) break;
2899 if (data
.devices_status
== STATUS_ABORTED
) break;
2900 if (data
.devices_status
== STATUS_QUIT
) break;
2906 hc_thread_mutex_lock (mux_display
);
2908 check_cracked (device_param
, salt_pos
);
2910 hc_thread_mutex_unlock (mux_display
);
2916 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2918 hc_thread_mutex_lock (mux_counter
);
2920 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2922 hc_thread_mutex_unlock (mux_counter
);
2930 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2932 hc_timer_set (&device_param
->timer_speed
);
2934 hc_thread_mutex_lock (mux_display
);
2936 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2938 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2940 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2942 hc_thread_mutex_unlock (mux_display
);
2946 if (speed_pos
== SPEED_CACHE
)
2953 device_param
->speed_pos
= speed_pos
;
2956 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2958 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2962 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2964 wl_data
->buf
[wl_data
->cnt
] = 0;
2966 if (wl_data
->cnt
== 0) return;
2968 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2972 if (wl_data
->cnt
== wl_data
->avail
)
2974 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2976 wl_data
->avail
+= wl_data
->incr
;
2979 const int c
= fgetc (fd
);
2981 if (c
== EOF
) break;
2983 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2987 if (c
== '\n') break;
2990 // ensure stream ends with a newline
2992 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2996 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3002 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3006 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3008 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3018 if (*ptr
!= '\n') continue;
3022 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3033 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3037 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3039 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3041 if (*ptr
!= '\n') continue;
3045 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3056 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3060 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3062 if (*ptr
!= '\n') continue;
3066 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3077 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3079 while (wl_data
->pos
< wl_data
->cnt
)
3084 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3086 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3088 wl_data
->pos
+= off
;
3090 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3092 char rule_buf_out
[BLOCK_SIZE
];
3094 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3096 int rule_len_out
= -1;
3098 if (len
< BLOCK_SIZE
)
3100 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3103 if (rule_len_out
< 0)
3108 if (rule_len_out
> PW_MAX
)
3129 fprintf (stderr
, "bug!!\n");
3134 load_segment (wl_data
, fd
);
3136 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3140 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3144 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3154 fstat (fileno (fd
), &d
.stat
);
3158 _fstat64 (fileno (fd
), &d
.stat
);
3162 d
.stat
.st_nlink
= 0;
3166 d
.stat
.st_atime
= 0;
3169 d
.stat
.st_blksize
= 0;
3170 d
.stat
.st_blocks
= 0;
3173 if (d
.stat
.st_size
== 0) return 0;
3175 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3177 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3181 uint64_t cnt
= d_cache
->cnt
;
3183 uint64_t keyspace
= cnt
;
3185 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3187 keyspace
*= data
.gpu_rules_cnt
;
3189 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3191 keyspace
*= data
.combs_cnt
;
3194 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
);
3195 if (data
.quiet
== 0) log_info ("");
3197 hc_signal (sigHandler_default
);
3212 load_segment (wl_data
, fd
);
3214 comp
+= wl_data
->cnt
;
3218 while (i
< wl_data
->cnt
)
3223 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3225 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3227 char rule_buf_out
[BLOCK_SIZE
];
3229 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3231 int rule_len_out
= -1;
3233 if (len
< BLOCK_SIZE
)
3235 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3238 if (rule_len_out
< 0)
3250 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3252 cnt
+= data
.gpu_rules_cnt
;
3254 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3256 cnt
+= data
.combs_cnt
;
3269 if ((now
- prev
) == 0) continue;
3271 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3273 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
);
3278 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
);
3279 if (data
.quiet
== 0) log_info ("");
3281 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3283 hc_signal (sigHandler_default
);
3288 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3290 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3293 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3295 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3297 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3299 uint cache_cnt
= pw_cache
->cnt
;
3301 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3303 memcpy (pw_hc1
, pw_buf
, pw_len
);
3305 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3307 uint pws_cnt
= device_param
->pws_cnt
;
3311 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3313 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3315 pw
->pw_len
= pw_len
;
3319 device_param
->pws_cnt
= pws_cnt
;
3320 device_param
->pw_cnt
= pws_cnt
* 1;
3324 pw_cache
->cnt
= cache_cnt
;
3329 static void *thread_monitor (void *p
)
3331 uint runtime_check
= 0;
3332 uint remove_check
= 0;
3333 uint status_check
= 0;
3334 uint hwmon_check
= 0;
3335 uint restore_check
= 0;
3337 uint restore_left
= data
.restore_timer
;
3338 uint remove_left
= data
.remove_timer
;
3339 uint status_left
= data
.status_timer
;
3341 // these variables are mainly used for fan control (AMD only)
3343 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3345 // temperature controller "loopback" values
3347 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3348 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3350 int temp_threshold
= 1; // degrees celcius
3352 int fan_speed_min
= 15; // in percentage
3353 int fan_speed_max
= 100;
3355 time_t last_temp_check_time
;
3357 uint sleep_time
= 1;
3364 if (data
.restore_timer
)
3369 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3374 if (data
.status
== 1)
3379 if (data
.gpu_temp_disable
== 0)
3381 time (&last_temp_check_time
);
3386 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3391 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3393 hc_sleep (sleep_time
);
3395 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3397 if (hwmon_check
== 1)
3399 hc_thread_mutex_lock (mux_adl
);
3401 time_t temp_check_time
;
3403 time (&temp_check_time
);
3405 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3407 if (Ta
== 0) Ta
= 1;
3409 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
3411 const int temperature
= hm_get_temperature_with_device_id (i
);
3413 if (temperature
> (int) data
.gpu_temp_abort
)
3415 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i
+ 1);
3417 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3422 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3424 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3426 if (data
.hm_device
[i
].fan_supported
== 1)
3428 int temp_cur
= temperature
;
3430 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3432 temp_diff_sum
[i
] = temp_diff_sum
[i
] + temp_diff_new
;
3434 // calculate Ta value (time difference in seconds between the last check and this check)
3436 last_temp_check_time
= temp_check_time
;
3442 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3444 int fan_diff_required
= (int) (Kp
* (float)temp_diff_new
+ Ki
* Ta
* (float)temp_diff_sum
[i
] + Kd
* ((float)(temp_diff_new
- temp_diff_old
[i
])) / Ta
);
3446 if (abs (fan_diff_required
) >= temp_threshold
)
3448 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (i
);
3450 int fan_speed_level
= fan_speed_cur
;
3452 if (fan_speed_chgd
[i
] == 0) fan_speed_level
= temp_cur
;
3454 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3456 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3457 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3459 if (fan_speed_new
!= fan_speed_cur
)
3461 int freely_change_fan_speed
= (fan_speed_chgd
[i
] == 1);
3462 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3464 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3466 hm_set_fanspeed_with_device_id_amd (i
, fan_speed_new
);
3468 fan_speed_chgd
[i
] = 1;
3471 temp_diff_old
[i
] = temp_diff_new
;
3478 hc_thread_mutex_unlock (mux_adl
);
3481 if (restore_check
== 1)
3485 if (restore_left
== 0)
3487 if (data
.restore_disable
== 0) cycle_restore ();
3489 restore_left
= data
.restore_timer
;
3493 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3497 time (&runtime_cur
);
3499 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3501 if (runtime_left
<= 0)
3503 if (data
.benchmark
== 0)
3505 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3508 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3512 if (remove_check
== 1)
3516 if (remove_left
== 0)
3518 if (data
.digests_saved
!= data
.digests_done
)
3520 data
.digests_saved
= data
.digests_done
;
3525 remove_left
= data
.remove_timer
;
3529 if (status_check
== 1)
3533 if (status_left
== 0)
3535 hc_thread_mutex_lock (mux_display
);
3537 if (data
.quiet
== 0) clear_prompt ();
3539 if (data
.quiet
== 0) log_info ("");
3543 if (data
.quiet
== 0) log_info ("");
3545 hc_thread_mutex_unlock (mux_display
);
3547 status_left
= data
.status_timer
;
3552 myfree (fan_speed_chgd
);
3554 myfree (temp_diff_old
);
3555 myfree (temp_diff_sum
);
3562 static void *thread_outfile_remove (void *p
)
3564 // some hash-dependent constants
3565 char *outfile_dir
= data
.outfile_check_directory
;
3566 uint dgst_size
= data
.dgst_size
;
3567 uint isSalted
= data
.isSalted
;
3568 uint esalt_size
= data
.esalt_size
;
3569 uint hash_mode
= data
.hash_mode
;
3571 uint outfile_check_timer
= data
.outfile_check_timer
;
3573 char separator
= data
.separator
;
3575 // some hash-dependent functions
3576 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3577 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3582 memset (&hash_buf
, 0, sizeof (hash_buf
));
3584 hash_buf
.digest
= mymalloc (dgst_size
);
3586 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3588 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3590 uint digest_buf
[64];
3592 outfile_data_t
*out_info
= NULL
;
3594 char **out_files
= NULL
;
3596 time_t folder_mtime
= 0;
3600 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3602 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3606 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3610 if (check_left
== 0)
3612 struct stat outfile_check_stat
;
3614 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3616 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3620 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3622 char **out_files_new
= scan_directory (outfile_dir
);
3624 int out_cnt_new
= count_dictionaries (out_files_new
);
3626 outfile_data_t
*out_info_new
= NULL
;
3628 if (out_cnt_new
> 0)
3630 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3632 for (int i
= 0; i
< out_cnt_new
; i
++)
3634 out_info_new
[i
].file_name
= out_files_new
[i
];
3636 // check if there are files that we have seen/checked before (and not changed)
3638 for (int j
= 0; j
< out_cnt
; j
++)
3640 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3642 struct stat outfile_stat
;
3644 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3646 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3648 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3649 out_info_new
[i
].seek
= out_info
[j
].seek
;
3657 local_free (out_info
);
3658 local_free (out_files
);
3660 out_files
= out_files_new
;
3661 out_cnt
= out_cnt_new
;
3662 out_info
= out_info_new
;
3664 folder_mtime
= outfile_check_stat
.st_mtime
;
3667 for (int j
= 0; j
< out_cnt
; j
++)
3669 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3673 //hc_thread_mutex_lock (mux_display);
3676 struct stat outfile_stat
;
3678 fstat (fileno (fp
), &outfile_stat
);
3682 struct stat64 outfile_stat
;
3684 _fstat64 (fileno (fp
), &outfile_stat
);
3687 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3689 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3690 out_info
[j
].seek
= 0;
3693 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3697 char line_buf
[BUFSIZ
];
3699 memset (line_buf
, 0, BUFSIZ
);
3701 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3703 if (ptr
== NULL
) break;
3705 int line_len
= strlen (line_buf
);
3707 if (line_len
<= 0) continue;
3709 int iter
= MAX_CUT_TRIES
;
3711 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3713 if (line_buf
[i
] != separator
) continue;
3715 int parser_status
= PARSER_OK
;
3717 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3719 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3724 if (parser_status
== PARSER_OK
)
3726 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3728 if (data
.salts_shown
[salt_pos
] == 1) continue;
3730 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3732 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3734 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3736 if (data
.digests_shown
[idx
] == 1) continue;
3740 if (hash_mode
== 6800)
3742 if (i
== salt_buf
->salt_len
)
3744 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3747 else if (hash_mode
== 2500)
3749 // BSSID : MAC1 : MAC2 (:plain)
3750 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3752 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3754 if (!cracked
) continue;
3756 // now compare MAC1 and MAC2 too, since we have this additional info
3757 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3758 char *mac2_pos
= mac1_pos
+ 12 + 1;
3760 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3761 wpa_t
*wpa
= &wpas
[salt_pos
];
3765 char *pke_ptr
= (char *) pke
;
3767 for (uint i
= 0; i
< 25; i
++)
3769 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3772 unsigned char mac1
[6];
3773 unsigned char mac2
[6];
3775 memcpy (mac1
, pke_ptr
+ 23, 6);
3776 memcpy (mac2
, pke_ptr
+ 29, 6);
3778 // compare hex string(s) vs binary MAC address(es)
3780 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3782 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3790 if (!cracked
) continue;
3792 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3794 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3804 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3806 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3808 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3815 data
.digests_shown
[idx
] = 1;
3817 data
.digests_done
++;
3819 salt_buf
->digests_done
++;
3821 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3823 data
.salts_shown
[salt_pos
] = 1;
3827 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3832 if (data
.devices_status
== STATUS_CRACKED
) break;
3838 if (data
.devices_status
== STATUS_CRACKED
) break;
3843 if (data
.devices_status
== STATUS_CRACKED
) break;
3846 out_info
[j
].seek
= ftell (fp
);
3848 //hc_thread_mutex_unlock (mux_display);
3856 check_left
= outfile_check_timer
;
3860 if (esalt_size
) local_free (hash_buf
.esalt
);
3862 if (isSalted
) local_free (hash_buf
.salt
);
3864 local_free (hash_buf
.digest
);
3866 local_free (out_info
);
3868 local_free (out_files
);
3875 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3877 hc_thread_mutex_lock (mux_dispatcher
);
3879 const uint64_t words_cur
= data
.words_cur
;
3880 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3882 device_param
->words_off
= words_cur
;
3884 const uint64_t words_left
= words_base
- words_cur
;
3886 if (data
.gpu_blocks_all
> words_left
)
3888 if (data
.gpu_blocks_div
== 0)
3890 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3894 if (data
.gpu_blocks_div
)
3896 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3898 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3899 const uint32_t gpu_power_new
= gpu_blocks_new
;
3901 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3903 device_param
->gpu_blocks
= gpu_blocks_new
;
3904 device_param
->gpu_power
= gpu_power_new
;
3909 const uint gpu_blocks
= device_param
->gpu_blocks
;
3911 uint work
= MIN (words_left
, gpu_blocks
);
3913 work
= MIN (work
, max
);
3915 data
.words_cur
+= work
;
3917 hc_thread_mutex_unlock (mux_dispatcher
);
3922 static void *thread_calc_stdin (void *p
)
3924 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3926 const uint attack_kern
= data
.attack_kern
;
3928 const uint gpu_blocks
= device_param
->gpu_blocks
;
3930 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3932 hc_thread_mutex_lock (mux_dispatcher
);
3934 if (feof (stdin
) != 0)
3936 hc_thread_mutex_unlock (mux_dispatcher
);
3943 while (words_cur
< gpu_blocks
)
3947 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3949 if (line_buf
== NULL
) break;
3951 uint line_len
= in_superchop (line_buf
);
3953 line_len
= convert_from_hex (line_buf
, line_len
);
3955 // post-process rule engine
3957 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3959 char rule_buf_out
[BLOCK_SIZE
];
3961 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3963 int rule_len_out
= -1;
3965 if (line_len
< BLOCK_SIZE
)
3967 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3970 if (rule_len_out
< 0) continue;
3972 line_buf
= rule_buf_out
;
3973 line_len
= rule_len_out
;
3976 if (line_len
> PW_MAX
)
3981 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3983 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3985 hc_thread_mutex_lock (mux_counter
);
3987 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3989 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3992 hc_thread_mutex_unlock (mux_counter
);
3997 else if (attack_kern
== ATTACK_KERN_COMBI
)
3999 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4000 // since we still need to combine the plains
4002 if (line_len
> data
.pw_max
)
4004 hc_thread_mutex_lock (mux_counter
);
4006 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4008 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4011 hc_thread_mutex_unlock (mux_counter
);
4017 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4021 if (data
.devices_status
== STATUS_CRACKED
) break;
4022 if (data
.devices_status
== STATUS_ABORTED
) break;
4023 if (data
.devices_status
== STATUS_QUIT
) break;
4024 if (data
.devices_status
== STATUS_BYPASS
) break;
4027 hc_thread_mutex_unlock (mux_dispatcher
);
4029 if (data
.devices_status
== STATUS_CRACKED
) break;
4030 if (data
.devices_status
== STATUS_ABORTED
) break;
4031 if (data
.devices_status
== STATUS_QUIT
) break;
4032 if (data
.devices_status
== STATUS_BYPASS
) break;
4034 // we need 2 flushing because we have two independant caches and it can occur
4035 // that one buffer is already at threshold plus for that length also exists
4036 // more data in the 2nd buffer so it would overflow
4041 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4043 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4045 const uint pw_cache_cnt
= pw_cache
->cnt
;
4047 if (pw_cache_cnt
== 0) continue;
4051 uint pws_cnt
= device_param
->pws_cnt
;
4053 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4055 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4057 pw
->pw_len
= pw_len
;
4059 uint pw_cnt
= device_param
->pw_cnt
;
4061 pw_cnt
+= pw_cache_cnt
;
4063 device_param
->pw_cnt
= pw_cnt
;
4067 device_param
->pws_cnt
= pws_cnt
;
4069 if (pws_cnt
== device_param
->gpu_power_user
) break;
4072 const uint pw_cnt
= device_param
->pw_cnt
;
4073 const uint pws_cnt
= device_param
->pws_cnt
;
4077 run_copy (device_param
, pws_cnt
);
4079 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4081 device_param
->pw_cnt
= 0;
4082 device_param
->pws_cnt
= 0;
4089 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4091 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4093 const uint pw_cache_cnt
= pw_cache
->cnt
;
4095 if (pw_cache_cnt
== 0) continue;
4099 uint pws_cnt
= device_param
->pws_cnt
;
4101 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4103 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4105 pw
->pw_len
= pw_len
;
4107 uint pw_cnt
= device_param
->pw_cnt
;
4109 pw_cnt
+= pw_cache_cnt
;
4111 device_param
->pw_cnt
= pw_cnt
;
4115 device_param
->pws_cnt
= pws_cnt
;
4118 const uint pw_cnt
= device_param
->pw_cnt
;
4119 const uint pws_cnt
= device_param
->pws_cnt
;
4123 run_copy (device_param
, pws_cnt
);
4125 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4127 device_param
->pw_cnt
= 0;
4128 device_param
->pws_cnt
= 0;
4136 static void *thread_calc (void *p
)
4138 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4140 const uint attack_mode
= data
.attack_mode
;
4141 const uint attack_kern
= data
.attack_kern
;
4143 if (attack_mode
== ATTACK_MODE_BF
)
4145 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4147 const uint work
= get_work (device_param
, -1);
4149 if (work
== 0) break;
4151 const uint64_t words_off
= device_param
->words_off
;
4152 const uint64_t words_fin
= words_off
+ work
;
4154 const uint pw_cnt
= work
;
4155 const uint pws_cnt
= work
;
4157 device_param
->pw_cnt
= pw_cnt
;
4158 device_param
->pws_cnt
= pws_cnt
;
4162 run_copy (device_param
, pws_cnt
);
4164 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4166 device_param
->pw_cnt
= 0;
4167 device_param
->pws_cnt
= 0;
4170 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4172 if (data
.devices_status
== STATUS_CRACKED
) break;
4173 if (data
.devices_status
== STATUS_ABORTED
) break;
4174 if (data
.devices_status
== STATUS_QUIT
) break;
4175 if (data
.devices_status
== STATUS_BYPASS
) break;
4177 device_param
->words_done
= words_fin
;
4182 const uint segment_size
= data
.segment_size
;
4184 char *dictfile
= data
.dictfile
;
4186 if (attack_mode
== ATTACK_MODE_COMBI
)
4188 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4190 dictfile
= data
.dictfile2
;
4194 FILE *fd
= fopen (dictfile
, "rb");
4198 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4203 if (attack_mode
== ATTACK_MODE_COMBI
)
4205 const uint combs_mode
= data
.combs_mode
;
4207 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4209 const char *dictfilec
= data
.dictfile2
;
4211 FILE *combs_fp
= fopen (dictfilec
, "rb");
4213 if (combs_fp
== NULL
)
4215 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4222 device_param
->combs_fp
= combs_fp
;
4224 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4226 const char *dictfilec
= data
.dictfile
;
4228 FILE *combs_fp
= fopen (dictfilec
, "rb");
4230 if (combs_fp
== NULL
)
4232 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4239 device_param
->combs_fp
= combs_fp
;
4243 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4245 wl_data
->buf
= (char *) mymalloc (segment_size
);
4246 wl_data
->avail
= segment_size
;
4247 wl_data
->incr
= segment_size
;
4251 uint64_t words_cur
= 0;
4253 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4255 uint64_t words_off
= 0;
4256 uint64_t words_fin
= 0;
4262 const uint work
= get_work (device_param
, max
);
4264 if (work
== 0) break;
4266 words_off
= device_param
->words_off
;
4267 words_fin
= words_off
+ work
;
4272 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4276 for ( ; words_cur
< words_fin
; words_cur
++)
4278 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4280 line_len
= convert_from_hex (line_buf
, line_len
);
4282 // post-process rule engine
4284 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4286 char rule_buf_out
[BLOCK_SIZE
];
4288 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4290 int rule_len_out
= -1;
4292 if (line_len
< BLOCK_SIZE
)
4294 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4297 if (rule_len_out
< 0) continue;
4299 line_buf
= rule_buf_out
;
4300 line_len
= rule_len_out
;
4303 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4305 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4309 hc_thread_mutex_lock (mux_counter
);
4311 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4313 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4316 hc_thread_mutex_unlock (mux_counter
);
4321 else if (attack_kern
== ATTACK_KERN_COMBI
)
4323 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4324 // since we still need to combine the plains
4326 if (line_len
> data
.pw_max
)
4330 hc_thread_mutex_lock (mux_counter
);
4332 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4334 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4337 hc_thread_mutex_unlock (mux_counter
);
4343 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4345 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4347 if (data
.devices_status
== STATUS_CRACKED
) break;
4348 if (data
.devices_status
== STATUS_ABORTED
) break;
4349 if (data
.devices_status
== STATUS_QUIT
) break;
4350 if (data
.devices_status
== STATUS_BYPASS
) break;
4353 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4355 if (data
.devices_status
== STATUS_CRACKED
) break;
4356 if (data
.devices_status
== STATUS_ABORTED
) break;
4357 if (data
.devices_status
== STATUS_QUIT
) break;
4358 if (data
.devices_status
== STATUS_BYPASS
) break;
4361 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4363 if (data
.devices_status
== STATUS_CRACKED
) break;
4364 if (data
.devices_status
== STATUS_ABORTED
) break;
4365 if (data
.devices_status
== STATUS_QUIT
) break;
4366 if (data
.devices_status
== STATUS_BYPASS
) break;
4368 // we need 2 flushing because we have two independant caches and it can occur
4369 // that one buffer is already at threshold plus for that length also exists
4370 // more data in the 2nd buffer so it would overflow
4377 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4379 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4381 const uint pw_cache_cnt
= pw_cache
->cnt
;
4383 if (pw_cache_cnt
== 0) continue;
4387 uint pws_cnt
= device_param
->pws_cnt
;
4389 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4391 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4393 pw
->pw_len
= pw_len
;
4395 uint pw_cnt
= device_param
->pw_cnt
;
4397 pw_cnt
+= pw_cache_cnt
;
4399 device_param
->pw_cnt
= pw_cnt
;
4403 device_param
->pws_cnt
= pws_cnt
;
4405 if (pws_cnt
== device_param
->gpu_power_user
) break;
4408 const uint pw_cnt
= device_param
->pw_cnt
;
4409 const uint pws_cnt
= device_param
->pws_cnt
;
4413 run_copy (device_param
, pws_cnt
);
4415 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4417 device_param
->pw_cnt
= 0;
4418 device_param
->pws_cnt
= 0;
4421 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4423 if (data
.devices_status
== STATUS_CRACKED
) break;
4424 if (data
.devices_status
== STATUS_ABORTED
) break;
4425 if (data
.devices_status
== STATUS_QUIT
) break;
4426 if (data
.devices_status
== STATUS_BYPASS
) break;
4434 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4436 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4438 const uint pw_cache_cnt
= pw_cache
->cnt
;
4440 if (pw_cache_cnt
== 0) continue;
4444 uint pws_cnt
= device_param
->pws_cnt
;
4446 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4448 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4450 pw
->pw_len
= pw_len
;
4452 uint pw_cnt
= device_param
->pw_cnt
;
4454 pw_cnt
+= pw_cache_cnt
;
4456 device_param
->pw_cnt
= pw_cnt
;
4460 device_param
->pws_cnt
= pws_cnt
;
4463 const uint pw_cnt
= device_param
->pw_cnt
;
4464 const uint pws_cnt
= device_param
->pws_cnt
;
4468 run_copy (device_param
, pws_cnt
);
4470 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4472 device_param
->pw_cnt
= 0;
4473 device_param
->pws_cnt
= 0;
4476 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4478 if (data
.devices_status
== STATUS_CRACKED
) break;
4479 if (data
.devices_status
== STATUS_ABORTED
) break;
4480 if (data
.devices_status
== STATUS_QUIT
) break;
4481 if (data
.devices_status
== STATUS_BYPASS
) break;
4484 if (words_fin
== 0) break;
4486 device_param
->words_done
= words_fin
;
4489 if (attack_mode
== ATTACK_MODE_COMBI
)
4491 fclose (device_param
->combs_fp
);
4494 free (wl_data
->buf
);
4503 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4505 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4507 device_param
->kernel_params_buf32
[24] = salt_pos
;
4508 device_param
->kernel_params_buf32
[27] = 1;
4509 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4510 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4511 device_param
->kernel_params_buf32
[30] = 0;
4512 device_param
->kernel_params_buf32
[31] = 1;
4514 char *dictfile_old
= data
.dictfile
;
4515 char *dictfile2_old
= data
.dictfile2
;
4516 char *mask_old
= data
.mask
;
4518 const char *weak_hash_check
= "weak-hash-check";
4520 data
.dictfile
= (char *) weak_hash_check
;
4521 data
.dictfile2
= (char *) weak_hash_check
;
4522 data
.mask
= (char *) weak_hash_check
;
4528 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4530 run_kernel (KERN_RUN_1
, device_param
, 1);
4534 run_kernel (KERN_RUN_1
, device_param
, 1);
4536 const uint iter
= salt_buf
->salt_iter
;
4538 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4540 uint loop_left
= iter
- loop_pos
;
4542 loop_left
= MIN (loop_left
, gpu_loops
);
4544 device_param
->kernel_params_buf32
[25] = loop_pos
;
4545 device_param
->kernel_params_buf32
[26] = loop_left
;
4547 run_kernel (KERN_RUN_2
, device_param
, 1);
4550 run_kernel (KERN_RUN_3
, device_param
, 1);
4557 check_cracked (device_param
, salt_pos
);
4563 device_param
->kernel_params_buf32
[24] = 0;
4564 device_param
->kernel_params_buf32
[25] = 0;
4565 device_param
->kernel_params_buf32
[26] = 0;
4566 device_param
->kernel_params_buf32
[27] = 0;
4567 device_param
->kernel_params_buf32
[28] = 0;
4568 device_param
->kernel_params_buf32
[29] = 0;
4569 device_param
->kernel_params_buf32
[30] = 0;
4570 device_param
->kernel_params_buf32
[31] = 0;
4572 data
.dictfile
= dictfile_old
;
4573 data
.dictfile2
= dictfile2_old
;
4574 data
.mask
= mask_old
;
4579 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4581 if (data
.username
== 0)
4583 *hashbuf_pos
= line_buf
;
4584 *hashbuf_len
= line_len
;
4588 char *pos
= line_buf
;
4591 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4593 if (line_buf
[i
] == data
.separator
)
4608 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4615 for (int i
= 0; i
< line_len
; i
++)
4617 if (line_buf
[i
] == data
.separator
)
4626 if (pos
== NULL
) pos
= line_buf
+ i
;
4638 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4645 for (int i
= 0; i
< line_len
; i
++)
4647 if (line_buf
[i
] == ':')
4654 if (sep_cnt
== 2) sep2_len
++;
4655 if (sep_cnt
== 3) sep3_len
++;
4658 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4663 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4670 for (int i
= 0; i
< line_len
; i
++)
4672 if (line_buf
[i
] == ':')
4679 if (data
.hash_mode
== 1000)
4683 if (pos
== NULL
) pos
= line_buf
+ i
;
4688 else if (data
.hash_mode
== 3000)
4692 if (pos
== NULL
) pos
= line_buf
+ i
;
4703 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4710 for (int i
= 0; i
< line_len
; i
++)
4712 if (line_buf
[i
] == ':')
4721 if (pos
== NULL
) pos
= line_buf
+ i
;
4733 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4737 char sep5_first
= 0;
4738 char sep6_first
= 0;
4740 for (int i
= 0; i
< line_len
; i
++)
4742 if (line_buf
[i
] == ':')
4749 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4750 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4753 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4758 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4765 for (int i
= 0; i
< line_len
; i
++)
4767 if (line_buf
[i
] == ':')
4776 if (pos
== NULL
) pos
= line_buf
+ i
;
4786 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4793 for (int i
= 0; i
< line_len
; i
++)
4795 if (line_buf
[i
] == ':')
4804 if (pos
== NULL
) pos
= line_buf
+ i
;
4816 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4820 for (int i
= 0; i
< line_len
; i
++)
4822 if (line_buf
[i
] == ':') sep_cnt
++;
4825 if (sep_cnt
== 8) return 1;
4830 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4832 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4835 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4837 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4842 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4844 switch (hashfile_format
)
4846 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4847 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4848 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4849 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4853 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4855 switch (hashfile_format
)
4857 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4858 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4859 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4860 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4864 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4866 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4868 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4869 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4871 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4877 char line_buf
[BUFSIZ
];
4879 int line_len
= fgetl (fp
, line_buf
);
4881 if (line_len
== 0) continue;
4883 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4884 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4885 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4887 if (num_check
== max_check
) break;
4892 uint hashlist_format
= HLFMT_HASHCAT
;
4894 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4896 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4898 hashlist_format
= i
;
4903 return hashlist_format
;
4907 * some further helper function
4910 // wrapper around mymalloc for ADL
4912 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4914 return mymalloc (iSize
);
4917 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 uint64_t collisions_max
)
4919 uint64_t collisions
= 0;
4921 const uint dgst_pos0
= data
.dgst_pos0
;
4922 const uint dgst_pos1
= data
.dgst_pos1
;
4923 const uint dgst_pos2
= data
.dgst_pos2
;
4924 const uint dgst_pos3
= data
.dgst_pos3
;
4926 memset (bitmap_a
, 0, bitmap_size
);
4927 memset (bitmap_b
, 0, bitmap_size
);
4928 memset (bitmap_c
, 0, bitmap_size
);
4929 memset (bitmap_d
, 0, bitmap_size
);
4931 for (uint i
= 0; i
< digests_cnt
; i
++)
4933 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4935 digests_buf_ptr
+= dgst_size
;
4937 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4938 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4939 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4940 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4942 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4943 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4944 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4945 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4947 if (bitmap_a
[idx0
] & val0
) collisions
++;
4948 if (bitmap_b
[idx1
] & val1
) collisions
++;
4949 if (bitmap_c
[idx2
] & val2
) collisions
++;
4950 if (bitmap_d
[idx3
] & val3
) collisions
++;
4952 bitmap_a
[idx0
] |= val0
;
4953 bitmap_b
[idx1
] |= val1
;
4954 bitmap_c
[idx2
] |= val2
;
4955 bitmap_d
[idx3
] |= val3
;
4957 if (collisions
>= collisions_max
) return 0x7fffffff;
4967 int main (int argc
, char **argv
)
4970 * To help users a bit
4973 char *compute
= getenv ("COMPUTE");
4979 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4985 if (getenv ("DISPLAY") == NULL
)
4986 putenv ((char *) "DISPLAY=:0");
4990 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4991 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4993 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4994 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5001 memset (&data
, 0, sizeof (hc_global_data_t
));
5007 data
.proc_start
= proc_start
;
5010 char **myargv
= argv
;
5012 hc_thread_mutex_init (mux_dispatcher
);
5013 hc_thread_mutex_init (mux_counter
);
5014 hc_thread_mutex_init (mux_display
);
5015 hc_thread_mutex_init (mux_adl
);
5018 * commandline parameters
5022 uint version
= VERSION
;
5024 uint benchmark
= BENCHMARK
;
5025 uint benchmark_mode
= BENCHMARK_MODE
;
5028 uint username
= USERNAME
;
5029 uint remove
= REMOVE
;
5030 uint remove_timer
= REMOVE_TIMER
;
5031 uint64_t skip
= SKIP
;
5032 uint64_t limit
= LIMIT
;
5033 uint keyspace
= KEYSPACE
;
5034 uint potfile_disable
= POTFILE_DISABLE
;
5035 uint debug_mode
= DEBUG_MODE
;
5036 char *debug_file
= NULL
;
5037 char *induction_dir
= NULL
;
5038 char *outfile_check_dir
= NULL
;
5040 uint runtime
= RUNTIME
;
5041 uint hash_mode
= HASH_MODE
;
5042 uint attack_mode
= ATTACK_MODE
;
5043 uint markov_disable
= MARKOV_DISABLE
;
5044 uint markov_classic
= MARKOV_CLASSIC
;
5045 uint markov_threshold
= MARKOV_THRESHOLD
;
5046 char *markov_hcstat
= NULL
;
5047 char *outfile
= NULL
;
5048 uint outfile_format
= OUTFILE_FORMAT
;
5049 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5050 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5051 uint restore
= RESTORE
;
5052 uint restore_timer
= RESTORE_TIMER
;
5053 uint restore_disable
= RESTORE_DISABLE
;
5054 uint status
= STATUS
;
5055 uint status_timer
= STATUS_TIMER
;
5056 uint status_automat
= STATUS_AUTOMAT
;
5057 uint loopback
= LOOPBACK
;
5058 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5059 char *session
= NULL
;
5060 uint hex_charset
= HEX_CHARSET
;
5061 uint hex_salt
= HEX_SALT
;
5062 uint hex_wordlist
= HEX_WORDLIST
;
5063 uint rp_gen
= RP_GEN
;
5064 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5065 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5066 uint rp_gen_seed
= RP_GEN_SEED
;
5067 char *rule_buf_l
= (char *) RULE_BUF_L
;
5068 char *rule_buf_r
= (char *) RULE_BUF_R
;
5069 uint increment
= INCREMENT
;
5070 uint increment_min
= INCREMENT_MIN
;
5071 uint increment_max
= INCREMENT_MAX
;
5072 char *cpu_affinity
= NULL
;
5073 char *gpu_devices
= NULL
;
5074 char *gpu_platform
= NULL
;
5075 char *truecrypt_keyfiles
= NULL
;
5076 uint workload_profile
= WORKLOAD_PROFILE
;
5077 uint gpu_accel
= GPU_ACCEL
;
5078 uint gpu_loops
= GPU_LOOPS
;
5079 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5080 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5081 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5082 uint powertune_enable
= POWERTUNE_ENABLE
;
5083 uint logfile_disable
= LOGFILE_DISABLE
;
5084 uint segment_size
= SEGMENT_SIZE
;
5085 uint scrypt_tmto
= SCRYPT_TMTO
;
5086 char separator
= SEPARATOR
;
5087 uint bitmap_min
= BITMAP_MIN
;
5088 uint bitmap_max
= BITMAP_MAX
;
5089 char *custom_charset_1
= NULL
;
5090 char *custom_charset_2
= NULL
;
5091 char *custom_charset_3
= NULL
;
5092 char *custom_charset_4
= NULL
;
5094 #define IDX_HELP 'h'
5095 #define IDX_VERSION 'V'
5096 #define IDX_VERSION_LOWER 'v'
5097 #define IDX_QUIET 0xff02
5098 #define IDX_SHOW 0xff03
5099 #define IDX_LEFT 0xff04
5100 #define IDX_REMOVE 0xff05
5101 #define IDX_REMOVE_TIMER 0xff37
5102 #define IDX_SKIP 's'
5103 #define IDX_LIMIT 'l'
5104 #define IDX_KEYSPACE 0xff35
5105 #define IDX_POTFILE_DISABLE 0xff06
5106 #define IDX_DEBUG_MODE 0xff43
5107 #define IDX_DEBUG_FILE 0xff44
5108 #define IDX_INDUCTION_DIR 0xff46
5109 #define IDX_OUTFILE_CHECK_DIR 0xff47
5110 #define IDX_USERNAME 0xff07
5111 #define IDX_FORCE 0xff08
5112 #define IDX_RUNTIME 0xff09
5113 #define IDX_BENCHMARK 'b'
5114 #define IDX_BENCHMARK_MODE 0xff32
5115 #define IDX_HASH_MODE 'm'
5116 #define IDX_ATTACK_MODE 'a'
5117 #define IDX_RP_FILE 'r'
5118 #define IDX_RP_GEN 'g'
5119 #define IDX_RP_GEN_FUNC_MIN 0xff10
5120 #define IDX_RP_GEN_FUNC_MAX 0xff11
5121 #define IDX_RP_GEN_SEED 0xff34
5122 #define IDX_RULE_BUF_L 'j'
5123 #define IDX_RULE_BUF_R 'k'
5124 #define IDX_INCREMENT 'i'
5125 #define IDX_INCREMENT_MIN 0xff12
5126 #define IDX_INCREMENT_MAX 0xff13
5127 #define IDX_OUTFILE 'o'
5128 #define IDX_OUTFILE_FORMAT 0xff14
5129 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5130 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5131 #define IDX_RESTORE 0xff15
5132 #define IDX_RESTORE_DISABLE 0xff27
5133 #define IDX_STATUS 0xff17
5134 #define IDX_STATUS_TIMER 0xff18
5135 #define IDX_STATUS_AUTOMAT 0xff50
5136 #define IDX_LOOPBACK 0xff38
5137 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5138 #define IDX_SESSION 0xff19
5139 #define IDX_HEX_CHARSET 0xff20
5140 #define IDX_HEX_SALT 0xff21
5141 #define IDX_HEX_WORDLIST 0xff40
5142 #define IDX_MARKOV_DISABLE 0xff22
5143 #define IDX_MARKOV_CLASSIC 0xff23
5144 #define IDX_MARKOV_THRESHOLD 't'
5145 #define IDX_MARKOV_HCSTAT 0xff24
5146 #define IDX_CPU_AFFINITY 0xff25
5147 #define IDX_GPU_DEVICES 'd'
5148 #define IDX_GPU_PLATFORM 0xff72
5149 #define IDX_WORKLOAD_PROFILE 'w'
5150 #define IDX_GPU_ACCEL 'n'
5151 #define IDX_GPU_LOOPS 'u'
5152 #define IDX_GPU_TEMP_DISABLE 0xff29
5153 #define IDX_GPU_TEMP_ABORT 0xff30
5154 #define IDX_GPU_TEMP_RETAIN 0xff31
5155 #define IDX_POWERTUNE_ENABLE 0xff41
5156 #define IDX_LOGFILE_DISABLE 0xff51
5157 #define IDX_TRUECRYPT_KEYFILES 0xff52
5158 #define IDX_SCRYPT_TMTO 0xff61
5159 #define IDX_SEGMENT_SIZE 'c'
5160 #define IDX_SEPARATOR 'p'
5161 #define IDX_BITMAP_MIN 0xff70
5162 #define IDX_BITMAP_MAX 0xff71
5163 #define IDX_CUSTOM_CHARSET_1 '1'
5164 #define IDX_CUSTOM_CHARSET_2 '2'
5165 #define IDX_CUSTOM_CHARSET_3 '3'
5166 #define IDX_CUSTOM_CHARSET_4 '4'
5168 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5170 struct option long_options
[] =
5172 {"help", no_argument
, 0, IDX_HELP
},
5173 {"version", no_argument
, 0, IDX_VERSION
},
5174 {"quiet", no_argument
, 0, IDX_QUIET
},
5175 {"show", no_argument
, 0, IDX_SHOW
},
5176 {"left", no_argument
, 0, IDX_LEFT
},
5177 {"username", no_argument
, 0, IDX_USERNAME
},
5178 {"remove", no_argument
, 0, IDX_REMOVE
},
5179 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5180 {"skip", required_argument
, 0, IDX_SKIP
},
5181 {"limit", required_argument
, 0, IDX_LIMIT
},
5182 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5183 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5184 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5185 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5186 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5187 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5188 {"force", no_argument
, 0, IDX_FORCE
},
5189 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5190 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5191 {"restore", no_argument
, 0, IDX_RESTORE
},
5192 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5193 {"status", no_argument
, 0, IDX_STATUS
},
5194 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5195 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5196 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5197 {"weak-hash-threshold",
5198 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5199 {"session", required_argument
, 0, IDX_SESSION
},
5200 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5201 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5202 {"generate-rules-func-min",
5203 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5204 {"generate-rules-func-max",
5205 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5206 {"generate-rules-seed",
5207 required_argument
, 0, IDX_RP_GEN_SEED
},
5208 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5209 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5210 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5211 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5212 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5213 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5214 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5215 {"outfile-autohex-disable",
5216 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5217 {"outfile-check-timer",
5218 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5219 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5220 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5221 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5222 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5223 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5224 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5225 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5226 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5227 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5228 {"gpu-platform", required_argument
, 0, IDX_GPU_PLATFORM
},
5229 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5230 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5231 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5232 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5233 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5234 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5235 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5236 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5237 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5238 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5239 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5241 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5242 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5243 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5244 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5245 {"increment", no_argument
, 0, IDX_INCREMENT
},
5246 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5247 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5248 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5249 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5250 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5251 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5256 uint rp_files_cnt
= 0;
5258 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5267 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5271 case IDX_HELP
: usage
= 1; break;
5273 case IDX_VERSION_LOWER
: version
= 1; break;
5274 case IDX_RESTORE
: restore
= 1; break;
5275 case IDX_SESSION
: session
= optarg
; break;
5276 case IDX_SHOW
: show
= 1; break;
5277 case IDX_LEFT
: left
= 1; break;
5278 case '?': return (-1);
5284 log_error ("ERROR: Invalid argument specified");
5295 log_info (VERSION_TXT
);
5302 usage_big_print (PROGNAME
);
5311 if (session
== NULL
) session
= (char *) PROGNAME
;
5313 size_t session_size
= strlen (session
) + 32;
5315 data
.session
= session
;
5317 char *eff_restore_file
= (char *) mymalloc (session_size
);
5318 char *new_restore_file
= (char *) mymalloc (session_size
);
5320 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5321 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5323 data
.eff_restore_file
= eff_restore_file
;
5324 data
.new_restore_file
= new_restore_file
;
5326 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5328 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5329 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5334 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5335 if ((show
== 1) || (left
== 1))
5337 restore_disable
= 1;
5342 data
.restore_disable
= restore_disable
;
5344 restore_data_t
*rd
= init_restore (argc
, argv
);
5354 read_restore (eff_restore_file
, rd
);
5356 if (rd
->version_bin
< RESTORE_MIN
)
5358 log_error ("ERROR: Incompatible restore-file version");
5367 rd
->pid
= getpid ();
5369 rd
->pid
= GetCurrentProcessId ();
5373 uint hash_mode_chgd
= 0;
5374 uint runtime_chgd
= 0;
5375 uint gpu_loops_chgd
= 0;
5376 uint gpu_accel_chgd
= 0;
5377 uint attack_mode_chgd
= 0;
5378 uint outfile_format_chgd
= 0;
5379 uint rp_gen_seed_chgd
= 0;
5380 uint remove_timer_chgd
= 0;
5381 uint increment_min_chgd
= 0;
5382 uint increment_max_chgd
= 0;
5383 uint gpu_temp_abort_chgd
= 0;
5384 uint gpu_temp_retain_chgd
= 0;
5390 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5394 //case IDX_HELP: usage = 1; break;
5395 //case IDX_VERSION: version = 1; break;
5396 //case IDX_RESTORE: restore = 1; break;
5397 case IDX_QUIET
: quiet
= 1; break;
5398 //case IDX_SHOW: show = 1; break;
5399 case IDX_SHOW
: break;
5400 //case IDX_LEFT: left = 1; break;
5401 case IDX_LEFT
: break;
5402 case IDX_USERNAME
: username
= 1; break;
5403 case IDX_REMOVE
: remove
= 1; break;
5404 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5405 remove_timer_chgd
= 1; break;
5406 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5407 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5408 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5409 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5410 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5411 case IDX_FORCE
: force
= 1; break;
5412 case IDX_SKIP
: skip
= atoll (optarg
); break;
5413 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5414 case IDX_KEYSPACE
: keyspace
= 1; break;
5415 case IDX_BENCHMARK
: benchmark
= 1; break;
5416 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5417 case IDX_RESTORE
: break;
5418 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5419 case IDX_STATUS
: status
= 1; break;
5420 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5421 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5422 case IDX_LOOPBACK
: loopback
= 1; break;
5423 case IDX_WEAK_HASH_THRESHOLD
:
5424 weak_hash_threshold
= atoi (optarg
); break;
5425 //case IDX_SESSION: session = optarg; break;
5426 case IDX_SESSION
: break;
5427 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5428 hash_mode_chgd
= 1; break;
5429 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5430 runtime_chgd
= 1; break;
5431 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5432 attack_mode_chgd
= 1; break;
5433 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5434 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5435 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5436 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5437 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5438 rp_gen_seed_chgd
= 1; break;
5439 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5440 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5441 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5442 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5443 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5444 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5445 case IDX_OUTFILE
: outfile
= optarg
; break;
5446 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5447 outfile_format_chgd
= 1; break;
5448 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5449 outfile_autohex
= 0; break;
5450 case IDX_OUTFILE_CHECK_TIMER
:
5451 outfile_check_timer
= atoi (optarg
); break;
5452 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5453 case IDX_HEX_SALT
: hex_salt
= 1; break;
5454 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5455 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5456 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5457 case IDX_GPU_PLATFORM
: gpu_platform
= optarg
; break;
5458 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5459 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5460 gpu_accel_chgd
= 1; break;
5461 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5462 gpu_loops_chgd
= 1; break;
5463 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5464 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5465 gpu_temp_abort
= atoi (optarg
); break;
5466 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5467 gpu_temp_retain
= atoi (optarg
); break;
5468 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5469 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5470 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5471 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5472 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5473 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5474 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5475 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5476 case IDX_INCREMENT
: increment
= 1; break;
5477 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5478 increment_min_chgd
= 1; break;
5479 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5480 increment_max_chgd
= 1; break;
5481 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5482 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5483 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5484 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5487 log_error ("ERROR: Invalid argument specified");
5494 log_error ("ERROR: Invalid argument specified");
5500 * Inform user things getting started,
5501 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5502 * - we do not need to check algorithm_pos
5509 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5513 else if (restore
== 1)
5515 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5521 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5531 if (attack_mode
> 7)
5533 log_error ("ERROR: Invalid attack-mode specified");
5538 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5540 log_error ("ERROR: Invalid runtime specified");
5545 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5547 log_error ("ERROR: Invalid hash-type specified");
5552 // renamed hash modes
5566 log_error ("Old -m specified, use -m %d instead", n
);
5574 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5576 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5582 if (outfile_format
> 16)
5584 log_error ("ERROR: Invalid outfile-format specified");
5591 if (outfile_format_chgd
== 1)
5593 if (outfile_format
> 1)
5595 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5602 outfile_format
= OUTFILE_FMT_HASH
;
5608 if (outfile_format_chgd
== 1)
5610 if ((outfile_format
> 7) && (outfile_format
< 16))
5612 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5619 if (increment_min
< INCREMENT_MIN
)
5621 log_error ("ERROR: Invalid increment-min specified");
5626 if (increment_max
> INCREMENT_MAX
)
5628 log_error ("ERROR: Invalid increment-max specified");
5633 if (increment_min
> increment_max
)
5635 log_error ("ERROR: Invalid increment-min specified");
5640 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5642 log_error ("ERROR: increment is not allowed in attack-mode 0");
5647 if ((increment
== 0) && (increment_min_chgd
== 1))
5649 log_error ("ERROR: increment-min is only supported together with increment switch");
5654 if ((increment
== 0) && (increment_max_chgd
== 1))
5656 log_error ("ERROR: increment-max is only supported together with increment switch");
5661 if (rp_files_cnt
&& rp_gen
)
5663 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5668 if (rp_files_cnt
|| rp_gen
)
5670 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5672 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5678 if (rp_gen_func_min
> rp_gen_func_max
)
5680 log_error ("ERROR: Invalid rp-gen-func-min specified");
5685 if (gpu_accel_chgd
== 1)
5687 if (workload_profile
!= WORKLOAD_PROFILE
)
5689 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5696 log_error ("ERROR: Invalid gpu-accel specified");
5701 if (gpu_accel
> 800)
5703 log_error ("ERROR: Invalid gpu-accel specified");
5709 if (gpu_loops_chgd
== 1)
5711 if (workload_profile
!= WORKLOAD_PROFILE
)
5713 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5720 log_error ("ERROR: Invalid gpu-loops specified");
5725 if (gpu_loops
> 1024)
5727 log_error ("ERROR: Invalid gpu-loops specified");
5735 if (workload_profile
!= WORKLOAD_PROFILE
)
5737 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5743 if ((workload_profile
< 1) || (workload_profile
> 3))
5745 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5750 if (show
== 1 || left
== 1)
5752 attack_mode
= ATTACK_MODE_NONE
;
5756 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5761 if (potfile_disable
== 1)
5763 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5769 uint attack_kern
= ATTACK_KERN_NONE
;
5771 switch (attack_mode
)
5773 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5774 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5775 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5776 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5777 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5784 int num_additional_params
= 1;
5786 if (attack_kern
== ATTACK_KERN_COMBI
)
5788 num_additional_params
= 2;
5791 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5793 if (keyspace_wordlist_specified
== 0) optind
--;
5796 if (attack_kern
== ATTACK_KERN_NONE
)
5798 if ((optind
+ 1) != myargc
)
5800 usage_mini_print (myargv
[0]);
5805 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5807 if ((optind
+ 1) > myargc
)
5809 usage_mini_print (myargv
[0]);
5814 else if (attack_kern
== ATTACK_KERN_COMBI
)
5816 if ((optind
+ 3) != myargc
)
5818 usage_mini_print (myargv
[0]);
5823 else if (attack_kern
== ATTACK_KERN_BF
)
5825 if ((optind
+ 1) > myargc
)
5827 usage_mini_print (myargv
[0]);
5834 usage_mini_print (myargv
[0]);
5841 if (myargv
[optind
] != 0)
5843 log_error ("ERROR: Invalid argument for benchmark mode specified");
5848 if (attack_mode_chgd
== 1)
5850 if (attack_mode
!= ATTACK_MODE_BF
)
5852 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5858 if (benchmark_mode
== 0)
5862 else if (benchmark_mode
== 1)
5864 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5866 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5873 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5879 if (skip
!= 0 && limit
!= 0)
5888 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5894 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5899 potfile_disable
= 1;
5901 restore_disable
= 1;
5905 weak_hash_threshold
= 0;
5910 if (remove_timer_chgd
== 1)
5914 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5919 if (remove_timer
< 1)
5921 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5929 if (attack_mode
== ATTACK_MODE_BF
)
5931 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5935 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5937 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5939 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5948 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5950 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5955 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5957 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5965 log_error ("ERROR: Invalid debug-mode specified");
5970 if (debug_file
!= NULL
)
5974 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5980 if (induction_dir
!= NULL
)
5982 if (attack_mode
== ATTACK_MODE_BF
)
5984 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5991 * induction directory
5994 char *induction_directory
= NULL
;
5996 if (attack_mode
!= ATTACK_MODE_BF
)
5998 if (induction_dir
== NULL
)
6000 induction_directory
= (char *) mymalloc (session_size
);
6002 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
6004 // create induction folder if it does not already exist
6008 if (rmdir (induction_directory
) == -1)
6010 if (errno
== ENOENT
)
6012 // good, we can ignore
6014 else if (errno
== ENOTEMPTY
)
6016 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6018 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
6020 if (rename (induction_directory
, induction_directory_mv
) != 0)
6022 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6029 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6036 #define mkdir(name,mode) mkdir (name)
6039 if (mkdir (induction_directory
, 0700) == -1)
6041 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6049 induction_directory
= induction_dir
;
6053 data
.induction_directory
= induction_directory
;
6059 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
6061 char *loopback_file
= (char *) mymalloc (loopback_size
);
6064 * outfile-check directory
6067 char *outfile_check_directory
= NULL
;
6069 if (outfile_check_dir
== NULL
)
6071 outfile_check_directory
= (char *) mymalloc (session_size
);
6073 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
6077 outfile_check_directory
= outfile_check_dir
;
6080 data
.outfile_check_directory
= outfile_check_directory
;
6084 struct stat outfile_check_stat
;
6086 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6088 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6092 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6097 else if (outfile_check_dir
== NULL
)
6100 #define mkdir(name,mode) mkdir (name)
6103 if (mkdir (outfile_check_directory
, 0700) == -1)
6105 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6113 * special other stuff
6116 if (hash_mode
== 9710)
6119 outfile_format_chgd
= 1;
6122 if (hash_mode
== 9810)
6125 outfile_format_chgd
= 1;
6128 if (hash_mode
== 10410)
6131 outfile_format_chgd
= 1;
6138 data
.hash_mode
= hash_mode
;
6139 data
.restore
= restore
;
6140 data
.restore_timer
= restore_timer
;
6141 data
.restore_disable
= restore_disable
;
6142 data
.status
= status
;
6143 data
.status_timer
= status_timer
;
6144 data
.status_automat
= status_automat
;
6145 data
.loopback
= loopback
;
6146 data
.runtime
= runtime
;
6147 data
.remove
= remove
;
6148 data
.remove_timer
= remove_timer
;
6149 data
.debug_mode
= debug_mode
;
6150 data
.debug_file
= debug_file
;
6151 data
.username
= username
;
6153 data
.outfile
= outfile
;
6154 data
.outfile_format
= outfile_format
;
6155 data
.outfile_autohex
= outfile_autohex
;
6156 data
.hex_charset
= hex_charset
;
6157 data
.hex_salt
= hex_salt
;
6158 data
.hex_wordlist
= hex_wordlist
;
6159 data
.separator
= separator
;
6160 data
.rp_files
= rp_files
;
6161 data
.rp_files_cnt
= rp_files_cnt
;
6162 data
.rp_gen
= rp_gen
;
6163 data
.rp_gen_seed
= rp_gen_seed
;
6165 data
.benchmark
= benchmark
;
6168 data
.powertune_enable
= powertune_enable
;
6169 data
.logfile_disable
= logfile_disable
;
6170 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6171 data
.scrypt_tmto
= scrypt_tmto
;
6174 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6179 char *resolved_path
= realpath (myargv
[0], NULL
);
6181 char *install_dir
= get_install_dir (resolved_path
);
6182 char *profile_dir
= NULL
;
6183 char *session_dir
= NULL
;
6185 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6187 struct passwd
*pw
= getpwuid (getuid ());
6189 const char *homedir
= pw
->pw_dir
;
6191 profile_dir
= get_profile_dir (homedir
);
6192 session_dir
= get_session_dir (profile_dir
, session
);
6196 profile_dir
= install_dir
;
6197 session_dir
= install_dir
;
6200 myfree (resolved_path
);
6204 char *install_dir
= get_install_dir (myargv
[0]);
6205 char *profile_dir
= install_dir
;
6206 char *session_dir
= install_dir
;
6210 data
.install_dir
= install_dir
;
6211 data
.profile_dir
= profile_dir
;
6212 data
.session_dir
= session_dir
;
6220 set_cpu_affinity (cpu_affinity
);
6223 if (rp_gen_seed_chgd
== 0)
6229 srand (rp_gen_seed
);
6236 if (logfile_disable
== 0)
6238 size_t logfile_size
= strlen (session
) + 32;
6240 char *logfile
= (char *) mymalloc (logfile_size
);
6242 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6244 data
.logfile
= logfile
;
6246 char *topid
= logfile_generate_topid ();
6251 // logfile_append() checks for logfile_disable internally to make it easier from here
6253 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6254 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6255 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6256 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6257 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6258 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6259 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6260 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6261 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6262 #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));
6264 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6265 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6266 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6267 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6268 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6269 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6270 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6271 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6273 logfile_top_msg ("START");
6275 logfile_top_uint (attack_mode
);
6276 logfile_top_uint (attack_kern
);
6277 logfile_top_uint (benchmark
);
6278 logfile_top_uint (benchmark_mode
);
6279 logfile_top_uint (bitmap_min
);
6280 logfile_top_uint (bitmap_max
);
6281 logfile_top_uint (debug_mode
);
6282 logfile_top_uint (force
);
6283 logfile_top_uint (gpu_accel
);
6284 logfile_top_uint (gpu_loops
);
6285 logfile_top_uint (gpu_temp_abort
);
6286 logfile_top_uint (gpu_temp_disable
);
6287 logfile_top_uint (gpu_temp_retain
);
6288 logfile_top_uint (hash_mode
);
6289 logfile_top_uint (hex_charset
);
6290 logfile_top_uint (hex_salt
);
6291 logfile_top_uint (hex_wordlist
);
6292 logfile_top_uint (increment
);
6293 logfile_top_uint (increment_max
);
6294 logfile_top_uint (increment_min
);
6295 logfile_top_uint (keyspace
);
6296 logfile_top_uint (left
);
6297 logfile_top_uint (logfile_disable
);
6298 logfile_top_uint (loopback
);
6299 logfile_top_uint (markov_classic
);
6300 logfile_top_uint (markov_disable
);
6301 logfile_top_uint (markov_threshold
);
6302 logfile_top_uint (outfile_autohex
);
6303 logfile_top_uint (outfile_check_timer
);
6304 logfile_top_uint (outfile_format
);
6305 logfile_top_uint (potfile_disable
);
6306 logfile_top_uint (powertune_enable
);
6307 logfile_top_uint (scrypt_tmto
);
6308 logfile_top_uint (quiet
);
6309 logfile_top_uint (remove
);
6310 logfile_top_uint (remove_timer
);
6311 logfile_top_uint (restore
);
6312 logfile_top_uint (restore_disable
);
6313 logfile_top_uint (restore_timer
);
6314 logfile_top_uint (rp_gen
);
6315 logfile_top_uint (rp_gen_func_max
);
6316 logfile_top_uint (rp_gen_func_min
);
6317 logfile_top_uint (rp_gen_seed
);
6318 logfile_top_uint (runtime
);
6319 logfile_top_uint (segment_size
);
6320 logfile_top_uint (show
);
6321 logfile_top_uint (status
);
6322 logfile_top_uint (status_automat
);
6323 logfile_top_uint (status_timer
);
6324 logfile_top_uint (usage
);
6325 logfile_top_uint (username
);
6326 logfile_top_uint (version
);
6327 logfile_top_uint (weak_hash_threshold
);
6328 logfile_top_uint (workload_profile
);
6329 logfile_top_uint64 (limit
);
6330 logfile_top_uint64 (skip
);
6331 logfile_top_char (separator
);
6332 logfile_top_string (cpu_affinity
);
6333 logfile_top_string (custom_charset_1
);
6334 logfile_top_string (custom_charset_2
);
6335 logfile_top_string (custom_charset_3
);
6336 logfile_top_string (custom_charset_4
);
6337 logfile_top_string (debug_file
);
6338 logfile_top_string (gpu_devices
);
6339 logfile_top_string (gpu_platform
);
6340 logfile_top_string (induction_dir
);
6341 logfile_top_string (markov_hcstat
);
6342 logfile_top_string (outfile
);
6343 logfile_top_string (outfile_check_dir
);
6344 logfile_top_string (rule_buf_l
);
6345 logfile_top_string (rule_buf_r
);
6346 logfile_top_string (session
);
6347 logfile_top_string (truecrypt_keyfiles
);
6353 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6362 * disable useless stuff for benchmark
6367 restore_disable
= 1;
6368 potfile_disable
= 1;
6369 weak_hash_threshold
= 0;
6371 data
.restore_timer
= restore_timer
;
6372 data
.status_timer
= status_timer
;
6373 data
.restore_disable
= restore_disable
;
6375 if (benchmark_mode
== 1)
6381 * force attack mode to be bruteforce
6384 attack_mode
= ATTACK_MODE_BF
;
6385 attack_kern
= ATTACK_KERN_BF
;
6387 if (runtime_chgd
== 0)
6391 if (benchmark_mode
== 1) runtime
= 17;
6393 data
.runtime
= runtime
;
6403 uint attack_exec
= 0;
6407 uint esalt_size
= 0;
6409 uint dgst_pos0
= -1;
6410 uint dgst_pos1
= -1;
6411 uint dgst_pos2
= -1;
6412 uint dgst_pos3
= -1;
6414 int (*parse_func
) (char *, uint
, hash_t
*);
6415 int (*sort_by_digest
) (const void *, const void *);
6417 uint algorithm_pos
= 0;
6418 uint algorithm_max
= 1;
6420 uint
*algorithms
= default_benchmark_algorithms
;
6422 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6424 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6427 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6428 * the following algos are skipped entirely
6431 if (algorithm_pos
> 0)
6435 rd
= init_restore (argc
, argv
);
6441 * update hash_mode in case of multihash benchmark
6446 if (hash_mode_chgd
== 0)
6448 hash_mode
= algorithms
[algorithm_pos
];
6450 data
.hash_mode
= hash_mode
;
6460 case 0: hash_type
= HASH_TYPE_MD5
;
6461 salt_type
= SALT_TYPE_NONE
;
6462 attack_exec
= ATTACK_EXEC_ON_GPU
;
6463 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6464 | OPTS_TYPE_PT_ADD80
6465 | OPTS_TYPE_PT_ADDBITS14
;
6466 kern_type
= KERN_TYPE_MD5
;
6467 dgst_size
= DGST_SIZE_4_4
;
6468 parse_func
= md5_parse_hash
;
6469 sort_by_digest
= sort_by_digest_4_4
;
6470 opti_type
= OPTI_TYPE_ZERO_BYTE
6471 | OPTI_TYPE_PRECOMPUTE_INIT
6472 | OPTI_TYPE_PRECOMPUTE_MERKLE
6473 | OPTI_TYPE_MEET_IN_MIDDLE
6474 | OPTI_TYPE_EARLY_SKIP
6475 | OPTI_TYPE_NOT_ITERATED
6476 | OPTI_TYPE_NOT_SALTED
6477 | OPTI_TYPE_RAW_HASH
;
6484 case 10: hash_type
= HASH_TYPE_MD5
;
6485 salt_type
= SALT_TYPE_INTERN
;
6486 attack_exec
= ATTACK_EXEC_ON_GPU
;
6487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6488 | OPTS_TYPE_ST_ADD80
6489 | OPTS_TYPE_ST_ADDBITS14
;
6490 kern_type
= KERN_TYPE_MD5_PWSLT
;
6491 dgst_size
= DGST_SIZE_4_4
;
6492 parse_func
= md5s_parse_hash
;
6493 sort_by_digest
= sort_by_digest_4_4
;
6494 opti_type
= OPTI_TYPE_ZERO_BYTE
6495 | OPTI_TYPE_PRECOMPUTE_INIT
6496 | OPTI_TYPE_PRECOMPUTE_MERKLE
6497 | OPTI_TYPE_MEET_IN_MIDDLE
6498 | OPTI_TYPE_EARLY_SKIP
6499 | OPTI_TYPE_NOT_ITERATED
6500 | OPTI_TYPE_APPENDED_SALT
6501 | OPTI_TYPE_RAW_HASH
;
6508 case 11: hash_type
= HASH_TYPE_MD5
;
6509 salt_type
= SALT_TYPE_INTERN
;
6510 attack_exec
= ATTACK_EXEC_ON_GPU
;
6511 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6512 | OPTS_TYPE_ST_ADD80
6513 | OPTS_TYPE_ST_ADDBITS14
;
6514 kern_type
= KERN_TYPE_MD5_PWSLT
;
6515 dgst_size
= DGST_SIZE_4_4
;
6516 parse_func
= joomla_parse_hash
;
6517 sort_by_digest
= sort_by_digest_4_4
;
6518 opti_type
= OPTI_TYPE_ZERO_BYTE
6519 | OPTI_TYPE_PRECOMPUTE_INIT
6520 | OPTI_TYPE_PRECOMPUTE_MERKLE
6521 | OPTI_TYPE_MEET_IN_MIDDLE
6522 | OPTI_TYPE_EARLY_SKIP
6523 | OPTI_TYPE_NOT_ITERATED
6524 | OPTI_TYPE_APPENDED_SALT
6525 | OPTI_TYPE_RAW_HASH
;
6532 case 12: hash_type
= HASH_TYPE_MD5
;
6533 salt_type
= SALT_TYPE_INTERN
;
6534 attack_exec
= ATTACK_EXEC_ON_GPU
;
6535 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6536 | OPTS_TYPE_ST_ADD80
6537 | OPTS_TYPE_ST_ADDBITS14
;
6538 kern_type
= KERN_TYPE_MD5_PWSLT
;
6539 dgst_size
= DGST_SIZE_4_4
;
6540 parse_func
= postgresql_parse_hash
;
6541 sort_by_digest
= sort_by_digest_4_4
;
6542 opti_type
= OPTI_TYPE_ZERO_BYTE
6543 | OPTI_TYPE_PRECOMPUTE_INIT
6544 | OPTI_TYPE_PRECOMPUTE_MERKLE
6545 | OPTI_TYPE_MEET_IN_MIDDLE
6546 | OPTI_TYPE_EARLY_SKIP
6547 | OPTI_TYPE_NOT_ITERATED
6548 | OPTI_TYPE_APPENDED_SALT
6549 | OPTI_TYPE_RAW_HASH
;
6556 case 20: hash_type
= HASH_TYPE_MD5
;
6557 salt_type
= SALT_TYPE_INTERN
;
6558 attack_exec
= ATTACK_EXEC_ON_GPU
;
6559 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6560 | OPTS_TYPE_PT_ADD80
6561 | OPTS_TYPE_PT_ADDBITS14
;
6562 kern_type
= KERN_TYPE_MD5_SLTPW
;
6563 dgst_size
= DGST_SIZE_4_4
;
6564 parse_func
= md5s_parse_hash
;
6565 sort_by_digest
= sort_by_digest_4_4
;
6566 opti_type
= OPTI_TYPE_ZERO_BYTE
6567 | OPTI_TYPE_PRECOMPUTE_INIT
6568 | OPTI_TYPE_PRECOMPUTE_MERKLE
6569 | OPTI_TYPE_EARLY_SKIP
6570 | OPTI_TYPE_NOT_ITERATED
6571 | OPTI_TYPE_PREPENDED_SALT
6572 | OPTI_TYPE_RAW_HASH
;
6579 case 21: hash_type
= HASH_TYPE_MD5
;
6580 salt_type
= SALT_TYPE_INTERN
;
6581 attack_exec
= ATTACK_EXEC_ON_GPU
;
6582 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6583 | OPTS_TYPE_PT_ADD80
6584 | OPTS_TYPE_PT_ADDBITS14
;
6585 kern_type
= KERN_TYPE_MD5_SLTPW
;
6586 dgst_size
= DGST_SIZE_4_4
;
6587 parse_func
= osc_parse_hash
;
6588 sort_by_digest
= sort_by_digest_4_4
;
6589 opti_type
= OPTI_TYPE_ZERO_BYTE
6590 | OPTI_TYPE_PRECOMPUTE_INIT
6591 | OPTI_TYPE_PRECOMPUTE_MERKLE
6592 | OPTI_TYPE_EARLY_SKIP
6593 | OPTI_TYPE_NOT_ITERATED
6594 | OPTI_TYPE_PREPENDED_SALT
6595 | OPTI_TYPE_RAW_HASH
;
6602 case 22: hash_type
= HASH_TYPE_MD5
;
6603 salt_type
= SALT_TYPE_EMBEDDED
;
6604 attack_exec
= ATTACK_EXEC_ON_GPU
;
6605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6606 | OPTS_TYPE_PT_ADD80
6607 | OPTS_TYPE_PT_ADDBITS14
;
6608 kern_type
= KERN_TYPE_MD5_SLTPW
;
6609 dgst_size
= DGST_SIZE_4_4
;
6610 parse_func
= netscreen_parse_hash
;
6611 sort_by_digest
= sort_by_digest_4_4
;
6612 opti_type
= OPTI_TYPE_ZERO_BYTE
6613 | OPTI_TYPE_PRECOMPUTE_INIT
6614 | OPTI_TYPE_PRECOMPUTE_MERKLE
6615 | OPTI_TYPE_EARLY_SKIP
6616 | OPTI_TYPE_NOT_ITERATED
6617 | OPTI_TYPE_PREPENDED_SALT
6618 | OPTI_TYPE_RAW_HASH
;
6625 case 23: hash_type
= HASH_TYPE_MD5
;
6626 salt_type
= SALT_TYPE_EMBEDDED
;
6627 attack_exec
= ATTACK_EXEC_ON_GPU
;
6628 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6629 | OPTS_TYPE_PT_ADD80
6630 | OPTS_TYPE_PT_ADDBITS14
;
6631 kern_type
= KERN_TYPE_MD5_SLTPW
;
6632 dgst_size
= DGST_SIZE_4_4
;
6633 parse_func
= skype_parse_hash
;
6634 sort_by_digest
= sort_by_digest_4_4
;
6635 opti_type
= OPTI_TYPE_ZERO_BYTE
6636 | OPTI_TYPE_PRECOMPUTE_INIT
6637 | OPTI_TYPE_PRECOMPUTE_MERKLE
6638 | OPTI_TYPE_EARLY_SKIP
6639 | OPTI_TYPE_NOT_ITERATED
6640 | OPTI_TYPE_PREPENDED_SALT
6641 | OPTI_TYPE_RAW_HASH
;
6648 case 30: hash_type
= HASH_TYPE_MD5
;
6649 salt_type
= SALT_TYPE_INTERN
;
6650 attack_exec
= ATTACK_EXEC_ON_GPU
;
6651 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6652 | OPTS_TYPE_PT_UNICODE
6653 | OPTS_TYPE_ST_ADD80
6654 | OPTS_TYPE_ST_ADDBITS14
;
6655 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6656 dgst_size
= DGST_SIZE_4_4
;
6657 parse_func
= md5s_parse_hash
;
6658 sort_by_digest
= sort_by_digest_4_4
;
6659 opti_type
= OPTI_TYPE_ZERO_BYTE
6660 | OPTI_TYPE_PRECOMPUTE_INIT
6661 | OPTI_TYPE_PRECOMPUTE_MERKLE
6662 | OPTI_TYPE_MEET_IN_MIDDLE
6663 | OPTI_TYPE_EARLY_SKIP
6664 | OPTI_TYPE_NOT_ITERATED
6665 | OPTI_TYPE_APPENDED_SALT
6666 | OPTI_TYPE_RAW_HASH
;
6673 case 40: hash_type
= HASH_TYPE_MD5
;
6674 salt_type
= SALT_TYPE_INTERN
;
6675 attack_exec
= ATTACK_EXEC_ON_GPU
;
6676 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6677 | OPTS_TYPE_PT_ADD80
6678 | OPTS_TYPE_PT_ADDBITS14
6679 | OPTS_TYPE_PT_UNICODE
;
6680 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6681 dgst_size
= DGST_SIZE_4_4
;
6682 parse_func
= md5s_parse_hash
;
6683 sort_by_digest
= sort_by_digest_4_4
;
6684 opti_type
= OPTI_TYPE_ZERO_BYTE
6685 | OPTI_TYPE_PRECOMPUTE_INIT
6686 | OPTI_TYPE_PRECOMPUTE_MERKLE
6687 | OPTI_TYPE_EARLY_SKIP
6688 | OPTI_TYPE_NOT_ITERATED
6689 | OPTI_TYPE_PREPENDED_SALT
6690 | OPTI_TYPE_RAW_HASH
;
6697 case 50: hash_type
= HASH_TYPE_MD5
;
6698 salt_type
= SALT_TYPE_INTERN
;
6699 attack_exec
= ATTACK_EXEC_ON_GPU
;
6700 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6701 | OPTS_TYPE_ST_ADD80
6702 | OPTS_TYPE_ST_ADDBITS14
;
6703 kern_type
= KERN_TYPE_HMACMD5_PW
;
6704 dgst_size
= DGST_SIZE_4_4
;
6705 parse_func
= hmacmd5_parse_hash
;
6706 sort_by_digest
= sort_by_digest_4_4
;
6707 opti_type
= OPTI_TYPE_ZERO_BYTE
6708 | OPTI_TYPE_NOT_ITERATED
;
6715 case 60: hash_type
= HASH_TYPE_MD5
;
6716 salt_type
= SALT_TYPE_INTERN
;
6717 attack_exec
= ATTACK_EXEC_ON_GPU
;
6718 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6719 | OPTS_TYPE_PT_ADD80
6720 | OPTS_TYPE_PT_ADDBITS14
;
6721 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6722 dgst_size
= DGST_SIZE_4_4
;
6723 parse_func
= hmacmd5_parse_hash
;
6724 sort_by_digest
= sort_by_digest_4_4
;
6725 opti_type
= OPTI_TYPE_ZERO_BYTE
6726 | OPTI_TYPE_NOT_ITERATED
;
6733 case 100: hash_type
= HASH_TYPE_SHA1
;
6734 salt_type
= SALT_TYPE_NONE
;
6735 attack_exec
= ATTACK_EXEC_ON_GPU
;
6736 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6737 | OPTS_TYPE_PT_ADD80
6738 | OPTS_TYPE_PT_ADDBITS15
;
6739 kern_type
= KERN_TYPE_SHA1
;
6740 dgst_size
= DGST_SIZE_4_5
;
6741 parse_func
= sha1_parse_hash
;
6742 sort_by_digest
= sort_by_digest_4_5
;
6743 opti_type
= OPTI_TYPE_ZERO_BYTE
6744 | OPTI_TYPE_PRECOMPUTE_INIT
6745 | OPTI_TYPE_PRECOMPUTE_MERKLE
6746 | OPTI_TYPE_EARLY_SKIP
6747 | OPTI_TYPE_NOT_ITERATED
6748 | OPTI_TYPE_NOT_SALTED
6749 | OPTI_TYPE_RAW_HASH
;
6756 case 101: hash_type
= HASH_TYPE_SHA1
;
6757 salt_type
= SALT_TYPE_NONE
;
6758 attack_exec
= ATTACK_EXEC_ON_GPU
;
6759 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6760 | OPTS_TYPE_PT_ADD80
6761 | OPTS_TYPE_PT_ADDBITS15
;
6762 kern_type
= KERN_TYPE_SHA1
;
6763 dgst_size
= DGST_SIZE_4_5
;
6764 parse_func
= sha1b64_parse_hash
;
6765 sort_by_digest
= sort_by_digest_4_5
;
6766 opti_type
= OPTI_TYPE_ZERO_BYTE
6767 | OPTI_TYPE_PRECOMPUTE_INIT
6768 | OPTI_TYPE_PRECOMPUTE_MERKLE
6769 | OPTI_TYPE_EARLY_SKIP
6770 | OPTI_TYPE_NOT_ITERATED
6771 | OPTI_TYPE_NOT_SALTED
6772 | OPTI_TYPE_RAW_HASH
;
6779 case 110: hash_type
= HASH_TYPE_SHA1
;
6780 salt_type
= SALT_TYPE_INTERN
;
6781 attack_exec
= ATTACK_EXEC_ON_GPU
;
6782 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6783 | OPTS_TYPE_ST_ADD80
6784 | OPTS_TYPE_ST_ADDBITS15
;
6785 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6786 dgst_size
= DGST_SIZE_4_5
;
6787 parse_func
= sha1s_parse_hash
;
6788 sort_by_digest
= sort_by_digest_4_5
;
6789 opti_type
= OPTI_TYPE_ZERO_BYTE
6790 | OPTI_TYPE_PRECOMPUTE_INIT
6791 | OPTI_TYPE_PRECOMPUTE_MERKLE
6792 | OPTI_TYPE_EARLY_SKIP
6793 | OPTI_TYPE_NOT_ITERATED
6794 | OPTI_TYPE_APPENDED_SALT
6795 | OPTI_TYPE_RAW_HASH
;
6802 case 111: hash_type
= HASH_TYPE_SHA1
;
6803 salt_type
= SALT_TYPE_EMBEDDED
;
6804 attack_exec
= ATTACK_EXEC_ON_GPU
;
6805 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6806 | OPTS_TYPE_ST_ADD80
6807 | OPTS_TYPE_ST_ADDBITS15
;
6808 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6809 dgst_size
= DGST_SIZE_4_5
;
6810 parse_func
= sha1b64s_parse_hash
;
6811 sort_by_digest
= sort_by_digest_4_5
;
6812 opti_type
= OPTI_TYPE_ZERO_BYTE
6813 | OPTI_TYPE_PRECOMPUTE_INIT
6814 | OPTI_TYPE_PRECOMPUTE_MERKLE
6815 | OPTI_TYPE_EARLY_SKIP
6816 | OPTI_TYPE_NOT_ITERATED
6817 | OPTI_TYPE_APPENDED_SALT
6818 | OPTI_TYPE_RAW_HASH
;
6825 case 112: hash_type
= HASH_TYPE_SHA1
;
6826 salt_type
= SALT_TYPE_INTERN
;
6827 attack_exec
= ATTACK_EXEC_ON_GPU
;
6828 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6829 | OPTS_TYPE_ST_ADD80
6830 | OPTS_TYPE_ST_ADDBITS15
6832 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6833 dgst_size
= DGST_SIZE_4_5
;
6834 parse_func
= oracles_parse_hash
;
6835 sort_by_digest
= sort_by_digest_4_5
;
6836 opti_type
= OPTI_TYPE_ZERO_BYTE
6837 | OPTI_TYPE_PRECOMPUTE_INIT
6838 | OPTI_TYPE_PRECOMPUTE_MERKLE
6839 | OPTI_TYPE_EARLY_SKIP
6840 | OPTI_TYPE_NOT_ITERATED
6841 | OPTI_TYPE_APPENDED_SALT
6842 | OPTI_TYPE_RAW_HASH
;
6849 case 120: hash_type
= HASH_TYPE_SHA1
;
6850 salt_type
= SALT_TYPE_INTERN
;
6851 attack_exec
= ATTACK_EXEC_ON_GPU
;
6852 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6853 | OPTS_TYPE_PT_ADD80
6854 | OPTS_TYPE_PT_ADDBITS15
;
6855 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6856 dgst_size
= DGST_SIZE_4_5
;
6857 parse_func
= sha1s_parse_hash
;
6858 sort_by_digest
= sort_by_digest_4_5
;
6859 opti_type
= OPTI_TYPE_ZERO_BYTE
6860 | OPTI_TYPE_PRECOMPUTE_INIT
6861 | OPTI_TYPE_PRECOMPUTE_MERKLE
6862 | OPTI_TYPE_EARLY_SKIP
6863 | OPTI_TYPE_NOT_ITERATED
6864 | OPTI_TYPE_PREPENDED_SALT
6865 | OPTI_TYPE_RAW_HASH
;
6872 case 121: hash_type
= HASH_TYPE_SHA1
;
6873 salt_type
= SALT_TYPE_INTERN
;
6874 attack_exec
= ATTACK_EXEC_ON_GPU
;
6875 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6876 | OPTS_TYPE_PT_ADD80
6877 | OPTS_TYPE_PT_ADDBITS15
6878 | OPTS_TYPE_ST_LOWER
;
6879 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6880 dgst_size
= DGST_SIZE_4_5
;
6881 parse_func
= smf_parse_hash
;
6882 sort_by_digest
= sort_by_digest_4_5
;
6883 opti_type
= OPTI_TYPE_ZERO_BYTE
6884 | OPTI_TYPE_PRECOMPUTE_INIT
6885 | OPTI_TYPE_PRECOMPUTE_MERKLE
6886 | OPTI_TYPE_EARLY_SKIP
6887 | OPTI_TYPE_NOT_ITERATED
6888 | OPTI_TYPE_PREPENDED_SALT
6889 | OPTI_TYPE_RAW_HASH
;
6896 case 122: hash_type
= HASH_TYPE_SHA1
;
6897 salt_type
= SALT_TYPE_EMBEDDED
;
6898 attack_exec
= ATTACK_EXEC_ON_GPU
;
6899 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6900 | OPTS_TYPE_PT_ADD80
6901 | OPTS_TYPE_PT_ADDBITS15
6903 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6904 dgst_size
= DGST_SIZE_4_5
;
6905 parse_func
= osx1_parse_hash
;
6906 sort_by_digest
= sort_by_digest_4_5
;
6907 opti_type
= OPTI_TYPE_ZERO_BYTE
6908 | OPTI_TYPE_PRECOMPUTE_INIT
6909 | OPTI_TYPE_PRECOMPUTE_MERKLE
6910 | OPTI_TYPE_EARLY_SKIP
6911 | OPTI_TYPE_NOT_ITERATED
6912 | OPTI_TYPE_PREPENDED_SALT
6913 | OPTI_TYPE_RAW_HASH
;
6920 case 124: hash_type
= HASH_TYPE_SHA1
;
6921 salt_type
= SALT_TYPE_EMBEDDED
;
6922 attack_exec
= ATTACK_EXEC_ON_GPU
;
6923 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6924 | OPTS_TYPE_PT_ADD80
6925 | OPTS_TYPE_PT_ADDBITS15
;
6926 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6927 dgst_size
= DGST_SIZE_4_5
;
6928 parse_func
= djangosha1_parse_hash
;
6929 sort_by_digest
= sort_by_digest_4_5
;
6930 opti_type
= OPTI_TYPE_ZERO_BYTE
6931 | OPTI_TYPE_PRECOMPUTE_INIT
6932 | OPTI_TYPE_PRECOMPUTE_MERKLE
6933 | OPTI_TYPE_EARLY_SKIP
6934 | OPTI_TYPE_NOT_ITERATED
6935 | OPTI_TYPE_PREPENDED_SALT
6936 | OPTI_TYPE_RAW_HASH
;
6943 case 130: hash_type
= HASH_TYPE_SHA1
;
6944 salt_type
= SALT_TYPE_INTERN
;
6945 attack_exec
= ATTACK_EXEC_ON_GPU
;
6946 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6947 | OPTS_TYPE_PT_UNICODE
6948 | OPTS_TYPE_ST_ADD80
6949 | OPTS_TYPE_ST_ADDBITS15
;
6950 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6951 dgst_size
= DGST_SIZE_4_5
;
6952 parse_func
= sha1s_parse_hash
;
6953 sort_by_digest
= sort_by_digest_4_5
;
6954 opti_type
= OPTI_TYPE_ZERO_BYTE
6955 | OPTI_TYPE_PRECOMPUTE_INIT
6956 | OPTI_TYPE_PRECOMPUTE_MERKLE
6957 | OPTI_TYPE_EARLY_SKIP
6958 | OPTI_TYPE_NOT_ITERATED
6959 | OPTI_TYPE_APPENDED_SALT
6960 | OPTI_TYPE_RAW_HASH
;
6967 case 131: hash_type
= HASH_TYPE_SHA1
;
6968 salt_type
= SALT_TYPE_EMBEDDED
;
6969 attack_exec
= ATTACK_EXEC_ON_GPU
;
6970 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6971 | OPTS_TYPE_PT_UNICODE
6972 | OPTS_TYPE_PT_UPPER
6973 | OPTS_TYPE_ST_ADD80
6974 | OPTS_TYPE_ST_ADDBITS15
6976 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6977 dgst_size
= DGST_SIZE_4_5
;
6978 parse_func
= mssql2000_parse_hash
;
6979 sort_by_digest
= sort_by_digest_4_5
;
6980 opti_type
= OPTI_TYPE_ZERO_BYTE
6981 | OPTI_TYPE_PRECOMPUTE_INIT
6982 | OPTI_TYPE_PRECOMPUTE_MERKLE
6983 | OPTI_TYPE_EARLY_SKIP
6984 | OPTI_TYPE_NOT_ITERATED
6985 | OPTI_TYPE_APPENDED_SALT
6986 | OPTI_TYPE_RAW_HASH
;
6993 case 132: hash_type
= HASH_TYPE_SHA1
;
6994 salt_type
= SALT_TYPE_EMBEDDED
;
6995 attack_exec
= ATTACK_EXEC_ON_GPU
;
6996 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6997 | OPTS_TYPE_PT_UNICODE
6998 | OPTS_TYPE_ST_ADD80
6999 | OPTS_TYPE_ST_ADDBITS15
7001 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7002 dgst_size
= DGST_SIZE_4_5
;
7003 parse_func
= mssql2005_parse_hash
;
7004 sort_by_digest
= sort_by_digest_4_5
;
7005 opti_type
= OPTI_TYPE_ZERO_BYTE
7006 | OPTI_TYPE_PRECOMPUTE_INIT
7007 | OPTI_TYPE_PRECOMPUTE_MERKLE
7008 | OPTI_TYPE_EARLY_SKIP
7009 | OPTI_TYPE_NOT_ITERATED
7010 | OPTI_TYPE_APPENDED_SALT
7011 | OPTI_TYPE_RAW_HASH
;
7018 case 133: hash_type
= HASH_TYPE_SHA1
;
7019 salt_type
= SALT_TYPE_EMBEDDED
;
7020 attack_exec
= ATTACK_EXEC_ON_GPU
;
7021 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7022 | OPTS_TYPE_PT_UNICODE
7023 | OPTS_TYPE_ST_ADD80
7024 | OPTS_TYPE_ST_ADDBITS15
;
7025 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7026 dgst_size
= DGST_SIZE_4_5
;
7027 parse_func
= peoplesoft_parse_hash
;
7028 sort_by_digest
= sort_by_digest_4_5
;
7029 opti_type
= OPTI_TYPE_ZERO_BYTE
7030 | OPTI_TYPE_PRECOMPUTE_INIT
7031 | OPTI_TYPE_PRECOMPUTE_MERKLE
7032 | OPTI_TYPE_EARLY_SKIP
7033 | OPTI_TYPE_NOT_ITERATED
7034 | OPTI_TYPE_APPENDED_SALT
7035 | OPTI_TYPE_RAW_HASH
;
7042 case 140: hash_type
= HASH_TYPE_SHA1
;
7043 salt_type
= SALT_TYPE_INTERN
;
7044 attack_exec
= ATTACK_EXEC_ON_GPU
;
7045 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7046 | OPTS_TYPE_PT_ADD80
7047 | OPTS_TYPE_PT_ADDBITS15
7048 | OPTS_TYPE_PT_UNICODE
;
7049 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7050 dgst_size
= DGST_SIZE_4_5
;
7051 parse_func
= sha1s_parse_hash
;
7052 sort_by_digest
= sort_by_digest_4_5
;
7053 opti_type
= OPTI_TYPE_ZERO_BYTE
7054 | OPTI_TYPE_PRECOMPUTE_INIT
7055 | OPTI_TYPE_PRECOMPUTE_MERKLE
7056 | OPTI_TYPE_EARLY_SKIP
7057 | OPTI_TYPE_NOT_ITERATED
7058 | OPTI_TYPE_PREPENDED_SALT
7059 | OPTI_TYPE_RAW_HASH
;
7066 case 141: hash_type
= HASH_TYPE_SHA1
;
7067 salt_type
= SALT_TYPE_EMBEDDED
;
7068 attack_exec
= ATTACK_EXEC_ON_GPU
;
7069 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7070 | OPTS_TYPE_PT_ADD80
7071 | OPTS_TYPE_PT_ADDBITS15
7072 | OPTS_TYPE_PT_UNICODE
7073 | OPTS_TYPE_ST_BASE64
;
7074 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7075 dgst_size
= DGST_SIZE_4_5
;
7076 parse_func
= episerver_parse_hash
;
7077 sort_by_digest
= sort_by_digest_4_5
;
7078 opti_type
= OPTI_TYPE_ZERO_BYTE
7079 | OPTI_TYPE_PRECOMPUTE_INIT
7080 | OPTI_TYPE_PRECOMPUTE_MERKLE
7081 | OPTI_TYPE_EARLY_SKIP
7082 | OPTI_TYPE_NOT_ITERATED
7083 | OPTI_TYPE_PREPENDED_SALT
7084 | OPTI_TYPE_RAW_HASH
;
7091 case 150: hash_type
= HASH_TYPE_SHA1
;
7092 salt_type
= SALT_TYPE_INTERN
;
7093 attack_exec
= ATTACK_EXEC_ON_GPU
;
7094 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7095 | OPTS_TYPE_ST_ADD80
7096 | OPTS_TYPE_ST_ADDBITS15
;
7097 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7098 dgst_size
= DGST_SIZE_4_5
;
7099 parse_func
= hmacsha1_parse_hash
;
7100 sort_by_digest
= sort_by_digest_4_5
;
7101 opti_type
= OPTI_TYPE_ZERO_BYTE
7102 | OPTI_TYPE_NOT_ITERATED
;
7109 case 160: hash_type
= HASH_TYPE_SHA1
;
7110 salt_type
= SALT_TYPE_INTERN
;
7111 attack_exec
= ATTACK_EXEC_ON_GPU
;
7112 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7113 | OPTS_TYPE_PT_ADD80
7114 | OPTS_TYPE_PT_ADDBITS15
;
7115 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7116 dgst_size
= DGST_SIZE_4_5
;
7117 parse_func
= hmacsha1_parse_hash
;
7118 sort_by_digest
= sort_by_digest_4_5
;
7119 opti_type
= OPTI_TYPE_ZERO_BYTE
7120 | OPTI_TYPE_NOT_ITERATED
;
7127 case 190: hash_type
= HASH_TYPE_SHA1
;
7128 salt_type
= SALT_TYPE_NONE
;
7129 attack_exec
= ATTACK_EXEC_ON_GPU
;
7130 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7131 | OPTS_TYPE_PT_ADD80
7132 | OPTS_TYPE_PT_ADDBITS15
;
7133 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7134 dgst_size
= DGST_SIZE_4_5
;
7135 parse_func
= sha1linkedin_parse_hash
;
7136 sort_by_digest
= sort_by_digest_4_5
;
7137 opti_type
= OPTI_TYPE_ZERO_BYTE
7138 | OPTI_TYPE_PRECOMPUTE_INIT
7139 | OPTI_TYPE_EARLY_SKIP
7140 | OPTI_TYPE_NOT_ITERATED
7141 | OPTI_TYPE_NOT_SALTED
;
7148 case 200: hash_type
= HASH_TYPE_MYSQL
;
7149 salt_type
= SALT_TYPE_NONE
;
7150 attack_exec
= ATTACK_EXEC_ON_GPU
;
7152 kern_type
= KERN_TYPE_MYSQL
;
7153 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7154 parse_func
= mysql323_parse_hash
;
7155 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7156 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7163 case 300: hash_type
= HASH_TYPE_SHA1
;
7164 salt_type
= SALT_TYPE_NONE
;
7165 attack_exec
= ATTACK_EXEC_ON_GPU
;
7166 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7167 | OPTS_TYPE_PT_ADD80
7168 | OPTS_TYPE_PT_ADDBITS15
;
7169 kern_type
= KERN_TYPE_MYSQL41
;
7170 dgst_size
= DGST_SIZE_4_5
;
7171 parse_func
= sha1_parse_hash
;
7172 sort_by_digest
= sort_by_digest_4_5
;
7173 opti_type
= OPTI_TYPE_ZERO_BYTE
7174 | OPTI_TYPE_PRECOMPUTE_INIT
7175 | OPTI_TYPE_PRECOMPUTE_MERKLE
7176 | OPTI_TYPE_EARLY_SKIP
7177 | OPTI_TYPE_NOT_ITERATED
7178 | OPTI_TYPE_NOT_SALTED
;
7185 case 400: hash_type
= HASH_TYPE_MD5
;
7186 salt_type
= SALT_TYPE_EMBEDDED
;
7187 attack_exec
= ATTACK_EXEC_ON_CPU
;
7188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7189 kern_type
= KERN_TYPE_PHPASS
;
7190 dgst_size
= DGST_SIZE_4_4
;
7191 parse_func
= phpass_parse_hash
;
7192 sort_by_digest
= sort_by_digest_4_4
;
7193 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7200 case 500: hash_type
= HASH_TYPE_MD5
;
7201 salt_type
= SALT_TYPE_EMBEDDED
;
7202 attack_exec
= ATTACK_EXEC_ON_CPU
;
7203 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7204 kern_type
= KERN_TYPE_MD5CRYPT
;
7205 dgst_size
= DGST_SIZE_4_4
;
7206 parse_func
= md5crypt_parse_hash
;
7207 sort_by_digest
= sort_by_digest_4_4
;
7208 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7215 case 501: hash_type
= HASH_TYPE_MD5
;
7216 salt_type
= SALT_TYPE_EMBEDDED
;
7217 attack_exec
= ATTACK_EXEC_ON_CPU
;
7218 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7219 | OPTS_TYPE_HASH_COPY
;
7220 kern_type
= KERN_TYPE_MD5CRYPT
;
7221 dgst_size
= DGST_SIZE_4_4
;
7222 parse_func
= juniper_parse_hash
;
7223 sort_by_digest
= sort_by_digest_4_4
;
7224 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7231 case 900: hash_type
= HASH_TYPE_MD4
;
7232 salt_type
= SALT_TYPE_NONE
;
7233 attack_exec
= ATTACK_EXEC_ON_GPU
;
7234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7235 | OPTS_TYPE_PT_ADD80
7236 | OPTS_TYPE_PT_ADDBITS14
;
7237 kern_type
= KERN_TYPE_MD4
;
7238 dgst_size
= DGST_SIZE_4_4
;
7239 parse_func
= md4_parse_hash
;
7240 sort_by_digest
= sort_by_digest_4_4
;
7241 opti_type
= OPTI_TYPE_ZERO_BYTE
7242 | OPTI_TYPE_PRECOMPUTE_INIT
7243 | OPTI_TYPE_PRECOMPUTE_MERKLE
7244 | OPTI_TYPE_MEET_IN_MIDDLE
7245 | OPTI_TYPE_EARLY_SKIP
7246 | OPTI_TYPE_NOT_ITERATED
7247 | OPTI_TYPE_NOT_SALTED
7248 | OPTI_TYPE_RAW_HASH
;
7255 case 1000: hash_type
= HASH_TYPE_MD4
;
7256 salt_type
= SALT_TYPE_NONE
;
7257 attack_exec
= ATTACK_EXEC_ON_GPU
;
7258 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7259 | OPTS_TYPE_PT_ADD80
7260 | OPTS_TYPE_PT_ADDBITS14
7261 | OPTS_TYPE_PT_UNICODE
;
7262 kern_type
= KERN_TYPE_MD4_PWU
;
7263 dgst_size
= DGST_SIZE_4_4
;
7264 parse_func
= md4_parse_hash
;
7265 sort_by_digest
= sort_by_digest_4_4
;
7266 opti_type
= OPTI_TYPE_ZERO_BYTE
7267 | OPTI_TYPE_PRECOMPUTE_INIT
7268 | OPTI_TYPE_PRECOMPUTE_MERKLE
7269 | OPTI_TYPE_MEET_IN_MIDDLE
7270 | OPTI_TYPE_EARLY_SKIP
7271 | OPTI_TYPE_NOT_ITERATED
7272 | OPTI_TYPE_NOT_SALTED
7273 | OPTI_TYPE_RAW_HASH
;
7280 case 1100: hash_type
= HASH_TYPE_MD4
;
7281 salt_type
= SALT_TYPE_INTERN
;
7282 attack_exec
= ATTACK_EXEC_ON_GPU
;
7283 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7284 | OPTS_TYPE_PT_ADD80
7285 | OPTS_TYPE_PT_ADDBITS14
7286 | OPTS_TYPE_PT_UNICODE
7287 | OPTS_TYPE_ST_ADD80
7288 | OPTS_TYPE_ST_UNICODE
7289 | OPTS_TYPE_ST_LOWER
;
7290 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7291 dgst_size
= DGST_SIZE_4_4
;
7292 parse_func
= dcc_parse_hash
;
7293 sort_by_digest
= sort_by_digest_4_4
;
7294 opti_type
= OPTI_TYPE_ZERO_BYTE
7295 | OPTI_TYPE_PRECOMPUTE_INIT
7296 | OPTI_TYPE_PRECOMPUTE_MERKLE
7297 | OPTI_TYPE_EARLY_SKIP
7298 | OPTI_TYPE_NOT_ITERATED
;
7305 case 1400: hash_type
= HASH_TYPE_SHA256
;
7306 salt_type
= SALT_TYPE_NONE
;
7307 attack_exec
= ATTACK_EXEC_ON_GPU
;
7308 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7309 | OPTS_TYPE_PT_ADD80
7310 | OPTS_TYPE_PT_ADDBITS15
;
7311 kern_type
= KERN_TYPE_SHA256
;
7312 dgst_size
= DGST_SIZE_4_8
;
7313 parse_func
= sha256_parse_hash
;
7314 sort_by_digest
= sort_by_digest_4_8
;
7315 opti_type
= OPTI_TYPE_ZERO_BYTE
7316 | OPTI_TYPE_PRECOMPUTE_INIT
7317 | OPTI_TYPE_PRECOMPUTE_MERKLE
7318 | OPTI_TYPE_EARLY_SKIP
7319 | OPTI_TYPE_NOT_ITERATED
7320 | OPTI_TYPE_NOT_SALTED
7321 | OPTI_TYPE_RAW_HASH
;
7328 case 1410: hash_type
= HASH_TYPE_SHA256
;
7329 salt_type
= SALT_TYPE_INTERN
;
7330 attack_exec
= ATTACK_EXEC_ON_GPU
;
7331 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7332 | OPTS_TYPE_ST_ADD80
7333 | OPTS_TYPE_ST_ADDBITS15
;
7334 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7335 dgst_size
= DGST_SIZE_4_8
;
7336 parse_func
= sha256s_parse_hash
;
7337 sort_by_digest
= sort_by_digest_4_8
;
7338 opti_type
= OPTI_TYPE_ZERO_BYTE
7339 | OPTI_TYPE_PRECOMPUTE_INIT
7340 | OPTI_TYPE_PRECOMPUTE_MERKLE
7341 | OPTI_TYPE_EARLY_SKIP
7342 | OPTI_TYPE_NOT_ITERATED
7343 | OPTI_TYPE_APPENDED_SALT
7344 | OPTI_TYPE_RAW_HASH
;
7351 case 1420: hash_type
= HASH_TYPE_SHA256
;
7352 salt_type
= SALT_TYPE_INTERN
;
7353 attack_exec
= ATTACK_EXEC_ON_GPU
;
7354 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7355 | OPTS_TYPE_PT_ADD80
7356 | OPTS_TYPE_PT_ADDBITS15
;
7357 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7358 dgst_size
= DGST_SIZE_4_8
;
7359 parse_func
= sha256s_parse_hash
;
7360 sort_by_digest
= sort_by_digest_4_8
;
7361 opti_type
= OPTI_TYPE_ZERO_BYTE
7362 | OPTI_TYPE_PRECOMPUTE_INIT
7363 | OPTI_TYPE_PRECOMPUTE_MERKLE
7364 | OPTI_TYPE_EARLY_SKIP
7365 | OPTI_TYPE_NOT_ITERATED
7366 | OPTI_TYPE_PREPENDED_SALT
7367 | OPTI_TYPE_RAW_HASH
;
7374 case 1421: hash_type
= HASH_TYPE_SHA256
;
7375 salt_type
= SALT_TYPE_EMBEDDED
;
7376 attack_exec
= ATTACK_EXEC_ON_GPU
;
7377 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7378 | OPTS_TYPE_PT_ADD80
7379 | OPTS_TYPE_PT_ADDBITS15
;
7380 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7381 dgst_size
= DGST_SIZE_4_8
;
7382 parse_func
= hmailserver_parse_hash
;
7383 sort_by_digest
= sort_by_digest_4_8
;
7384 opti_type
= OPTI_TYPE_ZERO_BYTE
7385 | OPTI_TYPE_PRECOMPUTE_INIT
7386 | OPTI_TYPE_PRECOMPUTE_MERKLE
7387 | OPTI_TYPE_EARLY_SKIP
7388 | OPTI_TYPE_NOT_ITERATED
7389 | OPTI_TYPE_PREPENDED_SALT
7390 | OPTI_TYPE_RAW_HASH
;
7397 case 1430: hash_type
= HASH_TYPE_SHA256
;
7398 salt_type
= SALT_TYPE_INTERN
;
7399 attack_exec
= ATTACK_EXEC_ON_GPU
;
7400 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7401 | OPTS_TYPE_PT_UNICODE
7402 | OPTS_TYPE_ST_ADD80
7403 | OPTS_TYPE_ST_ADDBITS15
;
7404 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7405 dgst_size
= DGST_SIZE_4_8
;
7406 parse_func
= sha256s_parse_hash
;
7407 sort_by_digest
= sort_by_digest_4_8
;
7408 opti_type
= OPTI_TYPE_ZERO_BYTE
7409 | OPTI_TYPE_PRECOMPUTE_INIT
7410 | OPTI_TYPE_PRECOMPUTE_MERKLE
7411 | OPTI_TYPE_EARLY_SKIP
7412 | OPTI_TYPE_NOT_ITERATED
7413 | OPTI_TYPE_APPENDED_SALT
7414 | OPTI_TYPE_RAW_HASH
;
7421 case 1440: hash_type
= HASH_TYPE_SHA256
;
7422 salt_type
= SALT_TYPE_INTERN
;
7423 attack_exec
= ATTACK_EXEC_ON_GPU
;
7424 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7425 | OPTS_TYPE_PT_ADD80
7426 | OPTS_TYPE_PT_ADDBITS15
7427 | OPTS_TYPE_PT_UNICODE
;
7428 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7429 dgst_size
= DGST_SIZE_4_8
;
7430 parse_func
= sha256s_parse_hash
;
7431 sort_by_digest
= sort_by_digest_4_8
;
7432 opti_type
= OPTI_TYPE_ZERO_BYTE
7433 | OPTI_TYPE_PRECOMPUTE_INIT
7434 | OPTI_TYPE_PRECOMPUTE_MERKLE
7435 | OPTI_TYPE_EARLY_SKIP
7436 | OPTI_TYPE_NOT_ITERATED
7437 | OPTI_TYPE_PREPENDED_SALT
7438 | OPTI_TYPE_RAW_HASH
;
7445 case 1441: hash_type
= HASH_TYPE_SHA256
;
7446 salt_type
= SALT_TYPE_EMBEDDED
;
7447 attack_exec
= ATTACK_EXEC_ON_GPU
;
7448 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7449 | OPTS_TYPE_PT_ADD80
7450 | OPTS_TYPE_PT_ADDBITS15
7451 | OPTS_TYPE_PT_UNICODE
7452 | OPTS_TYPE_ST_BASE64
;
7453 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7454 dgst_size
= DGST_SIZE_4_8
;
7455 parse_func
= episerver4_parse_hash
;
7456 sort_by_digest
= sort_by_digest_4_8
;
7457 opti_type
= OPTI_TYPE_ZERO_BYTE
7458 | OPTI_TYPE_PRECOMPUTE_INIT
7459 | OPTI_TYPE_PRECOMPUTE_MERKLE
7460 | OPTI_TYPE_EARLY_SKIP
7461 | OPTI_TYPE_NOT_ITERATED
7462 | OPTI_TYPE_PREPENDED_SALT
7463 | OPTI_TYPE_RAW_HASH
;
7470 case 1450: hash_type
= HASH_TYPE_SHA256
;
7471 salt_type
= SALT_TYPE_INTERN
;
7472 attack_exec
= ATTACK_EXEC_ON_GPU
;
7473 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7474 | OPTS_TYPE_ST_ADD80
;
7475 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7476 dgst_size
= DGST_SIZE_4_8
;
7477 parse_func
= hmacsha256_parse_hash
;
7478 sort_by_digest
= sort_by_digest_4_8
;
7479 opti_type
= OPTI_TYPE_ZERO_BYTE
7480 | OPTI_TYPE_NOT_ITERATED
;
7487 case 1460: hash_type
= HASH_TYPE_SHA256
;
7488 salt_type
= SALT_TYPE_INTERN
;
7489 attack_exec
= ATTACK_EXEC_ON_GPU
;
7490 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7491 | OPTS_TYPE_PT_ADD80
7492 | OPTS_TYPE_PT_ADDBITS15
;
7493 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7494 dgst_size
= DGST_SIZE_4_8
;
7495 parse_func
= hmacsha256_parse_hash
;
7496 sort_by_digest
= sort_by_digest_4_8
;
7497 opti_type
= OPTI_TYPE_ZERO_BYTE
7498 | OPTI_TYPE_NOT_ITERATED
;
7505 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7506 salt_type
= SALT_TYPE_EMBEDDED
;
7507 attack_exec
= ATTACK_EXEC_ON_GPU
;
7508 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7509 | OPTS_TYPE_PT_BITSLICE
;
7510 kern_type
= KERN_TYPE_DESCRYPT
;
7511 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7512 parse_func
= descrypt_parse_hash
;
7513 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7514 opti_type
= OPTI_TYPE_ZERO_BYTE
7515 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7522 case 1600: hash_type
= HASH_TYPE_MD5
;
7523 salt_type
= SALT_TYPE_EMBEDDED
;
7524 attack_exec
= ATTACK_EXEC_ON_CPU
;
7525 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7526 kern_type
= KERN_TYPE_APR1CRYPT
;
7527 dgst_size
= DGST_SIZE_4_4
;
7528 parse_func
= md5apr1_parse_hash
;
7529 sort_by_digest
= sort_by_digest_4_4
;
7530 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7537 case 1700: hash_type
= HASH_TYPE_SHA512
;
7538 salt_type
= SALT_TYPE_NONE
;
7539 attack_exec
= ATTACK_EXEC_ON_GPU
;
7540 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7541 | OPTS_TYPE_PT_ADD80
7542 | OPTS_TYPE_PT_ADDBITS15
;
7543 kern_type
= KERN_TYPE_SHA512
;
7544 dgst_size
= DGST_SIZE_8_8
;
7545 parse_func
= sha512_parse_hash
;
7546 sort_by_digest
= sort_by_digest_8_8
;
7547 opti_type
= OPTI_TYPE_ZERO_BYTE
7548 | OPTI_TYPE_PRECOMPUTE_INIT
7549 | OPTI_TYPE_PRECOMPUTE_MERKLE
7550 | OPTI_TYPE_EARLY_SKIP
7551 | OPTI_TYPE_NOT_ITERATED
7552 | OPTI_TYPE_NOT_SALTED
7553 | OPTI_TYPE_RAW_HASH
;
7560 case 1710: hash_type
= HASH_TYPE_SHA512
;
7561 salt_type
= SALT_TYPE_INTERN
;
7562 attack_exec
= ATTACK_EXEC_ON_GPU
;
7563 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7564 | OPTS_TYPE_ST_ADD80
7565 | OPTS_TYPE_ST_ADDBITS15
;
7566 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7567 dgst_size
= DGST_SIZE_8_8
;
7568 parse_func
= sha512s_parse_hash
;
7569 sort_by_digest
= sort_by_digest_8_8
;
7570 opti_type
= OPTI_TYPE_ZERO_BYTE
7571 | OPTI_TYPE_PRECOMPUTE_INIT
7572 | OPTI_TYPE_PRECOMPUTE_MERKLE
7573 | OPTI_TYPE_EARLY_SKIP
7574 | OPTI_TYPE_NOT_ITERATED
7575 | OPTI_TYPE_APPENDED_SALT
7576 | OPTI_TYPE_RAW_HASH
;
7583 case 1711: hash_type
= HASH_TYPE_SHA512
;
7584 salt_type
= SALT_TYPE_EMBEDDED
;
7585 attack_exec
= ATTACK_EXEC_ON_GPU
;
7586 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7587 | OPTS_TYPE_ST_ADD80
7588 | OPTS_TYPE_ST_ADDBITS15
;
7589 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7590 dgst_size
= DGST_SIZE_8_8
;
7591 parse_func
= sha512b64s_parse_hash
;
7592 sort_by_digest
= sort_by_digest_8_8
;
7593 opti_type
= OPTI_TYPE_ZERO_BYTE
7594 | OPTI_TYPE_PRECOMPUTE_INIT
7595 | OPTI_TYPE_PRECOMPUTE_MERKLE
7596 | OPTI_TYPE_EARLY_SKIP
7597 | OPTI_TYPE_NOT_ITERATED
7598 | OPTI_TYPE_APPENDED_SALT
7599 | OPTI_TYPE_RAW_HASH
;
7606 case 1720: hash_type
= HASH_TYPE_SHA512
;
7607 salt_type
= SALT_TYPE_INTERN
;
7608 attack_exec
= ATTACK_EXEC_ON_GPU
;
7609 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7610 | OPTS_TYPE_PT_ADD80
7611 | OPTS_TYPE_PT_ADDBITS15
;
7612 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7613 dgst_size
= DGST_SIZE_8_8
;
7614 parse_func
= sha512s_parse_hash
;
7615 sort_by_digest
= sort_by_digest_8_8
;
7616 opti_type
= OPTI_TYPE_ZERO_BYTE
7617 | OPTI_TYPE_PRECOMPUTE_INIT
7618 | OPTI_TYPE_PRECOMPUTE_MERKLE
7619 | OPTI_TYPE_EARLY_SKIP
7620 | OPTI_TYPE_NOT_ITERATED
7621 | OPTI_TYPE_PREPENDED_SALT
7622 | OPTI_TYPE_RAW_HASH
;
7629 case 1722: hash_type
= HASH_TYPE_SHA512
;
7630 salt_type
= SALT_TYPE_EMBEDDED
;
7631 attack_exec
= ATTACK_EXEC_ON_GPU
;
7632 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7633 | OPTS_TYPE_PT_ADD80
7634 | OPTS_TYPE_PT_ADDBITS15
7636 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7637 dgst_size
= DGST_SIZE_8_8
;
7638 parse_func
= osx512_parse_hash
;
7639 sort_by_digest
= sort_by_digest_8_8
;
7640 opti_type
= OPTI_TYPE_ZERO_BYTE
7641 | OPTI_TYPE_PRECOMPUTE_INIT
7642 | OPTI_TYPE_PRECOMPUTE_MERKLE
7643 | OPTI_TYPE_EARLY_SKIP
7644 | OPTI_TYPE_NOT_ITERATED
7645 | OPTI_TYPE_PREPENDED_SALT
7646 | OPTI_TYPE_RAW_HASH
;
7653 case 1730: hash_type
= HASH_TYPE_SHA512
;
7654 salt_type
= SALT_TYPE_INTERN
;
7655 attack_exec
= ATTACK_EXEC_ON_GPU
;
7656 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7657 | OPTS_TYPE_PT_UNICODE
7658 | OPTS_TYPE_ST_ADD80
7659 | OPTS_TYPE_ST_ADDBITS15
;
7660 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7661 dgst_size
= DGST_SIZE_8_8
;
7662 parse_func
= sha512s_parse_hash
;
7663 sort_by_digest
= sort_by_digest_8_8
;
7664 opti_type
= OPTI_TYPE_ZERO_BYTE
7665 | OPTI_TYPE_PRECOMPUTE_INIT
7666 | OPTI_TYPE_PRECOMPUTE_MERKLE
7667 | OPTI_TYPE_EARLY_SKIP
7668 | OPTI_TYPE_NOT_ITERATED
7669 | OPTI_TYPE_APPENDED_SALT
7670 | OPTI_TYPE_RAW_HASH
;
7677 case 1731: hash_type
= HASH_TYPE_SHA512
;
7678 salt_type
= SALT_TYPE_EMBEDDED
;
7679 attack_exec
= ATTACK_EXEC_ON_GPU
;
7680 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7681 | OPTS_TYPE_PT_UNICODE
7682 | OPTS_TYPE_ST_ADD80
7683 | OPTS_TYPE_ST_ADDBITS15
7685 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7686 dgst_size
= DGST_SIZE_8_8
;
7687 parse_func
= mssql2012_parse_hash
;
7688 sort_by_digest
= sort_by_digest_8_8
;
7689 opti_type
= OPTI_TYPE_ZERO_BYTE
7690 | OPTI_TYPE_PRECOMPUTE_INIT
7691 | OPTI_TYPE_PRECOMPUTE_MERKLE
7692 | OPTI_TYPE_EARLY_SKIP
7693 | OPTI_TYPE_NOT_ITERATED
7694 | OPTI_TYPE_APPENDED_SALT
7695 | OPTI_TYPE_RAW_HASH
;
7702 case 1740: hash_type
= HASH_TYPE_SHA512
;
7703 salt_type
= SALT_TYPE_INTERN
;
7704 attack_exec
= ATTACK_EXEC_ON_GPU
;
7705 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7706 | OPTS_TYPE_PT_ADD80
7707 | OPTS_TYPE_PT_ADDBITS15
7708 | OPTS_TYPE_PT_UNICODE
;
7709 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7710 dgst_size
= DGST_SIZE_8_8
;
7711 parse_func
= sha512s_parse_hash
;
7712 sort_by_digest
= sort_by_digest_8_8
;
7713 opti_type
= OPTI_TYPE_ZERO_BYTE
7714 | OPTI_TYPE_PRECOMPUTE_INIT
7715 | OPTI_TYPE_PRECOMPUTE_MERKLE
7716 | OPTI_TYPE_EARLY_SKIP
7717 | OPTI_TYPE_NOT_ITERATED
7718 | OPTI_TYPE_PREPENDED_SALT
7719 | OPTI_TYPE_RAW_HASH
;
7726 case 1750: hash_type
= HASH_TYPE_SHA512
;
7727 salt_type
= SALT_TYPE_INTERN
;
7728 attack_exec
= ATTACK_EXEC_ON_GPU
;
7729 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7730 | OPTS_TYPE_ST_ADD80
;
7731 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7732 dgst_size
= DGST_SIZE_8_8
;
7733 parse_func
= hmacsha512_parse_hash
;
7734 sort_by_digest
= sort_by_digest_8_8
;
7735 opti_type
= OPTI_TYPE_ZERO_BYTE
7736 | OPTI_TYPE_NOT_ITERATED
;
7743 case 1760: hash_type
= HASH_TYPE_SHA512
;
7744 salt_type
= SALT_TYPE_INTERN
;
7745 attack_exec
= ATTACK_EXEC_ON_GPU
;
7746 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7747 | OPTS_TYPE_PT_ADD80
7748 | OPTS_TYPE_PT_ADDBITS15
;
7749 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7750 dgst_size
= DGST_SIZE_8_8
;
7751 parse_func
= hmacsha512_parse_hash
;
7752 sort_by_digest
= sort_by_digest_8_8
;
7753 opti_type
= OPTI_TYPE_ZERO_BYTE
7754 | OPTI_TYPE_NOT_ITERATED
;
7761 case 1800: hash_type
= HASH_TYPE_SHA512
;
7762 salt_type
= SALT_TYPE_EMBEDDED
;
7763 attack_exec
= ATTACK_EXEC_ON_CPU
;
7764 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7765 kern_type
= KERN_TYPE_SHA512CRYPT
;
7766 dgst_size
= DGST_SIZE_8_8
;
7767 parse_func
= sha512crypt_parse_hash
;
7768 sort_by_digest
= sort_by_digest_8_8
;
7769 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7776 case 2100: hash_type
= HASH_TYPE_DCC2
;
7777 salt_type
= SALT_TYPE_EMBEDDED
;
7778 attack_exec
= ATTACK_EXEC_ON_CPU
;
7779 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7780 | OPTS_TYPE_ST_LOWER
7781 | OPTS_TYPE_ST_UNICODE
;
7782 kern_type
= KERN_TYPE_DCC2
;
7783 dgst_size
= DGST_SIZE_4_4
;
7784 parse_func
= dcc2_parse_hash
;
7785 sort_by_digest
= sort_by_digest_4_4
;
7786 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7793 case 2400: hash_type
= HASH_TYPE_MD5
;
7794 salt_type
= SALT_TYPE_NONE
;
7795 attack_exec
= ATTACK_EXEC_ON_GPU
;
7796 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7797 kern_type
= KERN_TYPE_MD5PIX
;
7798 dgst_size
= DGST_SIZE_4_4
;
7799 parse_func
= md5pix_parse_hash
;
7800 sort_by_digest
= sort_by_digest_4_4
;
7801 opti_type
= OPTI_TYPE_ZERO_BYTE
7802 | OPTI_TYPE_PRECOMPUTE_INIT
7803 | OPTI_TYPE_PRECOMPUTE_MERKLE
7804 | OPTI_TYPE_EARLY_SKIP
7805 | OPTI_TYPE_NOT_ITERATED
7806 | OPTI_TYPE_NOT_SALTED
;
7813 case 2410: hash_type
= HASH_TYPE_MD5
;
7814 salt_type
= SALT_TYPE_INTERN
;
7815 attack_exec
= ATTACK_EXEC_ON_GPU
;
7816 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7817 kern_type
= KERN_TYPE_MD5ASA
;
7818 dgst_size
= DGST_SIZE_4_4
;
7819 parse_func
= md5asa_parse_hash
;
7820 sort_by_digest
= sort_by_digest_4_4
;
7821 opti_type
= OPTI_TYPE_ZERO_BYTE
7822 | OPTI_TYPE_PRECOMPUTE_INIT
7823 | OPTI_TYPE_PRECOMPUTE_MERKLE
7824 | OPTI_TYPE_EARLY_SKIP
7825 | OPTI_TYPE_NOT_ITERATED
;
7832 case 2500: hash_type
= HASH_TYPE_WPA
;
7833 salt_type
= SALT_TYPE_EMBEDDED
;
7834 attack_exec
= ATTACK_EXEC_ON_CPU
;
7835 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7836 kern_type
= KERN_TYPE_WPA
;
7837 dgst_size
= DGST_SIZE_4_4
;
7838 parse_func
= wpa_parse_hash
;
7839 sort_by_digest
= sort_by_digest_4_4
;
7840 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7847 case 2600: hash_type
= HASH_TYPE_MD5
;
7848 salt_type
= SALT_TYPE_VIRTUAL
;
7849 attack_exec
= ATTACK_EXEC_ON_GPU
;
7850 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7851 | OPTS_TYPE_PT_ADD80
7852 | OPTS_TYPE_PT_ADDBITS14
7853 | OPTS_TYPE_ST_ADD80
;
7854 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7855 dgst_size
= DGST_SIZE_4_4
;
7856 parse_func
= md5md5_parse_hash
;
7857 sort_by_digest
= sort_by_digest_4_4
;
7858 opti_type
= OPTI_TYPE_ZERO_BYTE
7859 | OPTI_TYPE_PRECOMPUTE_INIT
7860 | OPTI_TYPE_PRECOMPUTE_MERKLE
7861 | OPTI_TYPE_EARLY_SKIP
;
7868 case 2611: hash_type
= HASH_TYPE_MD5
;
7869 salt_type
= SALT_TYPE_INTERN
;
7870 attack_exec
= ATTACK_EXEC_ON_GPU
;
7871 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7872 | OPTS_TYPE_PT_ADD80
7873 | OPTS_TYPE_PT_ADDBITS14
7874 | OPTS_TYPE_ST_ADD80
;
7875 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7876 dgst_size
= DGST_SIZE_4_4
;
7877 parse_func
= vb3_parse_hash
;
7878 sort_by_digest
= sort_by_digest_4_4
;
7879 opti_type
= OPTI_TYPE_ZERO_BYTE
7880 | OPTI_TYPE_PRECOMPUTE_INIT
7881 | OPTI_TYPE_PRECOMPUTE_MERKLE
7882 | OPTI_TYPE_EARLY_SKIP
;
7889 case 2612: hash_type
= HASH_TYPE_MD5
;
7890 salt_type
= SALT_TYPE_EMBEDDED
;
7891 attack_exec
= ATTACK_EXEC_ON_GPU
;
7892 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7893 | OPTS_TYPE_PT_ADD80
7894 | OPTS_TYPE_PT_ADDBITS14
7895 | OPTS_TYPE_ST_ADD80
7897 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7898 dgst_size
= DGST_SIZE_4_4
;
7899 parse_func
= phps_parse_hash
;
7900 sort_by_digest
= sort_by_digest_4_4
;
7901 opti_type
= OPTI_TYPE_ZERO_BYTE
7902 | OPTI_TYPE_PRECOMPUTE_INIT
7903 | OPTI_TYPE_PRECOMPUTE_MERKLE
7904 | OPTI_TYPE_EARLY_SKIP
;
7911 case 2711: hash_type
= HASH_TYPE_MD5
;
7912 salt_type
= SALT_TYPE_INTERN
;
7913 attack_exec
= ATTACK_EXEC_ON_GPU
;
7914 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7915 | OPTS_TYPE_PT_ADD80
7916 | OPTS_TYPE_PT_ADDBITS14
7917 | OPTS_TYPE_ST_ADD80
;
7918 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7919 dgst_size
= DGST_SIZE_4_4
;
7920 parse_func
= vb30_parse_hash
;
7921 sort_by_digest
= sort_by_digest_4_4
;
7922 opti_type
= OPTI_TYPE_ZERO_BYTE
7923 | OPTI_TYPE_PRECOMPUTE_INIT
7924 | OPTI_TYPE_EARLY_SKIP
;
7931 case 2811: hash_type
= HASH_TYPE_MD5
;
7932 salt_type
= SALT_TYPE_INTERN
;
7933 attack_exec
= ATTACK_EXEC_ON_GPU
;
7934 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7935 | OPTS_TYPE_PT_ADD80
7936 | OPTS_TYPE_PT_ADDBITS14
;
7937 kern_type
= KERN_TYPE_MD55_SLTPW
;
7938 dgst_size
= DGST_SIZE_4_4
;
7939 parse_func
= ipb2_parse_hash
;
7940 sort_by_digest
= sort_by_digest_4_4
;
7941 opti_type
= OPTI_TYPE_ZERO_BYTE
7942 | OPTI_TYPE_PRECOMPUTE_INIT
7943 | OPTI_TYPE_EARLY_SKIP
;
7950 case 3000: hash_type
= HASH_TYPE_LM
;
7951 salt_type
= SALT_TYPE_NONE
;
7952 attack_exec
= ATTACK_EXEC_ON_GPU
;
7953 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7954 | OPTS_TYPE_PT_UPPER
7955 | OPTS_TYPE_PT_BITSLICE
;
7956 kern_type
= KERN_TYPE_LM
;
7957 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7958 parse_func
= lm_parse_hash
;
7959 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7960 opti_type
= OPTI_TYPE_ZERO_BYTE
7961 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7968 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7969 salt_type
= SALT_TYPE_INTERN
;
7970 attack_exec
= ATTACK_EXEC_ON_GPU
;
7971 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7972 | OPTS_TYPE_PT_UPPER
7973 | OPTS_TYPE_ST_UPPER
;
7974 kern_type
= KERN_TYPE_ORACLEH
;
7975 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7976 parse_func
= oracleh_parse_hash
;
7977 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7978 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7985 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7986 salt_type
= SALT_TYPE_EMBEDDED
;
7987 attack_exec
= ATTACK_EXEC_ON_CPU
;
7988 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7989 | OPTS_TYPE_ST_GENERATE_LE
;
7990 kern_type
= KERN_TYPE_BCRYPT
;
7991 dgst_size
= DGST_SIZE_4_6
;
7992 parse_func
= bcrypt_parse_hash
;
7993 sort_by_digest
= sort_by_digest_4_6
;
7994 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8001 case 3710: hash_type
= HASH_TYPE_MD5
;
8002 salt_type
= SALT_TYPE_INTERN
;
8003 attack_exec
= ATTACK_EXEC_ON_GPU
;
8004 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8005 | OPTS_TYPE_PT_ADD80
8006 | OPTS_TYPE_PT_ADDBITS14
;
8007 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8008 dgst_size
= DGST_SIZE_4_4
;
8009 parse_func
= md5s_parse_hash
;
8010 sort_by_digest
= sort_by_digest_4_4
;
8011 opti_type
= OPTI_TYPE_ZERO_BYTE
8012 | OPTI_TYPE_PRECOMPUTE_INIT
8013 | OPTI_TYPE_PRECOMPUTE_MERKLE
8014 | OPTI_TYPE_EARLY_SKIP
;
8021 case 3711: hash_type
= HASH_TYPE_MD5
;
8022 salt_type
= SALT_TYPE_EMBEDDED
;
8023 attack_exec
= ATTACK_EXEC_ON_GPU
;
8024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8025 | OPTS_TYPE_PT_ADD80
8026 | OPTS_TYPE_PT_ADDBITS14
;
8027 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8028 dgst_size
= DGST_SIZE_4_4
;
8029 parse_func
= mediawiki_b_parse_hash
;
8030 sort_by_digest
= sort_by_digest_4_4
;
8031 opti_type
= OPTI_TYPE_ZERO_BYTE
8032 | OPTI_TYPE_PRECOMPUTE_INIT
8033 | OPTI_TYPE_PRECOMPUTE_MERKLE
8034 | OPTI_TYPE_EARLY_SKIP
;
8041 case 3800: hash_type
= HASH_TYPE_MD5
;
8042 salt_type
= SALT_TYPE_INTERN
;
8043 attack_exec
= ATTACK_EXEC_ON_GPU
;
8044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8045 | OPTS_TYPE_ST_ADDBITS14
;
8046 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8047 dgst_size
= DGST_SIZE_4_4
;
8048 parse_func
= md5s_parse_hash
;
8049 sort_by_digest
= sort_by_digest_4_4
;
8050 opti_type
= OPTI_TYPE_ZERO_BYTE
8051 | OPTI_TYPE_PRECOMPUTE_INIT
8052 | OPTI_TYPE_PRECOMPUTE_MERKLE
8053 | OPTI_TYPE_EARLY_SKIP
8054 | OPTI_TYPE_NOT_ITERATED
8055 | OPTI_TYPE_RAW_HASH
;
8062 case 4300: hash_type
= HASH_TYPE_MD5
;
8063 salt_type
= SALT_TYPE_VIRTUAL
;
8064 attack_exec
= ATTACK_EXEC_ON_GPU
;
8065 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8066 | OPTS_TYPE_PT_ADD80
8067 | OPTS_TYPE_PT_ADDBITS14
8068 | OPTS_TYPE_ST_ADD80
;
8069 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8070 dgst_size
= DGST_SIZE_4_4
;
8071 parse_func
= md5md5_parse_hash
;
8072 sort_by_digest
= sort_by_digest_4_4
;
8073 opti_type
= OPTI_TYPE_ZERO_BYTE
8074 | OPTI_TYPE_PRECOMPUTE_INIT
8075 | OPTI_TYPE_PRECOMPUTE_MERKLE
8076 | OPTI_TYPE_EARLY_SKIP
;
8084 case 4400: hash_type
= HASH_TYPE_MD5
;
8085 salt_type
= SALT_TYPE_NONE
;
8086 attack_exec
= ATTACK_EXEC_ON_GPU
;
8087 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8088 | OPTS_TYPE_PT_ADD80
8089 | OPTS_TYPE_PT_ADDBITS15
;
8090 kern_type
= KERN_TYPE_MD5_SHA1
;
8091 dgst_size
= DGST_SIZE_4_4
;
8092 parse_func
= md5_parse_hash
;
8093 sort_by_digest
= sort_by_digest_4_4
;
8094 opti_type
= OPTI_TYPE_ZERO_BYTE
8095 | OPTI_TYPE_PRECOMPUTE_INIT
8096 | OPTI_TYPE_PRECOMPUTE_MERKLE
8097 | OPTI_TYPE_EARLY_SKIP
8098 | OPTI_TYPE_NOT_ITERATED
8099 | OPTI_TYPE_NOT_SALTED
8100 | OPTI_TYPE_RAW_HASH
;
8107 case 4500: hash_type
= HASH_TYPE_SHA1
;
8108 salt_type
= SALT_TYPE_NONE
;
8109 attack_exec
= ATTACK_EXEC_ON_GPU
;
8110 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8111 | OPTS_TYPE_PT_ADD80
8112 | OPTS_TYPE_PT_ADDBITS15
;
8113 kern_type
= KERN_TYPE_SHA11
;
8114 dgst_size
= DGST_SIZE_4_5
;
8115 parse_func
= sha1_parse_hash
;
8116 sort_by_digest
= sort_by_digest_4_5
;
8117 opti_type
= OPTI_TYPE_ZERO_BYTE
8118 | OPTI_TYPE_PRECOMPUTE_INIT
8119 | OPTI_TYPE_PRECOMPUTE_MERKLE
8120 | OPTI_TYPE_EARLY_SKIP
8121 | OPTI_TYPE_NOT_SALTED
;
8128 case 4700: hash_type
= HASH_TYPE_SHA1
;
8129 salt_type
= SALT_TYPE_NONE
;
8130 attack_exec
= ATTACK_EXEC_ON_GPU
;
8131 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8132 | OPTS_TYPE_PT_ADD80
8133 | OPTS_TYPE_PT_ADDBITS14
;
8134 kern_type
= KERN_TYPE_SHA1_MD5
;
8135 dgst_size
= DGST_SIZE_4_5
;
8136 parse_func
= sha1_parse_hash
;
8137 sort_by_digest
= sort_by_digest_4_5
;
8138 opti_type
= OPTI_TYPE_ZERO_BYTE
8139 | OPTI_TYPE_PRECOMPUTE_INIT
8140 | OPTI_TYPE_PRECOMPUTE_MERKLE
8141 | OPTI_TYPE_EARLY_SKIP
8142 | OPTI_TYPE_NOT_ITERATED
8143 | OPTI_TYPE_NOT_SALTED
8144 | OPTI_TYPE_RAW_HASH
;
8151 case 4800: hash_type
= HASH_TYPE_MD5
;
8152 salt_type
= SALT_TYPE_EMBEDDED
;
8153 attack_exec
= ATTACK_EXEC_ON_GPU
;
8154 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8155 | OPTS_TYPE_PT_ADDBITS14
;
8156 kern_type
= KERN_TYPE_MD5_CHAP
;
8157 dgst_size
= DGST_SIZE_4_4
;
8158 parse_func
= chap_parse_hash
;
8159 sort_by_digest
= sort_by_digest_4_4
;
8160 opti_type
= OPTI_TYPE_ZERO_BYTE
8161 | OPTI_TYPE_PRECOMPUTE_INIT
8162 | OPTI_TYPE_PRECOMPUTE_MERKLE
8163 | OPTI_TYPE_MEET_IN_MIDDLE
8164 | OPTI_TYPE_EARLY_SKIP
8165 | OPTI_TYPE_NOT_ITERATED
8166 | OPTI_TYPE_RAW_HASH
;
8173 case 4900: hash_type
= HASH_TYPE_SHA1
;
8174 salt_type
= SALT_TYPE_INTERN
;
8175 attack_exec
= ATTACK_EXEC_ON_GPU
;
8176 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8177 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8178 dgst_size
= DGST_SIZE_4_5
;
8179 parse_func
= sha1s_parse_hash
;
8180 sort_by_digest
= sort_by_digest_4_5
;
8181 opti_type
= OPTI_TYPE_ZERO_BYTE
8182 | OPTI_TYPE_PRECOMPUTE_INIT
8183 | OPTI_TYPE_PRECOMPUTE_MERKLE
8184 | OPTI_TYPE_EARLY_SKIP
;
8191 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8192 salt_type
= SALT_TYPE_EMBEDDED
;
8193 attack_exec
= ATTACK_EXEC_ON_GPU
;
8194 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8195 | OPTS_TYPE_PT_ADD01
;
8196 kern_type
= KERN_TYPE_KECCAK
;
8197 dgst_size
= DGST_SIZE_8_25
;
8198 parse_func
= keccak_parse_hash
;
8199 sort_by_digest
= sort_by_digest_8_25
;
8200 opti_type
= OPTI_TYPE_ZERO_BYTE
8201 | OPTI_TYPE_RAW_HASH
;
8208 case 5100: hash_type
= HASH_TYPE_MD5H
;
8209 salt_type
= SALT_TYPE_NONE
;
8210 attack_exec
= ATTACK_EXEC_ON_GPU
;
8211 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8212 | OPTS_TYPE_PT_ADD80
8213 | OPTS_TYPE_PT_ADDBITS14
;
8214 kern_type
= KERN_TYPE_MD5H
;
8215 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8216 parse_func
= md5half_parse_hash
;
8217 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8218 opti_type
= OPTI_TYPE_ZERO_BYTE
8219 | OPTI_TYPE_RAW_HASH
;
8226 case 5200: hash_type
= HASH_TYPE_SHA256
;
8227 salt_type
= SALT_TYPE_EMBEDDED
;
8228 attack_exec
= ATTACK_EXEC_ON_CPU
;
8229 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8230 kern_type
= KERN_TYPE_PSAFE3
;
8231 dgst_size
= DGST_SIZE_4_8
;
8232 parse_func
= psafe3_parse_hash
;
8233 sort_by_digest
= sort_by_digest_4_8
;
8234 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8241 case 5300: hash_type
= HASH_TYPE_MD5
;
8242 salt_type
= SALT_TYPE_EMBEDDED
;
8243 attack_exec
= ATTACK_EXEC_ON_GPU
;
8244 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8245 | OPTS_TYPE_ST_ADD80
;
8246 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8247 dgst_size
= DGST_SIZE_4_4
;
8248 parse_func
= ikepsk_md5_parse_hash
;
8249 sort_by_digest
= sort_by_digest_4_4
;
8250 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8257 case 5400: hash_type
= HASH_TYPE_SHA1
;
8258 salt_type
= SALT_TYPE_EMBEDDED
;
8259 attack_exec
= ATTACK_EXEC_ON_GPU
;
8260 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8261 | OPTS_TYPE_ST_ADD80
;
8262 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8263 dgst_size
= DGST_SIZE_4_5
;
8264 parse_func
= ikepsk_sha1_parse_hash
;
8265 sort_by_digest
= sort_by_digest_4_5
;
8266 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8273 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8274 salt_type
= SALT_TYPE_EMBEDDED
;
8275 attack_exec
= ATTACK_EXEC_ON_GPU
;
8276 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8277 | OPTS_TYPE_PT_ADD80
8278 | OPTS_TYPE_PT_ADDBITS14
8279 | OPTS_TYPE_PT_UNICODE
8281 kern_type
= KERN_TYPE_NETNTLMv1
;
8282 dgst_size
= DGST_SIZE_4_4
;
8283 parse_func
= netntlmv1_parse_hash
;
8284 sort_by_digest
= sort_by_digest_4_4
;
8285 opti_type
= OPTI_TYPE_ZERO_BYTE
8286 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8293 case 5600: hash_type
= HASH_TYPE_MD5
;
8294 salt_type
= SALT_TYPE_EMBEDDED
;
8295 attack_exec
= ATTACK_EXEC_ON_GPU
;
8296 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8297 | OPTS_TYPE_PT_ADD80
8298 | OPTS_TYPE_PT_ADDBITS14
8299 | OPTS_TYPE_PT_UNICODE
;
8300 kern_type
= KERN_TYPE_NETNTLMv2
;
8301 dgst_size
= DGST_SIZE_4_4
;
8302 parse_func
= netntlmv2_parse_hash
;
8303 sort_by_digest
= sort_by_digest_4_4
;
8304 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8311 case 5700: hash_type
= HASH_TYPE_SHA256
;
8312 salt_type
= SALT_TYPE_NONE
;
8313 attack_exec
= ATTACK_EXEC_ON_GPU
;
8314 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8315 | OPTS_TYPE_PT_ADD80
8316 | OPTS_TYPE_PT_ADDBITS15
;
8317 kern_type
= KERN_TYPE_SHA256
;
8318 dgst_size
= DGST_SIZE_4_8
;
8319 parse_func
= cisco4_parse_hash
;
8320 sort_by_digest
= sort_by_digest_4_8
;
8321 opti_type
= OPTI_TYPE_ZERO_BYTE
8322 | OPTI_TYPE_PRECOMPUTE_INIT
8323 | OPTI_TYPE_PRECOMPUTE_MERKLE
8324 | OPTI_TYPE_EARLY_SKIP
8325 | OPTI_TYPE_NOT_ITERATED
8326 | OPTI_TYPE_NOT_SALTED
8327 | OPTI_TYPE_RAW_HASH
;
8334 case 5800: hash_type
= HASH_TYPE_SHA1
;
8335 salt_type
= SALT_TYPE_INTERN
;
8336 attack_exec
= ATTACK_EXEC_ON_CPU
;
8337 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8338 | OPTS_TYPE_ST_ADD80
;
8339 kern_type
= KERN_TYPE_ANDROIDPIN
;
8340 dgst_size
= DGST_SIZE_4_5
;
8341 parse_func
= androidpin_parse_hash
;
8342 sort_by_digest
= sort_by_digest_4_5
;
8343 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8350 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8351 salt_type
= SALT_TYPE_NONE
;
8352 attack_exec
= ATTACK_EXEC_ON_GPU
;
8353 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8354 | OPTS_TYPE_PT_ADD80
;
8355 kern_type
= KERN_TYPE_RIPEMD160
;
8356 dgst_size
= DGST_SIZE_4_5
;
8357 parse_func
= ripemd160_parse_hash
;
8358 sort_by_digest
= sort_by_digest_4_5
;
8359 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8366 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8367 salt_type
= SALT_TYPE_NONE
;
8368 attack_exec
= ATTACK_EXEC_ON_GPU
;
8369 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8370 | OPTS_TYPE_PT_ADD80
;
8371 kern_type
= KERN_TYPE_WHIRLPOOL
;
8372 dgst_size
= DGST_SIZE_4_16
;
8373 parse_func
= whirlpool_parse_hash
;
8374 sort_by_digest
= sort_by_digest_4_16
;
8375 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8382 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8383 salt_type
= SALT_TYPE_EMBEDDED
;
8384 attack_exec
= ATTACK_EXEC_ON_CPU
;
8385 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8386 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8387 dgst_size
= DGST_SIZE_4_5
;
8388 parse_func
= truecrypt_parse_hash_2k
;
8389 sort_by_digest
= sort_by_digest_4_5
;
8390 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8397 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8398 salt_type
= SALT_TYPE_EMBEDDED
;
8399 attack_exec
= ATTACK_EXEC_ON_CPU
;
8400 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8401 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8402 dgst_size
= DGST_SIZE_4_5
;
8403 parse_func
= truecrypt_parse_hash_2k
;
8404 sort_by_digest
= sort_by_digest_4_5
;
8405 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8412 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8413 salt_type
= SALT_TYPE_EMBEDDED
;
8414 attack_exec
= ATTACK_EXEC_ON_CPU
;
8415 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8416 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8417 dgst_size
= DGST_SIZE_4_5
;
8418 parse_func
= truecrypt_parse_hash_2k
;
8419 sort_by_digest
= sort_by_digest_4_5
;
8420 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8427 case 6221: hash_type
= HASH_TYPE_SHA512
;
8428 salt_type
= SALT_TYPE_EMBEDDED
;
8429 attack_exec
= ATTACK_EXEC_ON_CPU
;
8430 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8431 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8432 dgst_size
= DGST_SIZE_8_8
;
8433 parse_func
= truecrypt_parse_hash_1k
;
8434 sort_by_digest
= sort_by_digest_8_8
;
8435 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8442 case 6222: hash_type
= HASH_TYPE_SHA512
;
8443 salt_type
= SALT_TYPE_EMBEDDED
;
8444 attack_exec
= ATTACK_EXEC_ON_CPU
;
8445 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8446 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8447 dgst_size
= DGST_SIZE_8_8
;
8448 parse_func
= truecrypt_parse_hash_1k
;
8449 sort_by_digest
= sort_by_digest_8_8
;
8450 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8457 case 6223: hash_type
= HASH_TYPE_SHA512
;
8458 salt_type
= SALT_TYPE_EMBEDDED
;
8459 attack_exec
= ATTACK_EXEC_ON_CPU
;
8460 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8461 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8462 dgst_size
= DGST_SIZE_8_8
;
8463 parse_func
= truecrypt_parse_hash_1k
;
8464 sort_by_digest
= sort_by_digest_8_8
;
8465 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8472 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8473 salt_type
= SALT_TYPE_EMBEDDED
;
8474 attack_exec
= ATTACK_EXEC_ON_CPU
;
8475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8476 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8477 dgst_size
= DGST_SIZE_4_8
;
8478 parse_func
= truecrypt_parse_hash_1k
;
8479 sort_by_digest
= sort_by_digest_4_8
;
8480 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8487 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8488 salt_type
= SALT_TYPE_EMBEDDED
;
8489 attack_exec
= ATTACK_EXEC_ON_CPU
;
8490 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8491 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8492 dgst_size
= DGST_SIZE_4_8
;
8493 parse_func
= truecrypt_parse_hash_1k
;
8494 sort_by_digest
= sort_by_digest_4_8
;
8495 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8502 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8503 salt_type
= SALT_TYPE_EMBEDDED
;
8504 attack_exec
= ATTACK_EXEC_ON_CPU
;
8505 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8506 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8507 dgst_size
= DGST_SIZE_4_8
;
8508 parse_func
= truecrypt_parse_hash_1k
;
8509 sort_by_digest
= sort_by_digest_4_8
;
8510 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8517 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8518 salt_type
= SALT_TYPE_EMBEDDED
;
8519 attack_exec
= ATTACK_EXEC_ON_CPU
;
8520 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8521 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8522 dgst_size
= DGST_SIZE_4_5
;
8523 parse_func
= truecrypt_parse_hash_1k
;
8524 sort_by_digest
= sort_by_digest_4_5
;
8525 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8532 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8533 salt_type
= SALT_TYPE_EMBEDDED
;
8534 attack_exec
= ATTACK_EXEC_ON_CPU
;
8535 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8536 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8537 dgst_size
= DGST_SIZE_4_5
;
8538 parse_func
= truecrypt_parse_hash_1k
;
8539 sort_by_digest
= sort_by_digest_4_5
;
8540 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8547 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8548 salt_type
= SALT_TYPE_EMBEDDED
;
8549 attack_exec
= ATTACK_EXEC_ON_CPU
;
8550 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8551 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8552 dgst_size
= DGST_SIZE_4_5
;
8553 parse_func
= truecrypt_parse_hash_1k
;
8554 sort_by_digest
= sort_by_digest_4_5
;
8555 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8562 case 6300: hash_type
= HASH_TYPE_MD5
;
8563 salt_type
= SALT_TYPE_EMBEDDED
;
8564 attack_exec
= ATTACK_EXEC_ON_CPU
;
8565 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8566 kern_type
= KERN_TYPE_MD5AIX
;
8567 dgst_size
= DGST_SIZE_4_4
;
8568 parse_func
= md5aix_parse_hash
;
8569 sort_by_digest
= sort_by_digest_4_4
;
8570 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8577 case 6400: hash_type
= HASH_TYPE_SHA256
;
8578 salt_type
= SALT_TYPE_EMBEDDED
;
8579 attack_exec
= ATTACK_EXEC_ON_CPU
;
8580 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8581 kern_type
= KERN_TYPE_SHA256AIX
;
8582 dgst_size
= DGST_SIZE_4_8
;
8583 parse_func
= sha256aix_parse_hash
;
8584 sort_by_digest
= sort_by_digest_4_8
;
8585 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8592 case 6500: hash_type
= HASH_TYPE_SHA512
;
8593 salt_type
= SALT_TYPE_EMBEDDED
;
8594 attack_exec
= ATTACK_EXEC_ON_CPU
;
8595 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8596 kern_type
= KERN_TYPE_SHA512AIX
;
8597 dgst_size
= DGST_SIZE_8_8
;
8598 parse_func
= sha512aix_parse_hash
;
8599 sort_by_digest
= sort_by_digest_8_8
;
8600 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8607 case 6600: hash_type
= HASH_TYPE_AES
;
8608 salt_type
= SALT_TYPE_EMBEDDED
;
8609 attack_exec
= ATTACK_EXEC_ON_CPU
;
8610 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8611 kern_type
= KERN_TYPE_AGILEKEY
;
8612 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8613 parse_func
= agilekey_parse_hash
;
8614 sort_by_digest
= sort_by_digest_4_5
;
8615 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8622 case 6700: hash_type
= HASH_TYPE_SHA1
;
8623 salt_type
= SALT_TYPE_EMBEDDED
;
8624 attack_exec
= ATTACK_EXEC_ON_CPU
;
8625 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8626 kern_type
= KERN_TYPE_SHA1AIX
;
8627 dgst_size
= DGST_SIZE_4_5
;
8628 parse_func
= sha1aix_parse_hash
;
8629 sort_by_digest
= sort_by_digest_4_5
;
8630 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8637 case 6800: hash_type
= HASH_TYPE_AES
;
8638 salt_type
= SALT_TYPE_EMBEDDED
;
8639 attack_exec
= ATTACK_EXEC_ON_CPU
;
8640 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8641 kern_type
= KERN_TYPE_LASTPASS
;
8642 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8643 parse_func
= lastpass_parse_hash
;
8644 sort_by_digest
= sort_by_digest_4_8
;
8645 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8652 case 6900: hash_type
= HASH_TYPE_GOST
;
8653 salt_type
= SALT_TYPE_NONE
;
8654 attack_exec
= ATTACK_EXEC_ON_GPU
;
8655 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8656 kern_type
= KERN_TYPE_GOST
;
8657 dgst_size
= DGST_SIZE_4_8
;
8658 parse_func
= gost_parse_hash
;
8659 sort_by_digest
= sort_by_digest_4_8
;
8660 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8667 case 7100: hash_type
= HASH_TYPE_SHA512
;
8668 salt_type
= SALT_TYPE_EMBEDDED
;
8669 attack_exec
= ATTACK_EXEC_ON_CPU
;
8670 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8671 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8672 dgst_size
= DGST_SIZE_8_16
;
8673 parse_func
= sha512osx_parse_hash
;
8674 sort_by_digest
= sort_by_digest_8_16
;
8675 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8682 case 7200: hash_type
= HASH_TYPE_SHA512
;
8683 salt_type
= SALT_TYPE_EMBEDDED
;
8684 attack_exec
= ATTACK_EXEC_ON_CPU
;
8685 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8686 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8687 dgst_size
= DGST_SIZE_8_16
;
8688 parse_func
= sha512grub_parse_hash
;
8689 sort_by_digest
= sort_by_digest_8_16
;
8690 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8697 case 7300: hash_type
= HASH_TYPE_SHA1
;
8698 salt_type
= SALT_TYPE_EMBEDDED
;
8699 attack_exec
= ATTACK_EXEC_ON_GPU
;
8700 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8701 | OPTS_TYPE_ST_ADD80
8702 | OPTS_TYPE_ST_ADDBITS15
;
8703 kern_type
= KERN_TYPE_RAKP
;
8704 dgst_size
= DGST_SIZE_4_5
;
8705 parse_func
= rakp_parse_hash
;
8706 sort_by_digest
= sort_by_digest_4_5
;
8707 opti_type
= OPTI_TYPE_ZERO_BYTE
8708 | OPTI_TYPE_NOT_ITERATED
;
8715 case 7400: hash_type
= HASH_TYPE_SHA256
;
8716 salt_type
= SALT_TYPE_EMBEDDED
;
8717 attack_exec
= ATTACK_EXEC_ON_CPU
;
8718 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8719 kern_type
= KERN_TYPE_SHA256CRYPT
;
8720 dgst_size
= DGST_SIZE_4_8
;
8721 parse_func
= sha256crypt_parse_hash
;
8722 sort_by_digest
= sort_by_digest_4_8
;
8723 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8730 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8731 salt_type
= SALT_TYPE_EMBEDDED
;
8732 attack_exec
= ATTACK_EXEC_ON_GPU
;
8733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8734 kern_type
= KERN_TYPE_KRB5PA
;
8735 dgst_size
= DGST_SIZE_4_4
;
8736 parse_func
= krb5pa_parse_hash
;
8737 sort_by_digest
= sort_by_digest_4_4
;
8738 opti_type
= OPTI_TYPE_ZERO_BYTE
8739 | OPTI_TYPE_NOT_ITERATED
;
8746 case 7600: hash_type
= HASH_TYPE_SHA1
;
8747 salt_type
= SALT_TYPE_INTERN
;
8748 attack_exec
= ATTACK_EXEC_ON_GPU
;
8749 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8750 | OPTS_TYPE_PT_ADD80
8751 | OPTS_TYPE_PT_ADDBITS15
;
8752 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8753 dgst_size
= DGST_SIZE_4_5
;
8754 parse_func
= redmine_parse_hash
;
8755 sort_by_digest
= sort_by_digest_4_5
;
8756 opti_type
= OPTI_TYPE_ZERO_BYTE
8757 | OPTI_TYPE_PRECOMPUTE_INIT
8758 | OPTI_TYPE_EARLY_SKIP
8759 | OPTI_TYPE_NOT_ITERATED
8760 | OPTI_TYPE_PREPENDED_SALT
;
8767 case 7700: hash_type
= HASH_TYPE_SAPB
;
8768 salt_type
= SALT_TYPE_EMBEDDED
;
8769 attack_exec
= ATTACK_EXEC_ON_GPU
;
8770 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8771 | OPTS_TYPE_PT_UPPER
8772 | OPTS_TYPE_ST_UPPER
;
8773 kern_type
= KERN_TYPE_SAPB
;
8774 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8775 parse_func
= sapb_parse_hash
;
8776 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8777 opti_type
= OPTI_TYPE_ZERO_BYTE
8778 | OPTI_TYPE_PRECOMPUTE_INIT
8779 | OPTI_TYPE_NOT_ITERATED
;
8786 case 7800: hash_type
= HASH_TYPE_SAPG
;
8787 salt_type
= SALT_TYPE_EMBEDDED
;
8788 attack_exec
= ATTACK_EXEC_ON_GPU
;
8789 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8790 | OPTS_TYPE_ST_ADD80
8791 | OPTS_TYPE_ST_UPPER
;
8792 kern_type
= KERN_TYPE_SAPG
;
8793 dgst_size
= DGST_SIZE_4_5
;
8794 parse_func
= sapg_parse_hash
;
8795 sort_by_digest
= sort_by_digest_4_5
;
8796 opti_type
= OPTI_TYPE_ZERO_BYTE
8797 | OPTI_TYPE_PRECOMPUTE_INIT
8798 | OPTI_TYPE_NOT_ITERATED
;
8805 case 7900: hash_type
= HASH_TYPE_SHA512
;
8806 salt_type
= SALT_TYPE_EMBEDDED
;
8807 attack_exec
= ATTACK_EXEC_ON_CPU
;
8808 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8809 kern_type
= KERN_TYPE_DRUPAL7
;
8810 dgst_size
= DGST_SIZE_8_8
;
8811 parse_func
= drupal7_parse_hash
;
8812 sort_by_digest
= sort_by_digest_8_8
;
8813 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8820 case 8000: hash_type
= HASH_TYPE_SHA256
;
8821 salt_type
= SALT_TYPE_EMBEDDED
;
8822 attack_exec
= ATTACK_EXEC_ON_GPU
;
8823 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8824 | OPTS_TYPE_PT_UNICODE
8825 | OPTS_TYPE_ST_ADD80
8827 kern_type
= KERN_TYPE_SYBASEASE
;
8828 dgst_size
= DGST_SIZE_4_8
;
8829 parse_func
= sybasease_parse_hash
;
8830 sort_by_digest
= sort_by_digest_4_8
;
8831 opti_type
= OPTI_TYPE_ZERO_BYTE
8832 | OPTI_TYPE_PRECOMPUTE_INIT
8833 | OPTI_TYPE_EARLY_SKIP
8834 | OPTI_TYPE_NOT_ITERATED
8835 | OPTI_TYPE_RAW_HASH
;
8842 case 8100: hash_type
= HASH_TYPE_SHA1
;
8843 salt_type
= SALT_TYPE_EMBEDDED
;
8844 attack_exec
= ATTACK_EXEC_ON_GPU
;
8845 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8846 kern_type
= KERN_TYPE_NETSCALER
;
8847 dgst_size
= DGST_SIZE_4_5
;
8848 parse_func
= netscaler_parse_hash
;
8849 sort_by_digest
= sort_by_digest_4_5
;
8850 opti_type
= OPTI_TYPE_ZERO_BYTE
8851 | OPTI_TYPE_PRECOMPUTE_INIT
8852 | OPTI_TYPE_PRECOMPUTE_MERKLE
8853 | OPTI_TYPE_EARLY_SKIP
8854 | OPTI_TYPE_NOT_ITERATED
8855 | OPTI_TYPE_PREPENDED_SALT
8856 | OPTI_TYPE_RAW_HASH
;
8863 case 8200: hash_type
= HASH_TYPE_SHA256
;
8864 salt_type
= SALT_TYPE_EMBEDDED
;
8865 attack_exec
= ATTACK_EXEC_ON_CPU
;
8866 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8867 kern_type
= KERN_TYPE_CLOUDKEY
;
8868 dgst_size
= DGST_SIZE_4_8
;
8869 parse_func
= cloudkey_parse_hash
;
8870 sort_by_digest
= sort_by_digest_4_8
;
8871 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8878 case 8300: hash_type
= HASH_TYPE_SHA1
;
8879 salt_type
= SALT_TYPE_EMBEDDED
;
8880 attack_exec
= ATTACK_EXEC_ON_GPU
;
8881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8883 | OPTS_TYPE_ST_ADD80
;
8884 kern_type
= KERN_TYPE_NSEC3
;
8885 dgst_size
= DGST_SIZE_4_5
;
8886 parse_func
= nsec3_parse_hash
;
8887 sort_by_digest
= sort_by_digest_4_5
;
8888 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8895 case 8400: hash_type
= HASH_TYPE_SHA1
;
8896 salt_type
= SALT_TYPE_INTERN
;
8897 attack_exec
= ATTACK_EXEC_ON_GPU
;
8898 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8899 | OPTS_TYPE_PT_ADD80
8900 | OPTS_TYPE_PT_ADDBITS15
;
8901 kern_type
= KERN_TYPE_WBB3
;
8902 dgst_size
= DGST_SIZE_4_5
;
8903 parse_func
= wbb3_parse_hash
;
8904 sort_by_digest
= sort_by_digest_4_5
;
8905 opti_type
= OPTI_TYPE_ZERO_BYTE
8906 | OPTI_TYPE_PRECOMPUTE_INIT
8907 | OPTI_TYPE_NOT_ITERATED
;
8914 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8915 salt_type
= SALT_TYPE_EMBEDDED
;
8916 attack_exec
= ATTACK_EXEC_ON_GPU
;
8917 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8918 | OPTS_TYPE_ST_UPPER
;
8919 kern_type
= KERN_TYPE_RACF
;
8920 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8921 parse_func
= racf_parse_hash
;
8922 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8923 opti_type
= OPTI_TYPE_ZERO_BYTE
8924 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8931 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8932 salt_type
= SALT_TYPE_NONE
;
8933 attack_exec
= ATTACK_EXEC_ON_GPU
;
8934 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8935 kern_type
= KERN_TYPE_LOTUS5
;
8936 dgst_size
= DGST_SIZE_4_4
;
8937 parse_func
= lotus5_parse_hash
;
8938 sort_by_digest
= sort_by_digest_4_4
;
8939 opti_type
= OPTI_TYPE_EARLY_SKIP
8940 | OPTI_TYPE_NOT_ITERATED
8941 | OPTI_TYPE_NOT_SALTED
8942 | OPTI_TYPE_RAW_HASH
;
8949 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8950 salt_type
= SALT_TYPE_EMBEDDED
;
8951 attack_exec
= ATTACK_EXEC_ON_GPU
;
8952 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8953 kern_type
= KERN_TYPE_LOTUS6
;
8954 dgst_size
= DGST_SIZE_4_4
;
8955 parse_func
= lotus6_parse_hash
;
8956 sort_by_digest
= sort_by_digest_4_4
;
8957 opti_type
= OPTI_TYPE_EARLY_SKIP
8958 | OPTI_TYPE_NOT_ITERATED
8959 | OPTI_TYPE_RAW_HASH
;
8966 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8967 salt_type
= SALT_TYPE_EMBEDDED
;
8968 attack_exec
= ATTACK_EXEC_ON_CPU
;
8969 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8970 kern_type
= KERN_TYPE_ANDROIDFDE
;
8971 dgst_size
= DGST_SIZE_4_4
;
8972 parse_func
= androidfde_parse_hash
;
8973 sort_by_digest
= sort_by_digest_4_4
;
8974 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8981 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8982 salt_type
= SALT_TYPE_EMBEDDED
;
8983 attack_exec
= ATTACK_EXEC_ON_CPU
;
8984 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8985 kern_type
= KERN_TYPE_SCRYPT
;
8986 dgst_size
= DGST_SIZE_4_8
;
8987 parse_func
= scrypt_parse_hash
;
8988 sort_by_digest
= sort_by_digest_4_8
;
8989 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8996 case 9000: hash_type
= HASH_TYPE_SHA1
;
8997 salt_type
= SALT_TYPE_EMBEDDED
;
8998 attack_exec
= ATTACK_EXEC_ON_CPU
;
8999 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9000 | OPTS_TYPE_ST_GENERATE_LE
;
9001 kern_type
= KERN_TYPE_PSAFE2
;
9002 dgst_size
= DGST_SIZE_4_5
;
9003 parse_func
= psafe2_parse_hash
;
9004 sort_by_digest
= sort_by_digest_4_5
;
9005 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9012 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9013 salt_type
= SALT_TYPE_EMBEDDED
;
9014 attack_exec
= ATTACK_EXEC_ON_CPU
;
9015 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9016 kern_type
= KERN_TYPE_LOTUS8
;
9017 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9018 parse_func
= lotus8_parse_hash
;
9019 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9020 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9027 case 9200: hash_type
= HASH_TYPE_SHA256
;
9028 salt_type
= SALT_TYPE_EMBEDDED
;
9029 attack_exec
= ATTACK_EXEC_ON_CPU
;
9030 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9031 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9032 dgst_size
= DGST_SIZE_4_32
;
9033 parse_func
= cisco8_parse_hash
;
9034 sort_by_digest
= sort_by_digest_4_32
;
9035 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9042 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9043 salt_type
= SALT_TYPE_EMBEDDED
;
9044 attack_exec
= ATTACK_EXEC_ON_CPU
;
9045 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9046 kern_type
= KERN_TYPE_SCRYPT
;
9047 dgst_size
= DGST_SIZE_4_8
;
9048 parse_func
= cisco9_parse_hash
;
9049 sort_by_digest
= sort_by_digest_4_8
;
9050 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9057 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9058 salt_type
= SALT_TYPE_EMBEDDED
;
9059 attack_exec
= ATTACK_EXEC_ON_CPU
;
9060 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9061 kern_type
= KERN_TYPE_OFFICE2007
;
9062 dgst_size
= DGST_SIZE_4_4
;
9063 parse_func
= office2007_parse_hash
;
9064 sort_by_digest
= sort_by_digest_4_4
;
9065 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9072 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9073 salt_type
= SALT_TYPE_EMBEDDED
;
9074 attack_exec
= ATTACK_EXEC_ON_CPU
;
9075 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9076 kern_type
= KERN_TYPE_OFFICE2010
;
9077 dgst_size
= DGST_SIZE_4_4
;
9078 parse_func
= office2010_parse_hash
;
9079 sort_by_digest
= sort_by_digest_4_4
;
9080 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9087 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9088 salt_type
= SALT_TYPE_EMBEDDED
;
9089 attack_exec
= ATTACK_EXEC_ON_CPU
;
9090 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9091 kern_type
= KERN_TYPE_OFFICE2013
;
9092 dgst_size
= DGST_SIZE_4_4
;
9093 parse_func
= office2013_parse_hash
;
9094 sort_by_digest
= sort_by_digest_4_4
;
9095 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9102 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9103 salt_type
= SALT_TYPE_EMBEDDED
;
9104 attack_exec
= ATTACK_EXEC_ON_GPU
;
9105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9106 | OPTS_TYPE_PT_ADD80
9107 | OPTS_TYPE_PT_UNICODE
;
9108 kern_type
= KERN_TYPE_OLDOFFICE01
;
9109 dgst_size
= DGST_SIZE_4_4
;
9110 parse_func
= oldoffice01_parse_hash
;
9111 sort_by_digest
= sort_by_digest_4_4
;
9112 opti_type
= OPTI_TYPE_ZERO_BYTE
9113 | OPTI_TYPE_PRECOMPUTE_INIT
9114 | OPTI_TYPE_NOT_ITERATED
;
9121 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9122 salt_type
= SALT_TYPE_EMBEDDED
;
9123 attack_exec
= ATTACK_EXEC_ON_GPU
;
9124 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9125 | OPTS_TYPE_PT_ADD80
;
9126 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9127 dgst_size
= DGST_SIZE_4_4
;
9128 parse_func
= oldoffice01cm1_parse_hash
;
9129 sort_by_digest
= sort_by_digest_4_4
;
9130 opti_type
= OPTI_TYPE_ZERO_BYTE
9131 | OPTI_TYPE_PRECOMPUTE_INIT
9132 | OPTI_TYPE_NOT_ITERATED
;
9139 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9140 salt_type
= SALT_TYPE_EMBEDDED
;
9141 attack_exec
= ATTACK_EXEC_ON_GPU
;
9142 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9143 | OPTS_TYPE_PT_ADD80
9144 | OPTS_TYPE_PT_UNICODE
9145 | OPTS_TYPE_PT_NEVERCRACK
;
9146 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9147 dgst_size
= DGST_SIZE_4_4
;
9148 parse_func
= oldoffice01cm2_parse_hash
;
9149 sort_by_digest
= sort_by_digest_4_4
;
9150 opti_type
= OPTI_TYPE_ZERO_BYTE
9151 | OPTI_TYPE_PRECOMPUTE_INIT
9152 | OPTI_TYPE_NOT_ITERATED
;
9159 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9160 salt_type
= SALT_TYPE_EMBEDDED
;
9161 attack_exec
= ATTACK_EXEC_ON_GPU
;
9162 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9163 | OPTS_TYPE_PT_ADD80
9164 | OPTS_TYPE_PT_UNICODE
;
9165 kern_type
= KERN_TYPE_OLDOFFICE34
;
9166 dgst_size
= DGST_SIZE_4_4
;
9167 parse_func
= oldoffice34_parse_hash
;
9168 sort_by_digest
= sort_by_digest_4_4
;
9169 opti_type
= OPTI_TYPE_ZERO_BYTE
9170 | OPTI_TYPE_PRECOMPUTE_INIT
9171 | OPTI_TYPE_NOT_ITERATED
;
9178 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9179 salt_type
= SALT_TYPE_EMBEDDED
;
9180 attack_exec
= ATTACK_EXEC_ON_GPU
;
9181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9182 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9183 dgst_size
= DGST_SIZE_4_4
;
9184 parse_func
= oldoffice34cm1_parse_hash
;
9185 sort_by_digest
= sort_by_digest_4_4
;
9186 opti_type
= OPTI_TYPE_ZERO_BYTE
9187 | OPTI_TYPE_PRECOMPUTE_INIT
9188 | OPTI_TYPE_NOT_ITERATED
;
9195 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9196 salt_type
= SALT_TYPE_EMBEDDED
;
9197 attack_exec
= ATTACK_EXEC_ON_GPU
;
9198 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9199 | OPTS_TYPE_PT_ADD80
9200 | OPTS_TYPE_PT_UNICODE
9201 | OPTS_TYPE_PT_NEVERCRACK
;
9202 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9203 dgst_size
= DGST_SIZE_4_4
;
9204 parse_func
= oldoffice34cm2_parse_hash
;
9205 sort_by_digest
= sort_by_digest_4_4
;
9206 opti_type
= OPTI_TYPE_ZERO_BYTE
9207 | OPTI_TYPE_PRECOMPUTE_INIT
9208 | OPTI_TYPE_NOT_ITERATED
;
9215 case 9900: hash_type
= HASH_TYPE_MD5
;
9216 salt_type
= SALT_TYPE_NONE
;
9217 attack_exec
= ATTACK_EXEC_ON_GPU
;
9218 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9219 kern_type
= KERN_TYPE_RADMIN2
;
9220 dgst_size
= DGST_SIZE_4_4
;
9221 parse_func
= radmin2_parse_hash
;
9222 sort_by_digest
= sort_by_digest_4_4
;
9223 opti_type
= OPTI_TYPE_ZERO_BYTE
9224 | OPTI_TYPE_PRECOMPUTE_INIT
9225 | OPTI_TYPE_EARLY_SKIP
9226 | OPTI_TYPE_NOT_ITERATED
9227 | OPTI_TYPE_NOT_SALTED
;
9234 case 10000: hash_type
= HASH_TYPE_SHA256
;
9235 salt_type
= SALT_TYPE_EMBEDDED
;
9236 attack_exec
= ATTACK_EXEC_ON_CPU
;
9237 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9238 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9239 dgst_size
= DGST_SIZE_4_32
;
9240 parse_func
= djangopbkdf2_parse_hash
;
9241 sort_by_digest
= sort_by_digest_4_32
;
9242 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9249 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9250 salt_type
= SALT_TYPE_EMBEDDED
;
9251 attack_exec
= ATTACK_EXEC_ON_GPU
;
9252 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9253 kern_type
= KERN_TYPE_SIPHASH
;
9254 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9255 parse_func
= siphash_parse_hash
;
9256 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9257 opti_type
= OPTI_TYPE_ZERO_BYTE
9258 | OPTI_TYPE_NOT_ITERATED
9259 | OPTI_TYPE_RAW_HASH
;
9266 case 10200: hash_type
= HASH_TYPE_MD5
;
9267 salt_type
= SALT_TYPE_EMBEDDED
;
9268 attack_exec
= ATTACK_EXEC_ON_GPU
;
9269 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9270 | OPTS_TYPE_ST_ADD80
9271 | OPTS_TYPE_ST_ADDBITS14
;
9272 kern_type
= KERN_TYPE_HMACMD5_PW
;
9273 dgst_size
= DGST_SIZE_4_4
;
9274 parse_func
= crammd5_parse_hash
;
9275 sort_by_digest
= sort_by_digest_4_4
;
9276 opti_type
= OPTI_TYPE_ZERO_BYTE
9277 | OPTI_TYPE_NOT_ITERATED
;
9284 case 10300: hash_type
= HASH_TYPE_SHA1
;
9285 salt_type
= SALT_TYPE_EMBEDDED
;
9286 attack_exec
= ATTACK_EXEC_ON_CPU
;
9287 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9288 kern_type
= KERN_TYPE_SAPH_SHA1
;
9289 dgst_size
= DGST_SIZE_4_5
;
9290 parse_func
= saph_sha1_parse_hash
;
9291 sort_by_digest
= sort_by_digest_4_5
;
9292 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9299 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9300 salt_type
= SALT_TYPE_EMBEDDED
;
9301 attack_exec
= ATTACK_EXEC_ON_GPU
;
9302 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9303 kern_type
= KERN_TYPE_PDF11
;
9304 dgst_size
= DGST_SIZE_4_4
;
9305 parse_func
= pdf11_parse_hash
;
9306 sort_by_digest
= sort_by_digest_4_4
;
9307 opti_type
= OPTI_TYPE_ZERO_BYTE
9308 | OPTI_TYPE_NOT_ITERATED
;
9315 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9316 salt_type
= SALT_TYPE_EMBEDDED
;
9317 attack_exec
= ATTACK_EXEC_ON_GPU
;
9318 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9319 kern_type
= KERN_TYPE_PDF11CM1
;
9320 dgst_size
= DGST_SIZE_4_4
;
9321 parse_func
= pdf11cm1_parse_hash
;
9322 sort_by_digest
= sort_by_digest_4_4
;
9323 opti_type
= OPTI_TYPE_ZERO_BYTE
9324 | OPTI_TYPE_NOT_ITERATED
;
9331 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9332 salt_type
= SALT_TYPE_EMBEDDED
;
9333 attack_exec
= ATTACK_EXEC_ON_GPU
;
9334 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9335 kern_type
= KERN_TYPE_PDF11CM2
;
9336 dgst_size
= DGST_SIZE_4_4
;
9337 parse_func
= pdf11cm2_parse_hash
;
9338 sort_by_digest
= sort_by_digest_4_4
;
9339 opti_type
= OPTI_TYPE_ZERO_BYTE
9340 | OPTI_TYPE_NOT_ITERATED
;
9347 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9348 salt_type
= SALT_TYPE_EMBEDDED
;
9349 attack_exec
= ATTACK_EXEC_ON_CPU
;
9350 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9351 kern_type
= KERN_TYPE_PDF14
;
9352 dgst_size
= DGST_SIZE_4_4
;
9353 parse_func
= pdf14_parse_hash
;
9354 sort_by_digest
= sort_by_digest_4_4
;
9355 opti_type
= OPTI_TYPE_ZERO_BYTE
9356 | OPTI_TYPE_NOT_ITERATED
;
9363 case 10600: hash_type
= HASH_TYPE_SHA256
;
9364 salt_type
= SALT_TYPE_EMBEDDED
;
9365 attack_exec
= ATTACK_EXEC_ON_GPU
;
9366 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9367 | OPTS_TYPE_ST_ADD80
9368 | OPTS_TYPE_ST_ADDBITS15
9369 | OPTS_TYPE_HASH_COPY
;
9370 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9371 dgst_size
= DGST_SIZE_4_8
;
9372 parse_func
= pdf17l3_parse_hash
;
9373 sort_by_digest
= sort_by_digest_4_8
;
9374 opti_type
= OPTI_TYPE_ZERO_BYTE
9375 | OPTI_TYPE_PRECOMPUTE_INIT
9376 | OPTI_TYPE_PRECOMPUTE_MERKLE
9377 | OPTI_TYPE_EARLY_SKIP
9378 | OPTI_TYPE_NOT_ITERATED
9379 | OPTI_TYPE_APPENDED_SALT
9380 | OPTI_TYPE_RAW_HASH
;
9387 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9388 salt_type
= SALT_TYPE_EMBEDDED
;
9389 attack_exec
= ATTACK_EXEC_ON_CPU
;
9390 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9391 | OPTS_TYPE_HASH_COPY
;
9392 kern_type
= KERN_TYPE_PDF17L8
;
9393 dgst_size
= DGST_SIZE_4_8
;
9394 parse_func
= pdf17l8_parse_hash
;
9395 sort_by_digest
= sort_by_digest_4_8
;
9396 opti_type
= OPTI_TYPE_ZERO_BYTE
9397 | OPTI_TYPE_NOT_ITERATED
;
9404 case 10800: hash_type
= HASH_TYPE_SHA384
;
9405 salt_type
= SALT_TYPE_NONE
;
9406 attack_exec
= ATTACK_EXEC_ON_GPU
;
9407 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9408 | OPTS_TYPE_PT_ADD80
9409 | OPTS_TYPE_PT_ADDBITS15
;
9410 kern_type
= KERN_TYPE_SHA384
;
9411 dgst_size
= DGST_SIZE_8_8
;
9412 parse_func
= sha384_parse_hash
;
9413 sort_by_digest
= sort_by_digest_8_8
;
9414 opti_type
= OPTI_TYPE_ZERO_BYTE
9415 | OPTI_TYPE_PRECOMPUTE_INIT
9416 | OPTI_TYPE_PRECOMPUTE_MERKLE
9417 | OPTI_TYPE_EARLY_SKIP
9418 | OPTI_TYPE_NOT_ITERATED
9419 | OPTI_TYPE_NOT_SALTED
9420 | OPTI_TYPE_RAW_HASH
;
9427 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9428 salt_type
= SALT_TYPE_EMBEDDED
;
9429 attack_exec
= ATTACK_EXEC_ON_CPU
;
9430 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9431 | OPTS_TYPE_ST_BASE64
9432 | OPTS_TYPE_HASH_COPY
;
9433 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9434 dgst_size
= DGST_SIZE_4_32
;
9435 parse_func
= pbkdf2_sha256_parse_hash
;
9436 sort_by_digest
= sort_by_digest_4_32
;
9437 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9444 case 11000: hash_type
= HASH_TYPE_MD5
;
9445 salt_type
= SALT_TYPE_INTERN
;
9446 attack_exec
= ATTACK_EXEC_ON_GPU
;
9447 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9448 | OPTS_TYPE_PT_ADD80
;
9449 kern_type
= KERN_TYPE_PRESTASHOP
;
9450 dgst_size
= DGST_SIZE_4_4
;
9451 parse_func
= prestashop_parse_hash
;
9452 sort_by_digest
= sort_by_digest_4_4
;
9453 opti_type
= OPTI_TYPE_ZERO_BYTE
9454 | OPTI_TYPE_PRECOMPUTE_INIT
9455 | OPTI_TYPE_NOT_ITERATED
9456 | OPTI_TYPE_PREPENDED_SALT
;
9463 case 11100: hash_type
= HASH_TYPE_MD5
;
9464 salt_type
= SALT_TYPE_EMBEDDED
;
9465 attack_exec
= ATTACK_EXEC_ON_GPU
;
9466 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9467 | OPTS_TYPE_ST_ADD80
;
9468 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9469 dgst_size
= DGST_SIZE_4_4
;
9470 parse_func
= postgresql_auth_parse_hash
;
9471 sort_by_digest
= sort_by_digest_4_4
;
9472 opti_type
= OPTI_TYPE_ZERO_BYTE
9473 | OPTI_TYPE_PRECOMPUTE_INIT
9474 | OPTI_TYPE_PRECOMPUTE_MERKLE
9475 | OPTI_TYPE_EARLY_SKIP
;
9482 case 11200: hash_type
= HASH_TYPE_SHA1
;
9483 salt_type
= SALT_TYPE_EMBEDDED
;
9484 attack_exec
= ATTACK_EXEC_ON_GPU
;
9485 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9486 | OPTS_TYPE_PT_ADD80
9488 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9489 dgst_size
= DGST_SIZE_4_5
;
9490 parse_func
= mysql_auth_parse_hash
;
9491 sort_by_digest
= sort_by_digest_4_5
;
9492 opti_type
= OPTI_TYPE_ZERO_BYTE
9493 | OPTI_TYPE_EARLY_SKIP
;
9500 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9501 salt_type
= SALT_TYPE_EMBEDDED
;
9502 attack_exec
= ATTACK_EXEC_ON_CPU
;
9503 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9505 | OPTS_TYPE_ST_ADD80
;
9506 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9507 dgst_size
= DGST_SIZE_4_4
;
9508 parse_func
= bitcoin_wallet_parse_hash
;
9509 sort_by_digest
= sort_by_digest_4_4
;
9510 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9517 case 11400: hash_type
= HASH_TYPE_MD5
;
9518 salt_type
= SALT_TYPE_EMBEDDED
;
9519 attack_exec
= ATTACK_EXEC_ON_GPU
;
9520 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9521 | OPTS_TYPE_PT_ADD80
9522 | OPTS_TYPE_HASH_COPY
;
9523 kern_type
= KERN_TYPE_SIP_AUTH
;
9524 dgst_size
= DGST_SIZE_4_4
;
9525 parse_func
= sip_auth_parse_hash
;
9526 sort_by_digest
= sort_by_digest_4_4
;
9527 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9534 case 11500: hash_type
= HASH_TYPE_CRC32
;
9535 salt_type
= SALT_TYPE_INTERN
;
9536 attack_exec
= ATTACK_EXEC_ON_GPU
;
9537 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9538 | OPTS_TYPE_ST_GENERATE_LE
9540 kern_type
= KERN_TYPE_CRC32
;
9541 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9542 parse_func
= crc32_parse_hash
;
9543 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9544 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9551 case 11600: hash_type
= HASH_TYPE_AES
;
9552 salt_type
= SALT_TYPE_EMBEDDED
;
9553 attack_exec
= ATTACK_EXEC_ON_CPU
;
9554 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9555 | OPTS_TYPE_PT_NEVERCRACK
;
9556 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9557 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9558 parse_func
= seven_zip_parse_hash
;
9559 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9560 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9567 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9568 salt_type
= SALT_TYPE_NONE
;
9569 attack_exec
= ATTACK_EXEC_ON_GPU
;
9570 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9571 | OPTS_TYPE_PT_ADD01
;
9572 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9573 dgst_size
= DGST_SIZE_4_8
;
9574 parse_func
= gost2012sbog_256_parse_hash
;
9575 sort_by_digest
= sort_by_digest_4_8
;
9576 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9583 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9584 salt_type
= SALT_TYPE_NONE
;
9585 attack_exec
= ATTACK_EXEC_ON_GPU
;
9586 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9587 | OPTS_TYPE_PT_ADD01
;
9588 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9589 dgst_size
= DGST_SIZE_4_16
;
9590 parse_func
= gost2012sbog_512_parse_hash
;
9591 sort_by_digest
= sort_by_digest_4_16
;
9592 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9599 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9600 salt_type
= SALT_TYPE_EMBEDDED
;
9601 attack_exec
= ATTACK_EXEC_ON_CPU
;
9602 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9603 | OPTS_TYPE_ST_BASE64
9604 | OPTS_TYPE_HASH_COPY
;
9605 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9606 dgst_size
= DGST_SIZE_4_32
;
9607 parse_func
= pbkdf2_md5_parse_hash
;
9608 sort_by_digest
= sort_by_digest_4_32
;
9609 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9616 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9617 salt_type
= SALT_TYPE_EMBEDDED
;
9618 attack_exec
= ATTACK_EXEC_ON_CPU
;
9619 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9620 | OPTS_TYPE_ST_BASE64
9621 | OPTS_TYPE_HASH_COPY
;
9622 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9623 dgst_size
= DGST_SIZE_4_32
;
9624 parse_func
= pbkdf2_sha1_parse_hash
;
9625 sort_by_digest
= sort_by_digest_4_32
;
9626 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9633 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9634 salt_type
= SALT_TYPE_EMBEDDED
;
9635 attack_exec
= ATTACK_EXEC_ON_CPU
;
9636 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9637 | OPTS_TYPE_ST_BASE64
9638 | OPTS_TYPE_HASH_COPY
;
9639 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9640 dgst_size
= DGST_SIZE_8_16
;
9641 parse_func
= pbkdf2_sha512_parse_hash
;
9642 sort_by_digest
= sort_by_digest_8_16
;
9643 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9650 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9651 salt_type
= SALT_TYPE_EMBEDDED
;
9652 attack_exec
= ATTACK_EXEC_ON_CPU
;
9653 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9654 kern_type
= KERN_TYPE_ECRYPTFS
;
9655 dgst_size
= DGST_SIZE_8_8
;
9656 parse_func
= ecryptfs_parse_hash
;
9657 sort_by_digest
= sort_by_digest_8_8
;
9658 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9665 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9666 salt_type
= SALT_TYPE_EMBEDDED
;
9667 attack_exec
= ATTACK_EXEC_ON_CPU
;
9668 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9669 kern_type
= KERN_TYPE_ORACLET
;
9670 dgst_size
= DGST_SIZE_8_16
;
9671 parse_func
= oraclet_parse_hash
;
9672 sort_by_digest
= sort_by_digest_8_16
;
9673 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9680 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9681 salt_type
= SALT_TYPE_EMBEDDED
;
9682 attack_exec
= ATTACK_EXEC_ON_CPU
;
9683 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9684 kern_type
= KERN_TYPE_BSDICRYPT
;
9685 dgst_size
= DGST_SIZE_4_4
;
9686 parse_func
= bsdicrypt_parse_hash
;
9687 sort_by_digest
= sort_by_digest_4_4
;
9688 opti_type
= OPTI_TYPE_ZERO_BYTE
9689 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9696 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9697 salt_type
= SALT_TYPE_EMBEDDED
;
9698 attack_exec
= ATTACK_EXEC_ON_CPU
;
9699 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9700 kern_type
= KERN_TYPE_RAR3
;
9701 dgst_size
= DGST_SIZE_4_4
;
9702 parse_func
= rar3hp_parse_hash
;
9703 sort_by_digest
= sort_by_digest_4_4
;
9704 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9711 case 12600: hash_type
= HASH_TYPE_SHA256
;
9712 salt_type
= SALT_TYPE_INTERN
;
9713 attack_exec
= ATTACK_EXEC_ON_GPU
;
9714 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9715 | OPTS_TYPE_PT_ADD80
;
9716 kern_type
= KERN_TYPE_CF10
;
9717 dgst_size
= DGST_SIZE_4_8
;
9718 parse_func
= cf10_parse_hash
;
9719 sort_by_digest
= sort_by_digest_4_8
;
9720 opti_type
= OPTI_TYPE_ZERO_BYTE
9721 | OPTI_TYPE_PRECOMPUTE_INIT
9722 | OPTI_TYPE_EARLY_SKIP
9723 | OPTI_TYPE_NOT_ITERATED
;
9730 case 12700: hash_type
= HASH_TYPE_AES
;
9731 salt_type
= SALT_TYPE_EMBEDDED
;
9732 attack_exec
= ATTACK_EXEC_ON_CPU
;
9733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9734 | OPTS_TYPE_HASH_COPY
;
9735 kern_type
= KERN_TYPE_MYWALLET
;
9736 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9737 parse_func
= mywallet_parse_hash
;
9738 sort_by_digest
= sort_by_digest_4_5
;
9739 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9746 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9747 salt_type
= SALT_TYPE_EMBEDDED
;
9748 attack_exec
= ATTACK_EXEC_ON_CPU
;
9749 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9750 kern_type
= KERN_TYPE_MS_DRSR
;
9751 dgst_size
= DGST_SIZE_4_8
;
9752 parse_func
= ms_drsr_parse_hash
;
9753 sort_by_digest
= sort_by_digest_4_8
;
9754 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9761 default: usage_mini_print (PROGNAME
); return (-1);
9768 data
.parse_func
= parse_func
;
9776 if (salt_type
== SALT_TYPE_INTERN
)
9778 opts_type
|= OPTS_TYPE_ST_HEX
;
9782 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9788 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9789 | (salt_type
== SALT_TYPE_EXTERN
)
9790 | (salt_type
== SALT_TYPE_EMBEDDED
)
9791 | (salt_type
== SALT_TYPE_VIRTUAL
));
9793 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9795 data
.hash_type
= hash_type
;
9796 data
.attack_mode
= attack_mode
;
9797 data
.attack_kern
= attack_kern
;
9798 data
.attack_exec
= attack_exec
;
9799 data
.kern_type
= kern_type
;
9800 data
.opts_type
= opts_type
;
9801 data
.dgst_size
= dgst_size
;
9802 data
.salt_type
= salt_type
;
9803 data
.isSalted
= isSalted
;
9804 data
.sort_by_digest
= sort_by_digest
;
9805 data
.dgst_pos0
= dgst_pos0
;
9806 data
.dgst_pos1
= dgst_pos1
;
9807 data
.dgst_pos2
= dgst_pos2
;
9808 data
.dgst_pos3
= dgst_pos3
;
9814 case 2500: esalt_size
= sizeof (wpa_t
); break;
9815 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9816 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9817 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9818 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9830 case 6243: esalt_size
= sizeof (tc_t
); break;
9831 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9832 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9833 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9834 case 7300: esalt_size
= sizeof (rakp_t
); break;
9835 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9836 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9837 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9838 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9839 case 9400: esalt_size
= sizeof (office2007_t
); break;
9840 case 9500: esalt_size
= sizeof (office2010_t
); break;
9841 case 9600: esalt_size
= sizeof (office2013_t
); break;
9842 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9843 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9844 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9845 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9846 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9847 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9848 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9849 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9850 case 10400: esalt_size
= sizeof (pdf_t
); break;
9851 case 10410: esalt_size
= sizeof (pdf_t
); break;
9852 case 10420: esalt_size
= sizeof (pdf_t
); break;
9853 case 10500: esalt_size
= sizeof (pdf_t
); break;
9854 case 10600: esalt_size
= sizeof (pdf_t
); break;
9855 case 10700: esalt_size
= sizeof (pdf_t
); break;
9856 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9857 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9858 case 11400: esalt_size
= sizeof (sip_t
); break;
9859 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9860 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9861 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9862 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9865 data
.esalt_size
= esalt_size
;
9868 * choose dictionary parser
9871 if (hash_type
== HASH_TYPE_LM
)
9873 get_next_word_func
= get_next_word_lm
;
9875 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9877 get_next_word_func
= get_next_word_uc
;
9881 get_next_word_func
= get_next_word_std
;
9888 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9891 size_t dictstat_nmemb
= 0;
9895 uint dictstat_nmemb
= 0;
9900 FILE *dictstat_fp
= NULL
;
9904 memset (dictstat
, 0, sizeof (dictstat
));
9906 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9908 dictstat_fp
= fopen (dictstat
, "rb");
9913 struct stat tmpstat
;
9915 fstat (fileno (dictstat_fp
), &tmpstat
);
9919 struct stat64 tmpstat
;
9921 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9924 if (tmpstat
.st_mtime
< COMPTIME
)
9926 /* with v0.15 the format changed so we have to ensure user is using a good version
9927 since there is no version-header in the dictstat file */
9929 fclose (dictstat_fp
);
9935 while (!feof (dictstat_fp
))
9939 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9941 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9943 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9945 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9951 fclose (dictstat_fp
);
9962 memset (potfile
, 0, sizeof (potfile
));
9964 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9968 FILE *out_fp
= NULL
;
9969 FILE *pot_fp
= NULL
;
9971 if (show
== 1 || left
== 1)
9973 pot_fp
= fopen (potfile
, "rb");
9977 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9982 if (outfile
!= NULL
)
9984 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9986 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
10000 if (potfile_disable
== 0)
10002 pot_fp
= fopen (potfile
, "ab");
10004 if (pot_fp
== NULL
)
10006 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10011 data
.pot_fp
= pot_fp
;
10018 uint pot_avail
= 0;
10020 if (show
== 1 || left
== 1)
10022 SUPPRESS_OUTPUT
= 1;
10024 pot_avail
= count_lines (pot_fp
);
10028 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
10030 uint pot_hashes_avail
= 0;
10034 while (!feof (pot_fp
))
10038 char line_buf
[BUFSIZ
];
10040 int line_len
= fgetl (pot_fp
, line_buf
);
10042 if (line_len
== 0) continue;
10044 char *plain_buf
= line_buf
+ line_len
;
10046 pot_t
*pot_ptr
= &pot
[pot_cnt
];
10048 hash_t
*hashes_buf
= &pot_ptr
->hash
;
10050 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
10051 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
10053 if (pot_cnt
== pot_hashes_avail
)
10057 for (pos
= 0; pos
< INCR_POT
; pos
++)
10059 if ((pot_cnt
+ pos
) >= pot_avail
) break;
10061 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
10063 hash_t
*tmp_hash
= &tmp_pot
->hash
;
10065 tmp_hash
->digest
= mymalloc (dgst_size
);
10069 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
10074 tmp_hash
->esalt
= mymalloc (esalt_size
);
10077 pot_hashes_avail
++;
10085 int iter
= MAX_CUT_TRIES
;
10089 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10091 if (line_buf
[i
] == ':')
10099 if (data
.hash_mode
!= 2500)
10101 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10105 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10107 if (line_len
> max_salt_size
)
10109 parser_status
= PARSER_GLOBAL_LENGTH
;
10113 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10115 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10117 hashes_buf
->salt
->salt_len
= line_len
;
10119 parser_status
= PARSER_OK
;
10123 // if NOT parsed without error, we add the ":" to the plain
10125 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10131 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10133 if (parser_status
< PARSER_GLOBAL_ZERO
)
10135 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10140 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10142 pot_ptr
->plain_len
= plain_len
;
10149 SUPPRESS_OUTPUT
= 0;
10151 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10155 * gpu accel and loops auto adjustment
10158 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10159 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10161 if (workload_profile
== 1)
10166 if (gpu_loops
== 0) gpu_loops
= 8;
10167 if (gpu_accel
== 0) gpu_accel
= 2;
10169 else if (workload_profile
== 3)
10174 if (gpu_loops
> 1024) gpu_loops
= 1024;
10175 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10178 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10180 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10185 if (hash_mode
== 12500)
10187 gpu_loops
= ROUNDS_RAR3
/ 16;
10190 data
.gpu_accel
= gpu_accel
;
10191 data
.gpu_loops
= gpu_loops
;
10197 uint pw_min
= PW_MIN
;
10198 uint pw_max
= PW_MAX
;
10202 case 400: if (pw_max
> 40) pw_max
= 40;
10204 case 500: if (pw_max
> 16) pw_max
= 16;
10206 case 1500: if (pw_max
> 8) pw_max
= 8;
10208 case 1600: if (pw_max
> 16) pw_max
= 16;
10210 case 1800: if (pw_max
> 16) pw_max
= 16;
10212 case 2100: if (pw_max
> 16) pw_max
= 16;
10214 case 2500: if (pw_min
< 8) pw_min
= 8;
10216 case 3000: if (pw_max
> 7) pw_max
= 7;
10218 case 5200: if (pw_max
> 24) pw_max
= 24;
10220 case 5800: if (pw_max
> 16) pw_max
= 16;
10222 case 6300: if (pw_max
> 16) pw_max
= 16;
10224 case 7400: if (pw_max
> 16) pw_max
= 16;
10226 case 7900: if (pw_max
> 48) pw_max
= 48;
10228 case 8500: if (pw_max
> 8) pw_max
= 8;
10230 case 8600: if (pw_max
> 16) pw_max
= 16;
10232 case 9710: pw_min
= 5;
10235 case 9810: pw_min
= 5;
10238 case 10410: pw_min
= 5;
10241 case 10300: if (pw_max
< 3) pw_min
= 3;
10242 if (pw_max
> 40) pw_max
= 40;
10244 case 10500: if (pw_max
< 3) pw_min
= 3;
10245 if (pw_max
> 40) pw_max
= 40;
10247 case 10700: if (pw_max
> 16) pw_max
= 16;
10249 case 11300: if (pw_max
> 40) pw_max
= 40;
10251 case 12500: if (pw_max
> 20) pw_max
= 20;
10253 case 12800: if (pw_max
> 24) pw_max
= 24;
10257 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10259 switch (attack_kern
)
10261 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10263 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10269 * charsets : keep them together for more easy maintainnce
10275 memset (mp_sys
, 0, sizeof (mp_sys
));
10276 memset (mp_usr
, 0, sizeof (mp_usr
));
10278 mp_setup_sys (mp_sys
);
10280 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10281 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10282 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10283 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10286 * load hashes, part I: find input mode, count hashes
10289 uint hashlist_mode
= 0;
10290 uint hashlist_format
= HLFMT_HASHCAT
;
10292 uint hashes_avail
= 0;
10294 if (benchmark
== 0)
10298 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10300 if ((hash_mode
== 2500) ||
10301 (hash_mode
== 5200) ||
10302 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10303 (hash_mode
== 9000))
10305 hashlist_mode
= HL_MODE_ARG
;
10307 char *hashfile
= myargv
[optind
];
10309 data
.hashfile
= hashfile
;
10311 logfile_top_var_string ("target", hashfile
);
10314 if (hashlist_mode
== HL_MODE_ARG
)
10316 if (hash_mode
== 2500)
10320 if (stat (data
.hashfile
, &st
) == -1)
10322 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10327 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10334 else if (hashlist_mode
== HL_MODE_FILE
)
10336 char *hashfile
= myargv
[optind
];
10338 data
.hashfile
= hashfile
;
10340 logfile_top_var_string ("target", hashfile
);
10344 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10346 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10351 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10353 hashes_avail
= count_lines (fp
);
10357 if (hashes_avail
== 0)
10359 log_error ("ERROR: hashfile is empty or corrupt");
10366 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10368 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10370 log_error ("ERROR: remove not supported in native hashfile-format mode");
10382 hashlist_mode
= HL_MODE_ARG
;
10387 if (hash_mode
== 3000) hashes_avail
*= 2;
10389 data
.hashlist_mode
= hashlist_mode
;
10390 data
.hashlist_format
= hashlist_format
;
10392 logfile_top_uint (hashlist_mode
);
10393 logfile_top_uint (hashlist_format
);
10396 * load hashes, part II: allocate required memory, set pointers
10399 hash_t
*hashes_buf
= NULL
;
10400 void *digests_buf
= NULL
;
10401 salt_t
*salts_buf
= NULL
;
10402 void *esalts_buf
= NULL
;
10404 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10406 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10408 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10412 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10414 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10416 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10418 if (username
&& (remove
|| show
|| left
))
10420 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10425 hash_info
->orighash
= (char *) mymalloc (256);
10432 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10436 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10441 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10444 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10446 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10450 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10454 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10459 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10464 * load hashes, part III: parse hashes or generate them if benchmark
10467 uint hashes_cnt
= 0;
10469 if (benchmark
== 0)
10473 // useless to read hash file for keyspace, cheat a little bit w/ optind
10475 else if (hashes_avail
== 0)
10478 else if (hashlist_mode
== HL_MODE_ARG
)
10480 char *input_buf
= myargv
[optind
];
10482 uint input_len
= strlen (input_buf
);
10484 logfile_top_var_string ("target", input_buf
);
10486 char *hash_buf
= NULL
;
10489 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10493 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10495 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10497 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10502 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10505 int parser_status
= PARSER_OK
;
10507 if (hash_mode
== 2500)
10511 log_error ("ERROR: hccap file not specified");
10516 hashlist_mode
= HL_MODE_FILE
;
10518 data
.hashlist_mode
= hashlist_mode
;
10520 FILE *fp
= fopen (hash_buf
, "rb");
10524 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10529 if (hashes_avail
< 1)
10531 log_error ("ERROR: hccap file is empty or corrupt");
10538 uint hccap_size
= sizeof (hccap_t
);
10540 char in
[hccap_size
];
10544 int n
= fread (&in
, hccap_size
, 1, fp
);
10548 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10553 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10555 if (parser_status
!= PARSER_OK
)
10557 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10562 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10564 if ((show
== 1) || (left
== 1))
10566 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10568 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10570 int cur_pos
= tmp_salt
->salt_len
;
10571 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10573 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10575 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10577 // do the appending task
10579 snprintf (salt_ptr
+ cur_pos
,
10581 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10582 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10583 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10586 // memset () the remaining part of the salt
10588 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10589 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10591 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10593 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10596 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
);
10597 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
);
10604 else if (hash_mode
== 3000)
10606 if (hash_len
== 32)
10608 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10610 hash_t
*lm_hash_left
= NULL
;
10612 if (parser_status
== PARSER_OK
)
10614 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10620 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10624 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10626 hash_t
*lm_hash_right
= NULL
;
10628 if (parser_status
== PARSER_OK
)
10630 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10636 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10641 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10643 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
);
10644 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
);
10649 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10651 if (parser_status
== PARSER_OK
)
10653 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10654 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10657 if (parser_status
== PARSER_OK
)
10663 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10669 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10671 if (parser_status
== PARSER_OK
)
10673 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10674 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10677 if (parser_status
== PARSER_OK
)
10683 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10688 else if (hashlist_mode
== HL_MODE_FILE
)
10690 char *hashfile
= data
.hashfile
;
10694 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10696 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10707 char line_buf
[BUFSIZ
];
10709 int line_len
= fgetl (fp
, line_buf
);
10711 if (line_len
== 0) continue;
10713 char *hash_buf
= NULL
;
10716 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10720 char *user_buf
= NULL
;
10723 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10725 if (remove
|| show
)
10727 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10729 *user
= (user_t
*) malloc (sizeof (user_t
));
10731 user_t
*user_ptr
= *user
;
10733 if (user_buf
!= NULL
)
10735 user_ptr
->user_name
= mystrdup (user_buf
);
10739 user_ptr
->user_name
= mystrdup ("");
10742 user_ptr
->user_len
= user_len
;
10746 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10748 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10750 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10755 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10758 if (hash_mode
== 3000)
10760 if (hash_len
== 32)
10762 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10764 if (parser_status
< PARSER_GLOBAL_ZERO
)
10766 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10771 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10775 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10777 if (parser_status
< PARSER_GLOBAL_ZERO
)
10779 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10784 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10786 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);
10792 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
);
10793 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
);
10797 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10799 if (parser_status
< PARSER_GLOBAL_ZERO
)
10801 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10806 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);
10808 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10809 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10816 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10818 if (parser_status
< PARSER_GLOBAL_ZERO
)
10820 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10825 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);
10827 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10828 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10836 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10838 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10845 hashes_buf
[0].salt
->salt_len
= 8;
10847 // special salt handling
10851 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10853 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10855 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10857 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10859 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10861 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10863 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10865 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10867 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10869 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10871 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10872 hashes_buf
[0].salt
->scrypt_N
= 1024;
10873 hashes_buf
[0].salt
->scrypt_r
= 1;
10874 hashes_buf
[0].salt
->scrypt_p
= 1;
10876 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10878 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10879 hashes_buf
[0].salt
->scrypt_N
= 16384;
10880 hashes_buf
[0].salt
->scrypt_r
= 1;
10881 hashes_buf
[0].salt
->scrypt_p
= 1;
10883 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10885 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10887 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10889 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10891 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10893 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10895 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10897 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10899 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10901 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10903 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10905 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10907 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10909 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10911 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10915 // special esalt handling
10919 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10921 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10922 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10924 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10925 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10927 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10928 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10929 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10930 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10932 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10933 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10934 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10935 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10937 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10939 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10940 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10941 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10943 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10944 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10945 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10947 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10948 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10949 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10951 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10952 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10953 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10955 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10956 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10957 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10959 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10960 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10961 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10963 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10964 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10965 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10974 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10976 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10978 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10991 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10993 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10995 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10997 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
11001 // set default iterations
11005 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
11007 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11009 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11011 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11013 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
11015 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
11017 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
11019 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
11021 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
11023 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
11027 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
11031 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11035 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11039 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11041 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11043 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
11045 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
11047 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
11049 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
11051 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
11053 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
11055 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
11057 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
11059 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
11061 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
11063 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
11065 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
11067 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
11069 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
11071 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
11073 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
11075 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
11077 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
11079 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
11081 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11083 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11085 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11087 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11089 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11091 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11093 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11095 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11097 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11099 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11101 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11103 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11105 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11107 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11109 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11111 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11113 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11117 // set special tuning for benchmark-mode 1
11119 if (benchmark_mode
== 1)
11126 case 400: gpu_loops
= ROUNDS_PHPASS
;
11129 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11132 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11135 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11138 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11141 case 2100: gpu_loops
= ROUNDS_DCC2
;
11144 case 2500: gpu_loops
= ROUNDS_WPA2
;
11147 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11150 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11153 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11156 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11159 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11162 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11165 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11168 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11171 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11174 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11177 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11180 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11183 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11186 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11189 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11192 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11195 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11198 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11201 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11204 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11207 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11210 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11213 case 7200: gpu_loops
= ROUNDS_GRUB
;
11216 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11219 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11222 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11225 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11228 case 8900: gpu_loops
= 1;
11231 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11234 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11237 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11240 case 9300: gpu_loops
= 1;
11243 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11246 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11249 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11252 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11255 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11258 case 10500: gpu_loops
= ROUNDS_PDF14
;
11261 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11264 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11267 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11270 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11273 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11276 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11279 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11282 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11285 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11288 case 12500: gpu_loops
= ROUNDS_RAR3
;
11291 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11294 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11299 // some algorithm collide too fast, make that impossible
11303 case 11500: ((uint
*) digests_buf
)[1] = 1;
11307 if (gpu_loops
> 1024) gpu_loops
= 1024;
11308 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11311 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11316 if (hash_mode
== 12500)
11318 gpu_loops
= ROUNDS_RAR3
/ 16;
11321 data
.gpu_accel
= gpu_accel
;
11322 data
.gpu_loops
= gpu_loops
;
11327 if (show
== 1 || left
== 1)
11329 for (uint i
= 0; i
< pot_cnt
; i
++)
11331 pot_t
*pot_ptr
= &pot
[i
];
11333 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11335 local_free (hashes_buf
->digest
);
11339 local_free (hashes_buf
->salt
);
11345 if (data
.quiet
== 0) log_info_nn ("");
11352 if (hashes_cnt
== 0)
11354 log_error ("ERROR: No hashes loaded");
11361 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11364 if (data
.outfile
!= NULL
)
11366 if (data
.hashfile
!= NULL
)
11369 struct stat tmpstat_outfile
;
11370 struct stat tmpstat_hashfile
;
11374 struct stat64 tmpstat_outfile
;
11375 struct stat64 tmpstat_hashfile
;
11378 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11380 if (tmp_outfile_fp
)
11383 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11387 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11390 fclose (tmp_outfile_fp
);
11393 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11395 if (tmp_hashfile_fp
)
11398 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11402 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11405 fclose (tmp_hashfile_fp
);
11408 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11410 tmpstat_outfile
.st_mode
= 0;
11411 tmpstat_outfile
.st_nlink
= 0;
11412 tmpstat_outfile
.st_uid
= 0;
11413 tmpstat_outfile
.st_gid
= 0;
11414 tmpstat_outfile
.st_rdev
= 0;
11415 tmpstat_outfile
.st_atime
= 0;
11417 tmpstat_hashfile
.st_mode
= 0;
11418 tmpstat_hashfile
.st_nlink
= 0;
11419 tmpstat_hashfile
.st_uid
= 0;
11420 tmpstat_hashfile
.st_gid
= 0;
11421 tmpstat_hashfile
.st_rdev
= 0;
11422 tmpstat_hashfile
.st_atime
= 0;
11425 tmpstat_outfile
.st_blksize
= 0;
11426 tmpstat_outfile
.st_blocks
= 0;
11428 tmpstat_hashfile
.st_blksize
= 0;
11429 tmpstat_hashfile
.st_blocks
= 0;
11433 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11435 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11442 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11444 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11454 * Remove duplicates
11457 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11461 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11465 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11468 uint hashes_cnt_orig
= hashes_cnt
;
11472 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11476 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11478 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11483 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11486 if (hashes_pos
> hashes_cnt
)
11488 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11498 uint potfile_remove_cracks
= 0;
11500 if (potfile_disable
== 0)
11504 hash_buf
.digest
= mymalloc (dgst_size
);
11505 hash_buf
.salt
= NULL
;
11506 hash_buf
.esalt
= NULL
;
11507 hash_buf
.hash_info
= NULL
;
11508 hash_buf
.cracked
= 0;
11512 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11517 hash_buf
.esalt
= mymalloc (esalt_size
);
11520 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11522 // no solution for these special hash types (for instane because they use hashfile in output etc)
11523 if ((hash_mode
!= 5200) &&
11524 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11525 (hash_mode
!= 9000))
11527 FILE *fp
= fopen (potfile
, "rb");
11533 char line_buf
[BUFSIZ
];
11535 memset (line_buf
, 0, BUFSIZ
);
11537 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11539 if (ptr
== NULL
) break;
11541 int line_len
= strlen (line_buf
);
11543 if (line_len
== 0) continue;
11545 int iter
= MAX_CUT_TRIES
;
11547 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11549 if (line_buf
[i
] != ':') continue;
11553 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11556 hash_t
*found
= NULL
;
11558 if (hash_mode
== 6800)
11560 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11562 // manipulate salt_buf
11563 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11565 hash_buf
.salt
->salt_len
= i
;
11567 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11570 else if (hash_mode
== 2500)
11572 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11574 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11575 // manipulate salt_buf
11577 // to be safe work with a copy (because of line_len loop, i etc)
11579 char line_buf_cpy
[BUFSIZ
];
11580 memset (line_buf_cpy
, 0, BUFSIZ
);
11582 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11584 memcpy (line_buf_cpy
, line_buf
, i
);
11586 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11588 if (mac2_pos
== NULL
) continue;
11593 if (strlen (mac2_pos
) != 12) continue;
11595 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11597 if (mac1_pos
== NULL
) continue;
11602 if (strlen (mac1_pos
) != 12) continue;
11604 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11606 // here we need the ESSID
11607 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11609 hash_buf
.salt
->salt_len
= essid_length
;
11611 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11615 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11619 char *pke_ptr
= (char *) pke
;
11621 for (uint i
= 0; i
< 25; i
++)
11623 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11626 unsigned char mac1
[6];
11627 unsigned char mac2
[6];
11629 memcpy (mac1
, pke_ptr
+ 23, 6);
11630 memcpy (mac2
, pke_ptr
+ 29, 6);
11632 // compare hex string(s) vs binary MAC address(es)
11634 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11636 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11644 if (!found
) continue;
11646 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11648 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11659 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11661 if (parser_status
== PARSER_OK
)
11665 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11669 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11674 if (found
== NULL
) continue;
11676 if (!found
->cracked
) potfile_remove_cracks
++;
11678 found
->cracked
= 1;
11692 local_free (hash_buf
.esalt
);
11697 local_free (hash_buf
.salt
);
11700 local_free (hash_buf
.digest
);
11704 * Now generate all the buffers required for later
11707 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11709 salt_t
*salts_buf_new
= NULL
;
11710 void *esalts_buf_new
= NULL
;
11714 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11718 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11723 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11726 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11728 uint digests_cnt
= hashes_cnt
;
11729 uint digests_done
= 0;
11731 uint size_digests
= digests_cnt
* dgst_size
;
11732 uint size_shown
= digests_cnt
* sizeof (uint
);
11734 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11735 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11737 uint salts_cnt
= 0;
11738 uint salts_done
= 0;
11740 hashinfo_t
**hash_info
= NULL
;
11742 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11744 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11746 if (username
&& (remove
|| show
))
11750 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11752 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11754 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11759 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11764 // copied from inner loop
11766 salt_buf
= &salts_buf_new
[salts_cnt
];
11768 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11772 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11775 salt_buf
->digests_cnt
= 0;
11776 salt_buf
->digests_done
= 0;
11777 salt_buf
->digests_offset
= 0;
11782 if (hashes_buf
[0].cracked
== 1)
11784 digests_shown
[0] = 1;
11788 salt_buf
->digests_done
++;
11791 salt_buf
->digests_cnt
++;
11793 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11795 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11797 hash_info
[0] = hashes_buf
[0].hash_info
;
11800 // copy from inner loop
11802 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11806 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11808 salt_buf
= &salts_buf_new
[salts_cnt
];
11810 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11814 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11817 salt_buf
->digests_cnt
= 0;
11818 salt_buf
->digests_done
= 0;
11819 salt_buf
->digests_offset
= hashes_pos
;
11825 if (hashes_buf
[hashes_pos
].cracked
== 1)
11827 digests_shown
[hashes_pos
] = 1;
11831 salt_buf
->digests_done
++;
11834 salt_buf
->digests_cnt
++;
11836 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11838 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11840 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11844 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11846 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11848 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11850 salts_shown
[salt_pos
] = 1;
11855 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11858 local_free (digests_buf
);
11859 local_free (salts_buf
);
11860 local_free (esalts_buf
);
11862 digests_buf
= digests_buf_new
;
11863 salts_buf
= salts_buf_new
;
11864 esalts_buf
= esalts_buf_new
;
11866 local_free (hashes_buf
);
11869 * special modification not set from parser
11874 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11875 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11876 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11877 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11878 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11879 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11880 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11881 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11882 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11883 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11884 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11885 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11888 if (truecrypt_keyfiles
)
11890 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11892 char *keyfiles
= strdup (truecrypt_keyfiles
);
11894 char *keyfile
= strtok (keyfiles
, ",");
11898 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11900 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11905 data
.digests_cnt
= digests_cnt
;
11906 data
.digests_done
= digests_done
;
11907 data
.digests_buf
= digests_buf
;
11908 data
.digests_shown
= digests_shown
;
11909 data
.digests_shown_tmp
= digests_shown_tmp
;
11911 data
.salts_cnt
= salts_cnt
;
11912 data
.salts_done
= salts_done
;
11913 data
.salts_buf
= salts_buf
;
11914 data
.salts_shown
= salts_shown
;
11916 data
.esalts_buf
= esalts_buf
;
11917 data
.hash_info
= hash_info
;
11920 * Automatic Optimizers
11923 if (salts_cnt
== 1)
11924 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11926 if (digests_cnt
== 1)
11927 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11929 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11930 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11932 if (attack_mode
== ATTACK_MODE_BF
)
11933 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11935 data
.opti_type
= opti_type
;
11937 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11939 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11941 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11943 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11945 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11946 opts_type
|= OPTS_TYPE_PT_ADD80
;
11949 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11951 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11952 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11955 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11957 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11958 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11965 * Some algorithm, like descrypt, can benefit from JIT compilation
11968 uint force_jit_compilation
= 0;
11970 if (hash_mode
== 8900)
11972 force_jit_compilation
= 8900;
11974 else if (hash_mode
== 9300)
11976 force_jit_compilation
= 8900;
11978 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11980 force_jit_compilation
= 1500;
11984 * generate bitmap tables
11987 const uint bitmap_shift1
= 5;
11988 const uint bitmap_shift2
= 13;
11990 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11992 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11993 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11994 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11995 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11996 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11997 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11998 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11999 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12006 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12008 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12010 bitmap_nums
= 1 << bitmap_bits
;
12012 bitmap_mask
= bitmap_nums
- 1;
12014 bitmap_size
= bitmap_nums
* sizeof (uint
);
12016 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12018 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;
12019 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;
12024 bitmap_nums
= 1 << bitmap_bits
;
12026 bitmap_mask
= bitmap_nums
- 1;
12028 bitmap_size
= bitmap_nums
* sizeof (uint
);
12030 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);
12031 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);
12034 * prepare quick rule
12037 data
.rule_buf_l
= rule_buf_l
;
12038 data
.rule_buf_r
= rule_buf_r
;
12040 int rule_len_l
= (int) strlen (rule_buf_l
);
12041 int rule_len_r
= (int) strlen (rule_buf_r
);
12043 data
.rule_len_l
= rule_len_l
;
12044 data
.rule_len_r
= rule_len_r
;
12050 uint
*all_gpu_rules_cnt
= NULL
;
12052 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
12056 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12058 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
12061 char rule_buf
[BUFSIZ
];
12065 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12067 uint gpu_rules_avail
= 0;
12069 uint gpu_rules_cnt
= 0;
12071 gpu_rule_t
*gpu_rules_buf
= NULL
;
12073 char *rp_file
= rp_files
[i
];
12075 char in
[BLOCK_SIZE
];
12076 char out
[BLOCK_SIZE
];
12080 uint rule_line
= 0;
12082 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12084 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12091 memset (rule_buf
, 0, BUFSIZ
);
12093 rule_len
= fgetl (fp
, rule_buf
);
12097 if (rule_len
== 0) continue;
12099 if (rule_buf
[0] == '#') continue;
12101 if (gpu_rules_avail
== gpu_rules_cnt
)
12103 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12105 gpu_rules_avail
+= INCR_RULES
;
12108 memset (in
, 0, BLOCK_SIZE
);
12109 memset (out
, 0, BLOCK_SIZE
);
12111 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12115 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12120 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12122 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12124 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12130 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12132 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12143 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12145 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12149 * merge rules or automatic rule generator
12152 uint gpu_rules_cnt
= 0;
12154 gpu_rule_t
*gpu_rules_buf
= NULL
;
12156 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12162 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12164 repeats
[0] = gpu_rules_cnt
;
12166 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12168 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12170 repeats
[i
+ 1] = gpu_rules_cnt
;
12173 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12175 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12177 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12181 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12183 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12185 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12188 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12190 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12192 if (out_pos
== RULES_MAX
- 1)
12194 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12199 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12204 local_free (repeats
);
12208 uint gpu_rules_avail
= 0;
12210 while (gpu_rules_cnt
< rp_gen
)
12212 if (gpu_rules_avail
== gpu_rules_cnt
)
12214 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12216 gpu_rules_avail
+= INCR_RULES
;
12219 memset (rule_buf
, 0, BLOCK_SIZE
);
12221 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12223 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12231 * generate NOP rules
12234 if (gpu_rules_cnt
== 0)
12236 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12238 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12243 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12244 data
.gpu_rules_buf
= gpu_rules_buf
;
12250 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12252 uint CL_platforms_cnt
= 0;
12254 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12256 if (CL_platforms_cnt
== 0)
12258 log_error ("ERROR: No OpenCL compatible platform found");
12263 uint CL_platform_sel
= 0;
12265 if (CL_platforms_cnt
> 1)
12267 if (gpu_platform
== NULL
)
12269 log_error ("ERROR: Too many OpenCL compatible platforms found");
12270 log_error (" Please select a single platform using the --gpu-platform option");
12272 log_error ("Available OpenCL platforms:");
12274 for (uint i
= 0; i
< CL_platforms_cnt
; i
++)
12276 char CL_platform_vendor
[INFOSZ
];
12278 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12280 hc_clGetPlatformInfo (CL_platforms
[i
], CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12282 printf ("* %d = %s\n", i
+ 1, CL_platform_vendor
);
12287 CL_platform_sel
= atoi (gpu_platform
);
12293 cl_platform_id CL_platform
= CL_platforms
[CL_platform_sel
];
12295 char CL_platform_vendor
[INFOSZ
];
12297 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12299 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12303 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12305 vendor_id
= VENDOR_ID_AMD
;
12307 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12309 vendor_id
= VENDOR_ID_NV
;
12311 // make sure that we do not directly control the fan for NVidia
12313 gpu_temp_retain
= 0;
12314 data
.gpu_temp_retain
= gpu_temp_retain
;
12318 vendor_id
= VENDOR_ID_UNKNOWN
;
12321 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12323 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12325 gpu_temp_disable
= 1;
12328 data
.vendor_id
= vendor_id
;
12334 cl_device_id devices_all
[DEVICES_MAX
];
12335 cl_device_id devices
[DEVICES_MAX
];
12337 uint devices_all_cnt
= 0;
12339 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12341 int hm_adapters_all
= devices_all_cnt
;
12343 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12345 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12347 if (gpu_temp_disable
== 0)
12349 if (vendor_id
== VENDOR_ID_NV
)
12352 HM_LIB hm_dll
= hm_init ();
12354 data
.hm_dll
= hm_dll
;
12356 if (hc_NVML_nvmlInit (hm_dll
) == NVML_SUCCESS
)
12358 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12360 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12364 for (int i
= 0; i
< tmp_in
; i
++)
12366 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12369 hm_adapters_all
= tmp_out
;
12371 for (int i
= 0; i
< tmp_out
; i
++)
12373 unsigned int speed
;
12375 if (hc_NVML_nvmlDeviceGetFanSpeed (hm_dll
, 1, hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12381 if (NvAPI_Initialize () == NVAPI_OK
)
12383 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12385 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12389 for (int i
= 0; i
< tmp_in
; i
++)
12391 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12394 hm_adapters_all
= tmp_out
;
12396 for (int i
= 0; i
< tmp_out
; i
++)
12400 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12406 if (vendor_id
== VENDOR_ID_AMD
)
12408 HM_LIB hm_dll
= hm_init ();
12410 data
.hm_dll
= hm_dll
;
12412 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12414 // total number of adapters
12416 int hm_adapters_num
;
12418 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12422 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12424 if (lpAdapterInfo
== NULL
) return (-1);
12426 // get a list (of ids of) valid/usable adapters
12428 int num_adl_adapters
= 0;
12430 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12432 if (num_adl_adapters
> 0)
12434 hc_thread_mutex_lock (mux_adl
);
12436 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12438 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12440 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12441 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12443 hc_thread_mutex_unlock (mux_adl
);
12446 hm_adapters_all
= num_adl_adapters
;
12448 myfree (valid_adl_device_list
);
12449 myfree (lpAdapterInfo
);
12454 if (hm_adapters_all
== 0)
12456 gpu_temp_disable
= 1;
12459 if (gpu_temp_disable
== 1)
12461 gpu_temp_abort
= 0;
12462 gpu_temp_retain
= 0;
12466 * enable custom signal handler(s)
12469 if (benchmark
== 0)
12471 hc_signal (sigHandler_default
);
12475 hc_signal (sigHandler_benchmark
);
12479 * devices mask and properties
12482 uint devices_cnt
= 0;
12484 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12486 if (gpu_devicemask
)
12488 uint device_all_id_mask
= 1 << device_all_id
;
12490 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12492 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12498 const uint device_id
= devices_cnt
;
12500 devices
[device_id
] = devices_all
[device_all_id
];
12502 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12504 char device_name
[INFOSZ
];
12506 memset (device_name
, 0, sizeof (device_name
));
12508 cl_ulong global_mem_size
;
12509 cl_uint max_clock_frequency
;
12510 cl_uint max_compute_units
;
12512 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12513 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12514 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12515 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12517 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12519 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12522 (unsigned int) (global_mem_size
/ 1024 / 1024),
12523 (unsigned int) (max_clock_frequency
),
12524 (unsigned int) max_compute_units
);
12530 if (devices_cnt
== 0)
12532 log_error ("ERROR: No devices left that matches your specification.");
12537 data
.devices_cnt
= devices_cnt
;
12539 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12548 // gpu temp sanity check
12550 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12552 if (gpu_temp_abort
< gpu_temp_retain
)
12554 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12560 data
.gpu_temp_disable
= gpu_temp_disable
;
12561 data
.gpu_temp_abort
= gpu_temp_abort
;
12562 data
.gpu_temp_retain
= gpu_temp_retain
;
12564 if (data
.quiet
== 0)
12566 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12568 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
);
12570 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12572 log_info ("Rules: %u", gpu_rules_cnt
);
12577 log_info ("Applicable Optimizers:");
12579 for (uint i
= 0; i
< 32; i
++)
12581 const uint opti_bit
= 1 << i
;
12583 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12588 * Watchdog and Temperature balance
12591 if (gpu_temp_abort
== 0)
12593 log_info ("Watchdog: Temperature abort trigger disabled");
12597 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12600 if (gpu_temp_retain
== 0)
12602 log_info ("Watchdog: Temperature retain trigger disabled");
12606 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12614 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12616 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12618 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12620 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12622 data
.devices_param
= devices_param
;
12624 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12626 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12628 cl_device_id device
= devices
[device_id
];
12630 device_param
->device
= device
;
12632 cl_uint max_compute_units
= 0;
12634 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12636 device_param
->gpu_processors
= max_compute_units
;
12638 cl_ulong max_mem_alloc_size
= 0;
12640 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12642 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12644 char tmp
[INFOSZ
], t1
[64];
12646 memset (tmp
, 0, sizeof (tmp
));
12648 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12650 device_param
->device_name
= mystrdup (tmp
);
12652 memset (tmp
, 0, sizeof (tmp
));
12654 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12656 memset (t1
, 0, sizeof (t1
));
12658 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12660 device_param
->device_version
= mystrdup (t1
);
12662 memset (tmp
, 0, sizeof (tmp
));
12664 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12666 device_param
->driver_version
= mystrdup (tmp
);
12668 if (vendor_id
== VENDOR_ID_AMD
)
12670 cl_uint gpu_processor_cores
= 0;
12672 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
12674 hc_clGetDeviceInfo (device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12676 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12679 if (vendor_id
== VENDOR_ID_NV
)
12681 cl_uint kernel_exec_timeout
= 0;
12683 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
12685 hc_clGetDeviceInfo (device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
12687 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
12689 cl_uint gpu_processor_cores
= 0;
12691 #define CL_DEVICE_WARP_SIZE_NV 0x4003
12693 hc_clGetDeviceInfo (device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12695 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12697 cl_uint sm_minor
= 0;
12698 cl_uint sm_major
= 0;
12700 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12701 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12703 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12704 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12706 device_param
->sm_minor
= sm_minor
;
12707 device_param
->sm_major
= sm_major
;
12711 * common driver check
12714 if (vendor_id
== VENDOR_ID_NV
)
12716 if (device_param
->kernel_exec_timeout
!= 0)
12718 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);
12719 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
12723 if (vendor_id
== VENDOR_ID_AMD
)
12725 int catalyst_check
= (force
== 1) ? 0 : 1;
12727 int catalyst_warn
= 0;
12729 int catalyst_broken
= 0;
12731 if (catalyst_check
== 1)
12735 // v14.9 and higher
12736 if ((atoi (device_param
->device_version
) >= 1573)
12737 && (atoi (device_param
->driver_version
) >= 1573))
12742 catalyst_check
= 0;
12745 if (catalyst_broken
== 1)
12748 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12749 log_error ("It will pass over cracked hashes and does not report them as cracked");
12750 log_error ("You are STRONGLY encouraged not to use it");
12751 log_error ("You can use --force to override this but do not post error reports if you do so");
12756 if (catalyst_warn
== 1)
12759 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12760 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12761 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12763 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12765 log_error ("You can use --force to override this but do not post error reports if you do so");
12774 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12775 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12776 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12777 * Driver / ADL bug?
12780 if (vendor_id
== VENDOR_ID_AMD
)
12782 if (powertune_enable
== 1)
12784 hc_thread_mutex_lock (mux_adl
);
12786 for (uint i
= 0; i
< devices_cnt
; i
++)
12788 if (data
.hm_device
[i
].od_version
== 6)
12790 // set powertune value only
12792 int powertune_supported
= 0;
12796 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12798 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12803 if (powertune_supported
!= 0)
12806 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12808 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12810 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12815 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12817 log_error ("ERROR: Failed to set new ADL PowerControl values");
12825 hc_thread_mutex_unlock (mux_adl
);
12829 uint gpu_blocks_all
= 0;
12831 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12837 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12840 * device properties
12843 char *device_name
= device_param
->device_name
;
12844 char *device_version
= device_param
->device_version
;
12845 char *driver_version
= device_param
->driver_version
;
12847 uint gpu_processors
= device_param
->gpu_processors
;
12849 uint gpu_processor_cores
= device_param
->gpu_processor_cores
;
12852 * create context for each device
12855 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12858 * create command-queue
12861 // not support with NV
12862 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12864 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12867 * create input buffers on device
12870 uint gpu_threads
= GPU_THREADS
;
12873 if (hash_mode
== 3200) gpu_threads
= 8;
12874 if (hash_mode
== 9000) gpu_threads
= 8;
12876 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12877 uint gpu_blocks
= gpu_power
;
12879 device_param
->gpu_threads
= gpu_threads
;
12880 device_param
->gpu_power_user
= gpu_power
;
12881 device_param
->gpu_blocks_user
= gpu_blocks
;
12883 gpu_blocks_all
+= gpu_blocks
;
12885 uint size_pws
= gpu_power
* sizeof (pw_t
);
12887 uint size_tmps
= 4;
12891 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12892 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12893 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12894 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12895 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12896 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12897 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12898 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12899 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12900 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12903 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12906 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12909 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12912 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12913 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12914 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12915 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12916 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12917 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12918 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12919 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12920 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12921 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12922 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12923 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12924 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12925 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12926 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12927 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12928 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12929 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12930 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12931 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12932 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12933 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12934 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12935 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12936 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12937 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12938 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12939 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12940 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12941 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12942 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12943 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12944 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12945 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12946 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12947 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12948 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12949 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12952 uint size_hooks
= 4;
12954 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12956 // insert correct hook size
12959 // we can optimize some stuff here...
12961 device_param
->size_pws
= size_pws
;
12962 device_param
->size_tmps
= size_tmps
;
12963 device_param
->size_hooks
= size_hooks
;
12965 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12966 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12968 device_param
->size_root_css
= size_root_css
;
12969 device_param
->size_markov_css
= size_markov_css
;
12971 uint size_results
= GPU_THREADS
* sizeof (uint
);
12973 device_param
->size_results
= size_results
;
12975 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12976 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12977 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12978 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12979 uint size_esalts
= salts_cnt
* esalt_size
;
12981 device_param
->size_plains
= size_plains
;
12982 device_param
->size_digests
= size_digests
;
12983 device_param
->size_shown
= size_shown
;
12984 device_param
->size_salts
= size_salts
;
12986 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12987 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12988 uint size_tm
= 32 * sizeof (bs_word_t
);
12990 uint64_t size_scryptV
= 1;
12992 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12994 uint tmto_start
= 0;
12995 uint tmto_stop
= 10;
12999 tmto_start
= scrypt_tmto
;
13003 // in case the user did not specify the tmto manually
13004 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
13005 // but set the lower end only in case the user has a gpu with too less memory
13007 if (hash_mode
== 8900)
13009 if (vendor_id
== VENDOR_ID_AMD
)
13013 else if (vendor_id
== VENDOR_ID_NV
)
13018 else if (hash_mode
== 9300)
13020 if (vendor_id
== VENDOR_ID_AMD
)
13024 else if (vendor_id
== VENDOR_ID_NV
)
13031 if (quiet
== 0) log_info ("");
13033 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
13035 // TODO: in theory the following calculation needs to be done per salt, not global
13036 // we assume all hashes have the same scrypt settings
13038 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
13040 size_scryptV
/= 1 << tmto
;
13042 size_scryptV
*= gpu_processors
* gpu_processor_cores
* gpu_threads
;
13044 if (size_scryptV
> device_param
->gpu_maxmem_alloc
)
13046 if (quiet
== 0) log_info ("WARNING: not enough GPU memory free for allocation to use --scrypt-tmto %d, increasing...", tmto
);
13051 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
13053 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
13054 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* gpu_processor_cores
* gpu_threads
;
13060 if (data
.salts_buf
[0].scrypt_tmto
== 0)
13062 log_error ("ERROR: can't allocate enough GPU memory");
13067 if (quiet
== 0) log_info ("");
13068 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
13072 * default building options
13075 char build_opts
[1024];
13077 // we don't have sm_* on AMD but it doesn't matter
13079 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
13087 * kernel source filename
13090 char source_file
[256];
13092 memset (source_file
, 0, sizeof (source_file
));
13094 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, source_file
);
13098 if (stat (source_file
, &sst
) == -1)
13100 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13106 * kernel cached filename
13109 char cached_file
[256];
13111 memset (cached_file
, 0, sizeof (cached_file
));
13113 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13119 if (stat (cached_file
, &cst
) == -1)
13125 * kernel compile or load
13128 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13130 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13132 if (force_jit_compilation
== 0)
13136 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13138 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13140 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13142 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13144 size_t binary_size
;
13146 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13148 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13150 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13152 writeProgramBin (cached_file
, binary
, binary_size
);
13154 local_free (binary
);
13158 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13160 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13162 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13164 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13169 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
13171 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13173 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13175 if (force_jit_compilation
== 1500)
13177 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13179 else if (force_jit_compilation
== 8900)
13181 sprintf (build_opts
, "%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
);
13184 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13187 local_free (kernel_lengths
);
13188 local_free (kernel_sources
[0]);
13189 local_free (kernel_sources
);
13191 // this is mostly for debug
13193 size_t ret_val_size
= 0;
13195 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13197 if (ret_val_size
> 2)
13199 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13201 memset (build_log
, 0, ret_val_size
+ 1);
13203 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13207 myfree (build_log
);
13212 * word generator kernel
13215 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13218 * kernel mp source filename
13221 char source_file
[256];
13223 memset (source_file
, 0, sizeof (source_file
));
13225 generate_source_kernel_mp_filename (opti_type
, opts_type
, install_dir
, source_file
);
13229 if (stat (source_file
, &sst
) == -1)
13231 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13237 * kernel mp cached filename
13240 char cached_file
[256];
13242 memset (cached_file
, 0, sizeof (cached_file
));
13244 generate_cached_kernel_mp_filename (opti_type
, opts_type
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13250 if (stat (cached_file
, &cst
) == -1)
13256 * kernel compile or load
13259 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13261 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13265 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13267 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13269 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13271 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13273 size_t binary_size
;
13275 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13277 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13279 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13281 writeProgramBin (cached_file
, binary
, binary_size
);
13283 local_free (binary
);
13287 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13289 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13291 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13293 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13296 local_free (kernel_lengths
);
13297 local_free (kernel_sources
[0]);
13298 local_free (kernel_sources
);
13300 // this is mostly for debug
13302 size_t ret_val_size
= 0;
13304 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13306 if (ret_val_size
> 2)
13308 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13310 memset (build_log
, 0, ret_val_size
+ 1);
13312 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13316 myfree (build_log
);
13324 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13331 * kernel amp source filename
13334 char source_file
[256];
13336 memset (source_file
, 0, sizeof (source_file
));
13338 generate_source_kernel_amp_filename (attack_kern
, install_dir
, source_file
);
13342 if (stat (source_file
, &sst
) == -1)
13344 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13350 * kernel amp cached filename
13353 char cached_file
[256];
13355 memset (cached_file
, 0, sizeof (cached_file
));
13357 generate_cached_kernel_amp_filename (attack_kern
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13363 if (stat (cached_file
, &cst
) == -1)
13369 * kernel compile or load
13372 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13374 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13378 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13380 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13382 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13384 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13386 size_t binary_size
;
13388 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13390 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13392 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13394 writeProgramBin (cached_file
, binary
, binary_size
);
13396 local_free (binary
);
13400 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13402 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13404 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13406 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13409 local_free (kernel_lengths
);
13410 local_free (kernel_sources
[0]);
13411 local_free (kernel_sources
);
13413 // this is mostly for debug
13415 size_t ret_val_size
= 0;
13417 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13419 if (ret_val_size
> 2)
13421 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13423 memset (build_log
, 0, ret_val_size
+ 1);
13425 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13429 myfree (build_log
);
13437 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13438 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13439 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13440 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13441 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13442 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13443 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13444 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13445 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13446 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13447 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13448 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13449 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13450 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13451 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13452 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13453 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13454 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13456 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13457 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13458 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13459 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13460 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13461 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13462 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13463 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13464 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13465 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13466 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13468 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13469 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13470 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13471 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13472 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13473 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13479 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13481 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13482 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13484 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13486 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13488 else if (attack_kern
== ATTACK_KERN_COMBI
)
13490 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13491 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13492 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13493 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13495 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13496 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13497 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13498 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13500 else if (attack_kern
== ATTACK_KERN_BF
)
13502 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13503 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13504 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13505 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13506 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13508 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13509 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13510 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13511 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13512 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13517 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13519 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13526 uint
*result
= (uint
*) mymalloc (size_results
);
13528 memset (result
, 0, size_results
);
13530 device_param
->result
= result
;
13532 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13534 memset (pws_buf
, 0, size_pws
);
13536 device_param
->pws_buf
= pws_buf
;
13538 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13540 for (int i
= 0; i
< 64; i
++)
13542 pw_caches
[i
].pw_buf
.pw_len
= i
;
13543 pw_caches
[i
].cnt
= 0;
13546 device_param
->pw_caches
= pw_caches
;
13548 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13550 device_param
->combs_buf
= combs_buf
;
13552 void *hooks_buf
= mymalloc (size_hooks
);
13554 device_param
->hooks_buf
= hooks_buf
;
13556 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13557 device_param
->pw_add
= pw_add_to_hc1
;
13563 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13564 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13565 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13566 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13567 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13568 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13569 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13570 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13571 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13572 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13573 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13575 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13576 ? &device_param
->d_pws_buf
13577 : &device_param
->d_pws_amp_buf
;
13578 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13579 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13580 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13581 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13582 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13583 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13584 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13585 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13586 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13587 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13588 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13589 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13590 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13591 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13592 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13593 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13594 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13595 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13596 device_param
->kernel_params
[19] = &device_param
->d_result
;
13597 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13598 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13599 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13600 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13601 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13602 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13603 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13604 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13605 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13606 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13607 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13608 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13610 device_param
->kernel_params_mp_buf64
[3] = 0;
13611 device_param
->kernel_params_mp_buf32
[4] = 0;
13612 device_param
->kernel_params_mp_buf32
[5] = 0;
13613 device_param
->kernel_params_mp_buf32
[6] = 0;
13614 device_param
->kernel_params_mp_buf32
[7] = 0;
13615 device_param
->kernel_params_mp_buf32
[8] = 0;
13617 device_param
->kernel_params_mp
[0] = NULL
;
13618 device_param
->kernel_params_mp
[1] = NULL
;
13619 device_param
->kernel_params_mp
[2] = NULL
;
13620 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13621 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13622 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13623 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13624 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13625 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13627 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13628 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13629 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13630 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13631 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13632 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13633 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13635 device_param
->kernel_params_mp_l
[0] = NULL
;
13636 device_param
->kernel_params_mp_l
[1] = NULL
;
13637 device_param
->kernel_params_mp_l
[2] = NULL
;
13638 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13639 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13640 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13641 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13642 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13643 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13644 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13646 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13647 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13648 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13649 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13650 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13651 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13653 device_param
->kernel_params_mp_r
[0] = NULL
;
13654 device_param
->kernel_params_mp_r
[1] = NULL
;
13655 device_param
->kernel_params_mp_r
[2] = NULL
;
13656 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13657 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13658 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13659 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13660 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13661 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13663 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13664 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13666 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13667 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13668 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13669 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13670 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13671 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13672 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13674 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13676 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13677 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13683 char kernel_name
[64];
13685 memset (kernel_name
, 0, sizeof (kernel_name
));
13687 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13689 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13691 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13693 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13695 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13697 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13699 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13701 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13705 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13707 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13709 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13711 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13713 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13715 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13718 if (data
.attack_mode
== ATTACK_MODE_BF
)
13720 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13722 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13724 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13726 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13728 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13734 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13736 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13738 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13740 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13742 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13744 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13746 if (opts_type
& OPTS_TYPE_HOOK12
)
13748 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13750 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13753 if (opts_type
& OPTS_TYPE_HOOK23
)
13755 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13757 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13761 for (uint i
= 0; i
<= 20; i
++)
13763 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13764 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13765 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13767 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13768 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13771 for (uint i
= 21; i
<= 31; i
++)
13773 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13774 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13775 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13777 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13778 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13781 if (attack_mode
== ATTACK_MODE_BF
)
13783 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13784 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13786 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13788 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13790 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13791 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13794 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13796 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13798 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13800 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13803 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13809 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13812 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13818 for (uint i
= 0; i
< 5; i
++)
13820 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13823 for (uint i
= 5; i
< 7; i
++)
13825 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13830 * Store initial fanspeed if gpu_temp_retain is enabled
13833 int gpu_temp_retain_set
= 0;
13835 if (gpu_temp_disable
== 0)
13837 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13839 hc_thread_mutex_lock (mux_adl
);
13841 if (data
.hm_device
[device_id
].fan_supported
== 1)
13843 if (gpu_temp_retain_chgd
== 0)
13846 uint default_temp
= 0;
13848 int ADL_rc
= hc_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
13850 if (ADL_rc
== ADL_OK
)
13852 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13854 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13856 // special case with multi gpu setups: always use minimum retain
13858 if (gpu_temp_retain_set
== 0)
13860 gpu_temp_retain
= gpu_temp_retain_target
;
13861 gpu_temp_retain_set
= 1;
13865 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13868 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13872 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13874 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13876 if (fan_speed
== -1)
13878 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13880 temp_retain_fanspeed_value
[device_id
] = 0;
13884 hc_thread_mutex_unlock (mux_adl
);
13889 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13892 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13894 hc_thread_mutex_lock (mux_adl
);
13896 if (data
.hm_device
[device_id
].od_version
== 6)
13900 // check powertune capabilities first, if not available then skip device
13902 int powertune_supported
= 0;
13904 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13906 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13911 if (powertune_supported
!= 0)
13913 // powercontrol settings
13915 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13917 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13919 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13922 if (ADL_rc
!= ADL_OK
)
13924 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13929 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13931 log_error ("ERROR: Failed to set new ADL PowerControl values");
13938 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13940 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13942 if ((ADL_rc
= hc_ADL_Overdrive_StateInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
13944 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13949 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13951 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13953 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
13955 log_error ("ERROR: Failed to get ADL device capabilities");
13960 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
13961 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
13963 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
13964 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
13966 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
13967 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
13969 // warning if profile has to low max values
13971 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
13973 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13976 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
13978 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13981 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
13983 performance_state
->iNumberOfPerformanceLevels
= 2;
13985 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
13986 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
13987 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
13988 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
13990 if ((ADL_rc
= hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
13992 log_info ("ERROR: Failed to set ADL performance state");
13997 local_free (performance_state
);
14001 hc_thread_mutex_unlock (mux_adl
);
14005 data
.gpu_blocks_all
= gpu_blocks_all
;
14007 if (data
.quiet
== 0) log_info ("");
14010 * Inform user which algorithm is checked and at which workload setting
14013 if (benchmark
== 1)
14017 data
.quiet
= quiet
;
14019 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
14021 log_info ("Hashtype: %s", hash_type
);
14022 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
14027 * keep track of the progress
14030 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14031 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14032 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14039 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
14041 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
14046 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
14048 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
14053 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
14055 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
14065 segment_size
*= (1024 * 1024);
14067 data
.segment_size
= segment_size
;
14069 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
14071 wl_data
->buf
= (char *) mymalloc (segment_size
);
14072 wl_data
->avail
= segment_size
;
14073 wl_data
->incr
= segment_size
;
14077 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
14079 data
.wordlist_mode
= wordlist_mode
;
14081 cs_t
*css_buf
= NULL
;
14085 char **masks
= NULL
;
14086 char **dictfiles
= NULL
;
14088 uint mask_from_file
= 0;
14090 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14092 if (wordlist_mode
== WL_MODE_FILE
)
14094 int wls_left
= myargc
- (optind
+ 1);
14096 for (int i
= 0; i
< wls_left
; i
++)
14098 char *l0_filename
= myargv
[optind
+ 1 + i
];
14100 struct stat l0_stat
;
14102 if (stat (l0_filename
, &l0_stat
) == -1)
14104 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
14109 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
14113 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14117 dictfiles
[dictcnt
- 1] = l0_filename
;
14121 // do not allow --keyspace w/ a directory
14125 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14130 char **dictionary_files
= NULL
;
14132 dictionary_files
= scan_directory (l0_filename
);
14134 if (dictionary_files
!= NULL
)
14136 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14138 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14140 char *l1_filename
= dictionary_files
[d
];
14142 struct stat l1_stat
;
14144 if (stat (l1_filename
, &l1_stat
) == -1)
14146 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14151 if (S_ISREG (l1_stat
.st_mode
))
14153 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14157 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14162 local_free (dictionary_files
);
14168 log_error ("ERROR: No usable dictionary file found.");
14173 else if (wordlist_mode
== WL_MODE_STDIN
)
14178 else if (attack_mode
== ATTACK_MODE_COMBI
)
14182 char *dictfile1
= myargv
[optind
+ 1 + 0];
14183 char *dictfile2
= myargv
[optind
+ 1 + 1];
14185 // find the bigger dictionary and use as base
14190 struct stat tmp_stat
;
14192 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14194 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14199 if (stat (dictfile1
, &tmp_stat
) == -1)
14201 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14208 if (S_ISDIR (tmp_stat
.st_mode
))
14210 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14217 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14219 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14226 if (stat (dictfile2
, &tmp_stat
) == -1)
14228 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14236 if (S_ISDIR (tmp_stat
.st_mode
))
14238 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14246 data
.combs_cnt
= 1;
14250 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14252 data
.quiet
= quiet
;
14254 if (words1_cnt
== 0)
14256 log_error ("ERROR: %s: empty file", dictfile1
);
14264 data
.combs_cnt
= 1;
14268 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14270 data
.quiet
= quiet
;
14272 if (words2_cnt
== 0)
14274 log_error ("ERROR: %s: empty file", dictfile2
);
14285 data
.dictfile
= dictfile1
;
14286 data
.dictfile2
= dictfile2
;
14288 if (words1_cnt
>= words2_cnt
)
14290 data
.combs_cnt
= words2_cnt
;
14291 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14293 dictfiles
= &data
.dictfile
;
14299 data
.combs_cnt
= words1_cnt
;
14300 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14302 dictfiles
= &data
.dictfile2
;
14306 // we also have to switch wordlist related rules!
14308 char *tmpc
= data
.rule_buf_l
;
14310 data
.rule_buf_l
= data
.rule_buf_r
;
14311 data
.rule_buf_r
= tmpc
;
14313 int tmpi
= data
.rule_len_l
;
14315 data
.rule_len_l
= data
.rule_len_r
;
14316 data
.rule_len_r
= tmpi
;
14319 else if (attack_mode
== ATTACK_MODE_BF
)
14325 if (benchmark
== 0)
14327 mask
= myargv
[optind
+ 1];
14329 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14331 if ((optind
+ 2) <= myargc
)
14333 struct stat file_stat
;
14335 if (stat (mask
, &file_stat
) == -1)
14339 masks
[maskcnt
- 1] = mystrdup (mask
);
14343 int wls_left
= myargc
- (optind
+ 1);
14345 uint masks_avail
= INCR_MASKS
;
14347 for (int i
= 0; i
< wls_left
; i
++)
14351 mask
= myargv
[optind
+ 1 + i
];
14353 if (stat (mask
, &file_stat
) == -1)
14355 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14361 uint is_file
= S_ISREG (file_stat
.st_mode
);
14367 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14369 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14374 char line_buf
[BUFSIZ
];
14376 while (!feof (mask_fp
))
14378 memset (line_buf
, 0, BUFSIZ
);
14380 int line_len
= fgetl (mask_fp
, line_buf
);
14382 if (line_len
== 0) continue;
14384 if (line_buf
[0] == '#') continue;
14386 if (masks_avail
== maskcnt
)
14388 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14390 masks_avail
+= INCR_MASKS
;
14393 masks
[maskcnt
] = mystrdup (line_buf
);
14402 log_error ("ERROR: %s: unsupported file-type", mask
);
14408 mask_from_file
= 1;
14413 custom_charset_1
= (char *) "?l?d?u";
14414 custom_charset_2
= (char *) "?l?d";
14415 custom_charset_3
= (char *) "?l?d*!$@_";
14417 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14418 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14419 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14421 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14423 wordlist_mode
= WL_MODE_MASK
;
14425 data
.wordlist_mode
= wordlist_mode
;
14435 * generate full masks and charsets
14438 masks
= (char **) mymalloc (sizeof (char *));
14442 case 1731: pw_min
= 5;
14444 mask
= mystrdup ("?b?b?b?b?b");
14446 case 12500: pw_min
= 5;
14448 mask
= mystrdup ("?b?b?b?b?b");
14450 default: pw_min
= 7;
14452 mask
= mystrdup ("?b?b?b?b?b?b?b");
14458 masks
[maskcnt
- 1] = mystrdup (mask
);
14460 wordlist_mode
= WL_MODE_MASK
;
14462 data
.wordlist_mode
= wordlist_mode
;
14467 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14471 if (increment_min
> pw_min
) pw_min
= increment_min
;
14473 if (increment_max
< pw_max
) pw_max
= increment_max
;
14476 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14478 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14482 char *mask
= myargv
[myargc
- 1];
14486 masks
= (char **) mymalloc (1 * sizeof (char *));
14490 struct stat file_stat
;
14492 if (stat (mask
, &file_stat
) == -1)
14496 masks
[maskcnt
- 1] = mystrdup (mask
);
14500 uint is_file
= S_ISREG (file_stat
.st_mode
);
14506 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14508 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14513 char line_buf
[BUFSIZ
];
14515 uint masks_avail
= 1;
14517 while (!feof (mask_fp
))
14519 memset (line_buf
, 0, BUFSIZ
);
14521 int line_len
= fgetl (mask_fp
, line_buf
);
14523 if (line_len
== 0) continue;
14525 if (line_buf
[0] == '#') continue;
14527 if (masks_avail
== maskcnt
)
14529 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14531 masks_avail
+= INCR_MASKS
;
14534 masks
[maskcnt
] = mystrdup (line_buf
);
14541 mask_from_file
= 1;
14547 masks
[maskcnt
- 1] = mystrdup (mask
);
14553 int wls_left
= myargc
- (optind
+ 2);
14555 for (int i
= 0; i
< wls_left
; i
++)
14557 char *filename
= myargv
[optind
+ 1 + i
];
14559 struct stat file_stat
;
14561 if (stat (filename
, &file_stat
) == -1)
14563 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14568 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14572 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14576 dictfiles
[dictcnt
- 1] = filename
;
14580 // do not allow --keyspace w/ a directory
14584 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14589 char **dictionary_files
= NULL
;
14591 dictionary_files
= scan_directory (filename
);
14593 if (dictionary_files
!= NULL
)
14595 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14597 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14599 char *l1_filename
= dictionary_files
[d
];
14601 struct stat l1_stat
;
14603 if (stat (l1_filename
, &l1_stat
) == -1)
14605 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14610 if (S_ISREG (l1_stat
.st_mode
))
14612 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14616 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14621 local_free (dictionary_files
);
14627 log_error ("ERROR: No usable dictionary file found.");
14636 uint mask_min
= increment_min
; // we can't reject smaller masks here
14637 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14639 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14641 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14643 if (cur_mask
== NULL
) break;
14645 masks
[maskcnt
] = cur_mask
;
14649 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14653 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14655 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14659 char *mask
= myargv
[optind
+ 1 + 0];
14663 masks
= (char **) mymalloc (1 * sizeof (char *));
14667 struct stat file_stat
;
14669 if (stat (mask
, &file_stat
) == -1)
14673 masks
[maskcnt
- 1] = mystrdup (mask
);
14677 uint is_file
= S_ISREG (file_stat
.st_mode
);
14683 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14685 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14690 char line_buf
[BUFSIZ
];
14692 uint masks_avail
= 1;
14694 while (!feof (mask_fp
))
14696 memset (line_buf
, 0, BUFSIZ
);
14698 int line_len
= fgetl (mask_fp
, line_buf
);
14700 if (line_len
== 0) continue;
14702 if (line_buf
[0] == '#') continue;
14704 if (masks_avail
== maskcnt
)
14706 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14708 masks_avail
+= INCR_MASKS
;
14711 masks
[maskcnt
] = mystrdup (line_buf
);
14718 mask_from_file
= 1;
14724 masks
[maskcnt
- 1] = mystrdup (mask
);
14730 int wls_left
= myargc
- (optind
+ 2);
14732 for (int i
= 0; i
< wls_left
; i
++)
14734 char *filename
= myargv
[optind
+ 2 + i
];
14736 struct stat file_stat
;
14738 if (stat (filename
, &file_stat
) == -1)
14740 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14745 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14749 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14753 dictfiles
[dictcnt
- 1] = filename
;
14757 // do not allow --keyspace w/ a directory
14761 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14766 char **dictionary_files
= NULL
;
14768 dictionary_files
= scan_directory (filename
);
14770 if (dictionary_files
!= NULL
)
14772 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14774 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14776 char *l1_filename
= dictionary_files
[d
];
14778 struct stat l1_stat
;
14780 if (stat (l1_filename
, &l1_stat
) == -1)
14782 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14787 if (S_ISREG (l1_stat
.st_mode
))
14789 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14793 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14798 local_free (dictionary_files
);
14804 log_error ("ERROR: No usable dictionary file found.");
14813 uint mask_min
= increment_min
; // we can't reject smaller masks here
14814 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14816 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14818 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14820 if (cur_mask
== NULL
) break;
14822 masks
[maskcnt
] = cur_mask
;
14826 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14831 data
.pw_min
= pw_min
;
14832 data
.pw_max
= pw_max
;
14838 if (weak_hash_threshold
>= salts_cnt
)
14840 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14842 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14844 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14848 // Display hack, guarantee that there is at least one \r before real start
14850 if (data
.quiet
== 0) log_info_nn ("");
14853 * status and monitor threads
14856 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14858 hc_thread_t i_thread
= 0;
14860 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14862 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14865 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14867 uint ni_threads_cnt
= 0;
14869 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14871 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14881 if (outfile_check_timer
!= 0)
14883 if (data
.outfile_check_directory
!= NULL
)
14885 if ((hash_mode
!= 5200) &&
14886 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14887 (hash_mode
!= 9000))
14889 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14895 outfile_check_timer
= 0;
14900 outfile_check_timer
= 0;
14906 * Inform the user if we got some hashes remove because of the pot file remove feature
14909 if (data
.quiet
== 0)
14911 if (potfile_remove_cracks
> 0)
14913 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14914 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14918 data
.outfile_check_timer
= outfile_check_timer
;
14924 char **induction_dictionaries
= NULL
;
14926 int induction_dictionaries_cnt
= 0;
14928 hcstat_table_t
*root_table_buf
= NULL
;
14929 hcstat_table_t
*markov_table_buf
= NULL
;
14931 uint initial_restore_done
= 0;
14933 data
.maskcnt
= maskcnt
;
14935 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14937 if (data
.devices_status
== STATUS_CRACKED
) break;
14939 data
.devices_status
= STATUS_INIT
;
14941 if (maskpos
> rd
->maskpos
)
14946 rd
->maskpos
= maskpos
;
14947 data
.maskpos
= maskpos
;
14949 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14951 char *mask
= masks
[maskpos
];
14953 if (mask_from_file
== 1)
14955 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14960 uint mask_offset
= 0;
14962 uint separator_cnt
;
14964 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14966 str_ptr
= strstr (mask
+ mask_offset
, ",");
14968 if (str_ptr
== NULL
) break;
14970 str_pos
= str_ptr
- mask
;
14972 // escaped separator, i.e. "\,"
14976 if (mask
[str_pos
- 1] == '\\')
14980 mask_offset
= str_pos
+ 1;
14986 // reset the offset
14990 mask
[str_pos
] = '\0';
14992 switch (separator_cnt
)
14995 mp_reset_usr (mp_usr
, 0);
14997 custom_charset_1
= mask
;
14998 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
15002 mp_reset_usr (mp_usr
, 1);
15004 custom_charset_2
= mask
;
15005 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
15009 mp_reset_usr (mp_usr
, 2);
15011 custom_charset_3
= mask
;
15012 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
15016 mp_reset_usr (mp_usr
, 3);
15018 custom_charset_4
= mask
;
15019 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
15023 mask
= mask
+ str_pos
+ 1;
15027 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15031 local_free (css_buf
);
15032 local_free (data
.root_css_buf
);
15033 local_free (data
.markov_css_buf
);
15035 local_free (masks
[maskpos
- 1]);
15038 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15041 data
.css_cnt
= css_cnt
;
15042 data
.css_buf
= css_buf
;
15044 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15046 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15048 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15050 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15051 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15053 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15055 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15057 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15058 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15060 data
.root_css_buf
= root_css_buf
;
15061 data
.markov_css_buf
= markov_css_buf
;
15063 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15065 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15067 local_free (root_table_buf
);
15068 local_free (markov_table_buf
);
15072 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15074 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15076 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
15077 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
15078 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
15080 device_param
->kernel_params_mp_buf64
[3] = 0;
15081 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
15082 device_param
->kernel_params_mp_buf32
[5] = 0;
15083 device_param
->kernel_params_mp_buf32
[6] = 0;
15084 device_param
->kernel_params_mp_buf32
[7] = 0;
15086 if (attack_mode
== ATTACK_MODE_HYBRID1
)
15088 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
15089 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
15090 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
15091 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
15093 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15095 device_param
->kernel_params_mp_buf32
[5] = 0;
15096 device_param
->kernel_params_mp_buf32
[6] = 0;
15097 device_param
->kernel_params_mp_buf32
[7] = 0;
15100 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
15101 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
15102 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
15104 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
15105 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
15108 else if (attack_mode
== ATTACK_MODE_BF
)
15110 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
15114 for (uint i
= 0; i
< dictcnt
; i
++)
15116 local_free (dictfiles
[i
]);
15119 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
15121 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
15123 if (l1_filename
== NULL
) break;
15127 dictfiles
[dictcnt
- 1] = l1_filename
;
15134 dictfiles
[dictcnt
- 1] = mask
;
15139 log_error ("ERROR: Mask is too small");
15146 free (induction_dictionaries
);
15148 // induction_dictionaries_cnt = 0; // implied
15150 if (attack_mode
!= ATTACK_MODE_BF
)
15154 induction_dictionaries
= scan_directory (induction_directory
);
15156 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15160 if (induction_dictionaries_cnt
)
15162 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15166 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15170 if ((maskcnt
> 1) || (dictcnt
> 1))
15172 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15178 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15180 char *subid
= logfile_generate_subid ();
15182 data
.subid
= subid
;
15184 logfile_sub_msg ("START");
15186 data
.devices_status
= STATUS_INIT
;
15188 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15189 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15190 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15192 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15196 data
.cpt_start
= time (NULL
);
15198 data
.cpt_total
= 0;
15200 if (data
.restore
== 0)
15202 rd
->words_cur
= skip
;
15209 data
.ms_paused
= 0;
15211 data
.words_cur
= rd
->words_cur
;
15213 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15215 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15217 device_param
->speed_pos
= 0;
15219 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15220 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15221 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15223 device_param
->gpu_power
= device_param
->gpu_power_user
;
15224 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15226 device_param
->outerloop_pos
= 0;
15227 device_param
->outerloop_left
= 0;
15228 device_param
->innerloop_pos
= 0;
15229 device_param
->innerloop_left
= 0;
15231 // some more resets:
15233 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15235 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15237 device_param
->pw_cnt
= 0;
15238 device_param
->pws_cnt
= 0;
15240 device_param
->words_off
= 0;
15241 device_param
->words_done
= 0;
15244 data
.gpu_blocks_div
= 0;
15246 // figure out some workload
15248 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15250 if (data
.wordlist_mode
== WL_MODE_FILE
)
15252 char *dictfile
= NULL
;
15254 if (induction_dictionaries_cnt
)
15256 dictfile
= induction_dictionaries
[0];
15260 dictfile
= dictfiles
[dictpos
];
15263 data
.dictfile
= dictfile
;
15265 logfile_sub_string (dictfile
);
15267 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15269 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15272 FILE *fd2
= fopen (dictfile
, "rb");
15276 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15281 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15285 if (data
.words_cnt
== 0)
15287 if (data
.devices_status
== STATUS_CRACKED
) break;
15288 if (data
.devices_status
== STATUS_ABORTED
) break;
15296 else if (attack_mode
== ATTACK_MODE_COMBI
)
15298 char *dictfile
= data
.dictfile
;
15299 char *dictfile2
= data
.dictfile2
;
15301 logfile_sub_string (dictfile
);
15302 logfile_sub_string (dictfile2
);
15304 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15306 FILE *fd2
= fopen (dictfile
, "rb");
15310 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15315 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15319 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15321 FILE *fd2
= fopen (dictfile2
, "rb");
15325 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15330 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15335 if (data
.words_cnt
== 0)
15337 if (data
.devices_status
== STATUS_CRACKED
) break;
15338 if (data
.devices_status
== STATUS_ABORTED
) break;
15345 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15347 char *dictfile
= NULL
;
15349 if (induction_dictionaries_cnt
)
15351 dictfile
= induction_dictionaries
[0];
15355 dictfile
= dictfiles
[dictpos
];
15358 data
.dictfile
= dictfile
;
15360 char *mask
= data
.mask
;
15362 logfile_sub_string (dictfile
);
15363 logfile_sub_string (mask
);
15365 FILE *fd2
= fopen (dictfile
, "rb");
15369 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15374 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15378 if (data
.words_cnt
== 0)
15380 if (data
.devices_status
== STATUS_CRACKED
) break;
15381 if (data
.devices_status
== STATUS_ABORTED
) break;
15388 else if (attack_mode
== ATTACK_MODE_BF
)
15390 local_free (css_buf
);
15391 local_free (data
.root_css_buf
);
15392 local_free (data
.markov_css_buf
);
15394 char *mask
= dictfiles
[dictpos
];
15396 logfile_sub_string (mask
);
15400 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15402 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15404 uint css_cnt_unicode
= css_cnt
* 2;
15406 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15408 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15410 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15412 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15413 css_buf_unicode
[j
+ 1].cs_len
= 1;
15418 css_buf
= css_buf_unicode
;
15419 css_cnt
= css_cnt_unicode
;
15422 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15424 uint mask_min
= pw_min
;
15425 uint mask_max
= pw_max
;
15427 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15433 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15435 if (css_cnt
< mask_min
)
15437 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15440 if (css_cnt
> mask_max
)
15442 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15445 // skip to next mask
15449 rd
->dictpos
= dictpos
;
15451 logfile_sub_msg ("STOP");
15456 uint save_css_cnt
= css_cnt
;
15458 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15460 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15462 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15463 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15465 uint css_cnt_salt
= css_cnt
+ salt_len
;
15467 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15469 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15471 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15473 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15474 css_buf_salt
[j
].cs_len
= 1;
15479 css_buf
= css_buf_salt
;
15480 css_cnt
= css_cnt_salt
;
15485 data
.css_cnt
= css_cnt
;
15486 data
.css_buf
= css_buf
;
15488 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15490 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15492 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15494 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15496 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15497 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15499 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15501 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15503 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15504 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15506 data
.root_css_buf
= root_css_buf
;
15507 data
.markov_css_buf
= markov_css_buf
;
15509 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15511 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15513 local_free (root_table_buf
);
15514 local_free (markov_table_buf
);
15518 uint css_cnt_l
= css_cnt
;
15521 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15523 if (save_css_cnt
< 6)
15527 else if (save_css_cnt
== 6)
15533 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15535 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15546 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15561 /* unfinished code?
15562 int sum = css_buf[css_cnt_r - 1].cs_len;
15564 for (uint i = 1; i < 4 && i < css_cnt; i++)
15566 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15570 sum *= css_buf[css_cnt_r - 1].cs_len;
15575 css_cnt_l
-= css_cnt_r
;
15577 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15579 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15581 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15583 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15584 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15585 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15587 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15588 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15589 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15590 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15591 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15592 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15594 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15595 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15596 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15597 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15599 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15600 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15601 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15603 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15604 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15605 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15606 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15607 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15609 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp_l
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_l
[i
]);
15610 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp_l
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_l
[i
]);
15611 for (uint i
= 4; i
< 9; i
++) hc_clSetKernelArg (device_param
->kernel_mp_l
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_l
[i
]);
15613 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp_r
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp_r
[i
]);
15614 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp_r
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp_r
[i
]);
15615 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp_r
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp_r
[i
]);
15617 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_root_css_buf
, CL_TRUE
, 0, device_param
->size_root_css
, root_css_buf
, 0, NULL
, NULL
);
15618 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_markov_css_buf
, CL_TRUE
, 0, device_param
->size_markov_css
, markov_css_buf
, 0, NULL
, NULL
);
15622 uint64_t words_base
= data
.words_cnt
;
15624 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15626 if (data
.gpu_rules_cnt
)
15628 words_base
/= data
.gpu_rules_cnt
;
15631 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15633 if (data
.combs_cnt
)
15635 words_base
/= data
.combs_cnt
;
15638 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15642 words_base
/= data
.bfs_cnt
;
15646 data
.words_base
= words_base
;
15650 log_info ("%llu", (unsigned long long int) words_base
);
15655 if (data
.words_cur
> data
.words_base
)
15657 log_error ("ERROR: restore value greater keyspace");
15662 if (data
.words_cur
)
15664 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15666 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15668 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15671 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15673 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15675 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15678 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15680 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15682 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15688 * Inform user about possible slow speeds
15691 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15693 if (data
.words_base
< gpu_blocks_all
)
15698 log_info ("ATTENTION!");
15699 log_info (" The wordlist or mask you are using is too small.");
15700 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15701 log_info (" The cracking speed will drop.");
15702 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15709 * Update loopback file
15718 uint random_num
= get_random_num (0, 9999);
15720 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15722 data
.loopback_file
= loopback_file
;
15726 * Update dictionary statistic
15731 dictstat_fp
= fopen (dictstat
, "wb");
15735 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15737 fclose (dictstat_fp
);
15741 data
.devices_status
= STATUS_RUNNING
;
15743 if (initial_restore_done
== 0)
15745 if (data
.restore_disable
== 0) cycle_restore ();
15747 initial_restore_done
= 1;
15750 hc_timer_set (&data
.timer_running
);
15752 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15754 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15756 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15757 if (quiet
== 0) fflush (stdout
);
15760 else if (wordlist_mode
== WL_MODE_STDIN
)
15762 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15763 if (data
.quiet
== 0) log_info ("");
15766 time_t runtime_start
;
15768 time (&runtime_start
);
15770 data
.runtime_start
= runtime_start
;
15773 * create cracker threads
15776 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15778 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15780 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15782 device_param
->device_id
= device_id
;
15784 if (wordlist_mode
== WL_MODE_STDIN
)
15786 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15790 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15794 // wait for crack threads to exit
15796 hc_thread_wait (devices_cnt
, c_threads
);
15798 local_free (c_threads
);
15804 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15806 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15808 if (data
.devices_status
== STATUS_CRACKED
) break;
15809 if (data
.devices_status
== STATUS_ABORTED
) break;
15811 if (data
.devices_status
== STATUS_BYPASS
)
15813 data
.devices_status
= STATUS_RUNNING
;
15816 if (induction_dictionaries_cnt
)
15818 unlink (induction_dictionaries
[0]);
15821 free (induction_dictionaries
);
15823 if (attack_mode
!= ATTACK_MODE_BF
)
15825 induction_dictionaries
= scan_directory (induction_directory
);
15827 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15830 if (benchmark
== 0)
15832 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15834 if (quiet
== 0) clear_prompt ();
15836 if (quiet
== 0) log_info ("");
15844 if (quiet
== 0) status_display ();
15847 if (quiet
== 0) log_info ("");
15851 if (attack_mode
== ATTACK_MODE_BF
)
15855 rd
->dictpos
= dictpos
;
15859 if (induction_dictionaries_cnt
)
15861 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15867 rd
->dictpos
= dictpos
;
15871 time_t runtime_stop
;
15873 time (&runtime_stop
);
15875 data
.runtime_stop
= runtime_stop
;
15877 logfile_sub_uint (runtime_start
);
15878 logfile_sub_uint (runtime_stop
);
15880 logfile_sub_msg ("STOP");
15882 global_free (subid
);
15885 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15887 if (data
.devices_status
== STATUS_CRACKED
) break;
15888 if (data
.devices_status
== STATUS_ABORTED
) break;
15889 if (data
.devices_status
== STATUS_QUIT
) break;
15891 if (data
.devices_status
== STATUS_BYPASS
)
15893 data
.devices_status
= STATUS_RUNNING
;
15897 // 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
15899 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15901 if (data
.wordlist_mode
== WL_MODE_FILE
)
15903 if (data
.dictfile
== NULL
)
15905 if (dictfiles
!= NULL
)
15907 data
.dictfile
= dictfiles
[0];
15909 hc_timer_set (&data
.timer_running
);
15914 // NOTE: combi is okay because it is already set beforehand
15915 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15917 if (data
.dictfile
== NULL
)
15919 if (dictfiles
!= NULL
)
15921 hc_timer_set (&data
.timer_running
);
15923 data
.dictfile
= dictfiles
[0];
15927 else if (attack_mode
== ATTACK_MODE_BF
)
15929 if (data
.mask
== NULL
)
15931 hc_timer_set (&data
.timer_running
);
15933 data
.mask
= masks
[0];
15937 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15939 data
.devices_status
= STATUS_EXHAUSTED
;
15942 // if cracked / aborted remove last induction dictionary
15944 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15946 struct stat induct_stat
;
15948 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15950 unlink (induction_dictionaries
[file_pos
]);
15954 // wait for non-interactive threads
15956 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15958 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15961 local_free (ni_threads
);
15963 // wait for interactive threads
15965 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15967 hc_thread_wait (1, &i_thread
);
15970 // we dont need restore file anymore
15971 if (data
.restore_disable
== 0)
15973 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15975 unlink (eff_restore_file
);
15976 unlink (new_restore_file
);
15984 // finally save left hashes
15986 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15995 if (benchmark
== 1)
15997 status_benchmark ();
16003 if (quiet
== 0) clear_prompt ();
16005 if (quiet
== 0) log_info ("");
16013 if (quiet
== 0) status_display ();
16016 if (quiet
== 0) log_info ("");
16019 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
16021 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16023 local_free (device_param
->result
);
16025 local_free (device_param
->pw_caches
);
16027 local_free (device_param
->combs_buf
);
16029 local_free (device_param
->hooks_buf
);
16031 local_free (device_param
->device_name
);
16033 local_free (device_param
->device_version
);
16035 local_free (device_param
->driver_version
);
16037 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
16038 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
16039 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
16040 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
16041 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
16042 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
16043 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
16044 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
16045 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
16046 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
16047 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
16048 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
16049 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
16050 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
16051 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
16052 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
16053 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
16054 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
16055 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
16056 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
16057 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
16058 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
16059 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
16060 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
16061 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
16062 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
16063 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
16064 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
16065 if (device_param
->d_tm_c
) hc_clReleaseMemObject (device_param
->d_tm_c
);
16067 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
16068 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
16069 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
16070 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
16071 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
16072 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
16073 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
16074 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
16075 if (device_param
->kernel_tb
) hc_clReleaseKernel (device_param
->kernel_tb
);
16076 if (device_param
->kernel_tm
) hc_clReleaseKernel (device_param
->kernel_tm
);
16077 if (device_param
->kernel_amp
) hc_clReleaseKernel (device_param
->kernel_amp
);
16079 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
16080 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
16081 if (device_param
->program_amp
) hc_clReleaseProgram (device_param
->program_amp
);
16082 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
16083 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
16086 // reset default fan speed
16088 if (gpu_temp_disable
== 0)
16090 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
16092 hc_thread_mutex_lock (mux_adl
);
16094 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16096 if (data
.hm_device
[i
].fan_supported
== 1)
16098 int fanspeed
= temp_retain_fanspeed_value
[i
];
16100 if (fanspeed
== -1) continue;
16102 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
16104 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
16108 hc_thread_mutex_unlock (mux_adl
);
16112 // reset power tuning
16114 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
16116 hc_thread_mutex_lock (mux_adl
);
16118 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16120 if (data
.hm_device
[i
].od_version
== 6)
16122 // check powertune capabilities first, if not available then skip device
16124 int powertune_supported
= 0;
16126 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
16128 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
16133 if (powertune_supported
!= 0)
16135 // powercontrol settings
16137 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
16139 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16146 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
16148 performance_state
->iNumberOfPerformanceLevels
= 2;
16150 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
16151 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
16152 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
16153 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
16155 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
16157 log_info ("ERROR: Failed to restore ADL performance state");
16162 local_free (performance_state
);
16167 hc_thread_mutex_unlock (mux_adl
);
16170 if (gpu_temp_disable
== 0)
16172 if (vendor_id
== VENDOR_ID_NV
)
16175 hc_NVML_nvmlShutdown (data
.hm_dll
);
16183 if (vendor_id
== VENDOR_ID_AMD
)
16185 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
16187 hm_close (data
.hm_dll
);
16191 if (vendor_id
== VENDOR_ID_NV
)
16193 hm_close (data
.hm_dll
);
16200 local_free (masks
);
16202 local_free (dictstat_base
);
16204 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16206 pot_t
*pot_ptr
= &pot
[pot_pos
];
16208 hash_t
*hash
= &pot_ptr
->hash
;
16210 local_free (hash
->digest
);
16214 local_free (hash
->salt
);
16220 local_free (all_gpu_rules_cnt
);
16221 local_free (all_gpu_rules_buf
);
16223 local_free (wl_data
->buf
);
16224 local_free (wl_data
);
16226 local_free (bitmap_s1_a
);
16227 local_free (bitmap_s1_b
);
16228 local_free (bitmap_s1_c
);
16229 local_free (bitmap_s1_d
);
16230 local_free (bitmap_s2_a
);
16231 local_free (bitmap_s2_b
);
16232 local_free (bitmap_s2_c
);
16233 local_free (bitmap_s2_d
);
16235 local_free (temp_retain_fanspeed_value
);
16236 local_free (od_clock_mem_status
);
16237 local_free (od_power_control_status
);
16239 global_free (devices_param
);
16241 global_free (gpu_rules_buf
);
16243 global_free (root_css_buf
);
16244 global_free (markov_css_buf
);
16246 global_free (digests_buf
);
16247 global_free (digests_shown
);
16248 global_free (digests_shown_tmp
);
16250 global_free (salts_buf
);
16251 global_free (salts_shown
);
16253 global_free (esalts_buf
);
16255 global_free (words_progress_done
);
16256 global_free (words_progress_rejected
);
16257 global_free (words_progress_restored
);
16259 if (pot_fp
) fclose (pot_fp
);
16261 if (data
.devices_status
== STATUS_QUIT
) break;
16264 // destroy others mutex
16266 hc_thread_mutex_delete (mux_dispatcher
);
16267 hc_thread_mutex_delete (mux_counter
);
16268 hc_thread_mutex_delete (mux_display
);
16269 hc_thread_mutex_delete (mux_adl
);
16273 local_free (eff_restore_file
);
16274 local_free (new_restore_file
);
16280 local_free (loopback_file
);
16282 if (loopback
== 1) unlink (loopback_file
);
16284 // induction directory
16286 if (induction_dir
== NULL
)
16288 if (attack_mode
!= ATTACK_MODE_BF
)
16290 if (rmdir (induction_directory
) == -1)
16292 if (errno
== ENOENT
)
16294 // good, we can ignore
16296 else if (errno
== ENOTEMPTY
)
16298 // good, we can ignore
16302 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16308 local_free (induction_directory
);
16312 // outfile-check directory
16314 if (outfile_check_dir
== NULL
)
16316 if (rmdir (outfile_check_directory
) == -1)
16318 if (errno
== ENOENT
)
16320 // good, we can ignore
16322 else if (errno
== ENOTEMPTY
)
16324 // good, we can ignore
16328 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16334 local_free (outfile_check_directory
);
16341 logfile_top_uint (proc_start
);
16342 logfile_top_uint (proc_stop
);
16344 logfile_top_msg ("STOP");
16346 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16347 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16349 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16350 if (data
.devices_status
== STATUS_QUIT
) return 2;
16351 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16352 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16353 if (data
.devices_status
== STATUS_CRACKED
) return 0;