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 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 *shared_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", shared_dir
, (int) kern_type
);
1603 else if (attack_kern
== ATTACK_KERN_COMBI
)
1604 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", shared_dir
, (int) kern_type
);
1605 else if (attack_kern
== ATTACK_KERN_BF
)
1606 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", shared_dir
, (int) kern_type
);
1609 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", shared_dir
, (int) kern_type
);
1612 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *profile_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", profile_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", profile_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", profile_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", profile_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 *shared_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", shared_dir
);
1637 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", shared_dir
);
1641 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *profile_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", profile_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", profile_dir
, vendor_id
, device_name
, device_version
, driver_version
, COMPTIME
);
1653 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *shared_dir
, char *source_file
)
1655 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", shared_dir
, attack_kern
);
1658 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *profile_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", profile_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
);
5308 * session needs to be set, always!
5311 if (session
== NULL
) session
= (char *) PROGNAME
;
5314 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
5317 char *exec_path
= get_exec_path ();
5321 char *resolved_install_folder
= realpath (INSTALL_FOLDER
, NULL
);
5322 char *resolved_exec_path
= realpath (exec_path
, NULL
);
5324 char *install_dir
= get_install_dir (resolved_exec_path
);
5325 char *profile_dir
= NULL
;
5326 char *session_dir
= NULL
;
5327 char *shared_dir
= NULL
;
5329 if (strcmp (install_dir
, resolved_install_folder
) == 0)
5331 struct passwd
*pw
= getpwuid (getuid ());
5333 const char *homedir
= pw
->pw_dir
;
5335 profile_dir
= get_profile_dir (homedir
);
5336 session_dir
= get_session_dir (profile_dir
, session
);
5337 shared_dir
= strdup (SHARED_FOLDER
);
5339 mkdir (profile_dir
, 0700);
5340 mkdir (session_dir
, 0700);
5344 profile_dir
= install_dir
;
5345 session_dir
= install_dir
;
5346 shared_dir
= install_dir
;
5349 myfree (resolved_install_folder
);
5350 myfree (resolved_exec_path
);
5354 char *install_dir
= get_install_dir (exec_path
);
5355 char *profile_dir
= install_dir
;
5356 char *session_dir
= install_dir
;
5357 char *shared_dir
= shared_dir
;
5361 data
.install_dir
= install_dir
;
5362 data
.profile_dir
= profile_dir
;
5363 data
.session_dir
= session_dir
;
5364 data
.shared_dir
= shared_dir
;
5372 size_t session_size
= strlen (session_dir
) + 1 + strlen (session
) + 32;
5374 data
.session
= session
;
5376 char *eff_restore_file
= (char *) mymalloc (session_size
);
5377 char *new_restore_file
= (char *) mymalloc (session_size
);
5379 snprintf (eff_restore_file
, session_size
- 1, "%s/%s.restore", data
.session_dir
, session
);
5380 snprintf (new_restore_file
, session_size
- 1, "%s/%s.restore.new", data
.session_dir
, session
);
5382 data
.eff_restore_file
= eff_restore_file
;
5383 data
.new_restore_file
= new_restore_file
;
5385 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5387 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5388 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5393 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5394 if ((show
== 1) || (left
== 1))
5396 restore_disable
= 1;
5401 data
.restore_disable
= restore_disable
;
5403 restore_data_t
*rd
= init_restore (argc
, argv
);
5413 read_restore (eff_restore_file
, rd
);
5415 if (rd
->version_bin
< RESTORE_MIN
)
5417 log_error ("ERROR: Incompatible restore-file version");
5426 rd
->pid
= getpid ();
5428 rd
->pid
= GetCurrentProcessId ();
5432 uint hash_mode_chgd
= 0;
5433 uint runtime_chgd
= 0;
5434 uint gpu_loops_chgd
= 0;
5435 uint gpu_accel_chgd
= 0;
5436 uint attack_mode_chgd
= 0;
5437 uint outfile_format_chgd
= 0;
5438 uint rp_gen_seed_chgd
= 0;
5439 uint remove_timer_chgd
= 0;
5440 uint increment_min_chgd
= 0;
5441 uint increment_max_chgd
= 0;
5442 uint gpu_temp_abort_chgd
= 0;
5443 uint gpu_temp_retain_chgd
= 0;
5449 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5453 //case IDX_HELP: usage = 1; break;
5454 //case IDX_VERSION: version = 1; break;
5455 //case IDX_RESTORE: restore = 1; break;
5456 case IDX_QUIET
: quiet
= 1; break;
5457 //case IDX_SHOW: show = 1; break;
5458 case IDX_SHOW
: break;
5459 //case IDX_LEFT: left = 1; break;
5460 case IDX_LEFT
: break;
5461 case IDX_USERNAME
: username
= 1; break;
5462 case IDX_REMOVE
: remove
= 1; break;
5463 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5464 remove_timer_chgd
= 1; break;
5465 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5466 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5467 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5468 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5469 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5470 case IDX_FORCE
: force
= 1; break;
5471 case IDX_SKIP
: skip
= atoll (optarg
); break;
5472 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5473 case IDX_KEYSPACE
: keyspace
= 1; break;
5474 case IDX_BENCHMARK
: benchmark
= 1; break;
5475 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5476 case IDX_RESTORE
: break;
5477 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5478 case IDX_STATUS
: status
= 1; break;
5479 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5480 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5481 case IDX_LOOPBACK
: loopback
= 1; break;
5482 case IDX_WEAK_HASH_THRESHOLD
:
5483 weak_hash_threshold
= atoi (optarg
); break;
5484 //case IDX_SESSION: session = optarg; break;
5485 case IDX_SESSION
: break;
5486 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5487 hash_mode_chgd
= 1; break;
5488 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5489 runtime_chgd
= 1; break;
5490 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5491 attack_mode_chgd
= 1; break;
5492 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5493 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5494 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5495 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5496 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5497 rp_gen_seed_chgd
= 1; break;
5498 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5499 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5500 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5501 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5502 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5503 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5504 case IDX_OUTFILE
: outfile
= optarg
; break;
5505 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5506 outfile_format_chgd
= 1; break;
5507 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5508 outfile_autohex
= 0; break;
5509 case IDX_OUTFILE_CHECK_TIMER
:
5510 outfile_check_timer
= atoi (optarg
); break;
5511 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5512 case IDX_HEX_SALT
: hex_salt
= 1; break;
5513 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5514 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5515 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5516 case IDX_GPU_PLATFORM
: gpu_platform
= optarg
; break;
5517 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5518 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5519 gpu_accel_chgd
= 1; break;
5520 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5521 gpu_loops_chgd
= 1; break;
5522 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5523 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5524 gpu_temp_abort
= atoi (optarg
); break;
5525 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5526 gpu_temp_retain
= atoi (optarg
); break;
5527 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5528 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5529 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5530 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5531 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5532 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5533 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5534 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5535 case IDX_INCREMENT
: increment
= 1; break;
5536 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5537 increment_min_chgd
= 1; break;
5538 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5539 increment_max_chgd
= 1; break;
5540 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5541 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5542 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5543 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5546 log_error ("ERROR: Invalid argument specified");
5553 log_error ("ERROR: Invalid argument specified");
5559 * Inform user things getting started,
5560 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5561 * - we do not need to check algorithm_pos
5568 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5572 else if (restore
== 1)
5574 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5580 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5590 if (attack_mode
> 7)
5592 log_error ("ERROR: Invalid attack-mode specified");
5597 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5599 log_error ("ERROR: Invalid runtime specified");
5604 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5606 log_error ("ERROR: Invalid hash-type specified");
5611 // renamed hash modes
5625 log_error ("Old -m specified, use -m %d instead", n
);
5633 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5635 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5641 if (outfile_format
> 16)
5643 log_error ("ERROR: Invalid outfile-format specified");
5650 if (outfile_format_chgd
== 1)
5652 if (outfile_format
> 1)
5654 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5661 outfile_format
= OUTFILE_FMT_HASH
;
5667 if (outfile_format_chgd
== 1)
5669 if ((outfile_format
> 7) && (outfile_format
< 16))
5671 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5678 if (increment_min
< INCREMENT_MIN
)
5680 log_error ("ERROR: Invalid increment-min specified");
5685 if (increment_max
> INCREMENT_MAX
)
5687 log_error ("ERROR: Invalid increment-max specified");
5692 if (increment_min
> increment_max
)
5694 log_error ("ERROR: Invalid increment-min specified");
5699 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5701 log_error ("ERROR: increment is not allowed in attack-mode 0");
5706 if ((increment
== 0) && (increment_min_chgd
== 1))
5708 log_error ("ERROR: increment-min is only supported together with increment switch");
5713 if ((increment
== 0) && (increment_max_chgd
== 1))
5715 log_error ("ERROR: increment-max is only supported together with increment switch");
5720 if (rp_files_cnt
&& rp_gen
)
5722 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5727 if (rp_files_cnt
|| rp_gen
)
5729 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5731 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5737 if (rp_gen_func_min
> rp_gen_func_max
)
5739 log_error ("ERROR: Invalid rp-gen-func-min specified");
5744 if (gpu_accel_chgd
== 1)
5746 if (workload_profile
!= WORKLOAD_PROFILE
)
5748 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5755 log_error ("ERROR: Invalid gpu-accel specified");
5760 if (gpu_accel
> 800)
5762 log_error ("ERROR: Invalid gpu-accel specified");
5768 if (gpu_loops_chgd
== 1)
5770 if (workload_profile
!= WORKLOAD_PROFILE
)
5772 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5779 log_error ("ERROR: Invalid gpu-loops specified");
5784 if (gpu_loops
> 1024)
5786 log_error ("ERROR: Invalid gpu-loops specified");
5794 if (workload_profile
!= WORKLOAD_PROFILE
)
5796 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5802 if ((workload_profile
< 1) || (workload_profile
> 3))
5804 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5809 if (show
== 1 || left
== 1)
5811 attack_mode
= ATTACK_MODE_NONE
;
5815 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5820 if (potfile_disable
== 1)
5822 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5828 uint attack_kern
= ATTACK_KERN_NONE
;
5830 switch (attack_mode
)
5832 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5833 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5834 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5835 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5836 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5843 int num_additional_params
= 1;
5845 if (attack_kern
== ATTACK_KERN_COMBI
)
5847 num_additional_params
= 2;
5850 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5852 if (keyspace_wordlist_specified
== 0) optind
--;
5855 if (attack_kern
== ATTACK_KERN_NONE
)
5857 if ((optind
+ 1) != myargc
)
5859 usage_mini_print (myargv
[0]);
5864 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5866 if ((optind
+ 1) > myargc
)
5868 usage_mini_print (myargv
[0]);
5873 else if (attack_kern
== ATTACK_KERN_COMBI
)
5875 if ((optind
+ 3) != myargc
)
5877 usage_mini_print (myargv
[0]);
5882 else if (attack_kern
== ATTACK_KERN_BF
)
5884 if ((optind
+ 1) > myargc
)
5886 usage_mini_print (myargv
[0]);
5893 usage_mini_print (myargv
[0]);
5900 if (myargv
[optind
] != 0)
5902 log_error ("ERROR: Invalid argument for benchmark mode specified");
5907 if (attack_mode_chgd
== 1)
5909 if (attack_mode
!= ATTACK_MODE_BF
)
5911 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5917 if (benchmark_mode
== 0)
5921 else if (benchmark_mode
== 1)
5923 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5925 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5932 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5938 if (skip
!= 0 && limit
!= 0)
5947 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5953 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5958 potfile_disable
= 1;
5960 restore_disable
= 1;
5964 weak_hash_threshold
= 0;
5969 if (remove_timer_chgd
== 1)
5973 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5978 if (remove_timer
< 1)
5980 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5988 if (attack_mode
== ATTACK_MODE_BF
)
5990 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5994 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5996 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5998 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
6007 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
6009 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
6014 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
6016 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
6024 log_error ("ERROR: Invalid debug-mode specified");
6029 if (debug_file
!= NULL
)
6033 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
6039 if (induction_dir
!= NULL
)
6041 if (attack_mode
== ATTACK_MODE_BF
)
6043 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
6050 * induction directory
6053 char *induction_directory
= NULL
;
6055 if (attack_mode
!= ATTACK_MODE_BF
)
6057 if (induction_dir
== NULL
)
6059 induction_directory
= (char *) mymalloc (session_size
);
6061 snprintf (induction_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, INDUCT_DIR
);
6063 // create induction folder if it does not already exist
6067 if (rmdir (induction_directory
) == -1)
6069 if (errno
== ENOENT
)
6071 // good, we can ignore
6073 else if (errno
== ENOTEMPTY
)
6075 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6077 snprintf (induction_directory_mv
, session_size
- 1, "%s/%s.induct.%d", session_dir
, session
, (int) proc_start
);
6079 if (rename (induction_directory
, induction_directory_mv
) != 0)
6081 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6088 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6094 if (mkdir (induction_directory
, 0700) == -1)
6096 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6104 induction_directory
= induction_dir
;
6108 data
.induction_directory
= induction_directory
;
6114 size_t loopback_size
= strlen (session_dir
) + 1 + session_size
+ strlen (LOOPBACK_FILE
) + 12;
6116 char *loopback_file
= (char *) mymalloc (loopback_size
);
6119 * outfile-check directory
6122 char *outfile_check_directory
= NULL
;
6124 if (outfile_check_dir
== NULL
)
6126 outfile_check_directory
= (char *) mymalloc (session_size
);
6128 snprintf (outfile_check_directory
, session_size
- 1, "%s/%s.%s", session_dir
, session
, OUTFILES_DIR
);
6132 outfile_check_directory
= outfile_check_dir
;
6135 data
.outfile_check_directory
= outfile_check_directory
;
6139 struct stat outfile_check_stat
;
6141 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6143 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6147 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6152 else if (outfile_check_dir
== NULL
)
6154 if (mkdir (outfile_check_directory
, 0700) == -1)
6156 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6164 * special other stuff
6167 if (hash_mode
== 9710)
6170 outfile_format_chgd
= 1;
6173 if (hash_mode
== 9810)
6176 outfile_format_chgd
= 1;
6179 if (hash_mode
== 10410)
6182 outfile_format_chgd
= 1;
6189 data
.hash_mode
= hash_mode
;
6190 data
.restore
= restore
;
6191 data
.restore_timer
= restore_timer
;
6192 data
.restore_disable
= restore_disable
;
6193 data
.status
= status
;
6194 data
.status_timer
= status_timer
;
6195 data
.status_automat
= status_automat
;
6196 data
.loopback
= loopback
;
6197 data
.runtime
= runtime
;
6198 data
.remove
= remove
;
6199 data
.remove_timer
= remove_timer
;
6200 data
.debug_mode
= debug_mode
;
6201 data
.debug_file
= debug_file
;
6202 data
.username
= username
;
6204 data
.outfile
= outfile
;
6205 data
.outfile_format
= outfile_format
;
6206 data
.outfile_autohex
= outfile_autohex
;
6207 data
.hex_charset
= hex_charset
;
6208 data
.hex_salt
= hex_salt
;
6209 data
.hex_wordlist
= hex_wordlist
;
6210 data
.separator
= separator
;
6211 data
.rp_files
= rp_files
;
6212 data
.rp_files_cnt
= rp_files_cnt
;
6213 data
.rp_gen
= rp_gen
;
6214 data
.rp_gen_seed
= rp_gen_seed
;
6216 data
.benchmark
= benchmark
;
6219 data
.powertune_enable
= powertune_enable
;
6220 data
.logfile_disable
= logfile_disable
;
6221 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6222 data
.scrypt_tmto
= scrypt_tmto
;
6230 set_cpu_affinity (cpu_affinity
);
6233 if (rp_gen_seed_chgd
== 0)
6239 srand (rp_gen_seed
);
6246 if (logfile_disable
== 0)
6248 size_t logfile_size
= strlen (session
) + 32;
6250 char *logfile
= (char *) mymalloc (logfile_size
);
6252 snprintf (logfile
, logfile_size
- 1, "%s/%s.log", session_dir
, session
);
6254 data
.logfile
= logfile
;
6256 char *topid
= logfile_generate_topid ();
6261 // logfile_append() checks for logfile_disable internally to make it easier from here
6263 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6264 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6265 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6266 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6267 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6268 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6269 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6270 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6271 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6272 #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));
6274 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6275 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6276 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6277 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6278 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6279 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6280 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6281 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6283 logfile_top_msg ("START");
6285 logfile_top_uint (attack_mode
);
6286 logfile_top_uint (attack_kern
);
6287 logfile_top_uint (benchmark
);
6288 logfile_top_uint (benchmark_mode
);
6289 logfile_top_uint (bitmap_min
);
6290 logfile_top_uint (bitmap_max
);
6291 logfile_top_uint (debug_mode
);
6292 logfile_top_uint (force
);
6293 logfile_top_uint (gpu_accel
);
6294 logfile_top_uint (gpu_loops
);
6295 logfile_top_uint (gpu_temp_abort
);
6296 logfile_top_uint (gpu_temp_disable
);
6297 logfile_top_uint (gpu_temp_retain
);
6298 logfile_top_uint (hash_mode
);
6299 logfile_top_uint (hex_charset
);
6300 logfile_top_uint (hex_salt
);
6301 logfile_top_uint (hex_wordlist
);
6302 logfile_top_uint (increment
);
6303 logfile_top_uint (increment_max
);
6304 logfile_top_uint (increment_min
);
6305 logfile_top_uint (keyspace
);
6306 logfile_top_uint (left
);
6307 logfile_top_uint (logfile_disable
);
6308 logfile_top_uint (loopback
);
6309 logfile_top_uint (markov_classic
);
6310 logfile_top_uint (markov_disable
);
6311 logfile_top_uint (markov_threshold
);
6312 logfile_top_uint (outfile_autohex
);
6313 logfile_top_uint (outfile_check_timer
);
6314 logfile_top_uint (outfile_format
);
6315 logfile_top_uint (potfile_disable
);
6316 logfile_top_uint (powertune_enable
);
6317 logfile_top_uint (scrypt_tmto
);
6318 logfile_top_uint (quiet
);
6319 logfile_top_uint (remove
);
6320 logfile_top_uint (remove_timer
);
6321 logfile_top_uint (restore
);
6322 logfile_top_uint (restore_disable
);
6323 logfile_top_uint (restore_timer
);
6324 logfile_top_uint (rp_gen
);
6325 logfile_top_uint (rp_gen_func_max
);
6326 logfile_top_uint (rp_gen_func_min
);
6327 logfile_top_uint (rp_gen_seed
);
6328 logfile_top_uint (runtime
);
6329 logfile_top_uint (segment_size
);
6330 logfile_top_uint (show
);
6331 logfile_top_uint (status
);
6332 logfile_top_uint (status_automat
);
6333 logfile_top_uint (status_timer
);
6334 logfile_top_uint (usage
);
6335 logfile_top_uint (username
);
6336 logfile_top_uint (version
);
6337 logfile_top_uint (weak_hash_threshold
);
6338 logfile_top_uint (workload_profile
);
6339 logfile_top_uint64 (limit
);
6340 logfile_top_uint64 (skip
);
6341 logfile_top_char (separator
);
6342 logfile_top_string (cpu_affinity
);
6343 logfile_top_string (custom_charset_1
);
6344 logfile_top_string (custom_charset_2
);
6345 logfile_top_string (custom_charset_3
);
6346 logfile_top_string (custom_charset_4
);
6347 logfile_top_string (debug_file
);
6348 logfile_top_string (gpu_devices
);
6349 logfile_top_string (gpu_platform
);
6350 logfile_top_string (induction_dir
);
6351 logfile_top_string (markov_hcstat
);
6352 logfile_top_string (outfile
);
6353 logfile_top_string (outfile_check_dir
);
6354 logfile_top_string (rule_buf_l
);
6355 logfile_top_string (rule_buf_r
);
6356 logfile_top_string (session
);
6357 logfile_top_string (truecrypt_keyfiles
);
6363 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6372 * disable useless stuff for benchmark
6377 restore_disable
= 1;
6378 potfile_disable
= 1;
6379 weak_hash_threshold
= 0;
6381 data
.restore_timer
= restore_timer
;
6382 data
.status_timer
= status_timer
;
6383 data
.restore_disable
= restore_disable
;
6385 if (benchmark_mode
== 1)
6391 * force attack mode to be bruteforce
6394 attack_mode
= ATTACK_MODE_BF
;
6395 attack_kern
= ATTACK_KERN_BF
;
6397 if (runtime_chgd
== 0)
6401 if (benchmark_mode
== 1) runtime
= 17;
6403 data
.runtime
= runtime
;
6413 uint attack_exec
= 0;
6417 uint esalt_size
= 0;
6419 uint dgst_pos0
= -1;
6420 uint dgst_pos1
= -1;
6421 uint dgst_pos2
= -1;
6422 uint dgst_pos3
= -1;
6424 int (*parse_func
) (char *, uint
, hash_t
*);
6425 int (*sort_by_digest
) (const void *, const void *);
6427 uint algorithm_pos
= 0;
6428 uint algorithm_max
= 1;
6430 uint
*algorithms
= default_benchmark_algorithms
;
6432 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6434 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6437 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6438 * the following algos are skipped entirely
6441 if (algorithm_pos
> 0)
6445 rd
= init_restore (argc
, argv
);
6451 * update hash_mode in case of multihash benchmark
6456 if (hash_mode_chgd
== 0)
6458 hash_mode
= algorithms
[algorithm_pos
];
6460 data
.hash_mode
= hash_mode
;
6470 case 0: hash_type
= HASH_TYPE_MD5
;
6471 salt_type
= SALT_TYPE_NONE
;
6472 attack_exec
= ATTACK_EXEC_ON_GPU
;
6473 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6474 | OPTS_TYPE_PT_ADD80
6475 | OPTS_TYPE_PT_ADDBITS14
;
6476 kern_type
= KERN_TYPE_MD5
;
6477 dgst_size
= DGST_SIZE_4_4
;
6478 parse_func
= md5_parse_hash
;
6479 sort_by_digest
= sort_by_digest_4_4
;
6480 opti_type
= OPTI_TYPE_ZERO_BYTE
6481 | OPTI_TYPE_PRECOMPUTE_INIT
6482 | OPTI_TYPE_PRECOMPUTE_MERKLE
6483 | OPTI_TYPE_MEET_IN_MIDDLE
6484 | OPTI_TYPE_EARLY_SKIP
6485 | OPTI_TYPE_NOT_ITERATED
6486 | OPTI_TYPE_NOT_SALTED
6487 | OPTI_TYPE_RAW_HASH
;
6494 case 10: hash_type
= HASH_TYPE_MD5
;
6495 salt_type
= SALT_TYPE_INTERN
;
6496 attack_exec
= ATTACK_EXEC_ON_GPU
;
6497 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6498 | OPTS_TYPE_ST_ADD80
6499 | OPTS_TYPE_ST_ADDBITS14
;
6500 kern_type
= KERN_TYPE_MD5_PWSLT
;
6501 dgst_size
= DGST_SIZE_4_4
;
6502 parse_func
= md5s_parse_hash
;
6503 sort_by_digest
= sort_by_digest_4_4
;
6504 opti_type
= OPTI_TYPE_ZERO_BYTE
6505 | OPTI_TYPE_PRECOMPUTE_INIT
6506 | OPTI_TYPE_PRECOMPUTE_MERKLE
6507 | OPTI_TYPE_MEET_IN_MIDDLE
6508 | OPTI_TYPE_EARLY_SKIP
6509 | OPTI_TYPE_NOT_ITERATED
6510 | OPTI_TYPE_APPENDED_SALT
6511 | OPTI_TYPE_RAW_HASH
;
6518 case 11: hash_type
= HASH_TYPE_MD5
;
6519 salt_type
= SALT_TYPE_INTERN
;
6520 attack_exec
= ATTACK_EXEC_ON_GPU
;
6521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6522 | OPTS_TYPE_ST_ADD80
6523 | OPTS_TYPE_ST_ADDBITS14
;
6524 kern_type
= KERN_TYPE_MD5_PWSLT
;
6525 dgst_size
= DGST_SIZE_4_4
;
6526 parse_func
= joomla_parse_hash
;
6527 sort_by_digest
= sort_by_digest_4_4
;
6528 opti_type
= OPTI_TYPE_ZERO_BYTE
6529 | OPTI_TYPE_PRECOMPUTE_INIT
6530 | OPTI_TYPE_PRECOMPUTE_MERKLE
6531 | OPTI_TYPE_MEET_IN_MIDDLE
6532 | OPTI_TYPE_EARLY_SKIP
6533 | OPTI_TYPE_NOT_ITERATED
6534 | OPTI_TYPE_APPENDED_SALT
6535 | OPTI_TYPE_RAW_HASH
;
6542 case 12: hash_type
= HASH_TYPE_MD5
;
6543 salt_type
= SALT_TYPE_INTERN
;
6544 attack_exec
= ATTACK_EXEC_ON_GPU
;
6545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6546 | OPTS_TYPE_ST_ADD80
6547 | OPTS_TYPE_ST_ADDBITS14
;
6548 kern_type
= KERN_TYPE_MD5_PWSLT
;
6549 dgst_size
= DGST_SIZE_4_4
;
6550 parse_func
= postgresql_parse_hash
;
6551 sort_by_digest
= sort_by_digest_4_4
;
6552 opti_type
= OPTI_TYPE_ZERO_BYTE
6553 | OPTI_TYPE_PRECOMPUTE_INIT
6554 | OPTI_TYPE_PRECOMPUTE_MERKLE
6555 | OPTI_TYPE_MEET_IN_MIDDLE
6556 | OPTI_TYPE_EARLY_SKIP
6557 | OPTI_TYPE_NOT_ITERATED
6558 | OPTI_TYPE_APPENDED_SALT
6559 | OPTI_TYPE_RAW_HASH
;
6566 case 20: hash_type
= HASH_TYPE_MD5
;
6567 salt_type
= SALT_TYPE_INTERN
;
6568 attack_exec
= ATTACK_EXEC_ON_GPU
;
6569 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6570 | OPTS_TYPE_PT_ADD80
6571 | OPTS_TYPE_PT_ADDBITS14
;
6572 kern_type
= KERN_TYPE_MD5_SLTPW
;
6573 dgst_size
= DGST_SIZE_4_4
;
6574 parse_func
= md5s_parse_hash
;
6575 sort_by_digest
= sort_by_digest_4_4
;
6576 opti_type
= OPTI_TYPE_ZERO_BYTE
6577 | OPTI_TYPE_PRECOMPUTE_INIT
6578 | OPTI_TYPE_PRECOMPUTE_MERKLE
6579 | OPTI_TYPE_EARLY_SKIP
6580 | OPTI_TYPE_NOT_ITERATED
6581 | OPTI_TYPE_PREPENDED_SALT
6582 | OPTI_TYPE_RAW_HASH
;
6589 case 21: hash_type
= HASH_TYPE_MD5
;
6590 salt_type
= SALT_TYPE_INTERN
;
6591 attack_exec
= ATTACK_EXEC_ON_GPU
;
6592 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6593 | OPTS_TYPE_PT_ADD80
6594 | OPTS_TYPE_PT_ADDBITS14
;
6595 kern_type
= KERN_TYPE_MD5_SLTPW
;
6596 dgst_size
= DGST_SIZE_4_4
;
6597 parse_func
= osc_parse_hash
;
6598 sort_by_digest
= sort_by_digest_4_4
;
6599 opti_type
= OPTI_TYPE_ZERO_BYTE
6600 | OPTI_TYPE_PRECOMPUTE_INIT
6601 | OPTI_TYPE_PRECOMPUTE_MERKLE
6602 | OPTI_TYPE_EARLY_SKIP
6603 | OPTI_TYPE_NOT_ITERATED
6604 | OPTI_TYPE_PREPENDED_SALT
6605 | OPTI_TYPE_RAW_HASH
;
6612 case 22: hash_type
= HASH_TYPE_MD5
;
6613 salt_type
= SALT_TYPE_EMBEDDED
;
6614 attack_exec
= ATTACK_EXEC_ON_GPU
;
6615 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6616 | OPTS_TYPE_PT_ADD80
6617 | OPTS_TYPE_PT_ADDBITS14
;
6618 kern_type
= KERN_TYPE_MD5_SLTPW
;
6619 dgst_size
= DGST_SIZE_4_4
;
6620 parse_func
= netscreen_parse_hash
;
6621 sort_by_digest
= sort_by_digest_4_4
;
6622 opti_type
= OPTI_TYPE_ZERO_BYTE
6623 | OPTI_TYPE_PRECOMPUTE_INIT
6624 | OPTI_TYPE_PRECOMPUTE_MERKLE
6625 | OPTI_TYPE_EARLY_SKIP
6626 | OPTI_TYPE_NOT_ITERATED
6627 | OPTI_TYPE_PREPENDED_SALT
6628 | OPTI_TYPE_RAW_HASH
;
6635 case 23: hash_type
= HASH_TYPE_MD5
;
6636 salt_type
= SALT_TYPE_EMBEDDED
;
6637 attack_exec
= ATTACK_EXEC_ON_GPU
;
6638 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6639 | OPTS_TYPE_PT_ADD80
6640 | OPTS_TYPE_PT_ADDBITS14
;
6641 kern_type
= KERN_TYPE_MD5_SLTPW
;
6642 dgst_size
= DGST_SIZE_4_4
;
6643 parse_func
= skype_parse_hash
;
6644 sort_by_digest
= sort_by_digest_4_4
;
6645 opti_type
= OPTI_TYPE_ZERO_BYTE
6646 | OPTI_TYPE_PRECOMPUTE_INIT
6647 | OPTI_TYPE_PRECOMPUTE_MERKLE
6648 | OPTI_TYPE_EARLY_SKIP
6649 | OPTI_TYPE_NOT_ITERATED
6650 | OPTI_TYPE_PREPENDED_SALT
6651 | OPTI_TYPE_RAW_HASH
;
6658 case 30: hash_type
= HASH_TYPE_MD5
;
6659 salt_type
= SALT_TYPE_INTERN
;
6660 attack_exec
= ATTACK_EXEC_ON_GPU
;
6661 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6662 | OPTS_TYPE_PT_UNICODE
6663 | OPTS_TYPE_ST_ADD80
6664 | OPTS_TYPE_ST_ADDBITS14
;
6665 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6666 dgst_size
= DGST_SIZE_4_4
;
6667 parse_func
= md5s_parse_hash
;
6668 sort_by_digest
= sort_by_digest_4_4
;
6669 opti_type
= OPTI_TYPE_ZERO_BYTE
6670 | OPTI_TYPE_PRECOMPUTE_INIT
6671 | OPTI_TYPE_PRECOMPUTE_MERKLE
6672 | OPTI_TYPE_MEET_IN_MIDDLE
6673 | OPTI_TYPE_EARLY_SKIP
6674 | OPTI_TYPE_NOT_ITERATED
6675 | OPTI_TYPE_APPENDED_SALT
6676 | OPTI_TYPE_RAW_HASH
;
6683 case 40: hash_type
= HASH_TYPE_MD5
;
6684 salt_type
= SALT_TYPE_INTERN
;
6685 attack_exec
= ATTACK_EXEC_ON_GPU
;
6686 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6687 | OPTS_TYPE_PT_ADD80
6688 | OPTS_TYPE_PT_ADDBITS14
6689 | OPTS_TYPE_PT_UNICODE
;
6690 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6691 dgst_size
= DGST_SIZE_4_4
;
6692 parse_func
= md5s_parse_hash
;
6693 sort_by_digest
= sort_by_digest_4_4
;
6694 opti_type
= OPTI_TYPE_ZERO_BYTE
6695 | OPTI_TYPE_PRECOMPUTE_INIT
6696 | OPTI_TYPE_PRECOMPUTE_MERKLE
6697 | OPTI_TYPE_EARLY_SKIP
6698 | OPTI_TYPE_NOT_ITERATED
6699 | OPTI_TYPE_PREPENDED_SALT
6700 | OPTI_TYPE_RAW_HASH
;
6707 case 50: hash_type
= HASH_TYPE_MD5
;
6708 salt_type
= SALT_TYPE_INTERN
;
6709 attack_exec
= ATTACK_EXEC_ON_GPU
;
6710 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6711 | OPTS_TYPE_ST_ADD80
6712 | OPTS_TYPE_ST_ADDBITS14
;
6713 kern_type
= KERN_TYPE_HMACMD5_PW
;
6714 dgst_size
= DGST_SIZE_4_4
;
6715 parse_func
= hmacmd5_parse_hash
;
6716 sort_by_digest
= sort_by_digest_4_4
;
6717 opti_type
= OPTI_TYPE_ZERO_BYTE
6718 | OPTI_TYPE_NOT_ITERATED
;
6725 case 60: hash_type
= HASH_TYPE_MD5
;
6726 salt_type
= SALT_TYPE_INTERN
;
6727 attack_exec
= ATTACK_EXEC_ON_GPU
;
6728 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6729 | OPTS_TYPE_PT_ADD80
6730 | OPTS_TYPE_PT_ADDBITS14
;
6731 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6732 dgst_size
= DGST_SIZE_4_4
;
6733 parse_func
= hmacmd5_parse_hash
;
6734 sort_by_digest
= sort_by_digest_4_4
;
6735 opti_type
= OPTI_TYPE_ZERO_BYTE
6736 | OPTI_TYPE_NOT_ITERATED
;
6743 case 100: hash_type
= HASH_TYPE_SHA1
;
6744 salt_type
= SALT_TYPE_NONE
;
6745 attack_exec
= ATTACK_EXEC_ON_GPU
;
6746 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6747 | OPTS_TYPE_PT_ADD80
6748 | OPTS_TYPE_PT_ADDBITS15
;
6749 kern_type
= KERN_TYPE_SHA1
;
6750 dgst_size
= DGST_SIZE_4_5
;
6751 parse_func
= sha1_parse_hash
;
6752 sort_by_digest
= sort_by_digest_4_5
;
6753 opti_type
= OPTI_TYPE_ZERO_BYTE
6754 | OPTI_TYPE_PRECOMPUTE_INIT
6755 | OPTI_TYPE_PRECOMPUTE_MERKLE
6756 | OPTI_TYPE_EARLY_SKIP
6757 | OPTI_TYPE_NOT_ITERATED
6758 | OPTI_TYPE_NOT_SALTED
6759 | OPTI_TYPE_RAW_HASH
;
6766 case 101: hash_type
= HASH_TYPE_SHA1
;
6767 salt_type
= SALT_TYPE_NONE
;
6768 attack_exec
= ATTACK_EXEC_ON_GPU
;
6769 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6770 | OPTS_TYPE_PT_ADD80
6771 | OPTS_TYPE_PT_ADDBITS15
;
6772 kern_type
= KERN_TYPE_SHA1
;
6773 dgst_size
= DGST_SIZE_4_5
;
6774 parse_func
= sha1b64_parse_hash
;
6775 sort_by_digest
= sort_by_digest_4_5
;
6776 opti_type
= OPTI_TYPE_ZERO_BYTE
6777 | OPTI_TYPE_PRECOMPUTE_INIT
6778 | OPTI_TYPE_PRECOMPUTE_MERKLE
6779 | OPTI_TYPE_EARLY_SKIP
6780 | OPTI_TYPE_NOT_ITERATED
6781 | OPTI_TYPE_NOT_SALTED
6782 | OPTI_TYPE_RAW_HASH
;
6789 case 110: hash_type
= HASH_TYPE_SHA1
;
6790 salt_type
= SALT_TYPE_INTERN
;
6791 attack_exec
= ATTACK_EXEC_ON_GPU
;
6792 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6793 | OPTS_TYPE_ST_ADD80
6794 | OPTS_TYPE_ST_ADDBITS15
;
6795 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6796 dgst_size
= DGST_SIZE_4_5
;
6797 parse_func
= sha1s_parse_hash
;
6798 sort_by_digest
= sort_by_digest_4_5
;
6799 opti_type
= OPTI_TYPE_ZERO_BYTE
6800 | OPTI_TYPE_PRECOMPUTE_INIT
6801 | OPTI_TYPE_PRECOMPUTE_MERKLE
6802 | OPTI_TYPE_EARLY_SKIP
6803 | OPTI_TYPE_NOT_ITERATED
6804 | OPTI_TYPE_APPENDED_SALT
6805 | OPTI_TYPE_RAW_HASH
;
6812 case 111: hash_type
= HASH_TYPE_SHA1
;
6813 salt_type
= SALT_TYPE_EMBEDDED
;
6814 attack_exec
= ATTACK_EXEC_ON_GPU
;
6815 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6816 | OPTS_TYPE_ST_ADD80
6817 | OPTS_TYPE_ST_ADDBITS15
;
6818 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6819 dgst_size
= DGST_SIZE_4_5
;
6820 parse_func
= sha1b64s_parse_hash
;
6821 sort_by_digest
= sort_by_digest_4_5
;
6822 opti_type
= OPTI_TYPE_ZERO_BYTE
6823 | OPTI_TYPE_PRECOMPUTE_INIT
6824 | OPTI_TYPE_PRECOMPUTE_MERKLE
6825 | OPTI_TYPE_EARLY_SKIP
6826 | OPTI_TYPE_NOT_ITERATED
6827 | OPTI_TYPE_APPENDED_SALT
6828 | OPTI_TYPE_RAW_HASH
;
6835 case 112: hash_type
= HASH_TYPE_SHA1
;
6836 salt_type
= SALT_TYPE_INTERN
;
6837 attack_exec
= ATTACK_EXEC_ON_GPU
;
6838 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6839 | OPTS_TYPE_ST_ADD80
6840 | OPTS_TYPE_ST_ADDBITS15
6842 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6843 dgst_size
= DGST_SIZE_4_5
;
6844 parse_func
= oracles_parse_hash
;
6845 sort_by_digest
= sort_by_digest_4_5
;
6846 opti_type
= OPTI_TYPE_ZERO_BYTE
6847 | OPTI_TYPE_PRECOMPUTE_INIT
6848 | OPTI_TYPE_PRECOMPUTE_MERKLE
6849 | OPTI_TYPE_EARLY_SKIP
6850 | OPTI_TYPE_NOT_ITERATED
6851 | OPTI_TYPE_APPENDED_SALT
6852 | OPTI_TYPE_RAW_HASH
;
6859 case 120: hash_type
= HASH_TYPE_SHA1
;
6860 salt_type
= SALT_TYPE_INTERN
;
6861 attack_exec
= ATTACK_EXEC_ON_GPU
;
6862 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6863 | OPTS_TYPE_PT_ADD80
6864 | OPTS_TYPE_PT_ADDBITS15
;
6865 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6866 dgst_size
= DGST_SIZE_4_5
;
6867 parse_func
= sha1s_parse_hash
;
6868 sort_by_digest
= sort_by_digest_4_5
;
6869 opti_type
= OPTI_TYPE_ZERO_BYTE
6870 | OPTI_TYPE_PRECOMPUTE_INIT
6871 | OPTI_TYPE_PRECOMPUTE_MERKLE
6872 | OPTI_TYPE_EARLY_SKIP
6873 | OPTI_TYPE_NOT_ITERATED
6874 | OPTI_TYPE_PREPENDED_SALT
6875 | OPTI_TYPE_RAW_HASH
;
6882 case 121: hash_type
= HASH_TYPE_SHA1
;
6883 salt_type
= SALT_TYPE_INTERN
;
6884 attack_exec
= ATTACK_EXEC_ON_GPU
;
6885 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6886 | OPTS_TYPE_PT_ADD80
6887 | OPTS_TYPE_PT_ADDBITS15
6888 | OPTS_TYPE_ST_LOWER
;
6889 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6890 dgst_size
= DGST_SIZE_4_5
;
6891 parse_func
= smf_parse_hash
;
6892 sort_by_digest
= sort_by_digest_4_5
;
6893 opti_type
= OPTI_TYPE_ZERO_BYTE
6894 | OPTI_TYPE_PRECOMPUTE_INIT
6895 | OPTI_TYPE_PRECOMPUTE_MERKLE
6896 | OPTI_TYPE_EARLY_SKIP
6897 | OPTI_TYPE_NOT_ITERATED
6898 | OPTI_TYPE_PREPENDED_SALT
6899 | OPTI_TYPE_RAW_HASH
;
6906 case 122: hash_type
= HASH_TYPE_SHA1
;
6907 salt_type
= SALT_TYPE_EMBEDDED
;
6908 attack_exec
= ATTACK_EXEC_ON_GPU
;
6909 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6910 | OPTS_TYPE_PT_ADD80
6911 | OPTS_TYPE_PT_ADDBITS15
6913 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6914 dgst_size
= DGST_SIZE_4_5
;
6915 parse_func
= osx1_parse_hash
;
6916 sort_by_digest
= sort_by_digest_4_5
;
6917 opti_type
= OPTI_TYPE_ZERO_BYTE
6918 | OPTI_TYPE_PRECOMPUTE_INIT
6919 | OPTI_TYPE_PRECOMPUTE_MERKLE
6920 | OPTI_TYPE_EARLY_SKIP
6921 | OPTI_TYPE_NOT_ITERATED
6922 | OPTI_TYPE_PREPENDED_SALT
6923 | OPTI_TYPE_RAW_HASH
;
6930 case 124: hash_type
= HASH_TYPE_SHA1
;
6931 salt_type
= SALT_TYPE_EMBEDDED
;
6932 attack_exec
= ATTACK_EXEC_ON_GPU
;
6933 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6934 | OPTS_TYPE_PT_ADD80
6935 | OPTS_TYPE_PT_ADDBITS15
;
6936 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6937 dgst_size
= DGST_SIZE_4_5
;
6938 parse_func
= djangosha1_parse_hash
;
6939 sort_by_digest
= sort_by_digest_4_5
;
6940 opti_type
= OPTI_TYPE_ZERO_BYTE
6941 | OPTI_TYPE_PRECOMPUTE_INIT
6942 | OPTI_TYPE_PRECOMPUTE_MERKLE
6943 | OPTI_TYPE_EARLY_SKIP
6944 | OPTI_TYPE_NOT_ITERATED
6945 | OPTI_TYPE_PREPENDED_SALT
6946 | OPTI_TYPE_RAW_HASH
;
6953 case 130: hash_type
= HASH_TYPE_SHA1
;
6954 salt_type
= SALT_TYPE_INTERN
;
6955 attack_exec
= ATTACK_EXEC_ON_GPU
;
6956 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6957 | OPTS_TYPE_PT_UNICODE
6958 | OPTS_TYPE_ST_ADD80
6959 | OPTS_TYPE_ST_ADDBITS15
;
6960 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6961 dgst_size
= DGST_SIZE_4_5
;
6962 parse_func
= sha1s_parse_hash
;
6963 sort_by_digest
= sort_by_digest_4_5
;
6964 opti_type
= OPTI_TYPE_ZERO_BYTE
6965 | OPTI_TYPE_PRECOMPUTE_INIT
6966 | OPTI_TYPE_PRECOMPUTE_MERKLE
6967 | OPTI_TYPE_EARLY_SKIP
6968 | OPTI_TYPE_NOT_ITERATED
6969 | OPTI_TYPE_APPENDED_SALT
6970 | OPTI_TYPE_RAW_HASH
;
6977 case 131: hash_type
= HASH_TYPE_SHA1
;
6978 salt_type
= SALT_TYPE_EMBEDDED
;
6979 attack_exec
= ATTACK_EXEC_ON_GPU
;
6980 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6981 | OPTS_TYPE_PT_UNICODE
6982 | OPTS_TYPE_PT_UPPER
6983 | OPTS_TYPE_ST_ADD80
6984 | OPTS_TYPE_ST_ADDBITS15
6986 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6987 dgst_size
= DGST_SIZE_4_5
;
6988 parse_func
= mssql2000_parse_hash
;
6989 sort_by_digest
= sort_by_digest_4_5
;
6990 opti_type
= OPTI_TYPE_ZERO_BYTE
6991 | OPTI_TYPE_PRECOMPUTE_INIT
6992 | OPTI_TYPE_PRECOMPUTE_MERKLE
6993 | OPTI_TYPE_EARLY_SKIP
6994 | OPTI_TYPE_NOT_ITERATED
6995 | OPTI_TYPE_APPENDED_SALT
6996 | OPTI_TYPE_RAW_HASH
;
7003 case 132: hash_type
= HASH_TYPE_SHA1
;
7004 salt_type
= SALT_TYPE_EMBEDDED
;
7005 attack_exec
= ATTACK_EXEC_ON_GPU
;
7006 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7007 | OPTS_TYPE_PT_UNICODE
7008 | OPTS_TYPE_ST_ADD80
7009 | OPTS_TYPE_ST_ADDBITS15
7011 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7012 dgst_size
= DGST_SIZE_4_5
;
7013 parse_func
= mssql2005_parse_hash
;
7014 sort_by_digest
= sort_by_digest_4_5
;
7015 opti_type
= OPTI_TYPE_ZERO_BYTE
7016 | OPTI_TYPE_PRECOMPUTE_INIT
7017 | OPTI_TYPE_PRECOMPUTE_MERKLE
7018 | OPTI_TYPE_EARLY_SKIP
7019 | OPTI_TYPE_NOT_ITERATED
7020 | OPTI_TYPE_APPENDED_SALT
7021 | OPTI_TYPE_RAW_HASH
;
7028 case 133: hash_type
= HASH_TYPE_SHA1
;
7029 salt_type
= SALT_TYPE_EMBEDDED
;
7030 attack_exec
= ATTACK_EXEC_ON_GPU
;
7031 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7032 | OPTS_TYPE_PT_UNICODE
7033 | OPTS_TYPE_ST_ADD80
7034 | OPTS_TYPE_ST_ADDBITS15
;
7035 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7036 dgst_size
= DGST_SIZE_4_5
;
7037 parse_func
= peoplesoft_parse_hash
;
7038 sort_by_digest
= sort_by_digest_4_5
;
7039 opti_type
= OPTI_TYPE_ZERO_BYTE
7040 | OPTI_TYPE_PRECOMPUTE_INIT
7041 | OPTI_TYPE_PRECOMPUTE_MERKLE
7042 | OPTI_TYPE_EARLY_SKIP
7043 | OPTI_TYPE_NOT_ITERATED
7044 | OPTI_TYPE_APPENDED_SALT
7045 | OPTI_TYPE_RAW_HASH
;
7052 case 140: hash_type
= HASH_TYPE_SHA1
;
7053 salt_type
= SALT_TYPE_INTERN
;
7054 attack_exec
= ATTACK_EXEC_ON_GPU
;
7055 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7056 | OPTS_TYPE_PT_ADD80
7057 | OPTS_TYPE_PT_ADDBITS15
7058 | OPTS_TYPE_PT_UNICODE
;
7059 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7060 dgst_size
= DGST_SIZE_4_5
;
7061 parse_func
= sha1s_parse_hash
;
7062 sort_by_digest
= sort_by_digest_4_5
;
7063 opti_type
= OPTI_TYPE_ZERO_BYTE
7064 | OPTI_TYPE_PRECOMPUTE_INIT
7065 | OPTI_TYPE_PRECOMPUTE_MERKLE
7066 | OPTI_TYPE_EARLY_SKIP
7067 | OPTI_TYPE_NOT_ITERATED
7068 | OPTI_TYPE_PREPENDED_SALT
7069 | OPTI_TYPE_RAW_HASH
;
7076 case 141: hash_type
= HASH_TYPE_SHA1
;
7077 salt_type
= SALT_TYPE_EMBEDDED
;
7078 attack_exec
= ATTACK_EXEC_ON_GPU
;
7079 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7080 | OPTS_TYPE_PT_ADD80
7081 | OPTS_TYPE_PT_ADDBITS15
7082 | OPTS_TYPE_PT_UNICODE
7083 | OPTS_TYPE_ST_BASE64
;
7084 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7085 dgst_size
= DGST_SIZE_4_5
;
7086 parse_func
= episerver_parse_hash
;
7087 sort_by_digest
= sort_by_digest_4_5
;
7088 opti_type
= OPTI_TYPE_ZERO_BYTE
7089 | OPTI_TYPE_PRECOMPUTE_INIT
7090 | OPTI_TYPE_PRECOMPUTE_MERKLE
7091 | OPTI_TYPE_EARLY_SKIP
7092 | OPTI_TYPE_NOT_ITERATED
7093 | OPTI_TYPE_PREPENDED_SALT
7094 | OPTI_TYPE_RAW_HASH
;
7101 case 150: hash_type
= HASH_TYPE_SHA1
;
7102 salt_type
= SALT_TYPE_INTERN
;
7103 attack_exec
= ATTACK_EXEC_ON_GPU
;
7104 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7105 | OPTS_TYPE_ST_ADD80
7106 | OPTS_TYPE_ST_ADDBITS15
;
7107 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7108 dgst_size
= DGST_SIZE_4_5
;
7109 parse_func
= hmacsha1_parse_hash
;
7110 sort_by_digest
= sort_by_digest_4_5
;
7111 opti_type
= OPTI_TYPE_ZERO_BYTE
7112 | OPTI_TYPE_NOT_ITERATED
;
7119 case 160: hash_type
= HASH_TYPE_SHA1
;
7120 salt_type
= SALT_TYPE_INTERN
;
7121 attack_exec
= ATTACK_EXEC_ON_GPU
;
7122 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7123 | OPTS_TYPE_PT_ADD80
7124 | OPTS_TYPE_PT_ADDBITS15
;
7125 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7126 dgst_size
= DGST_SIZE_4_5
;
7127 parse_func
= hmacsha1_parse_hash
;
7128 sort_by_digest
= sort_by_digest_4_5
;
7129 opti_type
= OPTI_TYPE_ZERO_BYTE
7130 | OPTI_TYPE_NOT_ITERATED
;
7137 case 190: hash_type
= HASH_TYPE_SHA1
;
7138 salt_type
= SALT_TYPE_NONE
;
7139 attack_exec
= ATTACK_EXEC_ON_GPU
;
7140 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7141 | OPTS_TYPE_PT_ADD80
7142 | OPTS_TYPE_PT_ADDBITS15
;
7143 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7144 dgst_size
= DGST_SIZE_4_5
;
7145 parse_func
= sha1linkedin_parse_hash
;
7146 sort_by_digest
= sort_by_digest_4_5
;
7147 opti_type
= OPTI_TYPE_ZERO_BYTE
7148 | OPTI_TYPE_PRECOMPUTE_INIT
7149 | OPTI_TYPE_EARLY_SKIP
7150 | OPTI_TYPE_NOT_ITERATED
7151 | OPTI_TYPE_NOT_SALTED
;
7158 case 200: hash_type
= HASH_TYPE_MYSQL
;
7159 salt_type
= SALT_TYPE_NONE
;
7160 attack_exec
= ATTACK_EXEC_ON_GPU
;
7162 kern_type
= KERN_TYPE_MYSQL
;
7163 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7164 parse_func
= mysql323_parse_hash
;
7165 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7166 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7173 case 300: hash_type
= HASH_TYPE_SHA1
;
7174 salt_type
= SALT_TYPE_NONE
;
7175 attack_exec
= ATTACK_EXEC_ON_GPU
;
7176 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7177 | OPTS_TYPE_PT_ADD80
7178 | OPTS_TYPE_PT_ADDBITS15
;
7179 kern_type
= KERN_TYPE_MYSQL41
;
7180 dgst_size
= DGST_SIZE_4_5
;
7181 parse_func
= sha1_parse_hash
;
7182 sort_by_digest
= sort_by_digest_4_5
;
7183 opti_type
= OPTI_TYPE_ZERO_BYTE
7184 | OPTI_TYPE_PRECOMPUTE_INIT
7185 | OPTI_TYPE_PRECOMPUTE_MERKLE
7186 | OPTI_TYPE_EARLY_SKIP
7187 | OPTI_TYPE_NOT_ITERATED
7188 | OPTI_TYPE_NOT_SALTED
;
7195 case 400: hash_type
= HASH_TYPE_MD5
;
7196 salt_type
= SALT_TYPE_EMBEDDED
;
7197 attack_exec
= ATTACK_EXEC_ON_CPU
;
7198 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7199 kern_type
= KERN_TYPE_PHPASS
;
7200 dgst_size
= DGST_SIZE_4_4
;
7201 parse_func
= phpass_parse_hash
;
7202 sort_by_digest
= sort_by_digest_4_4
;
7203 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7210 case 500: hash_type
= HASH_TYPE_MD5
;
7211 salt_type
= SALT_TYPE_EMBEDDED
;
7212 attack_exec
= ATTACK_EXEC_ON_CPU
;
7213 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7214 kern_type
= KERN_TYPE_MD5CRYPT
;
7215 dgst_size
= DGST_SIZE_4_4
;
7216 parse_func
= md5crypt_parse_hash
;
7217 sort_by_digest
= sort_by_digest_4_4
;
7218 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7225 case 501: hash_type
= HASH_TYPE_MD5
;
7226 salt_type
= SALT_TYPE_EMBEDDED
;
7227 attack_exec
= ATTACK_EXEC_ON_CPU
;
7228 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7229 | OPTS_TYPE_HASH_COPY
;
7230 kern_type
= KERN_TYPE_MD5CRYPT
;
7231 dgst_size
= DGST_SIZE_4_4
;
7232 parse_func
= juniper_parse_hash
;
7233 sort_by_digest
= sort_by_digest_4_4
;
7234 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7241 case 900: hash_type
= HASH_TYPE_MD4
;
7242 salt_type
= SALT_TYPE_NONE
;
7243 attack_exec
= ATTACK_EXEC_ON_GPU
;
7244 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7245 | OPTS_TYPE_PT_ADD80
7246 | OPTS_TYPE_PT_ADDBITS14
;
7247 kern_type
= KERN_TYPE_MD4
;
7248 dgst_size
= DGST_SIZE_4_4
;
7249 parse_func
= md4_parse_hash
;
7250 sort_by_digest
= sort_by_digest_4_4
;
7251 opti_type
= OPTI_TYPE_ZERO_BYTE
7252 | OPTI_TYPE_PRECOMPUTE_INIT
7253 | OPTI_TYPE_PRECOMPUTE_MERKLE
7254 | OPTI_TYPE_MEET_IN_MIDDLE
7255 | OPTI_TYPE_EARLY_SKIP
7256 | OPTI_TYPE_NOT_ITERATED
7257 | OPTI_TYPE_NOT_SALTED
7258 | OPTI_TYPE_RAW_HASH
;
7265 case 1000: hash_type
= HASH_TYPE_MD4
;
7266 salt_type
= SALT_TYPE_NONE
;
7267 attack_exec
= ATTACK_EXEC_ON_GPU
;
7268 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7269 | OPTS_TYPE_PT_ADD80
7270 | OPTS_TYPE_PT_ADDBITS14
7271 | OPTS_TYPE_PT_UNICODE
;
7272 kern_type
= KERN_TYPE_MD4_PWU
;
7273 dgst_size
= DGST_SIZE_4_4
;
7274 parse_func
= md4_parse_hash
;
7275 sort_by_digest
= sort_by_digest_4_4
;
7276 opti_type
= OPTI_TYPE_ZERO_BYTE
7277 | OPTI_TYPE_PRECOMPUTE_INIT
7278 | OPTI_TYPE_PRECOMPUTE_MERKLE
7279 | OPTI_TYPE_MEET_IN_MIDDLE
7280 | OPTI_TYPE_EARLY_SKIP
7281 | OPTI_TYPE_NOT_ITERATED
7282 | OPTI_TYPE_NOT_SALTED
7283 | OPTI_TYPE_RAW_HASH
;
7290 case 1100: hash_type
= HASH_TYPE_MD4
;
7291 salt_type
= SALT_TYPE_INTERN
;
7292 attack_exec
= ATTACK_EXEC_ON_GPU
;
7293 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7294 | OPTS_TYPE_PT_ADD80
7295 | OPTS_TYPE_PT_ADDBITS14
7296 | OPTS_TYPE_PT_UNICODE
7297 | OPTS_TYPE_ST_ADD80
7298 | OPTS_TYPE_ST_UNICODE
7299 | OPTS_TYPE_ST_LOWER
;
7300 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7301 dgst_size
= DGST_SIZE_4_4
;
7302 parse_func
= dcc_parse_hash
;
7303 sort_by_digest
= sort_by_digest_4_4
;
7304 opti_type
= OPTI_TYPE_ZERO_BYTE
7305 | OPTI_TYPE_PRECOMPUTE_INIT
7306 | OPTI_TYPE_PRECOMPUTE_MERKLE
7307 | OPTI_TYPE_EARLY_SKIP
7308 | OPTI_TYPE_NOT_ITERATED
;
7315 case 1400: hash_type
= HASH_TYPE_SHA256
;
7316 salt_type
= SALT_TYPE_NONE
;
7317 attack_exec
= ATTACK_EXEC_ON_GPU
;
7318 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7319 | OPTS_TYPE_PT_ADD80
7320 | OPTS_TYPE_PT_ADDBITS15
;
7321 kern_type
= KERN_TYPE_SHA256
;
7322 dgst_size
= DGST_SIZE_4_8
;
7323 parse_func
= sha256_parse_hash
;
7324 sort_by_digest
= sort_by_digest_4_8
;
7325 opti_type
= OPTI_TYPE_ZERO_BYTE
7326 | OPTI_TYPE_PRECOMPUTE_INIT
7327 | OPTI_TYPE_PRECOMPUTE_MERKLE
7328 | OPTI_TYPE_EARLY_SKIP
7329 | OPTI_TYPE_NOT_ITERATED
7330 | OPTI_TYPE_NOT_SALTED
7331 | OPTI_TYPE_RAW_HASH
;
7338 case 1410: hash_type
= HASH_TYPE_SHA256
;
7339 salt_type
= SALT_TYPE_INTERN
;
7340 attack_exec
= ATTACK_EXEC_ON_GPU
;
7341 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7342 | OPTS_TYPE_ST_ADD80
7343 | OPTS_TYPE_ST_ADDBITS15
;
7344 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7345 dgst_size
= DGST_SIZE_4_8
;
7346 parse_func
= sha256s_parse_hash
;
7347 sort_by_digest
= sort_by_digest_4_8
;
7348 opti_type
= OPTI_TYPE_ZERO_BYTE
7349 | OPTI_TYPE_PRECOMPUTE_INIT
7350 | OPTI_TYPE_PRECOMPUTE_MERKLE
7351 | OPTI_TYPE_EARLY_SKIP
7352 | OPTI_TYPE_NOT_ITERATED
7353 | OPTI_TYPE_APPENDED_SALT
7354 | OPTI_TYPE_RAW_HASH
;
7361 case 1420: hash_type
= HASH_TYPE_SHA256
;
7362 salt_type
= SALT_TYPE_INTERN
;
7363 attack_exec
= ATTACK_EXEC_ON_GPU
;
7364 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7365 | OPTS_TYPE_PT_ADD80
7366 | OPTS_TYPE_PT_ADDBITS15
;
7367 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7368 dgst_size
= DGST_SIZE_4_8
;
7369 parse_func
= sha256s_parse_hash
;
7370 sort_by_digest
= sort_by_digest_4_8
;
7371 opti_type
= OPTI_TYPE_ZERO_BYTE
7372 | OPTI_TYPE_PRECOMPUTE_INIT
7373 | OPTI_TYPE_PRECOMPUTE_MERKLE
7374 | OPTI_TYPE_EARLY_SKIP
7375 | OPTI_TYPE_NOT_ITERATED
7376 | OPTI_TYPE_PREPENDED_SALT
7377 | OPTI_TYPE_RAW_HASH
;
7384 case 1421: hash_type
= HASH_TYPE_SHA256
;
7385 salt_type
= SALT_TYPE_EMBEDDED
;
7386 attack_exec
= ATTACK_EXEC_ON_GPU
;
7387 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7388 | OPTS_TYPE_PT_ADD80
7389 | OPTS_TYPE_PT_ADDBITS15
;
7390 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7391 dgst_size
= DGST_SIZE_4_8
;
7392 parse_func
= hmailserver_parse_hash
;
7393 sort_by_digest
= sort_by_digest_4_8
;
7394 opti_type
= OPTI_TYPE_ZERO_BYTE
7395 | OPTI_TYPE_PRECOMPUTE_INIT
7396 | OPTI_TYPE_PRECOMPUTE_MERKLE
7397 | OPTI_TYPE_EARLY_SKIP
7398 | OPTI_TYPE_NOT_ITERATED
7399 | OPTI_TYPE_PREPENDED_SALT
7400 | OPTI_TYPE_RAW_HASH
;
7407 case 1430: hash_type
= HASH_TYPE_SHA256
;
7408 salt_type
= SALT_TYPE_INTERN
;
7409 attack_exec
= ATTACK_EXEC_ON_GPU
;
7410 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7411 | OPTS_TYPE_PT_UNICODE
7412 | OPTS_TYPE_ST_ADD80
7413 | OPTS_TYPE_ST_ADDBITS15
;
7414 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7415 dgst_size
= DGST_SIZE_4_8
;
7416 parse_func
= sha256s_parse_hash
;
7417 sort_by_digest
= sort_by_digest_4_8
;
7418 opti_type
= OPTI_TYPE_ZERO_BYTE
7419 | OPTI_TYPE_PRECOMPUTE_INIT
7420 | OPTI_TYPE_PRECOMPUTE_MERKLE
7421 | OPTI_TYPE_EARLY_SKIP
7422 | OPTI_TYPE_NOT_ITERATED
7423 | OPTI_TYPE_APPENDED_SALT
7424 | OPTI_TYPE_RAW_HASH
;
7431 case 1440: hash_type
= HASH_TYPE_SHA256
;
7432 salt_type
= SALT_TYPE_INTERN
;
7433 attack_exec
= ATTACK_EXEC_ON_GPU
;
7434 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7435 | OPTS_TYPE_PT_ADD80
7436 | OPTS_TYPE_PT_ADDBITS15
7437 | OPTS_TYPE_PT_UNICODE
;
7438 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7439 dgst_size
= DGST_SIZE_4_8
;
7440 parse_func
= sha256s_parse_hash
;
7441 sort_by_digest
= sort_by_digest_4_8
;
7442 opti_type
= OPTI_TYPE_ZERO_BYTE
7443 | OPTI_TYPE_PRECOMPUTE_INIT
7444 | OPTI_TYPE_PRECOMPUTE_MERKLE
7445 | OPTI_TYPE_EARLY_SKIP
7446 | OPTI_TYPE_NOT_ITERATED
7447 | OPTI_TYPE_PREPENDED_SALT
7448 | OPTI_TYPE_RAW_HASH
;
7455 case 1441: hash_type
= HASH_TYPE_SHA256
;
7456 salt_type
= SALT_TYPE_EMBEDDED
;
7457 attack_exec
= ATTACK_EXEC_ON_GPU
;
7458 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7459 | OPTS_TYPE_PT_ADD80
7460 | OPTS_TYPE_PT_ADDBITS15
7461 | OPTS_TYPE_PT_UNICODE
7462 | OPTS_TYPE_ST_BASE64
;
7463 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7464 dgst_size
= DGST_SIZE_4_8
;
7465 parse_func
= episerver4_parse_hash
;
7466 sort_by_digest
= sort_by_digest_4_8
;
7467 opti_type
= OPTI_TYPE_ZERO_BYTE
7468 | OPTI_TYPE_PRECOMPUTE_INIT
7469 | OPTI_TYPE_PRECOMPUTE_MERKLE
7470 | OPTI_TYPE_EARLY_SKIP
7471 | OPTI_TYPE_NOT_ITERATED
7472 | OPTI_TYPE_PREPENDED_SALT
7473 | OPTI_TYPE_RAW_HASH
;
7480 case 1450: hash_type
= HASH_TYPE_SHA256
;
7481 salt_type
= SALT_TYPE_INTERN
;
7482 attack_exec
= ATTACK_EXEC_ON_GPU
;
7483 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7484 | OPTS_TYPE_ST_ADD80
;
7485 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7486 dgst_size
= DGST_SIZE_4_8
;
7487 parse_func
= hmacsha256_parse_hash
;
7488 sort_by_digest
= sort_by_digest_4_8
;
7489 opti_type
= OPTI_TYPE_ZERO_BYTE
7490 | OPTI_TYPE_NOT_ITERATED
;
7497 case 1460: hash_type
= HASH_TYPE_SHA256
;
7498 salt_type
= SALT_TYPE_INTERN
;
7499 attack_exec
= ATTACK_EXEC_ON_GPU
;
7500 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7501 | OPTS_TYPE_PT_ADD80
7502 | OPTS_TYPE_PT_ADDBITS15
;
7503 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7504 dgst_size
= DGST_SIZE_4_8
;
7505 parse_func
= hmacsha256_parse_hash
;
7506 sort_by_digest
= sort_by_digest_4_8
;
7507 opti_type
= OPTI_TYPE_ZERO_BYTE
7508 | OPTI_TYPE_NOT_ITERATED
;
7515 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7516 salt_type
= SALT_TYPE_EMBEDDED
;
7517 attack_exec
= ATTACK_EXEC_ON_GPU
;
7518 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7519 | OPTS_TYPE_PT_BITSLICE
;
7520 kern_type
= KERN_TYPE_DESCRYPT
;
7521 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7522 parse_func
= descrypt_parse_hash
;
7523 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7524 opti_type
= OPTI_TYPE_ZERO_BYTE
7525 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7532 case 1600: hash_type
= HASH_TYPE_MD5
;
7533 salt_type
= SALT_TYPE_EMBEDDED
;
7534 attack_exec
= ATTACK_EXEC_ON_CPU
;
7535 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7536 kern_type
= KERN_TYPE_APR1CRYPT
;
7537 dgst_size
= DGST_SIZE_4_4
;
7538 parse_func
= md5apr1_parse_hash
;
7539 sort_by_digest
= sort_by_digest_4_4
;
7540 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7547 case 1700: hash_type
= HASH_TYPE_SHA512
;
7548 salt_type
= SALT_TYPE_NONE
;
7549 attack_exec
= ATTACK_EXEC_ON_GPU
;
7550 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7551 | OPTS_TYPE_PT_ADD80
7552 | OPTS_TYPE_PT_ADDBITS15
;
7553 kern_type
= KERN_TYPE_SHA512
;
7554 dgst_size
= DGST_SIZE_8_8
;
7555 parse_func
= sha512_parse_hash
;
7556 sort_by_digest
= sort_by_digest_8_8
;
7557 opti_type
= OPTI_TYPE_ZERO_BYTE
7558 | OPTI_TYPE_PRECOMPUTE_INIT
7559 | OPTI_TYPE_PRECOMPUTE_MERKLE
7560 | OPTI_TYPE_EARLY_SKIP
7561 | OPTI_TYPE_NOT_ITERATED
7562 | OPTI_TYPE_NOT_SALTED
7563 | OPTI_TYPE_RAW_HASH
;
7570 case 1710: hash_type
= HASH_TYPE_SHA512
;
7571 salt_type
= SALT_TYPE_INTERN
;
7572 attack_exec
= ATTACK_EXEC_ON_GPU
;
7573 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7574 | OPTS_TYPE_ST_ADD80
7575 | OPTS_TYPE_ST_ADDBITS15
;
7576 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7577 dgst_size
= DGST_SIZE_8_8
;
7578 parse_func
= sha512s_parse_hash
;
7579 sort_by_digest
= sort_by_digest_8_8
;
7580 opti_type
= OPTI_TYPE_ZERO_BYTE
7581 | OPTI_TYPE_PRECOMPUTE_INIT
7582 | OPTI_TYPE_PRECOMPUTE_MERKLE
7583 | OPTI_TYPE_EARLY_SKIP
7584 | OPTI_TYPE_NOT_ITERATED
7585 | OPTI_TYPE_APPENDED_SALT
7586 | OPTI_TYPE_RAW_HASH
;
7593 case 1711: hash_type
= HASH_TYPE_SHA512
;
7594 salt_type
= SALT_TYPE_EMBEDDED
;
7595 attack_exec
= ATTACK_EXEC_ON_GPU
;
7596 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7597 | OPTS_TYPE_ST_ADD80
7598 | OPTS_TYPE_ST_ADDBITS15
;
7599 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7600 dgst_size
= DGST_SIZE_8_8
;
7601 parse_func
= sha512b64s_parse_hash
;
7602 sort_by_digest
= sort_by_digest_8_8
;
7603 opti_type
= OPTI_TYPE_ZERO_BYTE
7604 | OPTI_TYPE_PRECOMPUTE_INIT
7605 | OPTI_TYPE_PRECOMPUTE_MERKLE
7606 | OPTI_TYPE_EARLY_SKIP
7607 | OPTI_TYPE_NOT_ITERATED
7608 | OPTI_TYPE_APPENDED_SALT
7609 | OPTI_TYPE_RAW_HASH
;
7616 case 1720: hash_type
= HASH_TYPE_SHA512
;
7617 salt_type
= SALT_TYPE_INTERN
;
7618 attack_exec
= ATTACK_EXEC_ON_GPU
;
7619 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7620 | OPTS_TYPE_PT_ADD80
7621 | OPTS_TYPE_PT_ADDBITS15
;
7622 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7623 dgst_size
= DGST_SIZE_8_8
;
7624 parse_func
= sha512s_parse_hash
;
7625 sort_by_digest
= sort_by_digest_8_8
;
7626 opti_type
= OPTI_TYPE_ZERO_BYTE
7627 | OPTI_TYPE_PRECOMPUTE_INIT
7628 | OPTI_TYPE_PRECOMPUTE_MERKLE
7629 | OPTI_TYPE_EARLY_SKIP
7630 | OPTI_TYPE_NOT_ITERATED
7631 | OPTI_TYPE_PREPENDED_SALT
7632 | OPTI_TYPE_RAW_HASH
;
7639 case 1722: hash_type
= HASH_TYPE_SHA512
;
7640 salt_type
= SALT_TYPE_EMBEDDED
;
7641 attack_exec
= ATTACK_EXEC_ON_GPU
;
7642 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7643 | OPTS_TYPE_PT_ADD80
7644 | OPTS_TYPE_PT_ADDBITS15
7646 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7647 dgst_size
= DGST_SIZE_8_8
;
7648 parse_func
= osx512_parse_hash
;
7649 sort_by_digest
= sort_by_digest_8_8
;
7650 opti_type
= OPTI_TYPE_ZERO_BYTE
7651 | OPTI_TYPE_PRECOMPUTE_INIT
7652 | OPTI_TYPE_PRECOMPUTE_MERKLE
7653 | OPTI_TYPE_EARLY_SKIP
7654 | OPTI_TYPE_NOT_ITERATED
7655 | OPTI_TYPE_PREPENDED_SALT
7656 | OPTI_TYPE_RAW_HASH
;
7663 case 1730: hash_type
= HASH_TYPE_SHA512
;
7664 salt_type
= SALT_TYPE_INTERN
;
7665 attack_exec
= ATTACK_EXEC_ON_GPU
;
7666 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7667 | OPTS_TYPE_PT_UNICODE
7668 | OPTS_TYPE_ST_ADD80
7669 | OPTS_TYPE_ST_ADDBITS15
;
7670 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7671 dgst_size
= DGST_SIZE_8_8
;
7672 parse_func
= sha512s_parse_hash
;
7673 sort_by_digest
= sort_by_digest_8_8
;
7674 opti_type
= OPTI_TYPE_ZERO_BYTE
7675 | OPTI_TYPE_PRECOMPUTE_INIT
7676 | OPTI_TYPE_PRECOMPUTE_MERKLE
7677 | OPTI_TYPE_EARLY_SKIP
7678 | OPTI_TYPE_NOT_ITERATED
7679 | OPTI_TYPE_APPENDED_SALT
7680 | OPTI_TYPE_RAW_HASH
;
7687 case 1731: hash_type
= HASH_TYPE_SHA512
;
7688 salt_type
= SALT_TYPE_EMBEDDED
;
7689 attack_exec
= ATTACK_EXEC_ON_GPU
;
7690 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7691 | OPTS_TYPE_PT_UNICODE
7692 | OPTS_TYPE_ST_ADD80
7693 | OPTS_TYPE_ST_ADDBITS15
7695 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7696 dgst_size
= DGST_SIZE_8_8
;
7697 parse_func
= mssql2012_parse_hash
;
7698 sort_by_digest
= sort_by_digest_8_8
;
7699 opti_type
= OPTI_TYPE_ZERO_BYTE
7700 | OPTI_TYPE_PRECOMPUTE_INIT
7701 | OPTI_TYPE_PRECOMPUTE_MERKLE
7702 | OPTI_TYPE_EARLY_SKIP
7703 | OPTI_TYPE_NOT_ITERATED
7704 | OPTI_TYPE_APPENDED_SALT
7705 | OPTI_TYPE_RAW_HASH
;
7712 case 1740: hash_type
= HASH_TYPE_SHA512
;
7713 salt_type
= SALT_TYPE_INTERN
;
7714 attack_exec
= ATTACK_EXEC_ON_GPU
;
7715 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7716 | OPTS_TYPE_PT_ADD80
7717 | OPTS_TYPE_PT_ADDBITS15
7718 | OPTS_TYPE_PT_UNICODE
;
7719 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7720 dgst_size
= DGST_SIZE_8_8
;
7721 parse_func
= sha512s_parse_hash
;
7722 sort_by_digest
= sort_by_digest_8_8
;
7723 opti_type
= OPTI_TYPE_ZERO_BYTE
7724 | OPTI_TYPE_PRECOMPUTE_INIT
7725 | OPTI_TYPE_PRECOMPUTE_MERKLE
7726 | OPTI_TYPE_EARLY_SKIP
7727 | OPTI_TYPE_NOT_ITERATED
7728 | OPTI_TYPE_PREPENDED_SALT
7729 | OPTI_TYPE_RAW_HASH
;
7736 case 1750: hash_type
= HASH_TYPE_SHA512
;
7737 salt_type
= SALT_TYPE_INTERN
;
7738 attack_exec
= ATTACK_EXEC_ON_GPU
;
7739 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7740 | OPTS_TYPE_ST_ADD80
;
7741 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7742 dgst_size
= DGST_SIZE_8_8
;
7743 parse_func
= hmacsha512_parse_hash
;
7744 sort_by_digest
= sort_by_digest_8_8
;
7745 opti_type
= OPTI_TYPE_ZERO_BYTE
7746 | OPTI_TYPE_NOT_ITERATED
;
7753 case 1760: hash_type
= HASH_TYPE_SHA512
;
7754 salt_type
= SALT_TYPE_INTERN
;
7755 attack_exec
= ATTACK_EXEC_ON_GPU
;
7756 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7757 | OPTS_TYPE_PT_ADD80
7758 | OPTS_TYPE_PT_ADDBITS15
;
7759 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7760 dgst_size
= DGST_SIZE_8_8
;
7761 parse_func
= hmacsha512_parse_hash
;
7762 sort_by_digest
= sort_by_digest_8_8
;
7763 opti_type
= OPTI_TYPE_ZERO_BYTE
7764 | OPTI_TYPE_NOT_ITERATED
;
7771 case 1800: hash_type
= HASH_TYPE_SHA512
;
7772 salt_type
= SALT_TYPE_EMBEDDED
;
7773 attack_exec
= ATTACK_EXEC_ON_CPU
;
7774 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7775 kern_type
= KERN_TYPE_SHA512CRYPT
;
7776 dgst_size
= DGST_SIZE_8_8
;
7777 parse_func
= sha512crypt_parse_hash
;
7778 sort_by_digest
= sort_by_digest_8_8
;
7779 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7786 case 2100: hash_type
= HASH_TYPE_DCC2
;
7787 salt_type
= SALT_TYPE_EMBEDDED
;
7788 attack_exec
= ATTACK_EXEC_ON_CPU
;
7789 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7790 | OPTS_TYPE_ST_LOWER
7791 | OPTS_TYPE_ST_UNICODE
;
7792 kern_type
= KERN_TYPE_DCC2
;
7793 dgst_size
= DGST_SIZE_4_4
;
7794 parse_func
= dcc2_parse_hash
;
7795 sort_by_digest
= sort_by_digest_4_4
;
7796 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7803 case 2400: hash_type
= HASH_TYPE_MD5
;
7804 salt_type
= SALT_TYPE_NONE
;
7805 attack_exec
= ATTACK_EXEC_ON_GPU
;
7806 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7807 kern_type
= KERN_TYPE_MD5PIX
;
7808 dgst_size
= DGST_SIZE_4_4
;
7809 parse_func
= md5pix_parse_hash
;
7810 sort_by_digest
= sort_by_digest_4_4
;
7811 opti_type
= OPTI_TYPE_ZERO_BYTE
7812 | OPTI_TYPE_PRECOMPUTE_INIT
7813 | OPTI_TYPE_PRECOMPUTE_MERKLE
7814 | OPTI_TYPE_EARLY_SKIP
7815 | OPTI_TYPE_NOT_ITERATED
7816 | OPTI_TYPE_NOT_SALTED
;
7823 case 2410: hash_type
= HASH_TYPE_MD5
;
7824 salt_type
= SALT_TYPE_INTERN
;
7825 attack_exec
= ATTACK_EXEC_ON_GPU
;
7826 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7827 kern_type
= KERN_TYPE_MD5ASA
;
7828 dgst_size
= DGST_SIZE_4_4
;
7829 parse_func
= md5asa_parse_hash
;
7830 sort_by_digest
= sort_by_digest_4_4
;
7831 opti_type
= OPTI_TYPE_ZERO_BYTE
7832 | OPTI_TYPE_PRECOMPUTE_INIT
7833 | OPTI_TYPE_PRECOMPUTE_MERKLE
7834 | OPTI_TYPE_EARLY_SKIP
7835 | OPTI_TYPE_NOT_ITERATED
;
7842 case 2500: hash_type
= HASH_TYPE_WPA
;
7843 salt_type
= SALT_TYPE_EMBEDDED
;
7844 attack_exec
= ATTACK_EXEC_ON_CPU
;
7845 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7846 kern_type
= KERN_TYPE_WPA
;
7847 dgst_size
= DGST_SIZE_4_4
;
7848 parse_func
= wpa_parse_hash
;
7849 sort_by_digest
= sort_by_digest_4_4
;
7850 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7857 case 2600: hash_type
= HASH_TYPE_MD5
;
7858 salt_type
= SALT_TYPE_VIRTUAL
;
7859 attack_exec
= ATTACK_EXEC_ON_GPU
;
7860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7861 | OPTS_TYPE_PT_ADD80
7862 | OPTS_TYPE_PT_ADDBITS14
7863 | OPTS_TYPE_ST_ADD80
;
7864 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7865 dgst_size
= DGST_SIZE_4_4
;
7866 parse_func
= md5md5_parse_hash
;
7867 sort_by_digest
= sort_by_digest_4_4
;
7868 opti_type
= OPTI_TYPE_ZERO_BYTE
7869 | OPTI_TYPE_PRECOMPUTE_INIT
7870 | OPTI_TYPE_PRECOMPUTE_MERKLE
7871 | OPTI_TYPE_EARLY_SKIP
;
7878 case 2611: hash_type
= HASH_TYPE_MD5
;
7879 salt_type
= SALT_TYPE_INTERN
;
7880 attack_exec
= ATTACK_EXEC_ON_GPU
;
7881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7882 | OPTS_TYPE_PT_ADD80
7883 | OPTS_TYPE_PT_ADDBITS14
7884 | OPTS_TYPE_ST_ADD80
;
7885 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7886 dgst_size
= DGST_SIZE_4_4
;
7887 parse_func
= vb3_parse_hash
;
7888 sort_by_digest
= sort_by_digest_4_4
;
7889 opti_type
= OPTI_TYPE_ZERO_BYTE
7890 | OPTI_TYPE_PRECOMPUTE_INIT
7891 | OPTI_TYPE_PRECOMPUTE_MERKLE
7892 | OPTI_TYPE_EARLY_SKIP
;
7899 case 2612: hash_type
= HASH_TYPE_MD5
;
7900 salt_type
= SALT_TYPE_EMBEDDED
;
7901 attack_exec
= ATTACK_EXEC_ON_GPU
;
7902 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7903 | OPTS_TYPE_PT_ADD80
7904 | OPTS_TYPE_PT_ADDBITS14
7905 | OPTS_TYPE_ST_ADD80
7907 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7908 dgst_size
= DGST_SIZE_4_4
;
7909 parse_func
= phps_parse_hash
;
7910 sort_by_digest
= sort_by_digest_4_4
;
7911 opti_type
= OPTI_TYPE_ZERO_BYTE
7912 | OPTI_TYPE_PRECOMPUTE_INIT
7913 | OPTI_TYPE_PRECOMPUTE_MERKLE
7914 | OPTI_TYPE_EARLY_SKIP
;
7921 case 2711: hash_type
= HASH_TYPE_MD5
;
7922 salt_type
= SALT_TYPE_INTERN
;
7923 attack_exec
= ATTACK_EXEC_ON_GPU
;
7924 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7925 | OPTS_TYPE_PT_ADD80
7926 | OPTS_TYPE_PT_ADDBITS14
7927 | OPTS_TYPE_ST_ADD80
;
7928 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7929 dgst_size
= DGST_SIZE_4_4
;
7930 parse_func
= vb30_parse_hash
;
7931 sort_by_digest
= sort_by_digest_4_4
;
7932 opti_type
= OPTI_TYPE_ZERO_BYTE
7933 | OPTI_TYPE_PRECOMPUTE_INIT
7934 | OPTI_TYPE_EARLY_SKIP
;
7941 case 2811: hash_type
= HASH_TYPE_MD5
;
7942 salt_type
= SALT_TYPE_INTERN
;
7943 attack_exec
= ATTACK_EXEC_ON_GPU
;
7944 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7945 | OPTS_TYPE_PT_ADD80
7946 | OPTS_TYPE_PT_ADDBITS14
;
7947 kern_type
= KERN_TYPE_MD55_SLTPW
;
7948 dgst_size
= DGST_SIZE_4_4
;
7949 parse_func
= ipb2_parse_hash
;
7950 sort_by_digest
= sort_by_digest_4_4
;
7951 opti_type
= OPTI_TYPE_ZERO_BYTE
7952 | OPTI_TYPE_PRECOMPUTE_INIT
7953 | OPTI_TYPE_EARLY_SKIP
;
7960 case 3000: hash_type
= HASH_TYPE_LM
;
7961 salt_type
= SALT_TYPE_NONE
;
7962 attack_exec
= ATTACK_EXEC_ON_GPU
;
7963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7964 | OPTS_TYPE_PT_UPPER
7965 | OPTS_TYPE_PT_BITSLICE
;
7966 kern_type
= KERN_TYPE_LM
;
7967 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7968 parse_func
= lm_parse_hash
;
7969 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7970 opti_type
= OPTI_TYPE_ZERO_BYTE
7971 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7978 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7979 salt_type
= SALT_TYPE_INTERN
;
7980 attack_exec
= ATTACK_EXEC_ON_GPU
;
7981 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7982 | OPTS_TYPE_PT_UPPER
7983 | OPTS_TYPE_ST_UPPER
;
7984 kern_type
= KERN_TYPE_ORACLEH
;
7985 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7986 parse_func
= oracleh_parse_hash
;
7987 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7988 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7995 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7996 salt_type
= SALT_TYPE_EMBEDDED
;
7997 attack_exec
= ATTACK_EXEC_ON_CPU
;
7998 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7999 | OPTS_TYPE_ST_GENERATE_LE
;
8000 kern_type
= KERN_TYPE_BCRYPT
;
8001 dgst_size
= DGST_SIZE_4_6
;
8002 parse_func
= bcrypt_parse_hash
;
8003 sort_by_digest
= sort_by_digest_4_6
;
8004 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8011 case 3710: hash_type
= HASH_TYPE_MD5
;
8012 salt_type
= SALT_TYPE_INTERN
;
8013 attack_exec
= ATTACK_EXEC_ON_GPU
;
8014 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8015 | OPTS_TYPE_PT_ADD80
8016 | OPTS_TYPE_PT_ADDBITS14
;
8017 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8018 dgst_size
= DGST_SIZE_4_4
;
8019 parse_func
= md5s_parse_hash
;
8020 sort_by_digest
= sort_by_digest_4_4
;
8021 opti_type
= OPTI_TYPE_ZERO_BYTE
8022 | OPTI_TYPE_PRECOMPUTE_INIT
8023 | OPTI_TYPE_PRECOMPUTE_MERKLE
8024 | OPTI_TYPE_EARLY_SKIP
;
8031 case 3711: hash_type
= HASH_TYPE_MD5
;
8032 salt_type
= SALT_TYPE_EMBEDDED
;
8033 attack_exec
= ATTACK_EXEC_ON_GPU
;
8034 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8035 | OPTS_TYPE_PT_ADD80
8036 | OPTS_TYPE_PT_ADDBITS14
;
8037 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8038 dgst_size
= DGST_SIZE_4_4
;
8039 parse_func
= mediawiki_b_parse_hash
;
8040 sort_by_digest
= sort_by_digest_4_4
;
8041 opti_type
= OPTI_TYPE_ZERO_BYTE
8042 | OPTI_TYPE_PRECOMPUTE_INIT
8043 | OPTI_TYPE_PRECOMPUTE_MERKLE
8044 | OPTI_TYPE_EARLY_SKIP
;
8051 case 3800: hash_type
= HASH_TYPE_MD5
;
8052 salt_type
= SALT_TYPE_INTERN
;
8053 attack_exec
= ATTACK_EXEC_ON_GPU
;
8054 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8055 | OPTS_TYPE_ST_ADDBITS14
;
8056 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8057 dgst_size
= DGST_SIZE_4_4
;
8058 parse_func
= md5s_parse_hash
;
8059 sort_by_digest
= sort_by_digest_4_4
;
8060 opti_type
= OPTI_TYPE_ZERO_BYTE
8061 | OPTI_TYPE_PRECOMPUTE_INIT
8062 | OPTI_TYPE_PRECOMPUTE_MERKLE
8063 | OPTI_TYPE_EARLY_SKIP
8064 | OPTI_TYPE_NOT_ITERATED
8065 | OPTI_TYPE_RAW_HASH
;
8072 case 4300: hash_type
= HASH_TYPE_MD5
;
8073 salt_type
= SALT_TYPE_VIRTUAL
;
8074 attack_exec
= ATTACK_EXEC_ON_GPU
;
8075 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8076 | OPTS_TYPE_PT_ADD80
8077 | OPTS_TYPE_PT_ADDBITS14
8078 | OPTS_TYPE_ST_ADD80
;
8079 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8080 dgst_size
= DGST_SIZE_4_4
;
8081 parse_func
= md5md5_parse_hash
;
8082 sort_by_digest
= sort_by_digest_4_4
;
8083 opti_type
= OPTI_TYPE_ZERO_BYTE
8084 | OPTI_TYPE_PRECOMPUTE_INIT
8085 | OPTI_TYPE_PRECOMPUTE_MERKLE
8086 | OPTI_TYPE_EARLY_SKIP
;
8094 case 4400: hash_type
= HASH_TYPE_MD5
;
8095 salt_type
= SALT_TYPE_NONE
;
8096 attack_exec
= ATTACK_EXEC_ON_GPU
;
8097 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8098 | OPTS_TYPE_PT_ADD80
8099 | OPTS_TYPE_PT_ADDBITS15
;
8100 kern_type
= KERN_TYPE_MD5_SHA1
;
8101 dgst_size
= DGST_SIZE_4_4
;
8102 parse_func
= md5_parse_hash
;
8103 sort_by_digest
= sort_by_digest_4_4
;
8104 opti_type
= OPTI_TYPE_ZERO_BYTE
8105 | OPTI_TYPE_PRECOMPUTE_INIT
8106 | OPTI_TYPE_PRECOMPUTE_MERKLE
8107 | OPTI_TYPE_EARLY_SKIP
8108 | OPTI_TYPE_NOT_ITERATED
8109 | OPTI_TYPE_NOT_SALTED
8110 | OPTI_TYPE_RAW_HASH
;
8117 case 4500: hash_type
= HASH_TYPE_SHA1
;
8118 salt_type
= SALT_TYPE_NONE
;
8119 attack_exec
= ATTACK_EXEC_ON_GPU
;
8120 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8121 | OPTS_TYPE_PT_ADD80
8122 | OPTS_TYPE_PT_ADDBITS15
;
8123 kern_type
= KERN_TYPE_SHA11
;
8124 dgst_size
= DGST_SIZE_4_5
;
8125 parse_func
= sha1_parse_hash
;
8126 sort_by_digest
= sort_by_digest_4_5
;
8127 opti_type
= OPTI_TYPE_ZERO_BYTE
8128 | OPTI_TYPE_PRECOMPUTE_INIT
8129 | OPTI_TYPE_PRECOMPUTE_MERKLE
8130 | OPTI_TYPE_EARLY_SKIP
8131 | OPTI_TYPE_NOT_SALTED
;
8138 case 4700: hash_type
= HASH_TYPE_SHA1
;
8139 salt_type
= SALT_TYPE_NONE
;
8140 attack_exec
= ATTACK_EXEC_ON_GPU
;
8141 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8142 | OPTS_TYPE_PT_ADD80
8143 | OPTS_TYPE_PT_ADDBITS14
;
8144 kern_type
= KERN_TYPE_SHA1_MD5
;
8145 dgst_size
= DGST_SIZE_4_5
;
8146 parse_func
= sha1_parse_hash
;
8147 sort_by_digest
= sort_by_digest_4_5
;
8148 opti_type
= OPTI_TYPE_ZERO_BYTE
8149 | OPTI_TYPE_PRECOMPUTE_INIT
8150 | OPTI_TYPE_PRECOMPUTE_MERKLE
8151 | OPTI_TYPE_EARLY_SKIP
8152 | OPTI_TYPE_NOT_ITERATED
8153 | OPTI_TYPE_NOT_SALTED
8154 | OPTI_TYPE_RAW_HASH
;
8161 case 4800: hash_type
= HASH_TYPE_MD5
;
8162 salt_type
= SALT_TYPE_EMBEDDED
;
8163 attack_exec
= ATTACK_EXEC_ON_GPU
;
8164 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8165 | OPTS_TYPE_PT_ADDBITS14
;
8166 kern_type
= KERN_TYPE_MD5_CHAP
;
8167 dgst_size
= DGST_SIZE_4_4
;
8168 parse_func
= chap_parse_hash
;
8169 sort_by_digest
= sort_by_digest_4_4
;
8170 opti_type
= OPTI_TYPE_ZERO_BYTE
8171 | OPTI_TYPE_PRECOMPUTE_INIT
8172 | OPTI_TYPE_PRECOMPUTE_MERKLE
8173 | OPTI_TYPE_MEET_IN_MIDDLE
8174 | OPTI_TYPE_EARLY_SKIP
8175 | OPTI_TYPE_NOT_ITERATED
8176 | OPTI_TYPE_RAW_HASH
;
8183 case 4900: hash_type
= HASH_TYPE_SHA1
;
8184 salt_type
= SALT_TYPE_INTERN
;
8185 attack_exec
= ATTACK_EXEC_ON_GPU
;
8186 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8187 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8188 dgst_size
= DGST_SIZE_4_5
;
8189 parse_func
= sha1s_parse_hash
;
8190 sort_by_digest
= sort_by_digest_4_5
;
8191 opti_type
= OPTI_TYPE_ZERO_BYTE
8192 | OPTI_TYPE_PRECOMPUTE_INIT
8193 | OPTI_TYPE_PRECOMPUTE_MERKLE
8194 | OPTI_TYPE_EARLY_SKIP
;
8201 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8202 salt_type
= SALT_TYPE_EMBEDDED
;
8203 attack_exec
= ATTACK_EXEC_ON_GPU
;
8204 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8205 | OPTS_TYPE_PT_ADD01
;
8206 kern_type
= KERN_TYPE_KECCAK
;
8207 dgst_size
= DGST_SIZE_8_25
;
8208 parse_func
= keccak_parse_hash
;
8209 sort_by_digest
= sort_by_digest_8_25
;
8210 opti_type
= OPTI_TYPE_ZERO_BYTE
8211 | OPTI_TYPE_RAW_HASH
;
8218 case 5100: hash_type
= HASH_TYPE_MD5H
;
8219 salt_type
= SALT_TYPE_NONE
;
8220 attack_exec
= ATTACK_EXEC_ON_GPU
;
8221 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8222 | OPTS_TYPE_PT_ADD80
8223 | OPTS_TYPE_PT_ADDBITS14
;
8224 kern_type
= KERN_TYPE_MD5H
;
8225 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8226 parse_func
= md5half_parse_hash
;
8227 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8228 opti_type
= OPTI_TYPE_ZERO_BYTE
8229 | OPTI_TYPE_RAW_HASH
;
8236 case 5200: hash_type
= HASH_TYPE_SHA256
;
8237 salt_type
= SALT_TYPE_EMBEDDED
;
8238 attack_exec
= ATTACK_EXEC_ON_CPU
;
8239 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8240 kern_type
= KERN_TYPE_PSAFE3
;
8241 dgst_size
= DGST_SIZE_4_8
;
8242 parse_func
= psafe3_parse_hash
;
8243 sort_by_digest
= sort_by_digest_4_8
;
8244 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8251 case 5300: hash_type
= HASH_TYPE_MD5
;
8252 salt_type
= SALT_TYPE_EMBEDDED
;
8253 attack_exec
= ATTACK_EXEC_ON_GPU
;
8254 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8255 | OPTS_TYPE_ST_ADD80
;
8256 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8257 dgst_size
= DGST_SIZE_4_4
;
8258 parse_func
= ikepsk_md5_parse_hash
;
8259 sort_by_digest
= sort_by_digest_4_4
;
8260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8267 case 5400: hash_type
= HASH_TYPE_SHA1
;
8268 salt_type
= SALT_TYPE_EMBEDDED
;
8269 attack_exec
= ATTACK_EXEC_ON_GPU
;
8270 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8271 | OPTS_TYPE_ST_ADD80
;
8272 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8273 dgst_size
= DGST_SIZE_4_5
;
8274 parse_func
= ikepsk_sha1_parse_hash
;
8275 sort_by_digest
= sort_by_digest_4_5
;
8276 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8283 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8284 salt_type
= SALT_TYPE_EMBEDDED
;
8285 attack_exec
= ATTACK_EXEC_ON_GPU
;
8286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8287 | OPTS_TYPE_PT_ADD80
8288 | OPTS_TYPE_PT_ADDBITS14
8289 | OPTS_TYPE_PT_UNICODE
8291 kern_type
= KERN_TYPE_NETNTLMv1
;
8292 dgst_size
= DGST_SIZE_4_4
;
8293 parse_func
= netntlmv1_parse_hash
;
8294 sort_by_digest
= sort_by_digest_4_4
;
8295 opti_type
= OPTI_TYPE_ZERO_BYTE
8296 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8303 case 5600: hash_type
= HASH_TYPE_MD5
;
8304 salt_type
= SALT_TYPE_EMBEDDED
;
8305 attack_exec
= ATTACK_EXEC_ON_GPU
;
8306 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8307 | OPTS_TYPE_PT_ADD80
8308 | OPTS_TYPE_PT_ADDBITS14
8309 | OPTS_TYPE_PT_UNICODE
;
8310 kern_type
= KERN_TYPE_NETNTLMv2
;
8311 dgst_size
= DGST_SIZE_4_4
;
8312 parse_func
= netntlmv2_parse_hash
;
8313 sort_by_digest
= sort_by_digest_4_4
;
8314 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8321 case 5700: hash_type
= HASH_TYPE_SHA256
;
8322 salt_type
= SALT_TYPE_NONE
;
8323 attack_exec
= ATTACK_EXEC_ON_GPU
;
8324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8325 | OPTS_TYPE_PT_ADD80
8326 | OPTS_TYPE_PT_ADDBITS15
;
8327 kern_type
= KERN_TYPE_SHA256
;
8328 dgst_size
= DGST_SIZE_4_8
;
8329 parse_func
= cisco4_parse_hash
;
8330 sort_by_digest
= sort_by_digest_4_8
;
8331 opti_type
= OPTI_TYPE_ZERO_BYTE
8332 | OPTI_TYPE_PRECOMPUTE_INIT
8333 | OPTI_TYPE_PRECOMPUTE_MERKLE
8334 | OPTI_TYPE_EARLY_SKIP
8335 | OPTI_TYPE_NOT_ITERATED
8336 | OPTI_TYPE_NOT_SALTED
8337 | OPTI_TYPE_RAW_HASH
;
8344 case 5800: hash_type
= HASH_TYPE_SHA1
;
8345 salt_type
= SALT_TYPE_INTERN
;
8346 attack_exec
= ATTACK_EXEC_ON_CPU
;
8347 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8348 | OPTS_TYPE_ST_ADD80
;
8349 kern_type
= KERN_TYPE_ANDROIDPIN
;
8350 dgst_size
= DGST_SIZE_4_5
;
8351 parse_func
= androidpin_parse_hash
;
8352 sort_by_digest
= sort_by_digest_4_5
;
8353 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8360 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8361 salt_type
= SALT_TYPE_NONE
;
8362 attack_exec
= ATTACK_EXEC_ON_GPU
;
8363 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8364 | OPTS_TYPE_PT_ADD80
;
8365 kern_type
= KERN_TYPE_RIPEMD160
;
8366 dgst_size
= DGST_SIZE_4_5
;
8367 parse_func
= ripemd160_parse_hash
;
8368 sort_by_digest
= sort_by_digest_4_5
;
8369 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8376 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8377 salt_type
= SALT_TYPE_NONE
;
8378 attack_exec
= ATTACK_EXEC_ON_GPU
;
8379 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8380 | OPTS_TYPE_PT_ADD80
;
8381 kern_type
= KERN_TYPE_WHIRLPOOL
;
8382 dgst_size
= DGST_SIZE_4_16
;
8383 parse_func
= whirlpool_parse_hash
;
8384 sort_by_digest
= sort_by_digest_4_16
;
8385 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8392 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8393 salt_type
= SALT_TYPE_EMBEDDED
;
8394 attack_exec
= ATTACK_EXEC_ON_CPU
;
8395 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8396 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8397 dgst_size
= DGST_SIZE_4_5
;
8398 parse_func
= truecrypt_parse_hash_2k
;
8399 sort_by_digest
= sort_by_digest_4_5
;
8400 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8407 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8408 salt_type
= SALT_TYPE_EMBEDDED
;
8409 attack_exec
= ATTACK_EXEC_ON_CPU
;
8410 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8411 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8412 dgst_size
= DGST_SIZE_4_5
;
8413 parse_func
= truecrypt_parse_hash_2k
;
8414 sort_by_digest
= sort_by_digest_4_5
;
8415 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8422 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8423 salt_type
= SALT_TYPE_EMBEDDED
;
8424 attack_exec
= ATTACK_EXEC_ON_CPU
;
8425 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8426 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8427 dgst_size
= DGST_SIZE_4_5
;
8428 parse_func
= truecrypt_parse_hash_2k
;
8429 sort_by_digest
= sort_by_digest_4_5
;
8430 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8437 case 6221: hash_type
= HASH_TYPE_SHA512
;
8438 salt_type
= SALT_TYPE_EMBEDDED
;
8439 attack_exec
= ATTACK_EXEC_ON_CPU
;
8440 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8441 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8442 dgst_size
= DGST_SIZE_8_8
;
8443 parse_func
= truecrypt_parse_hash_1k
;
8444 sort_by_digest
= sort_by_digest_8_8
;
8445 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8452 case 6222: hash_type
= HASH_TYPE_SHA512
;
8453 salt_type
= SALT_TYPE_EMBEDDED
;
8454 attack_exec
= ATTACK_EXEC_ON_CPU
;
8455 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8456 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8457 dgst_size
= DGST_SIZE_8_8
;
8458 parse_func
= truecrypt_parse_hash_1k
;
8459 sort_by_digest
= sort_by_digest_8_8
;
8460 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8467 case 6223: hash_type
= HASH_TYPE_SHA512
;
8468 salt_type
= SALT_TYPE_EMBEDDED
;
8469 attack_exec
= ATTACK_EXEC_ON_CPU
;
8470 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8471 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8472 dgst_size
= DGST_SIZE_8_8
;
8473 parse_func
= truecrypt_parse_hash_1k
;
8474 sort_by_digest
= sort_by_digest_8_8
;
8475 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8482 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8483 salt_type
= SALT_TYPE_EMBEDDED
;
8484 attack_exec
= ATTACK_EXEC_ON_CPU
;
8485 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8486 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8487 dgst_size
= DGST_SIZE_4_8
;
8488 parse_func
= truecrypt_parse_hash_1k
;
8489 sort_by_digest
= sort_by_digest_4_8
;
8490 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8497 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8498 salt_type
= SALT_TYPE_EMBEDDED
;
8499 attack_exec
= ATTACK_EXEC_ON_CPU
;
8500 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8501 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8502 dgst_size
= DGST_SIZE_4_8
;
8503 parse_func
= truecrypt_parse_hash_1k
;
8504 sort_by_digest
= sort_by_digest_4_8
;
8505 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8512 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8513 salt_type
= SALT_TYPE_EMBEDDED
;
8514 attack_exec
= ATTACK_EXEC_ON_CPU
;
8515 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8516 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8517 dgst_size
= DGST_SIZE_4_8
;
8518 parse_func
= truecrypt_parse_hash_1k
;
8519 sort_by_digest
= sort_by_digest_4_8
;
8520 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8527 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8528 salt_type
= SALT_TYPE_EMBEDDED
;
8529 attack_exec
= ATTACK_EXEC_ON_CPU
;
8530 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8531 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8532 dgst_size
= DGST_SIZE_4_5
;
8533 parse_func
= truecrypt_parse_hash_1k
;
8534 sort_by_digest
= sort_by_digest_4_5
;
8535 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8542 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8543 salt_type
= SALT_TYPE_EMBEDDED
;
8544 attack_exec
= ATTACK_EXEC_ON_CPU
;
8545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8546 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8547 dgst_size
= DGST_SIZE_4_5
;
8548 parse_func
= truecrypt_parse_hash_1k
;
8549 sort_by_digest
= sort_by_digest_4_5
;
8550 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8557 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8558 salt_type
= SALT_TYPE_EMBEDDED
;
8559 attack_exec
= ATTACK_EXEC_ON_CPU
;
8560 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8561 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8562 dgst_size
= DGST_SIZE_4_5
;
8563 parse_func
= truecrypt_parse_hash_1k
;
8564 sort_by_digest
= sort_by_digest_4_5
;
8565 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8572 case 6300: hash_type
= HASH_TYPE_MD5
;
8573 salt_type
= SALT_TYPE_EMBEDDED
;
8574 attack_exec
= ATTACK_EXEC_ON_CPU
;
8575 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8576 kern_type
= KERN_TYPE_MD5AIX
;
8577 dgst_size
= DGST_SIZE_4_4
;
8578 parse_func
= md5aix_parse_hash
;
8579 sort_by_digest
= sort_by_digest_4_4
;
8580 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8587 case 6400: hash_type
= HASH_TYPE_SHA256
;
8588 salt_type
= SALT_TYPE_EMBEDDED
;
8589 attack_exec
= ATTACK_EXEC_ON_CPU
;
8590 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8591 kern_type
= KERN_TYPE_SHA256AIX
;
8592 dgst_size
= DGST_SIZE_4_8
;
8593 parse_func
= sha256aix_parse_hash
;
8594 sort_by_digest
= sort_by_digest_4_8
;
8595 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8602 case 6500: hash_type
= HASH_TYPE_SHA512
;
8603 salt_type
= SALT_TYPE_EMBEDDED
;
8604 attack_exec
= ATTACK_EXEC_ON_CPU
;
8605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8606 kern_type
= KERN_TYPE_SHA512AIX
;
8607 dgst_size
= DGST_SIZE_8_8
;
8608 parse_func
= sha512aix_parse_hash
;
8609 sort_by_digest
= sort_by_digest_8_8
;
8610 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8617 case 6600: hash_type
= HASH_TYPE_AES
;
8618 salt_type
= SALT_TYPE_EMBEDDED
;
8619 attack_exec
= ATTACK_EXEC_ON_CPU
;
8620 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8621 kern_type
= KERN_TYPE_AGILEKEY
;
8622 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8623 parse_func
= agilekey_parse_hash
;
8624 sort_by_digest
= sort_by_digest_4_5
;
8625 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8632 case 6700: hash_type
= HASH_TYPE_SHA1
;
8633 salt_type
= SALT_TYPE_EMBEDDED
;
8634 attack_exec
= ATTACK_EXEC_ON_CPU
;
8635 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8636 kern_type
= KERN_TYPE_SHA1AIX
;
8637 dgst_size
= DGST_SIZE_4_5
;
8638 parse_func
= sha1aix_parse_hash
;
8639 sort_by_digest
= sort_by_digest_4_5
;
8640 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8647 case 6800: hash_type
= HASH_TYPE_AES
;
8648 salt_type
= SALT_TYPE_EMBEDDED
;
8649 attack_exec
= ATTACK_EXEC_ON_CPU
;
8650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8651 kern_type
= KERN_TYPE_LASTPASS
;
8652 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8653 parse_func
= lastpass_parse_hash
;
8654 sort_by_digest
= sort_by_digest_4_8
;
8655 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8662 case 6900: hash_type
= HASH_TYPE_GOST
;
8663 salt_type
= SALT_TYPE_NONE
;
8664 attack_exec
= ATTACK_EXEC_ON_GPU
;
8665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8666 kern_type
= KERN_TYPE_GOST
;
8667 dgst_size
= DGST_SIZE_4_8
;
8668 parse_func
= gost_parse_hash
;
8669 sort_by_digest
= sort_by_digest_4_8
;
8670 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8677 case 7100: hash_type
= HASH_TYPE_SHA512
;
8678 salt_type
= SALT_TYPE_EMBEDDED
;
8679 attack_exec
= ATTACK_EXEC_ON_CPU
;
8680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8681 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8682 dgst_size
= DGST_SIZE_8_16
;
8683 parse_func
= sha512osx_parse_hash
;
8684 sort_by_digest
= sort_by_digest_8_16
;
8685 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8692 case 7200: hash_type
= HASH_TYPE_SHA512
;
8693 salt_type
= SALT_TYPE_EMBEDDED
;
8694 attack_exec
= ATTACK_EXEC_ON_CPU
;
8695 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8696 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8697 dgst_size
= DGST_SIZE_8_16
;
8698 parse_func
= sha512grub_parse_hash
;
8699 sort_by_digest
= sort_by_digest_8_16
;
8700 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8707 case 7300: hash_type
= HASH_TYPE_SHA1
;
8708 salt_type
= SALT_TYPE_EMBEDDED
;
8709 attack_exec
= ATTACK_EXEC_ON_GPU
;
8710 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8711 | OPTS_TYPE_ST_ADD80
8712 | OPTS_TYPE_ST_ADDBITS15
;
8713 kern_type
= KERN_TYPE_RAKP
;
8714 dgst_size
= DGST_SIZE_4_5
;
8715 parse_func
= rakp_parse_hash
;
8716 sort_by_digest
= sort_by_digest_4_5
;
8717 opti_type
= OPTI_TYPE_ZERO_BYTE
8718 | OPTI_TYPE_NOT_ITERATED
;
8725 case 7400: hash_type
= HASH_TYPE_SHA256
;
8726 salt_type
= SALT_TYPE_EMBEDDED
;
8727 attack_exec
= ATTACK_EXEC_ON_CPU
;
8728 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8729 kern_type
= KERN_TYPE_SHA256CRYPT
;
8730 dgst_size
= DGST_SIZE_4_8
;
8731 parse_func
= sha256crypt_parse_hash
;
8732 sort_by_digest
= sort_by_digest_4_8
;
8733 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8740 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8741 salt_type
= SALT_TYPE_EMBEDDED
;
8742 attack_exec
= ATTACK_EXEC_ON_GPU
;
8743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8744 kern_type
= KERN_TYPE_KRB5PA
;
8745 dgst_size
= DGST_SIZE_4_4
;
8746 parse_func
= krb5pa_parse_hash
;
8747 sort_by_digest
= sort_by_digest_4_4
;
8748 opti_type
= OPTI_TYPE_ZERO_BYTE
8749 | OPTI_TYPE_NOT_ITERATED
;
8756 case 7600: hash_type
= HASH_TYPE_SHA1
;
8757 salt_type
= SALT_TYPE_INTERN
;
8758 attack_exec
= ATTACK_EXEC_ON_GPU
;
8759 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8760 | OPTS_TYPE_PT_ADD80
8761 | OPTS_TYPE_PT_ADDBITS15
;
8762 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8763 dgst_size
= DGST_SIZE_4_5
;
8764 parse_func
= redmine_parse_hash
;
8765 sort_by_digest
= sort_by_digest_4_5
;
8766 opti_type
= OPTI_TYPE_ZERO_BYTE
8767 | OPTI_TYPE_PRECOMPUTE_INIT
8768 | OPTI_TYPE_EARLY_SKIP
8769 | OPTI_TYPE_NOT_ITERATED
8770 | OPTI_TYPE_PREPENDED_SALT
;
8777 case 7700: hash_type
= HASH_TYPE_SAPB
;
8778 salt_type
= SALT_TYPE_EMBEDDED
;
8779 attack_exec
= ATTACK_EXEC_ON_GPU
;
8780 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8781 | OPTS_TYPE_PT_UPPER
8782 | OPTS_TYPE_ST_UPPER
;
8783 kern_type
= KERN_TYPE_SAPB
;
8784 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8785 parse_func
= sapb_parse_hash
;
8786 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8787 opti_type
= OPTI_TYPE_ZERO_BYTE
8788 | OPTI_TYPE_PRECOMPUTE_INIT
8789 | OPTI_TYPE_NOT_ITERATED
;
8796 case 7800: hash_type
= HASH_TYPE_SAPG
;
8797 salt_type
= SALT_TYPE_EMBEDDED
;
8798 attack_exec
= ATTACK_EXEC_ON_GPU
;
8799 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8800 | OPTS_TYPE_ST_ADD80
8801 | OPTS_TYPE_ST_UPPER
;
8802 kern_type
= KERN_TYPE_SAPG
;
8803 dgst_size
= DGST_SIZE_4_5
;
8804 parse_func
= sapg_parse_hash
;
8805 sort_by_digest
= sort_by_digest_4_5
;
8806 opti_type
= OPTI_TYPE_ZERO_BYTE
8807 | OPTI_TYPE_PRECOMPUTE_INIT
8808 | OPTI_TYPE_NOT_ITERATED
;
8815 case 7900: hash_type
= HASH_TYPE_SHA512
;
8816 salt_type
= SALT_TYPE_EMBEDDED
;
8817 attack_exec
= ATTACK_EXEC_ON_CPU
;
8818 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8819 kern_type
= KERN_TYPE_DRUPAL7
;
8820 dgst_size
= DGST_SIZE_8_8
;
8821 parse_func
= drupal7_parse_hash
;
8822 sort_by_digest
= sort_by_digest_8_8
;
8823 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8830 case 8000: hash_type
= HASH_TYPE_SHA256
;
8831 salt_type
= SALT_TYPE_EMBEDDED
;
8832 attack_exec
= ATTACK_EXEC_ON_GPU
;
8833 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8834 | OPTS_TYPE_PT_UNICODE
8835 | OPTS_TYPE_ST_ADD80
8837 kern_type
= KERN_TYPE_SYBASEASE
;
8838 dgst_size
= DGST_SIZE_4_8
;
8839 parse_func
= sybasease_parse_hash
;
8840 sort_by_digest
= sort_by_digest_4_8
;
8841 opti_type
= OPTI_TYPE_ZERO_BYTE
8842 | OPTI_TYPE_PRECOMPUTE_INIT
8843 | OPTI_TYPE_EARLY_SKIP
8844 | OPTI_TYPE_NOT_ITERATED
8845 | OPTI_TYPE_RAW_HASH
;
8852 case 8100: hash_type
= HASH_TYPE_SHA1
;
8853 salt_type
= SALT_TYPE_EMBEDDED
;
8854 attack_exec
= ATTACK_EXEC_ON_GPU
;
8855 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8856 kern_type
= KERN_TYPE_NETSCALER
;
8857 dgst_size
= DGST_SIZE_4_5
;
8858 parse_func
= netscaler_parse_hash
;
8859 sort_by_digest
= sort_by_digest_4_5
;
8860 opti_type
= OPTI_TYPE_ZERO_BYTE
8861 | OPTI_TYPE_PRECOMPUTE_INIT
8862 | OPTI_TYPE_PRECOMPUTE_MERKLE
8863 | OPTI_TYPE_EARLY_SKIP
8864 | OPTI_TYPE_NOT_ITERATED
8865 | OPTI_TYPE_PREPENDED_SALT
8866 | OPTI_TYPE_RAW_HASH
;
8873 case 8200: hash_type
= HASH_TYPE_SHA256
;
8874 salt_type
= SALT_TYPE_EMBEDDED
;
8875 attack_exec
= ATTACK_EXEC_ON_CPU
;
8876 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8877 kern_type
= KERN_TYPE_CLOUDKEY
;
8878 dgst_size
= DGST_SIZE_4_8
;
8879 parse_func
= cloudkey_parse_hash
;
8880 sort_by_digest
= sort_by_digest_4_8
;
8881 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8888 case 8300: hash_type
= HASH_TYPE_SHA1
;
8889 salt_type
= SALT_TYPE_EMBEDDED
;
8890 attack_exec
= ATTACK_EXEC_ON_GPU
;
8891 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8893 | OPTS_TYPE_ST_ADD80
;
8894 kern_type
= KERN_TYPE_NSEC3
;
8895 dgst_size
= DGST_SIZE_4_5
;
8896 parse_func
= nsec3_parse_hash
;
8897 sort_by_digest
= sort_by_digest_4_5
;
8898 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8905 case 8400: hash_type
= HASH_TYPE_SHA1
;
8906 salt_type
= SALT_TYPE_INTERN
;
8907 attack_exec
= ATTACK_EXEC_ON_GPU
;
8908 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8909 | OPTS_TYPE_PT_ADD80
8910 | OPTS_TYPE_PT_ADDBITS15
;
8911 kern_type
= KERN_TYPE_WBB3
;
8912 dgst_size
= DGST_SIZE_4_5
;
8913 parse_func
= wbb3_parse_hash
;
8914 sort_by_digest
= sort_by_digest_4_5
;
8915 opti_type
= OPTI_TYPE_ZERO_BYTE
8916 | OPTI_TYPE_PRECOMPUTE_INIT
8917 | OPTI_TYPE_NOT_ITERATED
;
8924 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8925 salt_type
= SALT_TYPE_EMBEDDED
;
8926 attack_exec
= ATTACK_EXEC_ON_GPU
;
8927 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8928 | OPTS_TYPE_ST_UPPER
;
8929 kern_type
= KERN_TYPE_RACF
;
8930 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8931 parse_func
= racf_parse_hash
;
8932 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8933 opti_type
= OPTI_TYPE_ZERO_BYTE
8934 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8941 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8942 salt_type
= SALT_TYPE_NONE
;
8943 attack_exec
= ATTACK_EXEC_ON_GPU
;
8944 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8945 kern_type
= KERN_TYPE_LOTUS5
;
8946 dgst_size
= DGST_SIZE_4_4
;
8947 parse_func
= lotus5_parse_hash
;
8948 sort_by_digest
= sort_by_digest_4_4
;
8949 opti_type
= OPTI_TYPE_EARLY_SKIP
8950 | OPTI_TYPE_NOT_ITERATED
8951 | OPTI_TYPE_NOT_SALTED
8952 | OPTI_TYPE_RAW_HASH
;
8959 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8960 salt_type
= SALT_TYPE_EMBEDDED
;
8961 attack_exec
= ATTACK_EXEC_ON_GPU
;
8962 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8963 kern_type
= KERN_TYPE_LOTUS6
;
8964 dgst_size
= DGST_SIZE_4_4
;
8965 parse_func
= lotus6_parse_hash
;
8966 sort_by_digest
= sort_by_digest_4_4
;
8967 opti_type
= OPTI_TYPE_EARLY_SKIP
8968 | OPTI_TYPE_NOT_ITERATED
8969 | OPTI_TYPE_RAW_HASH
;
8976 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8977 salt_type
= SALT_TYPE_EMBEDDED
;
8978 attack_exec
= ATTACK_EXEC_ON_CPU
;
8979 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8980 kern_type
= KERN_TYPE_ANDROIDFDE
;
8981 dgst_size
= DGST_SIZE_4_4
;
8982 parse_func
= androidfde_parse_hash
;
8983 sort_by_digest
= sort_by_digest_4_4
;
8984 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8991 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8992 salt_type
= SALT_TYPE_EMBEDDED
;
8993 attack_exec
= ATTACK_EXEC_ON_CPU
;
8994 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8995 kern_type
= KERN_TYPE_SCRYPT
;
8996 dgst_size
= DGST_SIZE_4_8
;
8997 parse_func
= scrypt_parse_hash
;
8998 sort_by_digest
= sort_by_digest_4_8
;
8999 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9006 case 9000: hash_type
= HASH_TYPE_SHA1
;
9007 salt_type
= SALT_TYPE_EMBEDDED
;
9008 attack_exec
= ATTACK_EXEC_ON_CPU
;
9009 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9010 | OPTS_TYPE_ST_GENERATE_LE
;
9011 kern_type
= KERN_TYPE_PSAFE2
;
9012 dgst_size
= DGST_SIZE_4_5
;
9013 parse_func
= psafe2_parse_hash
;
9014 sort_by_digest
= sort_by_digest_4_5
;
9015 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9022 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9023 salt_type
= SALT_TYPE_EMBEDDED
;
9024 attack_exec
= ATTACK_EXEC_ON_CPU
;
9025 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9026 kern_type
= KERN_TYPE_LOTUS8
;
9027 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9028 parse_func
= lotus8_parse_hash
;
9029 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9030 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9037 case 9200: hash_type
= HASH_TYPE_SHA256
;
9038 salt_type
= SALT_TYPE_EMBEDDED
;
9039 attack_exec
= ATTACK_EXEC_ON_CPU
;
9040 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9041 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9042 dgst_size
= DGST_SIZE_4_32
;
9043 parse_func
= cisco8_parse_hash
;
9044 sort_by_digest
= sort_by_digest_4_32
;
9045 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9052 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9053 salt_type
= SALT_TYPE_EMBEDDED
;
9054 attack_exec
= ATTACK_EXEC_ON_CPU
;
9055 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9056 kern_type
= KERN_TYPE_SCRYPT
;
9057 dgst_size
= DGST_SIZE_4_8
;
9058 parse_func
= cisco9_parse_hash
;
9059 sort_by_digest
= sort_by_digest_4_8
;
9060 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9067 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9068 salt_type
= SALT_TYPE_EMBEDDED
;
9069 attack_exec
= ATTACK_EXEC_ON_CPU
;
9070 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9071 kern_type
= KERN_TYPE_OFFICE2007
;
9072 dgst_size
= DGST_SIZE_4_4
;
9073 parse_func
= office2007_parse_hash
;
9074 sort_by_digest
= sort_by_digest_4_4
;
9075 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9082 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9083 salt_type
= SALT_TYPE_EMBEDDED
;
9084 attack_exec
= ATTACK_EXEC_ON_CPU
;
9085 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9086 kern_type
= KERN_TYPE_OFFICE2010
;
9087 dgst_size
= DGST_SIZE_4_4
;
9088 parse_func
= office2010_parse_hash
;
9089 sort_by_digest
= sort_by_digest_4_4
;
9090 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9097 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9098 salt_type
= SALT_TYPE_EMBEDDED
;
9099 attack_exec
= ATTACK_EXEC_ON_CPU
;
9100 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9101 kern_type
= KERN_TYPE_OFFICE2013
;
9102 dgst_size
= DGST_SIZE_4_4
;
9103 parse_func
= office2013_parse_hash
;
9104 sort_by_digest
= sort_by_digest_4_4
;
9105 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9112 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9113 salt_type
= SALT_TYPE_EMBEDDED
;
9114 attack_exec
= ATTACK_EXEC_ON_GPU
;
9115 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9116 | OPTS_TYPE_PT_ADD80
9117 | OPTS_TYPE_PT_UNICODE
;
9118 kern_type
= KERN_TYPE_OLDOFFICE01
;
9119 dgst_size
= DGST_SIZE_4_4
;
9120 parse_func
= oldoffice01_parse_hash
;
9121 sort_by_digest
= sort_by_digest_4_4
;
9122 opti_type
= OPTI_TYPE_ZERO_BYTE
9123 | OPTI_TYPE_PRECOMPUTE_INIT
9124 | OPTI_TYPE_NOT_ITERATED
;
9131 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9132 salt_type
= SALT_TYPE_EMBEDDED
;
9133 attack_exec
= ATTACK_EXEC_ON_GPU
;
9134 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9135 | OPTS_TYPE_PT_ADD80
;
9136 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9137 dgst_size
= DGST_SIZE_4_4
;
9138 parse_func
= oldoffice01cm1_parse_hash
;
9139 sort_by_digest
= sort_by_digest_4_4
;
9140 opti_type
= OPTI_TYPE_ZERO_BYTE
9141 | OPTI_TYPE_PRECOMPUTE_INIT
9142 | OPTI_TYPE_NOT_ITERATED
;
9149 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9150 salt_type
= SALT_TYPE_EMBEDDED
;
9151 attack_exec
= ATTACK_EXEC_ON_GPU
;
9152 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9153 | OPTS_TYPE_PT_ADD80
9154 | OPTS_TYPE_PT_UNICODE
9155 | OPTS_TYPE_PT_NEVERCRACK
;
9156 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9157 dgst_size
= DGST_SIZE_4_4
;
9158 parse_func
= oldoffice01cm2_parse_hash
;
9159 sort_by_digest
= sort_by_digest_4_4
;
9160 opti_type
= OPTI_TYPE_ZERO_BYTE
9161 | OPTI_TYPE_PRECOMPUTE_INIT
9162 | OPTI_TYPE_NOT_ITERATED
;
9169 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9170 salt_type
= SALT_TYPE_EMBEDDED
;
9171 attack_exec
= ATTACK_EXEC_ON_GPU
;
9172 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9173 | OPTS_TYPE_PT_ADD80
9174 | OPTS_TYPE_PT_UNICODE
;
9175 kern_type
= KERN_TYPE_OLDOFFICE34
;
9176 dgst_size
= DGST_SIZE_4_4
;
9177 parse_func
= oldoffice34_parse_hash
;
9178 sort_by_digest
= sort_by_digest_4_4
;
9179 opti_type
= OPTI_TYPE_ZERO_BYTE
9180 | OPTI_TYPE_PRECOMPUTE_INIT
9181 | OPTI_TYPE_NOT_ITERATED
;
9188 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9189 salt_type
= SALT_TYPE_EMBEDDED
;
9190 attack_exec
= ATTACK_EXEC_ON_GPU
;
9191 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9192 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9193 dgst_size
= DGST_SIZE_4_4
;
9194 parse_func
= oldoffice34cm1_parse_hash
;
9195 sort_by_digest
= sort_by_digest_4_4
;
9196 opti_type
= OPTI_TYPE_ZERO_BYTE
9197 | OPTI_TYPE_PRECOMPUTE_INIT
9198 | OPTI_TYPE_NOT_ITERATED
;
9205 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9206 salt_type
= SALT_TYPE_EMBEDDED
;
9207 attack_exec
= ATTACK_EXEC_ON_GPU
;
9208 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9209 | OPTS_TYPE_PT_ADD80
9210 | OPTS_TYPE_PT_UNICODE
9211 | OPTS_TYPE_PT_NEVERCRACK
;
9212 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9213 dgst_size
= DGST_SIZE_4_4
;
9214 parse_func
= oldoffice34cm2_parse_hash
;
9215 sort_by_digest
= sort_by_digest_4_4
;
9216 opti_type
= OPTI_TYPE_ZERO_BYTE
9217 | OPTI_TYPE_PRECOMPUTE_INIT
9218 | OPTI_TYPE_NOT_ITERATED
;
9225 case 9900: hash_type
= HASH_TYPE_MD5
;
9226 salt_type
= SALT_TYPE_NONE
;
9227 attack_exec
= ATTACK_EXEC_ON_GPU
;
9228 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9229 kern_type
= KERN_TYPE_RADMIN2
;
9230 dgst_size
= DGST_SIZE_4_4
;
9231 parse_func
= radmin2_parse_hash
;
9232 sort_by_digest
= sort_by_digest_4_4
;
9233 opti_type
= OPTI_TYPE_ZERO_BYTE
9234 | OPTI_TYPE_PRECOMPUTE_INIT
9235 | OPTI_TYPE_EARLY_SKIP
9236 | OPTI_TYPE_NOT_ITERATED
9237 | OPTI_TYPE_NOT_SALTED
;
9244 case 10000: hash_type
= HASH_TYPE_SHA256
;
9245 salt_type
= SALT_TYPE_EMBEDDED
;
9246 attack_exec
= ATTACK_EXEC_ON_CPU
;
9247 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9248 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9249 dgst_size
= DGST_SIZE_4_32
;
9250 parse_func
= djangopbkdf2_parse_hash
;
9251 sort_by_digest
= sort_by_digest_4_32
;
9252 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9259 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9260 salt_type
= SALT_TYPE_EMBEDDED
;
9261 attack_exec
= ATTACK_EXEC_ON_GPU
;
9262 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9263 kern_type
= KERN_TYPE_SIPHASH
;
9264 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9265 parse_func
= siphash_parse_hash
;
9266 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9267 opti_type
= OPTI_TYPE_ZERO_BYTE
9268 | OPTI_TYPE_NOT_ITERATED
9269 | OPTI_TYPE_RAW_HASH
;
9276 case 10200: hash_type
= HASH_TYPE_MD5
;
9277 salt_type
= SALT_TYPE_EMBEDDED
;
9278 attack_exec
= ATTACK_EXEC_ON_GPU
;
9279 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9280 | OPTS_TYPE_ST_ADD80
9281 | OPTS_TYPE_ST_ADDBITS14
;
9282 kern_type
= KERN_TYPE_HMACMD5_PW
;
9283 dgst_size
= DGST_SIZE_4_4
;
9284 parse_func
= crammd5_parse_hash
;
9285 sort_by_digest
= sort_by_digest_4_4
;
9286 opti_type
= OPTI_TYPE_ZERO_BYTE
9287 | OPTI_TYPE_NOT_ITERATED
;
9294 case 10300: hash_type
= HASH_TYPE_SHA1
;
9295 salt_type
= SALT_TYPE_EMBEDDED
;
9296 attack_exec
= ATTACK_EXEC_ON_CPU
;
9297 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9298 kern_type
= KERN_TYPE_SAPH_SHA1
;
9299 dgst_size
= DGST_SIZE_4_5
;
9300 parse_func
= saph_sha1_parse_hash
;
9301 sort_by_digest
= sort_by_digest_4_5
;
9302 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9309 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9310 salt_type
= SALT_TYPE_EMBEDDED
;
9311 attack_exec
= ATTACK_EXEC_ON_GPU
;
9312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9313 kern_type
= KERN_TYPE_PDF11
;
9314 dgst_size
= DGST_SIZE_4_4
;
9315 parse_func
= pdf11_parse_hash
;
9316 sort_by_digest
= sort_by_digest_4_4
;
9317 opti_type
= OPTI_TYPE_ZERO_BYTE
9318 | OPTI_TYPE_NOT_ITERATED
;
9325 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9326 salt_type
= SALT_TYPE_EMBEDDED
;
9327 attack_exec
= ATTACK_EXEC_ON_GPU
;
9328 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9329 kern_type
= KERN_TYPE_PDF11CM1
;
9330 dgst_size
= DGST_SIZE_4_4
;
9331 parse_func
= pdf11cm1_parse_hash
;
9332 sort_by_digest
= sort_by_digest_4_4
;
9333 opti_type
= OPTI_TYPE_ZERO_BYTE
9334 | OPTI_TYPE_NOT_ITERATED
;
9341 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9342 salt_type
= SALT_TYPE_EMBEDDED
;
9343 attack_exec
= ATTACK_EXEC_ON_GPU
;
9344 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9345 kern_type
= KERN_TYPE_PDF11CM2
;
9346 dgst_size
= DGST_SIZE_4_4
;
9347 parse_func
= pdf11cm2_parse_hash
;
9348 sort_by_digest
= sort_by_digest_4_4
;
9349 opti_type
= OPTI_TYPE_ZERO_BYTE
9350 | OPTI_TYPE_NOT_ITERATED
;
9357 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9358 salt_type
= SALT_TYPE_EMBEDDED
;
9359 attack_exec
= ATTACK_EXEC_ON_CPU
;
9360 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9361 kern_type
= KERN_TYPE_PDF14
;
9362 dgst_size
= DGST_SIZE_4_4
;
9363 parse_func
= pdf14_parse_hash
;
9364 sort_by_digest
= sort_by_digest_4_4
;
9365 opti_type
= OPTI_TYPE_ZERO_BYTE
9366 | OPTI_TYPE_NOT_ITERATED
;
9373 case 10600: hash_type
= HASH_TYPE_SHA256
;
9374 salt_type
= SALT_TYPE_EMBEDDED
;
9375 attack_exec
= ATTACK_EXEC_ON_GPU
;
9376 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9377 | OPTS_TYPE_ST_ADD80
9378 | OPTS_TYPE_ST_ADDBITS15
9379 | OPTS_TYPE_HASH_COPY
;
9380 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9381 dgst_size
= DGST_SIZE_4_8
;
9382 parse_func
= pdf17l3_parse_hash
;
9383 sort_by_digest
= sort_by_digest_4_8
;
9384 opti_type
= OPTI_TYPE_ZERO_BYTE
9385 | OPTI_TYPE_PRECOMPUTE_INIT
9386 | OPTI_TYPE_PRECOMPUTE_MERKLE
9387 | OPTI_TYPE_EARLY_SKIP
9388 | OPTI_TYPE_NOT_ITERATED
9389 | OPTI_TYPE_APPENDED_SALT
9390 | OPTI_TYPE_RAW_HASH
;
9397 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9398 salt_type
= SALT_TYPE_EMBEDDED
;
9399 attack_exec
= ATTACK_EXEC_ON_CPU
;
9400 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9401 | OPTS_TYPE_HASH_COPY
;
9402 kern_type
= KERN_TYPE_PDF17L8
;
9403 dgst_size
= DGST_SIZE_4_8
;
9404 parse_func
= pdf17l8_parse_hash
;
9405 sort_by_digest
= sort_by_digest_4_8
;
9406 opti_type
= OPTI_TYPE_ZERO_BYTE
9407 | OPTI_TYPE_NOT_ITERATED
;
9414 case 10800: hash_type
= HASH_TYPE_SHA384
;
9415 salt_type
= SALT_TYPE_NONE
;
9416 attack_exec
= ATTACK_EXEC_ON_GPU
;
9417 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9418 | OPTS_TYPE_PT_ADD80
9419 | OPTS_TYPE_PT_ADDBITS15
;
9420 kern_type
= KERN_TYPE_SHA384
;
9421 dgst_size
= DGST_SIZE_8_8
;
9422 parse_func
= sha384_parse_hash
;
9423 sort_by_digest
= sort_by_digest_8_8
;
9424 opti_type
= OPTI_TYPE_ZERO_BYTE
9425 | OPTI_TYPE_PRECOMPUTE_INIT
9426 | OPTI_TYPE_PRECOMPUTE_MERKLE
9427 | OPTI_TYPE_EARLY_SKIP
9428 | OPTI_TYPE_NOT_ITERATED
9429 | OPTI_TYPE_NOT_SALTED
9430 | OPTI_TYPE_RAW_HASH
;
9437 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9438 salt_type
= SALT_TYPE_EMBEDDED
;
9439 attack_exec
= ATTACK_EXEC_ON_CPU
;
9440 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9441 | OPTS_TYPE_ST_BASE64
9442 | OPTS_TYPE_HASH_COPY
;
9443 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9444 dgst_size
= DGST_SIZE_4_32
;
9445 parse_func
= pbkdf2_sha256_parse_hash
;
9446 sort_by_digest
= sort_by_digest_4_32
;
9447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9454 case 11000: hash_type
= HASH_TYPE_MD5
;
9455 salt_type
= SALT_TYPE_INTERN
;
9456 attack_exec
= ATTACK_EXEC_ON_GPU
;
9457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9458 | OPTS_TYPE_PT_ADD80
;
9459 kern_type
= KERN_TYPE_PRESTASHOP
;
9460 dgst_size
= DGST_SIZE_4_4
;
9461 parse_func
= prestashop_parse_hash
;
9462 sort_by_digest
= sort_by_digest_4_4
;
9463 opti_type
= OPTI_TYPE_ZERO_BYTE
9464 | OPTI_TYPE_PRECOMPUTE_INIT
9465 | OPTI_TYPE_NOT_ITERATED
9466 | OPTI_TYPE_PREPENDED_SALT
;
9473 case 11100: hash_type
= HASH_TYPE_MD5
;
9474 salt_type
= SALT_TYPE_EMBEDDED
;
9475 attack_exec
= ATTACK_EXEC_ON_GPU
;
9476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9477 | OPTS_TYPE_ST_ADD80
;
9478 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9479 dgst_size
= DGST_SIZE_4_4
;
9480 parse_func
= postgresql_auth_parse_hash
;
9481 sort_by_digest
= sort_by_digest_4_4
;
9482 opti_type
= OPTI_TYPE_ZERO_BYTE
9483 | OPTI_TYPE_PRECOMPUTE_INIT
9484 | OPTI_TYPE_PRECOMPUTE_MERKLE
9485 | OPTI_TYPE_EARLY_SKIP
;
9492 case 11200: hash_type
= HASH_TYPE_SHA1
;
9493 salt_type
= SALT_TYPE_EMBEDDED
;
9494 attack_exec
= ATTACK_EXEC_ON_GPU
;
9495 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9496 | OPTS_TYPE_PT_ADD80
9498 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9499 dgst_size
= DGST_SIZE_4_5
;
9500 parse_func
= mysql_auth_parse_hash
;
9501 sort_by_digest
= sort_by_digest_4_5
;
9502 opti_type
= OPTI_TYPE_ZERO_BYTE
9503 | OPTI_TYPE_EARLY_SKIP
;
9510 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9511 salt_type
= SALT_TYPE_EMBEDDED
;
9512 attack_exec
= ATTACK_EXEC_ON_CPU
;
9513 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9515 | OPTS_TYPE_ST_ADD80
;
9516 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9517 dgst_size
= DGST_SIZE_4_4
;
9518 parse_func
= bitcoin_wallet_parse_hash
;
9519 sort_by_digest
= sort_by_digest_4_4
;
9520 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9527 case 11400: hash_type
= HASH_TYPE_MD5
;
9528 salt_type
= SALT_TYPE_EMBEDDED
;
9529 attack_exec
= ATTACK_EXEC_ON_GPU
;
9530 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9531 | OPTS_TYPE_PT_ADD80
9532 | OPTS_TYPE_HASH_COPY
;
9533 kern_type
= KERN_TYPE_SIP_AUTH
;
9534 dgst_size
= DGST_SIZE_4_4
;
9535 parse_func
= sip_auth_parse_hash
;
9536 sort_by_digest
= sort_by_digest_4_4
;
9537 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9544 case 11500: hash_type
= HASH_TYPE_CRC32
;
9545 salt_type
= SALT_TYPE_INTERN
;
9546 attack_exec
= ATTACK_EXEC_ON_GPU
;
9547 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9548 | OPTS_TYPE_ST_GENERATE_LE
9550 kern_type
= KERN_TYPE_CRC32
;
9551 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9552 parse_func
= crc32_parse_hash
;
9553 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9554 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9561 case 11600: hash_type
= HASH_TYPE_AES
;
9562 salt_type
= SALT_TYPE_EMBEDDED
;
9563 attack_exec
= ATTACK_EXEC_ON_CPU
;
9564 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9565 | OPTS_TYPE_PT_NEVERCRACK
;
9566 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9567 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9568 parse_func
= seven_zip_parse_hash
;
9569 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9570 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9577 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9578 salt_type
= SALT_TYPE_NONE
;
9579 attack_exec
= ATTACK_EXEC_ON_GPU
;
9580 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9581 | OPTS_TYPE_PT_ADD01
;
9582 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9583 dgst_size
= DGST_SIZE_4_8
;
9584 parse_func
= gost2012sbog_256_parse_hash
;
9585 sort_by_digest
= sort_by_digest_4_8
;
9586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9593 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9594 salt_type
= SALT_TYPE_NONE
;
9595 attack_exec
= ATTACK_EXEC_ON_GPU
;
9596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9597 | OPTS_TYPE_PT_ADD01
;
9598 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9599 dgst_size
= DGST_SIZE_4_16
;
9600 parse_func
= gost2012sbog_512_parse_hash
;
9601 sort_by_digest
= sort_by_digest_4_16
;
9602 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9609 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9610 salt_type
= SALT_TYPE_EMBEDDED
;
9611 attack_exec
= ATTACK_EXEC_ON_CPU
;
9612 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9613 | OPTS_TYPE_ST_BASE64
9614 | OPTS_TYPE_HASH_COPY
;
9615 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9616 dgst_size
= DGST_SIZE_4_32
;
9617 parse_func
= pbkdf2_md5_parse_hash
;
9618 sort_by_digest
= sort_by_digest_4_32
;
9619 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9626 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9627 salt_type
= SALT_TYPE_EMBEDDED
;
9628 attack_exec
= ATTACK_EXEC_ON_CPU
;
9629 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9630 | OPTS_TYPE_ST_BASE64
9631 | OPTS_TYPE_HASH_COPY
;
9632 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9633 dgst_size
= DGST_SIZE_4_32
;
9634 parse_func
= pbkdf2_sha1_parse_hash
;
9635 sort_by_digest
= sort_by_digest_4_32
;
9636 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9643 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9644 salt_type
= SALT_TYPE_EMBEDDED
;
9645 attack_exec
= ATTACK_EXEC_ON_CPU
;
9646 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9647 | OPTS_TYPE_ST_BASE64
9648 | OPTS_TYPE_HASH_COPY
;
9649 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9650 dgst_size
= DGST_SIZE_8_16
;
9651 parse_func
= pbkdf2_sha512_parse_hash
;
9652 sort_by_digest
= sort_by_digest_8_16
;
9653 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9660 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9661 salt_type
= SALT_TYPE_EMBEDDED
;
9662 attack_exec
= ATTACK_EXEC_ON_CPU
;
9663 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9664 kern_type
= KERN_TYPE_ECRYPTFS
;
9665 dgst_size
= DGST_SIZE_8_8
;
9666 parse_func
= ecryptfs_parse_hash
;
9667 sort_by_digest
= sort_by_digest_8_8
;
9668 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9675 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9676 salt_type
= SALT_TYPE_EMBEDDED
;
9677 attack_exec
= ATTACK_EXEC_ON_CPU
;
9678 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9679 kern_type
= KERN_TYPE_ORACLET
;
9680 dgst_size
= DGST_SIZE_8_16
;
9681 parse_func
= oraclet_parse_hash
;
9682 sort_by_digest
= sort_by_digest_8_16
;
9683 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9690 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9691 salt_type
= SALT_TYPE_EMBEDDED
;
9692 attack_exec
= ATTACK_EXEC_ON_CPU
;
9693 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9694 kern_type
= KERN_TYPE_BSDICRYPT
;
9695 dgst_size
= DGST_SIZE_4_4
;
9696 parse_func
= bsdicrypt_parse_hash
;
9697 sort_by_digest
= sort_by_digest_4_4
;
9698 opti_type
= OPTI_TYPE_ZERO_BYTE
9699 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9706 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9707 salt_type
= SALT_TYPE_EMBEDDED
;
9708 attack_exec
= ATTACK_EXEC_ON_CPU
;
9709 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9710 kern_type
= KERN_TYPE_RAR3
;
9711 dgst_size
= DGST_SIZE_4_4
;
9712 parse_func
= rar3hp_parse_hash
;
9713 sort_by_digest
= sort_by_digest_4_4
;
9714 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9721 case 12600: hash_type
= HASH_TYPE_SHA256
;
9722 salt_type
= SALT_TYPE_INTERN
;
9723 attack_exec
= ATTACK_EXEC_ON_GPU
;
9724 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9725 | OPTS_TYPE_PT_ADD80
;
9726 kern_type
= KERN_TYPE_CF10
;
9727 dgst_size
= DGST_SIZE_4_8
;
9728 parse_func
= cf10_parse_hash
;
9729 sort_by_digest
= sort_by_digest_4_8
;
9730 opti_type
= OPTI_TYPE_ZERO_BYTE
9731 | OPTI_TYPE_PRECOMPUTE_INIT
9732 | OPTI_TYPE_EARLY_SKIP
9733 | OPTI_TYPE_NOT_ITERATED
;
9740 case 12700: hash_type
= HASH_TYPE_AES
;
9741 salt_type
= SALT_TYPE_EMBEDDED
;
9742 attack_exec
= ATTACK_EXEC_ON_CPU
;
9743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9744 | OPTS_TYPE_HASH_COPY
;
9745 kern_type
= KERN_TYPE_MYWALLET
;
9746 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9747 parse_func
= mywallet_parse_hash
;
9748 sort_by_digest
= sort_by_digest_4_5
;
9749 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9756 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9757 salt_type
= SALT_TYPE_EMBEDDED
;
9758 attack_exec
= ATTACK_EXEC_ON_CPU
;
9759 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9760 kern_type
= KERN_TYPE_MS_DRSR
;
9761 dgst_size
= DGST_SIZE_4_8
;
9762 parse_func
= ms_drsr_parse_hash
;
9763 sort_by_digest
= sort_by_digest_4_8
;
9764 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9771 default: usage_mini_print (PROGNAME
); return (-1);
9778 data
.parse_func
= parse_func
;
9786 if (salt_type
== SALT_TYPE_INTERN
)
9788 opts_type
|= OPTS_TYPE_ST_HEX
;
9792 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9798 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9799 | (salt_type
== SALT_TYPE_EXTERN
)
9800 | (salt_type
== SALT_TYPE_EMBEDDED
)
9801 | (salt_type
== SALT_TYPE_VIRTUAL
));
9803 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9805 data
.hash_type
= hash_type
;
9806 data
.attack_mode
= attack_mode
;
9807 data
.attack_kern
= attack_kern
;
9808 data
.attack_exec
= attack_exec
;
9809 data
.kern_type
= kern_type
;
9810 data
.opts_type
= opts_type
;
9811 data
.dgst_size
= dgst_size
;
9812 data
.salt_type
= salt_type
;
9813 data
.isSalted
= isSalted
;
9814 data
.sort_by_digest
= sort_by_digest
;
9815 data
.dgst_pos0
= dgst_pos0
;
9816 data
.dgst_pos1
= dgst_pos1
;
9817 data
.dgst_pos2
= dgst_pos2
;
9818 data
.dgst_pos3
= dgst_pos3
;
9824 case 2500: esalt_size
= sizeof (wpa_t
); break;
9825 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9826 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9827 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9828 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9840 case 6243: esalt_size
= sizeof (tc_t
); break;
9841 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9842 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9843 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9844 case 7300: esalt_size
= sizeof (rakp_t
); break;
9845 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9846 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9847 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9848 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9849 case 9400: esalt_size
= sizeof (office2007_t
); break;
9850 case 9500: esalt_size
= sizeof (office2010_t
); break;
9851 case 9600: esalt_size
= sizeof (office2013_t
); break;
9852 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9853 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9854 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9855 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9856 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9857 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9858 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9859 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9860 case 10400: esalt_size
= sizeof (pdf_t
); break;
9861 case 10410: esalt_size
= sizeof (pdf_t
); break;
9862 case 10420: esalt_size
= sizeof (pdf_t
); break;
9863 case 10500: esalt_size
= sizeof (pdf_t
); break;
9864 case 10600: esalt_size
= sizeof (pdf_t
); break;
9865 case 10700: esalt_size
= sizeof (pdf_t
); break;
9866 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9867 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9868 case 11400: esalt_size
= sizeof (sip_t
); break;
9869 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9870 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9871 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9872 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9875 data
.esalt_size
= esalt_size
;
9878 * choose dictionary parser
9881 if (hash_type
== HASH_TYPE_LM
)
9883 get_next_word_func
= get_next_word_lm
;
9885 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9887 get_next_word_func
= get_next_word_uc
;
9891 get_next_word_func
= get_next_word_std
;
9898 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9901 size_t dictstat_nmemb
= 0;
9905 uint dictstat_nmemb
= 0;
9910 FILE *dictstat_fp
= NULL
;
9914 memset (dictstat
, 0, sizeof (dictstat
));
9916 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/hashcat.dictstat", profile_dir
);
9918 dictstat_fp
= fopen (dictstat
, "rb");
9923 struct stat tmpstat
;
9925 fstat (fileno (dictstat_fp
), &tmpstat
);
9929 struct stat64 tmpstat
;
9931 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9934 if (tmpstat
.st_mtime
< COMPTIME
)
9936 /* with v0.15 the format changed so we have to ensure user is using a good version
9937 since there is no version-header in the dictstat file */
9939 fclose (dictstat_fp
);
9945 while (!feof (dictstat_fp
))
9949 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9951 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9953 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9955 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9961 fclose (dictstat_fp
);
9972 memset (potfile
, 0, sizeof (potfile
));
9974 snprintf (potfile
, sizeof (potfile
) - 1, "%s/%s.pot", session_dir
, session
);
9978 FILE *out_fp
= NULL
;
9979 FILE *pot_fp
= NULL
;
9981 if (show
== 1 || left
== 1)
9983 pot_fp
= fopen (potfile
, "rb");
9987 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9992 if (outfile
!= NULL
)
9994 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9996 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
10010 if (potfile_disable
== 0)
10012 pot_fp
= fopen (potfile
, "ab");
10014 if (pot_fp
== NULL
)
10016 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10021 data
.pot_fp
= pot_fp
;
10028 uint pot_avail
= 0;
10030 if (show
== 1 || left
== 1)
10032 SUPPRESS_OUTPUT
= 1;
10034 pot_avail
= count_lines (pot_fp
);
10038 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
10040 uint pot_hashes_avail
= 0;
10044 while (!feof (pot_fp
))
10048 char line_buf
[BUFSIZ
];
10050 int line_len
= fgetl (pot_fp
, line_buf
);
10052 if (line_len
== 0) continue;
10054 char *plain_buf
= line_buf
+ line_len
;
10056 pot_t
*pot_ptr
= &pot
[pot_cnt
];
10058 hash_t
*hashes_buf
= &pot_ptr
->hash
;
10060 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
10061 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
10063 if (pot_cnt
== pot_hashes_avail
)
10067 for (pos
= 0; pos
< INCR_POT
; pos
++)
10069 if ((pot_cnt
+ pos
) >= pot_avail
) break;
10071 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
10073 hash_t
*tmp_hash
= &tmp_pot
->hash
;
10075 tmp_hash
->digest
= mymalloc (dgst_size
);
10079 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
10084 tmp_hash
->esalt
= mymalloc (esalt_size
);
10087 pot_hashes_avail
++;
10095 int iter
= MAX_CUT_TRIES
;
10099 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10101 if (line_buf
[i
] == ':')
10109 if (data
.hash_mode
!= 2500)
10111 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10115 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10117 if (line_len
> max_salt_size
)
10119 parser_status
= PARSER_GLOBAL_LENGTH
;
10123 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10125 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10127 hashes_buf
->salt
->salt_len
= line_len
;
10129 parser_status
= PARSER_OK
;
10133 // if NOT parsed without error, we add the ":" to the plain
10135 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10141 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10143 if (parser_status
< PARSER_GLOBAL_ZERO
)
10145 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10150 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10152 pot_ptr
->plain_len
= plain_len
;
10159 SUPPRESS_OUTPUT
= 0;
10161 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10165 * gpu accel and loops auto adjustment
10168 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10169 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10171 if (workload_profile
== 1)
10176 if (gpu_loops
== 0) gpu_loops
= 8;
10177 if (gpu_accel
== 0) gpu_accel
= 2;
10179 else if (workload_profile
== 3)
10184 if (gpu_loops
> 1024) gpu_loops
= 1024;
10185 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10188 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10190 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10195 if (hash_mode
== 12500)
10197 gpu_loops
= ROUNDS_RAR3
/ 16;
10200 data
.gpu_accel
= gpu_accel
;
10201 data
.gpu_loops
= gpu_loops
;
10207 uint pw_min
= PW_MIN
;
10208 uint pw_max
= PW_MAX
;
10212 case 400: if (pw_max
> 40) pw_max
= 40;
10214 case 500: if (pw_max
> 16) pw_max
= 16;
10216 case 1500: if (pw_max
> 8) pw_max
= 8;
10218 case 1600: if (pw_max
> 16) pw_max
= 16;
10220 case 1800: if (pw_max
> 16) pw_max
= 16;
10222 case 2100: if (pw_max
> 16) pw_max
= 16;
10224 case 2500: if (pw_min
< 8) pw_min
= 8;
10226 case 3000: if (pw_max
> 7) pw_max
= 7;
10228 case 5200: if (pw_max
> 24) pw_max
= 24;
10230 case 5800: if (pw_max
> 16) pw_max
= 16;
10232 case 6300: if (pw_max
> 16) pw_max
= 16;
10234 case 7400: if (pw_max
> 16) pw_max
= 16;
10236 case 7900: if (pw_max
> 48) pw_max
= 48;
10238 case 8500: if (pw_max
> 8) pw_max
= 8;
10240 case 8600: if (pw_max
> 16) pw_max
= 16;
10242 case 9710: pw_min
= 5;
10245 case 9810: pw_min
= 5;
10248 case 10410: pw_min
= 5;
10251 case 10300: if (pw_max
< 3) pw_min
= 3;
10252 if (pw_max
> 40) pw_max
= 40;
10254 case 10500: if (pw_max
< 3) pw_min
= 3;
10255 if (pw_max
> 40) pw_max
= 40;
10257 case 10700: if (pw_max
> 16) pw_max
= 16;
10259 case 11300: if (pw_max
> 40) pw_max
= 40;
10261 case 12500: if (pw_max
> 20) pw_max
= 20;
10263 case 12800: if (pw_max
> 24) pw_max
= 24;
10267 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10269 switch (attack_kern
)
10271 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10273 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10279 * charsets : keep them together for more easy maintainnce
10285 memset (mp_sys
, 0, sizeof (mp_sys
));
10286 memset (mp_usr
, 0, sizeof (mp_usr
));
10288 mp_setup_sys (mp_sys
);
10290 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10291 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10292 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10293 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10296 * load hashes, part I: find input mode, count hashes
10299 uint hashlist_mode
= 0;
10300 uint hashlist_format
= HLFMT_HASHCAT
;
10302 uint hashes_avail
= 0;
10304 if (benchmark
== 0)
10308 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10310 if ((hash_mode
== 2500) ||
10311 (hash_mode
== 5200) ||
10312 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10313 (hash_mode
== 9000))
10315 hashlist_mode
= HL_MODE_ARG
;
10317 char *hashfile
= myargv
[optind
];
10319 data
.hashfile
= hashfile
;
10321 logfile_top_var_string ("target", hashfile
);
10324 if (hashlist_mode
== HL_MODE_ARG
)
10326 if (hash_mode
== 2500)
10330 if (stat (data
.hashfile
, &st
) == -1)
10332 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10337 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10344 else if (hashlist_mode
== HL_MODE_FILE
)
10346 char *hashfile
= myargv
[optind
];
10348 data
.hashfile
= hashfile
;
10350 logfile_top_var_string ("target", hashfile
);
10354 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10356 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10361 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10363 hashes_avail
= count_lines (fp
);
10367 if (hashes_avail
== 0)
10369 log_error ("ERROR: hashfile is empty or corrupt");
10376 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10378 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10380 log_error ("ERROR: remove not supported in native hashfile-format mode");
10392 hashlist_mode
= HL_MODE_ARG
;
10397 if (hash_mode
== 3000) hashes_avail
*= 2;
10399 data
.hashlist_mode
= hashlist_mode
;
10400 data
.hashlist_format
= hashlist_format
;
10402 logfile_top_uint (hashlist_mode
);
10403 logfile_top_uint (hashlist_format
);
10406 * load hashes, part II: allocate required memory, set pointers
10409 hash_t
*hashes_buf
= NULL
;
10410 void *digests_buf
= NULL
;
10411 salt_t
*salts_buf
= NULL
;
10412 void *esalts_buf
= NULL
;
10414 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10416 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10418 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10422 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10424 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10426 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10428 if (username
&& (remove
|| show
|| left
))
10430 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10435 hash_info
->orighash
= (char *) mymalloc (256);
10442 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10446 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10451 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10454 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10456 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10460 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10464 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10469 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10474 * load hashes, part III: parse hashes or generate them if benchmark
10477 uint hashes_cnt
= 0;
10479 if (benchmark
== 0)
10483 // useless to read hash file for keyspace, cheat a little bit w/ optind
10485 else if (hashes_avail
== 0)
10488 else if (hashlist_mode
== HL_MODE_ARG
)
10490 char *input_buf
= myargv
[optind
];
10492 uint input_len
= strlen (input_buf
);
10494 logfile_top_var_string ("target", input_buf
);
10496 char *hash_buf
= NULL
;
10499 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10503 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10505 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10507 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10512 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10515 int parser_status
= PARSER_OK
;
10517 if (hash_mode
== 2500)
10521 log_error ("ERROR: hccap file not specified");
10526 hashlist_mode
= HL_MODE_FILE
;
10528 data
.hashlist_mode
= hashlist_mode
;
10530 FILE *fp
= fopen (hash_buf
, "rb");
10534 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10539 if (hashes_avail
< 1)
10541 log_error ("ERROR: hccap file is empty or corrupt");
10548 uint hccap_size
= sizeof (hccap_t
);
10550 char in
[hccap_size
];
10554 int n
= fread (&in
, hccap_size
, 1, fp
);
10558 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10563 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10565 if (parser_status
!= PARSER_OK
)
10567 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10572 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10574 if ((show
== 1) || (left
== 1))
10576 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10578 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10580 int cur_pos
= tmp_salt
->salt_len
;
10581 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10583 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10585 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10587 // do the appending task
10589 snprintf (salt_ptr
+ cur_pos
,
10591 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10592 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10593 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10596 // memset () the remaining part of the salt
10598 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10599 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10601 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10603 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10606 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
);
10607 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
);
10614 else if (hash_mode
== 3000)
10616 if (hash_len
== 32)
10618 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10620 hash_t
*lm_hash_left
= NULL
;
10622 if (parser_status
== PARSER_OK
)
10624 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10630 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10634 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10636 hash_t
*lm_hash_right
= NULL
;
10638 if (parser_status
== PARSER_OK
)
10640 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10646 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10651 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10653 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
);
10654 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
);
10659 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10661 if (parser_status
== PARSER_OK
)
10663 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10664 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10667 if (parser_status
== PARSER_OK
)
10673 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10679 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10681 if (parser_status
== PARSER_OK
)
10683 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10684 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10687 if (parser_status
== PARSER_OK
)
10693 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10698 else if (hashlist_mode
== HL_MODE_FILE
)
10700 char *hashfile
= data
.hashfile
;
10704 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10706 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10717 char line_buf
[BUFSIZ
];
10719 int line_len
= fgetl (fp
, line_buf
);
10721 if (line_len
== 0) continue;
10723 char *hash_buf
= NULL
;
10726 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10730 char *user_buf
= NULL
;
10733 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10735 if (remove
|| show
)
10737 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10739 *user
= (user_t
*) malloc (sizeof (user_t
));
10741 user_t
*user_ptr
= *user
;
10743 if (user_buf
!= NULL
)
10745 user_ptr
->user_name
= mystrdup (user_buf
);
10749 user_ptr
->user_name
= mystrdup ("");
10752 user_ptr
->user_len
= user_len
;
10756 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10758 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10760 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10765 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10768 if (hash_mode
== 3000)
10770 if (hash_len
== 32)
10772 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10774 if (parser_status
< PARSER_GLOBAL_ZERO
)
10776 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10781 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10785 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10787 if (parser_status
< PARSER_GLOBAL_ZERO
)
10789 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10794 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10796 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);
10802 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
);
10803 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
);
10807 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10809 if (parser_status
< PARSER_GLOBAL_ZERO
)
10811 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10816 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);
10818 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10819 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10826 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10828 if (parser_status
< PARSER_GLOBAL_ZERO
)
10830 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10835 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);
10837 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10838 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10846 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10848 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10855 hashes_buf
[0].salt
->salt_len
= 8;
10857 // special salt handling
10861 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10863 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10865 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10867 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10869 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10871 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10873 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10875 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10877 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10879 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10881 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10882 hashes_buf
[0].salt
->scrypt_N
= 1024;
10883 hashes_buf
[0].salt
->scrypt_r
= 1;
10884 hashes_buf
[0].salt
->scrypt_p
= 1;
10886 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10888 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10889 hashes_buf
[0].salt
->scrypt_N
= 16384;
10890 hashes_buf
[0].salt
->scrypt_r
= 1;
10891 hashes_buf
[0].salt
->scrypt_p
= 1;
10893 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10895 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10897 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10899 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10901 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10903 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10905 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10907 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10909 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10911 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10913 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10915 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10917 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10919 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10921 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10925 // special esalt handling
10929 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10931 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10932 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10934 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10935 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10937 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10938 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10939 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10940 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10942 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10943 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10944 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10945 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10947 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10949 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10950 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10951 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10953 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10954 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10955 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10957 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10958 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10959 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10961 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10962 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10963 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10965 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10966 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10967 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10969 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10970 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10971 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10973 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10974 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10975 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10984 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10986 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10988 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
11001 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
11003 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
11005 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
11007 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
11011 // set default iterations
11015 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
11017 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11019 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11021 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11023 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
11025 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
11027 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
11029 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
11031 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
11033 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
11037 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
11041 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11045 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11049 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11051 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11053 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
11055 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
11057 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
11059 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
11061 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
11063 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
11065 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
11067 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
11069 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
11071 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
11073 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
11075 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
11077 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
11079 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
11081 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
11083 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
11085 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
11087 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
11089 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
11091 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11093 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11095 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11097 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11099 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11101 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11103 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11105 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11107 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11109 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11111 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11113 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11115 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11117 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11119 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11121 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11123 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11127 // set special tuning for benchmark-mode 1
11129 if (benchmark_mode
== 1)
11136 case 400: gpu_loops
= ROUNDS_PHPASS
;
11139 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11142 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11145 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11148 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11151 case 2100: gpu_loops
= ROUNDS_DCC2
;
11154 case 2500: gpu_loops
= ROUNDS_WPA2
;
11157 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11160 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11163 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11166 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11169 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11172 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11175 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11178 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11181 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11184 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11187 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11190 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11193 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11196 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11199 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11202 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11205 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11208 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11211 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11214 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11217 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11220 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11223 case 7200: gpu_loops
= ROUNDS_GRUB
;
11226 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11229 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11232 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11235 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11238 case 8900: gpu_loops
= 1;
11241 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11244 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11247 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11250 case 9300: gpu_loops
= 1;
11253 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11256 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11259 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11262 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11265 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11268 case 10500: gpu_loops
= ROUNDS_PDF14
;
11271 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11274 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11277 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11280 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11283 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11286 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11289 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11292 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11295 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11298 case 12500: gpu_loops
= ROUNDS_RAR3
;
11301 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11304 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11309 // some algorithm collide too fast, make that impossible
11313 case 11500: ((uint
*) digests_buf
)[1] = 1;
11317 if (gpu_loops
> 1024) gpu_loops
= 1024;
11318 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11321 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11326 if (hash_mode
== 12500)
11328 gpu_loops
= ROUNDS_RAR3
/ 16;
11331 data
.gpu_accel
= gpu_accel
;
11332 data
.gpu_loops
= gpu_loops
;
11337 if (show
== 1 || left
== 1)
11339 for (uint i
= 0; i
< pot_cnt
; i
++)
11341 pot_t
*pot_ptr
= &pot
[i
];
11343 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11345 local_free (hashes_buf
->digest
);
11349 local_free (hashes_buf
->salt
);
11355 if (data
.quiet
== 0) log_info_nn ("");
11362 if (hashes_cnt
== 0)
11364 log_error ("ERROR: No hashes loaded");
11371 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11374 if (data
.outfile
!= NULL
)
11376 if (data
.hashfile
!= NULL
)
11379 struct stat tmpstat_outfile
;
11380 struct stat tmpstat_hashfile
;
11384 struct stat64 tmpstat_outfile
;
11385 struct stat64 tmpstat_hashfile
;
11388 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11390 if (tmp_outfile_fp
)
11393 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11397 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11400 fclose (tmp_outfile_fp
);
11403 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11405 if (tmp_hashfile_fp
)
11408 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11412 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11415 fclose (tmp_hashfile_fp
);
11418 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11420 tmpstat_outfile
.st_mode
= 0;
11421 tmpstat_outfile
.st_nlink
= 0;
11422 tmpstat_outfile
.st_uid
= 0;
11423 tmpstat_outfile
.st_gid
= 0;
11424 tmpstat_outfile
.st_rdev
= 0;
11425 tmpstat_outfile
.st_atime
= 0;
11427 tmpstat_hashfile
.st_mode
= 0;
11428 tmpstat_hashfile
.st_nlink
= 0;
11429 tmpstat_hashfile
.st_uid
= 0;
11430 tmpstat_hashfile
.st_gid
= 0;
11431 tmpstat_hashfile
.st_rdev
= 0;
11432 tmpstat_hashfile
.st_atime
= 0;
11435 tmpstat_outfile
.st_blksize
= 0;
11436 tmpstat_outfile
.st_blocks
= 0;
11438 tmpstat_hashfile
.st_blksize
= 0;
11439 tmpstat_hashfile
.st_blocks
= 0;
11443 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11445 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11452 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11454 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11464 * Remove duplicates
11467 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11471 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11475 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11478 uint hashes_cnt_orig
= hashes_cnt
;
11482 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11486 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11488 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11493 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11496 if (hashes_pos
> hashes_cnt
)
11498 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11508 uint potfile_remove_cracks
= 0;
11510 if (potfile_disable
== 0)
11514 hash_buf
.digest
= mymalloc (dgst_size
);
11515 hash_buf
.salt
= NULL
;
11516 hash_buf
.esalt
= NULL
;
11517 hash_buf
.hash_info
= NULL
;
11518 hash_buf
.cracked
= 0;
11522 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11527 hash_buf
.esalt
= mymalloc (esalt_size
);
11530 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11532 // no solution for these special hash types (for instane because they use hashfile in output etc)
11533 if ((hash_mode
!= 5200) &&
11534 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11535 (hash_mode
!= 9000))
11537 FILE *fp
= fopen (potfile
, "rb");
11543 char line_buf
[BUFSIZ
];
11545 memset (line_buf
, 0, BUFSIZ
);
11547 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11549 if (ptr
== NULL
) break;
11551 int line_len
= strlen (line_buf
);
11553 if (line_len
== 0) continue;
11555 int iter
= MAX_CUT_TRIES
;
11557 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11559 if (line_buf
[i
] != ':') continue;
11563 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11566 hash_t
*found
= NULL
;
11568 if (hash_mode
== 6800)
11570 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11572 // manipulate salt_buf
11573 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11575 hash_buf
.salt
->salt_len
= i
;
11577 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11580 else if (hash_mode
== 2500)
11582 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11584 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11585 // manipulate salt_buf
11587 // to be safe work with a copy (because of line_len loop, i etc)
11589 char line_buf_cpy
[BUFSIZ
];
11590 memset (line_buf_cpy
, 0, BUFSIZ
);
11592 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11594 memcpy (line_buf_cpy
, line_buf
, i
);
11596 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11598 if (mac2_pos
== NULL
) continue;
11603 if (strlen (mac2_pos
) != 12) continue;
11605 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11607 if (mac1_pos
== NULL
) continue;
11612 if (strlen (mac1_pos
) != 12) continue;
11614 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11616 // here we need the ESSID
11617 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11619 hash_buf
.salt
->salt_len
= essid_length
;
11621 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11625 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11629 char *pke_ptr
= (char *) pke
;
11631 for (uint i
= 0; i
< 25; i
++)
11633 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11636 unsigned char mac1
[6];
11637 unsigned char mac2
[6];
11639 memcpy (mac1
, pke_ptr
+ 23, 6);
11640 memcpy (mac2
, pke_ptr
+ 29, 6);
11642 // compare hex string(s) vs binary MAC address(es)
11644 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11646 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11654 if (!found
) continue;
11656 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11658 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11669 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11671 if (parser_status
== PARSER_OK
)
11675 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11679 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11684 if (found
== NULL
) continue;
11686 if (!found
->cracked
) potfile_remove_cracks
++;
11688 found
->cracked
= 1;
11702 local_free (hash_buf
.esalt
);
11707 local_free (hash_buf
.salt
);
11710 local_free (hash_buf
.digest
);
11714 * Now generate all the buffers required for later
11717 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11719 salt_t
*salts_buf_new
= NULL
;
11720 void *esalts_buf_new
= NULL
;
11724 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11728 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11733 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11736 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11738 uint digests_cnt
= hashes_cnt
;
11739 uint digests_done
= 0;
11741 uint size_digests
= digests_cnt
* dgst_size
;
11742 uint size_shown
= digests_cnt
* sizeof (uint
);
11744 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11745 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11747 uint salts_cnt
= 0;
11748 uint salts_done
= 0;
11750 hashinfo_t
**hash_info
= NULL
;
11752 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11754 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11756 if (username
&& (remove
|| show
))
11760 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11762 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11764 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11769 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11774 // copied from inner loop
11776 salt_buf
= &salts_buf_new
[salts_cnt
];
11778 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11782 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11785 salt_buf
->digests_cnt
= 0;
11786 salt_buf
->digests_done
= 0;
11787 salt_buf
->digests_offset
= 0;
11792 if (hashes_buf
[0].cracked
== 1)
11794 digests_shown
[0] = 1;
11798 salt_buf
->digests_done
++;
11801 salt_buf
->digests_cnt
++;
11803 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11805 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11807 hash_info
[0] = hashes_buf
[0].hash_info
;
11810 // copy from inner loop
11812 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11816 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11818 salt_buf
= &salts_buf_new
[salts_cnt
];
11820 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11824 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11827 salt_buf
->digests_cnt
= 0;
11828 salt_buf
->digests_done
= 0;
11829 salt_buf
->digests_offset
= hashes_pos
;
11835 if (hashes_buf
[hashes_pos
].cracked
== 1)
11837 digests_shown
[hashes_pos
] = 1;
11841 salt_buf
->digests_done
++;
11844 salt_buf
->digests_cnt
++;
11846 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11848 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11850 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11854 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11856 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11858 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11860 salts_shown
[salt_pos
] = 1;
11865 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11868 local_free (digests_buf
);
11869 local_free (salts_buf
);
11870 local_free (esalts_buf
);
11872 digests_buf
= digests_buf_new
;
11873 salts_buf
= salts_buf_new
;
11874 esalts_buf
= esalts_buf_new
;
11876 local_free (hashes_buf
);
11879 * special modification not set from parser
11884 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11885 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11886 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11887 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11888 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11889 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11890 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11891 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11892 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11893 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11894 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11895 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11898 if (truecrypt_keyfiles
)
11900 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11902 char *keyfiles
= strdup (truecrypt_keyfiles
);
11904 char *keyfile
= strtok (keyfiles
, ",");
11908 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11910 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11915 data
.digests_cnt
= digests_cnt
;
11916 data
.digests_done
= digests_done
;
11917 data
.digests_buf
= digests_buf
;
11918 data
.digests_shown
= digests_shown
;
11919 data
.digests_shown_tmp
= digests_shown_tmp
;
11921 data
.salts_cnt
= salts_cnt
;
11922 data
.salts_done
= salts_done
;
11923 data
.salts_buf
= salts_buf
;
11924 data
.salts_shown
= salts_shown
;
11926 data
.esalts_buf
= esalts_buf
;
11927 data
.hash_info
= hash_info
;
11930 * Automatic Optimizers
11933 if (salts_cnt
== 1)
11934 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11936 if (digests_cnt
== 1)
11937 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11939 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11940 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11942 if (attack_mode
== ATTACK_MODE_BF
)
11943 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11945 data
.opti_type
= opti_type
;
11947 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11949 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11951 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11953 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11955 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11956 opts_type
|= OPTS_TYPE_PT_ADD80
;
11959 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11961 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11962 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11965 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11967 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11968 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11975 * Some algorithm, like descrypt, can benefit from JIT compilation
11978 uint force_jit_compilation
= 0;
11980 if (hash_mode
== 8900)
11982 force_jit_compilation
= 8900;
11984 else if (hash_mode
== 9300)
11986 force_jit_compilation
= 8900;
11988 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11990 force_jit_compilation
= 1500;
11994 * generate bitmap tables
11997 const uint bitmap_shift1
= 5;
11998 const uint bitmap_shift2
= 13;
12000 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
12002 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12003 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12004 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12005 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12006 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12007 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12008 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12009 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12016 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12018 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12020 bitmap_nums
= 1 << bitmap_bits
;
12022 bitmap_mask
= bitmap_nums
- 1;
12024 bitmap_size
= bitmap_nums
* sizeof (uint
);
12026 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12028 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;
12029 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;
12034 bitmap_nums
= 1 << bitmap_bits
;
12036 bitmap_mask
= bitmap_nums
- 1;
12038 bitmap_size
= bitmap_nums
* sizeof (uint
);
12040 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);
12041 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);
12044 * prepare quick rule
12047 data
.rule_buf_l
= rule_buf_l
;
12048 data
.rule_buf_r
= rule_buf_r
;
12050 int rule_len_l
= (int) strlen (rule_buf_l
);
12051 int rule_len_r
= (int) strlen (rule_buf_r
);
12053 data
.rule_len_l
= rule_len_l
;
12054 data
.rule_len_r
= rule_len_r
;
12060 uint
*all_gpu_rules_cnt
= NULL
;
12062 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
12066 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12068 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
12071 char rule_buf
[BUFSIZ
];
12075 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12077 uint gpu_rules_avail
= 0;
12079 uint gpu_rules_cnt
= 0;
12081 gpu_rule_t
*gpu_rules_buf
= NULL
;
12083 char *rp_file
= rp_files
[i
];
12085 char in
[BLOCK_SIZE
];
12086 char out
[BLOCK_SIZE
];
12090 uint rule_line
= 0;
12092 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12094 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12101 memset (rule_buf
, 0, BUFSIZ
);
12103 rule_len
= fgetl (fp
, rule_buf
);
12107 if (rule_len
== 0) continue;
12109 if (rule_buf
[0] == '#') continue;
12111 if (gpu_rules_avail
== gpu_rules_cnt
)
12113 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12115 gpu_rules_avail
+= INCR_RULES
;
12118 memset (in
, 0, BLOCK_SIZE
);
12119 memset (out
, 0, BLOCK_SIZE
);
12121 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12125 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12130 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12132 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12134 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12140 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12142 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12153 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12155 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12159 * merge rules or automatic rule generator
12162 uint gpu_rules_cnt
= 0;
12164 gpu_rule_t
*gpu_rules_buf
= NULL
;
12166 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12172 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12174 repeats
[0] = gpu_rules_cnt
;
12176 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12178 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12180 repeats
[i
+ 1] = gpu_rules_cnt
;
12183 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12185 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12187 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12191 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12193 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12195 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12198 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12200 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12202 if (out_pos
== RULES_MAX
- 1)
12204 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12209 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12214 local_free (repeats
);
12218 uint gpu_rules_avail
= 0;
12220 while (gpu_rules_cnt
< rp_gen
)
12222 if (gpu_rules_avail
== gpu_rules_cnt
)
12224 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12226 gpu_rules_avail
+= INCR_RULES
;
12229 memset (rule_buf
, 0, BLOCK_SIZE
);
12231 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12233 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12241 * generate NOP rules
12244 if (gpu_rules_cnt
== 0)
12246 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12248 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12253 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12254 data
.gpu_rules_buf
= gpu_rules_buf
;
12260 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12262 uint CL_platforms_cnt
= 0;
12264 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12266 if (CL_platforms_cnt
== 0)
12268 log_error ("ERROR: No OpenCL compatible platform found");
12273 uint CL_platform_sel
= 0;
12275 if (CL_platforms_cnt
> 1)
12277 if (gpu_platform
== NULL
)
12279 log_error ("ERROR: Too many OpenCL compatible platforms found");
12280 log_error (" Please select a single platform using the --gpu-platform option");
12282 log_error ("Available OpenCL platforms:");
12284 for (uint i
= 0; i
< CL_platforms_cnt
; i
++)
12286 char CL_platform_vendor
[INFOSZ
];
12288 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12290 hc_clGetPlatformInfo (CL_platforms
[i
], CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12292 printf ("* %d = %s\n", i
+ 1, CL_platform_vendor
);
12299 CL_platform_sel
= atoi (gpu_platform
);
12301 if (CL_platform_sel
> CL_platforms_cnt
)
12303 log_error ("ERROR: invalid OpenCL platforms selected");
12308 // user does not count with zero
12310 CL_platform_sel
-= 1;
12314 cl_platform_id CL_platform
= CL_platforms
[CL_platform_sel
];
12316 char CL_platform_vendor
[INFOSZ
];
12318 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12320 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12324 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12326 vendor_id
= VENDOR_ID_AMD
;
12328 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12330 vendor_id
= VENDOR_ID_NV
;
12332 // make sure that we do not directly control the fan for NVidia
12334 gpu_temp_retain
= 0;
12335 data
.gpu_temp_retain
= gpu_temp_retain
;
12339 vendor_id
= VENDOR_ID_UNKNOWN
;
12342 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12344 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12346 gpu_temp_disable
= 1;
12349 data
.vendor_id
= vendor_id
;
12352 * cached kernel path depends on vendor_id which we don't know, so create it here
12355 if (profile_dir
!= install_dir
) // not a bug
12357 int vendor_id_folder_size
= strlen (profile_dir
) + 1 + 7 + 1 + 10 + 1;
12359 char *vendor_id_folder
= (char *) mymalloc (vendor_id_folder_size
);
12361 snprintf (vendor_id_folder
, vendor_id_folder_size
- 1, "%s/kernels", profile_dir
);
12363 mkdir (vendor_id_folder
, 0700);
12365 snprintf (vendor_id_folder
, vendor_id_folder_size
- 1, "%s/kernels/%d", profile_dir
, vendor_id
);
12367 mkdir (vendor_id_folder
, 0700);
12369 myfree (vendor_id_folder
);
12376 cl_device_id devices_all
[DEVICES_MAX
];
12377 cl_device_id devices
[DEVICES_MAX
];
12379 uint devices_all_cnt
= 0;
12381 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12383 int hm_adapters_all
= devices_all_cnt
;
12385 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12387 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12389 if (gpu_temp_disable
== 0)
12391 if (vendor_id
== VENDOR_ID_NV
)
12394 HM_LIB hm_dll
= hm_init ();
12396 data
.hm_dll
= hm_dll
;
12398 if (hc_NVML_nvmlInit (hm_dll
) == NVML_SUCCESS
)
12400 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12402 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12406 for (int i
= 0; i
< tmp_in
; i
++)
12408 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12411 hm_adapters_all
= tmp_out
;
12413 for (int i
= 0; i
< tmp_out
; i
++)
12415 unsigned int speed
;
12417 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;
12423 if (NvAPI_Initialize () == NVAPI_OK
)
12425 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12427 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12431 for (int i
= 0; i
< tmp_in
; i
++)
12433 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12436 hm_adapters_all
= tmp_out
;
12438 for (int i
= 0; i
< tmp_out
; i
++)
12442 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12448 if (vendor_id
== VENDOR_ID_AMD
)
12450 HM_LIB hm_dll
= hm_init ();
12452 data
.hm_dll
= hm_dll
;
12454 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12456 // total number of adapters
12458 int hm_adapters_num
;
12460 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12464 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12466 if (lpAdapterInfo
== NULL
) return (-1);
12468 // get a list (of ids of) valid/usable adapters
12470 int num_adl_adapters
= 0;
12472 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12474 if (num_adl_adapters
> 0)
12476 hc_thread_mutex_lock (mux_adl
);
12478 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12480 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12482 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12483 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12485 hc_thread_mutex_unlock (mux_adl
);
12488 hm_adapters_all
= num_adl_adapters
;
12490 myfree (valid_adl_device_list
);
12491 myfree (lpAdapterInfo
);
12496 if (hm_adapters_all
== 0)
12498 gpu_temp_disable
= 1;
12501 if (gpu_temp_disable
== 1)
12503 gpu_temp_abort
= 0;
12504 gpu_temp_retain
= 0;
12508 * enable custom signal handler(s)
12511 if (benchmark
== 0)
12513 hc_signal (sigHandler_default
);
12517 hc_signal (sigHandler_benchmark
);
12521 * devices mask and properties
12524 uint devices_cnt
= 0;
12526 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12528 if (gpu_devicemask
)
12530 uint device_all_id_mask
= 1 << device_all_id
;
12532 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12534 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12540 const uint device_id
= devices_cnt
;
12542 devices
[device_id
] = devices_all
[device_all_id
];
12544 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12546 char device_name
[INFOSZ
];
12548 memset (device_name
, 0, sizeof (device_name
));
12550 cl_ulong global_mem_size
;
12551 cl_ulong max_mem_alloc_size
;
12552 cl_uint max_clock_frequency
;
12553 cl_uint max_compute_units
;
12555 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12556 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12557 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12558 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12559 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12561 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12563 log_info ("Device #%u: %s, %lu/%lu MB allocatable, %dMhz, %uMCU",
12566 (unsigned int) (max_mem_alloc_size
/ 1024 / 1024),
12567 (unsigned int) (global_mem_size
/ 1024 / 1024),
12568 (unsigned int) (max_clock_frequency
),
12569 (unsigned int) max_compute_units
);
12575 if (devices_cnt
== 0)
12577 log_error ("ERROR: No devices left that matches your specification.");
12582 data
.devices_cnt
= devices_cnt
;
12584 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12593 // gpu temp sanity check
12595 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12597 if (gpu_temp_abort
< gpu_temp_retain
)
12599 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12605 data
.gpu_temp_disable
= gpu_temp_disable
;
12606 data
.gpu_temp_abort
= gpu_temp_abort
;
12607 data
.gpu_temp_retain
= gpu_temp_retain
;
12609 if (data
.quiet
== 0)
12611 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12613 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
);
12615 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12617 log_info ("Rules: %u", gpu_rules_cnt
);
12622 log_info ("Applicable Optimizers:");
12624 for (uint i
= 0; i
< 32; i
++)
12626 const uint opti_bit
= 1 << i
;
12628 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12633 * Watchdog and Temperature balance
12636 if (gpu_temp_abort
== 0)
12638 log_info ("Watchdog: Temperature abort trigger disabled");
12642 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12645 if (gpu_temp_retain
== 0)
12647 log_info ("Watchdog: Temperature retain trigger disabled");
12651 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12659 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12661 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12663 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12665 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12667 data
.devices_param
= devices_param
;
12669 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12671 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12673 cl_device_id device
= devices
[device_id
];
12675 device_param
->device
= device
;
12677 cl_uint max_compute_units
= 0;
12679 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12681 device_param
->gpu_processors
= max_compute_units
;
12683 cl_ulong max_mem_alloc_size
= 0;
12685 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12687 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12689 char tmp
[INFOSZ
], t1
[64];
12691 memset (tmp
, 0, sizeof (tmp
));
12693 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12695 device_param
->device_name
= mystrdup (tmp
);
12697 memset (tmp
, 0, sizeof (tmp
));
12699 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12701 memset (t1
, 0, sizeof (t1
));
12703 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12705 device_param
->device_version
= mystrdup (t1
);
12707 memset (tmp
, 0, sizeof (tmp
));
12709 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12711 device_param
->driver_version
= mystrdup (tmp
);
12713 if (vendor_id
== VENDOR_ID_AMD
)
12715 cl_uint gpu_processor_cores
= 0;
12717 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
12719 hc_clGetDeviceInfo (device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12721 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12724 if (vendor_id
== VENDOR_ID_NV
)
12726 cl_uint kernel_exec_timeout
= 0;
12728 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
12730 hc_clGetDeviceInfo (device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
12732 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
12734 cl_uint gpu_processor_cores
= 0;
12736 #define CL_DEVICE_WARP_SIZE_NV 0x4003
12738 hc_clGetDeviceInfo (device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12740 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12742 cl_uint sm_minor
= 0;
12743 cl_uint sm_major
= 0;
12745 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12746 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12748 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12749 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12751 device_param
->sm_minor
= sm_minor
;
12752 device_param
->sm_major
= sm_major
;
12756 * common driver check
12759 if (vendor_id
== VENDOR_ID_NV
)
12761 if (device_param
->kernel_exec_timeout
!= 0)
12763 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);
12764 if (data
.quiet
== 0) log_info (" See the wiki on how to disable it: https://hashcat.net/wiki/doku.php?id=timeout_patch");
12768 if (vendor_id
== VENDOR_ID_AMD
)
12770 int catalyst_check
= (force
== 1) ? 0 : 1;
12772 int catalyst_warn
= 0;
12774 int catalyst_broken
= 0;
12776 if (catalyst_check
== 1)
12780 // v14.9 and higher
12781 if ((atoi (device_param
->device_version
) >= 1573)
12782 && (atoi (device_param
->driver_version
) >= 1573))
12787 catalyst_check
= 0;
12790 if (catalyst_broken
== 1)
12793 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12794 log_error ("It will pass over cracked hashes and does not report them as cracked");
12795 log_error ("You are STRONGLY encouraged not to use it");
12796 log_error ("You can use --force to override this but do not post error reports if you do so");
12801 if (catalyst_warn
== 1)
12804 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12805 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12806 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12808 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12810 log_error ("You can use --force to override this but do not post error reports if you do so");
12819 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12820 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12821 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12822 * Driver / ADL bug?
12825 if (vendor_id
== VENDOR_ID_AMD
)
12827 if (powertune_enable
== 1)
12829 hc_thread_mutex_lock (mux_adl
);
12831 for (uint i
= 0; i
< devices_cnt
; i
++)
12833 if (data
.hm_device
[i
].od_version
== 6)
12835 // set powertune value only
12837 int powertune_supported
= 0;
12841 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12843 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12848 if (powertune_supported
!= 0)
12851 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12853 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12855 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12860 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12862 log_error ("ERROR: Failed to set new ADL PowerControl values");
12870 hc_thread_mutex_unlock (mux_adl
);
12874 uint gpu_blocks_all
= 0;
12876 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12882 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12885 * device properties
12888 char *device_name
= device_param
->device_name
;
12889 char *device_version
= device_param
->device_version
;
12890 char *driver_version
= device_param
->driver_version
;
12892 uint gpu_processors
= device_param
->gpu_processors
;
12894 uint gpu_processor_cores
= device_param
->gpu_processor_cores
;
12897 * create context for each device
12900 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12903 * create command-queue
12906 // not support with NV
12907 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12909 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12912 * create input buffers on device
12915 uint gpu_threads
= GPU_THREADS
;
12918 if (hash_mode
== 3200) gpu_threads
= 8;
12919 if (hash_mode
== 9000) gpu_threads
= 8;
12921 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12922 uint gpu_blocks
= gpu_power
;
12924 device_param
->gpu_threads
= gpu_threads
;
12925 device_param
->gpu_power_user
= gpu_power
;
12926 device_param
->gpu_blocks_user
= gpu_blocks
;
12928 gpu_blocks_all
+= gpu_blocks
;
12930 uint size_pws
= gpu_power
* sizeof (pw_t
);
12932 uint size_tmps
= 4;
12936 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12937 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12938 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12939 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12940 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12941 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12942 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12943 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12944 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12945 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12948 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12951 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12954 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12957 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12958 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12959 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12960 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12961 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12962 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12963 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12964 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12965 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12966 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12967 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12968 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12969 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12970 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12971 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12972 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12973 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12974 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12975 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12976 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12977 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12978 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12979 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12980 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12981 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12982 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12983 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12984 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12985 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12986 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12987 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12988 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12989 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12990 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12991 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12992 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12993 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12994 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12997 uint size_hooks
= 4;
12999 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
13001 // insert correct hook size
13004 // we can optimize some stuff here...
13006 device_param
->size_pws
= size_pws
;
13007 device_param
->size_tmps
= size_tmps
;
13008 device_param
->size_hooks
= size_hooks
;
13010 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
13011 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
13013 device_param
->size_root_css
= size_root_css
;
13014 device_param
->size_markov_css
= size_markov_css
;
13016 uint size_results
= GPU_THREADS
* sizeof (uint
);
13018 device_param
->size_results
= size_results
;
13020 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
13021 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
13022 uint size_plains
= digests_cnt
* sizeof (plain_t
);
13023 uint size_salts
= salts_cnt
* sizeof (salt_t
);
13024 uint size_esalts
= salts_cnt
* esalt_size
;
13026 device_param
->size_plains
= size_plains
;
13027 device_param
->size_digests
= size_digests
;
13028 device_param
->size_shown
= size_shown
;
13029 device_param
->size_salts
= size_salts
;
13031 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
13032 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
13033 uint size_tm
= 32 * sizeof (bs_word_t
);
13035 uint64_t size_scryptV
= 1;
13037 if ((hash_mode
== 8900) || (hash_mode
== 9300))
13039 uint tmto_start
= 0;
13040 uint tmto_stop
= 10;
13044 tmto_start
= scrypt_tmto
;
13048 // in case the user did not specify the tmto manually
13049 // use some values known to run best (tested on 290x for AMD and 980ti for NV)
13050 // but set the lower end only in case the user has a gpu with too less memory
13052 if (hash_mode
== 8900)
13054 if (vendor_id
== VENDOR_ID_AMD
)
13058 else if (vendor_id
== VENDOR_ID_NV
)
13063 else if (hash_mode
== 9300)
13065 if (vendor_id
== VENDOR_ID_AMD
)
13069 else if (vendor_id
== VENDOR_ID_NV
)
13076 if (quiet
== 0) log_info ("");
13078 uint shader_per_mp
= 1;
13080 if (vendor_id
== VENDOR_ID_AMD
)
13085 if (vendor_id
== VENDOR_ID_NV
)
13087 shader_per_mp
= 32;
13090 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
++)
13092 // TODO: in theory the following calculation needs to be done per salt, not global
13093 // we assume all hashes have the same scrypt settings
13095 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
13097 size_scryptV
/= 1 << tmto
;
13099 size_scryptV
*= gpu_processors
* gpu_processor_cores
* shader_per_mp
;
13101 if (size_scryptV
> device_param
->gpu_maxmem_alloc
)
13103 if (quiet
== 0) log_info ("WARNING: not enough GPU memory allocatable to use --scrypt-tmto %d, increasing...", tmto
);
13108 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
13110 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
13111 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* gpu_processor_cores
* shader_per_mp
;
13117 if (data
.salts_buf
[0].scrypt_phy
== 0)
13119 log_error ("ERROR: can't allocate enough GPU memory");
13124 if (quiet
== 0) log_info ("");
13125 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u, mem: %u\n", data
.salts_buf
[0].scrypt_tmto
, size_scryptV
);
13129 * default building options
13132 char build_opts
[1024];
13134 // we don't have sm_* on AMD but it doesn't matter
13136 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
13144 * kernel source filename
13147 char source_file
[256];
13149 memset (source_file
, 0, sizeof (source_file
));
13151 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, shared_dir
, source_file
);
13155 if (stat (source_file
, &sst
) == -1)
13157 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13163 * kernel cached filename
13166 char cached_file
[256];
13168 memset (cached_file
, 0, sizeof (cached_file
));
13170 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, profile_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13176 if (stat (cached_file
, &cst
) == -1)
13182 * kernel compile or load
13185 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13187 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13189 if (force_jit_compilation
== 0)
13193 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13195 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13197 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13199 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13201 size_t binary_size
;
13203 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13205 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13207 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13209 writeProgramBin (cached_file
, binary
, binary_size
);
13211 local_free (binary
);
13215 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13217 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13219 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13221 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13226 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
13228 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13230 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13232 if (force_jit_compilation
== 1500)
13234 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13236 else if (force_jit_compilation
== 8900)
13238 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
);
13241 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13244 local_free (kernel_lengths
);
13245 local_free (kernel_sources
[0]);
13246 local_free (kernel_sources
);
13248 // this is mostly for debug
13250 size_t ret_val_size
= 0;
13252 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13254 if (ret_val_size
> 2)
13256 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13258 memset (build_log
, 0, ret_val_size
+ 1);
13260 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13264 myfree (build_log
);
13269 * word generator kernel
13272 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13275 * kernel mp source filename
13278 char source_file
[256];
13280 memset (source_file
, 0, sizeof (source_file
));
13282 generate_source_kernel_mp_filename (opti_type
, opts_type
, shared_dir
, source_file
);
13286 if (stat (source_file
, &sst
) == -1)
13288 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13294 * kernel mp cached filename
13297 char cached_file
[256];
13299 memset (cached_file
, 0, sizeof (cached_file
));
13301 generate_cached_kernel_mp_filename (opti_type
, opts_type
, profile_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13307 if (stat (cached_file
, &cst
) == -1)
13313 * kernel compile or load
13316 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13318 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13322 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13324 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13326 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13328 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13330 size_t binary_size
;
13332 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13334 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13336 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13338 writeProgramBin (cached_file
, binary
, binary_size
);
13340 local_free (binary
);
13344 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13346 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13348 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13350 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13353 local_free (kernel_lengths
);
13354 local_free (kernel_sources
[0]);
13355 local_free (kernel_sources
);
13357 // this is mostly for debug
13359 size_t ret_val_size
= 0;
13361 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13363 if (ret_val_size
> 2)
13365 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13367 memset (build_log
, 0, ret_val_size
+ 1);
13369 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13373 myfree (build_log
);
13381 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13388 * kernel amp source filename
13391 char source_file
[256];
13393 memset (source_file
, 0, sizeof (source_file
));
13395 generate_source_kernel_amp_filename (attack_kern
, shared_dir
, source_file
);
13399 if (stat (source_file
, &sst
) == -1)
13401 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13407 * kernel amp cached filename
13410 char cached_file
[256];
13412 memset (cached_file
, 0, sizeof (cached_file
));
13414 generate_cached_kernel_amp_filename (attack_kern
, profile_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13420 if (stat (cached_file
, &cst
) == -1)
13426 * kernel compile or load
13429 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13431 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13435 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13437 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13439 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13441 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13443 size_t binary_size
;
13445 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13447 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13449 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13451 writeProgramBin (cached_file
, binary
, binary_size
);
13453 local_free (binary
);
13457 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13459 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13461 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13463 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13466 local_free (kernel_lengths
);
13467 local_free (kernel_sources
[0]);
13468 local_free (kernel_sources
);
13470 // this is mostly for debug
13472 size_t ret_val_size
= 0;
13474 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13476 if (ret_val_size
> 2)
13478 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13480 memset (build_log
, 0, ret_val_size
+ 1);
13482 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13486 myfree (build_log
);
13494 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13495 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13496 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13497 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13498 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13499 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13500 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13501 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13502 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13503 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13504 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13505 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13506 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13507 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13508 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13509 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13510 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13511 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13513 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13514 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13515 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13516 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13517 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13518 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13519 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13520 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13521 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13522 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13523 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13525 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13526 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13527 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13528 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13529 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13530 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13536 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13538 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13539 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13541 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13543 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13545 else if (attack_kern
== ATTACK_KERN_COMBI
)
13547 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13548 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13549 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13550 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13552 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13553 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13554 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13555 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13557 else if (attack_kern
== ATTACK_KERN_BF
)
13559 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13560 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13561 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13562 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13563 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13565 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13566 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13567 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13568 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13569 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13574 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13576 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13583 uint
*result
= (uint
*) mymalloc (size_results
);
13585 memset (result
, 0, size_results
);
13587 device_param
->result
= result
;
13589 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13591 memset (pws_buf
, 0, size_pws
);
13593 device_param
->pws_buf
= pws_buf
;
13595 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13597 for (int i
= 0; i
< 64; i
++)
13599 pw_caches
[i
].pw_buf
.pw_len
= i
;
13600 pw_caches
[i
].cnt
= 0;
13603 device_param
->pw_caches
= pw_caches
;
13605 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13607 device_param
->combs_buf
= combs_buf
;
13609 void *hooks_buf
= mymalloc (size_hooks
);
13611 device_param
->hooks_buf
= hooks_buf
;
13613 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13614 device_param
->pw_add
= pw_add_to_hc1
;
13620 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13621 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13622 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13623 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13624 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13625 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13626 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13627 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13628 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13629 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13630 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13632 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13633 ? &device_param
->d_pws_buf
13634 : &device_param
->d_pws_amp_buf
;
13635 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13636 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13637 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13638 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13639 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13640 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13641 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13642 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13643 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13644 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13645 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13646 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13647 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13648 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13649 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13650 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13651 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13652 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13653 device_param
->kernel_params
[19] = &device_param
->d_result
;
13654 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13655 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13656 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13657 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13658 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13659 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13660 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13661 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13662 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13663 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13664 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13665 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13667 device_param
->kernel_params_mp_buf64
[3] = 0;
13668 device_param
->kernel_params_mp_buf32
[4] = 0;
13669 device_param
->kernel_params_mp_buf32
[5] = 0;
13670 device_param
->kernel_params_mp_buf32
[6] = 0;
13671 device_param
->kernel_params_mp_buf32
[7] = 0;
13672 device_param
->kernel_params_mp_buf32
[8] = 0;
13674 device_param
->kernel_params_mp
[0] = NULL
;
13675 device_param
->kernel_params_mp
[1] = NULL
;
13676 device_param
->kernel_params_mp
[2] = NULL
;
13677 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13678 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13679 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13680 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13681 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13682 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13684 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13685 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13686 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13687 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13688 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13689 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13690 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13692 device_param
->kernel_params_mp_l
[0] = NULL
;
13693 device_param
->kernel_params_mp_l
[1] = NULL
;
13694 device_param
->kernel_params_mp_l
[2] = NULL
;
13695 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13696 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13697 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13698 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13699 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13700 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13701 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13703 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13704 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13705 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13706 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13707 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13708 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13710 device_param
->kernel_params_mp_r
[0] = NULL
;
13711 device_param
->kernel_params_mp_r
[1] = NULL
;
13712 device_param
->kernel_params_mp_r
[2] = NULL
;
13713 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13714 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13715 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13716 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13717 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13718 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13720 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13721 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13723 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13724 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13725 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13726 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13727 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13728 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13729 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13731 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13733 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13734 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13740 char kernel_name
[64];
13742 memset (kernel_name
, 0, sizeof (kernel_name
));
13744 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13746 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13748 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13750 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13752 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13754 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13756 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13758 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13762 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13764 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13766 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13768 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13770 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13772 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13775 if (data
.attack_mode
== ATTACK_MODE_BF
)
13777 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13779 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13781 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13783 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13785 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13791 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13793 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13795 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13797 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13799 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13801 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13803 if (opts_type
& OPTS_TYPE_HOOK12
)
13805 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13807 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13810 if (opts_type
& OPTS_TYPE_HOOK23
)
13812 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13814 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13818 for (uint i
= 0; i
<= 20; i
++)
13820 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13821 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13822 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13824 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13825 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13828 for (uint i
= 21; i
<= 31; i
++)
13830 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13831 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13832 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13834 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13835 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13838 if (attack_mode
== ATTACK_MODE_BF
)
13840 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13841 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13843 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13845 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13847 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13848 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13851 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13853 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13855 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13857 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13860 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13866 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13869 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13875 for (uint i
= 0; i
< 5; i
++)
13877 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13880 for (uint i
= 5; i
< 7; i
++)
13882 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13887 * Store initial fanspeed if gpu_temp_retain is enabled
13890 int gpu_temp_retain_set
= 0;
13892 if (gpu_temp_disable
== 0)
13894 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13896 hc_thread_mutex_lock (mux_adl
);
13898 if (data
.hm_device
[device_id
].fan_supported
== 1)
13900 if (gpu_temp_retain_chgd
== 0)
13903 uint default_temp
= 0;
13905 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
);
13907 if (ADL_rc
== ADL_OK
)
13909 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13911 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13913 // special case with multi gpu setups: always use minimum retain
13915 if (gpu_temp_retain_set
== 0)
13917 gpu_temp_retain
= gpu_temp_retain_target
;
13918 gpu_temp_retain_set
= 1;
13922 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13925 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13929 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13931 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13933 if (fan_speed
== -1)
13935 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13937 temp_retain_fanspeed_value
[device_id
] = 0;
13941 hc_thread_mutex_unlock (mux_adl
);
13946 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13949 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13951 hc_thread_mutex_lock (mux_adl
);
13953 if (data
.hm_device
[device_id
].od_version
== 6)
13957 // check powertune capabilities first, if not available then skip device
13959 int powertune_supported
= 0;
13961 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13963 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13968 if (powertune_supported
!= 0)
13970 // powercontrol settings
13972 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13974 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13976 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13979 if (ADL_rc
!= ADL_OK
)
13981 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13986 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13988 log_error ("ERROR: Failed to set new ADL PowerControl values");
13995 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13997 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13999 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
)
14001 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
14006 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
14008 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
14010 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
14012 log_error ("ERROR: Failed to get ADL device capabilities");
14017 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
14018 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
14020 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
14021 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
14023 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
14024 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
14026 // warning if profile has to low max values
14028 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
14030 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
14033 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
14035 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
14038 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
14040 performance_state
->iNumberOfPerformanceLevels
= 2;
14042 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
14043 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
14044 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
14045 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
14047 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
)
14049 log_info ("ERROR: Failed to set ADL performance state");
14054 local_free (performance_state
);
14058 hc_thread_mutex_unlock (mux_adl
);
14062 data
.gpu_blocks_all
= gpu_blocks_all
;
14064 if (data
.quiet
== 0) log_info ("");
14067 * Inform user which algorithm is checked and at which workload setting
14070 if (benchmark
== 1)
14074 data
.quiet
= quiet
;
14076 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
14078 log_info ("Hashtype: %s", hash_type
);
14079 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
14084 * keep track of the progress
14087 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14088 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14089 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
14096 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
14098 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
14103 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
14105 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
14110 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
14112 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
14122 segment_size
*= (1024 * 1024);
14124 data
.segment_size
= segment_size
;
14126 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
14128 wl_data
->buf
= (char *) mymalloc (segment_size
);
14129 wl_data
->avail
= segment_size
;
14130 wl_data
->incr
= segment_size
;
14134 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
14136 data
.wordlist_mode
= wordlist_mode
;
14138 cs_t
*css_buf
= NULL
;
14142 char **masks
= NULL
;
14143 char **dictfiles
= NULL
;
14145 uint mask_from_file
= 0;
14147 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14149 if (wordlist_mode
== WL_MODE_FILE
)
14151 int wls_left
= myargc
- (optind
+ 1);
14153 for (int i
= 0; i
< wls_left
; i
++)
14155 char *l0_filename
= myargv
[optind
+ 1 + i
];
14157 struct stat l0_stat
;
14159 if (stat (l0_filename
, &l0_stat
) == -1)
14161 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
14166 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
14170 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14174 dictfiles
[dictcnt
- 1] = l0_filename
;
14178 // do not allow --keyspace w/ a directory
14182 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14187 char **dictionary_files
= NULL
;
14189 dictionary_files
= scan_directory (l0_filename
);
14191 if (dictionary_files
!= NULL
)
14193 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14195 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14197 char *l1_filename
= dictionary_files
[d
];
14199 struct stat l1_stat
;
14201 if (stat (l1_filename
, &l1_stat
) == -1)
14203 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14208 if (S_ISREG (l1_stat
.st_mode
))
14210 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14214 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14219 local_free (dictionary_files
);
14225 log_error ("ERROR: No usable dictionary file found.");
14230 else if (wordlist_mode
== WL_MODE_STDIN
)
14235 else if (attack_mode
== ATTACK_MODE_COMBI
)
14239 char *dictfile1
= myargv
[optind
+ 1 + 0];
14240 char *dictfile2
= myargv
[optind
+ 1 + 1];
14242 // find the bigger dictionary and use as base
14247 struct stat tmp_stat
;
14249 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14251 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14256 if (stat (dictfile1
, &tmp_stat
) == -1)
14258 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14265 if (S_ISDIR (tmp_stat
.st_mode
))
14267 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14274 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14276 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14283 if (stat (dictfile2
, &tmp_stat
) == -1)
14285 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14293 if (S_ISDIR (tmp_stat
.st_mode
))
14295 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14303 data
.combs_cnt
= 1;
14307 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14309 data
.quiet
= quiet
;
14311 if (words1_cnt
== 0)
14313 log_error ("ERROR: %s: empty file", dictfile1
);
14321 data
.combs_cnt
= 1;
14325 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14327 data
.quiet
= quiet
;
14329 if (words2_cnt
== 0)
14331 log_error ("ERROR: %s: empty file", dictfile2
);
14342 data
.dictfile
= dictfile1
;
14343 data
.dictfile2
= dictfile2
;
14345 if (words1_cnt
>= words2_cnt
)
14347 data
.combs_cnt
= words2_cnt
;
14348 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14350 dictfiles
= &data
.dictfile
;
14356 data
.combs_cnt
= words1_cnt
;
14357 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14359 dictfiles
= &data
.dictfile2
;
14363 // we also have to switch wordlist related rules!
14365 char *tmpc
= data
.rule_buf_l
;
14367 data
.rule_buf_l
= data
.rule_buf_r
;
14368 data
.rule_buf_r
= tmpc
;
14370 int tmpi
= data
.rule_len_l
;
14372 data
.rule_len_l
= data
.rule_len_r
;
14373 data
.rule_len_r
= tmpi
;
14376 else if (attack_mode
== ATTACK_MODE_BF
)
14382 if (benchmark
== 0)
14384 mask
= myargv
[optind
+ 1];
14386 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14388 if ((optind
+ 2) <= myargc
)
14390 struct stat file_stat
;
14392 if (stat (mask
, &file_stat
) == -1)
14396 masks
[maskcnt
- 1] = mystrdup (mask
);
14400 int wls_left
= myargc
- (optind
+ 1);
14402 uint masks_avail
= INCR_MASKS
;
14404 for (int i
= 0; i
< wls_left
; i
++)
14408 mask
= myargv
[optind
+ 1 + i
];
14410 if (stat (mask
, &file_stat
) == -1)
14412 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14418 uint is_file
= S_ISREG (file_stat
.st_mode
);
14424 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14426 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14431 char line_buf
[BUFSIZ
];
14433 while (!feof (mask_fp
))
14435 memset (line_buf
, 0, BUFSIZ
);
14437 int line_len
= fgetl (mask_fp
, line_buf
);
14439 if (line_len
== 0) continue;
14441 if (line_buf
[0] == '#') continue;
14443 if (masks_avail
== maskcnt
)
14445 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14447 masks_avail
+= INCR_MASKS
;
14450 masks
[maskcnt
] = mystrdup (line_buf
);
14459 log_error ("ERROR: %s: unsupported file-type", mask
);
14465 mask_from_file
= 1;
14470 custom_charset_1
= (char *) "?l?d?u";
14471 custom_charset_2
= (char *) "?l?d";
14472 custom_charset_3
= (char *) "?l?d*!$@_";
14474 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14475 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14476 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14478 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14480 wordlist_mode
= WL_MODE_MASK
;
14482 data
.wordlist_mode
= wordlist_mode
;
14492 * generate full masks and charsets
14495 masks
= (char **) mymalloc (sizeof (char *));
14499 case 1731: pw_min
= 5;
14501 mask
= mystrdup ("?b?b?b?b?b");
14503 case 12500: pw_min
= 5;
14505 mask
= mystrdup ("?b?b?b?b?b");
14507 default: pw_min
= 7;
14509 mask
= mystrdup ("?b?b?b?b?b?b?b");
14515 masks
[maskcnt
- 1] = mystrdup (mask
);
14517 wordlist_mode
= WL_MODE_MASK
;
14519 data
.wordlist_mode
= wordlist_mode
;
14524 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14528 if (increment_min
> pw_min
) pw_min
= increment_min
;
14530 if (increment_max
< pw_max
) pw_max
= increment_max
;
14533 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14535 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14539 char *mask
= myargv
[myargc
- 1];
14543 masks
= (char **) mymalloc (1 * sizeof (char *));
14547 struct stat file_stat
;
14549 if (stat (mask
, &file_stat
) == -1)
14553 masks
[maskcnt
- 1] = mystrdup (mask
);
14557 uint is_file
= S_ISREG (file_stat
.st_mode
);
14563 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14565 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14570 char line_buf
[BUFSIZ
];
14572 uint masks_avail
= 1;
14574 while (!feof (mask_fp
))
14576 memset (line_buf
, 0, BUFSIZ
);
14578 int line_len
= fgetl (mask_fp
, line_buf
);
14580 if (line_len
== 0) continue;
14582 if (line_buf
[0] == '#') continue;
14584 if (masks_avail
== maskcnt
)
14586 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14588 masks_avail
+= INCR_MASKS
;
14591 masks
[maskcnt
] = mystrdup (line_buf
);
14598 mask_from_file
= 1;
14604 masks
[maskcnt
- 1] = mystrdup (mask
);
14610 int wls_left
= myargc
- (optind
+ 2);
14612 for (int i
= 0; i
< wls_left
; i
++)
14614 char *filename
= myargv
[optind
+ 1 + i
];
14616 struct stat file_stat
;
14618 if (stat (filename
, &file_stat
) == -1)
14620 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14625 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14629 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14633 dictfiles
[dictcnt
- 1] = filename
;
14637 // do not allow --keyspace w/ a directory
14641 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14646 char **dictionary_files
= NULL
;
14648 dictionary_files
= scan_directory (filename
);
14650 if (dictionary_files
!= NULL
)
14652 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14654 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14656 char *l1_filename
= dictionary_files
[d
];
14658 struct stat l1_stat
;
14660 if (stat (l1_filename
, &l1_stat
) == -1)
14662 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14667 if (S_ISREG (l1_stat
.st_mode
))
14669 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14673 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14678 local_free (dictionary_files
);
14684 log_error ("ERROR: No usable dictionary file found.");
14693 uint mask_min
= increment_min
; // we can't reject smaller masks here
14694 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14696 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14698 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14700 if (cur_mask
== NULL
) break;
14702 masks
[maskcnt
] = cur_mask
;
14706 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14710 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14712 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14716 char *mask
= myargv
[optind
+ 1 + 0];
14720 masks
= (char **) mymalloc (1 * sizeof (char *));
14724 struct stat file_stat
;
14726 if (stat (mask
, &file_stat
) == -1)
14730 masks
[maskcnt
- 1] = mystrdup (mask
);
14734 uint is_file
= S_ISREG (file_stat
.st_mode
);
14740 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14742 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14747 char line_buf
[BUFSIZ
];
14749 uint masks_avail
= 1;
14751 while (!feof (mask_fp
))
14753 memset (line_buf
, 0, BUFSIZ
);
14755 int line_len
= fgetl (mask_fp
, line_buf
);
14757 if (line_len
== 0) continue;
14759 if (line_buf
[0] == '#') continue;
14761 if (masks_avail
== maskcnt
)
14763 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14765 masks_avail
+= INCR_MASKS
;
14768 masks
[maskcnt
] = mystrdup (line_buf
);
14775 mask_from_file
= 1;
14781 masks
[maskcnt
- 1] = mystrdup (mask
);
14787 int wls_left
= myargc
- (optind
+ 2);
14789 for (int i
= 0; i
< wls_left
; i
++)
14791 char *filename
= myargv
[optind
+ 2 + i
];
14793 struct stat file_stat
;
14795 if (stat (filename
, &file_stat
) == -1)
14797 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14802 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14806 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14810 dictfiles
[dictcnt
- 1] = filename
;
14814 // do not allow --keyspace w/ a directory
14818 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14823 char **dictionary_files
= NULL
;
14825 dictionary_files
= scan_directory (filename
);
14827 if (dictionary_files
!= NULL
)
14829 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14831 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14833 char *l1_filename
= dictionary_files
[d
];
14835 struct stat l1_stat
;
14837 if (stat (l1_filename
, &l1_stat
) == -1)
14839 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14844 if (S_ISREG (l1_stat
.st_mode
))
14846 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14850 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14855 local_free (dictionary_files
);
14861 log_error ("ERROR: No usable dictionary file found.");
14870 uint mask_min
= increment_min
; // we can't reject smaller masks here
14871 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14873 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14875 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14877 if (cur_mask
== NULL
) break;
14879 masks
[maskcnt
] = cur_mask
;
14883 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14888 data
.pw_min
= pw_min
;
14889 data
.pw_max
= pw_max
;
14895 if (weak_hash_threshold
>= salts_cnt
)
14897 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14899 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14901 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14905 // Display hack, guarantee that there is at least one \r before real start
14907 if (data
.quiet
== 0) log_info_nn ("");
14910 * status and monitor threads
14913 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14915 hc_thread_t i_thread
= 0;
14917 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14919 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14922 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14924 uint ni_threads_cnt
= 0;
14926 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14928 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14938 if (outfile_check_timer
!= 0)
14940 if (data
.outfile_check_directory
!= NULL
)
14942 if ((hash_mode
!= 5200) &&
14943 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14944 (hash_mode
!= 9000))
14946 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14952 outfile_check_timer
= 0;
14957 outfile_check_timer
= 0;
14963 * Inform the user if we got some hashes remove because of the pot file remove feature
14966 if (data
.quiet
== 0)
14968 if (potfile_remove_cracks
> 0)
14970 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14971 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14975 data
.outfile_check_timer
= outfile_check_timer
;
14981 char **induction_dictionaries
= NULL
;
14983 int induction_dictionaries_cnt
= 0;
14985 hcstat_table_t
*root_table_buf
= NULL
;
14986 hcstat_table_t
*markov_table_buf
= NULL
;
14988 uint initial_restore_done
= 0;
14990 data
.maskcnt
= maskcnt
;
14992 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14994 if (data
.devices_status
== STATUS_CRACKED
) break;
14996 data
.devices_status
= STATUS_INIT
;
14998 if (maskpos
> rd
->maskpos
)
15003 rd
->maskpos
= maskpos
;
15004 data
.maskpos
= maskpos
;
15006 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
15008 char *mask
= masks
[maskpos
];
15010 if (mask_from_file
== 1)
15012 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
15017 uint mask_offset
= 0;
15019 uint separator_cnt
;
15021 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
15023 str_ptr
= strstr (mask
+ mask_offset
, ",");
15025 if (str_ptr
== NULL
) break;
15027 str_pos
= str_ptr
- mask
;
15029 // escaped separator, i.e. "\,"
15033 if (mask
[str_pos
- 1] == '\\')
15037 mask_offset
= str_pos
+ 1;
15043 // reset the offset
15047 mask
[str_pos
] = '\0';
15049 switch (separator_cnt
)
15052 mp_reset_usr (mp_usr
, 0);
15054 custom_charset_1
= mask
;
15055 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
15059 mp_reset_usr (mp_usr
, 1);
15061 custom_charset_2
= mask
;
15062 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
15066 mp_reset_usr (mp_usr
, 2);
15068 custom_charset_3
= mask
;
15069 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
15073 mp_reset_usr (mp_usr
, 3);
15075 custom_charset_4
= mask
;
15076 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
15080 mask
= mask
+ str_pos
+ 1;
15084 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15088 local_free (css_buf
);
15089 local_free (data
.root_css_buf
);
15090 local_free (data
.markov_css_buf
);
15092 local_free (masks
[maskpos
- 1]);
15095 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15098 data
.css_cnt
= css_cnt
;
15099 data
.css_buf
= css_buf
;
15101 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15103 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15105 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15107 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15108 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15110 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15112 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15114 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15115 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15117 data
.root_css_buf
= root_css_buf
;
15118 data
.markov_css_buf
= markov_css_buf
;
15120 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15122 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15124 local_free (root_table_buf
);
15125 local_free (markov_table_buf
);
15129 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15131 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15133 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
15134 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
15135 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
15137 device_param
->kernel_params_mp_buf64
[3] = 0;
15138 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
15139 device_param
->kernel_params_mp_buf32
[5] = 0;
15140 device_param
->kernel_params_mp_buf32
[6] = 0;
15141 device_param
->kernel_params_mp_buf32
[7] = 0;
15143 if (attack_mode
== ATTACK_MODE_HYBRID1
)
15145 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
15146 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
15147 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
15148 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
15150 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15152 device_param
->kernel_params_mp_buf32
[5] = 0;
15153 device_param
->kernel_params_mp_buf32
[6] = 0;
15154 device_param
->kernel_params_mp_buf32
[7] = 0;
15157 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
15158 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
15159 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
15161 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
);
15162 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
);
15165 else if (attack_mode
== ATTACK_MODE_BF
)
15167 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
15171 for (uint i
= 0; i
< dictcnt
; i
++)
15173 local_free (dictfiles
[i
]);
15176 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
15178 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
15180 if (l1_filename
== NULL
) break;
15184 dictfiles
[dictcnt
- 1] = l1_filename
;
15191 dictfiles
[dictcnt
- 1] = mask
;
15196 log_error ("ERROR: Mask is too small");
15203 free (induction_dictionaries
);
15205 // induction_dictionaries_cnt = 0; // implied
15207 if (attack_mode
!= ATTACK_MODE_BF
)
15211 induction_dictionaries
= scan_directory (induction_directory
);
15213 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15217 if (induction_dictionaries_cnt
)
15219 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15223 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15227 if ((maskcnt
> 1) || (dictcnt
> 1))
15229 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15235 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15237 char *subid
= logfile_generate_subid ();
15239 data
.subid
= subid
;
15241 logfile_sub_msg ("START");
15243 data
.devices_status
= STATUS_INIT
;
15245 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15246 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15247 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15249 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15253 data
.cpt_start
= time (NULL
);
15255 data
.cpt_total
= 0;
15257 if (data
.restore
== 0)
15259 rd
->words_cur
= skip
;
15266 data
.ms_paused
= 0;
15268 data
.words_cur
= rd
->words_cur
;
15270 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15272 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15274 device_param
->speed_pos
= 0;
15276 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15277 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15278 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15280 device_param
->gpu_power
= device_param
->gpu_power_user
;
15281 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15283 device_param
->outerloop_pos
= 0;
15284 device_param
->outerloop_left
= 0;
15285 device_param
->innerloop_pos
= 0;
15286 device_param
->innerloop_left
= 0;
15288 // some more resets:
15290 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15292 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15294 device_param
->pw_cnt
= 0;
15295 device_param
->pws_cnt
= 0;
15297 device_param
->words_off
= 0;
15298 device_param
->words_done
= 0;
15301 data
.gpu_blocks_div
= 0;
15303 // figure out some workload
15305 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15307 if (data
.wordlist_mode
== WL_MODE_FILE
)
15309 char *dictfile
= NULL
;
15311 if (induction_dictionaries_cnt
)
15313 dictfile
= induction_dictionaries
[0];
15317 dictfile
= dictfiles
[dictpos
];
15320 data
.dictfile
= dictfile
;
15322 logfile_sub_string (dictfile
);
15324 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15326 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15329 FILE *fd2
= fopen (dictfile
, "rb");
15333 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15338 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15342 if (data
.words_cnt
== 0)
15344 if (data
.devices_status
== STATUS_CRACKED
) break;
15345 if (data
.devices_status
== STATUS_ABORTED
) break;
15353 else if (attack_mode
== ATTACK_MODE_COMBI
)
15355 char *dictfile
= data
.dictfile
;
15356 char *dictfile2
= data
.dictfile2
;
15358 logfile_sub_string (dictfile
);
15359 logfile_sub_string (dictfile2
);
15361 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15363 FILE *fd2
= fopen (dictfile
, "rb");
15367 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15372 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15376 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15378 FILE *fd2
= fopen (dictfile2
, "rb");
15382 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15387 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15392 if (data
.words_cnt
== 0)
15394 if (data
.devices_status
== STATUS_CRACKED
) break;
15395 if (data
.devices_status
== STATUS_ABORTED
) break;
15402 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15404 char *dictfile
= NULL
;
15406 if (induction_dictionaries_cnt
)
15408 dictfile
= induction_dictionaries
[0];
15412 dictfile
= dictfiles
[dictpos
];
15415 data
.dictfile
= dictfile
;
15417 char *mask
= data
.mask
;
15419 logfile_sub_string (dictfile
);
15420 logfile_sub_string (mask
);
15422 FILE *fd2
= fopen (dictfile
, "rb");
15426 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15431 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15435 if (data
.words_cnt
== 0)
15437 if (data
.devices_status
== STATUS_CRACKED
) break;
15438 if (data
.devices_status
== STATUS_ABORTED
) break;
15445 else if (attack_mode
== ATTACK_MODE_BF
)
15447 local_free (css_buf
);
15448 local_free (data
.root_css_buf
);
15449 local_free (data
.markov_css_buf
);
15451 char *mask
= dictfiles
[dictpos
];
15453 logfile_sub_string (mask
);
15457 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15459 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15461 uint css_cnt_unicode
= css_cnt
* 2;
15463 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15465 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15467 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15469 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15470 css_buf_unicode
[j
+ 1].cs_len
= 1;
15475 css_buf
= css_buf_unicode
;
15476 css_cnt
= css_cnt_unicode
;
15479 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15481 uint mask_min
= pw_min
;
15482 uint mask_max
= pw_max
;
15484 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15490 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15492 if (css_cnt
< mask_min
)
15494 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15497 if (css_cnt
> mask_max
)
15499 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15502 // skip to next mask
15506 rd
->dictpos
= dictpos
;
15508 logfile_sub_msg ("STOP");
15513 uint save_css_cnt
= css_cnt
;
15515 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15517 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15519 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15520 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15522 uint css_cnt_salt
= css_cnt
+ salt_len
;
15524 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15526 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15528 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15530 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15531 css_buf_salt
[j
].cs_len
= 1;
15536 css_buf
= css_buf_salt
;
15537 css_cnt
= css_cnt_salt
;
15542 data
.css_cnt
= css_cnt
;
15543 data
.css_buf
= css_buf
;
15545 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15547 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15549 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15551 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15553 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15554 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15556 sp_setup_tbl (shared_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15558 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15560 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15561 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15563 data
.root_css_buf
= root_css_buf
;
15564 data
.markov_css_buf
= markov_css_buf
;
15566 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15568 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15570 local_free (root_table_buf
);
15571 local_free (markov_table_buf
);
15575 uint css_cnt_l
= css_cnt
;
15578 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15580 if (save_css_cnt
< 6)
15584 else if (save_css_cnt
== 6)
15590 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15592 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15603 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15618 /* unfinished code?
15619 int sum = css_buf[css_cnt_r - 1].cs_len;
15621 for (uint i = 1; i < 4 && i < css_cnt; i++)
15623 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15627 sum *= css_buf[css_cnt_r - 1].cs_len;
15632 css_cnt_l
-= css_cnt_r
;
15634 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15636 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15638 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15640 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15641 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15642 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15644 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15645 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15646 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15647 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15648 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15649 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15651 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15652 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15653 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15654 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15656 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15657 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15658 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15660 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15661 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15662 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15663 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15664 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15666 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
]);
15667 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
]);
15668 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
]);
15670 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
]);
15671 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
]);
15672 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
]);
15674 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
);
15675 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
);
15679 uint64_t words_base
= data
.words_cnt
;
15681 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15683 if (data
.gpu_rules_cnt
)
15685 words_base
/= data
.gpu_rules_cnt
;
15688 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15690 if (data
.combs_cnt
)
15692 words_base
/= data
.combs_cnt
;
15695 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15699 words_base
/= data
.bfs_cnt
;
15703 data
.words_base
= words_base
;
15707 log_info ("%llu", (unsigned long long int) words_base
);
15712 if (data
.words_cur
> data
.words_base
)
15714 log_error ("ERROR: restore value greater keyspace");
15719 if (data
.words_cur
)
15721 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15723 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15725 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15728 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15730 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15732 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15735 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15737 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15739 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15745 * Inform user about possible slow speeds
15748 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15750 if (data
.words_base
< gpu_blocks_all
)
15755 log_info ("ATTENTION!");
15756 log_info (" The wordlist or mask you are using is too small.");
15757 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15758 log_info (" The cracking speed will drop.");
15759 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15766 * Update loopback file
15775 uint random_num
= get_random_num (0, 9999);
15777 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15779 data
.loopback_file
= loopback_file
;
15783 * Update dictionary statistic
15788 dictstat_fp
= fopen (dictstat
, "wb");
15792 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15794 fclose (dictstat_fp
);
15798 data
.devices_status
= STATUS_RUNNING
;
15800 if (initial_restore_done
== 0)
15802 if (data
.restore_disable
== 0) cycle_restore ();
15804 initial_restore_done
= 1;
15807 hc_timer_set (&data
.timer_running
);
15809 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15811 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15813 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15814 if (quiet
== 0) fflush (stdout
);
15817 else if (wordlist_mode
== WL_MODE_STDIN
)
15819 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15820 if (data
.quiet
== 0) log_info ("");
15823 time_t runtime_start
;
15825 time (&runtime_start
);
15827 data
.runtime_start
= runtime_start
;
15830 * create cracker threads
15833 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15835 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15837 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15839 device_param
->device_id
= device_id
;
15841 if (wordlist_mode
== WL_MODE_STDIN
)
15843 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15847 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15851 // wait for crack threads to exit
15853 hc_thread_wait (devices_cnt
, c_threads
);
15855 local_free (c_threads
);
15861 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15863 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15865 if (data
.devices_status
== STATUS_CRACKED
) break;
15866 if (data
.devices_status
== STATUS_ABORTED
) break;
15868 if (data
.devices_status
== STATUS_BYPASS
)
15870 data
.devices_status
= STATUS_RUNNING
;
15873 if (induction_dictionaries_cnt
)
15875 unlink (induction_dictionaries
[0]);
15878 free (induction_dictionaries
);
15880 if (attack_mode
!= ATTACK_MODE_BF
)
15882 induction_dictionaries
= scan_directory (induction_directory
);
15884 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15887 if (benchmark
== 0)
15889 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15891 if (quiet
== 0) clear_prompt ();
15893 if (quiet
== 0) log_info ("");
15901 if (quiet
== 0) status_display ();
15904 if (quiet
== 0) log_info ("");
15908 if (attack_mode
== ATTACK_MODE_BF
)
15912 rd
->dictpos
= dictpos
;
15916 if (induction_dictionaries_cnt
)
15918 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15924 rd
->dictpos
= dictpos
;
15928 time_t runtime_stop
;
15930 time (&runtime_stop
);
15932 data
.runtime_stop
= runtime_stop
;
15934 logfile_sub_uint (runtime_start
);
15935 logfile_sub_uint (runtime_stop
);
15937 logfile_sub_msg ("STOP");
15939 global_free (subid
);
15942 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15944 if (data
.devices_status
== STATUS_CRACKED
) break;
15945 if (data
.devices_status
== STATUS_ABORTED
) break;
15946 if (data
.devices_status
== STATUS_QUIT
) break;
15948 if (data
.devices_status
== STATUS_BYPASS
)
15950 data
.devices_status
= STATUS_RUNNING
;
15954 // 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
15956 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15958 if (data
.wordlist_mode
== WL_MODE_FILE
)
15960 if (data
.dictfile
== NULL
)
15962 if (dictfiles
!= NULL
)
15964 data
.dictfile
= dictfiles
[0];
15966 hc_timer_set (&data
.timer_running
);
15971 // NOTE: combi is okay because it is already set beforehand
15972 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15974 if (data
.dictfile
== NULL
)
15976 if (dictfiles
!= NULL
)
15978 hc_timer_set (&data
.timer_running
);
15980 data
.dictfile
= dictfiles
[0];
15984 else if (attack_mode
== ATTACK_MODE_BF
)
15986 if (data
.mask
== NULL
)
15988 hc_timer_set (&data
.timer_running
);
15990 data
.mask
= masks
[0];
15994 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15996 data
.devices_status
= STATUS_EXHAUSTED
;
15999 // if cracked / aborted remove last induction dictionary
16001 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
16003 struct stat induct_stat
;
16005 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
16007 unlink (induction_dictionaries
[file_pos
]);
16011 // wait for non-interactive threads
16013 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
16015 hc_thread_wait (1, &ni_threads
[thread_idx
]);
16018 local_free (ni_threads
);
16020 // wait for interactive threads
16022 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
16024 hc_thread_wait (1, &i_thread
);
16027 // we dont need restore file anymore
16028 if (data
.restore_disable
== 0)
16030 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
16032 unlink (eff_restore_file
);
16033 unlink (new_restore_file
);
16041 // finally save left hashes
16043 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
16052 if (benchmark
== 1)
16054 status_benchmark ();
16060 if (quiet
== 0) clear_prompt ();
16062 if (quiet
== 0) log_info ("");
16070 if (quiet
== 0) status_display ();
16073 if (quiet
== 0) log_info ("");
16076 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
16078 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
16080 local_free (device_param
->result
);
16082 local_free (device_param
->pw_caches
);
16084 local_free (device_param
->combs_buf
);
16086 local_free (device_param
->hooks_buf
);
16088 local_free (device_param
->device_name
);
16090 local_free (device_param
->device_version
);
16092 local_free (device_param
->driver_version
);
16094 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
16095 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
16096 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
16097 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
16098 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
16099 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
16100 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
16101 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
16102 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
16103 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
16104 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
16105 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
16106 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
16107 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
16108 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
16109 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
16110 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
16111 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
16112 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
16113 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
16114 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
16115 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
16116 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
16117 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
16118 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
16119 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
16120 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
16121 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
16122 if (device_param
->d_tm_c
) hc_clReleaseMemObject (device_param
->d_tm_c
);
16124 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
16125 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
16126 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
16127 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
16128 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
16129 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
16130 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
16131 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
16132 if (device_param
->kernel_tb
) hc_clReleaseKernel (device_param
->kernel_tb
);
16133 if (device_param
->kernel_tm
) hc_clReleaseKernel (device_param
->kernel_tm
);
16134 if (device_param
->kernel_amp
) hc_clReleaseKernel (device_param
->kernel_amp
);
16136 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
16137 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
16138 if (device_param
->program_amp
) hc_clReleaseProgram (device_param
->program_amp
);
16139 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
16140 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
16143 // reset default fan speed
16145 if (gpu_temp_disable
== 0)
16147 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
16149 hc_thread_mutex_lock (mux_adl
);
16151 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16153 if (data
.hm_device
[i
].fan_supported
== 1)
16155 int fanspeed
= temp_retain_fanspeed_value
[i
];
16157 if (fanspeed
== -1) continue;
16159 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
16161 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
16165 hc_thread_mutex_unlock (mux_adl
);
16169 // reset power tuning
16171 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
16173 hc_thread_mutex_lock (mux_adl
);
16175 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16177 if (data
.hm_device
[i
].od_version
== 6)
16179 // check powertune capabilities first, if not available then skip device
16181 int powertune_supported
= 0;
16183 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
16185 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
16190 if (powertune_supported
!= 0)
16192 // powercontrol settings
16194 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
16196 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16203 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
16205 performance_state
->iNumberOfPerformanceLevels
= 2;
16207 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
16208 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
16209 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
16210 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
16212 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
16214 log_info ("ERROR: Failed to restore ADL performance state");
16219 local_free (performance_state
);
16224 hc_thread_mutex_unlock (mux_adl
);
16227 if (gpu_temp_disable
== 0)
16229 if (vendor_id
== VENDOR_ID_NV
)
16232 hc_NVML_nvmlShutdown (data
.hm_dll
);
16240 if (vendor_id
== VENDOR_ID_AMD
)
16242 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
16244 hm_close (data
.hm_dll
);
16248 if (vendor_id
== VENDOR_ID_NV
)
16250 hm_close (data
.hm_dll
);
16257 local_free (masks
);
16259 local_free (dictstat_base
);
16261 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16263 pot_t
*pot_ptr
= &pot
[pot_pos
];
16265 hash_t
*hash
= &pot_ptr
->hash
;
16267 local_free (hash
->digest
);
16271 local_free (hash
->salt
);
16277 local_free (all_gpu_rules_cnt
);
16278 local_free (all_gpu_rules_buf
);
16280 local_free (wl_data
->buf
);
16281 local_free (wl_data
);
16283 local_free (bitmap_s1_a
);
16284 local_free (bitmap_s1_b
);
16285 local_free (bitmap_s1_c
);
16286 local_free (bitmap_s1_d
);
16287 local_free (bitmap_s2_a
);
16288 local_free (bitmap_s2_b
);
16289 local_free (bitmap_s2_c
);
16290 local_free (bitmap_s2_d
);
16292 local_free (temp_retain_fanspeed_value
);
16293 local_free (od_clock_mem_status
);
16294 local_free (od_power_control_status
);
16296 global_free (devices_param
);
16298 global_free (gpu_rules_buf
);
16300 global_free (root_css_buf
);
16301 global_free (markov_css_buf
);
16303 global_free (digests_buf
);
16304 global_free (digests_shown
);
16305 global_free (digests_shown_tmp
);
16307 global_free (salts_buf
);
16308 global_free (salts_shown
);
16310 global_free (esalts_buf
);
16312 global_free (words_progress_done
);
16313 global_free (words_progress_rejected
);
16314 global_free (words_progress_restored
);
16316 if (pot_fp
) fclose (pot_fp
);
16318 if (data
.devices_status
== STATUS_QUIT
) break;
16321 // destroy others mutex
16323 hc_thread_mutex_delete (mux_dispatcher
);
16324 hc_thread_mutex_delete (mux_counter
);
16325 hc_thread_mutex_delete (mux_display
);
16326 hc_thread_mutex_delete (mux_adl
);
16330 local_free (eff_restore_file
);
16331 local_free (new_restore_file
);
16337 local_free (loopback_file
);
16339 if (loopback
== 1) unlink (loopback_file
);
16341 // induction directory
16343 if (induction_dir
== NULL
)
16345 if (attack_mode
!= ATTACK_MODE_BF
)
16347 if (rmdir (induction_directory
) == -1)
16349 if (errno
== ENOENT
)
16351 // good, we can ignore
16353 else if (errno
== ENOTEMPTY
)
16355 // good, we can ignore
16359 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16365 local_free (induction_directory
);
16369 // outfile-check directory
16371 if (outfile_check_dir
== NULL
)
16373 if (rmdir (outfile_check_directory
) == -1)
16375 if (errno
== ENOENT
)
16377 // good, we can ignore
16379 else if (errno
== ENOTEMPTY
)
16381 // good, we can ignore
16385 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16391 local_free (outfile_check_directory
);
16398 logfile_top_uint (proc_start
);
16399 logfile_top_uint (proc_stop
);
16401 logfile_top_msg ("STOP");
16403 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16404 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16406 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16407 if (data
.devices_status
== STATUS_QUIT
) return 2;
16408 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16409 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16410 if (data
.devices_status
== STATUS_CRACKED
) return 0;