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
21 // comment-out for kernel source mode
23 //#define BINARY_KERNEL
28 #define MARKOV_THRESHOLD 0
29 #define MARKOV_DISABLE 0
30 #define MARKOV_CLASSIC 0
32 #define BENCHMARK_MODE 1
34 #define RESTORE_TIMER 60
35 #define RESTORE_DISABLE 0
37 #define STATUS_TIMER 10
38 #define STATUS_AUTOMAT 0
40 #define WEAK_HASH_THRESHOLD 100
45 #define REMOVE_TIMER 60
49 #define POTFILE_DISABLE 0
52 #define RP_GEN_FUNC_MIN 1
53 #define RP_GEN_FUNC_MAX 4
55 #define RULE_BUF_L ":"
56 #define RULE_BUF_R ":"
61 #define HEX_WORDLIST 0
62 #define OUTFILE_FORMAT 3
63 #define OUTFILE_AUTOHEX 1
64 #define OUTFILE_CHECK_TIMER 5
67 #define SEGMENT_SIZE 32
69 #define INCREMENT_MIN 1
70 #define INCREMENT_MAX PW_MAX
74 #define GPU_TEMP_DISABLE 0
75 #define GPU_TEMP_ABORT 90
76 #define GPU_TEMP_RETAIN 80
77 #define WORKLOAD_PROFILE 2
80 #define GPU_RULES 1024
81 #define GPU_COMBS 1024
83 #define GPU_THREADS 64
84 #define POWERTUNE_ENABLE 0
85 #define LOGFILE_DISABLE 0
88 #define WL_MODE_STDIN 1
89 #define WL_MODE_FILE 2
90 #define WL_MODE_MASK 3
92 #define HL_MODE_FILE 4
95 #define HLFMT_HASHCAT 0
96 #define HLFMT_PWDUMP 1
97 #define HLFMT_PASSWD 2
98 #define HLFMT_SHADOW 3
101 #define HLFMT_NETNTLM1 7
102 #define HLFMT_NETNTLM2 8
103 #define HLFMT_NSLDAP 9
104 #define HLFMT_NSLDAPS 10
105 #define HLFMTS_CNT 11
107 #define ATTACK_MODE_STRAIGHT 0
108 #define ATTACK_MODE_COMBI 1
109 #define ATTACK_MODE_TOGGLE 2
110 #define ATTACK_MODE_BF 3
111 #define ATTACK_MODE_PERM 4
112 #define ATTACK_MODE_TABLE 5
113 #define ATTACK_MODE_HYBRID1 6
114 #define ATTACK_MODE_HYBRID2 7
115 #define ATTACK_MODE_NONE 100
117 #define ATTACK_KERN_STRAIGHT 0
118 #define ATTACK_KERN_COMBI 1
119 #define ATTACK_KERN_BF 3
120 #define ATTACK_KERN_NONE 100
122 #define ATTACK_EXEC_ON_CPU 10
123 #define ATTACK_EXEC_ON_GPU 11
125 #define COMBINATOR_MODE_BASE_LEFT 10001
126 #define COMBINATOR_MODE_BASE_RIGHT 10002
128 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
129 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
131 #define MAX_CUT_TRIES 4
133 #define MAX_DICTSTAT 10000
135 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 128
137 #define global_free(attr) \
139 myfree ((void *) data.attr); \
144 #define local_free(attr) \
146 myfree ((void *) attr); \
151 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
287 static void (*get_next_word_func
) (char *, uint32_t, uint32_t *, uint32_t *);
293 static unsigned int full01
= 0x01010101;
294 static unsigned int full80
= 0x80808080;
296 int SUPPRESS_OUTPUT
= 0;
298 hc_thread_mutex_t mux_adl
;
299 hc_thread_mutex_t mux_counter
;
300 hc_thread_mutex_t mux_dispatcher
;
301 hc_thread_mutex_t mux_display
;
303 hc_global_data_t data
;
305 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
307 const char *USAGE_MINI
[] =
309 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
311 "Try --help for more help.",
315 const char *USAGE_BIG
[] =
317 "%s, advanced password recovery",
319 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
327 " -m, --hash-type=NUM Hash-type, see references below",
328 " -a, --attack-mode=NUM Attack-mode, see references below",
329 " -V, --version Print version",
330 " -h, --help Print help",
331 " --quiet Suppress output",
335 " -b, --benchmark Run benchmark",
336 " --benchmark-mode=NUM Benchmark-mode, see references below",
340 " --hex-charset Assume charset is given in hex",
341 " --hex-salt Assume salt is given in hex",
342 " --hex-wordlist Assume words in wordlist is given in hex",
343 " --force Ignore warnings",
344 " --status Enable automatic update of the status-screen",
345 " --status-timer=NUM Seconds between status-screen update",
346 " --status-automat Display the status view in a machine readable format",
347 " --loopback Add new plains to induct directory",
348 " --weak-hash-threshold=NUM Threshold when to stop checking for weak hashes, default is 100 salts",
352 " --markov-hcstat=FILE Specify hcstat file to use, default is hashcat.hcstat",
353 " --markov-disable Disables markov-chains, emulates classic brute-force",
354 " --markov-classic Enables classic markov-chains, no per-position enhancement",
355 " -t, --markov-threshold=NUM Threshold when to stop accepting new markov-chains",
359 " --runtime=NUM Abort session after NUM seconds of runtime",
360 " --session=STR Define specific session name",
361 " --restore Restore session from --session",
362 " --restore-disable Do not write restore file",
366 " -o, --outfile=FILE Define outfile for recovered hash",
367 " --outfile-format=NUM Define outfile-format for recovered hash, see references below",
368 " --outfile-autohex-disable Disable the use of $HEX[] in output plains",
369 " --outfile-check-timer=NUM Seconds between outfile checks",
370 " -p, --separator=CHAR Separator char for hashlists and outfile",
371 " --show Show cracked passwords only",
372 " --left Show un-cracked passwords only",
373 " --username Enable ignoring of usernames in hashfile (recommended: also use --show)",
374 " --remove Enable remove of hash once it is cracked",
375 " --remove-timer=NUM Update input hash file each NUM seconds",
376 " --potfile-disable Do not write potfile",
377 " --debug-mode=NUM Defines the debug mode (hybrid only by using rules), see references below",
378 " --debug-file=FILE Output file for debugging rules (see also --debug-mode)",
379 " --induction-dir=FOLDER Specify induction directory to use, default is $session.induct",
380 " --outfile-check-dir=FOLDER Specify the outfile directory which should be monitored, default is $session.outfiles",
381 " --logfile-disable Disable the logfile",
382 " --truecrypt-keyfiles=FILE Keyfiles used, seperate with comma",
386 " -c, --segment-size=NUM Size in MB to cache from the wordfile",
387 " --bitmap-min=NUM Minimum number of bits allowed for bitmaps",
388 " --bitmap-max=NUM Maximum number of bits allowed for bitmaps",
389 " --cpu-affinity=STR Locks to CPU devices, seperate with comma",
390 " -d, --gpu-devices=STR Devices to use, separate with comma",
391 " -w, --workload-profile=NUM Enable a specific workload profile, see references below",
392 " -n, --gpu-accel=NUM Workload tuning: 1, 8, 40, 80, 160",
393 " -u, --gpu-loops=NUM Workload fine-tuning: 8 - 1024",
394 " --gpu-temp-disable Disable temperature and fanspeed readings and triggers",
395 " --gpu-temp-abort=NUM Abort session if GPU temperature reaches NUM degrees celsius",
396 " --gpu-temp-retain=NUM Try to retain GPU temperature at NUM degrees celsius (AMD only)",
397 " --powertune-enable Enable automatic power tuning option (AMD OverDrive 6 only)",
398 " --scrypt-tmto=NUM Manually override automatically calculated TMTO value for scrypt",
402 " -s, --skip=NUM Skip number of words",
403 " -l, --limit=NUM Limit number of words",
404 " --keyspace Show keyspace base:mod values and quit",
408 " -j, --rule-left=RULE Single rule applied to each word from left dict",
409 " -k, --rule-right=RULE Single rule applied to each word from right dict",
410 " -r, --rules-file=FILE Rules-file, multi use: -r 1.rule -r 2.rule",
411 " -g, --generate-rules=NUM Generate NUM random rules",
412 " --generate-rules-func-min=NUM Force NUM functions per random rule min",
413 " --generate-rules-func-max=NUM Force NUM functions per random rule max",
414 " --generate-rules-seed=NUM Force RNG seed to NUM",
416 "* Custom charsets:",
418 " -1, --custom-charset1=CS User-defined charsets",
419 " -2, --custom-charset2=CS Example:",
420 " -3, --custom-charset3=CS --custom-charset1=?dabcdef : sets charset ?1 to 0123456789abcdef",
421 " -4, --custom-charset4=CS -2 mycharset.hcchr : sets charset ?2 to chars contained in file",
425 " -i, --increment Enable increment mode",
426 " --increment-min=NUM Start incrementing at NUM",
427 " --increment-max=NUM Stop incrementing at NUM",
433 "* Workload Profile:",
435 " 1 = Reduced performance profile (low latency desktop)",
436 " 2 = Default performance profile",
437 " 3 = Tuned performance profile (high latency desktop)",
439 "* Benchmark Settings:",
441 " 0 = Manual Tuning",
442 " 1 = Performance Tuning, default",
444 "* Outfile Formats:",
448 " 3 = hash[:salt]:plain",
450 " 5 = hash[:salt]:hex_plain",
451 " 6 = plain:hex_plain",
452 " 7 = hash[:salt]:plain:hex_plain",
454 " 9 = hash[:salt]:crackpos",
455 " 10 = plain:crackpos",
456 " 11 = hash[:salt]:plain:crackpos",
457 " 12 = hex_plain:crackpos",
458 " 13 = hash[:salt]:hex_plain:crackpos",
459 " 14 = plain:hex_plain:crackpos",
460 " 15 = hash[:salt]:plain:hex_plain:crackpos",
462 "* Debug mode output formats (for hybrid mode only, by using rules):",
464 " 1 = save finding rule",
465 " 2 = save original word",
466 " 3 = save original word and finding rule",
467 " 4 = save original word, finding rule and modified plain",
469 "* Built-in charsets:",
471 " ?l = abcdefghijklmnopqrstuvwxyz",
472 " ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ",
474 " ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
483 " 6 = Hybrid dict + mask",
484 " 7 = Hybrid mask + dict",
488 "[[ Roll-your-own: Raw Hashes ]]",
497 " 5000 = SHA-3(Keccak)",
501 " 6900 = GOST R 34.11-94",
502 " 11700 = GOST R 34.11-2012 (Streebog) 256-bit",
503 " 11800 = GOST R 34.11-2012 (Streebog) 512-bit",
505 "[[ Roll-your-own: Iterated and / or Salted Hashes ]]",
507 " 10 = md5($pass.$salt)",
508 " 20 = md5($salt.$pass)",
509 " 30 = md5(unicode($pass).$salt)",
510 " 40 = md5($salt.unicode($pass))",
511 " 3800 = md5($salt.$pass.$salt)",
512 " 3710 = md5($salt.md5($pass))",
513 " 2600 = md5(md5($pass)",
514 " 4300 = md5(strtoupper(md5($pass)))",
515 " 4400 = md5(sha1($pass))",
516 " 110 = sha1($pass.$salt)",
517 " 120 = sha1($salt.$pass)",
518 " 130 = sha1(unicode($pass).$salt)",
519 " 140 = sha1($salt.unicode($pass))",
520 " 4500 = sha1(sha1($pass)",
521 " 4700 = sha1(md5($pass))",
522 " 4900 = sha1($salt.$pass.$salt)",
523 " 1410 = sha256($pass.$salt)",
524 " 1420 = sha256($salt.$pass)",
525 " 1430 = sha256(unicode($pass).$salt)",
526 " 1440 = sha256($salt.unicode($pass))",
527 " 1710 = sha512($pass.$salt)",
528 " 1720 = sha512($salt.$pass)",
529 " 1730 = sha512(unicode($pass).$salt)",
530 " 1740 = sha512($salt.unicode($pass))",
532 "[[ Roll-your-own: Authenticated Hashes ]]",
534 " 50 = HMAC-MD5 (key = $pass)",
535 " 60 = HMAC-MD5 (key = $salt)",
536 " 150 = HMAC-SHA1 (key = $pass)",
537 " 160 = HMAC-SHA1 (key = $salt)",
538 " 1450 = HMAC-SHA256 (key = $pass)",
539 " 1460 = HMAC-SHA256 (key = $salt)",
540 " 1750 = HMAC-SHA512 (key = $pass)",
541 " 1760 = HMAC-SHA512 (key = $salt)",
547 " 11900 = PBKDF2-HMAC-MD5",
548 " 12000 = PBKDF2-HMAC-SHA1",
549 " 10900 = PBKDF2-HMAC-SHA256",
550 " 12100 = PBKDF2-HMAC-SHA512",
552 "[[ Network protocols, Challenge-Response ]]",
556 " 4800 = iSCSI CHAP authentication, MD5(Chap)",
557 " 5300 = IKE-PSK MD5",
558 " 5400 = IKE-PSK SHA1",
560 " 5500 = NetNTLMv1 + ESS",
562 " 7300 = IPMI2 RAKP HMAC-SHA1",
563 " 7500 = Kerberos 5 AS-REQ Pre-Auth etype 23",
564 " 8300 = DNSSEC (NSEC3)",
566 " 11100 = PostgreSQL Challenge-Response Authentication (MD5)",
567 " 11200 = MySQL Challenge-Response Authentication (SHA1)",
568 " 11400 = SIP digest authentication (MD5)",
570 "[[ Forums, CMS, E-Commerce, Frameworks, Middleware, Wiki, Management ]]",
572 " 121 = SMF (Simple Machines Forum)",
574 " 2611 = vBulletin < v3.8.5",
575 " 2711 = vBulletin > v3.8.5",
577 " 2811 = IPB (Invison Power Board)",
578 " 8400 = WBB3 (Woltlab Burning Board)",
579 " 11 = Joomla < 2.5.18",
580 " 400 = Joomla > 2.5.18",
586 " 11000 = PrestaShop",
587 " 124 = Django (SHA-1)",
588 " 10000 = Django (PBKDF2-SHA256)",
589 " 3711 = Mediawiki B type",
592 "[[ Database Server ]]",
595 " 131 = MSSQL(2000)",
596 " 132 = MSSQL(2005)",
597 " 1731 = MSSQL(2012)",
598 " 1731 = MSSQL(2014)",
600 " 300 = MySQL4.1/MySQL5",
601 " 3100 = Oracle H: Type (Oracle 7+)",
602 " 112 = Oracle S: Type (Oracle 11+)",
603 " 12300 = Oracle T: Type (Oracle 12+)",
604 " 8000 = Sybase ASE",
606 "[[ HTTP, SMTP, LDAP Server]]",
608 " 141 = EPiServer 6.x < v4",
609 " 1441 = EPiServer 6.x > v4",
610 " 1600 = Apache $apr1$",
611 " 12600 = ColdFusion 10+",
612 " 1421 = hMailServer",
613 " 101 = nsldap, SHA-1(Base64), Netscape LDAP SHA",
614 " 111 = nsldaps, SSHA-1(Base64), Netscape LDAP SSHA",
615 " 1711 = SSHA-512(Base64), LDAP {SSHA512}",
621 "[[ Operating-Systems ]]",
625 " 1100 = Domain Cached Credentials (DCC), MS Cache",
626 " 2100 = Domain Cached Credentials 2 (DCC2), MS Cache 2",
627 " 12800 = MS-AzureSync PBKDF2-HMAC-SHA256",
628 " 1500 = descrypt, DES(Unix), Traditional DES",
629 " 12400 = BSDiCrypt, Extended DES",
630 " 500 = md5crypt $1$, MD5(Unix)",
631 " 3200 = bcrypt $2*$, Blowfish(Unix)",
632 " 7400 = sha256crypt $5$, SHA256(Unix)",
633 " 1800 = sha512crypt $6$, SHA512(Unix)",
640 " 7100 = OSX v10.10",
641 " 6300 = AIX {smd5}",
642 " 6700 = AIX {ssha1}",
643 " 6400 = AIX {ssha256}",
644 " 6500 = AIX {ssha512}",
647 " 500 = Cisco-IOS $1$",
648 " 5700 = Cisco-IOS $4$",
649 " 9200 = Cisco-IOS $8$",
650 " 9300 = Cisco-IOS $9$",
651 " 22 = Juniper Netscreen/SSG (ScreenOS)",
652 " 501 = Juniper IVE",
653 " 5800 = Android PIN",
654 " 8100 = Citrix Netscaler",
659 "[[ Enterprise Application Software (EAS) ]]",
661 " 7700 = SAP CODVN B (BCODE)",
662 " 7800 = SAP CODVN F/G (PASSCODE)",
663 " 10300 = SAP CODVN H (PWDSALTEDHASH) iSSHA-1",
664 " 8600 = Lotus Notes/Domino 5",
665 " 8700 = Lotus Notes/Domino 6",
666 " 9100 = Lotus Notes/Domino 8",
674 "[[ Full-Disk encryptions (FDE) ]]",
676 " 62XY = TrueCrypt 5.0+",
677 " X = 1 = PBKDF2-HMAC-RipeMD160",
678 " X = 2 = PBKDF2-HMAC-SHA512",
679 " X = 3 = PBKDF2-HMAC-Whirlpool",
680 " X = 4 = PBKDF2-HMAC-RipeMD160 + boot-mode",
681 " Y = 1 = XTS 512 bit (Ciphers: AES or Serpent or Twofish)",
682 " Y = 2 = XTS 1024 bit (Ciphers: AES or Serpent or Twofish or AES-Twofish or Serpent-AES or Twofish-Serpent)",
683 " Y = 3 = XTS 1536 bit (Ciphers: All)",
684 " 8800 = Android FDE < v4.3",
689 " 9700 = MS Office <= 2003 MD5 + RC4, oldoffice$0, oldoffice$1",
690 " 9710 = MS Office <= 2003 MD5 + RC4, collider-mode #1",
691 " 9720 = MS Office <= 2003 MD5 + RC4, collider-mode #2",
692 " 9800 = MS Office <= 2003 SHA1 + RC4, oldoffice$3, oldoffice$4",
693 " 9810 = MS Office <= 2003 SHA1 + RC4, collider-mode #1",
694 " 9820 = MS Office <= 2003 SHA1 + RC4, collider-mode #2",
695 " 9400 = MS Office 2007",
696 " 9500 = MS Office 2010",
697 " 9600 = MS Office 2013",
698 " 10400 = PDF 1.1 - 1.3 (Acrobat 2 - 4)",
699 " 10410 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #1",
700 " 10420 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #2",
701 " 10500 = PDF 1.4 - 1.6 (Acrobat 5 - 8)",
702 " 10600 = PDF 1.7 Level 3 (Acrobat 9)",
703 " 10700 = PDF 1.7 Level 8 (Acrobat 10 - 11)",
705 "[[ Password Managers ]]",
707 " 9000 = Password Safe v2",
708 " 5200 = Password Safe v3",
710 " 6600 = 1Password, agilekeychain",
711 " 8200 = 1Password, cloudkeychain",
712 " 11300 = Bitcoin/Litecoin wallet.dat",
713 " 12700 = Blockchain, My Wallet",
719 * oclHashcat specific functions
722 void status_display_automat ()
726 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
732 fprintf (out
, "SPEED\t");
734 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
736 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
738 uint64_t speed_cnt
= 0;
741 for (int i
= 0; i
< SPEED_CACHE
; i
++)
745 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
747 if (rec_ms
> SPEED_MAXAGE
) continue;
749 speed_cnt
+= device_param
->speed_cnt
[i
];
750 speed_ms
+= device_param
->speed_ms
[i
];
753 speed_cnt
/= SPEED_CACHE
;
754 speed_ms
/= SPEED_CACHE
;
756 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
763 uint64_t words_cur
= get_lowest_words_done ();
765 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
771 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
773 if (salts_left
== 0) salts_left
= 1;
775 uint64_t progress_total
= data
.words_cnt
* salts_left
;
777 uint64_t all_done
= 0;
778 uint64_t all_rejected
= 0;
779 uint64_t all_restored
= 0;
781 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
785 // otherwise the final cracked status shows 0/XXX progress
787 if (data
.salts_shown
[salt_pos
] == 1) continue;
790 all_done
+= data
.words_progress_done
[salt_pos
];
791 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
792 all_restored
+= data
.words_progress_restored
[salt_pos
];
795 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
796 uint64_t progress_end
= progress_total
;
798 uint64_t progress_skip
= 0;
802 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
804 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
805 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
806 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
811 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
813 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
814 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
815 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
818 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
819 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
821 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
827 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
828 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
835 if (data.gpu_temp_disable == 0)
837 fprintf (out, "TEMP\t");
839 hc_thread_mutex_lock (mux_adl);
841 for (uint i = 0; i < data.devices_cnt; i++)
843 int temp = hm_get_temperature_with_device_id (i);
845 fprintf (out, "%d\t", temp);
848 hc_thread_mutex_unlock (mux_adl);
864 void status_display ()
866 if (data
.devices_status
== STATUS_INIT
) return;
867 if (data
.devices_status
== STATUS_STARTING
) return;
868 if (data
.devices_status
== STATUS_BYPASS
) return;
870 if (data
.status_automat
== 1)
872 status_display_automat ();
881 log_info ("Session.Name...: %s", data
.session
);
883 char *status_type
= strstatus (data
.devices_status
);
885 uint hash_mode
= data
.hash_mode
;
887 char *hash_type
= strhashtype (hash_mode
); // not a bug
889 log_info ("Status.........: %s", status_type
);
895 if (data
.rp_files_cnt
)
899 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
901 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
904 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
906 log_info ("Rules.Type.....: %s", tmp_buf
);
913 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
915 if (data
.rp_gen_seed
)
917 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
925 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
927 if (data
.wordlist_mode
== WL_MODE_FILE
)
929 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
931 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
933 log_info ("Input.Mode.....: Pipe");
936 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
938 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
939 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
941 else if (data
.attack_mode
== ATTACK_MODE_BF
)
943 char *mask
= data
.mask
;
947 uint mask_len
= data
.css_cnt
;
949 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
953 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
955 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
957 mask_len
-= data
.salts_buf
[0].salt_len
;
961 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
963 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
966 if (data
.maskcnt
> 1)
968 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
970 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
973 log_info ("Input.Mode.....: %s", tmp_buf
);
978 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
980 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
981 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
983 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
985 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
986 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
989 if (data
.digests_cnt
== 1)
991 if (data
.hash_mode
== 2500)
993 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
997 char *pke_ptr
= (char *) pke
;
999 for (uint i
= 0; i
< 25; i
++)
1001 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
1007 memcpy (mac1
, pke_ptr
+ 23, 6);
1008 memcpy (mac2
, pke_ptr
+ 29, 6);
1010 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1011 (char *) data
.salts_buf
[0].salt_buf
,
1025 else if (data
.hash_mode
== 5200)
1027 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1029 else if (data
.hash_mode
== 9000)
1031 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1033 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1035 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1041 ascii_digest (out_buf
, 0, 0);
1044 if (strlen (out_buf
) > 40)
1052 log_info ("Hash.Target....: %s", out_buf
);
1057 if (data
.hash_mode
== 3000)
1059 char out_buf1
[4096];
1060 char out_buf2
[4096];
1062 ascii_digest (out_buf1
, 0, 0);
1063 ascii_digest (out_buf2
, 0, 1);
1065 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1069 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1073 log_info ("Hash.Type......: %s", hash_type
);
1079 uint64_t speed_cnt
[DEVICES_MAX
];
1080 float speed_ms
[DEVICES_MAX
];
1082 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1084 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1086 // we need to clear values (set to 0) because in case the gpu does
1087 // not get new candidates it idles around but speed display would
1088 // show it as working.
1089 // if we instantly set it to 0 after reading it happens that the
1090 // speed can be shown as zero if the users refreshs to fast.
1091 // therefore, we add a timestamp when a stat was recorded and if its
1092 // to old we will not use it
1094 speed_cnt
[device_id
] = 0;
1095 speed_ms
[device_id
] = 0;
1097 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1101 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
1103 if (rec_ms
> SPEED_MAXAGE
) continue;
1105 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1106 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1109 speed_cnt
[device_id
] /= SPEED_CACHE
;
1110 speed_ms
[device_id
] /= SPEED_CACHE
;
1113 float hashes_all_ms
= 0;
1115 float hashes_dev_ms
[DEVICES_MAX
];
1117 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1119 hashes_dev_ms
[device_id
] = 0;
1121 if (speed_ms
[device_id
])
1123 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1125 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1133 float ms_running
= 0;
1135 hc_timer_get (data
.timer_running
, ms_running
);
1137 float ms_paused
= data
.ms_paused
;
1139 if (data
.devices_status
== STATUS_PAUSED
)
1141 float ms_paused_tmp
= 0;
1143 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1145 ms_paused
+= ms_paused_tmp
;
1150 __time64_t sec_run
= ms_running
/ 1000;
1154 time_t sec_run
= ms_running
/ 1000;
1160 char display_run
[32];
1168 tmp
= _gmtime64 (&sec_run
);
1172 tmp
= gmtime (&sec_run
);
1178 memcpy (&tm_run
, tmp
, sizeof (struct tm
));
1180 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1182 char *start
= ctime (&data
.proc_start
);
1184 size_t start_len
= strlen (start
);
1186 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1187 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1189 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1194 log_info ("Time.Started...: 0 secs");
1201 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
1203 if (salts_left
== 0) salts_left
= 1;
1205 uint64_t progress_total
= data
.words_cnt
* salts_left
;
1207 uint64_t all_done
= 0;
1208 uint64_t all_rejected
= 0;
1209 uint64_t all_restored
= 0;
1211 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1215 // otherwise the final cracked status shows 0/XXX progress
1217 if (data
.salts_shown
[salt_pos
] == 1) continue;
1220 all_done
+= data
.words_progress_done
[salt_pos
];
1221 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1222 all_restored
+= data
.words_progress_restored
[salt_pos
];
1225 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
1226 uint64_t progress_end
= progress_total
;
1228 uint64_t progress_skip
= 0;
1232 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
1234 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
1235 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1236 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1241 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
1243 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
1244 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1245 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1248 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
1249 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
1251 float speed_ms_real
= ms_running
- ms_paused
;
1252 uint64_t speed_plains_real
= all_done
;
1254 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1256 if (data
.devices_status
!= STATUS_CRACKED
)
1258 uint64_t words_per_ms
= 0;
1260 if (speed_plains_real
&& speed_ms_real
)
1262 words_per_ms
= speed_plains_real
/ speed_ms_real
;
1266 __time64_t sec_etc
= 0;
1273 uint64_t progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1275 uint64_t ms_left
= progress_left_relative_skip
/ words_per_ms
;
1277 sec_etc
= ms_left
/ 1000;
1282 log_info ("Time.Estimated.: 0 secs");
1284 else if ((uint64_t) sec_etc
> ETC_MAX
)
1286 log_info ("Time.Estimated.: > 10 Years");
1290 char display_etc
[32];
1298 tmp
= _gmtime64 (&sec_etc
);
1302 tmp
= gmtime (&sec_etc
);
1308 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1310 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1318 char *etc
= ctime (&now
);
1320 size_t etc_len
= strlen (etc
);
1322 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1323 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1325 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1331 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1333 char display_dev_cur
[16];
1335 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1337 strncpy (display_dev_cur
, "0.00", 4);
1339 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1341 log_info ("Speed.GPU.#%d...: %9sH/s", device_id
+ 1, display_dev_cur
);
1344 char display_all_cur
[16];
1346 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1348 strncpy (display_all_cur
, "0.00", 4);
1350 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1352 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*...: %9sH/s", display_all_cur
);
1354 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1355 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1357 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);
1361 if (data
.digests_cnt
> 100)
1363 time_t now
= time (NULL
);
1365 int cpt_cur_min
= 0;
1366 int cpt_cur_hour
= 0;
1367 int cpt_cur_day
= 0;
1369 for (int i
= 0; i
< CPT_BUF
; i
++)
1371 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1372 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1374 if ((timestamp
+ 60) > now
)
1376 cpt_cur_min
+= cracked
;
1379 if ((timestamp
+ 3600) > now
)
1381 cpt_cur_hour
+= cracked
;
1384 if ((timestamp
+ 86400) > now
)
1386 cpt_cur_day
+= cracked
;
1390 float cpt_avg_min
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 60);
1391 float cpt_avg_hour
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 3600);
1392 float cpt_avg_day
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 86400);
1394 if ((data
.cpt_start
+ 86400) < now
)
1396 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1404 else if ((data
.cpt_start
+ 3600) < now
)
1406 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1413 else if ((data
.cpt_start
+ 60) < now
)
1415 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1423 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1432 uint64_t restore_point
= get_lowest_words_done ();
1434 uint64_t restore_total
= data
.words_base
;
1436 float percent_restore
= 0;
1438 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1440 if (progress_end_relative_skip
)
1442 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1444 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1445 float percent_rejected
= 0.0;
1449 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1452 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);
1453 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1455 if (data
.restore_disable
== 0)
1457 if (percent_finished
!= 1)
1459 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1466 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1468 log_info ("Progress.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1469 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1471 if (data
.restore_disable
== 0)
1473 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1478 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1479 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1481 // --restore not allowed if stdin is used -- really? why?
1483 //if (data.restore_disable == 0)
1485 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1491 if (data.gpu_temp_disable == 0)
1493 hc_thread_mutex_lock (mux_adl);
1495 for (uint i = 0; i < data.devices_cnt; i++)
1497 if (data.hm_device[i].fan_supported == 1)
1499 const int temperature = hm_get_temperature_with_device_id (i);
1500 const int utilization = hm_get_utilization_with_device_id (i);
1501 const int fanspeed = hm_get_fanspeed_with_device_id (i);
1503 if (vendor_id == VENDOR_ID_AMD)
1505 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i + 1, utilization, temperature, fanspeed);
1508 if (vendor_id == VENDOR_ID_NV)
1511 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i + 1, utilization, temperature, fanspeed);
1513 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2drpm Fan", i + 1, utilization, temperature, fanspeed);
1519 const int temperature = hm_get_temperature_with_device_id (i);
1520 const int utilization = hm_get_utilization_with_device_id (i);
1522 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, N/A Fan", i + 1, utilization, temperature);
1526 hc_thread_mutex_unlock (mux_adl);
1531 static void status_benchmark ()
1533 if (data
.devices_status
== STATUS_INIT
) return;
1534 if (data
.devices_status
== STATUS_STARTING
) return;
1536 if (data
.words_cnt
== 0) return;
1538 uint64_t speed_cnt
[DEVICES_MAX
];
1539 float speed_ms
[DEVICES_MAX
];
1543 for (device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1545 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1547 speed_cnt
[device_id
] = 0;
1548 speed_ms
[device_id
] = 0;
1550 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1552 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1553 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1556 speed_cnt
[device_id
] /= SPEED_CACHE
;
1557 speed_ms
[device_id
] /= SPEED_CACHE
;
1560 float hashes_all_ms
= 0;
1562 float hashes_dev_ms
[DEVICES_MAX
];
1564 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1566 hashes_dev_ms
[device_id
] = 0;
1568 if (speed_ms
[device_id
])
1570 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1572 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1576 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1578 char display_dev_cur
[16];
1580 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1582 strncpy (display_dev_cur
, "0.00", 4);
1584 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1586 log_info ("Speed.GPU.#%d.: %9sH/s", device_id
+ 1, display_dev_cur
);
1589 char display_all_cur
[16];
1591 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1593 strncpy (display_all_cur
, "0.00", 4);
1595 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1597 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*.: %9sH/s", display_all_cur
);
1601 * oclHashcat -only- functions
1604 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *kernel_file
)
1606 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1608 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1609 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a0.cl", install_dir
, (int) kern_type
);
1610 else if (attack_kern
== ATTACK_KERN_COMBI
)
1611 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a1.cl", install_dir
, (int) kern_type
);
1612 else if (attack_kern
== ATTACK_KERN_BF
)
1613 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a3.cl", install_dir
, (int) kern_type
);
1616 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d.cl", install_dir
, (int) kern_type
);
1619 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1621 if (line_len
& 1) return (line_len
); // not in hex
1623 if (data
.hex_wordlist
== 1)
1628 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1630 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1633 memset (line_buf
+ i
, 0, line_len
- i
);
1637 else if (line_len
>= 6) // $HEX[] = 6
1639 if (line_buf
[0] != '$') return (line_len
);
1640 if (line_buf
[1] != 'H') return (line_len
);
1641 if (line_buf
[2] != 'E') return (line_len
);
1642 if (line_buf
[3] != 'X') return (line_len
);
1643 if (line_buf
[4] != '[') return (line_len
);
1644 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1649 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1651 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1654 memset (line_buf
+ i
, 0, line_len
- i
);
1662 static uint
count_lines (FILE *fd
)
1666 char *buf
= (char *) mymalloc (BUFSIZ
);
1668 size_t nread_tmp
= 0;
1674 size_t nread
= fread (buf
, sizeof (char), BUFSIZ
, fd
);
1677 if (nread
< 1) continue;
1683 if (*ptr
++ == '\n') cnt
++;
1688 // special case (if last line did not contain a newline char ... at the very end of the file)
1698 if (*ptr
!= '\n') // needed ? different on windows systems?
1710 static void clear_prompt ()
1712 fputc ('\r', stdout
);
1714 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1716 fputc (' ', stdout
);
1719 fputc ('\r', stdout
);
1724 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const uint64_t gidd
, pw_t
*pw
)
1726 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1729 static void check_hash (hc_device_param_t
*device_param
, const uint salt_pos
, const uint digest_pos
)
1731 char *outfile
= data
.outfile
;
1732 uint quiet
= data
.quiet
;
1733 FILE *pot_fp
= data
.pot_fp
;
1734 uint loopback
= data
.loopback
;
1735 uint debug_mode
= data
.debug_mode
;
1736 char *debug_file
= data
.debug_file
;
1738 char debug_rule_buf
[BLOCK_SIZE
];
1739 int debug_rule_len
= 0; // -1 error
1740 uint debug_plain_len
= 0;
1742 unsigned char debug_plain_ptr
[BLOCK_SIZE
];
1746 char out_buf
[4096]; memset (out_buf
, 0, sizeof (out_buf
));
1748 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1750 uint idx
= data
.salts_buf
[salt_pos
].digests_offset
+ digest_pos
;
1756 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, idx
* sizeof (plain_t
), sizeof (plain_t
), &plain
, 0, NULL
, NULL
);
1758 uint gidvid
= plain
.gidvid
;
1759 uint il_pos
= plain
.il_pos
;
1761 uint64_t crackpos
= device_param
->words_off
;
1765 unsigned char *plain_ptr
= (unsigned char *) plain_buf
;
1766 unsigned int plain_len
= 0;
1768 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1770 uint64_t gidd
= gidvid
;
1775 gidd_to_pw_t (device_param
, gidd
, &pw
);
1777 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1779 plain_buf
[i
] = pw
.hi1
[0][j
];
1782 plain_len
= pw
.pw_len
;
1784 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1791 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1793 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1795 debug_rule_len
= gpu_rule_to_cpu_rule (debug_rule_buf
, &data
.gpu_rules_buf
[off
]);
1799 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1801 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1803 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1805 debug_plain_len
= plain_len
;
1809 plain_len
= apply_rules (data
.gpu_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1812 crackpos
*= data
.gpu_rules_cnt
;
1813 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1815 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1817 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1819 uint64_t gidd
= gidvid
;
1824 gidd_to_pw_t (device_param
, gidd
, &pw
);
1826 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1828 plain_buf
[i
] = pw
.hi1
[0][j
];
1831 plain_len
= pw
.pw_len
;
1833 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1834 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1836 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1838 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1842 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1844 memcpy (plain_ptr
, comb_buf
, comb_len
);
1847 plain_len
+= comb_len
;
1850 crackpos
*= data
.combs_cnt
;
1851 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1853 if (data
.pw_max
!= PW_DICTMAX1
)
1855 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1858 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1860 uint64_t l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1861 uint64_t r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1863 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1864 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1866 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1867 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1869 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1870 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1872 plain_len
= data
.css_cnt
;
1875 crackpos
*= data
.bfs_cnt
;
1876 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1878 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1880 uint64_t gidd
= gidvid
;
1885 gidd_to_pw_t (device_param
, gidd
, &pw
);
1887 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1889 plain_buf
[i
] = pw
.hi1
[0][j
];
1892 plain_len
= pw
.pw_len
;
1894 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1897 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1899 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1901 plain_len
+= start
+ stop
;
1904 crackpos
*= data
.combs_cnt
;
1905 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1907 if (data
.pw_max
!= PW_DICTMAX1
)
1909 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1912 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1914 uint64_t gidd
= gidvid
;
1919 gidd_to_pw_t (device_param
, gidd
, &pw
);
1921 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1923 plain_buf
[i
] = pw
.hi1
[0][j
];
1926 plain_len
= pw
.pw_len
;
1928 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1931 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1933 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
1935 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1937 plain_len
+= start
+ stop
;
1940 crackpos
*= data
.combs_cnt
;
1941 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1943 if (data
.pw_max
!= PW_DICTMAX1
)
1945 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1949 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
1951 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1953 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1955 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
1959 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
1961 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
1963 plain_ptr
[j
] = plain_ptr
[i
];
1966 plain_len
= plain_len
/ 2;
1970 // if enabled, update also the potfile
1974 fprintf (pot_fp
, "%s:", out_buf
);
1976 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
1978 fputc ('\n', pot_fp
);
1985 FILE *out_fp
= NULL
;
1987 if (outfile
!= NULL
)
1989 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
1991 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2000 if (quiet
== 0) clear_prompt ();
2003 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2005 if (outfile
!= NULL
)
2007 if (out_fp
!= stdout
)
2014 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2016 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2018 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2019 if (quiet
== 0) fflush (stdout
);
2028 char *loopback_file
= data
.loopback_file
;
2032 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2034 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2036 fputc ('\n', fb_fp
);
2042 // (rule) debug mode
2044 // the next check implies that:
2045 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2048 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2050 if (debug_rule_len
< 0) debug_rule_len
= 0;
2052 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2054 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2056 if ((quiet
== 0) && (debug_file
== NULL
))
2058 fprintf (stdout
, "%s", PROMPT
);
2064 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2066 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2070 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2072 for (uint i
= 0; i
< GPU_THREADS
; i
++) if (device_param
->result
[i
] == 1) found
= 1;
2076 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2080 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
);
2082 uint cpt_cracked
= 0;
2084 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2086 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2088 if (data
.digests_shown_tmp
[idx
] == 0) continue;
2090 if (data
.digests_shown
[idx
] == 1) continue;
2092 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2094 data
.digests_shown
[idx
] = 1;
2096 data
.digests_done
++;
2100 salt_buf
->digests_done
++;
2102 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2104 data
.salts_shown
[salt_pos
] = 1;
2110 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2112 check_hash (device_param
, salt_pos
, digest_pos
);
2115 if (cpt_cracked
> 0)
2117 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2118 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2122 data
.cpt_total
+= cpt_cracked
;
2124 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2127 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2129 // we need to reset cracked state on the gpu
2130 // otherwise host thinks again and again the hash was cracked
2131 // and returns invalid password each time
2133 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2135 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
);
2138 memset (device_param
->result
, 0, device_param
->size_results
);
2140 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2144 static void save_hash ()
2146 char *hashfile
= data
.hashfile
;
2148 char new_hashfile
[256];
2149 char old_hashfile
[256];
2151 memset (new_hashfile
, 0, sizeof (new_hashfile
));
2152 memset (old_hashfile
, 0, sizeof (old_hashfile
));
2154 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2155 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2157 unlink (new_hashfile
);
2159 char separator
= data
.separator
;
2161 FILE *fp
= fopen (new_hashfile
, "wb");
2165 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2170 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2172 if (data
.salts_shown
[salt_pos
] == 1) continue;
2174 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2176 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2178 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2180 if (data
.digests_shown
[idx
] == 1) continue;
2182 if (data
.hash_mode
!= 2500)
2186 memset (out_buf
, 0, sizeof (out_buf
));
2188 if (data
.username
== 1)
2190 user_t
*user
= data
.hash_info
[idx
]->user
;
2194 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2196 fputc (separator
, fp
);
2199 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2201 fputs (out_buf
, fp
);
2209 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2211 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2220 unlink (old_hashfile
);
2222 if (rename (hashfile
, old_hashfile
) != 0)
2224 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2231 if (rename (new_hashfile
, hashfile
) != 0)
2233 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2238 unlink (old_hashfile
);
2241 static float find_gpu_blocks_div (const uint64_t total_left
, const uint gpu_blocks_all
)
2243 // function called only in case gpu_blocks_all > words_left)
2245 float gpu_blocks_div
= (float) (total_left
) / gpu_blocks_all
;
2247 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2249 uint32_t gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2251 while (gpu_blocks_new
< total_left
)
2253 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2255 gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2258 if (data
.quiet
== 0)
2264 log_info ("INFO: approaching final keyspace, workload adjusted");
2268 fprintf (stdout
, "%s", PROMPT
);
2273 if ((gpu_blocks_all
* gpu_blocks_div
) < 8) return 1;
2275 return gpu_blocks_div
;
2278 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2280 uint num_elements
= num
;
2282 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2283 device_param
->kernel_params_buf32
[31] = num
;
2285 uint gpu_threads
= device_param
->gpu_threads
;
2287 while (num_elements
% gpu_threads
) num_elements
++;
2289 cl_kernel kernel
= NULL
;
2293 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2294 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2295 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2296 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2297 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2300 hc_clSetKernelArg (kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2301 hc_clSetKernelArg (kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2302 hc_clSetKernelArg (kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2303 hc_clSetKernelArg (kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2304 hc_clSetKernelArg (kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2305 hc_clSetKernelArg (kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2306 hc_clSetKernelArg (kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2307 hc_clSetKernelArg (kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2308 hc_clSetKernelArg (kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2309 hc_clSetKernelArg (kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2310 hc_clSetKernelArg (kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2312 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2314 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2315 const size_t local_work_size
[3] = { gpu_threads
/ 32, 32, 1 };
2317 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2321 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2322 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2324 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2327 hc_clFlush (device_param
->command_queue
);
2329 hc_clFinish (device_param
->command_queue
);
2332 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2334 uint num_elements
= num
;
2338 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2339 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2340 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2343 // causes problems with special threads like in bcrypt
2344 // const uint gpu_threads = device_param->gpu_threads;
2346 const uint gpu_threads
= GPU_THREADS
;
2348 while (num_elements
% gpu_threads
) num_elements
++;
2350 cl_kernel kernel
= NULL
;
2354 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2355 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2356 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2361 case KERN_RUN_MP
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2362 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2363 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2364 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2365 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2366 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2368 case KERN_RUN_MP_R
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2369 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2370 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2371 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2372 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2373 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2375 case KERN_RUN_MP_L
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2376 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2377 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2378 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2379 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2380 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2381 hc_clSetKernelArg (kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2385 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2386 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2388 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2390 hc_clFlush (device_param
->command_queue
);
2392 hc_clFinish (device_param
->command_queue
);
2395 static void run_kernel_tb (hc_device_param_t
*device_param
, const uint num
)
2397 uint num_elements
= num
;
2399 uint gpu_threads
= device_param
->gpu_threads
;
2401 while (num_elements
% gpu_threads
) num_elements
++;
2403 cl_kernel kernel
= device_param
->kernel_tb
;
2405 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2406 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2408 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2410 hc_clFlush (device_param
->command_queue
);
2412 hc_clFinish (device_param
->command_queue
);
2415 static void run_kernel_tm (hc_device_param_t
*device_param
)
2417 const uint num_elements
= 1024; // fixed
2419 const uint gpu_threads
= 32;
2421 cl_kernel kernel
= device_param
->kernel_tm
;
2423 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2424 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2426 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2428 hc_clFlush (device_param
->command_queue
);
2430 hc_clFinish (device_param
->command_queue
);
2433 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2435 uint num_elements
= num
;
2437 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2438 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2440 // causes problems with special threads like in bcrypt
2441 // const uint gpu_threads = device_param->gpu_threads;
2443 const uint gpu_threads
= GPU_THREADS
;
2445 while (num_elements
% gpu_threads
) num_elements
++;
2447 cl_kernel kernel
= device_param
->kernel_amp
;
2449 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2450 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2452 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2453 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2455 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2457 hc_clFlush (device_param
->command_queue
);
2459 hc_clFinish (device_param
->command_queue
);
2462 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const uint size
)
2464 // not supported with Nvidia
2465 // hc_clEnqueueFillBuffer (device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2467 char *tmp
= (char *) mymalloc (size
);
2469 memset (tmp
, 0, size
);
2471 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, 0, size
, tmp
, 0, NULL
, NULL
);
2476 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2482 else if (rule_len
== 1)
2484 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2490 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2492 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2494 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
);
2496 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2498 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
);
2500 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2502 const uint64_t off
= device_param
->words_off
;
2504 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2506 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2510 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2512 const uint gpu_loops
= data
.gpu_loops
;
2516 uint speed_pos
= device_param
->speed_pos
;
2519 if (device_param
->timer_speed
.tv_sec
== 0)
2521 hc_timer_set (&device_param
->timer_speed
);
2526 if (device_param
->timer_speed
.QuadPart
== 0)
2528 hc_timer_set (&device_param
->timer_speed
);
2532 // find higest password length, this is for optimization stuff
2534 uint highest_pw_len
= 0;
2536 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2539 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2542 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2544 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2545 + device_param
->kernel_params_mp_l_buf32
[5];
2548 // bitslice optimization stuff
2550 if (data
.attack_mode
== ATTACK_MODE_BF
)
2552 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2554 run_kernel_tb (device_param
, pws_cnt
);
2560 uint innerloop_step
= 0;
2561 uint innerloop_cnt
= 0;
2563 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2564 else innerloop_step
= 1;
2566 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2567 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2568 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2570 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2572 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2574 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2576 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2578 if (data
.devices_status
== STATUS_CRACKED
) break;
2579 if (data
.devices_status
== STATUS_ABORTED
) break;
2580 if (data
.devices_status
== STATUS_QUIT
) break;
2581 if (data
.devices_status
== STATUS_BYPASS
) break;
2583 if (data
.salts_shown
[salt_pos
] == 1) continue;
2585 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2587 device_param
->kernel_params_buf32
[24] = salt_pos
;
2588 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2589 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2591 FILE *combs_fp
= device_param
->combs_fp
;
2593 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2600 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2602 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2604 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2606 if (data
.devices_status
== STATUS_CRACKED
) break;
2607 if (data
.devices_status
== STATUS_ABORTED
) break;
2608 if (data
.devices_status
== STATUS_QUIT
) break;
2609 if (data
.devices_status
== STATUS_BYPASS
) break;
2611 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2613 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2615 device_param
->innerloop_pos
= innerloop_pos
;
2616 device_param
->innerloop_left
= innerloop_left
;
2618 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2620 if (innerloop_left
== 0) continue;
2622 // initialize amplifiers
2624 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2626 char line_buf
[BUFSIZ
];
2630 while (i
< innerloop_left
)
2632 if (feof (combs_fp
)) break;
2634 int line_len
= fgetl (combs_fp
, line_buf
);
2636 if (line_len
>= PW_MAX1
) continue;
2638 line_len
= convert_from_hex (line_buf
, line_len
);
2640 char *line_buf_new
= line_buf
;
2642 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2644 char rule_buf_out
[BLOCK_SIZE
];
2646 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2648 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2650 if (rule_len_out
< 0)
2652 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2657 line_len
= rule_len_out
;
2659 line_buf_new
= rule_buf_out
;
2662 line_len
= MIN (line_len
, PW_DICTMAX
);
2664 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2666 memcpy (ptr
, line_buf_new
, line_len
);
2668 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2670 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2672 uppercase (ptr
, line_len
);
2675 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2677 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2679 ptr
[line_len
] = 0x80;
2682 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2684 ptr
[line_len
] = 0x01;
2688 device_param
->combs_buf
[i
].pw_len
= line_len
;
2693 for (uint j
= i
; j
< innerloop_left
; j
++)
2695 device_param
->combs_buf
[j
].i
[0] = 0;
2696 device_param
->combs_buf
[j
].i
[1] = 0;
2697 device_param
->combs_buf
[j
].i
[2] = 0;
2698 device_param
->combs_buf
[j
].i
[3] = 0;
2699 device_param
->combs_buf
[j
].i
[4] = 0;
2700 device_param
->combs_buf
[j
].i
[5] = 0;
2701 device_param
->combs_buf
[j
].i
[6] = 0;
2702 device_param
->combs_buf
[j
].i
[7] = 0;
2704 device_param
->combs_buf
[j
].pw_len
= 0;
2709 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2711 uint64_t off
= innerloop_pos
;
2713 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2715 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2717 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2719 uint64_t off
= innerloop_pos
;
2721 device_param
->kernel_params_mp_buf64
[3] = off
;
2723 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2725 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2727 uint64_t off
= innerloop_pos
;
2729 device_param
->kernel_params_mp_buf64
[3] = off
;
2731 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2736 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2738 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
);
2740 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2742 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
);
2744 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2746 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
);
2748 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2750 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
);
2752 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2754 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
);
2757 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2759 if (data
.attack_mode
== ATTACK_MODE_BF
)
2761 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2763 const uint size_tm
= 32 * sizeof (bs_word_t
);
2765 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2767 run_kernel_tm (device_param
);
2769 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2773 if (highest_pw_len
< 16)
2775 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2777 else if (highest_pw_len
< 32)
2779 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2783 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2788 run_kernel_amp (device_param
, pws_cnt
);
2790 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2792 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2794 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2797 uint iter
= salt_buf
->salt_iter
;
2799 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2801 uint loop_left
= iter
- loop_pos
;
2803 loop_left
= MIN (loop_left
, gpu_loops
);
2805 device_param
->kernel_params_buf32
[25] = loop_pos
;
2806 device_param
->kernel_params_buf32
[26] = loop_left
;
2808 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2810 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2812 if (data
.devices_status
== STATUS_CRACKED
) break;
2813 if (data
.devices_status
== STATUS_ABORTED
) break;
2814 if (data
.devices_status
== STATUS_QUIT
) break;
2817 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2819 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2821 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2823 // do something with data
2825 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2828 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2831 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2833 if (data
.devices_status
== STATUS_CRACKED
) break;
2834 if (data
.devices_status
== STATUS_ABORTED
) break;
2835 if (data
.devices_status
== STATUS_QUIT
) break;
2841 hc_thread_mutex_lock (mux_display
);
2843 check_cracked (device_param
, salt_pos
);
2845 hc_thread_mutex_unlock (mux_display
);
2851 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2853 hc_thread_mutex_lock (mux_counter
);
2855 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2857 hc_thread_mutex_unlock (mux_counter
);
2865 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2867 hc_timer_set (&device_param
->timer_speed
);
2869 hc_thread_mutex_lock (mux_display
);
2871 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2873 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2875 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2877 hc_thread_mutex_unlock (mux_display
);
2881 if (speed_pos
== SPEED_CACHE
)
2888 device_param
->speed_pos
= speed_pos
;
2891 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2893 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2897 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2899 wl_data
->buf
[wl_data
->cnt
] = 0;
2901 if (wl_data
->cnt
== 0) return;
2903 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2907 if (wl_data
->cnt
== wl_data
->avail
)
2909 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2911 wl_data
->avail
+= wl_data
->incr
;
2914 const int c
= fgetc (fd
);
2916 if (c
== EOF
) break;
2918 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2922 if (c
== '\n') break;
2925 // ensure stream ends with a newline
2927 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2931 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
2937 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2941 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2943 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2953 if (*ptr
!= '\n') continue;
2957 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2968 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2972 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2974 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2976 if (*ptr
!= '\n') continue;
2980 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2991 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2995 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2997 if (*ptr
!= '\n') continue;
3001 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3012 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3014 while (wl_data
->pos
< wl_data
->cnt
)
3019 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3021 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3023 wl_data
->pos
+= off
;
3025 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3027 char rule_buf_out
[BLOCK_SIZE
];
3029 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3031 int rule_len_out
= -1;
3033 if (len
< BLOCK_SIZE
)
3035 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3038 if (rule_len_out
< 0)
3043 if (rule_len_out
> PW_MAX
)
3064 fprintf (stderr
, "bug!!\n");
3069 load_segment (wl_data
, fd
);
3071 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3075 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3079 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3089 fstat (fileno (fd
), &d
.stat
);
3093 _fstat64 (fileno (fd
), &d
.stat
);
3097 d
.stat
.st_nlink
= 0;
3101 d
.stat
.st_atime
= 0;
3104 d
.stat
.st_blksize
= 0;
3105 d
.stat
.st_blocks
= 0;
3108 if (d
.stat
.st_size
== 0) return 0;
3110 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3112 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3116 uint64_t cnt
= d_cache
->cnt
;
3118 uint64_t keyspace
= cnt
;
3120 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3122 keyspace
*= data
.gpu_rules_cnt
;
3124 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3126 keyspace
*= data
.combs_cnt
;
3129 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
);
3130 if (data
.quiet
== 0) log_info ("");
3132 hc_signal (sigHandler_default
);
3147 load_segment (wl_data
, fd
);
3149 comp
+= wl_data
->cnt
;
3153 while (i
< wl_data
->cnt
)
3158 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3160 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3162 char rule_buf_out
[BLOCK_SIZE
];
3164 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3166 int rule_len_out
= -1;
3168 if (len
< BLOCK_SIZE
)
3170 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3173 if (rule_len_out
< 0)
3185 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3187 cnt
+= data
.gpu_rules_cnt
;
3189 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3191 cnt
+= data
.combs_cnt
;
3204 if ((now
- prev
) == 0) continue;
3206 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3208 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
);
3213 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
);
3214 if (data
.quiet
== 0) log_info ("");
3216 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3218 hc_signal (sigHandler_default
);
3223 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3225 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3228 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3230 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3232 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3234 uint cache_cnt
= pw_cache
->cnt
;
3236 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3238 memcpy (pw_hc1
, pw_buf
, pw_len
);
3240 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3242 uint pws_cnt
= device_param
->pws_cnt
;
3246 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3248 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3250 pw
->pw_len
= pw_len
;
3254 device_param
->pws_cnt
= pws_cnt
;
3255 device_param
->pw_cnt
= pws_cnt
* 1;
3259 pw_cache
->cnt
= cache_cnt
;
3264 static void *thread_monitor (void *p
)
3266 uint runtime_check
= 0;
3267 uint remove_check
= 0;
3268 uint status_check
= 0;
3269 uint hwmon_check
= 0;
3270 uint restore_check
= 0;
3272 uint restore_left
= data
.restore_timer
;
3273 uint remove_left
= data
.remove_timer
;
3274 uint status_left
= data
.status_timer
;
3276 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3278 // temperature controller "loopback" values
3280 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3281 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3283 int temp_threshold
= 1; // degrees celcius
3285 int fan_speed_min
= 15; // in percentage
3286 int fan_speed_max
= 100;
3288 time_t last_temp_check_time
;
3290 uint sleep_time
= 1;
3295 if (data
.restore_timer
)
3298 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3301 if (data
.status
== 1)
3304 if (data
.gpu_temp_disable
== 0)
3306 time (&last_temp_check_time
);
3311 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3316 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3318 hc_sleep (sleep_time
);
3320 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3323 if (hwmon_check == 1)
3325 hc_thread_mutex_lock (mux_adl);
3327 time_t temp_check_time;
3329 time (&temp_check_time);
3331 uint Ta = temp_check_time - last_temp_check_time; // set Ta = sleep_time; is not good enough (see --remove etc)
3333 if (Ta == 0) Ta = 1;
3335 for (uint i = 0; i < data.devices_cnt; i++)
3337 const int temperature = hm_get_temperature_with_device_id (i);
3339 if (temperature > (int) data.gpu_temp_abort)
3341 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i + 1);
3343 if (data.devices_status != STATUS_QUIT) myabort ();
3348 const int gpu_temp_retain = data.gpu_temp_retain;
3350 if (gpu_temp_retain)
3352 if (data.hm_device[i].fan_supported == 1)
3354 int temp_cur = temperature;
3356 int temp_diff_new = gpu_temp_retain - temp_cur;
3358 temp_diff_sum[i] = temp_diff_sum[i] + temp_diff_new;
3360 // calculate Ta value (time difference in seconds between the last check and this check)
3362 last_temp_check_time = temp_check_time;
3368 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3370 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);
3372 if (abs (fan_diff_required) >= temp_threshold)
3374 const int fan_speed_cur = hm_get_fanspeed_with_device_id (i);
3376 int fan_speed_level = fan_speed_cur;
3378 if (fan_speed_chgd[i] == 0) fan_speed_level = temp_cur;
3380 int fan_speed_new = fan_speed_level - fan_diff_required;
3382 if (fan_speed_new > fan_speed_max) fan_speed_new = fan_speed_max;
3383 if (fan_speed_new < fan_speed_min) fan_speed_new = fan_speed_min;
3385 if (fan_speed_new != fan_speed_cur)
3387 int freely_change_fan_speed = (fan_speed_chgd[i] == 1);
3388 int fan_speed_must_change = (fan_speed_new > fan_speed_cur);
3390 if ((freely_change_fan_speed == 1) || (fan_speed_must_change == 1))
3392 hm_set_fanspeed_with_device_id (i, fan_speed_new);
3394 fan_speed_chgd[i] = 1;
3397 temp_diff_old[i] = temp_diff_new;
3404 hc_thread_mutex_unlock (mux_adl);
3408 if (restore_check
== 1)
3412 if (restore_left
== 0)
3414 if (data
.restore_disable
== 0) cycle_restore ();
3416 restore_left
= data
.restore_timer
;
3420 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3424 time (&runtime_cur
);
3426 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3428 if (runtime_left
<= 0)
3430 if (data
.benchmark
== 0)
3432 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3435 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3439 if (remove_check
== 1)
3443 if (remove_left
== 0)
3445 if (data
.digests_saved
!= data
.digests_done
)
3447 data
.digests_saved
= data
.digests_done
;
3452 remove_left
= data
.remove_timer
;
3456 if (status_check
== 1)
3460 if (status_left
== 0)
3462 hc_thread_mutex_lock (mux_display
);
3464 if (data
.quiet
== 0) clear_prompt ();
3466 if (data
.quiet
== 0) log_info ("");
3470 if (data
.quiet
== 0) log_info ("");
3472 hc_thread_mutex_unlock (mux_display
);
3474 status_left
= data
.status_timer
;
3479 myfree (fan_speed_chgd
);
3481 myfree (temp_diff_old
);
3482 myfree (temp_diff_sum
);
3489 static void *thread_outfile_remove (void *p
)
3491 // some hash-dependent constants
3492 char *outfile_dir
= data
.outfile_check_directory
;
3493 uint dgst_size
= data
.dgst_size
;
3494 uint isSalted
= data
.isSalted
;
3495 uint esalt_size
= data
.esalt_size
;
3496 uint hash_mode
= data
.hash_mode
;
3498 uint outfile_check_timer
= data
.outfile_check_timer
;
3500 char separator
= data
.separator
;
3502 // some hash-dependent functions
3503 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3504 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3509 memset (&hash_buf
, 0, sizeof (hash_buf
));
3511 hash_buf
.digest
= mymalloc (dgst_size
);
3513 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3515 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3517 uint digest_buf
[64];
3519 outfile_data_t
*out_info
= NULL
;
3521 char **out_files
= NULL
;
3523 time_t folder_mtime
= 0;
3527 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3529 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3533 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3537 if (check_left
== 0)
3539 struct stat outfile_check_stat
;
3541 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3543 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3547 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3549 char **out_files_new
= scan_directory (outfile_dir
);
3551 int out_cnt_new
= count_dictionaries (out_files_new
);
3553 outfile_data_t
*out_info_new
= NULL
;
3555 if (out_cnt_new
> 0)
3557 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3559 for (int i
= 0; i
< out_cnt_new
; i
++)
3561 out_info_new
[i
].file_name
= out_files_new
[i
];
3563 // check if there are files that we have seen/checked before (and not changed)
3565 for (int j
= 0; j
< out_cnt
; j
++)
3567 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3569 struct stat outfile_stat
;
3571 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3573 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3575 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3576 out_info_new
[i
].seek
= out_info
[j
].seek
;
3584 local_free (out_info
);
3585 local_free (out_files
);
3587 out_files
= out_files_new
;
3588 out_cnt
= out_cnt_new
;
3589 out_info
= out_info_new
;
3591 folder_mtime
= outfile_check_stat
.st_mtime
;
3594 for (int j
= 0; j
< out_cnt
; j
++)
3596 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3600 //hc_thread_mutex_lock (mux_display);
3603 struct stat outfile_stat
;
3605 fstat (fileno (fp
), &outfile_stat
);
3609 struct stat64 outfile_stat
;
3611 _fstat64 (fileno (fp
), &outfile_stat
);
3614 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3616 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3617 out_info
[j
].seek
= 0;
3620 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3624 char line_buf
[BUFSIZ
];
3626 memset (line_buf
, 0, BUFSIZ
);
3628 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3630 if (ptr
== NULL
) break;
3632 int line_len
= strlen (line_buf
);
3634 if (line_len
<= 0) continue;
3636 int iter
= MAX_CUT_TRIES
;
3638 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3640 if (line_buf
[i
] != separator
) continue;
3642 int parser_status
= PARSER_OK
;
3644 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3646 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3651 if (parser_status
== PARSER_OK
)
3653 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3655 if (data
.salts_shown
[salt_pos
] == 1) continue;
3657 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3659 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3661 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3663 if (data
.digests_shown
[idx
] == 1) continue;
3667 if (hash_mode
== 6800)
3669 if (i
== salt_buf
->salt_len
)
3671 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3674 else if (hash_mode
== 2500)
3676 // BSSID : MAC1 : MAC2 (:plain)
3677 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3679 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3681 if (!cracked
) continue;
3683 // now compare MAC1 and MAC2 too, since we have this additional info
3684 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3685 char *mac2_pos
= mac1_pos
+ 12 + 1;
3687 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3688 wpa_t
*wpa
= &wpas
[salt_pos
];
3692 char *pke_ptr
= (char *) pke
;
3694 for (uint i
= 0; i
< 25; i
++)
3696 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3699 unsigned char mac1
[6];
3700 unsigned char mac2
[6];
3702 memcpy (mac1
, pke_ptr
+ 23, 6);
3703 memcpy (mac2
, pke_ptr
+ 29, 6);
3705 // compare hex string(s) vs binary MAC address(es)
3707 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3709 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3717 if (!cracked
) continue;
3719 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3721 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3731 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3733 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3735 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3742 data
.digests_shown
[idx
] = 1;
3744 data
.digests_done
++;
3746 salt_buf
->digests_done
++;
3748 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3750 data
.salts_shown
[salt_pos
] = 1;
3754 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3759 if (data
.devices_status
== STATUS_CRACKED
) break;
3765 if (data
.devices_status
== STATUS_CRACKED
) break;
3770 if (data
.devices_status
== STATUS_CRACKED
) break;
3773 out_info
[j
].seek
= ftell (fp
);
3775 //hc_thread_mutex_unlock (mux_display);
3783 check_left
= outfile_check_timer
;
3787 if (esalt_size
) local_free (hash_buf
.esalt
);
3789 if (isSalted
) local_free (hash_buf
.salt
);
3791 local_free (hash_buf
.digest
);
3793 local_free (out_info
);
3795 local_free (out_files
);
3802 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3804 hc_thread_mutex_lock (mux_dispatcher
);
3806 const uint64_t words_cur
= data
.words_cur
;
3807 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3809 device_param
->words_off
= words_cur
;
3811 const uint64_t words_left
= words_base
- words_cur
;
3813 if (data
.gpu_blocks_all
> words_left
)
3815 if (data
.gpu_blocks_div
== 0)
3817 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3821 if (data
.gpu_blocks_div
)
3823 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3825 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3826 const uint32_t gpu_power_new
= gpu_blocks_new
;
3828 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3830 device_param
->gpu_blocks
= gpu_blocks_new
;
3831 device_param
->gpu_power
= gpu_power_new
;
3836 const uint gpu_blocks
= device_param
->gpu_blocks
;
3838 uint work
= MIN (words_left
, gpu_blocks
);
3840 work
= MIN (work
, max
);
3842 data
.words_cur
+= work
;
3844 hc_thread_mutex_unlock (mux_dispatcher
);
3849 static void *thread_calc_stdin (void *p
)
3851 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3853 const uint attack_kern
= data
.attack_kern
;
3855 const uint gpu_blocks
= device_param
->gpu_blocks
;
3857 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3859 hc_thread_mutex_lock (mux_dispatcher
);
3861 if (feof (stdin
) != 0)
3863 hc_thread_mutex_unlock (mux_dispatcher
);
3870 while (words_cur
< gpu_blocks
)
3874 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3876 if (line_buf
== NULL
) break;
3878 uint line_len
= in_superchop (line_buf
);
3880 line_len
= convert_from_hex (line_buf
, line_len
);
3882 // post-process rule engine
3884 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3886 char rule_buf_out
[BLOCK_SIZE
];
3888 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3890 int rule_len_out
= -1;
3892 if (line_len
< BLOCK_SIZE
)
3894 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3897 if (rule_len_out
< 0) continue;
3899 line_buf
= rule_buf_out
;
3900 line_len
= rule_len_out
;
3903 if (line_len
> PW_MAX
)
3908 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3910 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3912 hc_thread_mutex_lock (mux_counter
);
3914 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3916 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3919 hc_thread_mutex_unlock (mux_counter
);
3924 else if (attack_kern
== ATTACK_KERN_COMBI
)
3926 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
3927 // since we still need to combine the plains
3929 if (line_len
> data
.pw_max
)
3931 hc_thread_mutex_lock (mux_counter
);
3933 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3935 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
3938 hc_thread_mutex_unlock (mux_counter
);
3944 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
3948 if (data
.devices_status
== STATUS_CRACKED
) break;
3949 if (data
.devices_status
== STATUS_ABORTED
) break;
3950 if (data
.devices_status
== STATUS_QUIT
) break;
3951 if (data
.devices_status
== STATUS_BYPASS
) break;
3954 hc_thread_mutex_unlock (mux_dispatcher
);
3956 if (data
.devices_status
== STATUS_CRACKED
) break;
3957 if (data
.devices_status
== STATUS_ABORTED
) break;
3958 if (data
.devices_status
== STATUS_QUIT
) break;
3959 if (data
.devices_status
== STATUS_BYPASS
) break;
3961 // we need 2 flushing because we have two independant caches and it can occur
3962 // that one buffer is already at threshold plus for that length also exists
3963 // more data in the 2nd buffer so it would overflow
3968 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
3970 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
3972 const uint pw_cache_cnt
= pw_cache
->cnt
;
3974 if (pw_cache_cnt
== 0) continue;
3978 uint pws_cnt
= device_param
->pws_cnt
;
3980 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3982 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3984 pw
->pw_len
= pw_len
;
3986 uint pw_cnt
= device_param
->pw_cnt
;
3988 pw_cnt
+= pw_cache_cnt
;
3990 device_param
->pw_cnt
= pw_cnt
;
3994 device_param
->pws_cnt
= pws_cnt
;
3996 if (pws_cnt
== device_param
->gpu_power_user
) break;
3999 const uint pw_cnt
= device_param
->pw_cnt
;
4000 const uint pws_cnt
= device_param
->pws_cnt
;
4004 run_copy (device_param
, pws_cnt
);
4006 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4008 device_param
->pw_cnt
= 0;
4009 device_param
->pws_cnt
= 0;
4016 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4018 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4020 const uint pw_cache_cnt
= pw_cache
->cnt
;
4022 if (pw_cache_cnt
== 0) continue;
4026 uint pws_cnt
= device_param
->pws_cnt
;
4028 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4030 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4032 pw
->pw_len
= pw_len
;
4034 uint pw_cnt
= device_param
->pw_cnt
;
4036 pw_cnt
+= pw_cache_cnt
;
4038 device_param
->pw_cnt
= pw_cnt
;
4042 device_param
->pws_cnt
= pws_cnt
;
4045 const uint pw_cnt
= device_param
->pw_cnt
;
4046 const uint pws_cnt
= device_param
->pws_cnt
;
4050 run_copy (device_param
, pws_cnt
);
4052 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4054 device_param
->pw_cnt
= 0;
4055 device_param
->pws_cnt
= 0;
4063 static void *thread_calc (void *p
)
4065 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4067 const uint attack_mode
= data
.attack_mode
;
4068 const uint attack_kern
= data
.attack_kern
;
4070 if (attack_mode
== ATTACK_MODE_BF
)
4072 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4074 const uint work
= get_work (device_param
, -1);
4076 if (work
== 0) break;
4078 const uint64_t words_off
= device_param
->words_off
;
4079 const uint64_t words_fin
= words_off
+ work
;
4081 const uint pw_cnt
= work
;
4082 const uint pws_cnt
= work
;
4084 device_param
->pw_cnt
= pw_cnt
;
4085 device_param
->pws_cnt
= pws_cnt
;
4089 run_copy (device_param
, pws_cnt
);
4091 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4093 device_param
->pw_cnt
= 0;
4094 device_param
->pws_cnt
= 0;
4097 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4099 if (data
.devices_status
== STATUS_CRACKED
) break;
4100 if (data
.devices_status
== STATUS_ABORTED
) break;
4101 if (data
.devices_status
== STATUS_QUIT
) break;
4102 if (data
.devices_status
== STATUS_BYPASS
) break;
4104 device_param
->words_done
= words_fin
;
4109 const uint segment_size
= data
.segment_size
;
4111 char *dictfile
= data
.dictfile
;
4113 if (attack_mode
== ATTACK_MODE_COMBI
)
4115 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4117 dictfile
= data
.dictfile2
;
4121 FILE *fd
= fopen (dictfile
, "rb");
4125 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4130 if (attack_mode
== ATTACK_MODE_COMBI
)
4132 const uint combs_mode
= data
.combs_mode
;
4134 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4136 const char *dictfilec
= data
.dictfile2
;
4138 FILE *combs_fp
= fopen (dictfilec
, "rb");
4140 if (combs_fp
== NULL
)
4142 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4149 device_param
->combs_fp
= combs_fp
;
4151 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4153 const char *dictfilec
= data
.dictfile
;
4155 FILE *combs_fp
= fopen (dictfilec
, "rb");
4157 if (combs_fp
== NULL
)
4159 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4166 device_param
->combs_fp
= combs_fp
;
4170 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4172 wl_data
->buf
= (char *) mymalloc (segment_size
);
4173 wl_data
->avail
= segment_size
;
4174 wl_data
->incr
= segment_size
;
4178 uint64_t words_cur
= 0;
4180 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4182 uint64_t words_off
= 0;
4183 uint64_t words_fin
= 0;
4189 const uint work
= get_work (device_param
, max
);
4191 if (work
== 0) break;
4193 words_off
= device_param
->words_off
;
4194 words_fin
= words_off
+ work
;
4199 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4203 for ( ; words_cur
< words_fin
; words_cur
++)
4205 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4207 line_len
= convert_from_hex (line_buf
, line_len
);
4209 // post-process rule engine
4211 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4213 char rule_buf_out
[BLOCK_SIZE
];
4215 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4217 int rule_len_out
= -1;
4219 if (line_len
< BLOCK_SIZE
)
4221 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4224 if (rule_len_out
< 0) continue;
4226 line_buf
= rule_buf_out
;
4227 line_len
= rule_len_out
;
4230 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4232 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4236 hc_thread_mutex_lock (mux_counter
);
4238 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4240 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4243 hc_thread_mutex_unlock (mux_counter
);
4248 else if (attack_kern
== ATTACK_KERN_COMBI
)
4250 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4251 // since we still need to combine the plains
4253 if (line_len
> data
.pw_max
)
4257 hc_thread_mutex_lock (mux_counter
);
4259 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4261 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4264 hc_thread_mutex_unlock (mux_counter
);
4270 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4272 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4274 if (data
.devices_status
== STATUS_CRACKED
) break;
4275 if (data
.devices_status
== STATUS_ABORTED
) break;
4276 if (data
.devices_status
== STATUS_QUIT
) break;
4277 if (data
.devices_status
== STATUS_BYPASS
) break;
4280 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4282 if (data
.devices_status
== STATUS_CRACKED
) break;
4283 if (data
.devices_status
== STATUS_ABORTED
) break;
4284 if (data
.devices_status
== STATUS_QUIT
) break;
4285 if (data
.devices_status
== STATUS_BYPASS
) break;
4288 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4290 if (data
.devices_status
== STATUS_CRACKED
) break;
4291 if (data
.devices_status
== STATUS_ABORTED
) break;
4292 if (data
.devices_status
== STATUS_QUIT
) break;
4293 if (data
.devices_status
== STATUS_BYPASS
) break;
4295 // we need 2 flushing because we have two independant caches and it can occur
4296 // that one buffer is already at threshold plus for that length also exists
4297 // more data in the 2nd buffer so it would overflow
4304 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4306 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4308 const uint pw_cache_cnt
= pw_cache
->cnt
;
4310 if (pw_cache_cnt
== 0) continue;
4314 uint pws_cnt
= device_param
->pws_cnt
;
4316 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4318 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4320 pw
->pw_len
= pw_len
;
4322 uint pw_cnt
= device_param
->pw_cnt
;
4324 pw_cnt
+= pw_cache_cnt
;
4326 device_param
->pw_cnt
= pw_cnt
;
4330 device_param
->pws_cnt
= pws_cnt
;
4332 if (pws_cnt
== device_param
->gpu_power_user
) break;
4335 const uint pw_cnt
= device_param
->pw_cnt
;
4336 const uint pws_cnt
= device_param
->pws_cnt
;
4340 run_copy (device_param
, pws_cnt
);
4342 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4344 device_param
->pw_cnt
= 0;
4345 device_param
->pws_cnt
= 0;
4348 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4350 if (data
.devices_status
== STATUS_CRACKED
) break;
4351 if (data
.devices_status
== STATUS_ABORTED
) break;
4352 if (data
.devices_status
== STATUS_QUIT
) break;
4353 if (data
.devices_status
== STATUS_BYPASS
) break;
4361 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4363 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4365 const uint pw_cache_cnt
= pw_cache
->cnt
;
4367 if (pw_cache_cnt
== 0) continue;
4371 uint pws_cnt
= device_param
->pws_cnt
;
4373 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4375 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4377 pw
->pw_len
= pw_len
;
4379 uint pw_cnt
= device_param
->pw_cnt
;
4381 pw_cnt
+= pw_cache_cnt
;
4383 device_param
->pw_cnt
= pw_cnt
;
4387 device_param
->pws_cnt
= pws_cnt
;
4390 const uint pw_cnt
= device_param
->pw_cnt
;
4391 const uint pws_cnt
= device_param
->pws_cnt
;
4395 run_copy (device_param
, pws_cnt
);
4397 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4399 device_param
->pw_cnt
= 0;
4400 device_param
->pws_cnt
= 0;
4403 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4405 if (data
.devices_status
== STATUS_CRACKED
) break;
4406 if (data
.devices_status
== STATUS_ABORTED
) break;
4407 if (data
.devices_status
== STATUS_QUIT
) break;
4408 if (data
.devices_status
== STATUS_BYPASS
) break;
4411 if (words_fin
== 0) break;
4413 device_param
->words_done
= words_fin
;
4416 if (attack_mode
== ATTACK_MODE_COMBI
)
4418 fclose (device_param
->combs_fp
);
4421 free (wl_data
->buf
);
4430 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4432 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4434 device_param
->kernel_params_buf32
[24] = salt_pos
;
4435 device_param
->kernel_params_buf32
[27] = 1;
4436 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4437 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4438 device_param
->kernel_params_buf32
[30] = 0;
4439 device_param
->kernel_params_buf32
[31] = 1;
4441 char *dictfile_old
= data
.dictfile
;
4442 char *dictfile2_old
= data
.dictfile2
;
4443 char *mask_old
= data
.mask
;
4445 const char *weak_hash_check
= "weak-hash-check";
4447 data
.dictfile
= (char *) weak_hash_check
;
4448 data
.dictfile2
= (char *) weak_hash_check
;
4449 data
.mask
= (char *) weak_hash_check
;
4455 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4457 run_kernel (KERN_RUN_1
, device_param
, 1);
4461 run_kernel (KERN_RUN_1
, device_param
, 1);
4463 const uint iter
= salt_buf
->salt_iter
;
4465 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4467 uint loop_left
= iter
- loop_pos
;
4469 loop_left
= MIN (loop_left
, gpu_loops
);
4471 device_param
->kernel_params_buf32
[25] = loop_pos
;
4472 device_param
->kernel_params_buf32
[26] = loop_left
;
4474 run_kernel (KERN_RUN_2
, device_param
, 1);
4477 run_kernel (KERN_RUN_3
, device_param
, 1);
4484 check_cracked (device_param
, salt_pos
);
4490 device_param
->kernel_params_buf32
[24] = 0;
4491 device_param
->kernel_params_buf32
[25] = 0;
4492 device_param
->kernel_params_buf32
[26] = 0;
4493 device_param
->kernel_params_buf32
[27] = 0;
4494 device_param
->kernel_params_buf32
[28] = 0;
4495 device_param
->kernel_params_buf32
[29] = 0;
4496 device_param
->kernel_params_buf32
[30] = 0;
4497 device_param
->kernel_params_buf32
[31] = 0;
4499 data
.dictfile
= dictfile_old
;
4500 data
.dictfile2
= dictfile2_old
;
4501 data
.mask
= mask_old
;
4506 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4508 if (data
.username
== 0)
4510 *hashbuf_pos
= line_buf
;
4511 *hashbuf_len
= line_len
;
4515 char *pos
= line_buf
;
4518 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4520 if (line_buf
[i
] == data
.separator
)
4535 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4542 for (int i
= 0; i
< line_len
; i
++)
4544 if (line_buf
[i
] == data
.separator
)
4553 if (pos
== NULL
) pos
= line_buf
+ i
;
4565 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4572 for (int i
= 0; i
< line_len
; i
++)
4574 if (line_buf
[i
] == ':')
4581 if (sep_cnt
== 2) sep2_len
++;
4582 if (sep_cnt
== 3) sep3_len
++;
4585 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4590 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4597 for (int i
= 0; i
< line_len
; i
++)
4599 if (line_buf
[i
] == ':')
4606 if (data
.hash_mode
== 1000)
4610 if (pos
== NULL
) pos
= line_buf
+ i
;
4615 else if (data
.hash_mode
== 3000)
4619 if (pos
== NULL
) pos
= line_buf
+ i
;
4630 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4637 for (int i
= 0; i
< line_len
; i
++)
4639 if (line_buf
[i
] == ':')
4648 if (pos
== NULL
) pos
= line_buf
+ i
;
4660 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4664 char sep5_first
= 0;
4665 char sep6_first
= 0;
4667 for (int i
= 0; i
< line_len
; i
++)
4669 if (line_buf
[i
] == ':')
4676 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4677 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4680 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4685 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4692 for (int i
= 0; i
< line_len
; i
++)
4694 if (line_buf
[i
] == ':')
4703 if (pos
== NULL
) pos
= line_buf
+ i
;
4713 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4720 for (int i
= 0; i
< line_len
; i
++)
4722 if (line_buf
[i
] == ':')
4731 if (pos
== NULL
) pos
= line_buf
+ i
;
4743 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4747 for (int i
= 0; i
< line_len
; i
++)
4749 if (line_buf
[i
] == ':') sep_cnt
++;
4752 if (sep_cnt
== 8) return 1;
4757 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4759 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4762 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4764 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4769 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4771 switch (hashfile_format
)
4773 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4774 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4775 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4776 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4780 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4782 switch (hashfile_format
)
4784 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4785 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4786 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4787 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4791 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4793 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4795 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4796 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4798 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4804 char line_buf
[BUFSIZ
];
4806 int line_len
= fgetl (fp
, line_buf
);
4808 if (line_len
== 0) continue;
4810 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4811 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4812 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4814 if (num_check
== max_check
) break;
4819 uint hashlist_format
= HLFMT_HASHCAT
;
4821 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4823 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4825 hashlist_format
= i
;
4830 return hashlist_format
;
4838 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4840 return mymalloc (iSize
);
4843 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
)
4845 uint64_t collisions
= 0;
4847 const uint dgst_pos0
= data
.dgst_pos0
;
4848 const uint dgst_pos1
= data
.dgst_pos1
;
4849 const uint dgst_pos2
= data
.dgst_pos2
;
4850 const uint dgst_pos3
= data
.dgst_pos3
;
4852 memset (bitmap_a
, 0, bitmap_size
);
4853 memset (bitmap_b
, 0, bitmap_size
);
4854 memset (bitmap_c
, 0, bitmap_size
);
4855 memset (bitmap_d
, 0, bitmap_size
);
4857 for (uint i
= 0; i
< digests_cnt
; i
++)
4859 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4861 digests_buf_ptr
+= dgst_size
;
4863 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4864 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4865 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4866 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4868 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4869 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4870 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4871 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4873 if (bitmap_a
[idx0
] & val0
) collisions
++;
4874 if (bitmap_b
[idx1
] & val1
) collisions
++;
4875 if (bitmap_c
[idx2
] & val2
) collisions
++;
4876 if (bitmap_d
[idx3
] & val3
) collisions
++;
4878 bitmap_a
[idx0
] |= val0
;
4879 bitmap_b
[idx1
] |= val1
;
4880 bitmap_c
[idx2
] |= val2
;
4881 bitmap_d
[idx3
] |= val3
;
4883 if (collisions
>= collisions_max
) return 0x7fffffff;
4889 int main (int argc
, char **argv
)
4892 * To help users a bit
4895 char *compute
= getenv ("COMPUTE");
4901 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4907 if (getenv ("DISPLAY") == NULL
)
4908 putenv ((char *) "DISPLAY=:0");
4912 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4913 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4915 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4916 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
4923 memset (&data
, 0, sizeof (hc_global_data_t
));
4929 data
.proc_start
= proc_start
;
4932 char **myargv
= argv
;
4934 hc_thread_mutex_init (mux_dispatcher
);
4935 hc_thread_mutex_init (mux_counter
);
4936 hc_thread_mutex_init (mux_display
);
4937 hc_thread_mutex_init (mux_adl
);
4940 * commandline parameters
4944 uint version
= VERSION
;
4946 uint benchmark
= BENCHMARK
;
4947 uint benchmark_mode
= BENCHMARK_MODE
;
4950 uint username
= USERNAME
;
4951 uint remove
= REMOVE
;
4952 uint remove_timer
= REMOVE_TIMER
;
4953 uint64_t skip
= SKIP
;
4954 uint64_t limit
= LIMIT
;
4955 uint keyspace
= KEYSPACE
;
4956 uint potfile_disable
= POTFILE_DISABLE
;
4957 uint debug_mode
= DEBUG_MODE
;
4958 char *debug_file
= NULL
;
4959 char *induction_dir
= NULL
;
4960 char *outfile_check_dir
= NULL
;
4962 uint runtime
= RUNTIME
;
4963 uint hash_mode
= HASH_MODE
;
4964 uint attack_mode
= ATTACK_MODE
;
4965 uint markov_disable
= MARKOV_DISABLE
;
4966 uint markov_classic
= MARKOV_CLASSIC
;
4967 uint markov_threshold
= MARKOV_THRESHOLD
;
4968 char *markov_hcstat
= NULL
;
4969 char *outfile
= NULL
;
4970 uint outfile_format
= OUTFILE_FORMAT
;
4971 uint outfile_autohex
= OUTFILE_AUTOHEX
;
4972 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
4973 uint restore
= RESTORE
;
4974 uint restore_timer
= RESTORE_TIMER
;
4975 uint restore_disable
= RESTORE_DISABLE
;
4976 uint status
= STATUS
;
4977 uint status_timer
= STATUS_TIMER
;
4978 uint status_automat
= STATUS_AUTOMAT
;
4979 uint loopback
= LOOPBACK
;
4980 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
4981 char *session
= NULL
;
4982 uint hex_charset
= HEX_CHARSET
;
4983 uint hex_salt
= HEX_SALT
;
4984 uint hex_wordlist
= HEX_WORDLIST
;
4985 uint rp_gen
= RP_GEN
;
4986 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
4987 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
4988 uint rp_gen_seed
= RP_GEN_SEED
;
4989 char *rule_buf_l
= (char *) RULE_BUF_L
;
4990 char *rule_buf_r
= (char *) RULE_BUF_R
;
4991 uint increment
= INCREMENT
;
4992 uint increment_min
= INCREMENT_MIN
;
4993 uint increment_max
= INCREMENT_MAX
;
4994 char *cpu_affinity
= NULL
;
4995 char *gpu_devices
= NULL
;
4996 char *truecrypt_keyfiles
= NULL
;
4997 uint workload_profile
= WORKLOAD_PROFILE
;
4998 uint gpu_accel
= GPU_ACCEL
;
4999 uint gpu_loops
= GPU_LOOPS
;
5000 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5001 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5002 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5003 uint powertune_enable
= POWERTUNE_ENABLE
;
5004 uint logfile_disable
= LOGFILE_DISABLE
;
5005 uint segment_size
= SEGMENT_SIZE
;
5006 uint scrypt_tmto
= SCRYPT_TMTO
;
5007 char separator
= SEPARATOR
;
5008 uint bitmap_min
= BITMAP_MIN
;
5009 uint bitmap_max
= BITMAP_MAX
;
5010 char *custom_charset_1
= NULL
;
5011 char *custom_charset_2
= NULL
;
5012 char *custom_charset_3
= NULL
;
5013 char *custom_charset_4
= NULL
;
5015 #define IDX_HELP 'h'
5016 #define IDX_VERSION 'V'
5017 #define IDX_VERSION_LOWER 'v'
5018 #define IDX_QUIET 0xff02
5019 #define IDX_SHOW 0xff03
5020 #define IDX_LEFT 0xff04
5021 #define IDX_REMOVE 0xff05
5022 #define IDX_REMOVE_TIMER 0xff37
5023 #define IDX_SKIP 's'
5024 #define IDX_LIMIT 'l'
5025 #define IDX_KEYSPACE 0xff35
5026 #define IDX_POTFILE_DISABLE 0xff06
5027 #define IDX_DEBUG_MODE 0xff43
5028 #define IDX_DEBUG_FILE 0xff44
5029 #define IDX_INDUCTION_DIR 0xff46
5030 #define IDX_OUTFILE_CHECK_DIR 0xff47
5031 #define IDX_USERNAME 0xff07
5032 #define IDX_FORCE 0xff08
5033 #define IDX_RUNTIME 0xff09
5034 #define IDX_BENCHMARK 'b'
5035 #define IDX_BENCHMARK_MODE 0xff32
5036 #define IDX_HASH_MODE 'm'
5037 #define IDX_ATTACK_MODE 'a'
5038 #define IDX_RP_FILE 'r'
5039 #define IDX_RP_GEN 'g'
5040 #define IDX_RP_GEN_FUNC_MIN 0xff10
5041 #define IDX_RP_GEN_FUNC_MAX 0xff11
5042 #define IDX_RP_GEN_SEED 0xff34
5043 #define IDX_RULE_BUF_L 'j'
5044 #define IDX_RULE_BUF_R 'k'
5045 #define IDX_INCREMENT 'i'
5046 #define IDX_INCREMENT_MIN 0xff12
5047 #define IDX_INCREMENT_MAX 0xff13
5048 #define IDX_OUTFILE 'o'
5049 #define IDX_OUTFILE_FORMAT 0xff14
5050 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5051 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5052 #define IDX_RESTORE 0xff15
5053 #define IDX_RESTORE_DISABLE 0xff27
5054 #define IDX_STATUS 0xff17
5055 #define IDX_STATUS_TIMER 0xff18
5056 #define IDX_STATUS_AUTOMAT 0xff50
5057 #define IDX_LOOPBACK 0xff38
5058 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5059 #define IDX_SESSION 0xff19
5060 #define IDX_HEX_CHARSET 0xff20
5061 #define IDX_HEX_SALT 0xff21
5062 #define IDX_HEX_WORDLIST 0xff40
5063 #define IDX_MARKOV_DISABLE 0xff22
5064 #define IDX_MARKOV_CLASSIC 0xff23
5065 #define IDX_MARKOV_THRESHOLD 't'
5066 #define IDX_MARKOV_HCSTAT 0xff24
5067 #define IDX_CPU_AFFINITY 0xff25
5068 #define IDX_GPU_DEVICES 'd'
5069 #define IDX_WORKLOAD_PROFILE 'w'
5070 #define IDX_GPU_ACCEL 'n'
5071 #define IDX_GPU_LOOPS 'u'
5072 #define IDX_GPU_TEMP_DISABLE 0xff29
5073 #define IDX_GPU_TEMP_ABORT 0xff30
5074 #define IDX_GPU_TEMP_RETAIN 0xff31
5075 #define IDX_POWERTUNE_ENABLE 0xff41
5076 #define IDX_LOGFILE_DISABLE 0xff51
5077 #define IDX_TRUECRYPT_KEYFILES 0xff52
5078 #define IDX_SCRYPT_TMTO 0xff61
5079 #define IDX_SEGMENT_SIZE 'c'
5080 #define IDX_SEPARATOR 'p'
5081 #define IDX_BITMAP_MIN 0xff70
5082 #define IDX_BITMAP_MAX 0xff71
5083 #define IDX_CUSTOM_CHARSET_1 '1'
5084 #define IDX_CUSTOM_CHARSET_2 '2'
5085 #define IDX_CUSTOM_CHARSET_3 '3'
5086 #define IDX_CUSTOM_CHARSET_4 '4'
5088 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5090 struct option long_options
[] =
5092 {"help", no_argument
, 0, IDX_HELP
},
5093 {"version", no_argument
, 0, IDX_VERSION
},
5094 {"quiet", no_argument
, 0, IDX_QUIET
},
5095 {"show", no_argument
, 0, IDX_SHOW
},
5096 {"left", no_argument
, 0, IDX_LEFT
},
5097 {"username", no_argument
, 0, IDX_USERNAME
},
5098 {"remove", no_argument
, 0, IDX_REMOVE
},
5099 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5100 {"skip", required_argument
, 0, IDX_SKIP
},
5101 {"limit", required_argument
, 0, IDX_LIMIT
},
5102 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5103 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5104 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5105 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5106 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5107 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5108 {"force", no_argument
, 0, IDX_FORCE
},
5109 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5110 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5111 {"restore", no_argument
, 0, IDX_RESTORE
},
5112 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5113 {"status", no_argument
, 0, IDX_STATUS
},
5114 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5115 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5116 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5117 {"weak-hash-threshold",
5118 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5119 {"session", required_argument
, 0, IDX_SESSION
},
5120 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5121 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5122 {"generate-rules-func-min",
5123 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5124 {"generate-rules-func-max",
5125 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5126 {"generate-rules-seed",
5127 required_argument
, 0, IDX_RP_GEN_SEED
},
5128 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5129 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5130 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5131 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5132 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5133 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5134 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5135 {"outfile-autohex-disable",
5136 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5137 {"outfile-check-timer",
5138 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5139 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5140 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5141 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5142 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5143 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5144 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5145 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5146 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5147 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5148 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5149 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5150 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5151 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5152 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5153 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5154 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5155 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5156 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5157 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5158 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5160 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5161 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5162 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5163 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5164 {"increment", no_argument
, 0, IDX_INCREMENT
},
5165 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5166 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5167 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5168 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5169 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5170 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5175 uint rp_files_cnt
= 0;
5177 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5186 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5190 case IDX_HELP
: usage
= 1; break;
5192 case IDX_VERSION_LOWER
: version
= 1; break;
5193 case IDX_RESTORE
: restore
= 1; break;
5194 case IDX_SESSION
: session
= optarg
; break;
5195 case IDX_SHOW
: show
= 1; break;
5196 case IDX_LEFT
: left
= 1; break;
5197 case '?': return (-1);
5203 log_error ("ERROR: Invalid argument specified");
5214 log_info (VERSION_TXT
);
5221 usage_big_print (PROGNAME
);
5230 if (session
== NULL
) session
= (char *) PROGNAME
;
5232 size_t session_size
= strlen (session
) + 32;
5234 data
.session
= session
;
5236 char *eff_restore_file
= (char *) mymalloc (session_size
);
5237 char *new_restore_file
= (char *) mymalloc (session_size
);
5239 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5240 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5242 data
.eff_restore_file
= eff_restore_file
;
5243 data
.new_restore_file
= new_restore_file
;
5245 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5247 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5248 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5253 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5254 if ((show
== 1) || (left
== 1))
5256 restore_disable
= 1;
5261 data
.restore_disable
= restore_disable
;
5263 restore_data_t
*rd
= init_restore (argc
, argv
);
5273 read_restore (eff_restore_file
, rd
);
5275 if (rd
->version_bin
< RESTORE_MIN
)
5277 log_error ("ERROR: Incompatible restore-file version");
5286 rd
->pid
= getpid ();
5288 rd
->pid
= GetCurrentProcessId ();
5292 uint hash_mode_chgd
= 0;
5293 uint runtime_chgd
= 0;
5294 uint gpu_loops_chgd
= 0;
5295 uint gpu_accel_chgd
= 0;
5296 uint attack_mode_chgd
= 0;
5297 uint outfile_format_chgd
= 0;
5298 uint rp_gen_seed_chgd
= 0;
5299 uint remove_timer_chgd
= 0;
5300 uint increment_min_chgd
= 0;
5301 uint increment_max_chgd
= 0;
5302 uint gpu_temp_abort_chgd
= 0;
5303 uint gpu_temp_retain_chgd
= 0;
5309 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5313 //case IDX_HELP: usage = 1; break;
5314 //case IDX_VERSION: version = 1; break;
5315 //case IDX_RESTORE: restore = 1; break;
5316 case IDX_QUIET
: quiet
= 1; break;
5317 //case IDX_SHOW: show = 1; break;
5318 case IDX_SHOW
: break;
5319 //case IDX_LEFT: left = 1; break;
5320 case IDX_LEFT
: break;
5321 case IDX_USERNAME
: username
= 1; break;
5322 case IDX_REMOVE
: remove
= 1; break;
5323 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5324 remove_timer_chgd
= 1; break;
5325 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5326 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5327 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5328 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5329 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5330 case IDX_FORCE
: force
= 1; break;
5331 case IDX_SKIP
: skip
= atoll (optarg
); break;
5332 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5333 case IDX_KEYSPACE
: keyspace
= 1; break;
5334 case IDX_BENCHMARK
: benchmark
= 1; break;
5335 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5336 case IDX_RESTORE
: break;
5337 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5338 case IDX_STATUS
: status
= 1; break;
5339 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5340 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5341 case IDX_LOOPBACK
: loopback
= 1; break;
5342 case IDX_WEAK_HASH_THRESHOLD
:
5343 weak_hash_threshold
= atoi (optarg
); break;
5344 //case IDX_SESSION: session = optarg; break;
5345 case IDX_SESSION
: break;
5346 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5347 hash_mode_chgd
= 1; break;
5348 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5349 runtime_chgd
= 1; break;
5350 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5351 attack_mode_chgd
= 1; break;
5352 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5353 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5354 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5355 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5356 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5357 rp_gen_seed_chgd
= 1; break;
5358 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5359 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5360 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5361 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5362 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5363 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5364 case IDX_OUTFILE
: outfile
= optarg
; break;
5365 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5366 outfile_format_chgd
= 1; break;
5367 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5368 outfile_autohex
= 0; break;
5369 case IDX_OUTFILE_CHECK_TIMER
:
5370 outfile_check_timer
= atoi (optarg
); break;
5371 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5372 case IDX_HEX_SALT
: hex_salt
= 1; break;
5373 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5374 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5375 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5376 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5377 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5378 gpu_accel_chgd
= 1; break;
5379 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5380 gpu_loops_chgd
= 1; break;
5381 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5382 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5383 gpu_temp_abort
= atoi (optarg
); break;
5384 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5385 gpu_temp_retain
= atoi (optarg
); break;
5386 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5387 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5388 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5389 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5390 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5391 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5392 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5393 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5394 case IDX_INCREMENT
: increment
= 1; break;
5395 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5396 increment_min_chgd
= 1; break;
5397 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5398 increment_max_chgd
= 1; break;
5399 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5400 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5401 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5402 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5405 log_error ("ERROR: Invalid argument specified");
5412 log_error ("ERROR: Invalid argument specified");
5418 * Inform user things getting started,
5419 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5420 * - we do not need to check algorithm_pos
5427 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5431 else if (restore
== 1)
5433 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5439 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5449 if (attack_mode
> 7)
5451 log_error ("ERROR: Invalid attack-mode specified");
5456 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5458 log_error ("ERROR: Invalid runtime specified");
5463 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5465 log_error ("ERROR: Invalid hash-type specified");
5470 // renamed hash modes
5484 log_error ("Old -m specified, use -m %d instead", n
);
5492 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5494 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5500 if (outfile_format
> 16)
5502 log_error ("ERROR: Invalid outfile-format specified");
5509 if (outfile_format_chgd
== 1)
5511 if (outfile_format
> 1)
5513 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5520 outfile_format
= OUTFILE_FMT_HASH
;
5526 if (outfile_format_chgd
== 1)
5528 if ((outfile_format
> 7) && (outfile_format
< 16))
5530 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5537 if (increment_min
< INCREMENT_MIN
)
5539 log_error ("ERROR: Invalid increment-min specified");
5544 if (increment_max
> INCREMENT_MAX
)
5546 log_error ("ERROR: Invalid increment-max specified");
5551 if (increment_min
> increment_max
)
5553 log_error ("ERROR: Invalid increment-min specified");
5558 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5560 log_error ("ERROR: increment is not allowed in attack-mode 0");
5565 if ((increment
== 0) && (increment_min_chgd
== 1))
5567 log_error ("ERROR: increment-min is only supported together with increment switch");
5572 if ((increment
== 0) && (increment_max_chgd
== 1))
5574 log_error ("ERROR: increment-max is only supported together with increment switch");
5579 if (rp_files_cnt
&& rp_gen
)
5581 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5586 if (rp_files_cnt
|| rp_gen
)
5588 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5590 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5596 if (rp_gen_func_min
> rp_gen_func_max
)
5598 log_error ("ERROR: Invalid rp-gen-func-min specified");
5603 if (gpu_accel_chgd
== 1)
5605 if (workload_profile
!= WORKLOAD_PROFILE
)
5607 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5614 log_error ("ERROR: Invalid gpu-accel specified");
5619 if (gpu_accel
> 800)
5621 log_error ("ERROR: Invalid gpu-accel specified");
5627 if (gpu_loops_chgd
== 1)
5629 if (workload_profile
!= WORKLOAD_PROFILE
)
5631 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5638 log_error ("ERROR: Invalid gpu-loops specified");
5643 if (gpu_loops
> 1024)
5645 log_error ("ERROR: Invalid gpu-loops specified");
5653 if (workload_profile
!= WORKLOAD_PROFILE
)
5655 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5661 if ((workload_profile
< 1) || (workload_profile
> 3))
5663 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5668 if (show
== 1 || left
== 1)
5670 attack_mode
= ATTACK_MODE_NONE
;
5674 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5679 if (potfile_disable
== 1)
5681 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5687 uint attack_kern
= ATTACK_KERN_NONE
;
5689 switch (attack_mode
)
5691 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5692 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5693 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5694 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5695 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5702 int num_additional_params
= 1;
5704 if (attack_kern
== ATTACK_KERN_COMBI
)
5706 num_additional_params
= 2;
5709 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5711 if (keyspace_wordlist_specified
== 0) optind
--;
5714 if (attack_kern
== ATTACK_KERN_NONE
)
5716 if ((optind
+ 1) != myargc
)
5718 usage_mini_print (myargv
[0]);
5723 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5725 if ((optind
+ 1) > myargc
)
5727 usage_mini_print (myargv
[0]);
5732 else if (attack_kern
== ATTACK_KERN_COMBI
)
5734 if ((optind
+ 3) != myargc
)
5736 usage_mini_print (myargv
[0]);
5741 else if (attack_kern
== ATTACK_KERN_BF
)
5743 if ((optind
+ 1) > myargc
)
5745 usage_mini_print (myargv
[0]);
5752 usage_mini_print (myargv
[0]);
5759 if (myargv
[optind
] != 0)
5761 log_error ("ERROR: Invalid argument for benchmark mode specified");
5766 if (attack_mode_chgd
== 1)
5768 if (attack_mode
!= ATTACK_MODE_BF
)
5770 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5776 if (benchmark_mode
== 0)
5780 else if (benchmark_mode
== 1)
5782 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5784 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5791 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5797 if (skip
!= 0 && limit
!= 0)
5806 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5812 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5817 potfile_disable
= 1;
5819 restore_disable
= 1;
5823 weak_hash_threshold
= 0;
5828 if (remove_timer_chgd
== 1)
5832 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5837 if (remove_timer
< 1)
5839 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5847 if (attack_mode
== ATTACK_MODE_BF
)
5849 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5853 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5855 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5857 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5866 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5868 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5873 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5875 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5883 log_error ("ERROR: Invalid debug-mode specified");
5888 if (debug_file
!= NULL
)
5892 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5898 if (induction_dir
!= NULL
)
5900 if (attack_mode
== ATTACK_MODE_BF
)
5902 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5909 * induction directory
5912 char *induction_directory
= NULL
;
5914 if (attack_mode
!= ATTACK_MODE_BF
)
5916 if (induction_dir
== NULL
)
5918 induction_directory
= (char *) mymalloc (session_size
);
5920 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
5922 // create induction folder if it does not already exist
5926 if (rmdir (induction_directory
) == -1)
5928 if (errno
== ENOENT
)
5930 // good, we can ignore
5932 else if (errno
== ENOTEMPTY
)
5934 char *induction_directory_mv
= (char *) mymalloc (session_size
);
5936 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
5938 if (rename (induction_directory
, induction_directory_mv
) != 0)
5940 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
5947 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5954 #define mkdir(name,mode) mkdir (name)
5957 if (mkdir (induction_directory
, 0700) == -1)
5959 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5967 induction_directory
= induction_dir
;
5971 data
.induction_directory
= induction_directory
;
5977 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
5979 char *loopback_file
= (char *) mymalloc (loopback_size
);
5982 * outfile-check directory
5985 char *outfile_check_directory
= NULL
;
5987 if (outfile_check_dir
== NULL
)
5989 outfile_check_directory
= (char *) mymalloc (session_size
);
5991 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
5995 outfile_check_directory
= outfile_check_dir
;
5998 data
.outfile_check_directory
= outfile_check_directory
;
6002 struct stat outfile_check_stat
;
6004 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6006 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6010 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6015 else if (outfile_check_dir
== NULL
)
6018 #define mkdir(name,mode) mkdir (name)
6021 if (mkdir (outfile_check_directory
, 0700) == -1)
6023 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6031 * special other stuff
6034 if (hash_mode
== 9710)
6037 outfile_format_chgd
= 1;
6040 if (hash_mode
== 9810)
6043 outfile_format_chgd
= 1;
6046 if (hash_mode
== 10410)
6049 outfile_format_chgd
= 1;
6056 data
.hash_mode
= hash_mode
;
6057 data
.restore
= restore
;
6058 data
.restore_timer
= restore_timer
;
6059 data
.restore_disable
= restore_disable
;
6060 data
.status
= status
;
6061 data
.status_timer
= status_timer
;
6062 data
.status_automat
= status_automat
;
6063 data
.loopback
= loopback
;
6064 data
.runtime
= runtime
;
6065 data
.remove
= remove
;
6066 data
.remove_timer
= remove_timer
;
6067 data
.debug_mode
= debug_mode
;
6068 data
.debug_file
= debug_file
;
6069 data
.username
= username
;
6071 data
.outfile
= outfile
;
6072 data
.outfile_format
= outfile_format
;
6073 data
.outfile_autohex
= outfile_autohex
;
6074 data
.hex_charset
= hex_charset
;
6075 data
.hex_salt
= hex_salt
;
6076 data
.hex_wordlist
= hex_wordlist
;
6077 data
.separator
= separator
;
6078 data
.rp_files
= rp_files
;
6079 data
.rp_files_cnt
= rp_files_cnt
;
6080 data
.rp_gen
= rp_gen
;
6081 data
.rp_gen_seed
= rp_gen_seed
;
6083 data
.benchmark
= benchmark
;
6086 data
.powertune_enable
= powertune_enable
;
6087 data
.logfile_disable
= logfile_disable
;
6088 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6089 data
.scrypt_tmto
= scrypt_tmto
;
6092 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6097 char *resolved_path
= realpath (myargv
[0], NULL
);
6099 char *install_dir
= get_install_dir (resolved_path
);
6100 char *profile_dir
= NULL
;
6101 char *session_dir
= NULL
;
6103 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6105 struct passwd
*pw
= getpwuid (getuid ());
6107 const char *homedir
= pw
->pw_dir
;
6109 profile_dir
= get_profile_dir (homedir
);
6110 session_dir
= get_session_dir (profile_dir
, session
);
6114 profile_dir
= install_dir
;
6115 session_dir
= install_dir
;
6118 myfree (resolved_path
);
6122 char *install_dir
= get_install_dir (myargv
[0]);
6123 char *profile_dir
= install_dir
;
6124 char *session_dir
= install_dir
;
6128 data
.install_dir
= install_dir
;
6129 data
.profile_dir
= profile_dir
;
6130 data
.session_dir
= session_dir
;
6138 set_cpu_affinity (cpu_affinity
);
6141 if (rp_gen_seed_chgd
== 0)
6147 srand (rp_gen_seed
);
6154 if (logfile_disable
== 0)
6156 size_t logfile_size
= strlen (session
) + 32;
6158 char *logfile
= (char *) mymalloc (logfile_size
);
6160 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6162 data
.logfile
= logfile
;
6164 char *topid
= logfile_generate_topid ();
6169 // logfile_append() checks for logfile_disable internally to make it easier from here
6171 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6172 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6173 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6174 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6175 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6176 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6177 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6178 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6179 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6180 #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));
6182 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6183 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6184 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6185 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6186 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6187 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6188 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6189 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6191 logfile_top_msg ("START");
6193 logfile_top_uint (attack_mode
);
6194 logfile_top_uint (attack_kern
);
6195 logfile_top_uint (benchmark
);
6196 logfile_top_uint (benchmark_mode
);
6197 logfile_top_uint (bitmap_min
);
6198 logfile_top_uint (bitmap_max
);
6199 logfile_top_uint (debug_mode
);
6200 logfile_top_uint (force
);
6201 logfile_top_uint (gpu_accel
);
6202 logfile_top_uint (gpu_loops
);
6203 logfile_top_uint (gpu_temp_abort
);
6204 logfile_top_uint (gpu_temp_disable
);
6205 logfile_top_uint (gpu_temp_retain
);
6206 logfile_top_uint (hash_mode
);
6207 logfile_top_uint (hex_charset
);
6208 logfile_top_uint (hex_salt
);
6209 logfile_top_uint (hex_wordlist
);
6210 logfile_top_uint (increment
);
6211 logfile_top_uint (increment_max
);
6212 logfile_top_uint (increment_min
);
6213 logfile_top_uint (keyspace
);
6214 logfile_top_uint (left
);
6215 logfile_top_uint (logfile_disable
);
6216 logfile_top_uint (loopback
);
6217 logfile_top_uint (markov_classic
);
6218 logfile_top_uint (markov_disable
);
6219 logfile_top_uint (markov_threshold
);
6220 logfile_top_uint (outfile_autohex
);
6221 logfile_top_uint (outfile_check_timer
);
6222 logfile_top_uint (outfile_format
);
6223 logfile_top_uint (potfile_disable
);
6224 logfile_top_uint (powertune_enable
);
6225 logfile_top_uint (scrypt_tmto
);
6226 logfile_top_uint (quiet
);
6227 logfile_top_uint (remove
);
6228 logfile_top_uint (remove_timer
);
6229 logfile_top_uint (restore
);
6230 logfile_top_uint (restore_disable
);
6231 logfile_top_uint (restore_timer
);
6232 logfile_top_uint (rp_gen
);
6233 logfile_top_uint (rp_gen_func_max
);
6234 logfile_top_uint (rp_gen_func_min
);
6235 logfile_top_uint (rp_gen_seed
);
6236 logfile_top_uint (runtime
);
6237 logfile_top_uint (segment_size
);
6238 logfile_top_uint (show
);
6239 logfile_top_uint (status
);
6240 logfile_top_uint (status_automat
);
6241 logfile_top_uint (status_timer
);
6242 logfile_top_uint (usage
);
6243 logfile_top_uint (username
);
6244 logfile_top_uint (version
);
6245 logfile_top_uint (weak_hash_threshold
);
6246 logfile_top_uint (workload_profile
);
6247 logfile_top_uint64 (limit
);
6248 logfile_top_uint64 (skip
);
6249 logfile_top_char (separator
);
6250 logfile_top_string (cpu_affinity
);
6251 logfile_top_string (custom_charset_1
);
6252 logfile_top_string (custom_charset_2
);
6253 logfile_top_string (custom_charset_3
);
6254 logfile_top_string (custom_charset_4
);
6255 logfile_top_string (debug_file
);
6256 logfile_top_string (gpu_devices
);
6257 logfile_top_string (induction_dir
);
6258 logfile_top_string (markov_hcstat
);
6259 logfile_top_string (outfile
);
6260 logfile_top_string (outfile_check_dir
);
6261 logfile_top_string (rule_buf_l
);
6262 logfile_top_string (rule_buf_r
);
6263 logfile_top_string (session
);
6264 logfile_top_string (truecrypt_keyfiles
);
6270 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6279 * disable useless stuff for benchmark
6284 restore_disable
= 1;
6285 potfile_disable
= 1;
6286 weak_hash_threshold
= 0;
6288 data
.restore_timer
= restore_timer
;
6289 data
.status_timer
= status_timer
;
6290 data
.restore_disable
= restore_disable
;
6292 if (benchmark_mode
== 1)
6298 * force attack mode to be bruteforce
6301 attack_mode
= ATTACK_MODE_BF
;
6302 attack_kern
= ATTACK_KERN_BF
;
6304 if (runtime_chgd
== 0)
6308 if (benchmark_mode
== 1) runtime
= 17;
6310 data
.runtime
= runtime
;
6320 uint attack_exec
= 0;
6324 uint esalt_size
= 0;
6326 uint dgst_pos0
= -1;
6327 uint dgst_pos1
= -1;
6328 uint dgst_pos2
= -1;
6329 uint dgst_pos3
= -1;
6331 int (*parse_func
) (char *, uint
, hash_t
*);
6332 int (*sort_by_digest
) (const void *, const void *);
6334 uint algorithm_pos
= 0;
6335 uint algorithm_max
= 1;
6337 uint
*algorithms
= default_benchmark_algorithms
;
6339 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6341 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6344 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6345 * the following algos are skipped entirely
6348 if (algorithm_pos
> 0)
6352 rd
= init_restore (argc
, argv
);
6358 * update hash_mode in case of multihash benchmark
6363 if (hash_mode_chgd
== 0)
6365 hash_mode
= algorithms
[algorithm_pos
];
6367 data
.hash_mode
= hash_mode
;
6377 case 0: hash_type
= HASH_TYPE_MD5
;
6378 salt_type
= SALT_TYPE_NONE
;
6379 attack_exec
= ATTACK_EXEC_ON_GPU
;
6380 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6381 | OPTS_TYPE_PT_ADD80
6382 | OPTS_TYPE_PT_ADDBITS14
;
6383 kern_type
= KERN_TYPE_MD5
;
6384 dgst_size
= DGST_SIZE_4_4
;
6385 parse_func
= md5_parse_hash
;
6386 sort_by_digest
= sort_by_digest_4_4
;
6387 opti_type
= OPTI_TYPE_ZERO_BYTE
6388 | OPTI_TYPE_PRECOMPUTE_INIT
6389 | OPTI_TYPE_PRECOMPUTE_MERKLE
6390 | OPTI_TYPE_MEET_IN_MIDDLE
6391 | OPTI_TYPE_EARLY_SKIP
6392 | OPTI_TYPE_NOT_ITERATED
6393 | OPTI_TYPE_NOT_SALTED
6394 | OPTI_TYPE_RAW_HASH
;
6401 case 10: hash_type
= HASH_TYPE_MD5
;
6402 salt_type
= SALT_TYPE_INTERN
;
6403 attack_exec
= ATTACK_EXEC_ON_GPU
;
6404 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6405 | OPTS_TYPE_ST_ADD80
6406 | OPTS_TYPE_ST_ADDBITS14
;
6407 kern_type
= KERN_TYPE_MD5_PWSLT
;
6408 dgst_size
= DGST_SIZE_4_4
;
6409 parse_func
= md5s_parse_hash
;
6410 sort_by_digest
= sort_by_digest_4_4
;
6411 opti_type
= OPTI_TYPE_ZERO_BYTE
6412 | OPTI_TYPE_PRECOMPUTE_INIT
6413 | OPTI_TYPE_PRECOMPUTE_MERKLE
6414 | OPTI_TYPE_MEET_IN_MIDDLE
6415 | OPTI_TYPE_EARLY_SKIP
6416 | OPTI_TYPE_NOT_ITERATED
6417 | OPTI_TYPE_APPENDED_SALT
6418 | OPTI_TYPE_RAW_HASH
;
6425 case 11: hash_type
= HASH_TYPE_MD5
;
6426 salt_type
= SALT_TYPE_INTERN
;
6427 attack_exec
= ATTACK_EXEC_ON_GPU
;
6428 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6429 | OPTS_TYPE_ST_ADD80
6430 | OPTS_TYPE_ST_ADDBITS14
;
6431 kern_type
= KERN_TYPE_MD5_PWSLT
;
6432 dgst_size
= DGST_SIZE_4_4
;
6433 parse_func
= joomla_parse_hash
;
6434 sort_by_digest
= sort_by_digest_4_4
;
6435 opti_type
= OPTI_TYPE_ZERO_BYTE
6436 | OPTI_TYPE_PRECOMPUTE_INIT
6437 | OPTI_TYPE_PRECOMPUTE_MERKLE
6438 | OPTI_TYPE_MEET_IN_MIDDLE
6439 | OPTI_TYPE_EARLY_SKIP
6440 | OPTI_TYPE_NOT_ITERATED
6441 | OPTI_TYPE_APPENDED_SALT
6442 | OPTI_TYPE_RAW_HASH
;
6449 case 12: hash_type
= HASH_TYPE_MD5
;
6450 salt_type
= SALT_TYPE_INTERN
;
6451 attack_exec
= ATTACK_EXEC_ON_GPU
;
6452 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6453 | OPTS_TYPE_ST_ADD80
6454 | OPTS_TYPE_ST_ADDBITS14
;
6455 kern_type
= KERN_TYPE_MD5_PWSLT
;
6456 dgst_size
= DGST_SIZE_4_4
;
6457 parse_func
= postgresql_parse_hash
;
6458 sort_by_digest
= sort_by_digest_4_4
;
6459 opti_type
= OPTI_TYPE_ZERO_BYTE
6460 | OPTI_TYPE_PRECOMPUTE_INIT
6461 | OPTI_TYPE_PRECOMPUTE_MERKLE
6462 | OPTI_TYPE_MEET_IN_MIDDLE
6463 | OPTI_TYPE_EARLY_SKIP
6464 | OPTI_TYPE_NOT_ITERATED
6465 | OPTI_TYPE_APPENDED_SALT
6466 | OPTI_TYPE_RAW_HASH
;
6473 case 20: hash_type
= HASH_TYPE_MD5
;
6474 salt_type
= SALT_TYPE_INTERN
;
6475 attack_exec
= ATTACK_EXEC_ON_GPU
;
6476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6477 | OPTS_TYPE_PT_ADD80
6478 | OPTS_TYPE_PT_ADDBITS14
;
6479 kern_type
= KERN_TYPE_MD5_SLTPW
;
6480 dgst_size
= DGST_SIZE_4_4
;
6481 parse_func
= md5s_parse_hash
;
6482 sort_by_digest
= sort_by_digest_4_4
;
6483 opti_type
= OPTI_TYPE_ZERO_BYTE
6484 | OPTI_TYPE_PRECOMPUTE_INIT
6485 | OPTI_TYPE_PRECOMPUTE_MERKLE
6486 | OPTI_TYPE_EARLY_SKIP
6487 | OPTI_TYPE_NOT_ITERATED
6488 | OPTI_TYPE_PREPENDED_SALT
6489 | OPTI_TYPE_RAW_HASH
;
6496 case 21: hash_type
= HASH_TYPE_MD5
;
6497 salt_type
= SALT_TYPE_INTERN
;
6498 attack_exec
= ATTACK_EXEC_ON_GPU
;
6499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6500 | OPTS_TYPE_PT_ADD80
6501 | OPTS_TYPE_PT_ADDBITS14
;
6502 kern_type
= KERN_TYPE_MD5_SLTPW
;
6503 dgst_size
= DGST_SIZE_4_4
;
6504 parse_func
= osc_parse_hash
;
6505 sort_by_digest
= sort_by_digest_4_4
;
6506 opti_type
= OPTI_TYPE_ZERO_BYTE
6507 | OPTI_TYPE_PRECOMPUTE_INIT
6508 | OPTI_TYPE_PRECOMPUTE_MERKLE
6509 | OPTI_TYPE_EARLY_SKIP
6510 | OPTI_TYPE_NOT_ITERATED
6511 | OPTI_TYPE_PREPENDED_SALT
6512 | OPTI_TYPE_RAW_HASH
;
6519 case 22: hash_type
= HASH_TYPE_MD5
;
6520 salt_type
= SALT_TYPE_EMBEDDED
;
6521 attack_exec
= ATTACK_EXEC_ON_GPU
;
6522 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6523 | OPTS_TYPE_PT_ADD80
6524 | OPTS_TYPE_PT_ADDBITS14
;
6525 kern_type
= KERN_TYPE_MD5_SLTPW
;
6526 dgst_size
= DGST_SIZE_4_4
;
6527 parse_func
= netscreen_parse_hash
;
6528 sort_by_digest
= sort_by_digest_4_4
;
6529 opti_type
= OPTI_TYPE_ZERO_BYTE
6530 | OPTI_TYPE_PRECOMPUTE_INIT
6531 | OPTI_TYPE_PRECOMPUTE_MERKLE
6532 | OPTI_TYPE_EARLY_SKIP
6533 | OPTI_TYPE_NOT_ITERATED
6534 | OPTI_TYPE_PREPENDED_SALT
6535 | OPTI_TYPE_RAW_HASH
;
6542 case 23: hash_type
= HASH_TYPE_MD5
;
6543 salt_type
= SALT_TYPE_EMBEDDED
;
6544 attack_exec
= ATTACK_EXEC_ON_GPU
;
6545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6546 | OPTS_TYPE_PT_ADD80
6547 | OPTS_TYPE_PT_ADDBITS14
;
6548 kern_type
= KERN_TYPE_MD5_SLTPW
;
6549 dgst_size
= DGST_SIZE_4_4
;
6550 parse_func
= skype_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_EARLY_SKIP
6556 | OPTI_TYPE_NOT_ITERATED
6557 | OPTI_TYPE_PREPENDED_SALT
6558 | OPTI_TYPE_RAW_HASH
;
6565 case 30: hash_type
= HASH_TYPE_MD5
;
6566 salt_type
= SALT_TYPE_INTERN
;
6567 attack_exec
= ATTACK_EXEC_ON_GPU
;
6568 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6569 | OPTS_TYPE_PT_UNICODE
6570 | OPTS_TYPE_ST_ADD80
6571 | OPTS_TYPE_ST_ADDBITS14
;
6572 kern_type
= KERN_TYPE_MD5_PWUSLT
;
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_MEET_IN_MIDDLE
6580 | OPTI_TYPE_EARLY_SKIP
6581 | OPTI_TYPE_NOT_ITERATED
6582 | OPTI_TYPE_APPENDED_SALT
6583 | OPTI_TYPE_RAW_HASH
;
6590 case 40: hash_type
= HASH_TYPE_MD5
;
6591 salt_type
= SALT_TYPE_INTERN
;
6592 attack_exec
= ATTACK_EXEC_ON_GPU
;
6593 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6594 | OPTS_TYPE_PT_ADD80
6595 | OPTS_TYPE_PT_ADDBITS14
6596 | OPTS_TYPE_PT_UNICODE
;
6597 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6598 dgst_size
= DGST_SIZE_4_4
;
6599 parse_func
= md5s_parse_hash
;
6600 sort_by_digest
= sort_by_digest_4_4
;
6601 opti_type
= OPTI_TYPE_ZERO_BYTE
6602 | OPTI_TYPE_PRECOMPUTE_INIT
6603 | OPTI_TYPE_PRECOMPUTE_MERKLE
6604 | OPTI_TYPE_EARLY_SKIP
6605 | OPTI_TYPE_NOT_ITERATED
6606 | OPTI_TYPE_PREPENDED_SALT
6607 | OPTI_TYPE_RAW_HASH
;
6614 case 50: hash_type
= HASH_TYPE_MD5
;
6615 salt_type
= SALT_TYPE_INTERN
;
6616 attack_exec
= ATTACK_EXEC_ON_GPU
;
6617 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6618 | OPTS_TYPE_ST_ADD80
6619 | OPTS_TYPE_ST_ADDBITS14
;
6620 kern_type
= KERN_TYPE_HMACMD5_PW
;
6621 dgst_size
= DGST_SIZE_4_4
;
6622 parse_func
= hmacmd5_parse_hash
;
6623 sort_by_digest
= sort_by_digest_4_4
;
6624 opti_type
= OPTI_TYPE_ZERO_BYTE
6625 | OPTI_TYPE_NOT_ITERATED
;
6632 case 60: hash_type
= HASH_TYPE_MD5
;
6633 salt_type
= SALT_TYPE_INTERN
;
6634 attack_exec
= ATTACK_EXEC_ON_GPU
;
6635 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6636 | OPTS_TYPE_PT_ADD80
6637 | OPTS_TYPE_PT_ADDBITS14
;
6638 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6639 dgst_size
= DGST_SIZE_4_4
;
6640 parse_func
= hmacmd5_parse_hash
;
6641 sort_by_digest
= sort_by_digest_4_4
;
6642 opti_type
= OPTI_TYPE_ZERO_BYTE
6643 | OPTI_TYPE_NOT_ITERATED
;
6650 case 100: hash_type
= HASH_TYPE_SHA1
;
6651 salt_type
= SALT_TYPE_NONE
;
6652 attack_exec
= ATTACK_EXEC_ON_GPU
;
6653 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6654 | OPTS_TYPE_PT_ADD80
6655 | OPTS_TYPE_PT_ADDBITS15
;
6656 kern_type
= KERN_TYPE_SHA1
;
6657 dgst_size
= DGST_SIZE_4_5
;
6658 parse_func
= sha1_parse_hash
;
6659 sort_by_digest
= sort_by_digest_4_5
;
6660 opti_type
= OPTI_TYPE_ZERO_BYTE
6661 | OPTI_TYPE_PRECOMPUTE_INIT
6662 | OPTI_TYPE_PRECOMPUTE_MERKLE
6663 | OPTI_TYPE_EARLY_SKIP
6664 | OPTI_TYPE_NOT_ITERATED
6665 | OPTI_TYPE_NOT_SALTED
6666 | OPTI_TYPE_RAW_HASH
;
6673 case 101: hash_type
= HASH_TYPE_SHA1
;
6674 salt_type
= SALT_TYPE_NONE
;
6675 attack_exec
= ATTACK_EXEC_ON_GPU
;
6676 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6677 | OPTS_TYPE_PT_ADD80
6678 | OPTS_TYPE_PT_ADDBITS15
;
6679 kern_type
= KERN_TYPE_SHA1
;
6680 dgst_size
= DGST_SIZE_4_5
;
6681 parse_func
= sha1b64_parse_hash
;
6682 sort_by_digest
= sort_by_digest_4_5
;
6683 opti_type
= OPTI_TYPE_ZERO_BYTE
6684 | OPTI_TYPE_PRECOMPUTE_INIT
6685 | OPTI_TYPE_PRECOMPUTE_MERKLE
6686 | OPTI_TYPE_EARLY_SKIP
6687 | OPTI_TYPE_NOT_ITERATED
6688 | OPTI_TYPE_NOT_SALTED
6689 | OPTI_TYPE_RAW_HASH
;
6696 case 110: hash_type
= HASH_TYPE_SHA1
;
6697 salt_type
= SALT_TYPE_INTERN
;
6698 attack_exec
= ATTACK_EXEC_ON_GPU
;
6699 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6700 | OPTS_TYPE_ST_ADD80
6701 | OPTS_TYPE_ST_ADDBITS15
;
6702 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6703 dgst_size
= DGST_SIZE_4_5
;
6704 parse_func
= sha1s_parse_hash
;
6705 sort_by_digest
= sort_by_digest_4_5
;
6706 opti_type
= OPTI_TYPE_ZERO_BYTE
6707 | OPTI_TYPE_PRECOMPUTE_INIT
6708 | OPTI_TYPE_PRECOMPUTE_MERKLE
6709 | OPTI_TYPE_EARLY_SKIP
6710 | OPTI_TYPE_NOT_ITERATED
6711 | OPTI_TYPE_APPENDED_SALT
6712 | OPTI_TYPE_RAW_HASH
;
6719 case 111: hash_type
= HASH_TYPE_SHA1
;
6720 salt_type
= SALT_TYPE_EMBEDDED
;
6721 attack_exec
= ATTACK_EXEC_ON_GPU
;
6722 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6723 | OPTS_TYPE_ST_ADD80
6724 | OPTS_TYPE_ST_ADDBITS15
;
6725 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6726 dgst_size
= DGST_SIZE_4_5
;
6727 parse_func
= sha1b64s_parse_hash
;
6728 sort_by_digest
= sort_by_digest_4_5
;
6729 opti_type
= OPTI_TYPE_ZERO_BYTE
6730 | OPTI_TYPE_PRECOMPUTE_INIT
6731 | OPTI_TYPE_PRECOMPUTE_MERKLE
6732 | OPTI_TYPE_EARLY_SKIP
6733 | OPTI_TYPE_NOT_ITERATED
6734 | OPTI_TYPE_APPENDED_SALT
6735 | OPTI_TYPE_RAW_HASH
;
6742 case 112: hash_type
= HASH_TYPE_SHA1
;
6743 salt_type
= SALT_TYPE_INTERN
;
6744 attack_exec
= ATTACK_EXEC_ON_GPU
;
6745 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6746 | OPTS_TYPE_ST_ADD80
6747 | OPTS_TYPE_ST_ADDBITS15
6749 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6750 dgst_size
= DGST_SIZE_4_5
;
6751 parse_func
= oracles_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_APPENDED_SALT
6759 | OPTI_TYPE_RAW_HASH
;
6766 case 120: hash_type
= HASH_TYPE_SHA1
;
6767 salt_type
= SALT_TYPE_INTERN
;
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_SLTPW
;
6773 dgst_size
= DGST_SIZE_4_5
;
6774 parse_func
= sha1s_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_PREPENDED_SALT
6782 | OPTI_TYPE_RAW_HASH
;
6789 case 121: 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_PT_ADD80
6794 | OPTS_TYPE_PT_ADDBITS15
6795 | OPTS_TYPE_ST_LOWER
;
6796 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6797 dgst_size
= DGST_SIZE_4_5
;
6798 parse_func
= smf_parse_hash
;
6799 sort_by_digest
= sort_by_digest_4_5
;
6800 opti_type
= OPTI_TYPE_ZERO_BYTE
6801 | OPTI_TYPE_PRECOMPUTE_INIT
6802 | OPTI_TYPE_PRECOMPUTE_MERKLE
6803 | OPTI_TYPE_EARLY_SKIP
6804 | OPTI_TYPE_NOT_ITERATED
6805 | OPTI_TYPE_PREPENDED_SALT
6806 | OPTI_TYPE_RAW_HASH
;
6813 case 122: hash_type
= HASH_TYPE_SHA1
;
6814 salt_type
= SALT_TYPE_EMBEDDED
;
6815 attack_exec
= ATTACK_EXEC_ON_GPU
;
6816 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6817 | OPTS_TYPE_PT_ADD80
6818 | OPTS_TYPE_PT_ADDBITS15
6820 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6821 dgst_size
= DGST_SIZE_4_5
;
6822 parse_func
= osx1_parse_hash
;
6823 sort_by_digest
= sort_by_digest_4_5
;
6824 opti_type
= OPTI_TYPE_ZERO_BYTE
6825 | OPTI_TYPE_PRECOMPUTE_INIT
6826 | OPTI_TYPE_PRECOMPUTE_MERKLE
6827 | OPTI_TYPE_EARLY_SKIP
6828 | OPTI_TYPE_NOT_ITERATED
6829 | OPTI_TYPE_PREPENDED_SALT
6830 | OPTI_TYPE_RAW_HASH
;
6837 case 124: hash_type
= HASH_TYPE_SHA1
;
6838 salt_type
= SALT_TYPE_EMBEDDED
;
6839 attack_exec
= ATTACK_EXEC_ON_GPU
;
6840 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6841 | OPTS_TYPE_PT_ADD80
6842 | OPTS_TYPE_PT_ADDBITS15
;
6843 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6844 dgst_size
= DGST_SIZE_4_5
;
6845 parse_func
= djangosha1_parse_hash
;
6846 sort_by_digest
= sort_by_digest_4_5
;
6847 opti_type
= OPTI_TYPE_ZERO_BYTE
6848 | OPTI_TYPE_PRECOMPUTE_INIT
6849 | OPTI_TYPE_PRECOMPUTE_MERKLE
6850 | OPTI_TYPE_EARLY_SKIP
6851 | OPTI_TYPE_NOT_ITERATED
6852 | OPTI_TYPE_PREPENDED_SALT
6853 | OPTI_TYPE_RAW_HASH
;
6860 case 130: hash_type
= HASH_TYPE_SHA1
;
6861 salt_type
= SALT_TYPE_INTERN
;
6862 attack_exec
= ATTACK_EXEC_ON_GPU
;
6863 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6864 | OPTS_TYPE_PT_UNICODE
6865 | OPTS_TYPE_ST_ADD80
6866 | OPTS_TYPE_ST_ADDBITS15
;
6867 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6868 dgst_size
= DGST_SIZE_4_5
;
6869 parse_func
= sha1s_parse_hash
;
6870 sort_by_digest
= sort_by_digest_4_5
;
6871 opti_type
= OPTI_TYPE_ZERO_BYTE
6872 | OPTI_TYPE_PRECOMPUTE_INIT
6873 | OPTI_TYPE_PRECOMPUTE_MERKLE
6874 | OPTI_TYPE_EARLY_SKIP
6875 | OPTI_TYPE_NOT_ITERATED
6876 | OPTI_TYPE_APPENDED_SALT
6877 | OPTI_TYPE_RAW_HASH
;
6884 case 131: hash_type
= HASH_TYPE_SHA1
;
6885 salt_type
= SALT_TYPE_EMBEDDED
;
6886 attack_exec
= ATTACK_EXEC_ON_GPU
;
6887 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6888 | OPTS_TYPE_PT_UNICODE
6889 | OPTS_TYPE_PT_UPPER
6890 | OPTS_TYPE_ST_ADD80
6891 | OPTS_TYPE_ST_ADDBITS15
6893 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6894 dgst_size
= DGST_SIZE_4_5
;
6895 parse_func
= mssql2000_parse_hash
;
6896 sort_by_digest
= sort_by_digest_4_5
;
6897 opti_type
= OPTI_TYPE_ZERO_BYTE
6898 | OPTI_TYPE_PRECOMPUTE_INIT
6899 | OPTI_TYPE_PRECOMPUTE_MERKLE
6900 | OPTI_TYPE_EARLY_SKIP
6901 | OPTI_TYPE_NOT_ITERATED
6902 | OPTI_TYPE_APPENDED_SALT
6903 | OPTI_TYPE_RAW_HASH
;
6910 case 132: hash_type
= HASH_TYPE_SHA1
;
6911 salt_type
= SALT_TYPE_EMBEDDED
;
6912 attack_exec
= ATTACK_EXEC_ON_GPU
;
6913 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6914 | OPTS_TYPE_PT_UNICODE
6915 | OPTS_TYPE_ST_ADD80
6916 | OPTS_TYPE_ST_ADDBITS15
6918 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6919 dgst_size
= DGST_SIZE_4_5
;
6920 parse_func
= mssql2005_parse_hash
;
6921 sort_by_digest
= sort_by_digest_4_5
;
6922 opti_type
= OPTI_TYPE_ZERO_BYTE
6923 | OPTI_TYPE_PRECOMPUTE_INIT
6924 | OPTI_TYPE_PRECOMPUTE_MERKLE
6925 | OPTI_TYPE_EARLY_SKIP
6926 | OPTI_TYPE_NOT_ITERATED
6927 | OPTI_TYPE_APPENDED_SALT
6928 | OPTI_TYPE_RAW_HASH
;
6935 case 133: hash_type
= HASH_TYPE_SHA1
;
6936 salt_type
= SALT_TYPE_EMBEDDED
;
6937 attack_exec
= ATTACK_EXEC_ON_GPU
;
6938 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6939 | OPTS_TYPE_PT_UNICODE
6940 | OPTS_TYPE_ST_ADD80
6941 | OPTS_TYPE_ST_ADDBITS15
;
6942 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6943 dgst_size
= DGST_SIZE_4_5
;
6944 parse_func
= peoplesoft_parse_hash
;
6945 sort_by_digest
= sort_by_digest_4_5
;
6946 opti_type
= OPTI_TYPE_ZERO_BYTE
6947 | OPTI_TYPE_PRECOMPUTE_INIT
6948 | OPTI_TYPE_PRECOMPUTE_MERKLE
6949 | OPTI_TYPE_EARLY_SKIP
6950 | OPTI_TYPE_NOT_ITERATED
6951 | OPTI_TYPE_APPENDED_SALT
6952 | OPTI_TYPE_RAW_HASH
;
6959 case 140: hash_type
= HASH_TYPE_SHA1
;
6960 salt_type
= SALT_TYPE_INTERN
;
6961 attack_exec
= ATTACK_EXEC_ON_GPU
;
6962 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6963 | OPTS_TYPE_PT_ADD80
6964 | OPTS_TYPE_PT_ADDBITS15
6965 | OPTS_TYPE_PT_UNICODE
;
6966 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6967 dgst_size
= DGST_SIZE_4_5
;
6968 parse_func
= sha1s_parse_hash
;
6969 sort_by_digest
= sort_by_digest_4_5
;
6970 opti_type
= OPTI_TYPE_ZERO_BYTE
6971 | OPTI_TYPE_PRECOMPUTE_INIT
6972 | OPTI_TYPE_PRECOMPUTE_MERKLE
6973 | OPTI_TYPE_EARLY_SKIP
6974 | OPTI_TYPE_NOT_ITERATED
6975 | OPTI_TYPE_PREPENDED_SALT
6976 | OPTI_TYPE_RAW_HASH
;
6983 case 141: hash_type
= HASH_TYPE_SHA1
;
6984 salt_type
= SALT_TYPE_EMBEDDED
;
6985 attack_exec
= ATTACK_EXEC_ON_GPU
;
6986 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6987 | OPTS_TYPE_PT_ADD80
6988 | OPTS_TYPE_PT_ADDBITS15
6989 | OPTS_TYPE_PT_UNICODE
6990 | OPTS_TYPE_ST_BASE64
;
6991 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6992 dgst_size
= DGST_SIZE_4_5
;
6993 parse_func
= episerver_parse_hash
;
6994 sort_by_digest
= sort_by_digest_4_5
;
6995 opti_type
= OPTI_TYPE_ZERO_BYTE
6996 | OPTI_TYPE_PRECOMPUTE_INIT
6997 | OPTI_TYPE_PRECOMPUTE_MERKLE
6998 | OPTI_TYPE_EARLY_SKIP
6999 | OPTI_TYPE_NOT_ITERATED
7000 | OPTI_TYPE_PREPENDED_SALT
7001 | OPTI_TYPE_RAW_HASH
;
7008 case 150: hash_type
= HASH_TYPE_SHA1
;
7009 salt_type
= SALT_TYPE_INTERN
;
7010 attack_exec
= ATTACK_EXEC_ON_GPU
;
7011 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7012 | OPTS_TYPE_ST_ADD80
7013 | OPTS_TYPE_ST_ADDBITS15
;
7014 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7015 dgst_size
= DGST_SIZE_4_5
;
7016 parse_func
= hmacsha1_parse_hash
;
7017 sort_by_digest
= sort_by_digest_4_5
;
7018 opti_type
= OPTI_TYPE_ZERO_BYTE
7019 | OPTI_TYPE_NOT_ITERATED
;
7026 case 160: hash_type
= HASH_TYPE_SHA1
;
7027 salt_type
= SALT_TYPE_INTERN
;
7028 attack_exec
= ATTACK_EXEC_ON_GPU
;
7029 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7030 | OPTS_TYPE_PT_ADD80
7031 | OPTS_TYPE_PT_ADDBITS15
;
7032 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7033 dgst_size
= DGST_SIZE_4_5
;
7034 parse_func
= hmacsha1_parse_hash
;
7035 sort_by_digest
= sort_by_digest_4_5
;
7036 opti_type
= OPTI_TYPE_ZERO_BYTE
7037 | OPTI_TYPE_NOT_ITERATED
;
7044 case 190: hash_type
= HASH_TYPE_SHA1
;
7045 salt_type
= SALT_TYPE_NONE
;
7046 attack_exec
= ATTACK_EXEC_ON_GPU
;
7047 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7048 | OPTS_TYPE_PT_ADD80
7049 | OPTS_TYPE_PT_ADDBITS15
;
7050 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7051 dgst_size
= DGST_SIZE_4_5
;
7052 parse_func
= sha1linkedin_parse_hash
;
7053 sort_by_digest
= sort_by_digest_4_5
;
7054 opti_type
= OPTI_TYPE_ZERO_BYTE
7055 | OPTI_TYPE_PRECOMPUTE_INIT
7056 | OPTI_TYPE_EARLY_SKIP
7057 | OPTI_TYPE_NOT_ITERATED
7058 | OPTI_TYPE_NOT_SALTED
;
7065 case 200: hash_type
= HASH_TYPE_MYSQL
;
7066 salt_type
= SALT_TYPE_NONE
;
7067 attack_exec
= ATTACK_EXEC_ON_GPU
;
7069 kern_type
= KERN_TYPE_MYSQL
;
7070 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7071 parse_func
= mysql323_parse_hash
;
7072 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7073 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7080 case 300: hash_type
= HASH_TYPE_SHA1
;
7081 salt_type
= SALT_TYPE_NONE
;
7082 attack_exec
= ATTACK_EXEC_ON_GPU
;
7083 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7084 | OPTS_TYPE_PT_ADD80
7085 | OPTS_TYPE_PT_ADDBITS15
;
7086 kern_type
= KERN_TYPE_MYSQL41
;
7087 dgst_size
= DGST_SIZE_4_5
;
7088 parse_func
= sha1_parse_hash
;
7089 sort_by_digest
= sort_by_digest_4_5
;
7090 opti_type
= OPTI_TYPE_ZERO_BYTE
7091 | OPTI_TYPE_PRECOMPUTE_INIT
7092 | OPTI_TYPE_PRECOMPUTE_MERKLE
7093 | OPTI_TYPE_EARLY_SKIP
7094 | OPTI_TYPE_NOT_ITERATED
7095 | OPTI_TYPE_NOT_SALTED
;
7102 case 400: hash_type
= HASH_TYPE_MD5
;
7103 salt_type
= SALT_TYPE_EMBEDDED
;
7104 attack_exec
= ATTACK_EXEC_ON_CPU
;
7105 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7106 kern_type
= KERN_TYPE_PHPASS
;
7107 dgst_size
= DGST_SIZE_4_4
;
7108 parse_func
= phpass_parse_hash
;
7109 sort_by_digest
= sort_by_digest_4_4
;
7110 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7117 case 500: hash_type
= HASH_TYPE_MD5
;
7118 salt_type
= SALT_TYPE_EMBEDDED
;
7119 attack_exec
= ATTACK_EXEC_ON_CPU
;
7120 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7121 kern_type
= KERN_TYPE_MD5CRYPT
;
7122 dgst_size
= DGST_SIZE_4_4
;
7123 parse_func
= md5crypt_parse_hash
;
7124 sort_by_digest
= sort_by_digest_4_4
;
7125 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7132 case 501: hash_type
= HASH_TYPE_MD5
;
7133 salt_type
= SALT_TYPE_EMBEDDED
;
7134 attack_exec
= ATTACK_EXEC_ON_CPU
;
7135 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7136 | OPTS_TYPE_HASH_COPY
;
7137 kern_type
= KERN_TYPE_MD5CRYPT
;
7138 dgst_size
= DGST_SIZE_4_4
;
7139 parse_func
= juniper_parse_hash
;
7140 sort_by_digest
= sort_by_digest_4_4
;
7141 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7148 case 900: hash_type
= HASH_TYPE_MD4
;
7149 salt_type
= SALT_TYPE_NONE
;
7150 attack_exec
= ATTACK_EXEC_ON_GPU
;
7151 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7152 | OPTS_TYPE_PT_ADD80
7153 | OPTS_TYPE_PT_ADDBITS14
;
7154 kern_type
= KERN_TYPE_MD4
;
7155 dgst_size
= DGST_SIZE_4_4
;
7156 parse_func
= md4_parse_hash
;
7157 sort_by_digest
= sort_by_digest_4_4
;
7158 opti_type
= OPTI_TYPE_ZERO_BYTE
7159 | OPTI_TYPE_PRECOMPUTE_INIT
7160 | OPTI_TYPE_PRECOMPUTE_MERKLE
7161 | OPTI_TYPE_MEET_IN_MIDDLE
7162 | OPTI_TYPE_EARLY_SKIP
7163 | OPTI_TYPE_NOT_ITERATED
7164 | OPTI_TYPE_NOT_SALTED
7165 | OPTI_TYPE_RAW_HASH
;
7172 case 1000: hash_type
= HASH_TYPE_MD4
;
7173 salt_type
= SALT_TYPE_NONE
;
7174 attack_exec
= ATTACK_EXEC_ON_GPU
;
7175 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7176 | OPTS_TYPE_PT_ADD80
7177 | OPTS_TYPE_PT_ADDBITS14
7178 | OPTS_TYPE_PT_UNICODE
;
7179 kern_type
= KERN_TYPE_MD4_PWU
;
7180 dgst_size
= DGST_SIZE_4_4
;
7181 parse_func
= md4_parse_hash
;
7182 sort_by_digest
= sort_by_digest_4_4
;
7183 opti_type
= OPTI_TYPE_ZERO_BYTE
7184 | OPTI_TYPE_PRECOMPUTE_INIT
7185 | OPTI_TYPE_PRECOMPUTE_MERKLE
7186 | OPTI_TYPE_MEET_IN_MIDDLE
7187 | OPTI_TYPE_EARLY_SKIP
7188 | OPTI_TYPE_NOT_ITERATED
7189 | OPTI_TYPE_NOT_SALTED
7190 | OPTI_TYPE_RAW_HASH
;
7197 case 1100: hash_type
= HASH_TYPE_MD4
;
7198 salt_type
= SALT_TYPE_INTERN
;
7199 attack_exec
= ATTACK_EXEC_ON_GPU
;
7200 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7201 | OPTS_TYPE_PT_ADD80
7202 | OPTS_TYPE_PT_ADDBITS14
7203 | OPTS_TYPE_PT_UNICODE
7204 | OPTS_TYPE_ST_ADD80
7205 | OPTS_TYPE_ST_UNICODE
7206 | OPTS_TYPE_ST_LOWER
;
7207 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7208 dgst_size
= DGST_SIZE_4_4
;
7209 parse_func
= dcc_parse_hash
;
7210 sort_by_digest
= sort_by_digest_4_4
;
7211 opti_type
= OPTI_TYPE_ZERO_BYTE
7212 | OPTI_TYPE_PRECOMPUTE_INIT
7213 | OPTI_TYPE_PRECOMPUTE_MERKLE
7214 | OPTI_TYPE_EARLY_SKIP
7215 | OPTI_TYPE_NOT_ITERATED
;
7222 case 1400: hash_type
= HASH_TYPE_SHA256
;
7223 salt_type
= SALT_TYPE_NONE
;
7224 attack_exec
= ATTACK_EXEC_ON_GPU
;
7225 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7226 | OPTS_TYPE_PT_ADD80
7227 | OPTS_TYPE_PT_ADDBITS15
;
7228 kern_type
= KERN_TYPE_SHA256
;
7229 dgst_size
= DGST_SIZE_4_8
;
7230 parse_func
= sha256_parse_hash
;
7231 sort_by_digest
= sort_by_digest_4_8
;
7232 opti_type
= OPTI_TYPE_ZERO_BYTE
7233 | OPTI_TYPE_PRECOMPUTE_INIT
7234 | OPTI_TYPE_PRECOMPUTE_MERKLE
7235 | OPTI_TYPE_EARLY_SKIP
7236 | OPTI_TYPE_NOT_ITERATED
7237 | OPTI_TYPE_NOT_SALTED
7238 | OPTI_TYPE_RAW_HASH
;
7245 case 1410: hash_type
= HASH_TYPE_SHA256
;
7246 salt_type
= SALT_TYPE_INTERN
;
7247 attack_exec
= ATTACK_EXEC_ON_GPU
;
7248 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7249 | OPTS_TYPE_ST_ADD80
7250 | OPTS_TYPE_ST_ADDBITS15
;
7251 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7252 dgst_size
= DGST_SIZE_4_8
;
7253 parse_func
= sha256s_parse_hash
;
7254 sort_by_digest
= sort_by_digest_4_8
;
7255 opti_type
= OPTI_TYPE_ZERO_BYTE
7256 | OPTI_TYPE_PRECOMPUTE_INIT
7257 | OPTI_TYPE_PRECOMPUTE_MERKLE
7258 | OPTI_TYPE_EARLY_SKIP
7259 | OPTI_TYPE_NOT_ITERATED
7260 | OPTI_TYPE_APPENDED_SALT
7261 | OPTI_TYPE_RAW_HASH
;
7268 case 1420: hash_type
= HASH_TYPE_SHA256
;
7269 salt_type
= SALT_TYPE_INTERN
;
7270 attack_exec
= ATTACK_EXEC_ON_GPU
;
7271 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7272 | OPTS_TYPE_PT_ADD80
7273 | OPTS_TYPE_PT_ADDBITS15
;
7274 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7275 dgst_size
= DGST_SIZE_4_8
;
7276 parse_func
= sha256s_parse_hash
;
7277 sort_by_digest
= sort_by_digest_4_8
;
7278 opti_type
= OPTI_TYPE_ZERO_BYTE
7279 | OPTI_TYPE_PRECOMPUTE_INIT
7280 | OPTI_TYPE_PRECOMPUTE_MERKLE
7281 | OPTI_TYPE_EARLY_SKIP
7282 | OPTI_TYPE_NOT_ITERATED
7283 | OPTI_TYPE_PREPENDED_SALT
7284 | OPTI_TYPE_RAW_HASH
;
7291 case 1421: hash_type
= HASH_TYPE_SHA256
;
7292 salt_type
= SALT_TYPE_EMBEDDED
;
7293 attack_exec
= ATTACK_EXEC_ON_GPU
;
7294 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7295 | OPTS_TYPE_PT_ADD80
7296 | OPTS_TYPE_PT_ADDBITS15
;
7297 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7298 dgst_size
= DGST_SIZE_4_8
;
7299 parse_func
= hmailserver_parse_hash
;
7300 sort_by_digest
= sort_by_digest_4_8
;
7301 opti_type
= OPTI_TYPE_ZERO_BYTE
7302 | OPTI_TYPE_PRECOMPUTE_INIT
7303 | OPTI_TYPE_PRECOMPUTE_MERKLE
7304 | OPTI_TYPE_EARLY_SKIP
7305 | OPTI_TYPE_NOT_ITERATED
7306 | OPTI_TYPE_PREPENDED_SALT
7307 | OPTI_TYPE_RAW_HASH
;
7314 case 1430: hash_type
= HASH_TYPE_SHA256
;
7315 salt_type
= SALT_TYPE_INTERN
;
7316 attack_exec
= ATTACK_EXEC_ON_GPU
;
7317 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7318 | OPTS_TYPE_PT_UNICODE
7319 | OPTS_TYPE_ST_ADD80
7320 | OPTS_TYPE_ST_ADDBITS15
;
7321 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7322 dgst_size
= DGST_SIZE_4_8
;
7323 parse_func
= sha256s_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_APPENDED_SALT
7331 | OPTI_TYPE_RAW_HASH
;
7338 case 1440: 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_PT_ADD80
7343 | OPTS_TYPE_PT_ADDBITS15
7344 | OPTS_TYPE_PT_UNICODE
;
7345 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7346 dgst_size
= DGST_SIZE_4_8
;
7347 parse_func
= sha256s_parse_hash
;
7348 sort_by_digest
= sort_by_digest_4_8
;
7349 opti_type
= OPTI_TYPE_ZERO_BYTE
7350 | OPTI_TYPE_PRECOMPUTE_INIT
7351 | OPTI_TYPE_PRECOMPUTE_MERKLE
7352 | OPTI_TYPE_EARLY_SKIP
7353 | OPTI_TYPE_NOT_ITERATED
7354 | OPTI_TYPE_PREPENDED_SALT
7355 | OPTI_TYPE_RAW_HASH
;
7362 case 1441: hash_type
= HASH_TYPE_SHA256
;
7363 salt_type
= SALT_TYPE_EMBEDDED
;
7364 attack_exec
= ATTACK_EXEC_ON_GPU
;
7365 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7366 | OPTS_TYPE_PT_ADD80
7367 | OPTS_TYPE_PT_ADDBITS15
7368 | OPTS_TYPE_PT_UNICODE
7369 | OPTS_TYPE_ST_BASE64
;
7370 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7371 dgst_size
= DGST_SIZE_4_8
;
7372 parse_func
= episerver4_parse_hash
;
7373 sort_by_digest
= sort_by_digest_4_8
;
7374 opti_type
= OPTI_TYPE_ZERO_BYTE
7375 | OPTI_TYPE_PRECOMPUTE_INIT
7376 | OPTI_TYPE_PRECOMPUTE_MERKLE
7377 | OPTI_TYPE_EARLY_SKIP
7378 | OPTI_TYPE_NOT_ITERATED
7379 | OPTI_TYPE_PREPENDED_SALT
7380 | OPTI_TYPE_RAW_HASH
;
7387 case 1450: hash_type
= HASH_TYPE_SHA256
;
7388 salt_type
= SALT_TYPE_INTERN
;
7389 attack_exec
= ATTACK_EXEC_ON_GPU
;
7390 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7391 | OPTS_TYPE_ST_ADD80
;
7392 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7393 dgst_size
= DGST_SIZE_4_8
;
7394 parse_func
= hmacsha256_parse_hash
;
7395 sort_by_digest
= sort_by_digest_4_8
;
7396 opti_type
= OPTI_TYPE_ZERO_BYTE
7397 | OPTI_TYPE_NOT_ITERATED
;
7404 case 1460: hash_type
= HASH_TYPE_SHA256
;
7405 salt_type
= SALT_TYPE_INTERN
;
7406 attack_exec
= ATTACK_EXEC_ON_GPU
;
7407 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7408 | OPTS_TYPE_PT_ADD80
7409 | OPTS_TYPE_PT_ADDBITS15
;
7410 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7411 dgst_size
= DGST_SIZE_4_8
;
7412 parse_func
= hmacsha256_parse_hash
;
7413 sort_by_digest
= sort_by_digest_4_8
;
7414 opti_type
= OPTI_TYPE_ZERO_BYTE
7415 | OPTI_TYPE_NOT_ITERATED
;
7422 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7423 salt_type
= SALT_TYPE_EMBEDDED
;
7424 attack_exec
= ATTACK_EXEC_ON_GPU
;
7425 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7426 | OPTS_TYPE_PT_BITSLICE
;
7427 kern_type
= KERN_TYPE_DESCRYPT
;
7428 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7429 parse_func
= descrypt_parse_hash
;
7430 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7431 opti_type
= OPTI_TYPE_ZERO_BYTE
7432 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7439 case 1600: hash_type
= HASH_TYPE_MD5
;
7440 salt_type
= SALT_TYPE_EMBEDDED
;
7441 attack_exec
= ATTACK_EXEC_ON_CPU
;
7442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7443 kern_type
= KERN_TYPE_APR1CRYPT
;
7444 dgst_size
= DGST_SIZE_4_4
;
7445 parse_func
= md5apr1_parse_hash
;
7446 sort_by_digest
= sort_by_digest_4_4
;
7447 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7454 case 1700: hash_type
= HASH_TYPE_SHA512
;
7455 salt_type
= SALT_TYPE_NONE
;
7456 attack_exec
= ATTACK_EXEC_ON_GPU
;
7457 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7458 | OPTS_TYPE_PT_ADD80
7459 | OPTS_TYPE_PT_ADDBITS15
;
7460 kern_type
= KERN_TYPE_SHA512
;
7461 dgst_size
= DGST_SIZE_8_8
;
7462 parse_func
= sha512_parse_hash
;
7463 sort_by_digest
= sort_by_digest_8_8
;
7464 opti_type
= OPTI_TYPE_ZERO_BYTE
7465 | OPTI_TYPE_PRECOMPUTE_INIT
7466 | OPTI_TYPE_PRECOMPUTE_MERKLE
7467 | OPTI_TYPE_EARLY_SKIP
7468 | OPTI_TYPE_NOT_ITERATED
7469 | OPTI_TYPE_NOT_SALTED
7470 | OPTI_TYPE_RAW_HASH
;
7477 case 1710: hash_type
= HASH_TYPE_SHA512
;
7478 salt_type
= SALT_TYPE_INTERN
;
7479 attack_exec
= ATTACK_EXEC_ON_GPU
;
7480 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7481 | OPTS_TYPE_ST_ADD80
7482 | OPTS_TYPE_ST_ADDBITS15
;
7483 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7484 dgst_size
= DGST_SIZE_8_8
;
7485 parse_func
= sha512s_parse_hash
;
7486 sort_by_digest
= sort_by_digest_8_8
;
7487 opti_type
= OPTI_TYPE_ZERO_BYTE
7488 | OPTI_TYPE_PRECOMPUTE_INIT
7489 | OPTI_TYPE_PRECOMPUTE_MERKLE
7490 | OPTI_TYPE_EARLY_SKIP
7491 | OPTI_TYPE_NOT_ITERATED
7492 | OPTI_TYPE_APPENDED_SALT
7493 | OPTI_TYPE_RAW_HASH
;
7500 case 1711: hash_type
= HASH_TYPE_SHA512
;
7501 salt_type
= SALT_TYPE_EMBEDDED
;
7502 attack_exec
= ATTACK_EXEC_ON_GPU
;
7503 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7504 | OPTS_TYPE_ST_ADD80
7505 | OPTS_TYPE_ST_ADDBITS15
;
7506 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7507 dgst_size
= DGST_SIZE_8_8
;
7508 parse_func
= sha512b64s_parse_hash
;
7509 sort_by_digest
= sort_by_digest_8_8
;
7510 opti_type
= OPTI_TYPE_ZERO_BYTE
7511 | OPTI_TYPE_PRECOMPUTE_INIT
7512 | OPTI_TYPE_PRECOMPUTE_MERKLE
7513 | OPTI_TYPE_EARLY_SKIP
7514 | OPTI_TYPE_NOT_ITERATED
7515 | OPTI_TYPE_APPENDED_SALT
7516 | OPTI_TYPE_RAW_HASH
;
7523 case 1720: hash_type
= HASH_TYPE_SHA512
;
7524 salt_type
= SALT_TYPE_INTERN
;
7525 attack_exec
= ATTACK_EXEC_ON_GPU
;
7526 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7527 | OPTS_TYPE_PT_ADD80
7528 | OPTS_TYPE_PT_ADDBITS15
;
7529 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7530 dgst_size
= DGST_SIZE_8_8
;
7531 parse_func
= sha512s_parse_hash
;
7532 sort_by_digest
= sort_by_digest_8_8
;
7533 opti_type
= OPTI_TYPE_ZERO_BYTE
7534 | OPTI_TYPE_PRECOMPUTE_INIT
7535 | OPTI_TYPE_PRECOMPUTE_MERKLE
7536 | OPTI_TYPE_EARLY_SKIP
7537 | OPTI_TYPE_NOT_ITERATED
7538 | OPTI_TYPE_PREPENDED_SALT
7539 | OPTI_TYPE_RAW_HASH
;
7546 case 1722: hash_type
= HASH_TYPE_SHA512
;
7547 salt_type
= SALT_TYPE_EMBEDDED
;
7548 attack_exec
= ATTACK_EXEC_ON_GPU
;
7549 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7550 | OPTS_TYPE_PT_ADD80
7551 | OPTS_TYPE_PT_ADDBITS15
7553 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7554 dgst_size
= DGST_SIZE_8_8
;
7555 parse_func
= osx512_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_PREPENDED_SALT
7563 | OPTI_TYPE_RAW_HASH
;
7570 case 1730: 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_PT_UNICODE
7575 | OPTS_TYPE_ST_ADD80
7576 | OPTS_TYPE_ST_ADDBITS15
;
7577 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7578 dgst_size
= DGST_SIZE_8_8
;
7579 parse_func
= sha512s_parse_hash
;
7580 sort_by_digest
= sort_by_digest_8_8
;
7581 opti_type
= OPTI_TYPE_ZERO_BYTE
7582 | OPTI_TYPE_PRECOMPUTE_INIT
7583 | OPTI_TYPE_PRECOMPUTE_MERKLE
7584 | OPTI_TYPE_EARLY_SKIP
7585 | OPTI_TYPE_NOT_ITERATED
7586 | OPTI_TYPE_APPENDED_SALT
7587 | OPTI_TYPE_RAW_HASH
;
7594 case 1731: hash_type
= HASH_TYPE_SHA512
;
7595 salt_type
= SALT_TYPE_EMBEDDED
;
7596 attack_exec
= ATTACK_EXEC_ON_GPU
;
7597 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7598 | OPTS_TYPE_PT_UNICODE
7599 | OPTS_TYPE_ST_ADD80
7600 | OPTS_TYPE_ST_ADDBITS15
7602 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7603 dgst_size
= DGST_SIZE_8_8
;
7604 parse_func
= mssql2012_parse_hash
;
7605 sort_by_digest
= sort_by_digest_8_8
;
7606 opti_type
= OPTI_TYPE_ZERO_BYTE
7607 | OPTI_TYPE_PRECOMPUTE_INIT
7608 | OPTI_TYPE_PRECOMPUTE_MERKLE
7609 | OPTI_TYPE_EARLY_SKIP
7610 | OPTI_TYPE_NOT_ITERATED
7611 | OPTI_TYPE_APPENDED_SALT
7612 | OPTI_TYPE_RAW_HASH
;
7619 case 1740: hash_type
= HASH_TYPE_SHA512
;
7620 salt_type
= SALT_TYPE_INTERN
;
7621 attack_exec
= ATTACK_EXEC_ON_GPU
;
7622 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7623 | OPTS_TYPE_PT_ADD80
7624 | OPTS_TYPE_PT_ADDBITS15
7625 | OPTS_TYPE_PT_UNICODE
;
7626 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7627 dgst_size
= DGST_SIZE_8_8
;
7628 parse_func
= sha512s_parse_hash
;
7629 sort_by_digest
= sort_by_digest_8_8
;
7630 opti_type
= OPTI_TYPE_ZERO_BYTE
7631 | OPTI_TYPE_PRECOMPUTE_INIT
7632 | OPTI_TYPE_PRECOMPUTE_MERKLE
7633 | OPTI_TYPE_EARLY_SKIP
7634 | OPTI_TYPE_NOT_ITERATED
7635 | OPTI_TYPE_PREPENDED_SALT
7636 | OPTI_TYPE_RAW_HASH
;
7643 case 1750: hash_type
= HASH_TYPE_SHA512
;
7644 salt_type
= SALT_TYPE_INTERN
;
7645 attack_exec
= ATTACK_EXEC_ON_GPU
;
7646 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7647 | OPTS_TYPE_ST_ADD80
;
7648 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7649 dgst_size
= DGST_SIZE_8_8
;
7650 parse_func
= hmacsha512_parse_hash
;
7651 sort_by_digest
= sort_by_digest_8_8
;
7652 opti_type
= OPTI_TYPE_ZERO_BYTE
7653 | OPTI_TYPE_NOT_ITERATED
;
7660 case 1760: hash_type
= HASH_TYPE_SHA512
;
7661 salt_type
= SALT_TYPE_INTERN
;
7662 attack_exec
= ATTACK_EXEC_ON_GPU
;
7663 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7664 | OPTS_TYPE_PT_ADD80
7665 | OPTS_TYPE_PT_ADDBITS15
;
7666 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7667 dgst_size
= DGST_SIZE_8_8
;
7668 parse_func
= hmacsha512_parse_hash
;
7669 sort_by_digest
= sort_by_digest_8_8
;
7670 opti_type
= OPTI_TYPE_ZERO_BYTE
7671 | OPTI_TYPE_NOT_ITERATED
;
7678 case 1800: hash_type
= HASH_TYPE_SHA512
;
7679 salt_type
= SALT_TYPE_EMBEDDED
;
7680 attack_exec
= ATTACK_EXEC_ON_CPU
;
7681 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7682 kern_type
= KERN_TYPE_SHA512CRYPT
;
7683 dgst_size
= DGST_SIZE_8_8
;
7684 parse_func
= sha512crypt_parse_hash
;
7685 sort_by_digest
= sort_by_digest_8_8
;
7686 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7693 case 2100: hash_type
= HASH_TYPE_DCC2
;
7694 salt_type
= SALT_TYPE_EMBEDDED
;
7695 attack_exec
= ATTACK_EXEC_ON_CPU
;
7696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7697 | OPTS_TYPE_ST_LOWER
7698 | OPTS_TYPE_ST_UNICODE
;
7699 kern_type
= KERN_TYPE_DCC2
;
7700 dgst_size
= DGST_SIZE_4_4
;
7701 parse_func
= dcc2_parse_hash
;
7702 sort_by_digest
= sort_by_digest_4_4
;
7703 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7710 case 2400: hash_type
= HASH_TYPE_MD5
;
7711 salt_type
= SALT_TYPE_NONE
;
7712 attack_exec
= ATTACK_EXEC_ON_GPU
;
7713 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7714 kern_type
= KERN_TYPE_MD5PIX
;
7715 dgst_size
= DGST_SIZE_4_4
;
7716 parse_func
= md5pix_parse_hash
;
7717 sort_by_digest
= sort_by_digest_4_4
;
7718 opti_type
= OPTI_TYPE_ZERO_BYTE
7719 | OPTI_TYPE_PRECOMPUTE_INIT
7720 | OPTI_TYPE_PRECOMPUTE_MERKLE
7721 | OPTI_TYPE_EARLY_SKIP
7722 | OPTI_TYPE_NOT_ITERATED
7723 | OPTI_TYPE_NOT_SALTED
;
7730 case 2410: hash_type
= HASH_TYPE_MD5
;
7731 salt_type
= SALT_TYPE_INTERN
;
7732 attack_exec
= ATTACK_EXEC_ON_GPU
;
7733 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7734 kern_type
= KERN_TYPE_MD5ASA
;
7735 dgst_size
= DGST_SIZE_4_4
;
7736 parse_func
= md5asa_parse_hash
;
7737 sort_by_digest
= sort_by_digest_4_4
;
7738 opti_type
= OPTI_TYPE_ZERO_BYTE
7739 | OPTI_TYPE_PRECOMPUTE_INIT
7740 | OPTI_TYPE_PRECOMPUTE_MERKLE
7741 | OPTI_TYPE_EARLY_SKIP
7742 | OPTI_TYPE_NOT_ITERATED
;
7749 case 2500: hash_type
= HASH_TYPE_WPA
;
7750 salt_type
= SALT_TYPE_EMBEDDED
;
7751 attack_exec
= ATTACK_EXEC_ON_CPU
;
7752 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7753 kern_type
= KERN_TYPE_WPA
;
7754 dgst_size
= DGST_SIZE_4_4
;
7755 parse_func
= wpa_parse_hash
;
7756 sort_by_digest
= sort_by_digest_4_4
;
7757 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7764 case 2600: hash_type
= HASH_TYPE_MD5
;
7765 salt_type
= SALT_TYPE_VIRTUAL
;
7766 attack_exec
= ATTACK_EXEC_ON_GPU
;
7767 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7768 | OPTS_TYPE_PT_ADD80
7769 | OPTS_TYPE_PT_ADDBITS14
7770 | OPTS_TYPE_ST_ADD80
;
7771 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7772 dgst_size
= DGST_SIZE_4_4
;
7773 parse_func
= md5md5_parse_hash
;
7774 sort_by_digest
= sort_by_digest_4_4
;
7775 opti_type
= OPTI_TYPE_ZERO_BYTE
7776 | OPTI_TYPE_PRECOMPUTE_INIT
7777 | OPTI_TYPE_PRECOMPUTE_MERKLE
7778 | OPTI_TYPE_EARLY_SKIP
;
7785 case 2611: hash_type
= HASH_TYPE_MD5
;
7786 salt_type
= SALT_TYPE_INTERN
;
7787 attack_exec
= ATTACK_EXEC_ON_GPU
;
7788 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7789 | OPTS_TYPE_PT_ADD80
7790 | OPTS_TYPE_PT_ADDBITS14
7791 | OPTS_TYPE_ST_ADD80
;
7792 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7793 dgst_size
= DGST_SIZE_4_4
;
7794 parse_func
= vb3_parse_hash
;
7795 sort_by_digest
= sort_by_digest_4_4
;
7796 opti_type
= OPTI_TYPE_ZERO_BYTE
7797 | OPTI_TYPE_PRECOMPUTE_INIT
7798 | OPTI_TYPE_PRECOMPUTE_MERKLE
7799 | OPTI_TYPE_EARLY_SKIP
;
7806 case 2612: hash_type
= HASH_TYPE_MD5
;
7807 salt_type
= SALT_TYPE_EMBEDDED
;
7808 attack_exec
= ATTACK_EXEC_ON_GPU
;
7809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7810 | OPTS_TYPE_PT_ADD80
7811 | OPTS_TYPE_PT_ADDBITS14
7812 | OPTS_TYPE_ST_ADD80
7814 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7815 dgst_size
= DGST_SIZE_4_4
;
7816 parse_func
= phps_parse_hash
;
7817 sort_by_digest
= sort_by_digest_4_4
;
7818 opti_type
= OPTI_TYPE_ZERO_BYTE
7819 | OPTI_TYPE_PRECOMPUTE_INIT
7820 | OPTI_TYPE_PRECOMPUTE_MERKLE
7821 | OPTI_TYPE_EARLY_SKIP
;
7828 case 2711: hash_type
= HASH_TYPE_MD5
;
7829 salt_type
= SALT_TYPE_INTERN
;
7830 attack_exec
= ATTACK_EXEC_ON_GPU
;
7831 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7832 | OPTS_TYPE_PT_ADD80
7833 | OPTS_TYPE_PT_ADDBITS14
7834 | OPTS_TYPE_ST_ADD80
;
7835 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7836 dgst_size
= DGST_SIZE_4_4
;
7837 parse_func
= vb30_parse_hash
;
7838 sort_by_digest
= sort_by_digest_4_4
;
7839 opti_type
= OPTI_TYPE_ZERO_BYTE
7840 | OPTI_TYPE_PRECOMPUTE_INIT
7841 | OPTI_TYPE_EARLY_SKIP
;
7848 case 2811: hash_type
= HASH_TYPE_MD5
;
7849 salt_type
= SALT_TYPE_INTERN
;
7850 attack_exec
= ATTACK_EXEC_ON_GPU
;
7851 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7852 | OPTS_TYPE_PT_ADD80
7853 | OPTS_TYPE_PT_ADDBITS14
;
7854 kern_type
= KERN_TYPE_MD55_SLTPW
;
7855 dgst_size
= DGST_SIZE_4_4
;
7856 parse_func
= ipb2_parse_hash
;
7857 sort_by_digest
= sort_by_digest_4_4
;
7858 opti_type
= OPTI_TYPE_ZERO_BYTE
7859 | OPTI_TYPE_PRECOMPUTE_INIT
7860 | OPTI_TYPE_EARLY_SKIP
;
7867 case 3000: hash_type
= HASH_TYPE_LM
;
7868 salt_type
= SALT_TYPE_NONE
;
7869 attack_exec
= ATTACK_EXEC_ON_GPU
;
7870 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7871 | OPTS_TYPE_PT_UPPER
7872 | OPTS_TYPE_PT_BITSLICE
;
7873 kern_type
= KERN_TYPE_LM
;
7874 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7875 parse_func
= lm_parse_hash
;
7876 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7877 opti_type
= OPTI_TYPE_ZERO_BYTE
7878 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7885 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7886 salt_type
= SALT_TYPE_INTERN
;
7887 attack_exec
= ATTACK_EXEC_ON_GPU
;
7888 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7889 | OPTS_TYPE_PT_UPPER
7890 | OPTS_TYPE_ST_UPPER
;
7891 kern_type
= KERN_TYPE_ORACLEH
;
7892 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7893 parse_func
= oracleh_parse_hash
;
7894 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7895 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7902 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7903 salt_type
= SALT_TYPE_EMBEDDED
;
7904 attack_exec
= ATTACK_EXEC_ON_CPU
;
7905 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7906 | OPTS_TYPE_ST_GENERATE_LE
;
7907 kern_type
= KERN_TYPE_BCRYPT
;
7908 dgst_size
= DGST_SIZE_4_6
;
7909 parse_func
= bcrypt_parse_hash
;
7910 sort_by_digest
= sort_by_digest_4_6
;
7911 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7918 case 3710: hash_type
= HASH_TYPE_MD5
;
7919 salt_type
= SALT_TYPE_INTERN
;
7920 attack_exec
= ATTACK_EXEC_ON_GPU
;
7921 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7922 | OPTS_TYPE_PT_ADD80
7923 | OPTS_TYPE_PT_ADDBITS14
;
7924 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7925 dgst_size
= DGST_SIZE_4_4
;
7926 parse_func
= md5s_parse_hash
;
7927 sort_by_digest
= sort_by_digest_4_4
;
7928 opti_type
= OPTI_TYPE_ZERO_BYTE
7929 | OPTI_TYPE_PRECOMPUTE_INIT
7930 | OPTI_TYPE_PRECOMPUTE_MERKLE
7931 | OPTI_TYPE_EARLY_SKIP
;
7938 case 3711: hash_type
= HASH_TYPE_MD5
;
7939 salt_type
= SALT_TYPE_EMBEDDED
;
7940 attack_exec
= ATTACK_EXEC_ON_GPU
;
7941 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7942 | OPTS_TYPE_PT_ADD80
7943 | OPTS_TYPE_PT_ADDBITS14
;
7944 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7945 dgst_size
= DGST_SIZE_4_4
;
7946 parse_func
= mediawiki_b_parse_hash
;
7947 sort_by_digest
= sort_by_digest_4_4
;
7948 opti_type
= OPTI_TYPE_ZERO_BYTE
7949 | OPTI_TYPE_PRECOMPUTE_INIT
7950 | OPTI_TYPE_PRECOMPUTE_MERKLE
7951 | OPTI_TYPE_EARLY_SKIP
;
7958 case 3800: hash_type
= HASH_TYPE_MD5
;
7959 salt_type
= SALT_TYPE_INTERN
;
7960 attack_exec
= ATTACK_EXEC_ON_GPU
;
7961 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7962 | OPTS_TYPE_ST_ADDBITS14
;
7963 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
7964 dgst_size
= DGST_SIZE_4_4
;
7965 parse_func
= md5s_parse_hash
;
7966 sort_by_digest
= sort_by_digest_4_4
;
7967 opti_type
= OPTI_TYPE_ZERO_BYTE
7968 | OPTI_TYPE_PRECOMPUTE_INIT
7969 | OPTI_TYPE_PRECOMPUTE_MERKLE
7970 | OPTI_TYPE_EARLY_SKIP
7971 | OPTI_TYPE_NOT_ITERATED
7972 | OPTI_TYPE_RAW_HASH
;
7979 case 4300: hash_type
= HASH_TYPE_MD5
;
7980 salt_type
= SALT_TYPE_VIRTUAL
;
7981 attack_exec
= ATTACK_EXEC_ON_GPU
;
7982 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7983 | OPTS_TYPE_PT_ADD80
7984 | OPTS_TYPE_PT_ADDBITS14
7985 | OPTS_TYPE_ST_ADD80
;
7986 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
7987 dgst_size
= DGST_SIZE_4_4
;
7988 parse_func
= md5md5_parse_hash
;
7989 sort_by_digest
= sort_by_digest_4_4
;
7990 opti_type
= OPTI_TYPE_ZERO_BYTE
7991 | OPTI_TYPE_PRECOMPUTE_INIT
7992 | OPTI_TYPE_PRECOMPUTE_MERKLE
7993 | OPTI_TYPE_EARLY_SKIP
;
8001 case 4400: hash_type
= HASH_TYPE_MD5
;
8002 salt_type
= SALT_TYPE_NONE
;
8003 attack_exec
= ATTACK_EXEC_ON_GPU
;
8004 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8005 | OPTS_TYPE_PT_ADD80
8006 | OPTS_TYPE_PT_ADDBITS15
;
8007 kern_type
= KERN_TYPE_MD5_SHA1
;
8008 dgst_size
= DGST_SIZE_4_4
;
8009 parse_func
= md5_parse_hash
;
8010 sort_by_digest
= sort_by_digest_4_4
;
8011 opti_type
= OPTI_TYPE_ZERO_BYTE
8012 | OPTI_TYPE_PRECOMPUTE_INIT
8013 | OPTI_TYPE_PRECOMPUTE_MERKLE
8014 | OPTI_TYPE_EARLY_SKIP
8015 | OPTI_TYPE_NOT_ITERATED
8016 | OPTI_TYPE_NOT_SALTED
8017 | OPTI_TYPE_RAW_HASH
;
8024 case 4500: hash_type
= HASH_TYPE_SHA1
;
8025 salt_type
= SALT_TYPE_NONE
;
8026 attack_exec
= ATTACK_EXEC_ON_GPU
;
8027 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8028 | OPTS_TYPE_PT_ADD80
8029 | OPTS_TYPE_PT_ADDBITS15
;
8030 kern_type
= KERN_TYPE_SHA11
;
8031 dgst_size
= DGST_SIZE_4_5
;
8032 parse_func
= sha1_parse_hash
;
8033 sort_by_digest
= sort_by_digest_4_5
;
8034 opti_type
= OPTI_TYPE_ZERO_BYTE
8035 | OPTI_TYPE_PRECOMPUTE_INIT
8036 | OPTI_TYPE_PRECOMPUTE_MERKLE
8037 | OPTI_TYPE_EARLY_SKIP
8038 | OPTI_TYPE_NOT_SALTED
;
8045 case 4700: hash_type
= HASH_TYPE_SHA1
;
8046 salt_type
= SALT_TYPE_NONE
;
8047 attack_exec
= ATTACK_EXEC_ON_GPU
;
8048 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8049 | OPTS_TYPE_PT_ADD80
8050 | OPTS_TYPE_PT_ADDBITS14
;
8051 kern_type
= KERN_TYPE_SHA1_MD5
;
8052 dgst_size
= DGST_SIZE_4_5
;
8053 parse_func
= sha1_parse_hash
;
8054 sort_by_digest
= sort_by_digest_4_5
;
8055 opti_type
= OPTI_TYPE_ZERO_BYTE
8056 | OPTI_TYPE_PRECOMPUTE_INIT
8057 | OPTI_TYPE_PRECOMPUTE_MERKLE
8058 | OPTI_TYPE_EARLY_SKIP
8059 | OPTI_TYPE_NOT_ITERATED
8060 | OPTI_TYPE_NOT_SALTED
8061 | OPTI_TYPE_RAW_HASH
;
8068 case 4800: hash_type
= HASH_TYPE_MD5
;
8069 salt_type
= SALT_TYPE_EMBEDDED
;
8070 attack_exec
= ATTACK_EXEC_ON_GPU
;
8071 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8072 | OPTS_TYPE_PT_ADDBITS14
;
8073 kern_type
= KERN_TYPE_MD5_CHAP
;
8074 dgst_size
= DGST_SIZE_4_4
;
8075 parse_func
= chap_parse_hash
;
8076 sort_by_digest
= sort_by_digest_4_4
;
8077 opti_type
= OPTI_TYPE_ZERO_BYTE
8078 | OPTI_TYPE_PRECOMPUTE_INIT
8079 | OPTI_TYPE_PRECOMPUTE_MERKLE
8080 | OPTI_TYPE_MEET_IN_MIDDLE
8081 | OPTI_TYPE_EARLY_SKIP
8082 | OPTI_TYPE_NOT_ITERATED
8083 | OPTI_TYPE_RAW_HASH
;
8090 case 4900: hash_type
= HASH_TYPE_SHA1
;
8091 salt_type
= SALT_TYPE_INTERN
;
8092 attack_exec
= ATTACK_EXEC_ON_GPU
;
8093 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8094 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8095 dgst_size
= DGST_SIZE_4_5
;
8096 parse_func
= sha1s_parse_hash
;
8097 sort_by_digest
= sort_by_digest_4_5
;
8098 opti_type
= OPTI_TYPE_ZERO_BYTE
8099 | OPTI_TYPE_PRECOMPUTE_INIT
8100 | OPTI_TYPE_PRECOMPUTE_MERKLE
8101 | OPTI_TYPE_EARLY_SKIP
;
8108 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8109 salt_type
= SALT_TYPE_EMBEDDED
;
8110 attack_exec
= ATTACK_EXEC_ON_GPU
;
8111 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8112 | OPTS_TYPE_PT_ADD01
;
8113 kern_type
= KERN_TYPE_KECCAK
;
8114 dgst_size
= DGST_SIZE_8_25
;
8115 parse_func
= keccak_parse_hash
;
8116 sort_by_digest
= sort_by_digest_8_25
;
8117 opti_type
= OPTI_TYPE_ZERO_BYTE
8118 | OPTI_TYPE_RAW_HASH
;
8125 case 5100: hash_type
= HASH_TYPE_MD5H
;
8126 salt_type
= SALT_TYPE_NONE
;
8127 attack_exec
= ATTACK_EXEC_ON_GPU
;
8128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8129 | OPTS_TYPE_PT_ADD80
8130 | OPTS_TYPE_PT_ADDBITS14
;
8131 kern_type
= KERN_TYPE_MD5H
;
8132 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8133 parse_func
= md5half_parse_hash
;
8134 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8135 opti_type
= OPTI_TYPE_ZERO_BYTE
8136 | OPTI_TYPE_RAW_HASH
;
8143 case 5200: hash_type
= HASH_TYPE_SHA256
;
8144 salt_type
= SALT_TYPE_EMBEDDED
;
8145 attack_exec
= ATTACK_EXEC_ON_CPU
;
8146 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8147 kern_type
= KERN_TYPE_PSAFE3
;
8148 dgst_size
= DGST_SIZE_4_8
;
8149 parse_func
= psafe3_parse_hash
;
8150 sort_by_digest
= sort_by_digest_4_8
;
8151 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8158 case 5300: hash_type
= HASH_TYPE_MD5
;
8159 salt_type
= SALT_TYPE_EMBEDDED
;
8160 attack_exec
= ATTACK_EXEC_ON_GPU
;
8161 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8162 | OPTS_TYPE_ST_ADD80
;
8163 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8164 dgst_size
= DGST_SIZE_4_4
;
8165 parse_func
= ikepsk_md5_parse_hash
;
8166 sort_by_digest
= sort_by_digest_4_4
;
8167 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8174 case 5400: hash_type
= HASH_TYPE_SHA1
;
8175 salt_type
= SALT_TYPE_EMBEDDED
;
8176 attack_exec
= ATTACK_EXEC_ON_GPU
;
8177 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8178 | OPTS_TYPE_ST_ADD80
;
8179 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8180 dgst_size
= DGST_SIZE_4_5
;
8181 parse_func
= ikepsk_sha1_parse_hash
;
8182 sort_by_digest
= sort_by_digest_4_5
;
8183 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8190 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8191 salt_type
= SALT_TYPE_EMBEDDED
;
8192 attack_exec
= ATTACK_EXEC_ON_GPU
;
8193 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8194 | OPTS_TYPE_PT_ADD80
8195 | OPTS_TYPE_PT_ADDBITS14
8196 | OPTS_TYPE_PT_UNICODE
8198 kern_type
= KERN_TYPE_NETNTLMv1
;
8199 dgst_size
= DGST_SIZE_4_4
;
8200 parse_func
= netntlmv1_parse_hash
;
8201 sort_by_digest
= sort_by_digest_4_4
;
8202 opti_type
= OPTI_TYPE_ZERO_BYTE
8203 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8210 case 5600: hash_type
= HASH_TYPE_MD5
;
8211 salt_type
= SALT_TYPE_EMBEDDED
;
8212 attack_exec
= ATTACK_EXEC_ON_GPU
;
8213 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8214 | OPTS_TYPE_PT_ADD80
8215 | OPTS_TYPE_PT_ADDBITS14
8216 | OPTS_TYPE_PT_UNICODE
;
8217 kern_type
= KERN_TYPE_NETNTLMv2
;
8218 dgst_size
= DGST_SIZE_4_4
;
8219 parse_func
= netntlmv2_parse_hash
;
8220 sort_by_digest
= sort_by_digest_4_4
;
8221 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8228 case 5700: hash_type
= HASH_TYPE_SHA256
;
8229 salt_type
= SALT_TYPE_NONE
;
8230 attack_exec
= ATTACK_EXEC_ON_GPU
;
8231 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8232 | OPTS_TYPE_PT_ADD80
8233 | OPTS_TYPE_PT_ADDBITS15
;
8234 kern_type
= KERN_TYPE_SHA256
;
8235 dgst_size
= DGST_SIZE_4_8
;
8236 parse_func
= cisco4_parse_hash
;
8237 sort_by_digest
= sort_by_digest_4_8
;
8238 opti_type
= OPTI_TYPE_ZERO_BYTE
8239 | OPTI_TYPE_PRECOMPUTE_INIT
8240 | OPTI_TYPE_PRECOMPUTE_MERKLE
8241 | OPTI_TYPE_EARLY_SKIP
8242 | OPTI_TYPE_NOT_ITERATED
8243 | OPTI_TYPE_NOT_SALTED
8244 | OPTI_TYPE_RAW_HASH
;
8251 case 5800: hash_type
= HASH_TYPE_SHA1
;
8252 salt_type
= SALT_TYPE_INTERN
;
8253 attack_exec
= ATTACK_EXEC_ON_CPU
;
8254 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8255 | OPTS_TYPE_ST_ADD80
;
8256 kern_type
= KERN_TYPE_ANDROIDPIN
;
8257 dgst_size
= DGST_SIZE_4_5
;
8258 parse_func
= androidpin_parse_hash
;
8259 sort_by_digest
= sort_by_digest_4_5
;
8260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8267 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8268 salt_type
= SALT_TYPE_NONE
;
8269 attack_exec
= ATTACK_EXEC_ON_GPU
;
8270 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8271 | OPTS_TYPE_PT_ADD80
;
8272 kern_type
= KERN_TYPE_RIPEMD160
;
8273 dgst_size
= DGST_SIZE_4_5
;
8274 parse_func
= ripemd160_parse_hash
;
8275 sort_by_digest
= sort_by_digest_4_5
;
8276 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8283 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8284 salt_type
= SALT_TYPE_NONE
;
8285 attack_exec
= ATTACK_EXEC_ON_GPU
;
8286 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8287 | OPTS_TYPE_PT_ADD80
;
8288 kern_type
= KERN_TYPE_WHIRLPOOL
;
8289 dgst_size
= DGST_SIZE_4_16
;
8290 parse_func
= whirlpool_parse_hash
;
8291 sort_by_digest
= sort_by_digest_4_16
;
8292 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8299 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8300 salt_type
= SALT_TYPE_EMBEDDED
;
8301 attack_exec
= ATTACK_EXEC_ON_CPU
;
8302 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8303 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8304 dgst_size
= DGST_SIZE_4_5
;
8305 parse_func
= truecrypt_parse_hash_2k
;
8306 sort_by_digest
= sort_by_digest_4_5
;
8307 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8314 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8315 salt_type
= SALT_TYPE_EMBEDDED
;
8316 attack_exec
= ATTACK_EXEC_ON_CPU
;
8317 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8318 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8319 dgst_size
= DGST_SIZE_4_5
;
8320 parse_func
= truecrypt_parse_hash_2k
;
8321 sort_by_digest
= sort_by_digest_4_5
;
8322 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8329 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8330 salt_type
= SALT_TYPE_EMBEDDED
;
8331 attack_exec
= ATTACK_EXEC_ON_CPU
;
8332 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8333 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8334 dgst_size
= DGST_SIZE_4_5
;
8335 parse_func
= truecrypt_parse_hash_2k
;
8336 sort_by_digest
= sort_by_digest_4_5
;
8337 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8344 case 6221: hash_type
= HASH_TYPE_SHA512
;
8345 salt_type
= SALT_TYPE_EMBEDDED
;
8346 attack_exec
= ATTACK_EXEC_ON_CPU
;
8347 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8348 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8349 dgst_size
= DGST_SIZE_8_8
;
8350 parse_func
= truecrypt_parse_hash_1k
;
8351 sort_by_digest
= sort_by_digest_8_8
;
8352 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8359 case 6222: hash_type
= HASH_TYPE_SHA512
;
8360 salt_type
= SALT_TYPE_EMBEDDED
;
8361 attack_exec
= ATTACK_EXEC_ON_CPU
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8363 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8364 dgst_size
= DGST_SIZE_8_8
;
8365 parse_func
= truecrypt_parse_hash_1k
;
8366 sort_by_digest
= sort_by_digest_8_8
;
8367 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8374 case 6223: hash_type
= HASH_TYPE_SHA512
;
8375 salt_type
= SALT_TYPE_EMBEDDED
;
8376 attack_exec
= ATTACK_EXEC_ON_CPU
;
8377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8378 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8379 dgst_size
= DGST_SIZE_8_8
;
8380 parse_func
= truecrypt_parse_hash_1k
;
8381 sort_by_digest
= sort_by_digest_8_8
;
8382 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8389 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8390 salt_type
= SALT_TYPE_EMBEDDED
;
8391 attack_exec
= ATTACK_EXEC_ON_CPU
;
8392 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8393 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8394 dgst_size
= DGST_SIZE_4_8
;
8395 parse_func
= truecrypt_parse_hash_1k
;
8396 sort_by_digest
= sort_by_digest_4_8
;
8397 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8404 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8405 salt_type
= SALT_TYPE_EMBEDDED
;
8406 attack_exec
= ATTACK_EXEC_ON_CPU
;
8407 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8408 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8409 dgst_size
= DGST_SIZE_4_8
;
8410 parse_func
= truecrypt_parse_hash_1k
;
8411 sort_by_digest
= sort_by_digest_4_8
;
8412 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8419 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8420 salt_type
= SALT_TYPE_EMBEDDED
;
8421 attack_exec
= ATTACK_EXEC_ON_CPU
;
8422 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8423 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8424 dgst_size
= DGST_SIZE_4_8
;
8425 parse_func
= truecrypt_parse_hash_1k
;
8426 sort_by_digest
= sort_by_digest_4_8
;
8427 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8434 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8435 salt_type
= SALT_TYPE_EMBEDDED
;
8436 attack_exec
= ATTACK_EXEC_ON_CPU
;
8437 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8438 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8439 dgst_size
= DGST_SIZE_4_5
;
8440 parse_func
= truecrypt_parse_hash_1k
;
8441 sort_by_digest
= sort_by_digest_4_5
;
8442 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8449 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8450 salt_type
= SALT_TYPE_EMBEDDED
;
8451 attack_exec
= ATTACK_EXEC_ON_CPU
;
8452 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8453 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8454 dgst_size
= DGST_SIZE_4_5
;
8455 parse_func
= truecrypt_parse_hash_1k
;
8456 sort_by_digest
= sort_by_digest_4_5
;
8457 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8464 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8465 salt_type
= SALT_TYPE_EMBEDDED
;
8466 attack_exec
= ATTACK_EXEC_ON_CPU
;
8467 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8468 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8469 dgst_size
= DGST_SIZE_4_5
;
8470 parse_func
= truecrypt_parse_hash_1k
;
8471 sort_by_digest
= sort_by_digest_4_5
;
8472 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8479 case 6300: hash_type
= HASH_TYPE_MD5
;
8480 salt_type
= SALT_TYPE_EMBEDDED
;
8481 attack_exec
= ATTACK_EXEC_ON_CPU
;
8482 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8483 kern_type
= KERN_TYPE_MD5AIX
;
8484 dgst_size
= DGST_SIZE_4_4
;
8485 parse_func
= md5aix_parse_hash
;
8486 sort_by_digest
= sort_by_digest_4_4
;
8487 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8494 case 6400: hash_type
= HASH_TYPE_SHA256
;
8495 salt_type
= SALT_TYPE_EMBEDDED
;
8496 attack_exec
= ATTACK_EXEC_ON_CPU
;
8497 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8498 kern_type
= KERN_TYPE_SHA256AIX
;
8499 dgst_size
= DGST_SIZE_4_8
;
8500 parse_func
= sha256aix_parse_hash
;
8501 sort_by_digest
= sort_by_digest_4_8
;
8502 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8509 case 6500: hash_type
= HASH_TYPE_SHA512
;
8510 salt_type
= SALT_TYPE_EMBEDDED
;
8511 attack_exec
= ATTACK_EXEC_ON_CPU
;
8512 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8513 kern_type
= KERN_TYPE_SHA512AIX
;
8514 dgst_size
= DGST_SIZE_8_8
;
8515 parse_func
= sha512aix_parse_hash
;
8516 sort_by_digest
= sort_by_digest_8_8
;
8517 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8524 case 6600: hash_type
= HASH_TYPE_AES
;
8525 salt_type
= SALT_TYPE_EMBEDDED
;
8526 attack_exec
= ATTACK_EXEC_ON_CPU
;
8527 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8528 kern_type
= KERN_TYPE_AGILEKEY
;
8529 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8530 parse_func
= agilekey_parse_hash
;
8531 sort_by_digest
= sort_by_digest_4_5
;
8532 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8539 case 6700: hash_type
= HASH_TYPE_SHA1
;
8540 salt_type
= SALT_TYPE_EMBEDDED
;
8541 attack_exec
= ATTACK_EXEC_ON_CPU
;
8542 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8543 kern_type
= KERN_TYPE_SHA1AIX
;
8544 dgst_size
= DGST_SIZE_4_5
;
8545 parse_func
= sha1aix_parse_hash
;
8546 sort_by_digest
= sort_by_digest_4_5
;
8547 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8554 case 6800: hash_type
= HASH_TYPE_AES
;
8555 salt_type
= SALT_TYPE_EMBEDDED
;
8556 attack_exec
= ATTACK_EXEC_ON_CPU
;
8557 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8558 kern_type
= KERN_TYPE_LASTPASS
;
8559 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8560 parse_func
= lastpass_parse_hash
;
8561 sort_by_digest
= sort_by_digest_4_8
;
8562 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8569 case 6900: hash_type
= HASH_TYPE_GOST
;
8570 salt_type
= SALT_TYPE_NONE
;
8571 attack_exec
= ATTACK_EXEC_ON_GPU
;
8572 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8573 kern_type
= KERN_TYPE_GOST
;
8574 dgst_size
= DGST_SIZE_4_8
;
8575 parse_func
= gost_parse_hash
;
8576 sort_by_digest
= sort_by_digest_4_8
;
8577 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8584 case 7100: hash_type
= HASH_TYPE_SHA512
;
8585 salt_type
= SALT_TYPE_EMBEDDED
;
8586 attack_exec
= ATTACK_EXEC_ON_CPU
;
8587 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8588 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8589 dgst_size
= DGST_SIZE_8_16
;
8590 parse_func
= sha512osx_parse_hash
;
8591 sort_by_digest
= sort_by_digest_8_16
;
8592 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8599 case 7200: hash_type
= HASH_TYPE_SHA512
;
8600 salt_type
= SALT_TYPE_EMBEDDED
;
8601 attack_exec
= ATTACK_EXEC_ON_CPU
;
8602 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8603 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8604 dgst_size
= DGST_SIZE_8_16
;
8605 parse_func
= sha512grub_parse_hash
;
8606 sort_by_digest
= sort_by_digest_8_16
;
8607 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8614 case 7300: hash_type
= HASH_TYPE_SHA1
;
8615 salt_type
= SALT_TYPE_EMBEDDED
;
8616 attack_exec
= ATTACK_EXEC_ON_GPU
;
8617 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8618 | OPTS_TYPE_ST_ADD80
8619 | OPTS_TYPE_ST_ADDBITS15
;
8620 kern_type
= KERN_TYPE_RAKP
;
8621 dgst_size
= DGST_SIZE_4_5
;
8622 parse_func
= rakp_parse_hash
;
8623 sort_by_digest
= sort_by_digest_4_5
;
8624 opti_type
= OPTI_TYPE_ZERO_BYTE
8625 | OPTI_TYPE_NOT_ITERATED
;
8632 case 7400: hash_type
= HASH_TYPE_SHA256
;
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_SHA256CRYPT
;
8637 dgst_size
= DGST_SIZE_4_8
;
8638 parse_func
= sha256crypt_parse_hash
;
8639 sort_by_digest
= sort_by_digest_4_8
;
8640 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8647 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8648 salt_type
= SALT_TYPE_EMBEDDED
;
8649 attack_exec
= ATTACK_EXEC_ON_GPU
;
8650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8651 kern_type
= KERN_TYPE_KRB5PA
;
8652 dgst_size
= DGST_SIZE_4_4
;
8653 parse_func
= krb5pa_parse_hash
;
8654 sort_by_digest
= sort_by_digest_4_4
;
8655 opti_type
= OPTI_TYPE_ZERO_BYTE
8656 | OPTI_TYPE_NOT_ITERATED
;
8663 case 7600: hash_type
= HASH_TYPE_SHA1
;
8664 salt_type
= SALT_TYPE_INTERN
;
8665 attack_exec
= ATTACK_EXEC_ON_GPU
;
8666 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8667 | OPTS_TYPE_PT_ADD80
8668 | OPTS_TYPE_PT_ADDBITS15
;
8669 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8670 dgst_size
= DGST_SIZE_4_5
;
8671 parse_func
= redmine_parse_hash
;
8672 sort_by_digest
= sort_by_digest_4_5
;
8673 opti_type
= OPTI_TYPE_ZERO_BYTE
8674 | OPTI_TYPE_PRECOMPUTE_INIT
8675 | OPTI_TYPE_EARLY_SKIP
8676 | OPTI_TYPE_NOT_ITERATED
8677 | OPTI_TYPE_PREPENDED_SALT
;
8684 case 7700: hash_type
= HASH_TYPE_SAPB
;
8685 salt_type
= SALT_TYPE_EMBEDDED
;
8686 attack_exec
= ATTACK_EXEC_ON_GPU
;
8687 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8688 | OPTS_TYPE_PT_UPPER
8689 | OPTS_TYPE_ST_UPPER
;
8690 kern_type
= KERN_TYPE_SAPB
;
8691 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8692 parse_func
= sapb_parse_hash
;
8693 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8694 opti_type
= OPTI_TYPE_ZERO_BYTE
8695 | OPTI_TYPE_PRECOMPUTE_INIT
8696 | OPTI_TYPE_NOT_ITERATED
;
8703 case 7800: hash_type
= HASH_TYPE_SAPG
;
8704 salt_type
= SALT_TYPE_EMBEDDED
;
8705 attack_exec
= ATTACK_EXEC_ON_GPU
;
8706 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8707 | OPTS_TYPE_ST_ADD80
8708 | OPTS_TYPE_ST_UPPER
;
8709 kern_type
= KERN_TYPE_SAPG
;
8710 dgst_size
= DGST_SIZE_4_5
;
8711 parse_func
= sapg_parse_hash
;
8712 sort_by_digest
= sort_by_digest_4_5
;
8713 opti_type
= OPTI_TYPE_ZERO_BYTE
8714 | OPTI_TYPE_PRECOMPUTE_INIT
8715 | OPTI_TYPE_NOT_ITERATED
;
8722 case 7900: hash_type
= HASH_TYPE_SHA512
;
8723 salt_type
= SALT_TYPE_EMBEDDED
;
8724 attack_exec
= ATTACK_EXEC_ON_CPU
;
8725 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8726 kern_type
= KERN_TYPE_DRUPAL7
;
8727 dgst_size
= DGST_SIZE_8_8
;
8728 parse_func
= drupal7_parse_hash
;
8729 sort_by_digest
= sort_by_digest_8_8
;
8730 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8737 case 8000: hash_type
= HASH_TYPE_SHA256
;
8738 salt_type
= SALT_TYPE_EMBEDDED
;
8739 attack_exec
= ATTACK_EXEC_ON_GPU
;
8740 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8741 | OPTS_TYPE_PT_UNICODE
8742 | OPTS_TYPE_ST_ADD80
8744 kern_type
= KERN_TYPE_SYBASEASE
;
8745 dgst_size
= DGST_SIZE_4_8
;
8746 parse_func
= sybasease_parse_hash
;
8747 sort_by_digest
= sort_by_digest_4_8
;
8748 opti_type
= OPTI_TYPE_ZERO_BYTE
8749 | OPTI_TYPE_PRECOMPUTE_INIT
8750 | OPTI_TYPE_EARLY_SKIP
8751 | OPTI_TYPE_NOT_ITERATED
8752 | OPTI_TYPE_RAW_HASH
;
8759 case 8100: hash_type
= HASH_TYPE_SHA1
;
8760 salt_type
= SALT_TYPE_EMBEDDED
;
8761 attack_exec
= ATTACK_EXEC_ON_GPU
;
8762 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8763 kern_type
= KERN_TYPE_NETSCALER
;
8764 dgst_size
= DGST_SIZE_4_5
;
8765 parse_func
= netscaler_parse_hash
;
8766 sort_by_digest
= sort_by_digest_4_5
;
8767 opti_type
= OPTI_TYPE_ZERO_BYTE
8768 | OPTI_TYPE_PRECOMPUTE_INIT
8769 | OPTI_TYPE_PRECOMPUTE_MERKLE
8770 | OPTI_TYPE_EARLY_SKIP
8771 | OPTI_TYPE_NOT_ITERATED
8772 | OPTI_TYPE_PREPENDED_SALT
8773 | OPTI_TYPE_RAW_HASH
;
8780 case 8200: hash_type
= HASH_TYPE_SHA256
;
8781 salt_type
= SALT_TYPE_EMBEDDED
;
8782 attack_exec
= ATTACK_EXEC_ON_CPU
;
8783 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8784 kern_type
= KERN_TYPE_CLOUDKEY
;
8785 dgst_size
= DGST_SIZE_4_8
;
8786 parse_func
= cloudkey_parse_hash
;
8787 sort_by_digest
= sort_by_digest_4_8
;
8788 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8795 case 8300: hash_type
= HASH_TYPE_SHA1
;
8796 salt_type
= SALT_TYPE_EMBEDDED
;
8797 attack_exec
= ATTACK_EXEC_ON_GPU
;
8798 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8800 | OPTS_TYPE_ST_ADD80
;
8801 kern_type
= KERN_TYPE_NSEC3
;
8802 dgst_size
= DGST_SIZE_4_5
;
8803 parse_func
= nsec3_parse_hash
;
8804 sort_by_digest
= sort_by_digest_4_5
;
8805 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8812 case 8400: hash_type
= HASH_TYPE_SHA1
;
8813 salt_type
= SALT_TYPE_INTERN
;
8814 attack_exec
= ATTACK_EXEC_ON_GPU
;
8815 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8816 | OPTS_TYPE_PT_ADD80
8817 | OPTS_TYPE_PT_ADDBITS15
;
8818 kern_type
= KERN_TYPE_WBB3
;
8819 dgst_size
= DGST_SIZE_4_5
;
8820 parse_func
= wbb3_parse_hash
;
8821 sort_by_digest
= sort_by_digest_4_5
;
8822 opti_type
= OPTI_TYPE_ZERO_BYTE
8823 | OPTI_TYPE_PRECOMPUTE_INIT
8824 | OPTI_TYPE_NOT_ITERATED
;
8831 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8832 salt_type
= SALT_TYPE_EMBEDDED
;
8833 attack_exec
= ATTACK_EXEC_ON_GPU
;
8834 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8835 | OPTS_TYPE_ST_UPPER
;
8836 kern_type
= KERN_TYPE_RACF
;
8837 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8838 parse_func
= racf_parse_hash
;
8839 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8840 opti_type
= OPTI_TYPE_ZERO_BYTE
8841 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8848 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8849 salt_type
= SALT_TYPE_NONE
;
8850 attack_exec
= ATTACK_EXEC_ON_GPU
;
8851 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8852 kern_type
= KERN_TYPE_LOTUS5
;
8853 dgst_size
= DGST_SIZE_4_4
;
8854 parse_func
= lotus5_parse_hash
;
8855 sort_by_digest
= sort_by_digest_4_4
;
8856 opti_type
= OPTI_TYPE_EARLY_SKIP
8857 | OPTI_TYPE_NOT_ITERATED
8858 | OPTI_TYPE_NOT_SALTED
8859 | OPTI_TYPE_RAW_HASH
;
8866 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8867 salt_type
= SALT_TYPE_EMBEDDED
;
8868 attack_exec
= ATTACK_EXEC_ON_GPU
;
8869 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8870 kern_type
= KERN_TYPE_LOTUS6
;
8871 dgst_size
= DGST_SIZE_4_4
;
8872 parse_func
= lotus6_parse_hash
;
8873 sort_by_digest
= sort_by_digest_4_4
;
8874 opti_type
= OPTI_TYPE_EARLY_SKIP
8875 | OPTI_TYPE_NOT_ITERATED
8876 | OPTI_TYPE_RAW_HASH
;
8883 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8884 salt_type
= SALT_TYPE_EMBEDDED
;
8885 attack_exec
= ATTACK_EXEC_ON_CPU
;
8886 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8887 kern_type
= KERN_TYPE_ANDROIDFDE
;
8888 dgst_size
= DGST_SIZE_4_4
;
8889 parse_func
= androidfde_parse_hash
;
8890 sort_by_digest
= sort_by_digest_4_4
;
8891 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8898 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8899 salt_type
= SALT_TYPE_EMBEDDED
;
8900 attack_exec
= ATTACK_EXEC_ON_CPU
;
8901 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8902 kern_type
= KERN_TYPE_SCRYPT
;
8903 dgst_size
= DGST_SIZE_4_8
;
8904 parse_func
= scrypt_parse_hash
;
8905 sort_by_digest
= sort_by_digest_4_8
;
8906 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8913 case 9000: hash_type
= HASH_TYPE_SHA1
;
8914 salt_type
= SALT_TYPE_EMBEDDED
;
8915 attack_exec
= ATTACK_EXEC_ON_CPU
;
8916 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8917 | OPTS_TYPE_ST_GENERATE_LE
;
8918 kern_type
= KERN_TYPE_PSAFE2
;
8919 dgst_size
= DGST_SIZE_4_5
;
8920 parse_func
= psafe2_parse_hash
;
8921 sort_by_digest
= sort_by_digest_4_5
;
8922 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8929 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
8930 salt_type
= SALT_TYPE_EMBEDDED
;
8931 attack_exec
= ATTACK_EXEC_ON_CPU
;
8932 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8933 kern_type
= KERN_TYPE_LOTUS8
;
8934 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8935 parse_func
= lotus8_parse_hash
;
8936 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8937 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8944 case 9200: hash_type
= HASH_TYPE_SHA256
;
8945 salt_type
= SALT_TYPE_EMBEDDED
;
8946 attack_exec
= ATTACK_EXEC_ON_CPU
;
8947 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8948 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
8949 dgst_size
= DGST_SIZE_4_32
;
8950 parse_func
= cisco8_parse_hash
;
8951 sort_by_digest
= sort_by_digest_4_32
;
8952 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8959 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
8960 salt_type
= SALT_TYPE_EMBEDDED
;
8961 attack_exec
= ATTACK_EXEC_ON_CPU
;
8962 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8963 kern_type
= KERN_TYPE_SCRYPT
;
8964 dgst_size
= DGST_SIZE_4_8
;
8965 parse_func
= cisco9_parse_hash
;
8966 sort_by_digest
= sort_by_digest_4_8
;
8967 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8974 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
8975 salt_type
= SALT_TYPE_EMBEDDED
;
8976 attack_exec
= ATTACK_EXEC_ON_CPU
;
8977 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8978 kern_type
= KERN_TYPE_OFFICE2007
;
8979 dgst_size
= DGST_SIZE_4_4
;
8980 parse_func
= office2007_parse_hash
;
8981 sort_by_digest
= sort_by_digest_4_4
;
8982 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8989 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
8990 salt_type
= SALT_TYPE_EMBEDDED
;
8991 attack_exec
= ATTACK_EXEC_ON_CPU
;
8992 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8993 kern_type
= KERN_TYPE_OFFICE2010
;
8994 dgst_size
= DGST_SIZE_4_4
;
8995 parse_func
= office2010_parse_hash
;
8996 sort_by_digest
= sort_by_digest_4_4
;
8997 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9004 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9005 salt_type
= SALT_TYPE_EMBEDDED
;
9006 attack_exec
= ATTACK_EXEC_ON_CPU
;
9007 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9008 kern_type
= KERN_TYPE_OFFICE2013
;
9009 dgst_size
= DGST_SIZE_4_4
;
9010 parse_func
= office2013_parse_hash
;
9011 sort_by_digest
= sort_by_digest_4_4
;
9012 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9019 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9020 salt_type
= SALT_TYPE_EMBEDDED
;
9021 attack_exec
= ATTACK_EXEC_ON_GPU
;
9022 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9023 | OPTS_TYPE_PT_ADD80
9024 | OPTS_TYPE_PT_UNICODE
;
9025 kern_type
= KERN_TYPE_OLDOFFICE01
;
9026 dgst_size
= DGST_SIZE_4_4
;
9027 parse_func
= oldoffice01_parse_hash
;
9028 sort_by_digest
= sort_by_digest_4_4
;
9029 opti_type
= OPTI_TYPE_ZERO_BYTE
9030 | OPTI_TYPE_PRECOMPUTE_INIT
9031 | OPTI_TYPE_NOT_ITERATED
;
9038 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9039 salt_type
= SALT_TYPE_EMBEDDED
;
9040 attack_exec
= ATTACK_EXEC_ON_GPU
;
9041 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9042 | OPTS_TYPE_PT_ADD80
;
9043 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9044 dgst_size
= DGST_SIZE_4_4
;
9045 parse_func
= oldoffice01cm1_parse_hash
;
9046 sort_by_digest
= sort_by_digest_4_4
;
9047 opti_type
= OPTI_TYPE_ZERO_BYTE
9048 | OPTI_TYPE_PRECOMPUTE_INIT
9049 | OPTI_TYPE_NOT_ITERATED
;
9056 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9057 salt_type
= SALT_TYPE_EMBEDDED
;
9058 attack_exec
= ATTACK_EXEC_ON_GPU
;
9059 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9060 | OPTS_TYPE_PT_ADD80
9061 | OPTS_TYPE_PT_UNICODE
9062 | OPTS_TYPE_PT_NEVERCRACK
;
9063 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9064 dgst_size
= DGST_SIZE_4_4
;
9065 parse_func
= oldoffice01cm2_parse_hash
;
9066 sort_by_digest
= sort_by_digest_4_4
;
9067 opti_type
= OPTI_TYPE_ZERO_BYTE
9068 | OPTI_TYPE_PRECOMPUTE_INIT
9069 | OPTI_TYPE_NOT_ITERATED
;
9076 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9077 salt_type
= SALT_TYPE_EMBEDDED
;
9078 attack_exec
= ATTACK_EXEC_ON_GPU
;
9079 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9080 | OPTS_TYPE_PT_ADD80
9081 | OPTS_TYPE_PT_UNICODE
;
9082 kern_type
= KERN_TYPE_OLDOFFICE34
;
9083 dgst_size
= DGST_SIZE_4_4
;
9084 parse_func
= oldoffice34_parse_hash
;
9085 sort_by_digest
= sort_by_digest_4_4
;
9086 opti_type
= OPTI_TYPE_ZERO_BYTE
9087 | OPTI_TYPE_PRECOMPUTE_INIT
9088 | OPTI_TYPE_NOT_ITERATED
;
9095 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9096 salt_type
= SALT_TYPE_EMBEDDED
;
9097 attack_exec
= ATTACK_EXEC_ON_GPU
;
9098 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9099 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9100 dgst_size
= DGST_SIZE_4_4
;
9101 parse_func
= oldoffice34cm1_parse_hash
;
9102 sort_by_digest
= sort_by_digest_4_4
;
9103 opti_type
= OPTI_TYPE_ZERO_BYTE
9104 | OPTI_TYPE_PRECOMPUTE_INIT
9105 | OPTI_TYPE_NOT_ITERATED
;
9112 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9113 salt_type
= SALT_TYPE_EMBEDDED
;
9114 attack_exec
= ATTACK_EXEC_ON_GPU
;
9115 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9116 | OPTS_TYPE_PT_ADD80
9117 | OPTS_TYPE_PT_UNICODE
9118 | OPTS_TYPE_PT_NEVERCRACK
;
9119 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9120 dgst_size
= DGST_SIZE_4_4
;
9121 parse_func
= oldoffice34cm2_parse_hash
;
9122 sort_by_digest
= sort_by_digest_4_4
;
9123 opti_type
= OPTI_TYPE_ZERO_BYTE
9124 | OPTI_TYPE_PRECOMPUTE_INIT
9125 | OPTI_TYPE_NOT_ITERATED
;
9132 case 9900: hash_type
= HASH_TYPE_MD5
;
9133 salt_type
= SALT_TYPE_NONE
;
9134 attack_exec
= ATTACK_EXEC_ON_GPU
;
9135 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9136 kern_type
= KERN_TYPE_RADMIN2
;
9137 dgst_size
= DGST_SIZE_4_4
;
9138 parse_func
= radmin2_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_EARLY_SKIP
9143 | OPTI_TYPE_NOT_ITERATED
9144 | OPTI_TYPE_NOT_SALTED
;
9151 case 10000: hash_type
= HASH_TYPE_SHA256
;
9152 salt_type
= SALT_TYPE_EMBEDDED
;
9153 attack_exec
= ATTACK_EXEC_ON_CPU
;
9154 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9155 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9156 dgst_size
= DGST_SIZE_4_32
;
9157 parse_func
= djangopbkdf2_parse_hash
;
9158 sort_by_digest
= sort_by_digest_4_32
;
9159 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9166 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9167 salt_type
= SALT_TYPE_EMBEDDED
;
9168 attack_exec
= ATTACK_EXEC_ON_GPU
;
9169 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9170 kern_type
= KERN_TYPE_SIPHASH
;
9171 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9172 parse_func
= siphash_parse_hash
;
9173 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9174 opti_type
= OPTI_TYPE_ZERO_BYTE
9175 | OPTI_TYPE_NOT_ITERATED
9176 | OPTI_TYPE_RAW_HASH
;
9183 case 10200: hash_type
= HASH_TYPE_MD5
;
9184 salt_type
= SALT_TYPE_EMBEDDED
;
9185 attack_exec
= ATTACK_EXEC_ON_GPU
;
9186 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9187 | OPTS_TYPE_ST_ADD80
9188 | OPTS_TYPE_ST_ADDBITS14
;
9189 kern_type
= KERN_TYPE_HMACMD5_PW
;
9190 dgst_size
= DGST_SIZE_4_4
;
9191 parse_func
= crammd5_parse_hash
;
9192 sort_by_digest
= sort_by_digest_4_4
;
9193 opti_type
= OPTI_TYPE_ZERO_BYTE
9194 | OPTI_TYPE_NOT_ITERATED
;
9201 case 10300: hash_type
= HASH_TYPE_SHA1
;
9202 salt_type
= SALT_TYPE_EMBEDDED
;
9203 attack_exec
= ATTACK_EXEC_ON_CPU
;
9204 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9205 kern_type
= KERN_TYPE_SAPH_SHA1
;
9206 dgst_size
= DGST_SIZE_4_5
;
9207 parse_func
= saph_sha1_parse_hash
;
9208 sort_by_digest
= sort_by_digest_4_5
;
9209 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9216 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9217 salt_type
= SALT_TYPE_EMBEDDED
;
9218 attack_exec
= ATTACK_EXEC_ON_GPU
;
9219 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9220 kern_type
= KERN_TYPE_PDF11
;
9221 dgst_size
= DGST_SIZE_4_4
;
9222 parse_func
= pdf11_parse_hash
;
9223 sort_by_digest
= sort_by_digest_4_4
;
9224 opti_type
= OPTI_TYPE_ZERO_BYTE
9225 | OPTI_TYPE_NOT_ITERATED
;
9232 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9233 salt_type
= SALT_TYPE_EMBEDDED
;
9234 attack_exec
= ATTACK_EXEC_ON_GPU
;
9235 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9236 kern_type
= KERN_TYPE_PDF11CM1
;
9237 dgst_size
= DGST_SIZE_4_4
;
9238 parse_func
= pdf11cm1_parse_hash
;
9239 sort_by_digest
= sort_by_digest_4_4
;
9240 opti_type
= OPTI_TYPE_ZERO_BYTE
9241 | OPTI_TYPE_NOT_ITERATED
;
9248 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9249 salt_type
= SALT_TYPE_EMBEDDED
;
9250 attack_exec
= ATTACK_EXEC_ON_GPU
;
9251 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9252 kern_type
= KERN_TYPE_PDF11CM2
;
9253 dgst_size
= DGST_SIZE_4_4
;
9254 parse_func
= pdf11cm2_parse_hash
;
9255 sort_by_digest
= sort_by_digest_4_4
;
9256 opti_type
= OPTI_TYPE_ZERO_BYTE
9257 | OPTI_TYPE_NOT_ITERATED
;
9264 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9265 salt_type
= SALT_TYPE_EMBEDDED
;
9266 attack_exec
= ATTACK_EXEC_ON_CPU
;
9267 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9268 kern_type
= KERN_TYPE_PDF14
;
9269 dgst_size
= DGST_SIZE_4_4
;
9270 parse_func
= pdf14_parse_hash
;
9271 sort_by_digest
= sort_by_digest_4_4
;
9272 opti_type
= OPTI_TYPE_ZERO_BYTE
9273 | OPTI_TYPE_NOT_ITERATED
;
9280 case 10600: hash_type
= HASH_TYPE_SHA256
;
9281 salt_type
= SALT_TYPE_EMBEDDED
;
9282 attack_exec
= ATTACK_EXEC_ON_GPU
;
9283 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9284 | OPTS_TYPE_ST_ADD80
9285 | OPTS_TYPE_ST_ADDBITS15
9286 | OPTS_TYPE_HASH_COPY
;
9287 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9288 dgst_size
= DGST_SIZE_4_8
;
9289 parse_func
= pdf17l3_parse_hash
;
9290 sort_by_digest
= sort_by_digest_4_8
;
9291 opti_type
= OPTI_TYPE_ZERO_BYTE
9292 | OPTI_TYPE_PRECOMPUTE_INIT
9293 | OPTI_TYPE_PRECOMPUTE_MERKLE
9294 | OPTI_TYPE_EARLY_SKIP
9295 | OPTI_TYPE_NOT_ITERATED
9296 | OPTI_TYPE_APPENDED_SALT
9297 | OPTI_TYPE_RAW_HASH
;
9304 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9305 salt_type
= SALT_TYPE_EMBEDDED
;
9306 attack_exec
= ATTACK_EXEC_ON_CPU
;
9307 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9308 | OPTS_TYPE_HASH_COPY
;
9309 kern_type
= KERN_TYPE_PDF17L8
;
9310 dgst_size
= DGST_SIZE_4_8
;
9311 parse_func
= pdf17l8_parse_hash
;
9312 sort_by_digest
= sort_by_digest_4_8
;
9313 opti_type
= OPTI_TYPE_ZERO_BYTE
9314 | OPTI_TYPE_NOT_ITERATED
;
9321 case 10800: hash_type
= HASH_TYPE_SHA384
;
9322 salt_type
= SALT_TYPE_NONE
;
9323 attack_exec
= ATTACK_EXEC_ON_GPU
;
9324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9325 | OPTS_TYPE_PT_ADD80
9326 | OPTS_TYPE_PT_ADDBITS15
;
9327 kern_type
= KERN_TYPE_SHA384
;
9328 dgst_size
= DGST_SIZE_8_8
;
9329 parse_func
= sha384_parse_hash
;
9330 sort_by_digest
= sort_by_digest_8_8
;
9331 opti_type
= OPTI_TYPE_ZERO_BYTE
9332 | OPTI_TYPE_PRECOMPUTE_INIT
9333 | OPTI_TYPE_PRECOMPUTE_MERKLE
9334 | OPTI_TYPE_EARLY_SKIP
9335 | OPTI_TYPE_NOT_ITERATED
9336 | OPTI_TYPE_NOT_SALTED
9337 | OPTI_TYPE_RAW_HASH
;
9344 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9345 salt_type
= SALT_TYPE_EMBEDDED
;
9346 attack_exec
= ATTACK_EXEC_ON_CPU
;
9347 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9348 | OPTS_TYPE_ST_BASE64
9349 | OPTS_TYPE_HASH_COPY
;
9350 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9351 dgst_size
= DGST_SIZE_4_32
;
9352 parse_func
= pbkdf2_sha256_parse_hash
;
9353 sort_by_digest
= sort_by_digest_4_32
;
9354 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9361 case 11000: hash_type
= HASH_TYPE_MD5
;
9362 salt_type
= SALT_TYPE_INTERN
;
9363 attack_exec
= ATTACK_EXEC_ON_GPU
;
9364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9365 | OPTS_TYPE_PT_ADD80
;
9366 kern_type
= KERN_TYPE_PRESTASHOP
;
9367 dgst_size
= DGST_SIZE_4_4
;
9368 parse_func
= prestashop_parse_hash
;
9369 sort_by_digest
= sort_by_digest_4_4
;
9370 opti_type
= OPTI_TYPE_ZERO_BYTE
9371 | OPTI_TYPE_PRECOMPUTE_INIT
9372 | OPTI_TYPE_NOT_ITERATED
9373 | OPTI_TYPE_PREPENDED_SALT
;
9380 case 11100: hash_type
= HASH_TYPE_MD5
;
9381 salt_type
= SALT_TYPE_EMBEDDED
;
9382 attack_exec
= ATTACK_EXEC_ON_GPU
;
9383 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9384 | OPTS_TYPE_ST_ADD80
;
9385 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9386 dgst_size
= DGST_SIZE_4_4
;
9387 parse_func
= postgresql_auth_parse_hash
;
9388 sort_by_digest
= sort_by_digest_4_4
;
9389 opti_type
= OPTI_TYPE_ZERO_BYTE
9390 | OPTI_TYPE_PRECOMPUTE_INIT
9391 | OPTI_TYPE_PRECOMPUTE_MERKLE
9392 | OPTI_TYPE_EARLY_SKIP
;
9399 case 11200: hash_type
= HASH_TYPE_SHA1
;
9400 salt_type
= SALT_TYPE_EMBEDDED
;
9401 attack_exec
= ATTACK_EXEC_ON_GPU
;
9402 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9403 | OPTS_TYPE_PT_ADD80
9405 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9406 dgst_size
= DGST_SIZE_4_5
;
9407 parse_func
= mysql_auth_parse_hash
;
9408 sort_by_digest
= sort_by_digest_4_5
;
9409 opti_type
= OPTI_TYPE_ZERO_BYTE
9410 | OPTI_TYPE_EARLY_SKIP
;
9417 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9418 salt_type
= SALT_TYPE_EMBEDDED
;
9419 attack_exec
= ATTACK_EXEC_ON_CPU
;
9420 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9422 | OPTS_TYPE_ST_ADD80
;
9423 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9424 dgst_size
= DGST_SIZE_4_4
;
9425 parse_func
= bitcoin_wallet_parse_hash
;
9426 sort_by_digest
= sort_by_digest_4_4
;
9427 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9434 case 11400: hash_type
= HASH_TYPE_MD5
;
9435 salt_type
= SALT_TYPE_EMBEDDED
;
9436 attack_exec
= ATTACK_EXEC_ON_GPU
;
9437 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9438 | OPTS_TYPE_PT_ADD80
9439 | OPTS_TYPE_HASH_COPY
;
9440 kern_type
= KERN_TYPE_SIP_AUTH
;
9441 dgst_size
= DGST_SIZE_4_4
;
9442 parse_func
= sip_auth_parse_hash
;
9443 sort_by_digest
= sort_by_digest_4_4
;
9444 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9451 case 11500: hash_type
= HASH_TYPE_CRC32
;
9452 salt_type
= SALT_TYPE_INTERN
;
9453 attack_exec
= ATTACK_EXEC_ON_GPU
;
9454 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9455 | OPTS_TYPE_ST_GENERATE_LE
9457 kern_type
= KERN_TYPE_CRC32
;
9458 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9459 parse_func
= crc32_parse_hash
;
9460 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9461 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9468 case 11600: hash_type
= HASH_TYPE_AES
;
9469 salt_type
= SALT_TYPE_EMBEDDED
;
9470 attack_exec
= ATTACK_EXEC_ON_CPU
;
9471 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9472 | OPTS_TYPE_PT_NEVERCRACK
;
9473 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9474 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9475 parse_func
= seven_zip_parse_hash
;
9476 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9477 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9484 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9485 salt_type
= SALT_TYPE_NONE
;
9486 attack_exec
= ATTACK_EXEC_ON_GPU
;
9487 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9488 | OPTS_TYPE_PT_ADD01
;
9489 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9490 dgst_size
= DGST_SIZE_4_8
;
9491 parse_func
= gost2012sbog_256_parse_hash
;
9492 sort_by_digest
= sort_by_digest_4_8
;
9493 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9500 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9501 salt_type
= SALT_TYPE_NONE
;
9502 attack_exec
= ATTACK_EXEC_ON_GPU
;
9503 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9504 | OPTS_TYPE_PT_ADD01
;
9505 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9506 dgst_size
= DGST_SIZE_4_16
;
9507 parse_func
= gost2012sbog_512_parse_hash
;
9508 sort_by_digest
= sort_by_digest_4_16
;
9509 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9516 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9517 salt_type
= SALT_TYPE_EMBEDDED
;
9518 attack_exec
= ATTACK_EXEC_ON_CPU
;
9519 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9520 | OPTS_TYPE_ST_BASE64
9521 | OPTS_TYPE_HASH_COPY
;
9522 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9523 dgst_size
= DGST_SIZE_4_32
;
9524 parse_func
= pbkdf2_md5_parse_hash
;
9525 sort_by_digest
= sort_by_digest_4_32
;
9526 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9533 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9534 salt_type
= SALT_TYPE_EMBEDDED
;
9535 attack_exec
= ATTACK_EXEC_ON_CPU
;
9536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9537 | OPTS_TYPE_ST_BASE64
9538 | OPTS_TYPE_HASH_COPY
;
9539 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9540 dgst_size
= DGST_SIZE_4_32
;
9541 parse_func
= pbkdf2_sha1_parse_hash
;
9542 sort_by_digest
= sort_by_digest_4_32
;
9543 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9550 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9551 salt_type
= SALT_TYPE_EMBEDDED
;
9552 attack_exec
= ATTACK_EXEC_ON_CPU
;
9553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9554 | OPTS_TYPE_ST_BASE64
9555 | OPTS_TYPE_HASH_COPY
;
9556 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9557 dgst_size
= DGST_SIZE_8_16
;
9558 parse_func
= pbkdf2_sha512_parse_hash
;
9559 sort_by_digest
= sort_by_digest_8_16
;
9560 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9567 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9568 salt_type
= SALT_TYPE_EMBEDDED
;
9569 attack_exec
= ATTACK_EXEC_ON_CPU
;
9570 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9571 kern_type
= KERN_TYPE_ECRYPTFS
;
9572 dgst_size
= DGST_SIZE_8_8
;
9573 parse_func
= ecryptfs_parse_hash
;
9574 sort_by_digest
= sort_by_digest_8_8
;
9575 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9582 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9583 salt_type
= SALT_TYPE_EMBEDDED
;
9584 attack_exec
= ATTACK_EXEC_ON_CPU
;
9585 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9586 kern_type
= KERN_TYPE_ORACLET
;
9587 dgst_size
= DGST_SIZE_8_16
;
9588 parse_func
= oraclet_parse_hash
;
9589 sort_by_digest
= sort_by_digest_8_16
;
9590 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9597 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9598 salt_type
= SALT_TYPE_EMBEDDED
;
9599 attack_exec
= ATTACK_EXEC_ON_CPU
;
9600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9601 kern_type
= KERN_TYPE_BSDICRYPT
;
9602 dgst_size
= DGST_SIZE_4_4
;
9603 parse_func
= bsdicrypt_parse_hash
;
9604 sort_by_digest
= sort_by_digest_4_4
;
9605 opti_type
= OPTI_TYPE_ZERO_BYTE
9606 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9613 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9614 salt_type
= SALT_TYPE_EMBEDDED
;
9615 attack_exec
= ATTACK_EXEC_ON_CPU
;
9616 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9617 kern_type
= KERN_TYPE_RAR3
;
9618 dgst_size
= DGST_SIZE_4_4
;
9619 parse_func
= rar3hp_parse_hash
;
9620 sort_by_digest
= sort_by_digest_4_4
;
9621 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9628 case 12600: hash_type
= HASH_TYPE_SHA256
;
9629 salt_type
= SALT_TYPE_INTERN
;
9630 attack_exec
= ATTACK_EXEC_ON_GPU
;
9631 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9632 | OPTS_TYPE_PT_ADD80
;
9633 kern_type
= KERN_TYPE_CF10
;
9634 dgst_size
= DGST_SIZE_4_8
;
9635 parse_func
= cf10_parse_hash
;
9636 sort_by_digest
= sort_by_digest_4_8
;
9637 opti_type
= OPTI_TYPE_ZERO_BYTE
9638 | OPTI_TYPE_PRECOMPUTE_INIT
9639 | OPTI_TYPE_EARLY_SKIP
9640 | OPTI_TYPE_NOT_ITERATED
;
9647 case 12700: hash_type
= HASH_TYPE_AES
;
9648 salt_type
= SALT_TYPE_EMBEDDED
;
9649 attack_exec
= ATTACK_EXEC_ON_CPU
;
9650 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9651 | OPTS_TYPE_HASH_COPY
;
9652 kern_type
= KERN_TYPE_MYWALLET
;
9653 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9654 parse_func
= mywallet_parse_hash
;
9655 sort_by_digest
= sort_by_digest_4_5
;
9656 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9663 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9664 salt_type
= SALT_TYPE_EMBEDDED
;
9665 attack_exec
= ATTACK_EXEC_ON_CPU
;
9666 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9667 kern_type
= KERN_TYPE_MS_DRSR
;
9668 dgst_size
= DGST_SIZE_4_8
;
9669 parse_func
= ms_drsr_parse_hash
;
9670 sort_by_digest
= sort_by_digest_4_8
;
9671 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9678 default: usage_mini_print (PROGNAME
); return (-1);
9685 data
.parse_func
= parse_func
;
9693 if (salt_type
== SALT_TYPE_INTERN
)
9695 opts_type
|= OPTS_TYPE_ST_HEX
;
9699 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9705 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9706 | (salt_type
== SALT_TYPE_EXTERN
)
9707 | (salt_type
== SALT_TYPE_EMBEDDED
)
9708 | (salt_type
== SALT_TYPE_VIRTUAL
));
9710 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9712 data
.hash_type
= hash_type
;
9713 data
.attack_mode
= attack_mode
;
9714 data
.attack_kern
= attack_kern
;
9715 data
.attack_exec
= attack_exec
;
9716 data
.kern_type
= kern_type
;
9717 data
.opts_type
= opts_type
;
9718 data
.dgst_size
= dgst_size
;
9719 data
.salt_type
= salt_type
;
9720 data
.isSalted
= isSalted
;
9721 data
.sort_by_digest
= sort_by_digest
;
9722 data
.dgst_pos0
= dgst_pos0
;
9723 data
.dgst_pos1
= dgst_pos1
;
9724 data
.dgst_pos2
= dgst_pos2
;
9725 data
.dgst_pos3
= dgst_pos3
;
9731 case 2500: esalt_size
= sizeof (wpa_t
); break;
9732 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9733 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9734 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9735 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9747 case 6243: esalt_size
= sizeof (tc_t
); break;
9748 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9749 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9750 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9751 case 7300: esalt_size
= sizeof (rakp_t
); break;
9752 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9753 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9754 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9755 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9756 case 9400: esalt_size
= sizeof (office2007_t
); break;
9757 case 9500: esalt_size
= sizeof (office2010_t
); break;
9758 case 9600: esalt_size
= sizeof (office2013_t
); break;
9759 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9760 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9761 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9762 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9763 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9764 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9765 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9766 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9767 case 10400: esalt_size
= sizeof (pdf_t
); break;
9768 case 10410: esalt_size
= sizeof (pdf_t
); break;
9769 case 10420: esalt_size
= sizeof (pdf_t
); break;
9770 case 10500: esalt_size
= sizeof (pdf_t
); break;
9771 case 10600: esalt_size
= sizeof (pdf_t
); break;
9772 case 10700: esalt_size
= sizeof (pdf_t
); break;
9773 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9774 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9775 case 11400: esalt_size
= sizeof (sip_t
); break;
9776 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9777 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9778 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9779 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9782 data
.esalt_size
= esalt_size
;
9785 * choose dictionary parser
9788 if (hash_type
== HASH_TYPE_LM
)
9790 get_next_word_func
= get_next_word_lm
;
9792 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9794 get_next_word_func
= get_next_word_uc
;
9798 get_next_word_func
= get_next_word_std
;
9805 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9808 size_t dictstat_nmemb
= 0;
9812 uint dictstat_nmemb
= 0;
9817 FILE *dictstat_fp
= NULL
;
9821 memset (dictstat
, 0, sizeof (dictstat
));
9823 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9825 dictstat_fp
= fopen (dictstat
, "rb");
9830 struct stat tmpstat
;
9832 fstat (fileno (dictstat_fp
), &tmpstat
);
9836 struct stat64 tmpstat
;
9838 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9841 if (tmpstat
.st_mtime
< COMPTIME
)
9843 /* with v0.15 the format changed so we have to ensure user is using a good version
9844 since there is no version-header in the dictstat file */
9846 fclose (dictstat_fp
);
9852 while (!feof (dictstat_fp
))
9856 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9858 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9860 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9862 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9868 fclose (dictstat_fp
);
9879 memset (potfile
, 0, sizeof (potfile
));
9881 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9885 FILE *out_fp
= NULL
;
9886 FILE *pot_fp
= NULL
;
9888 if (show
== 1 || left
== 1)
9890 pot_fp
= fopen (potfile
, "rb");
9894 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9899 if (outfile
!= NULL
)
9901 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9903 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
9917 if (potfile_disable
== 0)
9919 pot_fp
= fopen (potfile
, "ab");
9923 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9928 data
.pot_fp
= pot_fp
;
9937 if (show
== 1 || left
== 1)
9939 SUPPRESS_OUTPUT
= 1;
9941 pot_avail
= count_lines (pot_fp
);
9945 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
9947 uint pot_hashes_avail
= 0;
9951 while (!feof (pot_fp
))
9955 char line_buf
[BUFSIZ
];
9957 int line_len
= fgetl (pot_fp
, line_buf
);
9959 if (line_len
== 0) continue;
9961 char *plain_buf
= line_buf
+ line_len
;
9963 pot_t
*pot_ptr
= &pot
[pot_cnt
];
9965 hash_t
*hashes_buf
= &pot_ptr
->hash
;
9967 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
9968 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
9970 if (pot_cnt
== pot_hashes_avail
)
9974 for (pos
= 0; pos
< INCR_POT
; pos
++)
9976 if ((pot_cnt
+ pos
) >= pot_avail
) break;
9978 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
9980 hash_t
*tmp_hash
= &tmp_pot
->hash
;
9982 tmp_hash
->digest
= mymalloc (dgst_size
);
9986 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
9991 tmp_hash
->esalt
= mymalloc (esalt_size
);
10002 int iter
= MAX_CUT_TRIES
;
10006 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10008 if (line_buf
[i
] == ':')
10016 if (data
.hash_mode
!= 2500)
10018 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10022 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10024 if (line_len
> max_salt_size
)
10026 parser_status
= PARSER_GLOBAL_LENGTH
;
10030 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10032 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10034 hashes_buf
->salt
->salt_len
= line_len
;
10036 parser_status
= PARSER_OK
;
10040 // if NOT parsed without error, we add the ":" to the plain
10042 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10048 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10050 if (parser_status
< PARSER_GLOBAL_ZERO
)
10052 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10057 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10059 pot_ptr
->plain_len
= plain_len
;
10066 SUPPRESS_OUTPUT
= 0;
10068 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10072 * gpu accel and loops auto adjustment
10075 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10076 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10078 if (workload_profile
== 1)
10083 if (gpu_loops
== 0) gpu_loops
= 8;
10084 if (gpu_accel
== 0) gpu_accel
= 2;
10086 else if (workload_profile
== 3)
10091 if (gpu_loops
> 1024) gpu_loops
= 1024;
10092 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10095 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10097 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10102 if (hash_mode
== 12500)
10104 gpu_loops
= ROUNDS_RAR3
/ 16;
10107 data
.gpu_accel
= gpu_accel
;
10108 data
.gpu_loops
= gpu_loops
;
10114 uint pw_min
= PW_MIN
;
10115 uint pw_max
= PW_MAX
;
10119 case 400: if (pw_max
> 40) pw_max
= 40;
10121 case 500: if (pw_max
> 16) pw_max
= 16;
10123 case 1500: if (pw_max
> 8) pw_max
= 8;
10125 case 1600: if (pw_max
> 16) pw_max
= 16;
10127 case 1800: if (pw_max
> 16) pw_max
= 16;
10129 case 2100: if (pw_max
> 16) pw_max
= 16;
10131 case 2500: if (pw_min
< 8) pw_min
= 8;
10133 case 3000: if (pw_max
> 7) pw_max
= 7;
10135 case 5200: if (pw_max
> 24) pw_max
= 24;
10137 case 5800: if (pw_max
> 16) pw_max
= 16;
10139 case 6300: if (pw_max
> 16) pw_max
= 16;
10141 case 7400: if (pw_max
> 16) pw_max
= 16;
10143 case 7900: if (pw_max
> 48) pw_max
= 48;
10145 case 8500: if (pw_max
> 8) pw_max
= 8;
10147 case 8600: if (pw_max
> 16) pw_max
= 16;
10149 case 9710: pw_min
= 5;
10152 case 9810: pw_min
= 5;
10155 case 10410: pw_min
= 5;
10158 case 10300: if (pw_max
< 3) pw_min
= 3;
10159 if (pw_max
> 40) pw_max
= 40;
10161 case 10500: if (pw_max
< 3) pw_min
= 3;
10162 if (pw_max
> 40) pw_max
= 40;
10164 case 10700: if (pw_max
> 16) pw_max
= 16;
10166 case 11300: if (pw_max
> 40) pw_max
= 40;
10168 case 12500: if (pw_max
> 20) pw_max
= 20;
10170 case 12800: if (pw_max
> 24) pw_max
= 24;
10174 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10176 switch (attack_kern
)
10178 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10180 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10186 * charsets : keep them together for more easy maintainnce
10192 memset (mp_sys
, 0, sizeof (mp_sys
));
10193 memset (mp_usr
, 0, sizeof (mp_usr
));
10195 mp_setup_sys (mp_sys
);
10197 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10198 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10199 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10200 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10203 * load hashes, part I: find input mode, count hashes
10206 uint hashlist_mode
= 0;
10207 uint hashlist_format
= HLFMT_HASHCAT
;
10209 uint hashes_avail
= 0;
10211 if (benchmark
== 0)
10215 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10217 if ((hash_mode
== 2500) ||
10218 (hash_mode
== 5200) ||
10219 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10220 (hash_mode
== 9000))
10222 hashlist_mode
= HL_MODE_ARG
;
10224 char *hashfile
= myargv
[optind
];
10226 data
.hashfile
= hashfile
;
10228 logfile_top_var_string ("target", hashfile
);
10231 if (hashlist_mode
== HL_MODE_ARG
)
10233 if (hash_mode
== 2500)
10237 if (stat (data
.hashfile
, &st
) == -1)
10239 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10244 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10251 else if (hashlist_mode
== HL_MODE_FILE
)
10253 char *hashfile
= myargv
[optind
];
10255 data
.hashfile
= hashfile
;
10257 logfile_top_var_string ("target", hashfile
);
10261 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10263 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10268 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10270 hashes_avail
= count_lines (fp
);
10274 if (hashes_avail
== 0)
10276 log_error ("ERROR: hashfile is empty or corrupt");
10283 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10285 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10287 log_error ("ERROR: remove not supported in native hashfile-format mode");
10299 hashlist_mode
= HL_MODE_ARG
;
10304 if (hash_mode
== 3000) hashes_avail
*= 2;
10306 data
.hashlist_mode
= hashlist_mode
;
10307 data
.hashlist_format
= hashlist_format
;
10309 logfile_top_uint (hashlist_mode
);
10310 logfile_top_uint (hashlist_format
);
10313 * load hashes, part II: allocate required memory, set pointers
10316 hash_t
*hashes_buf
= NULL
;
10317 void *digests_buf
= NULL
;
10318 salt_t
*salts_buf
= NULL
;
10319 void *esalts_buf
= NULL
;
10321 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10323 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10325 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10329 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10331 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10333 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10335 if (username
&& (remove
|| show
|| left
))
10337 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10342 hash_info
->orighash
= (char *) mymalloc (256);
10349 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10353 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10358 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10361 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10363 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10367 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10371 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10376 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10381 * load hashes, part III: parse hashes or generate them if benchmark
10384 uint hashes_cnt
= 0;
10386 if (benchmark
== 0)
10390 // useless to read hash file for keyspace, cheat a little bit w/ optind
10392 else if (hashes_avail
== 0)
10395 else if (hashlist_mode
== HL_MODE_ARG
)
10397 char *input_buf
= myargv
[optind
];
10399 uint input_len
= strlen (input_buf
);
10401 logfile_top_var_string ("target", input_buf
);
10403 char *hash_buf
= NULL
;
10406 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10410 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10412 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10414 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10419 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10422 int parser_status
= PARSER_OK
;
10424 if (hash_mode
== 2500)
10428 log_error ("ERROR: hccap file not specified");
10433 hashlist_mode
= HL_MODE_FILE
;
10435 data
.hashlist_mode
= hashlist_mode
;
10437 FILE *fp
= fopen (hash_buf
, "rb");
10441 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10446 if (hashes_avail
< 1)
10448 log_error ("ERROR: hccap file is empty or corrupt");
10455 uint hccap_size
= sizeof (hccap_t
);
10457 char in
[hccap_size
];
10461 int n
= fread (&in
, hccap_size
, 1, fp
);
10465 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10470 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10472 if (parser_status
!= PARSER_OK
)
10474 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10479 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10481 if ((show
== 1) || (left
== 1))
10483 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10485 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10487 int cur_pos
= tmp_salt
->salt_len
;
10488 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10490 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10492 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10494 // do the appending task
10496 snprintf (salt_ptr
+ cur_pos
,
10498 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10499 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10500 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10503 // memset () the remaining part of the salt
10505 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10506 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10508 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10510 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10513 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
);
10514 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
);
10521 else if (hash_mode
== 3000)
10523 if (hash_len
== 32)
10525 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10527 hash_t
*lm_hash_left
= NULL
;
10529 if (parser_status
== PARSER_OK
)
10531 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10537 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10541 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10543 hash_t
*lm_hash_right
= NULL
;
10545 if (parser_status
== PARSER_OK
)
10547 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10553 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10558 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10560 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
);
10561 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
);
10566 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10568 if (parser_status
== PARSER_OK
)
10570 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10571 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10574 if (parser_status
== PARSER_OK
)
10580 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10586 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10588 if (parser_status
== PARSER_OK
)
10590 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10591 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10594 if (parser_status
== PARSER_OK
)
10600 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10605 else if (hashlist_mode
== HL_MODE_FILE
)
10607 char *hashfile
= data
.hashfile
;
10611 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10613 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10624 char line_buf
[BUFSIZ
];
10626 int line_len
= fgetl (fp
, line_buf
);
10628 if (line_len
== 0) continue;
10630 char *hash_buf
= NULL
;
10633 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10637 char *user_buf
= NULL
;
10640 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10642 if (remove
|| show
)
10644 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10646 *user
= (user_t
*) malloc (sizeof (user_t
));
10648 user_t
*user_ptr
= *user
;
10650 if (user_buf
!= NULL
)
10652 user_ptr
->user_name
= mystrdup (user_buf
);
10656 user_ptr
->user_name
= mystrdup ("");
10659 user_ptr
->user_len
= user_len
;
10663 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10665 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10667 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10672 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10675 if (hash_mode
== 3000)
10677 if (hash_len
== 32)
10679 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10681 if (parser_status
< PARSER_GLOBAL_ZERO
)
10683 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10688 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10692 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10694 if (parser_status
< PARSER_GLOBAL_ZERO
)
10696 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10701 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10703 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);
10709 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
);
10710 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
);
10714 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10716 if (parser_status
< PARSER_GLOBAL_ZERO
)
10718 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10723 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);
10725 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10726 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10733 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10735 if (parser_status
< PARSER_GLOBAL_ZERO
)
10737 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10742 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);
10744 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10745 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10753 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10755 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10762 hashes_buf
[0].salt
->salt_len
= 8;
10764 // special salt handling
10768 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10770 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10772 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10774 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10776 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10778 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10780 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10782 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10784 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10786 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10788 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10789 hashes_buf
[0].salt
->scrypt_N
= 1024;
10790 hashes_buf
[0].salt
->scrypt_r
= 1;
10791 hashes_buf
[0].salt
->scrypt_p
= 1;
10793 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10795 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10796 hashes_buf
[0].salt
->scrypt_N
= 16384;
10797 hashes_buf
[0].salt
->scrypt_r
= 1;
10798 hashes_buf
[0].salt
->scrypt_p
= 1;
10800 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10802 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10804 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10806 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10808 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10810 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10812 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10814 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10816 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10818 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10820 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10822 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10824 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10826 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10828 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10832 // special esalt handling
10836 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10838 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10839 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10841 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10842 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10844 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10845 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10846 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10847 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10849 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10850 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10851 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10852 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10854 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10856 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10857 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10858 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10860 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10861 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10862 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10864 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10865 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10866 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10868 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10869 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10870 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10872 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10873 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10874 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10876 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10877 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10878 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10880 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10881 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10882 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10891 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10893 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10895 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10908 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10910 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10912 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10914 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
10918 // set default iterations
10922 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
10924 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10926 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10928 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10930 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
10932 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
10934 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
10936 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
10938 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
10940 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
10944 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
10948 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10952 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10956 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10958 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10960 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
10962 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
10964 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
10966 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
10968 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
10970 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
10972 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
10974 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
10976 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
10978 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
10980 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
10982 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
10984 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
10986 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
10988 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
10990 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
10992 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
10994 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
10996 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
10998 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11000 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11002 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11004 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11006 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11008 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11010 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11012 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11014 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11016 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11018 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11020 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11022 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11024 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11026 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11028 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11030 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11034 // set special tuning for benchmark-mode 1
11036 if (benchmark_mode
== 1)
11043 case 400: gpu_loops
= ROUNDS_PHPASS
;
11046 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11049 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11052 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11055 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11058 case 2100: gpu_loops
= ROUNDS_DCC2
;
11061 case 2500: gpu_loops
= ROUNDS_WPA2
;
11064 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11067 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11070 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11073 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11076 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11079 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11082 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11085 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11088 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11091 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11094 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11097 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11100 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11103 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11106 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11109 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11112 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11115 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11118 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11121 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11124 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11127 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11130 case 7200: gpu_loops
= ROUNDS_GRUB
;
11133 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11136 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11139 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11142 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11145 case 8900: gpu_loops
= 1;
11148 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11151 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11154 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11157 case 9300: gpu_loops
= 1;
11160 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11163 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11166 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11169 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11172 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11175 case 10500: gpu_loops
= ROUNDS_PDF14
;
11178 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11181 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11184 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11187 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11190 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11193 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11196 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11199 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11202 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11205 case 12500: gpu_loops
= ROUNDS_RAR3
;
11208 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11211 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11216 // some algorithm collide too fast, make that impossible
11220 case 11500: ((uint
*) digests_buf
)[1] = 1;
11224 if (gpu_loops
> 1024) gpu_loops
= 1024;
11225 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11228 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11233 if (hash_mode
== 12500)
11235 gpu_loops
= ROUNDS_RAR3
/ 16;
11238 data
.gpu_accel
= gpu_accel
;
11239 data
.gpu_loops
= gpu_loops
;
11244 if (show
== 1 || left
== 1)
11246 for (uint i
= 0; i
< pot_cnt
; i
++)
11248 pot_t
*pot_ptr
= &pot
[i
];
11250 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11252 local_free (hashes_buf
->digest
);
11256 local_free (hashes_buf
->salt
);
11262 if (data
.quiet
== 0) log_info_nn ("");
11269 if (hashes_cnt
== 0)
11271 log_error ("ERROR: No hashes loaded");
11278 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11281 if (data
.outfile
!= NULL
)
11283 if (data
.hashfile
!= NULL
)
11286 struct stat tmpstat_outfile
;
11287 struct stat tmpstat_hashfile
;
11291 struct stat64 tmpstat_outfile
;
11292 struct stat64 tmpstat_hashfile
;
11295 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11297 if (tmp_outfile_fp
)
11300 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11304 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11307 fclose (tmp_outfile_fp
);
11310 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11312 if (tmp_hashfile_fp
)
11315 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11319 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11322 fclose (tmp_hashfile_fp
);
11325 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11327 tmpstat_outfile
.st_mode
= 0;
11328 tmpstat_outfile
.st_nlink
= 0;
11329 tmpstat_outfile
.st_uid
= 0;
11330 tmpstat_outfile
.st_gid
= 0;
11331 tmpstat_outfile
.st_rdev
= 0;
11332 tmpstat_outfile
.st_atime
= 0;
11334 tmpstat_hashfile
.st_mode
= 0;
11335 tmpstat_hashfile
.st_nlink
= 0;
11336 tmpstat_hashfile
.st_uid
= 0;
11337 tmpstat_hashfile
.st_gid
= 0;
11338 tmpstat_hashfile
.st_rdev
= 0;
11339 tmpstat_hashfile
.st_atime
= 0;
11342 tmpstat_outfile
.st_blksize
= 0;
11343 tmpstat_outfile
.st_blocks
= 0;
11345 tmpstat_hashfile
.st_blksize
= 0;
11346 tmpstat_hashfile
.st_blocks
= 0;
11350 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11352 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11359 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11361 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11371 * Remove duplicates
11374 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11378 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11382 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11385 uint hashes_cnt_orig
= hashes_cnt
;
11389 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11393 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11395 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11400 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11403 if (hashes_pos
> hashes_cnt
)
11405 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11415 uint potfile_remove_cracks
= 0;
11417 if (potfile_disable
== 0)
11421 hash_buf
.digest
= mymalloc (dgst_size
);
11422 hash_buf
.salt
= NULL
;
11423 hash_buf
.esalt
= NULL
;
11424 hash_buf
.hash_info
= NULL
;
11425 hash_buf
.cracked
= 0;
11429 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11434 hash_buf
.esalt
= mymalloc (esalt_size
);
11437 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11439 // no solution for these special hash types (for instane because they use hashfile in output etc)
11440 if ((hash_mode
!= 5200) &&
11441 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11442 (hash_mode
!= 9000))
11444 FILE *fp
= fopen (potfile
, "rb");
11450 char line_buf
[BUFSIZ
];
11452 memset (line_buf
, 0, BUFSIZ
);
11454 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11456 if (ptr
== NULL
) break;
11458 int line_len
= strlen (line_buf
);
11460 if (line_len
== 0) continue;
11462 int iter
= MAX_CUT_TRIES
;
11464 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11466 if (line_buf
[i
] != ':') continue;
11470 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11473 hash_t
*found
= NULL
;
11475 if (hash_mode
== 6800)
11477 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11479 // manipulate salt_buf
11480 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11482 hash_buf
.salt
->salt_len
= i
;
11484 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11487 else if (hash_mode
== 2500)
11489 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11491 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11492 // manipulate salt_buf
11494 // to be safe work with a copy (because of line_len loop, i etc)
11496 char line_buf_cpy
[BUFSIZ
];
11497 memset (line_buf_cpy
, 0, BUFSIZ
);
11499 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11501 memcpy (line_buf_cpy
, line_buf
, i
);
11503 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11505 if (mac2_pos
== NULL
) continue;
11510 if (strlen (mac2_pos
) != 12) continue;
11512 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11514 if (mac1_pos
== NULL
) continue;
11519 if (strlen (mac1_pos
) != 12) continue;
11521 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11523 // here we need the ESSID
11524 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11526 hash_buf
.salt
->salt_len
= essid_length
;
11528 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11532 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11536 char *pke_ptr
= (char *) pke
;
11538 for (uint i
= 0; i
< 25; i
++)
11540 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11543 unsigned char mac1
[6];
11544 unsigned char mac2
[6];
11546 memcpy (mac1
, pke_ptr
+ 23, 6);
11547 memcpy (mac2
, pke_ptr
+ 29, 6);
11549 // compare hex string(s) vs binary MAC address(es)
11551 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11553 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11561 if (!found
) continue;
11563 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11565 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11576 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11578 if (parser_status
== PARSER_OK
)
11582 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11586 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11591 if (found
== NULL
) continue;
11593 if (!found
->cracked
) potfile_remove_cracks
++;
11595 found
->cracked
= 1;
11609 local_free (hash_buf
.esalt
);
11614 local_free (hash_buf
.salt
);
11617 local_free (hash_buf
.digest
);
11621 * Now generate all the buffers required for later
11624 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11626 salt_t
*salts_buf_new
= NULL
;
11627 void *esalts_buf_new
= NULL
;
11631 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11635 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11640 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11643 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11645 uint digests_cnt
= hashes_cnt
;
11646 uint digests_done
= 0;
11648 uint size_digests
= digests_cnt
* dgst_size
;
11649 uint size_shown
= digests_cnt
* sizeof (uint
);
11651 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11652 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11654 uint salts_cnt
= 0;
11655 uint salts_done
= 0;
11657 hashinfo_t
**hash_info
= NULL
;
11659 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11661 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11663 if (username
&& (remove
|| show
))
11667 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11669 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11671 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11676 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11681 // copied from inner loop
11683 salt_buf
= &salts_buf_new
[salts_cnt
];
11685 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11689 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11692 salt_buf
->digests_cnt
= 0;
11693 salt_buf
->digests_done
= 0;
11694 salt_buf
->digests_offset
= 0;
11699 if (hashes_buf
[0].cracked
== 1)
11701 digests_shown
[0] = 1;
11705 salt_buf
->digests_done
++;
11708 salt_buf
->digests_cnt
++;
11710 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11712 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11714 hash_info
[0] = hashes_buf
[0].hash_info
;
11717 // copy from inner loop
11719 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11723 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11725 salt_buf
= &salts_buf_new
[salts_cnt
];
11727 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11731 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11734 salt_buf
->digests_cnt
= 0;
11735 salt_buf
->digests_done
= 0;
11736 salt_buf
->digests_offset
= hashes_pos
;
11742 if (hashes_buf
[hashes_pos
].cracked
== 1)
11744 digests_shown
[hashes_pos
] = 1;
11748 salt_buf
->digests_done
++;
11751 salt_buf
->digests_cnt
++;
11753 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11755 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11757 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11761 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11763 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11765 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11767 salts_shown
[salt_pos
] = 1;
11772 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11775 local_free (digests_buf
);
11776 local_free (salts_buf
);
11777 local_free (esalts_buf
);
11779 digests_buf
= digests_buf_new
;
11780 salts_buf
= salts_buf_new
;
11781 esalts_buf
= esalts_buf_new
;
11783 local_free (hashes_buf
);
11786 * special modification not set from parser
11791 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11792 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11793 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11794 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11795 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11796 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11797 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11798 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11799 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11800 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11801 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11802 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11805 if (truecrypt_keyfiles
)
11807 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11809 char *keyfiles
= strdup (truecrypt_keyfiles
);
11811 char *keyfile
= strtok (keyfiles
, ",");
11815 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11817 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11822 data
.digests_cnt
= digests_cnt
;
11823 data
.digests_done
= digests_done
;
11824 data
.digests_buf
= digests_buf
;
11825 data
.digests_shown
= digests_shown
;
11826 data
.digests_shown_tmp
= digests_shown_tmp
;
11828 data
.salts_cnt
= salts_cnt
;
11829 data
.salts_done
= salts_done
;
11830 data
.salts_buf
= salts_buf
;
11831 data
.salts_shown
= salts_shown
;
11833 data
.esalts_buf
= esalts_buf
;
11834 data
.hash_info
= hash_info
;
11837 * Automatic Optimizers
11840 if (salts_cnt
== 1)
11841 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11843 if (digests_cnt
== 1)
11844 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11846 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11847 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11849 if (attack_mode
== ATTACK_MODE_BF
)
11850 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11852 data
.opti_type
= opti_type
;
11854 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11856 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11858 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11860 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11862 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11863 opts_type
|= OPTS_TYPE_PT_ADD80
;
11866 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11868 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11869 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11872 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11874 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11875 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11882 * Some algorithm, like descrypt, can benefit from JIT compilation
11885 uint force_jit_compilation
= 0;
11887 if (hash_mode
== 8900)
11889 force_jit_compilation
= 8900;
11891 else if (hash_mode
== 9300)
11893 force_jit_compilation
= 8900;
11895 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11897 force_jit_compilation
= 1500;
11901 * generate bitmap tables
11904 const uint bitmap_shift1
= 5;
11905 const uint bitmap_shift2
= 13;
11907 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11909 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11910 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11911 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11912 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11913 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11914 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11915 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11916 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11923 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
11925 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
11927 bitmap_nums
= 1 << bitmap_bits
;
11929 bitmap_mask
= bitmap_nums
- 1;
11931 bitmap_size
= bitmap_nums
* sizeof (uint
);
11933 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
11935 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;
11936 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;
11941 bitmap_nums
= 1 << bitmap_bits
;
11943 bitmap_mask
= bitmap_nums
- 1;
11945 bitmap_size
= bitmap_nums
* sizeof (uint
);
11947 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);
11948 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);
11951 * prepare quick rule
11954 data
.rule_buf_l
= rule_buf_l
;
11955 data
.rule_buf_r
= rule_buf_r
;
11957 int rule_len_l
= (int) strlen (rule_buf_l
);
11958 int rule_len_r
= (int) strlen (rule_buf_r
);
11960 data
.rule_len_l
= rule_len_l
;
11961 data
.rule_len_r
= rule_len_r
;
11967 uint
*all_gpu_rules_cnt
= NULL
;
11969 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
11973 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
11975 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
11978 char rule_buf
[BUFSIZ
];
11982 for (uint i
= 0; i
< rp_files_cnt
; i
++)
11984 uint gpu_rules_avail
= 0;
11986 uint gpu_rules_cnt
= 0;
11988 gpu_rule_t
*gpu_rules_buf
= NULL
;
11990 char *rp_file
= rp_files
[i
];
11992 char in
[BLOCK_SIZE
];
11993 char out
[BLOCK_SIZE
];
11997 uint rule_line
= 0;
11999 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12001 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12008 memset (rule_buf
, 0, BUFSIZ
);
12010 rule_len
= fgetl (fp
, rule_buf
);
12014 if (rule_len
== 0) continue;
12016 if (rule_buf
[0] == '#') continue;
12018 if (gpu_rules_avail
== gpu_rules_cnt
)
12020 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12022 gpu_rules_avail
+= INCR_RULES
;
12025 memset (in
, 0, BLOCK_SIZE
);
12026 memset (out
, 0, BLOCK_SIZE
);
12028 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12032 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12037 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12039 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12041 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12047 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12049 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12060 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12062 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12066 * merge rules or automatic rule generator
12069 uint gpu_rules_cnt
= 0;
12071 gpu_rule_t
*gpu_rules_buf
= NULL
;
12073 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12079 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12081 repeats
[0] = gpu_rules_cnt
;
12083 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12085 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12087 repeats
[i
+ 1] = gpu_rules_cnt
;
12090 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12092 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12094 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12098 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12100 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12102 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12105 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12107 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12109 if (out_pos
== RULES_MAX
- 1)
12111 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12116 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12121 local_free (repeats
);
12125 uint gpu_rules_avail
= 0;
12127 while (gpu_rules_cnt
< rp_gen
)
12129 if (gpu_rules_avail
== gpu_rules_cnt
)
12131 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12133 gpu_rules_avail
+= INCR_RULES
;
12136 memset (rule_buf
, 0, BLOCK_SIZE
);
12138 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12140 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12148 * generate NOP rules
12151 if (gpu_rules_cnt
== 0)
12153 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12155 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12160 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12161 data
.gpu_rules_buf
= gpu_rules_buf
;
12167 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12169 uint CL_platforms_cnt
= 0;
12171 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12173 if (CL_platforms_cnt
== 0)
12175 log_error ("ERROR: No OpenCL compatible platform found");
12180 if (CL_platforms_cnt
> 1)
12182 log_error ("ERROR: Too many OpenCL compatible platforms found");
12187 cl_platform_id CL_platform
= CL_platforms
[0];
12189 char CL_platform_vendor
[INFOSZ
];
12191 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12193 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12197 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12199 vendor_id
= VENDOR_ID_AMD
;
12201 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12203 vendor_id
= VENDOR_ID_NV
;
12207 vendor_id
= VENDOR_ID_UNKNOWN
;
12210 data
.vendor_id
= vendor_id
;
12216 cl_device_id devices_all
[DEVICES_MAX
];
12217 cl_device_id devices
[DEVICES_MAX
];
12219 uint devices_all_cnt
= 0;
12221 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12223 int hm_adapters_all
= devices_all_cnt
;
12225 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12227 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12230 if (gpu_temp_disable == 0)
12232 if (vendor_id == VENDOR_ID_NV)
12235 if (hc_NVML_nvmlInit () == NVML_SUCCESS)
12237 HM_ADAPTER nvGPUHandle[DEVICES_MAX];
12239 int tmp_in = hm_get_adapter_index (nvGPUHandle);
12243 for (int i = 0; i < tmp_in; i++)
12245 hm_adapter_all[tmp_out++].adapter_index = nvGPUHandle[i];
12248 hm_adapters_all = tmp_out;
12250 for (int i = 0; i < tmp_out; i++)
12252 unsigned int speed;
12254 if (nvmlDeviceGetFanSpeed (hm_adapter_all[i].adapter_index, &speed) != NVML_ERROR_NOT_SUPPORTED) hm_adapter_all[i].fan_supported = 1;
12260 if (NvAPI_Initialize () == NVAPI_OK)
12262 HM_ADAPTER nvGPUHandle[DEVICES_MAX];
12264 int tmp_in = hm_get_adapter_index (nvGPUHandle);
12268 for (int i = 0; i < tmp_in; i++)
12270 hm_adapter_all[tmp_out++].adapter_index = nvGPUHandle[i];
12273 hm_adapters_all = tmp_out;
12275 for (int i = 0; i < tmp_out; i++)
12279 if (NvAPI_GPU_GetTachReading (hm_adapter_all[i].adapter_index, &speed) != NVAPI_NOT_SUPPORTED) hm_adapter_all[i].fan_supported = 1;
12285 if (vendor_id == VENDOR_ID_AMD)
12287 HM_LIB hm_dll = hm_init ();
12289 data.hm_dll = hm_dll;
12291 if (hc_ADL_Main_Control_Create (hm_dll, ADL_Main_Memory_Alloc, 0) == ADL_OK)
12293 // total number of adapters
12295 int hm_adapters_num;
12297 if (get_adapters_num (hm_dll, &hm_adapters_num) != 0) return (-1);
12301 LPAdapterInfo lpAdapterInfo = hm_get_adapter_info (hm_dll, hm_adapters_num);
12303 if (lpAdapterInfo == NULL) return (-1);
12305 // get a list (of ids of) valid/usable adapters
12307 int num_adl_adapters = 0;
12309 uint32_t *valid_adl_device_list = hm_get_list_valid_adl_adapters (hm_adapters_num, &num_adl_adapters, lpAdapterInfo);
12311 if (num_adl_adapters > 0)
12313 hc_thread_mutex_lock (mux_adl);
12315 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12317 hm_get_adapter_index (hm_adapter_all, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
12319 hm_get_overdrive_version (hm_dll, hm_adapter_all, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
12320 hm_check_fanspeed_control (hm_dll, hm_adapter_all, valid_adl_device_list, num_adl_adapters, lpAdapterInfo);
12322 hc_thread_mutex_unlock (mux_adl);
12325 hm_adapters_all = num_adl_adapters;
12327 myfree (valid_adl_device_list);
12328 myfree (lpAdapterInfo);
12333 if (hm_adapters_all == 0)
12335 gpu_temp_disable = 1;
12338 if (gpu_temp_disable == 1)
12340 gpu_temp_abort = 0;
12341 gpu_temp_retain = 0;
12346 * enable custom signal handler(s)
12349 if (benchmark
== 0)
12351 hc_signal (sigHandler_default
);
12355 hc_signal (sigHandler_benchmark
);
12359 * devices mask and properties
12362 uint devices_cnt
= 0;
12364 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12366 if (gpu_devicemask
)
12368 uint device_all_id_mask
= 1 << device_all_id
;
12370 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12372 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12378 const uint device_id
= devices_cnt
;
12380 devices
[device_id
] = devices_all
[device_all_id
];
12382 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12384 char device_name
[INFOSZ
];
12386 memset (device_name
, 0, sizeof (device_name
));
12388 cl_ulong global_mem_size
;
12389 cl_uint max_clock_frequency
;
12390 cl_uint max_compute_units
;
12392 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12393 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12394 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12395 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12397 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12399 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12402 (unsigned int) (global_mem_size
/ 1024 / 1024),
12403 (unsigned int) (max_clock_frequency
),
12404 (unsigned int) max_compute_units
);
12410 if (devices_cnt
== 0)
12412 log_error ("ERROR: No devices left that matches your specification.");
12417 data
.devices_cnt
= devices_cnt
;
12419 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12428 // gpu temp sanity check
12430 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12432 if (gpu_temp_abort
< gpu_temp_retain
)
12434 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12440 data
.gpu_temp_disable
= gpu_temp_disable
;
12441 data
.gpu_temp_abort
= gpu_temp_abort
;
12442 data
.gpu_temp_retain
= gpu_temp_retain
;
12444 if (data
.quiet
== 0)
12446 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12448 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
);
12450 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12452 log_info ("Rules: %u", gpu_rules_cnt
);
12457 log_info ("Applicable Optimizers:");
12459 for (uint i
= 0; i
< 32; i
++)
12461 const uint opti_bit
= 1 << i
;
12463 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12468 * Watchdog and Temperature balance
12471 if (gpu_temp_abort
== 0)
12473 log_info ("Watchdog: Temperature abort trigger disabled");
12477 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12480 if (gpu_temp_retain
== 0)
12482 log_info ("Watchdog: Temperature retain trigger disabled");
12486 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12494 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12496 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12498 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12500 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12502 data
.devices_param
= devices_param
;
12504 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12506 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12508 cl_device_id device
= devices
[device_id
];
12510 device_param
->device
= device
;
12512 cl_uint max_compute_units
= 0;
12514 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12516 device_param
->gpu_processors
= max_compute_units
;
12518 cl_ulong max_mem_alloc_size
= 0;
12520 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12522 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12524 char tmp
[INFOSZ
], t1
[64];
12526 memset (tmp
, 0, sizeof (tmp
));
12528 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12530 device_param
->device_name
= mystrdup (tmp
);
12532 memset (tmp
, 0, sizeof (tmp
));
12534 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12536 memset (t1
, 0, sizeof (t1
));
12538 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12540 device_param
->device_version
= mystrdup (t1
);
12542 memset (tmp
, 0, sizeof (tmp
));
12544 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12546 device_param
->driver_version
= mystrdup (tmp
);
12548 if (vendor_id
== VENDOR_ID_NV
)
12550 cl_uint sm_minor
= 0;
12551 cl_uint sm_major
= 0;
12553 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12554 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12556 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12557 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12559 device_param
->sm_minor
= sm_minor
;
12560 device_param
->sm_major
= sm_major
;
12564 * catalyst driver check
12567 if (vendor_id
== VENDOR_ID_AMD
)
12569 int catalyst_check
= (force
== 1) ? 0 : 1;
12571 int catalyst_warn
= 0;
12573 int catalyst_broken
= 0;
12575 if (catalyst_check
== 1)
12579 // v14.9 and higher
12580 if ((atoi (device_param
->device_version
) >= 1573)
12581 && (atoi (device_param
->driver_version
) >= 1573))
12588 if ((strstr (device_param->device_version, "1573.") != NULL)
12589 && (strstr (device_param->driver_version, "1573.") != NULL))
12594 // v14.12 -- version overlaps with v15.4 beta
12595 if ((strstr (device_param->device_version, "1642.") != NULL)
12596 && (strstr (device_param->driver_version, "1642.") != NULL))
12598 catalyst_broken = 1;
12601 // v15.4 (Beta, Windows only release)
12602 if ((strstr (device_param->device_version, "1642.") != NULL)
12603 && (strstr (device_param->driver_version, "1642.") != NULL))
12608 // v15.5 (Release, Linux)
12609 if ((strstr (device_param->device_version, "1702.") != NULL)
12610 && (strstr (device_param->driver_version, "1702.") != NULL))
12615 // v15.3 (Beta, Ubuntu repository release)
12616 if ((strstr (device_param->device_version, "1729.") != NULL)
12617 && (strstr (device_param->driver_version, "1729.") != NULL))
12623 catalyst_check
= 0;
12626 if (catalyst_broken
== 1)
12629 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12630 log_error ("It will pass over cracked hashes and does not report them as cracked");
12631 log_error ("You are STRONGLY encouraged not to use it");
12632 log_error ("You can use --force to override this but do not post error reports if you do so");
12637 if (catalyst_warn
== 1)
12640 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12641 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12642 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12644 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12646 log_error ("You can use --force to override this but do not post error reports if you do so");
12655 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12656 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12657 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12658 * Driver / ADL bug?
12662 if (vendor_id == VENDOR_ID_AMD)
12664 if (powertune_enable == 1)
12666 hc_thread_mutex_lock (mux_adl);
12668 for (uint i = 0; i < devices_cnt; i++)
12670 if (data.hm_device[i].od_version == 6)
12672 // set powertune value only
12674 int powertune_supported = 0;
12678 if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll, data.hm_device[i].adapter_index, &powertune_supported)) != ADL_OK)
12680 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12685 if (powertune_supported != 0)
12688 ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
12690 if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.hm_dll, data.hm_device[i].adapter_index, &powertune)) != ADL_OK)
12692 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12697 if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.hm_dll, data.hm_device[i].adapter_index, powertune.iMaxValue)) != ADL_OK)
12699 log_error ("ERROR: Failed to set new ADL PowerControl values");
12707 hc_thread_mutex_unlock (mux_adl);
12712 uint gpu_blocks_all
= 0;
12714 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12720 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12723 * device properties
12726 char *device_name
= device_param
->device_name
;
12727 char *device_version
= device_param
->device_version
;
12728 char *driver_version
= device_param
->driver_version
;
12730 uint gpu_processors
= device_param
->gpu_processors
;
12733 * create context for each device
12736 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12739 * create command-queue
12742 // not support with NV
12743 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12745 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12748 * create input buffers on device
12751 uint gpu_threads
= GPU_THREADS
;
12753 if (hash_mode
== 3200) gpu_threads
= 8;
12754 if (hash_mode
== 9000) gpu_threads
= 8;
12756 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12757 uint gpu_blocks
= gpu_power
;
12759 device_param
->gpu_threads
= gpu_threads
;
12760 device_param
->gpu_power_user
= gpu_power
;
12761 device_param
->gpu_blocks_user
= gpu_blocks
;
12763 gpu_blocks_all
+= gpu_blocks
;
12765 uint size_pws
= gpu_power
* sizeof (pw_t
);
12767 uint size_tmps
= 4;
12771 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12772 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12773 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12774 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12775 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12776 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12777 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12778 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12779 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12780 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12783 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12786 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12789 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12792 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12793 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12794 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12795 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12796 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12797 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12798 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12799 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12800 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12801 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12802 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12803 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12804 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12805 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12806 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12807 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12808 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12809 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12810 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12811 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12812 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12813 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12814 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12815 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12816 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12817 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12818 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12819 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12820 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12821 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12822 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12823 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12824 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12825 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12826 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12827 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12828 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12829 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12832 uint size_hooks
= 4;
12834 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12836 // insert correct hook size
12839 // we can optimize some stuff here...
12841 device_param
->size_pws
= size_pws
;
12842 device_param
->size_tmps
= size_tmps
;
12843 device_param
->size_hooks
= size_hooks
;
12845 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12846 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12848 device_param
->size_root_css
= size_root_css
;
12849 device_param
->size_markov_css
= size_markov_css
;
12851 uint size_results
= GPU_THREADS
* sizeof (uint
);
12853 device_param
->size_results
= size_results
;
12855 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12856 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12857 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12858 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12859 uint size_esalts
= salts_cnt
* esalt_size
;
12861 device_param
->size_plains
= size_plains
;
12862 device_param
->size_digests
= size_digests
;
12863 device_param
->size_shown
= size_shown
;
12864 device_param
->size_salts
= size_salts
;
12866 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12867 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12868 uint size_tm
= 32 * sizeof (bs_word_t
);
12870 uint64_t size_scryptV
= 1;
12872 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12874 #define SHADER_PER_MP 8
12875 #define WAVEFRONTS 64
12877 uint tmto_start
= 2;
12878 uint tmto_stop
= 1024;
12882 tmto_start
= 1 << scrypt_tmto
;
12883 tmto_stop
= tmto_start
+ 1;
12886 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
<<= 1)
12888 // todo -- make sure all salts get the new tmto value
12890 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
12892 size_scryptV
/= tmto
;
12894 size_scryptV
*= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12896 if (size_scryptV
> (device_param
->gpu_maxmem_alloc
/ 2)) continue;
12898 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
12900 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
12901 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12907 if (data
.salts_buf
[0].scrypt_tmto
== 0)
12909 log_error ("ERROR: can't allocate enough GPU memory");
12914 if (quiet
== 0) log_info ("");
12915 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
12922 char build_opts
[100];
12924 // we don't have sm_* on AMD but it doesn't matter
12926 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
12930 char kernel_file
[256];
12932 memset (kernel_file
, 0, sizeof (kernel_file
));
12934 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
12936 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
12938 #ifdef BINARY_KERNEL
12939 if (force_jit_compilation
== 0)
12941 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12943 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12944 snprintf (kernel_file
, sizeof (kernel_file
) - 1, "%s/kernels/4098/m%05d_a0.%s_%s_%s_%d.kernel", install_dir
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
12945 else if (attack_kern
== ATTACK_KERN_COMBI
)
12946 snprintf (kernel_file
, sizeof (kernel_file
) - 1, "%s/kernels/4098/m%05d_a1.%s_%s_%s_%d.kernel", install_dir
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
12947 else if (attack_kern
== ATTACK_KERN_BF
)
12948 snprintf (kernel_file
, sizeof (kernel_file
) - 1, "%s/kernels/4098/m%05d_a3.%s_%s_%s_%d.kernel", install_dir
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
12952 snprintf (kernel_file
, sizeof (kernel_file
) - 1, "%s/kernels/4098/m%05d.%s_%s_%s_%d.kernel", install_dir
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
12954 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12956 snprintf (kernel_file
, sizeof (kernel_file
) - 1, "%s/kernels/4098/m%05d_%d_%d_%d_%d.%s_%s_%s_%d.kernel", install_dir
, (int) kern_type
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, data
.salts_buf
[0].scrypt_tmto
, device_name
, device_version
, driver_version
, COMPTIME
);
12960 if (stat (kernel_file
, &st
) == -1)
12962 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_file
);
12964 char module_file
[256];
12966 memset (module_file
, 0, sizeof (module_file
));
12968 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12970 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12971 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a0.llvmir", install_dir
, (int) kern_type
);
12972 else if (attack_kern
== ATTACK_KERN_COMBI
)
12973 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a1.llvmir", install_dir
, (int) kern_type
);
12974 else if (attack_kern
== ATTACK_KERN_BF
)
12975 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a3.llvmir", install_dir
, (int) kern_type
);
12979 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d.llvmir", install_dir
, (int) kern_type
);
12981 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12983 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_%d_%d_%d_%d.llvmir", install_dir
, (int) kern_type
, data
.salts_buf
[0].scrypt_N
, data
.salts_buf
[0].scrypt_r
, data
.salts_buf
[0].scrypt_p
, data
.salts_buf
[0].scrypt_tmto
);
12987 load_kernel (module_file
, 1, kernel_lengths
, kernel_sources
);
12989 cl_program program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
12991 local_free (kernel_sources
[0]);
12993 hc_clBuildProgram (program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
12995 size_t binary_size
;
12997 clGetProgramInfo (program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
12999 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13001 clGetProgramInfo (program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13003 writeProgramBin (kernel_file
, binary
, binary_size
);
13005 local_free (binary
);
13007 stat (kernel_file
, &st
); // to reload filesize
13012 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13014 if (stat (kernel_file
, &st
) == -1)
13016 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13024 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13026 if (stat (kernel_file
, &st
) == -1)
13028 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13035 load_kernel (kernel_file
, 1, kernel_lengths
, kernel_sources
);
13037 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_file
, st
.st_size
);
13039 #ifdef BINARY_KERNEL
13040 if (force_jit_compilation
== 0)
13042 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13046 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13049 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13052 local_free (kernel_lengths
);
13054 local_free (kernel_sources
[0]);
13056 local_free (kernel_sources
)
13062 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13064 char kernel_mp_file
[256];
13066 memset (kernel_mp_file
, 0, sizeof (kernel_mp_file
));
13068 size_t *kernel_mp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13070 const unsigned char **kernel_mp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13072 #ifdef BINARY_KERNEL
13073 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13075 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/kernels/4098/markov_be.%s_%s_%s_%d.kernel", install_dir
, device_name
, device_version
, driver_version
, COMPTIME
);
13079 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/kernels/4098/markov_le.%s_%s_%s_%d.kernel", install_dir
, device_name
, device_version
, driver_version
, COMPTIME
);
13082 if (stat (kernel_mp_file
, &st
) == -1)
13084 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_mp_file
);
13086 char module_mp_file
[256];
13088 memset (module_mp_file
, 0, sizeof (module_mp_file
));
13090 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13092 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_be.llvmir", install_dir
);
13096 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_le.llvmir", install_dir
);
13099 load_kernel (module_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13101 cl_program program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13103 local_free (kernel_mp_sources
[0]);
13105 hc_clBuildProgram (program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13107 size_t binary_mp_size
;
13109 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_mp_size
, NULL
);
13111 unsigned char *binary_mp
= (unsigned char *) mymalloc (binary_mp_size
);
13113 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary_mp
), &binary_mp
, NULL
);
13115 writeProgramBin (kernel_mp_file
, binary_mp
, binary_mp_size
);
13117 local_free (binary_mp
);
13119 stat (kernel_mp_file
, &st
); // to reload filesize
13123 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13125 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_be.cl", install_dir
);
13129 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_le.cl", install_dir
);
13132 if (stat (kernel_mp_file
, &st
) == -1)
13134 log_error ("ERROR: %s: %s", kernel_mp_file
, strerror (errno
));
13141 load_kernel (kernel_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13143 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_mp_file
, st
.st_size
);
13145 #ifdef BINARY_KERNEL
13146 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13148 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_mp_sources
, NULL
);
13151 local_free (kernel_mp_lengths
);
13153 local_free (kernel_mp_sources
[0]);
13155 local_free (kernel_mp_sources
);
13162 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13168 char kernel_amp_file
[256];
13170 memset (kernel_amp_file
, 0, sizeof (kernel_amp_file
));
13172 size_t *kernel_amp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13174 const unsigned char **kernel_amp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13176 #ifdef BINARY_KERNEL
13177 snprintf (kernel_amp_file
, sizeof (kernel_amp_file
) - 1, "%s/kernels/4098/amp_a%d.%s_%s_%s_%d.kernel", install_dir
, attack_kern
, device_name
, device_version
, driver_version
, COMPTIME
);
13179 if (stat (kernel_amp_file
, &st
) == -1)
13181 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_amp_file
);
13183 char module_amp_file
[256];
13185 memset (module_amp_file
, 0, sizeof (module_amp_file
));
13187 snprintf (module_amp_file
, sizeof (module_amp_file
) - 1, "%s/kernels/4098/amp_a%d.llvmir", install_dir
, attack_kern
);
13189 load_kernel (module_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13191 cl_program program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13193 local_free (kernel_amp_sources
[0]);
13195 hc_clBuildProgram (program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13197 size_t binary_amp_size
;
13199 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_amp_size
, NULL
);
13201 unsigned char *binary_amp
= (unsigned char *) mymalloc (binary_amp_size
);
13203 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary_amp
), &binary_amp
, NULL
);
13205 writeProgramBin (kernel_amp_file
, binary_amp
, binary_amp_size
);
13207 local_free (binary_amp
);
13209 stat (kernel_amp_file
, &st
); // to reload filesize
13212 snprintf (kernel_amp_file
, sizeof (kernel_amp_file
) - 1, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
13214 if (stat (kernel_amp_file
, &st
) == -1)
13216 log_error ("ERROR: %s: %s", kernel_amp_file
, strerror (errno
));
13222 load_kernel (kernel_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13224 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_amp_file
, st
.st_size
);
13226 #ifdef BINARY_KERNEL
13227 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13229 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_amp_sources
, NULL
);
13232 local_free (kernel_amp_lengths
);
13234 local_free (kernel_amp_sources
[0]);
13236 local_free (kernel_amp_sources
);
13243 #ifdef BINARY_KERNEL
13245 if (force_jit_compilation
== 0)
13249 else if (force_jit_compilation
== 1500)
13251 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13253 else if (force_jit_compilation
== 8900)
13255 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
, data
.salts_buf
[0].scrypt_tmto
);
13260 clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13262 size_t ret_val_size
= 0;
13264 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13266 if (ret_val_size
> 1)
13268 char *build_log
= (char *) malloc (ret_val_size
+ 1);
13270 memset (build_log
, 0, ret_val_size
+ 1);
13272 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13279 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13281 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13284 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13290 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13294 * amp is not independent
13297 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13303 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13310 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13311 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13312 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13313 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13314 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13315 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13316 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13317 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13318 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13319 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13320 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13321 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13322 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13323 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13324 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13325 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13326 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13327 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13329 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13330 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13331 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13332 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13333 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13334 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13335 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13336 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13337 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13338 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13339 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13341 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13342 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13343 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13344 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13345 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13346 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13352 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13354 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13355 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13357 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13359 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13361 else if (attack_kern
== ATTACK_KERN_COMBI
)
13363 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13364 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13365 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13366 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13368 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13369 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13370 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13371 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13373 else if (attack_kern
== ATTACK_KERN_BF
)
13375 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13376 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13377 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13378 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13379 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13381 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13382 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13383 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13384 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13385 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13390 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13392 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13399 uint
*result
= (uint
*) mymalloc (size_results
);
13401 memset (result
, 0, size_results
);
13403 device_param
->result
= result
;
13405 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13407 memset (pws_buf
, 0, size_pws
);
13409 device_param
->pws_buf
= pws_buf
;
13411 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13413 for (int i
= 0; i
< 64; i
++)
13415 pw_caches
[i
].pw_buf
.pw_len
= i
;
13416 pw_caches
[i
].cnt
= 0;
13419 device_param
->pw_caches
= pw_caches
;
13421 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13423 device_param
->combs_buf
= combs_buf
;
13425 void *hooks_buf
= mymalloc (size_hooks
);
13427 device_param
->hooks_buf
= hooks_buf
;
13429 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13430 device_param
->pw_add
= pw_add_to_hc1
;
13436 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13437 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13438 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13439 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13440 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13441 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13442 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13443 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13444 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13445 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13446 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13448 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13449 ? &device_param
->d_pws_buf
13450 : &device_param
->d_pws_amp_buf
;
13451 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13452 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13453 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13454 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13455 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13456 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13457 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13458 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13459 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13460 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13461 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13462 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13463 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13464 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13465 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13466 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13467 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13468 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13469 device_param
->kernel_params
[19] = &device_param
->d_result
;
13470 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13471 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13472 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13473 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13474 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13475 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13476 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13477 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13478 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13479 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13480 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13481 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13483 device_param
->kernel_params_mp_buf64
[3] = 0;
13484 device_param
->kernel_params_mp_buf32
[4] = 0;
13485 device_param
->kernel_params_mp_buf32
[5] = 0;
13486 device_param
->kernel_params_mp_buf32
[6] = 0;
13487 device_param
->kernel_params_mp_buf32
[7] = 0;
13488 device_param
->kernel_params_mp_buf32
[8] = 0;
13490 device_param
->kernel_params_mp
[0] = NULL
;
13491 device_param
->kernel_params_mp
[1] = NULL
;
13492 device_param
->kernel_params_mp
[2] = NULL
;
13493 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13494 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13495 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13496 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13497 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13498 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13500 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13501 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13502 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13503 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13504 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13505 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13506 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13508 device_param
->kernel_params_mp_l
[0] = NULL
;
13509 device_param
->kernel_params_mp_l
[1] = NULL
;
13510 device_param
->kernel_params_mp_l
[2] = NULL
;
13511 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13512 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13513 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13514 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13515 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13516 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13517 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13519 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13520 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13521 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13522 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13523 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13524 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13526 device_param
->kernel_params_mp_r
[0] = NULL
;
13527 device_param
->kernel_params_mp_r
[1] = NULL
;
13528 device_param
->kernel_params_mp_r
[2] = NULL
;
13529 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13530 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13531 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13532 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13533 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13534 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13536 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13537 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13539 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13540 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13541 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13542 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13543 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13544 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13545 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13547 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13549 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13550 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13556 char kernel_name
[64];
13558 memset (kernel_name
, 0, sizeof (kernel_name
));
13560 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13562 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13564 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13566 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13568 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13570 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13572 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13574 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13578 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13580 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13582 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13584 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13586 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13588 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13591 if (data
.attack_mode
== ATTACK_MODE_BF
)
13593 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13595 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13597 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13599 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13601 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13607 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13609 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13611 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13613 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13615 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13617 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13619 if (opts_type
& OPTS_TYPE_HOOK12
)
13621 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13623 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13626 if (opts_type
& OPTS_TYPE_HOOK23
)
13628 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13630 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13634 for (uint i
= 0; i
<= 20; i
++)
13636 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13637 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13638 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13640 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13641 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13644 for (uint i
= 21; i
<= 31; i
++)
13646 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13647 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13648 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13650 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13651 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13654 if (attack_mode
== ATTACK_MODE_BF
)
13656 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13657 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13659 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13661 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13663 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13664 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13667 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13669 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13671 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13673 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13676 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13682 for (uint i
= 0; i
< 5; i
++)
13684 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13687 for (uint i
= 5; i
< 7; i
++)
13689 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13694 * Store initial fanspeed if gpu_temp_retain is enabled
13697 int gpu_temp_retain_set
= 0;
13700 if (gpu_temp_disable == 0)
13702 if (gpu_temp_retain != 0)
13704 hc_thread_mutex_lock (mux_adl);
13706 if (data.hm_device[device_id].fan_supported == 1)
13708 if (gpu_temp_retain_chgd == 0)
13711 uint default_temp = 0;
13713 int ADL_rc = hc_ADL_Overdrive6_TargetTemperatureData_Get (data.hm_dll, data.hm_device[device_id].adapter_index, (int *) &cur_temp, (int *) &default_temp);
13715 if (ADL_rc == ADL_OK)
13717 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13719 const uint gpu_temp_retain_target = default_temp - GPU_TEMP_RETAIN_ABORT_DIFF;
13721 // special case with multi gpu setups: always use minimum retain
13723 if (gpu_temp_retain_set == 0)
13725 gpu_temp_retain = gpu_temp_retain_target;
13726 gpu_temp_retain_set = 1;
13730 gpu_temp_retain = MIN (gpu_temp_retain, gpu_temp_retain_target);
13733 if (gpu_temp_abort_chgd == 0) gpu_temp_abort = gpu_temp_retain + GPU_TEMP_RETAIN_ABORT_DIFF;
13737 const int fan_speed = hm_get_fanspeed_with_device_id (device_id);
13739 temp_retain_fanspeed_value[device_id] = fan_speed;
13741 if (fan_speed == -1)
13743 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id + 1);
13745 temp_retain_fanspeed_value[device_id] = 0;
13749 hc_thread_mutex_unlock (mux_adl);
13755 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13759 if (powertune_enable == 1)
13761 hc_thread_mutex_lock (mux_adl);
13763 if (data.hm_device[device_id].od_version == 6)
13767 // check powertune capabilities first, if not available then skip device
13769 int powertune_supported = 0;
13771 if ((ADL_rc = hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll, data.hm_device[device_id].adapter_index, &powertune_supported)) != ADL_OK)
13773 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13778 if (powertune_supported != 0)
13780 // powercontrol settings
13782 ADLOD6PowerControlInfo powertune = {0, 0, 0, 0, 0};
13784 if ((ADL_rc = hc_ADL_Overdrive_PowerControlInfo_Get (data.hm_dll, data.hm_device[device_id].adapter_index, &powertune)) == ADL_OK)
13786 ADL_rc = hc_ADL_Overdrive_PowerControl_Get (data.hm_dll, data.hm_device[device_id].adapter_index, &od_power_control_status[device_id]);
13789 if (ADL_rc != ADL_OK)
13791 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13796 if ((ADL_rc = hc_ADL_Overdrive_PowerControl_Set (data.hm_dll, data.hm_device[device_id].adapter_index, powertune.iMaxValue)) != ADL_OK)
13798 log_error ("ERROR: Failed to set new ADL PowerControl values");
13805 memset (&od_clock_mem_status[device_id], 0, sizeof (ADLOD6MemClockState));
13807 od_clock_mem_status[device_id].state.iNumberOfPerformanceLevels = 2;
13809 if ((ADL_rc = hc_ADL_Overdrive_StateInfo_Get (data.hm_dll, data.hm_device[device_id].adapter_index, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE, &od_clock_mem_status[device_id])) != ADL_OK)
13811 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13816 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13818 ADLOD6Capabilities caps = {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13820 if ((ADL_rc = hc_ADL_Overdrive_Capabilities_Get (data.hm_dll, data.hm_device[device_id].adapter_index, &caps)) != ADL_OK)
13822 log_error ("ERROR: Failed to get ADL device capabilities");
13827 int engine_clock_max = caps.sEngineClockRange.iMax * 0.6666;
13828 int memory_clock_max = caps.sMemoryClockRange.iMax * 0.6250;
13830 int warning_trigger_engine = (int) (0.25 * (float) engine_clock_max);
13831 int warning_trigger_memory = (int) (0.25 * (float) memory_clock_max);
13833 int engine_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iEngineClock;
13834 int memory_clock_profile_max = od_clock_mem_status[device_id].state.aLevels[1].iMemoryClock;
13836 // warning if profile has to low max values
13838 if ((engine_clock_max - engine_clock_profile_max) > warning_trigger_engine)
13840 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13843 if ((memory_clock_max - memory_clock_profile_max) > warning_trigger_memory)
13845 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13848 ADLOD6StateInfo *performance_state = (ADLOD6StateInfo*) mycalloc (1, sizeof (ADLOD6StateInfo) + sizeof (ADLOD6PerformanceLevel));
13850 performance_state->iNumberOfPerformanceLevels = 2;
13852 performance_state->aLevels[0].iEngineClock = engine_clock_profile_max;
13853 performance_state->aLevels[1].iEngineClock = engine_clock_profile_max;
13854 performance_state->aLevels[0].iMemoryClock = memory_clock_profile_max;
13855 performance_state->aLevels[1].iMemoryClock = memory_clock_profile_max;
13857 if ((ADL_rc = hc_ADL_Overdrive_State_Set (data.hm_dll, data.hm_device[device_id].adapter_index, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
13859 log_info ("ERROR: Failed to set ADL performance state");
13864 local_free (performance_state);
13868 hc_thread_mutex_unlock (mux_adl);
13873 data
.gpu_blocks_all
= gpu_blocks_all
;
13875 if (data
.quiet
== 0) log_info ("");
13878 * Inform user which algorithm is checked and at which workload setting
13881 if (benchmark
== 1)
13885 data
.quiet
= quiet
;
13887 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
13889 log_info ("Hashtype: %s", hash_type
);
13890 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
13895 * keep track of the progress
13898 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13899 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13900 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13907 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
13909 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
13914 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
13916 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
13921 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
13923 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
13933 segment_size
*= (1024 * 1024);
13935 data
.segment_size
= segment_size
;
13937 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
13939 wl_data
->buf
= (char *) mymalloc (segment_size
);
13940 wl_data
->avail
= segment_size
;
13941 wl_data
->incr
= segment_size
;
13945 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
13947 data
.wordlist_mode
= wordlist_mode
;
13949 cs_t
*css_buf
= NULL
;
13953 char **masks
= NULL
;
13954 char **dictfiles
= NULL
;
13956 uint mask_from_file
= 0;
13958 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13960 if (wordlist_mode
== WL_MODE_FILE
)
13962 int wls_left
= myargc
- (optind
+ 1);
13964 for (int i
= 0; i
< wls_left
; i
++)
13966 char *l0_filename
= myargv
[optind
+ 1 + i
];
13968 struct stat l0_stat
;
13970 if (stat (l0_filename
, &l0_stat
) == -1)
13972 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
13977 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
13981 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
13985 dictfiles
[dictcnt
- 1] = l0_filename
;
13989 // do not allow --keyspace w/ a directory
13993 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
13998 char **dictionary_files
= NULL
;
14000 dictionary_files
= scan_directory (l0_filename
);
14002 if (dictionary_files
!= NULL
)
14004 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14006 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14008 char *l1_filename
= dictionary_files
[d
];
14010 struct stat l1_stat
;
14012 if (stat (l1_filename
, &l1_stat
) == -1)
14014 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14019 if (S_ISREG (l1_stat
.st_mode
))
14021 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14025 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14030 local_free (dictionary_files
);
14036 log_error ("ERROR: No usable dictionary file found.");
14041 else if (wordlist_mode
== WL_MODE_STDIN
)
14046 else if (attack_mode
== ATTACK_MODE_COMBI
)
14050 char *dictfile1
= myargv
[optind
+ 1 + 0];
14051 char *dictfile2
= myargv
[optind
+ 1 + 1];
14053 // find the bigger dictionary and use as base
14058 struct stat tmp_stat
;
14060 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14062 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14067 if (stat (dictfile1
, &tmp_stat
) == -1)
14069 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14076 if (S_ISDIR (tmp_stat
.st_mode
))
14078 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14085 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14087 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14094 if (stat (dictfile2
, &tmp_stat
) == -1)
14096 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14104 if (S_ISDIR (tmp_stat
.st_mode
))
14106 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14114 data
.combs_cnt
= 1;
14118 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14120 data
.quiet
= quiet
;
14122 if (words1_cnt
== 0)
14124 log_error ("ERROR: %s: empty file", dictfile1
);
14132 data
.combs_cnt
= 1;
14136 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14138 data
.quiet
= quiet
;
14140 if (words2_cnt
== 0)
14142 log_error ("ERROR: %s: empty file", dictfile2
);
14153 data
.dictfile
= dictfile1
;
14154 data
.dictfile2
= dictfile2
;
14156 if (words1_cnt
>= words2_cnt
)
14158 data
.combs_cnt
= words2_cnt
;
14159 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14161 dictfiles
= &data
.dictfile
;
14167 data
.combs_cnt
= words1_cnt
;
14168 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14170 dictfiles
= &data
.dictfile2
;
14174 // we also have to switch wordlist related rules!
14176 char *tmpc
= data
.rule_buf_l
;
14178 data
.rule_buf_l
= data
.rule_buf_r
;
14179 data
.rule_buf_r
= tmpc
;
14181 int tmpi
= data
.rule_len_l
;
14183 data
.rule_len_l
= data
.rule_len_r
;
14184 data
.rule_len_r
= tmpi
;
14187 else if (attack_mode
== ATTACK_MODE_BF
)
14193 if (benchmark
== 0)
14195 mask
= myargv
[optind
+ 1];
14197 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14199 if ((optind
+ 2) <= myargc
)
14201 struct stat file_stat
;
14203 if (stat (mask
, &file_stat
) == -1)
14207 masks
[maskcnt
- 1] = mystrdup (mask
);
14211 int wls_left
= myargc
- (optind
+ 1);
14213 uint masks_avail
= INCR_MASKS
;
14215 for (int i
= 0; i
< wls_left
; i
++)
14219 mask
= myargv
[optind
+ 1 + i
];
14221 if (stat (mask
, &file_stat
) == -1)
14223 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14229 uint is_file
= S_ISREG (file_stat
.st_mode
);
14235 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14237 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14242 char line_buf
[BUFSIZ
];
14244 while (!feof (mask_fp
))
14246 memset (line_buf
, 0, BUFSIZ
);
14248 int line_len
= fgetl (mask_fp
, line_buf
);
14250 if (line_len
== 0) continue;
14252 if (line_buf
[0] == '#') continue;
14254 if (masks_avail
== maskcnt
)
14256 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14258 masks_avail
+= INCR_MASKS
;
14261 masks
[maskcnt
] = mystrdup (line_buf
);
14270 log_error ("ERROR: %s: unsupported file-type", mask
);
14276 mask_from_file
= 1;
14281 custom_charset_1
= (char *) "?l?d?u";
14282 custom_charset_2
= (char *) "?l?d";
14283 custom_charset_3
= (char *) "?l?d*!$@_";
14285 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14286 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14287 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14289 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14291 wordlist_mode
= WL_MODE_MASK
;
14293 data
.wordlist_mode
= wordlist_mode
;
14303 * generate full masks and charsets
14306 masks
= (char **) mymalloc (sizeof (char *));
14310 case 1731: pw_min
= 5;
14312 mask
= mystrdup ("?b?b?b?b?b");
14314 case 12500: pw_min
= 5;
14316 mask
= mystrdup ("?b?b?b?b?b");
14318 default: pw_min
= 7;
14320 mask
= mystrdup ("?b?b?b?b?b?b?b");
14326 masks
[maskcnt
- 1] = mystrdup (mask
);
14328 wordlist_mode
= WL_MODE_MASK
;
14330 data
.wordlist_mode
= wordlist_mode
;
14335 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14339 if (increment_min
> pw_min
) pw_min
= increment_min
;
14341 if (increment_max
< pw_max
) pw_max
= increment_max
;
14344 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14346 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14350 char *mask
= myargv
[myargc
- 1];
14354 masks
= (char **) mymalloc (1 * sizeof (char *));
14358 struct stat file_stat
;
14360 if (stat (mask
, &file_stat
) == -1)
14364 masks
[maskcnt
- 1] = mystrdup (mask
);
14368 uint is_file
= S_ISREG (file_stat
.st_mode
);
14374 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14376 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14381 char line_buf
[BUFSIZ
];
14383 uint masks_avail
= 1;
14385 while (!feof (mask_fp
))
14387 memset (line_buf
, 0, BUFSIZ
);
14389 int line_len
= fgetl (mask_fp
, line_buf
);
14391 if (line_len
== 0) continue;
14393 if (line_buf
[0] == '#') continue;
14395 if (masks_avail
== maskcnt
)
14397 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14399 masks_avail
+= INCR_MASKS
;
14402 masks
[maskcnt
] = mystrdup (line_buf
);
14409 mask_from_file
= 1;
14415 masks
[maskcnt
- 1] = mystrdup (mask
);
14421 int wls_left
= myargc
- (optind
+ 2);
14423 for (int i
= 0; i
< wls_left
; i
++)
14425 char *filename
= myargv
[optind
+ 1 + i
];
14427 struct stat file_stat
;
14429 if (stat (filename
, &file_stat
) == -1)
14431 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14436 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14440 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14444 dictfiles
[dictcnt
- 1] = filename
;
14448 // do not allow --keyspace w/ a directory
14452 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14457 char **dictionary_files
= NULL
;
14459 dictionary_files
= scan_directory (filename
);
14461 if (dictionary_files
!= NULL
)
14463 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14465 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14467 char *l1_filename
= dictionary_files
[d
];
14469 struct stat l1_stat
;
14471 if (stat (l1_filename
, &l1_stat
) == -1)
14473 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14478 if (S_ISREG (l1_stat
.st_mode
))
14480 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14484 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14489 local_free (dictionary_files
);
14495 log_error ("ERROR: No usable dictionary file found.");
14504 uint mask_min
= increment_min
; // we can't reject smaller masks here
14505 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14507 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14509 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14511 if (cur_mask
== NULL
) break;
14513 masks
[maskcnt
] = cur_mask
;
14517 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14521 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14523 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14527 char *mask
= myargv
[optind
+ 1 + 0];
14531 masks
= (char **) mymalloc (1 * sizeof (char *));
14535 struct stat file_stat
;
14537 if (stat (mask
, &file_stat
) == -1)
14541 masks
[maskcnt
- 1] = mystrdup (mask
);
14545 uint is_file
= S_ISREG (file_stat
.st_mode
);
14551 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14553 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14558 char line_buf
[BUFSIZ
];
14560 uint masks_avail
= 1;
14562 while (!feof (mask_fp
))
14564 memset (line_buf
, 0, BUFSIZ
);
14566 int line_len
= fgetl (mask_fp
, line_buf
);
14568 if (line_len
== 0) continue;
14570 if (line_buf
[0] == '#') continue;
14572 if (masks_avail
== maskcnt
)
14574 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14576 masks_avail
+= INCR_MASKS
;
14579 masks
[maskcnt
] = mystrdup (line_buf
);
14586 mask_from_file
= 1;
14592 masks
[maskcnt
- 1] = mystrdup (mask
);
14598 int wls_left
= myargc
- (optind
+ 2);
14600 for (int i
= 0; i
< wls_left
; i
++)
14602 char *filename
= myargv
[optind
+ 2 + i
];
14604 struct stat file_stat
;
14606 if (stat (filename
, &file_stat
) == -1)
14608 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14613 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14617 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14621 dictfiles
[dictcnt
- 1] = filename
;
14625 // do not allow --keyspace w/ a directory
14629 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14634 char **dictionary_files
= NULL
;
14636 dictionary_files
= scan_directory (filename
);
14638 if (dictionary_files
!= NULL
)
14640 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14642 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14644 char *l1_filename
= dictionary_files
[d
];
14646 struct stat l1_stat
;
14648 if (stat (l1_filename
, &l1_stat
) == -1)
14650 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14655 if (S_ISREG (l1_stat
.st_mode
))
14657 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14661 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14666 local_free (dictionary_files
);
14672 log_error ("ERROR: No usable dictionary file found.");
14681 uint mask_min
= increment_min
; // we can't reject smaller masks here
14682 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14684 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14686 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14688 if (cur_mask
== NULL
) break;
14690 masks
[maskcnt
] = cur_mask
;
14694 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14699 data
.pw_min
= pw_min
;
14700 data
.pw_max
= pw_max
;
14706 if (weak_hash_threshold
>= salts_cnt
)
14708 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14710 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14712 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14716 // Display hack, guarantee that there is at least one \r before real start
14718 if (data
.quiet
== 0) log_info_nn ("");
14721 * status and monitor threads
14724 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14726 hc_thread_t i_thread
= 0;
14728 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14730 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14733 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14735 uint ni_threads_cnt
= 0;
14737 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14739 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14749 if (outfile_check_timer
!= 0)
14751 if (data
.outfile_check_directory
!= NULL
)
14753 if ((hash_mode
!= 5200) &&
14754 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14755 (hash_mode
!= 9000))
14757 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14763 outfile_check_timer
= 0;
14768 outfile_check_timer
= 0;
14774 * Inform the user if we got some hashes remove because of the pot file remove feature
14777 if (data
.quiet
== 0)
14779 if (potfile_remove_cracks
> 0)
14781 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14782 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14786 data
.outfile_check_timer
= outfile_check_timer
;
14792 char **induction_dictionaries
= NULL
;
14794 int induction_dictionaries_cnt
= 0;
14796 hcstat_table_t
*root_table_buf
= NULL
;
14797 hcstat_table_t
*markov_table_buf
= NULL
;
14799 uint initial_restore_done
= 0;
14801 data
.maskcnt
= maskcnt
;
14803 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14805 if (data
.devices_status
== STATUS_CRACKED
) break;
14807 data
.devices_status
= STATUS_INIT
;
14809 if (maskpos
> rd
->maskpos
)
14814 rd
->maskpos
= maskpos
;
14815 data
.maskpos
= maskpos
;
14817 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14819 char *mask
= masks
[maskpos
];
14821 if (mask_from_file
== 1)
14823 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14828 uint mask_offset
= 0;
14830 uint separator_cnt
;
14832 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14834 str_ptr
= strstr (mask
+ mask_offset
, ",");
14836 if (str_ptr
== NULL
) break;
14838 str_pos
= str_ptr
- mask
;
14840 // escaped separator, i.e. "\,"
14844 if (mask
[str_pos
- 1] == '\\')
14848 mask_offset
= str_pos
+ 1;
14854 // reset the offset
14858 mask
[str_pos
] = '\0';
14860 switch (separator_cnt
)
14863 mp_reset_usr (mp_usr
, 0);
14865 custom_charset_1
= mask
;
14866 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14870 mp_reset_usr (mp_usr
, 1);
14872 custom_charset_2
= mask
;
14873 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14877 mp_reset_usr (mp_usr
, 2);
14879 custom_charset_3
= mask
;
14880 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14884 mp_reset_usr (mp_usr
, 3);
14886 custom_charset_4
= mask
;
14887 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
14891 mask
= mask
+ str_pos
+ 1;
14895 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
14899 local_free (css_buf
);
14900 local_free (data
.root_css_buf
);
14901 local_free (data
.markov_css_buf
);
14903 local_free (masks
[maskpos
- 1]);
14906 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
14909 data
.css_cnt
= css_cnt
;
14910 data
.css_buf
= css_buf
;
14912 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
14914 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
14916 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
14918 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
14919 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
14921 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
14923 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
14925 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
14926 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
14928 data
.root_css_buf
= root_css_buf
;
14929 data
.markov_css_buf
= markov_css_buf
;
14931 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
14933 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
14935 local_free (root_table_buf
);
14936 local_free (markov_table_buf
);
14940 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
14942 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14944 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
14945 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
14946 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
14948 device_param
->kernel_params_mp_buf64
[3] = 0;
14949 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
14950 device_param
->kernel_params_mp_buf32
[5] = 0;
14951 device_param
->kernel_params_mp_buf32
[6] = 0;
14952 device_param
->kernel_params_mp_buf32
[7] = 0;
14954 if (attack_mode
== ATTACK_MODE_HYBRID1
)
14956 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
14957 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
14958 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
14959 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
14961 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14963 device_param
->kernel_params_mp_buf32
[5] = 0;
14964 device_param
->kernel_params_mp_buf32
[6] = 0;
14965 device_param
->kernel_params_mp_buf32
[7] = 0;
14968 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
14969 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
14970 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
14972 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
);
14973 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
);
14976 else if (attack_mode
== ATTACK_MODE_BF
)
14978 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
14982 for (uint i
= 0; i
< dictcnt
; i
++)
14984 local_free (dictfiles
[i
]);
14987 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
14989 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
14991 if (l1_filename
== NULL
) break;
14995 dictfiles
[dictcnt
- 1] = l1_filename
;
15002 dictfiles
[dictcnt
- 1] = mask
;
15007 log_error ("ERROR: Mask is too small");
15014 free (induction_dictionaries
);
15016 // induction_dictionaries_cnt = 0; // implied
15018 if (attack_mode
!= ATTACK_MODE_BF
)
15022 induction_dictionaries
= scan_directory (induction_directory
);
15024 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15028 if (induction_dictionaries_cnt
)
15030 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15034 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15038 if ((maskcnt
> 1) || (dictcnt
> 1))
15040 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15046 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15048 char *subid
= logfile_generate_subid ();
15050 data
.subid
= subid
;
15052 logfile_sub_msg ("START");
15054 data
.devices_status
= STATUS_INIT
;
15056 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15057 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15058 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15060 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15064 data
.cpt_start
= time (NULL
);
15066 data
.cpt_total
= 0;
15068 if (data
.restore
== 0)
15070 rd
->words_cur
= skip
;
15077 data
.ms_paused
= 0;
15079 data
.words_cur
= rd
->words_cur
;
15081 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15083 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15085 device_param
->speed_pos
= 0;
15087 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15088 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15089 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15091 device_param
->gpu_power
= device_param
->gpu_power_user
;
15092 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15094 device_param
->outerloop_pos
= 0;
15095 device_param
->outerloop_left
= 0;
15096 device_param
->innerloop_pos
= 0;
15097 device_param
->innerloop_left
= 0;
15099 // some more resets:
15101 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15103 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15105 device_param
->pw_cnt
= 0;
15106 device_param
->pws_cnt
= 0;
15108 device_param
->words_off
= 0;
15109 device_param
->words_done
= 0;
15112 data
.gpu_blocks_div
= 0;
15114 // figure out some workload
15116 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15118 if (data
.wordlist_mode
== WL_MODE_FILE
)
15120 char *dictfile
= NULL
;
15122 if (induction_dictionaries_cnt
)
15124 dictfile
= induction_dictionaries
[0];
15128 dictfile
= dictfiles
[dictpos
];
15131 data
.dictfile
= dictfile
;
15133 logfile_sub_string (dictfile
);
15135 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15137 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15140 FILE *fd2
= fopen (dictfile
, "rb");
15144 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15149 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15153 if (data
.words_cnt
== 0)
15155 if (data
.devices_status
== STATUS_CRACKED
) break;
15156 if (data
.devices_status
== STATUS_ABORTED
) break;
15164 else if (attack_mode
== ATTACK_MODE_COMBI
)
15166 char *dictfile
= data
.dictfile
;
15167 char *dictfile2
= data
.dictfile2
;
15169 logfile_sub_string (dictfile
);
15170 logfile_sub_string (dictfile2
);
15172 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15174 FILE *fd2
= fopen (dictfile
, "rb");
15178 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15183 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15187 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15189 FILE *fd2
= fopen (dictfile2
, "rb");
15193 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15198 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15203 if (data
.words_cnt
== 0)
15205 if (data
.devices_status
== STATUS_CRACKED
) break;
15206 if (data
.devices_status
== STATUS_ABORTED
) break;
15213 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15215 char *dictfile
= NULL
;
15217 if (induction_dictionaries_cnt
)
15219 dictfile
= induction_dictionaries
[0];
15223 dictfile
= dictfiles
[dictpos
];
15226 data
.dictfile
= dictfile
;
15228 char *mask
= data
.mask
;
15230 logfile_sub_string (dictfile
);
15231 logfile_sub_string (mask
);
15233 FILE *fd2
= fopen (dictfile
, "rb");
15237 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15242 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15246 if (data
.words_cnt
== 0)
15248 if (data
.devices_status
== STATUS_CRACKED
) break;
15249 if (data
.devices_status
== STATUS_ABORTED
) break;
15256 else if (attack_mode
== ATTACK_MODE_BF
)
15258 local_free (css_buf
);
15259 local_free (data
.root_css_buf
);
15260 local_free (data
.markov_css_buf
);
15262 char *mask
= dictfiles
[dictpos
];
15264 logfile_sub_string (mask
);
15268 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15270 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15272 uint css_cnt_unicode
= css_cnt
* 2;
15274 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15276 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15278 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15280 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15281 css_buf_unicode
[j
+ 1].cs_len
= 1;
15286 css_buf
= css_buf_unicode
;
15287 css_cnt
= css_cnt_unicode
;
15290 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15292 uint mask_min
= pw_min
;
15293 uint mask_max
= pw_max
;
15295 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15301 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15303 if (css_cnt
< mask_min
)
15305 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15308 if (css_cnt
> mask_max
)
15310 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15313 // skip to next mask
15317 rd
->dictpos
= dictpos
;
15319 logfile_sub_msg ("STOP");
15324 uint save_css_cnt
= css_cnt
;
15326 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15328 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15330 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15331 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15333 uint css_cnt_salt
= css_cnt
+ salt_len
;
15335 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15337 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15339 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15341 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15342 css_buf_salt
[j
].cs_len
= 1;
15347 css_buf
= css_buf_salt
;
15348 css_cnt
= css_cnt_salt
;
15353 data
.css_cnt
= css_cnt
;
15354 data
.css_buf
= css_buf
;
15356 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15358 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15360 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15362 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15364 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15365 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15367 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15369 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15371 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15372 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15374 data
.root_css_buf
= root_css_buf
;
15375 data
.markov_css_buf
= markov_css_buf
;
15377 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15379 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15381 local_free (root_table_buf
);
15382 local_free (markov_table_buf
);
15386 uint css_cnt_l
= css_cnt
;
15389 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15391 if (save_css_cnt
< 6)
15395 else if (save_css_cnt
== 6)
15401 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15403 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15414 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15429 /* unfinished code?
15430 int sum = css_buf[css_cnt_r - 1].cs_len;
15432 for (uint i = 1; i < 4 && i < css_cnt; i++)
15434 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15438 sum *= css_buf[css_cnt_r - 1].cs_len;
15443 css_cnt_l
-= css_cnt_r
;
15445 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15447 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15449 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15451 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15452 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15453 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15455 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15456 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15457 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15458 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15459 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15460 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15462 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15463 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15464 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15465 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15467 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15468 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15469 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15471 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15472 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15473 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15474 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15475 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15477 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
]);
15478 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
]);
15479 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
]);
15481 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
]);
15482 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
]);
15483 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
]);
15485 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
);
15486 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
);
15490 uint64_t words_base
= data
.words_cnt
;
15492 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15494 if (data
.gpu_rules_cnt
)
15496 words_base
/= data
.gpu_rules_cnt
;
15499 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15501 if (data
.combs_cnt
)
15503 words_base
/= data
.combs_cnt
;
15506 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15510 words_base
/= data
.bfs_cnt
;
15514 data
.words_base
= words_base
;
15518 log_info ("%llu", (unsigned long long int) words_base
);
15523 if (data
.words_cur
> data
.words_base
)
15525 log_error ("ERROR: restore value greater keyspace");
15530 if (data
.words_cur
)
15532 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15534 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15536 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15539 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15541 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15543 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15546 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15548 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15550 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15556 * Inform user about possible slow speeds
15559 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15561 if (data
.words_base
< gpu_blocks_all
)
15566 log_info ("ATTENTION!");
15567 log_info (" The wordlist or mask you are using is too small.");
15568 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15569 log_info (" The cracking speed will drop.");
15570 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15577 * Update loopback file
15586 uint random_num
= get_random_num (0, 9999);
15588 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15590 data
.loopback_file
= loopback_file
;
15594 * Update dictionary statistic
15599 dictstat_fp
= fopen (dictstat
, "wb");
15603 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15605 fclose (dictstat_fp
);
15609 data
.devices_status
= STATUS_RUNNING
;
15611 if (initial_restore_done
== 0)
15613 if (data
.restore_disable
== 0) cycle_restore ();
15615 initial_restore_done
= 1;
15618 hc_timer_set (&data
.timer_running
);
15620 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15622 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15624 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15625 if (quiet
== 0) fflush (stdout
);
15628 else if (wordlist_mode
== WL_MODE_STDIN
)
15630 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15631 if (data
.quiet
== 0) log_info ("");
15634 time_t runtime_start
;
15636 time (&runtime_start
);
15638 data
.runtime_start
= runtime_start
;
15641 * create cracker threads
15644 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15646 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15648 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15650 device_param
->device_id
= device_id
;
15652 if (wordlist_mode
== WL_MODE_STDIN
)
15654 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15658 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15662 // wait for crack threads to exit
15664 hc_thread_wait (devices_cnt
, c_threads
);
15666 local_free (c_threads
);
15672 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15674 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15676 if (data
.devices_status
== STATUS_CRACKED
) break;
15677 if (data
.devices_status
== STATUS_ABORTED
) break;
15679 if (data
.devices_status
== STATUS_BYPASS
)
15681 data
.devices_status
= STATUS_RUNNING
;
15684 if (induction_dictionaries_cnt
)
15686 unlink (induction_dictionaries
[0]);
15689 free (induction_dictionaries
);
15691 if (attack_mode
!= ATTACK_MODE_BF
)
15693 induction_dictionaries
= scan_directory (induction_directory
);
15695 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15698 if (benchmark
== 0)
15700 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15702 if (quiet
== 0) clear_prompt ();
15704 if (quiet
== 0) log_info ("");
15712 if (quiet
== 0) status_display ();
15715 if (quiet
== 0) log_info ("");
15719 if (attack_mode
== ATTACK_MODE_BF
)
15723 rd
->dictpos
= dictpos
;
15727 if (induction_dictionaries_cnt
)
15729 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15735 rd
->dictpos
= dictpos
;
15739 time_t runtime_stop
;
15741 time (&runtime_stop
);
15743 data
.runtime_stop
= runtime_stop
;
15745 logfile_sub_uint (runtime_start
);
15746 logfile_sub_uint (runtime_stop
);
15748 logfile_sub_msg ("STOP");
15750 global_free (subid
);
15753 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15755 if (data
.devices_status
== STATUS_CRACKED
) break;
15756 if (data
.devices_status
== STATUS_ABORTED
) break;
15757 if (data
.devices_status
== STATUS_QUIT
) break;
15759 if (data
.devices_status
== STATUS_BYPASS
)
15761 data
.devices_status
= STATUS_RUNNING
;
15765 // 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
15767 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15769 if (data
.wordlist_mode
== WL_MODE_FILE
)
15771 if (data
.dictfile
== NULL
)
15773 if (dictfiles
!= NULL
)
15775 data
.dictfile
= dictfiles
[0];
15777 hc_timer_set (&data
.timer_running
);
15782 // NOTE: combi is okay because it is already set beforehand
15783 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15785 if (data
.dictfile
== NULL
)
15787 if (dictfiles
!= NULL
)
15789 hc_timer_set (&data
.timer_running
);
15791 data
.dictfile
= dictfiles
[0];
15795 else if (attack_mode
== ATTACK_MODE_BF
)
15797 if (data
.mask
== NULL
)
15799 hc_timer_set (&data
.timer_running
);
15801 data
.mask
= masks
[0];
15805 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15807 data
.devices_status
= STATUS_EXHAUSTED
;
15810 // if cracked / aborted remove last induction dictionary
15812 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15814 struct stat induct_stat
;
15816 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15818 unlink (induction_dictionaries
[file_pos
]);
15822 // wait for non-interactive threads
15824 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15826 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15829 local_free (ni_threads
);
15831 // wait for interactive threads
15833 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15835 hc_thread_wait (1, &i_thread
);
15838 // we dont need restore file anymore
15839 if (data
.restore_disable
== 0)
15841 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15843 unlink (eff_restore_file
);
15844 unlink (new_restore_file
);
15852 // finally save left hashes
15854 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15863 if (benchmark
== 1)
15865 status_benchmark ();
15871 if (quiet
== 0) clear_prompt ();
15873 if (quiet
== 0) log_info ("");
15881 if (quiet
== 0) status_display ();
15884 if (quiet
== 0) log_info ("");
15887 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15889 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15891 local_free (device_param
->result
);
15893 local_free (device_param
->pw_caches
);
15895 local_free (device_param
->combs_buf
);
15897 local_free (device_param
->hooks_buf
);
15899 local_free (device_param
->device_name
);
15901 local_free (device_param
->device_version
);
15903 local_free (device_param
->driver_version
);
15905 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
15906 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
15907 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
15908 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
15909 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
15910 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
15911 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
15912 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
15913 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
15914 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
15915 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
15916 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
15917 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
15918 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
15919 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
15920 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
15921 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
15922 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
15923 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
15924 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
15925 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
15926 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
15927 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
15928 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
15929 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
15930 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
15931 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
15932 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
15934 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
15935 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
15936 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
15937 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
15938 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
15939 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
15940 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
15941 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
15943 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
15944 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
15945 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
15946 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
15949 // reset default fan speed
15952 if (gpu_temp_disable == 0)
15954 if (gpu_temp_retain != 0)
15956 hc_thread_mutex_lock (mux_adl);
15958 for (uint i = 0; i < data.devices_cnt; i++)
15960 if (data.hm_device[i].fan_supported == 1)
15962 int fanspeed = temp_retain_fanspeed_value[i];
15964 if (fanspeed == -1) continue;
15966 int rc = hm_set_fanspeed_with_device_id (i, fanspeed);
15968 if (rc == -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i);
15972 hc_thread_mutex_unlock (mux_adl);
15976 // reset power tuning
15978 if (powertune_enable == 1)
15980 hc_thread_mutex_lock (mux_adl);
15982 for (uint i = 0; i < data.devices_cnt; i++)
15984 if (data.hm_device[i].od_version == 6)
15986 // check powertune capabilities first, if not available then skip device
15988 int powertune_supported = 0;
15990 if ((hc_ADL_Overdrive6_PowerControl_Caps (data.hm_dll, data.hm_device[i].adapter_index, &powertune_supported)) != ADL_OK)
15992 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15997 if (powertune_supported != 0)
15999 // powercontrol settings
16001 if ((hc_ADL_Overdrive_PowerControl_Set (data.hm_dll, data.hm_device[i].adapter_index, od_power_control_status[i])) != ADL_OK)
16003 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16010 ADLOD6StateInfo *performance_state = (ADLOD6StateInfo*) mycalloc (1, sizeof (ADLOD6StateInfo) + sizeof (ADLOD6PerformanceLevel));
16012 performance_state->iNumberOfPerformanceLevels = 2;
16014 performance_state->aLevels[0].iEngineClock = od_clock_mem_status[i].state.aLevels[0].iEngineClock;
16015 performance_state->aLevels[1].iEngineClock = od_clock_mem_status[i].state.aLevels[1].iEngineClock;
16016 performance_state->aLevels[0].iMemoryClock = od_clock_mem_status[i].state.aLevels[0].iMemoryClock;
16017 performance_state->aLevels[1].iMemoryClock = od_clock_mem_status[i].state.aLevels[1].iMemoryClock;
16019 if ((hc_ADL_Overdrive_State_Set (data.hm_dll, data.hm_device[i].adapter_index, ADL_OD6_SETSTATE_PERFORMANCE, performance_state)) != ADL_OK)
16021 log_info ("ERROR: Failed to restore ADL performance state");
16026 local_free (performance_state);
16031 hc_thread_mutex_unlock (mux_adl);
16034 if (gpu_temp_disable == 0)
16036 if (vendor_id == VENDOR_ID_NV)
16039 hc_NVML_nvmlShutdown ();
16047 if (vendor_id == VENDOR_ID_AMD)
16049 hc_ADL_Main_Control_Destroy (data.hm_dll);
16051 hm_close (data.hm_dll);
16058 local_free (masks
);
16060 local_free (dictstat_base
);
16062 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16064 pot_t
*pot_ptr
= &pot
[pot_pos
];
16066 hash_t
*hash
= &pot_ptr
->hash
;
16068 local_free (hash
->digest
);
16072 local_free (hash
->salt
);
16078 local_free (all_gpu_rules_cnt
);
16079 local_free (all_gpu_rules_buf
);
16081 local_free (wl_data
->buf
);
16082 local_free (wl_data
);
16084 local_free (bitmap_s1_a
);
16085 local_free (bitmap_s1_b
);
16086 local_free (bitmap_s1_c
);
16087 local_free (bitmap_s1_d
);
16088 local_free (bitmap_s2_a
);
16089 local_free (bitmap_s2_b
);
16090 local_free (bitmap_s2_c
);
16091 local_free (bitmap_s2_d
);
16093 local_free (temp_retain_fanspeed_value
);
16094 local_free (od_clock_mem_status
);
16095 local_free (od_power_control_status
);
16097 global_free (devices_param
);
16099 global_free (gpu_rules_buf
);
16101 global_free (root_css_buf
);
16102 global_free (markov_css_buf
);
16104 global_free (digests_buf
);
16105 global_free (digests_shown
);
16106 global_free (digests_shown_tmp
);
16108 global_free (salts_buf
);
16109 global_free (salts_shown
);
16111 global_free (esalts_buf
);
16113 global_free (words_progress_done
);
16114 global_free (words_progress_rejected
);
16115 global_free (words_progress_restored
);
16117 if (pot_fp
) fclose (pot_fp
);
16119 if (data
.devices_status
== STATUS_QUIT
) break;
16122 // destroy others mutex
16124 hc_thread_mutex_delete (mux_dispatcher
);
16125 hc_thread_mutex_delete (mux_counter
);
16126 hc_thread_mutex_delete (mux_display
);
16127 hc_thread_mutex_delete (mux_adl
);
16131 local_free (eff_restore_file
);
16132 local_free (new_restore_file
);
16138 local_free (loopback_file
);
16140 if (loopback
== 1) unlink (loopback_file
);
16142 // induction directory
16144 if (induction_dir
== NULL
)
16146 if (attack_mode
!= ATTACK_MODE_BF
)
16148 if (rmdir (induction_directory
) == -1)
16150 if (errno
== ENOENT
)
16152 // good, we can ignore
16154 else if (errno
== ENOTEMPTY
)
16156 // good, we can ignore
16160 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16166 local_free (induction_directory
);
16170 // outfile-check directory
16172 if (outfile_check_dir
== NULL
)
16174 if (rmdir (outfile_check_directory
) == -1)
16176 if (errno
== ENOENT
)
16178 // good, we can ignore
16180 else if (errno
== ENOTEMPTY
)
16182 // good, we can ignore
16186 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16192 local_free (outfile_check_directory
);
16199 logfile_top_uint (proc_start
);
16200 logfile_top_uint (proc_stop
);
16202 logfile_top_msg ("STOP");
16204 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16205 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16207 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16208 if (data
.devices_status
== STATUS_QUIT
) return 2;
16209 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16210 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16211 if (data
.devices_status
== STATUS_CRACKED
) return 0;