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 58
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
] =
217 static void (*get_next_word_func
) (char *, uint32_t, uint32_t *, uint32_t *);
223 static unsigned int full01
= 0x01010101;
224 static unsigned int full80
= 0x80808080;
226 int SUPPRESS_OUTPUT
= 0;
228 hc_thread_mutex_t mux_adl
;
229 hc_thread_mutex_t mux_counter
;
230 hc_thread_mutex_t mux_dispatcher
;
231 hc_thread_mutex_t mux_display
;
233 hc_global_data_t data
;
235 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
237 const char *USAGE_MINI
[] =
239 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
241 "Try --help for more help.",
245 const char *USAGE_BIG
[] =
247 "%s, advanced password recovery",
249 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
257 " -m, --hash-type=NUM Hash-type, see references below",
258 " -a, --attack-mode=NUM Attack-mode, see references below",
259 " -V, --version Print version",
260 " -h, --help Print help",
261 " --quiet Suppress output",
265 " -b, --benchmark Run benchmark",
266 " --benchmark-mode=NUM Benchmark-mode, see references below",
270 " --hex-charset Assume charset is given in hex",
271 " --hex-salt Assume salt is given in hex",
272 " --hex-wordlist Assume words in wordlist is given in hex",
273 " --force Ignore warnings",
274 " --status Enable automatic update of the status-screen",
275 " --status-timer=NUM Seconds between status-screen update",
276 " --status-automat Display the status view in a machine readable format",
277 " --loopback Add new plains to induct directory",
278 " --weak-hash-threshold=NUM Threshold when to stop checking for weak hashes, default is 100 salts",
282 " --markov-hcstat=FILE Specify hcstat file to use, default is hashcat.hcstat",
283 " --markov-disable Disables markov-chains, emulates classic brute-force",
284 " --markov-classic Enables classic markov-chains, no per-position enhancement",
285 " -t, --markov-threshold=NUM Threshold when to stop accepting new markov-chains",
289 " --runtime=NUM Abort session after NUM seconds of runtime",
290 " --session=STR Define specific session name",
291 " --restore Restore session from --session",
292 " --restore-disable Do not write restore file",
296 " -o, --outfile=FILE Define outfile for recovered hash",
297 " --outfile-format=NUM Define outfile-format for recovered hash, see references below",
298 " --outfile-autohex-disable Disable the use of $HEX[] in output plains",
299 " --outfile-check-timer=NUM Seconds between outfile checks",
300 " -p, --separator=CHAR Separator char for hashlists and outfile",
301 " --show Show cracked passwords only",
302 " --left Show un-cracked passwords only",
303 " --username Enable ignoring of usernames in hashfile (recommended: also use --show)",
304 " --remove Enable remove of hash once it is cracked",
305 " --remove-timer=NUM Update input hash file each NUM seconds",
306 " --potfile-disable Do not write potfile",
307 " --debug-mode=NUM Defines the debug mode (hybrid only by using rules), see references below",
308 " --debug-file=FILE Output file for debugging rules (see also --debug-mode)",
309 " --induction-dir=FOLDER Specify induction directory to use, default is $session.induct",
310 " --outfile-check-dir=FOLDER Specify the outfile directory which should be monitored, default is $session.outfiles",
311 " --logfile-disable Disable the logfile",
312 " --truecrypt-keyfiles=FILE Keyfiles used, seperate with comma",
316 " -c, --segment-size=NUM Size in MB to cache from the wordfile",
317 " --bitmap-min=NUM Minimum number of bits allowed for bitmaps",
318 " --bitmap-max=NUM Maximum number of bits allowed for bitmaps",
319 " --cpu-affinity=STR Locks to CPU devices, seperate with comma",
320 " -d, --gpu-devices=STR Devices to use, separate with comma",
321 " -w, --workload-profile=NUM Enable a specific workload profile, see references below",
322 " -n, --gpu-accel=NUM Workload tuning: 1, 8, 40, 80, 160",
323 " -u, --gpu-loops=NUM Workload fine-tuning: 8 - 1024",
324 " --gpu-temp-disable Disable temperature and fanspeed readings and triggers",
325 " --gpu-temp-abort=NUM Abort session if GPU temperature reaches NUM degrees celsius",
326 " --gpu-temp-retain=NUM Try to retain GPU temperature at NUM degrees celsius (AMD only)",
327 " --powertune-enable Enable automatic power tuning option (AMD OverDrive 6 only)",
328 " --scrypt-tmto=NUM Manually override automatically calculated TMTO value for scrypt",
332 " -s, --skip=NUM Skip number of words",
333 " -l, --limit=NUM Limit number of words",
334 " --keyspace Show keyspace base:mod values and quit",
338 " -j, --rule-left=RULE Single rule applied to each word from left dict",
339 " -k, --rule-right=RULE Single rule applied to each word from right dict",
340 " -r, --rules-file=FILE Rules-file, multi use: -r 1.rule -r 2.rule",
341 " -g, --generate-rules=NUM Generate NUM random rules",
342 " --generate-rules-func-min=NUM Force NUM functions per random rule min",
343 " --generate-rules-func-max=NUM Force NUM functions per random rule max",
344 " --generate-rules-seed=NUM Force RNG seed to NUM",
346 "* Custom charsets:",
348 " -1, --custom-charset1=CS User-defined charsets",
349 " -2, --custom-charset2=CS Example:",
350 " -3, --custom-charset3=CS --custom-charset1=?dabcdef : sets charset ?1 to 0123456789abcdef",
351 " -4, --custom-charset4=CS -2 mycharset.hcchr : sets charset ?2 to chars contained in file",
355 " -i, --increment Enable increment mode",
356 " --increment-min=NUM Start incrementing at NUM",
357 " --increment-max=NUM Stop incrementing at NUM",
363 "* Workload Profile:",
365 " 1 = Reduced performance profile (low latency desktop)",
366 " 2 = Default performance profile",
367 " 3 = Tuned performance profile (high latency desktop)",
369 "* Benchmark Settings:",
371 " 0 = Manual Tuning",
372 " 1 = Performance Tuning, default",
374 "* Outfile Formats:",
378 " 3 = hash[:salt]:plain",
380 " 5 = hash[:salt]:hex_plain",
381 " 6 = plain:hex_plain",
382 " 7 = hash[:salt]:plain:hex_plain",
384 " 9 = hash[:salt]:crackpos",
385 " 10 = plain:crackpos",
386 " 11 = hash[:salt]:plain:crackpos",
387 " 12 = hex_plain:crackpos",
388 " 13 = hash[:salt]:hex_plain:crackpos",
389 " 14 = plain:hex_plain:crackpos",
390 " 15 = hash[:salt]:plain:hex_plain:crackpos",
392 "* Debug mode output formats (for hybrid mode only, by using rules):",
394 " 1 = save finding rule",
395 " 2 = save original word",
396 " 3 = save original word and finding rule",
397 " 4 = save original word, finding rule and modified plain",
399 "* Built-in charsets:",
401 " ?l = abcdefghijklmnopqrstuvwxyz",
402 " ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ",
404 " ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
413 " 6 = Hybrid dict + mask",
414 " 7 = Hybrid mask + dict",
418 "[[ Roll-your-own: Raw Hashes ]]",
427 " 5000 = SHA-3(Keccak)",
431 " 6900 = GOST R 34.11-94",
432 " 11700 = GOST R 34.11-2012 (Streebog) 256-bit",
433 " 11800 = GOST R 34.11-2012 (Streebog) 512-bit",
435 "[[ Roll-your-own: Iterated and / or Salted Hashes ]]",
437 " 10 = md5($pass.$salt)",
438 " 20 = md5($salt.$pass)",
439 " 30 = md5(unicode($pass).$salt)",
440 " 40 = md5($salt.unicode($pass))",
441 " 3800 = md5($salt.$pass.$salt)",
442 " 3710 = md5($salt.md5($pass))",
443 " 2600 = md5(md5($pass)",
444 " 4300 = md5(strtoupper(md5($pass)))",
445 " 4400 = md5(sha1($pass))",
446 " 110 = sha1($pass.$salt)",
447 " 120 = sha1($salt.$pass)",
448 " 130 = sha1(unicode($pass).$salt)",
449 " 140 = sha1($salt.unicode($pass))",
450 " 4500 = sha1(sha1($pass)",
451 " 4700 = sha1(md5($pass))",
452 " 4900 = sha1($salt.$pass.$salt)",
453 " 1410 = sha256($pass.$salt)",
454 " 1420 = sha256($salt.$pass)",
455 " 1430 = sha256(unicode($pass).$salt)",
456 " 1440 = sha256($salt.unicode($pass))",
457 " 1710 = sha512($pass.$salt)",
458 " 1720 = sha512($salt.$pass)",
459 " 1730 = sha512(unicode($pass).$salt)",
460 " 1740 = sha512($salt.unicode($pass))",
462 "[[ Roll-your-own: Authenticated Hashes ]]",
464 " 50 = HMAC-MD5 (key = $pass)",
465 " 60 = HMAC-MD5 (key = $salt)",
466 " 150 = HMAC-SHA1 (key = $pass)",
467 " 160 = HMAC-SHA1 (key = $salt)",
468 " 1450 = HMAC-SHA256 (key = $pass)",
469 " 1460 = HMAC-SHA256 (key = $salt)",
470 " 1750 = HMAC-SHA512 (key = $pass)",
471 " 1760 = HMAC-SHA512 (key = $salt)",
477 " 11900 = PBKDF2-HMAC-MD5",
478 " 12000 = PBKDF2-HMAC-SHA1",
479 " 10900 = PBKDF2-HMAC-SHA256",
480 " 12100 = PBKDF2-HMAC-SHA512",
482 "[[ Network protocols, Challenge-Response ]]",
486 " 4800 = iSCSI CHAP authentication, MD5(Chap)",
487 " 5300 = IKE-PSK MD5",
488 " 5400 = IKE-PSK SHA1",
490 " 5500 = NetNTLMv1 + ESS",
492 " 7300 = IPMI2 RAKP HMAC-SHA1",
493 " 7500 = Kerberos 5 AS-REQ Pre-Auth etype 23",
494 " 8300 = DNSSEC (NSEC3)",
496 " 11100 = PostgreSQL Challenge-Response Authentication (MD5)",
497 " 11200 = MySQL Challenge-Response Authentication (SHA1)",
498 " 11400 = SIP digest authentication (MD5)",
500 "[[ Forums, CMS, E-Commerce, Frameworks, Middleware, Wiki, Management ]]",
502 " 121 = SMF (Simple Machines Forum)",
504 " 2611 = vBulletin < v3.8.5",
505 " 2711 = vBulletin > v3.8.5",
507 " 2811 = IPB (Invison Power Board)",
508 " 8400 = WBB3 (Woltlab Burning Board)",
509 " 11 = Joomla < 2.5.18",
510 " 400 = Joomla > 2.5.18",
516 " 11000 = PrestaShop",
517 " 124 = Django (SHA-1)",
518 " 10000 = Django (PBKDF2-SHA256)",
519 " 3711 = Mediawiki B type",
522 "[[ Database Server ]]",
525 " 131 = MSSQL(2000)",
526 " 132 = MSSQL(2005)",
527 " 1731 = MSSQL(2012)",
528 " 1731 = MSSQL(2014)",
530 " 300 = MySQL4.1/MySQL5",
531 " 3100 = Oracle H: Type (Oracle 7+)",
532 " 112 = Oracle S: Type (Oracle 11+)",
533 " 12300 = Oracle T: Type (Oracle 12+)",
534 " 8000 = Sybase ASE",
536 "[[ HTTP, SMTP, LDAP Server]]",
538 " 141 = EPiServer 6.x < v4",
539 " 1441 = EPiServer 6.x > v4",
540 " 1600 = Apache $apr1$",
541 " 12600 = ColdFusion 10+",
542 " 1421 = hMailServer",
543 " 101 = nsldap, SHA-1(Base64), Netscape LDAP SHA",
544 " 111 = nsldaps, SSHA-1(Base64), Netscape LDAP SSHA",
545 " 1711 = SSHA-512(Base64), LDAP {SSHA512}",
551 "[[ Operating-Systems ]]",
555 " 1100 = Domain Cached Credentials (DCC), MS Cache",
556 " 2100 = Domain Cached Credentials 2 (DCC2), MS Cache 2",
557 " 12800 = MS-AzureSync PBKDF2-HMAC-SHA256",
558 " 1500 = descrypt, DES(Unix), Traditional DES",
559 " 12400 = BSDiCrypt, Extended DES",
560 " 500 = md5crypt $1$, MD5(Unix)",
561 " 3200 = bcrypt $2*$, Blowfish(Unix)",
562 " 7400 = sha256crypt $5$, SHA256(Unix)",
563 " 1800 = sha512crypt $6$, SHA512(Unix)",
570 " 7100 = OSX v10.10",
571 " 6300 = AIX {smd5}",
572 " 6700 = AIX {ssha1}",
573 " 6400 = AIX {ssha256}",
574 " 6500 = AIX {ssha512}",
577 " 500 = Cisco-IOS $1$",
578 " 5700 = Cisco-IOS $4$",
579 " 9200 = Cisco-IOS $8$",
580 " 9300 = Cisco-IOS $9$",
581 " 22 = Juniper Netscreen/SSG (ScreenOS)",
582 " 501 = Juniper IVE",
583 " 5800 = Android PIN",
584 " 8100 = Citrix Netscaler",
589 "[[ Enterprise Application Software (EAS) ]]",
591 " 7700 = SAP CODVN B (BCODE)",
592 " 7800 = SAP CODVN F/G (PASSCODE)",
593 " 10300 = SAP CODVN H (PWDSALTEDHASH) iSSHA-1",
594 " 8600 = Lotus Notes/Domino 5",
595 " 8700 = Lotus Notes/Domino 6",
596 " 9100 = Lotus Notes/Domino 8",
604 "[[ Full-Disk encryptions (FDE) ]]",
606 " 62XY = TrueCrypt 5.0+",
607 " X = 1 = PBKDF2-HMAC-RipeMD160",
608 " X = 2 = PBKDF2-HMAC-SHA512",
609 " X = 3 = PBKDF2-HMAC-Whirlpool",
610 " X = 4 = PBKDF2-HMAC-RipeMD160 + boot-mode",
611 " Y = 1 = XTS 512 bit (Ciphers: AES or Serpent or Twofish)",
612 " Y = 2 = XTS 1024 bit (Ciphers: AES or Serpent or Twofish or AES-Twofish or Serpent-AES or Twofish-Serpent)",
613 " Y = 3 = XTS 1536 bit (Ciphers: All)",
614 " 8800 = Android FDE < v4.3",
619 " 9700 = MS Office <= 2003 MD5 + RC4, oldoffice$0, oldoffice$1",
620 " 9710 = MS Office <= 2003 MD5 + RC4, collider-mode #1",
621 " 9720 = MS Office <= 2003 MD5 + RC4, collider-mode #2",
622 " 9800 = MS Office <= 2003 SHA1 + RC4, oldoffice$3, oldoffice$4",
623 " 9810 = MS Office <= 2003 SHA1 + RC4, collider-mode #1",
624 " 9820 = MS Office <= 2003 SHA1 + RC4, collider-mode #2",
625 " 9400 = MS Office 2007",
626 " 9500 = MS Office 2010",
627 " 9600 = MS Office 2013",
628 " 10400 = PDF 1.1 - 1.3 (Acrobat 2 - 4)",
629 " 10410 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #1",
630 " 10420 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #2",
631 " 10500 = PDF 1.4 - 1.6 (Acrobat 5 - 8)",
632 " 10600 = PDF 1.7 Level 3 (Acrobat 9)",
633 " 10700 = PDF 1.7 Level 8 (Acrobat 10 - 11)",
635 "[[ Password Managers ]]",
637 " 9000 = Password Safe v2",
638 " 5200 = Password Safe v3",
640 " 6600 = 1Password, agilekeychain",
641 " 8200 = 1Password, cloudkeychain",
642 " 11300 = Bitcoin/Litecoin wallet.dat",
643 " 12700 = Blockchain, My Wallet",
649 * oclHashcat specific functions
652 void status_display_automat ()
656 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
662 fprintf (out
, "SPEED\t");
664 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
666 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
668 uint64_t speed_cnt
= 0;
671 for (int i
= 0; i
< SPEED_CACHE
; i
++)
675 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
677 if (rec_ms
> SPEED_MAXAGE
) continue;
679 speed_cnt
+= device_param
->speed_cnt
[i
];
680 speed_ms
+= device_param
->speed_ms
[i
];
683 speed_cnt
/= SPEED_CACHE
;
684 speed_ms
/= SPEED_CACHE
;
686 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
693 uint64_t words_cur
= get_lowest_words_done ();
695 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
701 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
703 if (salts_left
== 0) salts_left
= 1;
705 uint64_t progress_total
= data
.words_cnt
* salts_left
;
707 uint64_t all_done
= 0;
708 uint64_t all_rejected
= 0;
709 uint64_t all_restored
= 0;
711 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
715 // otherwise the final cracked status shows 0/XXX progress
717 if (data
.salts_shown
[salt_pos
] == 1) continue;
720 all_done
+= data
.words_progress_done
[salt_pos
];
721 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
722 all_restored
+= data
.words_progress_restored
[salt_pos
];
725 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
726 uint64_t progress_end
= progress_total
;
728 uint64_t progress_skip
= 0;
732 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
734 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
735 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
736 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
741 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
743 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
744 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
745 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
748 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
749 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
751 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
757 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
758 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
764 if (data
.gpu_temp_disable
== 0)
766 fprintf (out
, "TEMP\t");
768 hc_thread_mutex_lock (mux_adl
);
770 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
772 int temp
= hm_get_temperature_with_device_id (i
);
774 fprintf (out
, "%d\t", temp
);
777 hc_thread_mutex_unlock (mux_adl
);
792 void status_display ()
794 if (data
.devices_status
== STATUS_INIT
) return;
795 if (data
.devices_status
== STATUS_STARTING
) return;
796 if (data
.devices_status
== STATUS_BYPASS
) return;
798 if (data
.status_automat
== 1)
800 status_display_automat ();
809 log_info ("Session.Name...: %s", data
.session
);
811 char *status_type
= strstatus (data
.devices_status
);
813 uint hash_mode
= data
.hash_mode
;
815 char *hash_type
= strhashtype (hash_mode
); // not a bug
817 log_info ("Status.........: %s", status_type
);
823 if (data
.rp_files_cnt
)
827 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
829 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
832 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
834 log_info ("Rules.Type.....: %s", tmp_buf
);
841 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
843 if (data
.rp_gen_seed
)
845 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
853 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
855 if (data
.wordlist_mode
== WL_MODE_FILE
)
857 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
859 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
861 log_info ("Input.Mode.....: Pipe");
864 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
866 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
867 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
869 else if (data
.attack_mode
== ATTACK_MODE_BF
)
871 char *mask
= data
.mask
;
875 uint mask_len
= data
.css_cnt
;
877 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
881 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
883 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
885 mask_len
-= data
.salts_buf
[0].salt_len
;
889 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
891 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
894 if (data
.maskcnt
> 1)
896 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
898 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
901 log_info ("Input.Mode.....: %s", tmp_buf
);
906 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
908 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
909 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
911 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
913 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
914 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
917 if (data
.digests_cnt
== 1)
919 if (data
.hash_mode
== 2500)
921 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
925 char *pke_ptr
= (char *) pke
;
927 for (uint i
= 0; i
< 25; i
++)
929 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
935 memcpy (mac1
, pke_ptr
+ 23, 6);
936 memcpy (mac2
, pke_ptr
+ 29, 6);
938 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
939 (char *) data
.salts_buf
[0].salt_buf
,
953 else if (data
.hash_mode
== 5200)
955 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
957 else if (data
.hash_mode
== 9000)
959 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
961 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
963 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
969 ascii_digest (out_buf
, 0, 0);
972 if (strlen (out_buf
) > 40)
980 log_info ("Hash.Target....: %s", out_buf
);
985 if (data
.hash_mode
== 3000)
990 ascii_digest (out_buf1
, 0, 0);
991 ascii_digest (out_buf2
, 0, 1);
993 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
997 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1001 log_info ("Hash.Type......: %s", hash_type
);
1007 uint64_t speed_cnt
[DEVICES_MAX
];
1008 float speed_ms
[DEVICES_MAX
];
1010 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1012 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1014 // we need to clear values (set to 0) because in case the gpu does
1015 // not get new candidates it idles around but speed display would
1016 // show it as working.
1017 // if we instantly set it to 0 after reading it happens that the
1018 // speed can be shown as zero if the users refreshs to fast.
1019 // therefore, we add a timestamp when a stat was recorded and if its
1020 // to old we will not use it
1022 speed_cnt
[device_id
] = 0;
1023 speed_ms
[device_id
] = 0;
1025 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1029 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
1031 if (rec_ms
> SPEED_MAXAGE
) continue;
1033 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1034 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1037 speed_cnt
[device_id
] /= SPEED_CACHE
;
1038 speed_ms
[device_id
] /= SPEED_CACHE
;
1041 float hashes_all_ms
= 0;
1043 float hashes_dev_ms
[DEVICES_MAX
];
1045 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1047 hashes_dev_ms
[device_id
] = 0;
1049 if (speed_ms
[device_id
])
1051 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1053 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1061 float ms_running
= 0;
1063 hc_timer_get (data
.timer_running
, ms_running
);
1065 float ms_paused
= data
.ms_paused
;
1067 if (data
.devices_status
== STATUS_PAUSED
)
1069 float ms_paused_tmp
= 0;
1071 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1073 ms_paused
+= ms_paused_tmp
;
1078 __time64_t sec_run
= ms_running
/ 1000;
1082 time_t sec_run
= ms_running
/ 1000;
1088 char display_run
[32];
1096 tmp
= _gmtime64 (&sec_run
);
1100 tmp
= gmtime (&sec_run
);
1106 memcpy (&tm_run
, tmp
, sizeof (struct tm
));
1108 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1110 char *start
= ctime (&data
.proc_start
);
1112 size_t start_len
= strlen (start
);
1114 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1115 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1117 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1122 log_info ("Time.Started...: 0 secs");
1129 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
1131 if (salts_left
== 0) salts_left
= 1;
1133 uint64_t progress_total
= data
.words_cnt
* salts_left
;
1135 uint64_t all_done
= 0;
1136 uint64_t all_rejected
= 0;
1137 uint64_t all_restored
= 0;
1139 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1143 // otherwise the final cracked status shows 0/XXX progress
1145 if (data
.salts_shown
[salt_pos
] == 1) continue;
1148 all_done
+= data
.words_progress_done
[salt_pos
];
1149 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1150 all_restored
+= data
.words_progress_restored
[salt_pos
];
1153 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
1154 uint64_t progress_end
= progress_total
;
1156 uint64_t progress_skip
= 0;
1160 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
1162 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
1163 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1164 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1169 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
1171 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
1172 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1173 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1176 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
1177 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
1179 float speed_ms_real
= ms_running
- ms_paused
;
1180 uint64_t speed_plains_real
= all_done
;
1182 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1184 if (data
.devices_status
!= STATUS_CRACKED
)
1186 uint64_t words_per_ms
= 0;
1188 if (speed_plains_real
&& speed_ms_real
)
1190 words_per_ms
= speed_plains_real
/ speed_ms_real
;
1194 __time64_t sec_etc
= 0;
1201 uint64_t progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1203 uint64_t ms_left
= progress_left_relative_skip
/ words_per_ms
;
1205 sec_etc
= ms_left
/ 1000;
1210 log_info ("Time.Estimated.: 0 secs");
1212 else if ((uint64_t) sec_etc
> ETC_MAX
)
1214 log_info ("Time.Estimated.: > 10 Years");
1218 char display_etc
[32];
1226 tmp
= _gmtime64 (&sec_etc
);
1230 tmp
= gmtime (&sec_etc
);
1236 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1238 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1246 char *etc
= ctime (&now
);
1248 size_t etc_len
= strlen (etc
);
1250 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1251 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1253 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1259 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1261 char display_dev_cur
[16];
1263 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1265 strncpy (display_dev_cur
, "0.00", 4);
1267 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1269 log_info ("Speed.GPU.#%d...: %9sH/s", device_id
+ 1, display_dev_cur
);
1272 char display_all_cur
[16];
1274 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1276 strncpy (display_all_cur
, "0.00", 4);
1278 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1280 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*...: %9sH/s", display_all_cur
);
1282 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1283 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1285 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);
1289 if (data
.digests_cnt
> 100)
1291 time_t now
= time (NULL
);
1293 int cpt_cur_min
= 0;
1294 int cpt_cur_hour
= 0;
1295 int cpt_cur_day
= 0;
1297 for (int i
= 0; i
< CPT_BUF
; i
++)
1299 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1300 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1302 if ((timestamp
+ 60) > now
)
1304 cpt_cur_min
+= cracked
;
1307 if ((timestamp
+ 3600) > now
)
1309 cpt_cur_hour
+= cracked
;
1312 if ((timestamp
+ 86400) > now
)
1314 cpt_cur_day
+= cracked
;
1318 float cpt_avg_min
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 60);
1319 float cpt_avg_hour
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 3600);
1320 float cpt_avg_day
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 86400);
1322 if ((data
.cpt_start
+ 86400) < now
)
1324 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1332 else if ((data
.cpt_start
+ 3600) < now
)
1334 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1341 else if ((data
.cpt_start
+ 60) < now
)
1343 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1351 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1360 uint64_t restore_point
= get_lowest_words_done ();
1362 uint64_t restore_total
= data
.words_base
;
1364 float percent_restore
= 0;
1366 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1368 if (progress_end_relative_skip
)
1370 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1372 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1373 float percent_rejected
= 0.0;
1377 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1380 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);
1381 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1383 if (data
.restore_disable
== 0)
1385 if (percent_finished
!= 1)
1387 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1394 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1396 log_info ("Progress.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1397 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1399 if (data
.restore_disable
== 0)
1401 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1406 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1407 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1409 // --restore not allowed if stdin is used -- really? why?
1411 //if (data.restore_disable == 0)
1413 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1418 if (data
.gpu_temp_disable
== 0)
1420 hc_thread_mutex_lock (mux_adl
);
1422 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
1424 if (data
.hm_device
[i
].fan_supported
== 1)
1426 const int temperature
= hm_get_temperature_with_device_id (i
);
1427 const int utilization
= hm_get_utilization_with_device_id (i
);
1428 const int fanspeed
= hm_get_fanspeed_with_device_id (i
);
1430 if (data
.vendor_id
== VENDOR_ID_AMD
)
1432 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1435 if (data
.vendor_id
== VENDOR_ID_NV
)
1438 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1440 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2drpm Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1446 const int temperature
= hm_get_temperature_with_device_id (i
);
1447 const int utilization
= hm_get_utilization_with_device_id (i
);
1449 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, N/A Fan", i
+ 1, utilization
, temperature
);
1453 hc_thread_mutex_unlock (mux_adl
);
1457 static void status_benchmark ()
1459 if (data
.devices_status
== STATUS_INIT
) return;
1460 if (data
.devices_status
== STATUS_STARTING
) return;
1462 if (data
.words_cnt
== 0) return;
1464 uint64_t speed_cnt
[DEVICES_MAX
];
1465 float speed_ms
[DEVICES_MAX
];
1469 for (device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1471 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1473 speed_cnt
[device_id
] = 0;
1474 speed_ms
[device_id
] = 0;
1476 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1478 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1479 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1482 speed_cnt
[device_id
] /= SPEED_CACHE
;
1483 speed_ms
[device_id
] /= SPEED_CACHE
;
1486 float hashes_all_ms
= 0;
1488 float hashes_dev_ms
[DEVICES_MAX
];
1490 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1492 hashes_dev_ms
[device_id
] = 0;
1494 if (speed_ms
[device_id
])
1496 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1498 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1502 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1504 char display_dev_cur
[16];
1506 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1508 strncpy (display_dev_cur
, "0.00", 4);
1510 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1512 log_info ("Speed.GPU.#%d.: %9sH/s", device_id
+ 1, display_dev_cur
);
1515 char display_all_cur
[16];
1517 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1519 strncpy (display_all_cur
, "0.00", 4);
1521 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1523 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*.: %9sH/s", display_all_cur
);
1527 * oclHashcat -only- functions
1530 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *kernel_file
)
1532 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1534 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1535 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a0.cl", install_dir
, (int) kern_type
);
1536 else if (attack_kern
== ATTACK_KERN_COMBI
)
1537 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a1.cl", install_dir
, (int) kern_type
);
1538 else if (attack_kern
== ATTACK_KERN_BF
)
1539 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a3.cl", install_dir
, (int) kern_type
);
1542 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d.cl", install_dir
, (int) kern_type
);
1545 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1547 if (line_len
& 1) return (line_len
); // not in hex
1549 if (data
.hex_wordlist
== 1)
1554 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1556 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1559 memset (line_buf
+ i
, 0, line_len
- i
);
1563 else if (line_len
>= 6) // $HEX[] = 6
1565 if (line_buf
[0] != '$') return (line_len
);
1566 if (line_buf
[1] != 'H') return (line_len
);
1567 if (line_buf
[2] != 'E') return (line_len
);
1568 if (line_buf
[3] != 'X') return (line_len
);
1569 if (line_buf
[4] != '[') return (line_len
);
1570 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1575 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1577 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1580 memset (line_buf
+ i
, 0, line_len
- i
);
1588 static uint
count_lines (FILE *fd
)
1592 char *buf
= (char *) mymalloc (BUFSIZ
);
1594 size_t nread_tmp
= 0;
1600 size_t nread
= fread (buf
, sizeof (char), BUFSIZ
, fd
);
1603 if (nread
< 1) continue;
1609 if (*ptr
++ == '\n') cnt
++;
1614 // special case (if last line did not contain a newline char ... at the very end of the file)
1624 if (*ptr
!= '\n') // needed ? different on windows systems?
1636 static void clear_prompt ()
1638 fputc ('\r', stdout
);
1640 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1642 fputc (' ', stdout
);
1645 fputc ('\r', stdout
);
1650 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const uint64_t gidd
, pw_t
*pw
)
1652 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1655 static void check_hash (hc_device_param_t
*device_param
, const uint salt_pos
, const uint digest_pos
)
1657 char *outfile
= data
.outfile
;
1658 uint quiet
= data
.quiet
;
1659 FILE *pot_fp
= data
.pot_fp
;
1660 uint loopback
= data
.loopback
;
1661 uint debug_mode
= data
.debug_mode
;
1662 char *debug_file
= data
.debug_file
;
1664 char debug_rule_buf
[BLOCK_SIZE
];
1665 int debug_rule_len
= 0; // -1 error
1666 uint debug_plain_len
= 0;
1668 unsigned char debug_plain_ptr
[BLOCK_SIZE
];
1672 char out_buf
[4096]; memset (out_buf
, 0, sizeof (out_buf
));
1674 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1676 uint idx
= data
.salts_buf
[salt_pos
].digests_offset
+ digest_pos
;
1682 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, idx
* sizeof (plain_t
), sizeof (plain_t
), &plain
, 0, NULL
, NULL
);
1684 uint gidvid
= plain
.gidvid
;
1685 uint il_pos
= plain
.il_pos
;
1687 uint64_t crackpos
= device_param
->words_off
;
1691 unsigned char *plain_ptr
= (unsigned char *) plain_buf
;
1692 unsigned int plain_len
= 0;
1694 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1696 uint64_t gidd
= gidvid
;
1701 gidd_to_pw_t (device_param
, gidd
, &pw
);
1703 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1705 plain_buf
[i
] = pw
.hi1
[0][j
];
1708 plain_len
= pw
.pw_len
;
1710 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1717 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1719 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1721 debug_rule_len
= gpu_rule_to_cpu_rule (debug_rule_buf
, &data
.gpu_rules_buf
[off
]);
1725 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1727 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1729 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1731 debug_plain_len
= plain_len
;
1735 plain_len
= apply_rules (data
.gpu_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1738 crackpos
*= data
.gpu_rules_cnt
;
1739 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1741 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1743 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1745 uint64_t gidd
= gidvid
;
1750 gidd_to_pw_t (device_param
, gidd
, &pw
);
1752 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1754 plain_buf
[i
] = pw
.hi1
[0][j
];
1757 plain_len
= pw
.pw_len
;
1759 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1760 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1762 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1764 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1768 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1770 memcpy (plain_ptr
, comb_buf
, comb_len
);
1773 plain_len
+= comb_len
;
1776 crackpos
*= data
.combs_cnt
;
1777 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1779 if (data
.pw_max
!= PW_DICTMAX1
)
1781 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1784 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1786 uint64_t l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1787 uint64_t r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1789 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1790 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1792 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1793 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1795 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1796 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1798 plain_len
= data
.css_cnt
;
1801 crackpos
*= data
.bfs_cnt
;
1802 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1804 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1806 uint64_t gidd
= gidvid
;
1811 gidd_to_pw_t (device_param
, gidd
, &pw
);
1813 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1815 plain_buf
[i
] = pw
.hi1
[0][j
];
1818 plain_len
= pw
.pw_len
;
1820 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1823 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1825 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1827 plain_len
+= start
+ stop
;
1830 crackpos
*= data
.combs_cnt
;
1831 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1833 if (data
.pw_max
!= PW_DICTMAX1
)
1835 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1838 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1840 uint64_t gidd
= gidvid
;
1845 gidd_to_pw_t (device_param
, gidd
, &pw
);
1847 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1849 plain_buf
[i
] = pw
.hi1
[0][j
];
1852 plain_len
= pw
.pw_len
;
1854 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1857 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1859 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
1861 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1863 plain_len
+= start
+ stop
;
1866 crackpos
*= data
.combs_cnt
;
1867 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1869 if (data
.pw_max
!= PW_DICTMAX1
)
1871 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1875 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
1877 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1879 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1881 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
1885 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
1887 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
1889 plain_ptr
[j
] = plain_ptr
[i
];
1892 plain_len
= plain_len
/ 2;
1896 // if enabled, update also the potfile
1900 fprintf (pot_fp
, "%s:", out_buf
);
1902 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
1904 fputc ('\n', pot_fp
);
1911 FILE *out_fp
= NULL
;
1913 if (outfile
!= NULL
)
1915 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
1917 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
1926 if (quiet
== 0) clear_prompt ();
1929 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
1931 if (outfile
!= NULL
)
1933 if (out_fp
!= stdout
)
1940 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1942 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
1944 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
1945 if (quiet
== 0) fflush (stdout
);
1954 char *loopback_file
= data
.loopback_file
;
1958 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
1960 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
1962 fputc ('\n', fb_fp
);
1968 // (rule) debug mode
1970 // the next check implies that:
1971 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
1974 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
1976 if (debug_rule_len
< 0) debug_rule_len
= 0;
1978 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
1980 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
1982 if ((quiet
== 0) && (debug_file
== NULL
))
1984 fprintf (stdout
, "%s", PROMPT
);
1990 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
1992 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
1996 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
1998 for (uint i
= 0; i
< GPU_THREADS
; i
++) if (device_param
->result
[i
] == 1) found
= 1;
2002 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2006 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
);
2008 uint cpt_cracked
= 0;
2010 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2012 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2014 if (data
.digests_shown_tmp
[idx
] == 0) continue;
2016 if (data
.digests_shown
[idx
] == 1) continue;
2018 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2020 data
.digests_shown
[idx
] = 1;
2022 data
.digests_done
++;
2026 salt_buf
->digests_done
++;
2028 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2030 data
.salts_shown
[salt_pos
] = 1;
2036 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2038 check_hash (device_param
, salt_pos
, digest_pos
);
2041 if (cpt_cracked
> 0)
2043 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2044 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2048 data
.cpt_total
+= cpt_cracked
;
2050 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2053 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2055 // we need to reset cracked state on the gpu
2056 // otherwise host thinks again and again the hash was cracked
2057 // and returns invalid password each time
2059 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2061 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
);
2064 memset (device_param
->result
, 0, device_param
->size_results
);
2066 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2070 static void save_hash ()
2072 char *hashfile
= data
.hashfile
;
2074 char new_hashfile
[256];
2075 char old_hashfile
[256];
2077 memset (new_hashfile
, 0, sizeof (new_hashfile
));
2078 memset (old_hashfile
, 0, sizeof (old_hashfile
));
2080 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2081 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2083 unlink (new_hashfile
);
2085 char separator
= data
.separator
;
2087 FILE *fp
= fopen (new_hashfile
, "wb");
2091 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2096 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2098 if (data
.salts_shown
[salt_pos
] == 1) continue;
2100 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2102 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2104 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2106 if (data
.digests_shown
[idx
] == 1) continue;
2108 if (data
.hash_mode
!= 2500)
2112 memset (out_buf
, 0, sizeof (out_buf
));
2114 if (data
.username
== 1)
2116 user_t
*user
= data
.hash_info
[idx
]->user
;
2120 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2122 fputc (separator
, fp
);
2125 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2127 fputs (out_buf
, fp
);
2135 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2137 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2146 unlink (old_hashfile
);
2148 if (rename (hashfile
, old_hashfile
) != 0)
2150 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2157 if (rename (new_hashfile
, hashfile
) != 0)
2159 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2164 unlink (old_hashfile
);
2167 static float find_gpu_blocks_div (const uint64_t total_left
, const uint gpu_blocks_all
)
2169 // function called only in case gpu_blocks_all > words_left)
2171 float gpu_blocks_div
= (float) (total_left
) / gpu_blocks_all
;
2173 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2175 uint32_t gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2177 while (gpu_blocks_new
< total_left
)
2179 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2181 gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2184 if (data
.quiet
== 0)
2190 log_info ("INFO: approaching final keyspace, workload adjusted");
2194 fprintf (stdout
, "%s", PROMPT
);
2199 if ((gpu_blocks_all
* gpu_blocks_div
) < 8) return 1;
2201 return gpu_blocks_div
;
2204 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2206 uint num_elements
= num
;
2208 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2209 device_param
->kernel_params_buf32
[31] = num
;
2211 uint gpu_threads
= device_param
->gpu_threads
;
2213 while (num_elements
% gpu_threads
) num_elements
++;
2215 cl_kernel kernel
= NULL
;
2219 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2220 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2221 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2222 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2223 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2226 hc_clSetKernelArg (kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2227 hc_clSetKernelArg (kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2228 hc_clSetKernelArg (kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2229 hc_clSetKernelArg (kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2230 hc_clSetKernelArg (kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2231 hc_clSetKernelArg (kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2232 hc_clSetKernelArg (kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2233 hc_clSetKernelArg (kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2234 hc_clSetKernelArg (kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2235 hc_clSetKernelArg (kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2236 hc_clSetKernelArg (kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2238 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2240 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2241 const size_t local_work_size
[3] = { gpu_threads
/ 32, 32, 1 };
2243 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2247 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2248 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2250 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2253 hc_clFlush (device_param
->command_queue
);
2255 hc_clFinish (device_param
->command_queue
);
2258 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2260 uint num_elements
= num
;
2264 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2265 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2266 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2269 // causes problems with special threads like in bcrypt
2270 // const uint gpu_threads = device_param->gpu_threads;
2272 const uint gpu_threads
= GPU_THREADS
;
2274 while (num_elements
% gpu_threads
) num_elements
++;
2276 cl_kernel kernel
= NULL
;
2280 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2281 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2282 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2287 case KERN_RUN_MP
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2288 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2289 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2290 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2291 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2292 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2294 case KERN_RUN_MP_R
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2295 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2296 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2297 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2298 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2299 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2301 case KERN_RUN_MP_L
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2302 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2303 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2304 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2305 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2306 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2307 hc_clSetKernelArg (kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2311 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2312 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2314 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2316 hc_clFlush (device_param
->command_queue
);
2318 hc_clFinish (device_param
->command_queue
);
2321 static void run_kernel_tb (hc_device_param_t
*device_param
, const uint num
)
2323 uint num_elements
= num
;
2325 uint gpu_threads
= device_param
->gpu_threads
;
2327 while (num_elements
% gpu_threads
) num_elements
++;
2329 cl_kernel kernel
= device_param
->kernel_tb
;
2331 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2332 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2334 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2336 hc_clFlush (device_param
->command_queue
);
2338 hc_clFinish (device_param
->command_queue
);
2341 static void run_kernel_tm (hc_device_param_t
*device_param
)
2343 const uint num_elements
= 1024; // fixed
2345 const uint gpu_threads
= 32;
2347 cl_kernel kernel
= device_param
->kernel_tm
;
2349 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2350 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2352 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2354 hc_clFlush (device_param
->command_queue
);
2356 hc_clFinish (device_param
->command_queue
);
2359 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2361 uint num_elements
= num
;
2363 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2364 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2366 // causes problems with special threads like in bcrypt
2367 // const uint gpu_threads = device_param->gpu_threads;
2369 const uint gpu_threads
= GPU_THREADS
;
2371 while (num_elements
% gpu_threads
) num_elements
++;
2373 cl_kernel kernel
= device_param
->kernel_amp
;
2375 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2376 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2378 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2379 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2381 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2383 hc_clFlush (device_param
->command_queue
);
2385 hc_clFinish (device_param
->command_queue
);
2388 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const uint size
)
2390 // not supported with Nvidia
2391 // hc_clEnqueueFillBuffer (device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2393 char *tmp
= (char *) mymalloc (size
);
2395 memset (tmp
, 0, size
);
2397 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, 0, size
, tmp
, 0, NULL
, NULL
);
2402 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2408 else if (rule_len
== 1)
2410 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2416 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2418 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2420 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
);
2422 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2424 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
);
2426 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2428 const uint64_t off
= device_param
->words_off
;
2430 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2432 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2436 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2438 const uint gpu_loops
= data
.gpu_loops
;
2442 uint speed_pos
= device_param
->speed_pos
;
2445 if (device_param
->timer_speed
.tv_sec
== 0)
2447 hc_timer_set (&device_param
->timer_speed
);
2452 if (device_param
->timer_speed
.QuadPart
== 0)
2454 hc_timer_set (&device_param
->timer_speed
);
2458 // find higest password length, this is for optimization stuff
2460 uint highest_pw_len
= 0;
2462 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2465 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2468 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2470 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2471 + device_param
->kernel_params_mp_l_buf32
[5];
2474 // bitslice optimization stuff
2476 if (data
.attack_mode
== ATTACK_MODE_BF
)
2478 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2480 run_kernel_tb (device_param
, pws_cnt
);
2486 uint innerloop_step
= 0;
2487 uint innerloop_cnt
= 0;
2489 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2490 else innerloop_step
= 1;
2492 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2493 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2494 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2496 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2498 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2500 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2502 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2504 if (data
.devices_status
== STATUS_CRACKED
) break;
2505 if (data
.devices_status
== STATUS_ABORTED
) break;
2506 if (data
.devices_status
== STATUS_QUIT
) break;
2507 if (data
.devices_status
== STATUS_BYPASS
) break;
2509 if (data
.salts_shown
[salt_pos
] == 1) continue;
2511 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2513 device_param
->kernel_params_buf32
[24] = salt_pos
;
2514 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2515 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2517 FILE *combs_fp
= device_param
->combs_fp
;
2519 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2526 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2528 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2530 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2532 if (data
.devices_status
== STATUS_CRACKED
) break;
2533 if (data
.devices_status
== STATUS_ABORTED
) break;
2534 if (data
.devices_status
== STATUS_QUIT
) break;
2535 if (data
.devices_status
== STATUS_BYPASS
) break;
2537 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2539 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2541 device_param
->innerloop_pos
= innerloop_pos
;
2542 device_param
->innerloop_left
= innerloop_left
;
2544 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2546 if (innerloop_left
== 0) continue;
2548 // initialize amplifiers
2550 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2552 char line_buf
[BUFSIZ
];
2556 while (i
< innerloop_left
)
2558 if (feof (combs_fp
)) break;
2560 int line_len
= fgetl (combs_fp
, line_buf
);
2562 if (line_len
>= PW_MAX1
) continue;
2564 line_len
= convert_from_hex (line_buf
, line_len
);
2566 char *line_buf_new
= line_buf
;
2568 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2570 char rule_buf_out
[BLOCK_SIZE
];
2572 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2574 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2576 if (rule_len_out
< 0)
2578 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2583 line_len
= rule_len_out
;
2585 line_buf_new
= rule_buf_out
;
2588 line_len
= MIN (line_len
, PW_DICTMAX
);
2590 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2592 memcpy (ptr
, line_buf_new
, line_len
);
2594 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2596 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2598 uppercase (ptr
, line_len
);
2601 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2603 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2605 ptr
[line_len
] = 0x80;
2608 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2610 ptr
[line_len
] = 0x01;
2614 device_param
->combs_buf
[i
].pw_len
= line_len
;
2619 for (uint j
= i
; j
< innerloop_left
; j
++)
2621 device_param
->combs_buf
[j
].i
[0] = 0;
2622 device_param
->combs_buf
[j
].i
[1] = 0;
2623 device_param
->combs_buf
[j
].i
[2] = 0;
2624 device_param
->combs_buf
[j
].i
[3] = 0;
2625 device_param
->combs_buf
[j
].i
[4] = 0;
2626 device_param
->combs_buf
[j
].i
[5] = 0;
2627 device_param
->combs_buf
[j
].i
[6] = 0;
2628 device_param
->combs_buf
[j
].i
[7] = 0;
2630 device_param
->combs_buf
[j
].pw_len
= 0;
2635 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2637 uint64_t off
= innerloop_pos
;
2639 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2641 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2643 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2645 uint64_t off
= innerloop_pos
;
2647 device_param
->kernel_params_mp_buf64
[3] = off
;
2649 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2651 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2653 uint64_t off
= innerloop_pos
;
2655 device_param
->kernel_params_mp_buf64
[3] = off
;
2657 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2662 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2664 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
);
2666 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2668 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
);
2670 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2672 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
);
2674 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2676 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
);
2678 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2680 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
);
2683 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2685 if (data
.attack_mode
== ATTACK_MODE_BF
)
2687 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2689 const uint size_tm
= 32 * sizeof (bs_word_t
);
2691 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2693 run_kernel_tm (device_param
);
2695 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2699 if (highest_pw_len
< 16)
2701 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2703 else if (highest_pw_len
< 32)
2705 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2709 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2714 run_kernel_amp (device_param
, pws_cnt
);
2716 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2718 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2720 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2723 uint iter
= salt_buf
->salt_iter
;
2725 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2727 uint loop_left
= iter
- loop_pos
;
2729 loop_left
= MIN (loop_left
, gpu_loops
);
2731 device_param
->kernel_params_buf32
[25] = loop_pos
;
2732 device_param
->kernel_params_buf32
[26] = loop_left
;
2734 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2736 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2738 if (data
.devices_status
== STATUS_CRACKED
) break;
2739 if (data
.devices_status
== STATUS_ABORTED
) break;
2740 if (data
.devices_status
== STATUS_QUIT
) break;
2743 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2745 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2747 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2749 // do something with data
2751 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2754 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2757 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2759 if (data
.devices_status
== STATUS_CRACKED
) break;
2760 if (data
.devices_status
== STATUS_ABORTED
) break;
2761 if (data
.devices_status
== STATUS_QUIT
) break;
2767 hc_thread_mutex_lock (mux_display
);
2769 check_cracked (device_param
, salt_pos
);
2771 hc_thread_mutex_unlock (mux_display
);
2777 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2779 hc_thread_mutex_lock (mux_counter
);
2781 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2783 hc_thread_mutex_unlock (mux_counter
);
2791 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2793 hc_timer_set (&device_param
->timer_speed
);
2795 hc_thread_mutex_lock (mux_display
);
2797 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2799 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2801 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2803 hc_thread_mutex_unlock (mux_display
);
2807 if (speed_pos
== SPEED_CACHE
)
2814 device_param
->speed_pos
= speed_pos
;
2817 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2819 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2823 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2825 wl_data
->buf
[wl_data
->cnt
] = 0;
2827 if (wl_data
->cnt
== 0) return;
2829 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2833 if (wl_data
->cnt
== wl_data
->avail
)
2835 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2837 wl_data
->avail
+= wl_data
->incr
;
2840 const int c
= fgetc (fd
);
2842 if (c
== EOF
) break;
2844 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2848 if (c
== '\n') break;
2851 // ensure stream ends with a newline
2853 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2857 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
2863 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2867 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2869 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2879 if (*ptr
!= '\n') continue;
2883 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2894 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2898 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2900 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2902 if (*ptr
!= '\n') continue;
2906 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2917 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2921 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2923 if (*ptr
!= '\n') continue;
2927 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2938 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
2940 while (wl_data
->pos
< wl_data
->cnt
)
2945 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
2947 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
2949 wl_data
->pos
+= off
;
2951 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
2953 char rule_buf_out
[BLOCK_SIZE
];
2955 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2957 int rule_len_out
= -1;
2959 if (len
< BLOCK_SIZE
)
2961 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
2964 if (rule_len_out
< 0)
2969 if (rule_len_out
> PW_MAX
)
2990 fprintf (stderr
, "bug!!\n");
2995 load_segment (wl_data
, fd
);
2997 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3001 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3005 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3015 fstat (fileno (fd
), &d
.stat
);
3019 _fstat64 (fileno (fd
), &d
.stat
);
3023 d
.stat
.st_nlink
= 0;
3027 d
.stat
.st_atime
= 0;
3030 d
.stat
.st_blksize
= 0;
3031 d
.stat
.st_blocks
= 0;
3034 if (d
.stat
.st_size
== 0) return 0;
3036 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3038 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3042 uint64_t cnt
= d_cache
->cnt
;
3044 uint64_t keyspace
= cnt
;
3046 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3048 keyspace
*= data
.gpu_rules_cnt
;
3050 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3052 keyspace
*= data
.combs_cnt
;
3055 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
);
3056 if (data
.quiet
== 0) log_info ("");
3058 hc_signal (sigHandler_default
);
3073 load_segment (wl_data
, fd
);
3075 comp
+= wl_data
->cnt
;
3079 while (i
< wl_data
->cnt
)
3084 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3086 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3088 char rule_buf_out
[BLOCK_SIZE
];
3090 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3092 int rule_len_out
= -1;
3094 if (len
< BLOCK_SIZE
)
3096 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3099 if (rule_len_out
< 0)
3111 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3113 cnt
+= data
.gpu_rules_cnt
;
3115 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3117 cnt
+= data
.combs_cnt
;
3130 if ((now
- prev
) == 0) continue;
3132 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3134 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
);
3139 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
);
3140 if (data
.quiet
== 0) log_info ("");
3142 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3144 hc_signal (sigHandler_default
);
3149 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3151 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3154 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3156 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3158 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3160 uint cache_cnt
= pw_cache
->cnt
;
3162 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3164 memcpy (pw_hc1
, pw_buf
, pw_len
);
3166 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3168 uint pws_cnt
= device_param
->pws_cnt
;
3172 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3174 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3176 pw
->pw_len
= pw_len
;
3180 device_param
->pws_cnt
= pws_cnt
;
3181 device_param
->pw_cnt
= pws_cnt
* 1;
3185 pw_cache
->cnt
= cache_cnt
;
3190 static void *thread_monitor (void *p
)
3192 uint runtime_check
= 0;
3193 uint remove_check
= 0;
3194 uint status_check
= 0;
3195 uint hwmon_check
= 0;
3196 uint restore_check
= 0;
3198 uint restore_left
= data
.restore_timer
;
3199 uint remove_left
= data
.remove_timer
;
3200 uint status_left
= data
.status_timer
;
3202 // these variables are mainly used for fan control (AMD only)
3204 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3206 // temperature controller "loopback" values
3208 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3209 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3211 int temp_threshold
= 1; // degrees celcius
3213 int fan_speed_min
= 15; // in percentage
3214 int fan_speed_max
= 100;
3216 time_t last_temp_check_time
;
3218 uint sleep_time
= 1;
3225 if (data
.restore_timer
)
3230 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3235 if (data
.status
== 1)
3240 if (data
.gpu_temp_disable
== 0)
3242 time (&last_temp_check_time
);
3247 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3252 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3254 hc_sleep (sleep_time
);
3256 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3258 if (hwmon_check
== 1)
3260 hc_thread_mutex_lock (mux_adl
);
3262 time_t temp_check_time
;
3264 time (&temp_check_time
);
3266 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3268 if (Ta
== 0) Ta
= 1;
3270 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
3272 const int temperature
= hm_get_temperature_with_device_id (i
);
3274 if (temperature
> (int) data
.gpu_temp_abort
)
3276 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i
+ 1);
3278 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3283 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3285 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3287 if (data
.hm_device
[i
].fan_supported
== 1)
3289 int temp_cur
= temperature
;
3291 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3293 temp_diff_sum
[i
] = temp_diff_sum
[i
] + temp_diff_new
;
3295 // calculate Ta value (time difference in seconds between the last check and this check)
3297 last_temp_check_time
= temp_check_time
;
3303 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3305 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
);
3307 if (abs (fan_diff_required
) >= temp_threshold
)
3309 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (i
);
3311 int fan_speed_level
= fan_speed_cur
;
3313 if (fan_speed_chgd
[i
] == 0) fan_speed_level
= temp_cur
;
3315 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3317 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3318 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3320 if (fan_speed_new
!= fan_speed_cur
)
3322 int freely_change_fan_speed
= (fan_speed_chgd
[i
] == 1);
3323 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3325 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3327 hm_set_fanspeed_with_device_id_amd (i
, fan_speed_new
);
3329 fan_speed_chgd
[i
] = 1;
3332 temp_diff_old
[i
] = temp_diff_new
;
3339 hc_thread_mutex_unlock (mux_adl
);
3342 if (restore_check
== 1)
3346 if (restore_left
== 0)
3348 if (data
.restore_disable
== 0) cycle_restore ();
3350 restore_left
= data
.restore_timer
;
3354 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3358 time (&runtime_cur
);
3360 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3362 if (runtime_left
<= 0)
3364 if (data
.benchmark
== 0)
3366 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3369 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3373 if (remove_check
== 1)
3377 if (remove_left
== 0)
3379 if (data
.digests_saved
!= data
.digests_done
)
3381 data
.digests_saved
= data
.digests_done
;
3386 remove_left
= data
.remove_timer
;
3390 if (status_check
== 1)
3394 if (status_left
== 0)
3396 hc_thread_mutex_lock (mux_display
);
3398 if (data
.quiet
== 0) clear_prompt ();
3400 if (data
.quiet
== 0) log_info ("");
3404 if (data
.quiet
== 0) log_info ("");
3406 hc_thread_mutex_unlock (mux_display
);
3408 status_left
= data
.status_timer
;
3413 myfree (fan_speed_chgd
);
3415 myfree (temp_diff_old
);
3416 myfree (temp_diff_sum
);
3423 static void *thread_outfile_remove (void *p
)
3425 // some hash-dependent constants
3426 char *outfile_dir
= data
.outfile_check_directory
;
3427 uint dgst_size
= data
.dgst_size
;
3428 uint isSalted
= data
.isSalted
;
3429 uint esalt_size
= data
.esalt_size
;
3430 uint hash_mode
= data
.hash_mode
;
3432 uint outfile_check_timer
= data
.outfile_check_timer
;
3434 char separator
= data
.separator
;
3436 // some hash-dependent functions
3437 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3438 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3443 memset (&hash_buf
, 0, sizeof (hash_buf
));
3445 hash_buf
.digest
= mymalloc (dgst_size
);
3447 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3449 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3451 uint digest_buf
[64];
3453 outfile_data_t
*out_info
= NULL
;
3455 char **out_files
= NULL
;
3457 time_t folder_mtime
= 0;
3461 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3463 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3467 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3471 if (check_left
== 0)
3473 struct stat outfile_check_stat
;
3475 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3477 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3481 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3483 char **out_files_new
= scan_directory (outfile_dir
);
3485 int out_cnt_new
= count_dictionaries (out_files_new
);
3487 outfile_data_t
*out_info_new
= NULL
;
3489 if (out_cnt_new
> 0)
3491 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3493 for (int i
= 0; i
< out_cnt_new
; i
++)
3495 out_info_new
[i
].file_name
= out_files_new
[i
];
3497 // check if there are files that we have seen/checked before (and not changed)
3499 for (int j
= 0; j
< out_cnt
; j
++)
3501 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3503 struct stat outfile_stat
;
3505 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3507 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3509 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3510 out_info_new
[i
].seek
= out_info
[j
].seek
;
3518 local_free (out_info
);
3519 local_free (out_files
);
3521 out_files
= out_files_new
;
3522 out_cnt
= out_cnt_new
;
3523 out_info
= out_info_new
;
3525 folder_mtime
= outfile_check_stat
.st_mtime
;
3528 for (int j
= 0; j
< out_cnt
; j
++)
3530 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3534 //hc_thread_mutex_lock (mux_display);
3537 struct stat outfile_stat
;
3539 fstat (fileno (fp
), &outfile_stat
);
3543 struct stat64 outfile_stat
;
3545 _fstat64 (fileno (fp
), &outfile_stat
);
3548 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3550 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3551 out_info
[j
].seek
= 0;
3554 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3558 char line_buf
[BUFSIZ
];
3560 memset (line_buf
, 0, BUFSIZ
);
3562 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3564 if (ptr
== NULL
) break;
3566 int line_len
= strlen (line_buf
);
3568 if (line_len
<= 0) continue;
3570 int iter
= MAX_CUT_TRIES
;
3572 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3574 if (line_buf
[i
] != separator
) continue;
3576 int parser_status
= PARSER_OK
;
3578 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3580 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3585 if (parser_status
== PARSER_OK
)
3587 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3589 if (data
.salts_shown
[salt_pos
] == 1) continue;
3591 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3593 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3595 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3597 if (data
.digests_shown
[idx
] == 1) continue;
3601 if (hash_mode
== 6800)
3603 if (i
== salt_buf
->salt_len
)
3605 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3608 else if (hash_mode
== 2500)
3610 // BSSID : MAC1 : MAC2 (:plain)
3611 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3613 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3615 if (!cracked
) continue;
3617 // now compare MAC1 and MAC2 too, since we have this additional info
3618 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3619 char *mac2_pos
= mac1_pos
+ 12 + 1;
3621 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3622 wpa_t
*wpa
= &wpas
[salt_pos
];
3626 char *pke_ptr
= (char *) pke
;
3628 for (uint i
= 0; i
< 25; i
++)
3630 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3633 unsigned char mac1
[6];
3634 unsigned char mac2
[6];
3636 memcpy (mac1
, pke_ptr
+ 23, 6);
3637 memcpy (mac2
, pke_ptr
+ 29, 6);
3639 // compare hex string(s) vs binary MAC address(es)
3641 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3643 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3651 if (!cracked
) continue;
3653 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3655 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3665 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3667 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3669 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3676 data
.digests_shown
[idx
] = 1;
3678 data
.digests_done
++;
3680 salt_buf
->digests_done
++;
3682 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3684 data
.salts_shown
[salt_pos
] = 1;
3688 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3693 if (data
.devices_status
== STATUS_CRACKED
) break;
3699 if (data
.devices_status
== STATUS_CRACKED
) break;
3704 if (data
.devices_status
== STATUS_CRACKED
) break;
3707 out_info
[j
].seek
= ftell (fp
);
3709 //hc_thread_mutex_unlock (mux_display);
3717 check_left
= outfile_check_timer
;
3721 if (esalt_size
) local_free (hash_buf
.esalt
);
3723 if (isSalted
) local_free (hash_buf
.salt
);
3725 local_free (hash_buf
.digest
);
3727 local_free (out_info
);
3729 local_free (out_files
);
3736 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3738 hc_thread_mutex_lock (mux_dispatcher
);
3740 const uint64_t words_cur
= data
.words_cur
;
3741 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3743 device_param
->words_off
= words_cur
;
3745 const uint64_t words_left
= words_base
- words_cur
;
3747 if (data
.gpu_blocks_all
> words_left
)
3749 if (data
.gpu_blocks_div
== 0)
3751 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3755 if (data
.gpu_blocks_div
)
3757 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3759 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3760 const uint32_t gpu_power_new
= gpu_blocks_new
;
3762 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3764 device_param
->gpu_blocks
= gpu_blocks_new
;
3765 device_param
->gpu_power
= gpu_power_new
;
3770 const uint gpu_blocks
= device_param
->gpu_blocks
;
3772 uint work
= MIN (words_left
, gpu_blocks
);
3774 work
= MIN (work
, max
);
3776 data
.words_cur
+= work
;
3778 hc_thread_mutex_unlock (mux_dispatcher
);
3783 static void *thread_calc_stdin (void *p
)
3785 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3787 const uint attack_kern
= data
.attack_kern
;
3789 const uint gpu_blocks
= device_param
->gpu_blocks
;
3791 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3793 hc_thread_mutex_lock (mux_dispatcher
);
3795 if (feof (stdin
) != 0)
3797 hc_thread_mutex_unlock (mux_dispatcher
);
3804 while (words_cur
< gpu_blocks
)
3808 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3810 if (line_buf
== NULL
) break;
3812 uint line_len
= in_superchop (line_buf
);
3814 line_len
= convert_from_hex (line_buf
, line_len
);
3816 // post-process rule engine
3818 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3820 char rule_buf_out
[BLOCK_SIZE
];
3822 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3824 int rule_len_out
= -1;
3826 if (line_len
< BLOCK_SIZE
)
3828 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3831 if (rule_len_out
< 0) continue;
3833 line_buf
= rule_buf_out
;
3834 line_len
= rule_len_out
;
3837 if (line_len
> PW_MAX
)
3842 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3844 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3846 hc_thread_mutex_lock (mux_counter
);
3848 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3850 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3853 hc_thread_mutex_unlock (mux_counter
);
3858 else if (attack_kern
== ATTACK_KERN_COMBI
)
3860 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
3861 // since we still need to combine the plains
3863 if (line_len
> data
.pw_max
)
3865 hc_thread_mutex_lock (mux_counter
);
3867 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3869 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
3872 hc_thread_mutex_unlock (mux_counter
);
3878 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
3882 if (data
.devices_status
== STATUS_CRACKED
) break;
3883 if (data
.devices_status
== STATUS_ABORTED
) break;
3884 if (data
.devices_status
== STATUS_QUIT
) break;
3885 if (data
.devices_status
== STATUS_BYPASS
) break;
3888 hc_thread_mutex_unlock (mux_dispatcher
);
3890 if (data
.devices_status
== STATUS_CRACKED
) break;
3891 if (data
.devices_status
== STATUS_ABORTED
) break;
3892 if (data
.devices_status
== STATUS_QUIT
) break;
3893 if (data
.devices_status
== STATUS_BYPASS
) break;
3895 // we need 2 flushing because we have two independant caches and it can occur
3896 // that one buffer is already at threshold plus for that length also exists
3897 // more data in the 2nd buffer so it would overflow
3902 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
3904 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
3906 const uint pw_cache_cnt
= pw_cache
->cnt
;
3908 if (pw_cache_cnt
== 0) continue;
3912 uint pws_cnt
= device_param
->pws_cnt
;
3914 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3916 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3918 pw
->pw_len
= pw_len
;
3920 uint pw_cnt
= device_param
->pw_cnt
;
3922 pw_cnt
+= pw_cache_cnt
;
3924 device_param
->pw_cnt
= pw_cnt
;
3928 device_param
->pws_cnt
= pws_cnt
;
3930 if (pws_cnt
== device_param
->gpu_power_user
) break;
3933 const uint pw_cnt
= device_param
->pw_cnt
;
3934 const uint pws_cnt
= device_param
->pws_cnt
;
3938 run_copy (device_param
, pws_cnt
);
3940 run_cracker (device_param
, pw_cnt
, pws_cnt
);
3942 device_param
->pw_cnt
= 0;
3943 device_param
->pws_cnt
= 0;
3950 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
3952 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
3954 const uint pw_cache_cnt
= pw_cache
->cnt
;
3956 if (pw_cache_cnt
== 0) continue;
3960 uint pws_cnt
= device_param
->pws_cnt
;
3962 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3964 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3966 pw
->pw_len
= pw_len
;
3968 uint pw_cnt
= device_param
->pw_cnt
;
3970 pw_cnt
+= pw_cache_cnt
;
3972 device_param
->pw_cnt
= pw_cnt
;
3976 device_param
->pws_cnt
= pws_cnt
;
3979 const uint pw_cnt
= device_param
->pw_cnt
;
3980 const uint pws_cnt
= device_param
->pws_cnt
;
3984 run_copy (device_param
, pws_cnt
);
3986 run_cracker (device_param
, pw_cnt
, pws_cnt
);
3988 device_param
->pw_cnt
= 0;
3989 device_param
->pws_cnt
= 0;
3997 static void *thread_calc (void *p
)
3999 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4001 const uint attack_mode
= data
.attack_mode
;
4002 const uint attack_kern
= data
.attack_kern
;
4004 if (attack_mode
== ATTACK_MODE_BF
)
4006 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4008 const uint work
= get_work (device_param
, -1);
4010 if (work
== 0) break;
4012 const uint64_t words_off
= device_param
->words_off
;
4013 const uint64_t words_fin
= words_off
+ work
;
4015 const uint pw_cnt
= work
;
4016 const uint pws_cnt
= work
;
4018 device_param
->pw_cnt
= pw_cnt
;
4019 device_param
->pws_cnt
= pws_cnt
;
4023 run_copy (device_param
, pws_cnt
);
4025 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4027 device_param
->pw_cnt
= 0;
4028 device_param
->pws_cnt
= 0;
4031 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4033 if (data
.devices_status
== STATUS_CRACKED
) break;
4034 if (data
.devices_status
== STATUS_ABORTED
) break;
4035 if (data
.devices_status
== STATUS_QUIT
) break;
4036 if (data
.devices_status
== STATUS_BYPASS
) break;
4038 device_param
->words_done
= words_fin
;
4043 const uint segment_size
= data
.segment_size
;
4045 char *dictfile
= data
.dictfile
;
4047 if (attack_mode
== ATTACK_MODE_COMBI
)
4049 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4051 dictfile
= data
.dictfile2
;
4055 FILE *fd
= fopen (dictfile
, "rb");
4059 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4064 if (attack_mode
== ATTACK_MODE_COMBI
)
4066 const uint combs_mode
= data
.combs_mode
;
4068 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4070 const char *dictfilec
= data
.dictfile2
;
4072 FILE *combs_fp
= fopen (dictfilec
, "rb");
4074 if (combs_fp
== NULL
)
4076 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4083 device_param
->combs_fp
= combs_fp
;
4085 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4087 const char *dictfilec
= data
.dictfile
;
4089 FILE *combs_fp
= fopen (dictfilec
, "rb");
4091 if (combs_fp
== NULL
)
4093 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4100 device_param
->combs_fp
= combs_fp
;
4104 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4106 wl_data
->buf
= (char *) mymalloc (segment_size
);
4107 wl_data
->avail
= segment_size
;
4108 wl_data
->incr
= segment_size
;
4112 uint64_t words_cur
= 0;
4114 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4116 uint64_t words_off
= 0;
4117 uint64_t words_fin
= 0;
4123 const uint work
= get_work (device_param
, max
);
4125 if (work
== 0) break;
4127 words_off
= device_param
->words_off
;
4128 words_fin
= words_off
+ work
;
4133 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4137 for ( ; words_cur
< words_fin
; words_cur
++)
4139 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4141 line_len
= convert_from_hex (line_buf
, line_len
);
4143 // post-process rule engine
4145 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4147 char rule_buf_out
[BLOCK_SIZE
];
4149 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4151 int rule_len_out
= -1;
4153 if (line_len
< BLOCK_SIZE
)
4155 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4158 if (rule_len_out
< 0) continue;
4160 line_buf
= rule_buf_out
;
4161 line_len
= rule_len_out
;
4164 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4166 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4170 hc_thread_mutex_lock (mux_counter
);
4172 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4174 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4177 hc_thread_mutex_unlock (mux_counter
);
4182 else if (attack_kern
== ATTACK_KERN_COMBI
)
4184 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4185 // since we still need to combine the plains
4187 if (line_len
> data
.pw_max
)
4191 hc_thread_mutex_lock (mux_counter
);
4193 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4195 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4198 hc_thread_mutex_unlock (mux_counter
);
4204 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4206 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4208 if (data
.devices_status
== STATUS_CRACKED
) break;
4209 if (data
.devices_status
== STATUS_ABORTED
) break;
4210 if (data
.devices_status
== STATUS_QUIT
) break;
4211 if (data
.devices_status
== STATUS_BYPASS
) break;
4214 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4216 if (data
.devices_status
== STATUS_CRACKED
) break;
4217 if (data
.devices_status
== STATUS_ABORTED
) break;
4218 if (data
.devices_status
== STATUS_QUIT
) break;
4219 if (data
.devices_status
== STATUS_BYPASS
) break;
4222 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4224 if (data
.devices_status
== STATUS_CRACKED
) break;
4225 if (data
.devices_status
== STATUS_ABORTED
) break;
4226 if (data
.devices_status
== STATUS_QUIT
) break;
4227 if (data
.devices_status
== STATUS_BYPASS
) break;
4229 // we need 2 flushing because we have two independant caches and it can occur
4230 // that one buffer is already at threshold plus for that length also exists
4231 // more data in the 2nd buffer so it would overflow
4238 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4240 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4242 const uint pw_cache_cnt
= pw_cache
->cnt
;
4244 if (pw_cache_cnt
== 0) continue;
4248 uint pws_cnt
= device_param
->pws_cnt
;
4250 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4252 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4254 pw
->pw_len
= pw_len
;
4256 uint pw_cnt
= device_param
->pw_cnt
;
4258 pw_cnt
+= pw_cache_cnt
;
4260 device_param
->pw_cnt
= pw_cnt
;
4264 device_param
->pws_cnt
= pws_cnt
;
4266 if (pws_cnt
== device_param
->gpu_power_user
) break;
4269 const uint pw_cnt
= device_param
->pw_cnt
;
4270 const uint pws_cnt
= device_param
->pws_cnt
;
4274 run_copy (device_param
, pws_cnt
);
4276 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4278 device_param
->pw_cnt
= 0;
4279 device_param
->pws_cnt
= 0;
4282 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4284 if (data
.devices_status
== STATUS_CRACKED
) break;
4285 if (data
.devices_status
== STATUS_ABORTED
) break;
4286 if (data
.devices_status
== STATUS_QUIT
) break;
4287 if (data
.devices_status
== STATUS_BYPASS
) break;
4295 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4297 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4299 const uint pw_cache_cnt
= pw_cache
->cnt
;
4301 if (pw_cache_cnt
== 0) continue;
4305 uint pws_cnt
= device_param
->pws_cnt
;
4307 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4309 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4311 pw
->pw_len
= pw_len
;
4313 uint pw_cnt
= device_param
->pw_cnt
;
4315 pw_cnt
+= pw_cache_cnt
;
4317 device_param
->pw_cnt
= pw_cnt
;
4321 device_param
->pws_cnt
= pws_cnt
;
4324 const uint pw_cnt
= device_param
->pw_cnt
;
4325 const uint pws_cnt
= device_param
->pws_cnt
;
4329 run_copy (device_param
, pws_cnt
);
4331 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4333 device_param
->pw_cnt
= 0;
4334 device_param
->pws_cnt
= 0;
4337 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4339 if (data
.devices_status
== STATUS_CRACKED
) break;
4340 if (data
.devices_status
== STATUS_ABORTED
) break;
4341 if (data
.devices_status
== STATUS_QUIT
) break;
4342 if (data
.devices_status
== STATUS_BYPASS
) break;
4345 if (words_fin
== 0) break;
4347 device_param
->words_done
= words_fin
;
4350 if (attack_mode
== ATTACK_MODE_COMBI
)
4352 fclose (device_param
->combs_fp
);
4355 free (wl_data
->buf
);
4364 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4366 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4368 device_param
->kernel_params_buf32
[24] = salt_pos
;
4369 device_param
->kernel_params_buf32
[27] = 1;
4370 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4371 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4372 device_param
->kernel_params_buf32
[30] = 0;
4373 device_param
->kernel_params_buf32
[31] = 1;
4375 char *dictfile_old
= data
.dictfile
;
4376 char *dictfile2_old
= data
.dictfile2
;
4377 char *mask_old
= data
.mask
;
4379 const char *weak_hash_check
= "weak-hash-check";
4381 data
.dictfile
= (char *) weak_hash_check
;
4382 data
.dictfile2
= (char *) weak_hash_check
;
4383 data
.mask
= (char *) weak_hash_check
;
4389 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4391 run_kernel (KERN_RUN_1
, device_param
, 1);
4395 run_kernel (KERN_RUN_1
, device_param
, 1);
4397 const uint iter
= salt_buf
->salt_iter
;
4399 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4401 uint loop_left
= iter
- loop_pos
;
4403 loop_left
= MIN (loop_left
, gpu_loops
);
4405 device_param
->kernel_params_buf32
[25] = loop_pos
;
4406 device_param
->kernel_params_buf32
[26] = loop_left
;
4408 run_kernel (KERN_RUN_2
, device_param
, 1);
4411 run_kernel (KERN_RUN_3
, device_param
, 1);
4418 check_cracked (device_param
, salt_pos
);
4424 device_param
->kernel_params_buf32
[24] = 0;
4425 device_param
->kernel_params_buf32
[25] = 0;
4426 device_param
->kernel_params_buf32
[26] = 0;
4427 device_param
->kernel_params_buf32
[27] = 0;
4428 device_param
->kernel_params_buf32
[28] = 0;
4429 device_param
->kernel_params_buf32
[29] = 0;
4430 device_param
->kernel_params_buf32
[30] = 0;
4431 device_param
->kernel_params_buf32
[31] = 0;
4433 data
.dictfile
= dictfile_old
;
4434 data
.dictfile2
= dictfile2_old
;
4435 data
.mask
= mask_old
;
4440 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4442 if (data
.username
== 0)
4444 *hashbuf_pos
= line_buf
;
4445 *hashbuf_len
= line_len
;
4449 char *pos
= line_buf
;
4452 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4454 if (line_buf
[i
] == data
.separator
)
4469 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4476 for (int i
= 0; i
< line_len
; i
++)
4478 if (line_buf
[i
] == data
.separator
)
4487 if (pos
== NULL
) pos
= line_buf
+ i
;
4499 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4506 for (int i
= 0; i
< line_len
; i
++)
4508 if (line_buf
[i
] == ':')
4515 if (sep_cnt
== 2) sep2_len
++;
4516 if (sep_cnt
== 3) sep3_len
++;
4519 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4524 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4531 for (int i
= 0; i
< line_len
; i
++)
4533 if (line_buf
[i
] == ':')
4540 if (data
.hash_mode
== 1000)
4544 if (pos
== NULL
) pos
= line_buf
+ i
;
4549 else if (data
.hash_mode
== 3000)
4553 if (pos
== NULL
) pos
= line_buf
+ i
;
4564 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4571 for (int i
= 0; i
< line_len
; i
++)
4573 if (line_buf
[i
] == ':')
4582 if (pos
== NULL
) pos
= line_buf
+ i
;
4594 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4598 char sep5_first
= 0;
4599 char sep6_first
= 0;
4601 for (int i
= 0; i
< line_len
; i
++)
4603 if (line_buf
[i
] == ':')
4610 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4611 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4614 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4619 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4626 for (int i
= 0; i
< line_len
; i
++)
4628 if (line_buf
[i
] == ':')
4637 if (pos
== NULL
) pos
= line_buf
+ i
;
4647 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4654 for (int i
= 0; i
< line_len
; i
++)
4656 if (line_buf
[i
] == ':')
4665 if (pos
== NULL
) pos
= line_buf
+ i
;
4677 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4681 for (int i
= 0; i
< line_len
; i
++)
4683 if (line_buf
[i
] == ':') sep_cnt
++;
4686 if (sep_cnt
== 8) return 1;
4691 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4693 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4696 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4698 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4703 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4705 switch (hashfile_format
)
4707 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4708 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4709 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4710 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4714 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4716 switch (hashfile_format
)
4718 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4719 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4720 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4721 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4725 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4727 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4729 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4730 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4732 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4738 char line_buf
[BUFSIZ
];
4740 int line_len
= fgetl (fp
, line_buf
);
4742 if (line_len
== 0) continue;
4744 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4745 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4746 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4748 if (num_check
== max_check
) break;
4753 uint hashlist_format
= HLFMT_HASHCAT
;
4755 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4757 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4759 hashlist_format
= i
;
4764 return hashlist_format
;
4768 * some further helper function
4771 // wrapper around mymalloc for ADL
4773 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4775 return mymalloc (iSize
);
4778 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
)
4780 uint64_t collisions
= 0;
4782 const uint dgst_pos0
= data
.dgst_pos0
;
4783 const uint dgst_pos1
= data
.dgst_pos1
;
4784 const uint dgst_pos2
= data
.dgst_pos2
;
4785 const uint dgst_pos3
= data
.dgst_pos3
;
4787 memset (bitmap_a
, 0, bitmap_size
);
4788 memset (bitmap_b
, 0, bitmap_size
);
4789 memset (bitmap_c
, 0, bitmap_size
);
4790 memset (bitmap_d
, 0, bitmap_size
);
4792 for (uint i
= 0; i
< digests_cnt
; i
++)
4794 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4796 digests_buf_ptr
+= dgst_size
;
4798 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4799 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4800 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4801 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4803 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4804 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4805 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4806 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4808 if (bitmap_a
[idx0
] & val0
) collisions
++;
4809 if (bitmap_b
[idx1
] & val1
) collisions
++;
4810 if (bitmap_c
[idx2
] & val2
) collisions
++;
4811 if (bitmap_d
[idx3
] & val3
) collisions
++;
4813 bitmap_a
[idx0
] |= val0
;
4814 bitmap_b
[idx1
] |= val1
;
4815 bitmap_c
[idx2
] |= val2
;
4816 bitmap_d
[idx3
] |= val3
;
4818 if (collisions
>= collisions_max
) return 0x7fffffff;
4828 int main (int argc
, char **argv
)
4831 * To help users a bit
4834 char *compute
= getenv ("COMPUTE");
4840 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4846 if (getenv ("DISPLAY") == NULL
)
4847 putenv ((char *) "DISPLAY=:0");
4851 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4852 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4854 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4855 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
4862 memset (&data
, 0, sizeof (hc_global_data_t
));
4868 data
.proc_start
= proc_start
;
4871 char **myargv
= argv
;
4873 hc_thread_mutex_init (mux_dispatcher
);
4874 hc_thread_mutex_init (mux_counter
);
4875 hc_thread_mutex_init (mux_display
);
4876 hc_thread_mutex_init (mux_adl
);
4879 * commandline parameters
4883 uint version
= VERSION
;
4885 uint benchmark
= BENCHMARK
;
4886 uint benchmark_mode
= BENCHMARK_MODE
;
4889 uint username
= USERNAME
;
4890 uint remove
= REMOVE
;
4891 uint remove_timer
= REMOVE_TIMER
;
4892 uint64_t skip
= SKIP
;
4893 uint64_t limit
= LIMIT
;
4894 uint keyspace
= KEYSPACE
;
4895 uint potfile_disable
= POTFILE_DISABLE
;
4896 uint debug_mode
= DEBUG_MODE
;
4897 char *debug_file
= NULL
;
4898 char *induction_dir
= NULL
;
4899 char *outfile_check_dir
= NULL
;
4901 uint runtime
= RUNTIME
;
4902 uint hash_mode
= HASH_MODE
;
4903 uint attack_mode
= ATTACK_MODE
;
4904 uint markov_disable
= MARKOV_DISABLE
;
4905 uint markov_classic
= MARKOV_CLASSIC
;
4906 uint markov_threshold
= MARKOV_THRESHOLD
;
4907 char *markov_hcstat
= NULL
;
4908 char *outfile
= NULL
;
4909 uint outfile_format
= OUTFILE_FORMAT
;
4910 uint outfile_autohex
= OUTFILE_AUTOHEX
;
4911 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
4912 uint restore
= RESTORE
;
4913 uint restore_timer
= RESTORE_TIMER
;
4914 uint restore_disable
= RESTORE_DISABLE
;
4915 uint status
= STATUS
;
4916 uint status_timer
= STATUS_TIMER
;
4917 uint status_automat
= STATUS_AUTOMAT
;
4918 uint loopback
= LOOPBACK
;
4919 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
4920 char *session
= NULL
;
4921 uint hex_charset
= HEX_CHARSET
;
4922 uint hex_salt
= HEX_SALT
;
4923 uint hex_wordlist
= HEX_WORDLIST
;
4924 uint rp_gen
= RP_GEN
;
4925 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
4926 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
4927 uint rp_gen_seed
= RP_GEN_SEED
;
4928 char *rule_buf_l
= (char *) RULE_BUF_L
;
4929 char *rule_buf_r
= (char *) RULE_BUF_R
;
4930 uint increment
= INCREMENT
;
4931 uint increment_min
= INCREMENT_MIN
;
4932 uint increment_max
= INCREMENT_MAX
;
4933 char *cpu_affinity
= NULL
;
4934 char *gpu_devices
= NULL
;
4935 char *truecrypt_keyfiles
= NULL
;
4936 uint workload_profile
= WORKLOAD_PROFILE
;
4937 uint gpu_accel
= GPU_ACCEL
;
4938 uint gpu_loops
= GPU_LOOPS
;
4939 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
4940 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
4941 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
4942 uint powertune_enable
= POWERTUNE_ENABLE
;
4943 uint logfile_disable
= LOGFILE_DISABLE
;
4944 uint segment_size
= SEGMENT_SIZE
;
4945 uint scrypt_tmto
= SCRYPT_TMTO
;
4946 char separator
= SEPARATOR
;
4947 uint bitmap_min
= BITMAP_MIN
;
4948 uint bitmap_max
= BITMAP_MAX
;
4949 char *custom_charset_1
= NULL
;
4950 char *custom_charset_2
= NULL
;
4951 char *custom_charset_3
= NULL
;
4952 char *custom_charset_4
= NULL
;
4954 #define IDX_HELP 'h'
4955 #define IDX_VERSION 'V'
4956 #define IDX_VERSION_LOWER 'v'
4957 #define IDX_QUIET 0xff02
4958 #define IDX_SHOW 0xff03
4959 #define IDX_LEFT 0xff04
4960 #define IDX_REMOVE 0xff05
4961 #define IDX_REMOVE_TIMER 0xff37
4962 #define IDX_SKIP 's'
4963 #define IDX_LIMIT 'l'
4964 #define IDX_KEYSPACE 0xff35
4965 #define IDX_POTFILE_DISABLE 0xff06
4966 #define IDX_DEBUG_MODE 0xff43
4967 #define IDX_DEBUG_FILE 0xff44
4968 #define IDX_INDUCTION_DIR 0xff46
4969 #define IDX_OUTFILE_CHECK_DIR 0xff47
4970 #define IDX_USERNAME 0xff07
4971 #define IDX_FORCE 0xff08
4972 #define IDX_RUNTIME 0xff09
4973 #define IDX_BENCHMARK 'b'
4974 #define IDX_BENCHMARK_MODE 0xff32
4975 #define IDX_HASH_MODE 'm'
4976 #define IDX_ATTACK_MODE 'a'
4977 #define IDX_RP_FILE 'r'
4978 #define IDX_RP_GEN 'g'
4979 #define IDX_RP_GEN_FUNC_MIN 0xff10
4980 #define IDX_RP_GEN_FUNC_MAX 0xff11
4981 #define IDX_RP_GEN_SEED 0xff34
4982 #define IDX_RULE_BUF_L 'j'
4983 #define IDX_RULE_BUF_R 'k'
4984 #define IDX_INCREMENT 'i'
4985 #define IDX_INCREMENT_MIN 0xff12
4986 #define IDX_INCREMENT_MAX 0xff13
4987 #define IDX_OUTFILE 'o'
4988 #define IDX_OUTFILE_FORMAT 0xff14
4989 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
4990 #define IDX_OUTFILE_CHECK_TIMER 0xff45
4991 #define IDX_RESTORE 0xff15
4992 #define IDX_RESTORE_DISABLE 0xff27
4993 #define IDX_STATUS 0xff17
4994 #define IDX_STATUS_TIMER 0xff18
4995 #define IDX_STATUS_AUTOMAT 0xff50
4996 #define IDX_LOOPBACK 0xff38
4997 #define IDX_WEAK_HASH_THRESHOLD 0xff42
4998 #define IDX_SESSION 0xff19
4999 #define IDX_HEX_CHARSET 0xff20
5000 #define IDX_HEX_SALT 0xff21
5001 #define IDX_HEX_WORDLIST 0xff40
5002 #define IDX_MARKOV_DISABLE 0xff22
5003 #define IDX_MARKOV_CLASSIC 0xff23
5004 #define IDX_MARKOV_THRESHOLD 't'
5005 #define IDX_MARKOV_HCSTAT 0xff24
5006 #define IDX_CPU_AFFINITY 0xff25
5007 #define IDX_GPU_DEVICES 'd'
5008 #define IDX_WORKLOAD_PROFILE 'w'
5009 #define IDX_GPU_ACCEL 'n'
5010 #define IDX_GPU_LOOPS 'u'
5011 #define IDX_GPU_TEMP_DISABLE 0xff29
5012 #define IDX_GPU_TEMP_ABORT 0xff30
5013 #define IDX_GPU_TEMP_RETAIN 0xff31
5014 #define IDX_POWERTUNE_ENABLE 0xff41
5015 #define IDX_LOGFILE_DISABLE 0xff51
5016 #define IDX_TRUECRYPT_KEYFILES 0xff52
5017 #define IDX_SCRYPT_TMTO 0xff61
5018 #define IDX_SEGMENT_SIZE 'c'
5019 #define IDX_SEPARATOR 'p'
5020 #define IDX_BITMAP_MIN 0xff70
5021 #define IDX_BITMAP_MAX 0xff71
5022 #define IDX_CUSTOM_CHARSET_1 '1'
5023 #define IDX_CUSTOM_CHARSET_2 '2'
5024 #define IDX_CUSTOM_CHARSET_3 '3'
5025 #define IDX_CUSTOM_CHARSET_4 '4'
5027 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5029 struct option long_options
[] =
5031 {"help", no_argument
, 0, IDX_HELP
},
5032 {"version", no_argument
, 0, IDX_VERSION
},
5033 {"quiet", no_argument
, 0, IDX_QUIET
},
5034 {"show", no_argument
, 0, IDX_SHOW
},
5035 {"left", no_argument
, 0, IDX_LEFT
},
5036 {"username", no_argument
, 0, IDX_USERNAME
},
5037 {"remove", no_argument
, 0, IDX_REMOVE
},
5038 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5039 {"skip", required_argument
, 0, IDX_SKIP
},
5040 {"limit", required_argument
, 0, IDX_LIMIT
},
5041 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5042 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5043 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5044 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5045 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5046 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5047 {"force", no_argument
, 0, IDX_FORCE
},
5048 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5049 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5050 {"restore", no_argument
, 0, IDX_RESTORE
},
5051 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5052 {"status", no_argument
, 0, IDX_STATUS
},
5053 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5054 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5055 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5056 {"weak-hash-threshold",
5057 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5058 {"session", required_argument
, 0, IDX_SESSION
},
5059 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5060 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5061 {"generate-rules-func-min",
5062 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5063 {"generate-rules-func-max",
5064 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5065 {"generate-rules-seed",
5066 required_argument
, 0, IDX_RP_GEN_SEED
},
5067 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5068 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5069 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5070 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5071 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5072 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5073 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5074 {"outfile-autohex-disable",
5075 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5076 {"outfile-check-timer",
5077 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5078 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5079 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5080 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5081 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5082 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5083 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5084 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5085 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5086 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5087 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5088 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5089 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5090 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5091 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5092 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5093 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5094 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5095 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5096 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5097 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5099 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5100 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5101 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5102 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5103 {"increment", no_argument
, 0, IDX_INCREMENT
},
5104 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5105 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5106 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5107 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5108 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5109 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5114 uint rp_files_cnt
= 0;
5116 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5125 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5129 case IDX_HELP
: usage
= 1; break;
5131 case IDX_VERSION_LOWER
: version
= 1; break;
5132 case IDX_RESTORE
: restore
= 1; break;
5133 case IDX_SESSION
: session
= optarg
; break;
5134 case IDX_SHOW
: show
= 1; break;
5135 case IDX_LEFT
: left
= 1; break;
5136 case '?': return (-1);
5142 log_error ("ERROR: Invalid argument specified");
5153 log_info (VERSION_TXT
);
5160 usage_big_print (PROGNAME
);
5169 if (session
== NULL
) session
= (char *) PROGNAME
;
5171 size_t session_size
= strlen (session
) + 32;
5173 data
.session
= session
;
5175 char *eff_restore_file
= (char *) mymalloc (session_size
);
5176 char *new_restore_file
= (char *) mymalloc (session_size
);
5178 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5179 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5181 data
.eff_restore_file
= eff_restore_file
;
5182 data
.new_restore_file
= new_restore_file
;
5184 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5186 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5187 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5192 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5193 if ((show
== 1) || (left
== 1))
5195 restore_disable
= 1;
5200 data
.restore_disable
= restore_disable
;
5202 restore_data_t
*rd
= init_restore (argc
, argv
);
5212 read_restore (eff_restore_file
, rd
);
5214 if (rd
->version_bin
< RESTORE_MIN
)
5216 log_error ("ERROR: Incompatible restore-file version");
5225 rd
->pid
= getpid ();
5227 rd
->pid
= GetCurrentProcessId ();
5231 uint hash_mode_chgd
= 0;
5232 uint runtime_chgd
= 0;
5233 uint gpu_loops_chgd
= 0;
5234 uint gpu_accel_chgd
= 0;
5235 uint attack_mode_chgd
= 0;
5236 uint outfile_format_chgd
= 0;
5237 uint rp_gen_seed_chgd
= 0;
5238 uint remove_timer_chgd
= 0;
5239 uint increment_min_chgd
= 0;
5240 uint increment_max_chgd
= 0;
5241 uint gpu_temp_abort_chgd
= 0;
5242 uint gpu_temp_retain_chgd
= 0;
5248 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5252 //case IDX_HELP: usage = 1; break;
5253 //case IDX_VERSION: version = 1; break;
5254 //case IDX_RESTORE: restore = 1; break;
5255 case IDX_QUIET
: quiet
= 1; break;
5256 //case IDX_SHOW: show = 1; break;
5257 case IDX_SHOW
: break;
5258 //case IDX_LEFT: left = 1; break;
5259 case IDX_LEFT
: break;
5260 case IDX_USERNAME
: username
= 1; break;
5261 case IDX_REMOVE
: remove
= 1; break;
5262 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5263 remove_timer_chgd
= 1; break;
5264 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5265 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5266 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5267 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5268 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5269 case IDX_FORCE
: force
= 1; break;
5270 case IDX_SKIP
: skip
= atoll (optarg
); break;
5271 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5272 case IDX_KEYSPACE
: keyspace
= 1; break;
5273 case IDX_BENCHMARK
: benchmark
= 1; break;
5274 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5275 case IDX_RESTORE
: break;
5276 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5277 case IDX_STATUS
: status
= 1; break;
5278 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5279 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5280 case IDX_LOOPBACK
: loopback
= 1; break;
5281 case IDX_WEAK_HASH_THRESHOLD
:
5282 weak_hash_threshold
= atoi (optarg
); break;
5283 //case IDX_SESSION: session = optarg; break;
5284 case IDX_SESSION
: break;
5285 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5286 hash_mode_chgd
= 1; break;
5287 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5288 runtime_chgd
= 1; break;
5289 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5290 attack_mode_chgd
= 1; break;
5291 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5292 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5293 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5294 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5295 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5296 rp_gen_seed_chgd
= 1; break;
5297 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5298 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5299 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5300 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5301 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5302 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5303 case IDX_OUTFILE
: outfile
= optarg
; break;
5304 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5305 outfile_format_chgd
= 1; break;
5306 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5307 outfile_autohex
= 0; break;
5308 case IDX_OUTFILE_CHECK_TIMER
:
5309 outfile_check_timer
= atoi (optarg
); break;
5310 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5311 case IDX_HEX_SALT
: hex_salt
= 1; break;
5312 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5313 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5314 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5315 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5316 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5317 gpu_accel_chgd
= 1; break;
5318 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5319 gpu_loops_chgd
= 1; break;
5320 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5321 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5322 gpu_temp_abort
= atoi (optarg
); break;
5323 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5324 gpu_temp_retain
= atoi (optarg
); break;
5325 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5326 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5327 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5328 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5329 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5330 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5331 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5332 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5333 case IDX_INCREMENT
: increment
= 1; break;
5334 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5335 increment_min_chgd
= 1; break;
5336 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5337 increment_max_chgd
= 1; break;
5338 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5339 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5340 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5341 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5344 log_error ("ERROR: Invalid argument specified");
5351 log_error ("ERROR: Invalid argument specified");
5357 * Inform user things getting started,
5358 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5359 * - we do not need to check algorithm_pos
5366 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5370 else if (restore
== 1)
5372 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5378 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5388 if (attack_mode
> 7)
5390 log_error ("ERROR: Invalid attack-mode specified");
5395 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5397 log_error ("ERROR: Invalid runtime specified");
5402 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5404 log_error ("ERROR: Invalid hash-type specified");
5409 // renamed hash modes
5423 log_error ("Old -m specified, use -m %d instead", n
);
5431 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5433 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5439 if (outfile_format
> 16)
5441 log_error ("ERROR: Invalid outfile-format specified");
5448 if (outfile_format_chgd
== 1)
5450 if (outfile_format
> 1)
5452 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5459 outfile_format
= OUTFILE_FMT_HASH
;
5465 if (outfile_format_chgd
== 1)
5467 if ((outfile_format
> 7) && (outfile_format
< 16))
5469 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5476 if (increment_min
< INCREMENT_MIN
)
5478 log_error ("ERROR: Invalid increment-min specified");
5483 if (increment_max
> INCREMENT_MAX
)
5485 log_error ("ERROR: Invalid increment-max specified");
5490 if (increment_min
> increment_max
)
5492 log_error ("ERROR: Invalid increment-min specified");
5497 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5499 log_error ("ERROR: increment is not allowed in attack-mode 0");
5504 if ((increment
== 0) && (increment_min_chgd
== 1))
5506 log_error ("ERROR: increment-min is only supported together with increment switch");
5511 if ((increment
== 0) && (increment_max_chgd
== 1))
5513 log_error ("ERROR: increment-max is only supported together with increment switch");
5518 if (rp_files_cnt
&& rp_gen
)
5520 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5525 if (rp_files_cnt
|| rp_gen
)
5527 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5529 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5535 if (rp_gen_func_min
> rp_gen_func_max
)
5537 log_error ("ERROR: Invalid rp-gen-func-min specified");
5542 if (gpu_accel_chgd
== 1)
5544 if (workload_profile
!= WORKLOAD_PROFILE
)
5546 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5553 log_error ("ERROR: Invalid gpu-accel specified");
5558 if (gpu_accel
> 800)
5560 log_error ("ERROR: Invalid gpu-accel specified");
5566 if (gpu_loops_chgd
== 1)
5568 if (workload_profile
!= WORKLOAD_PROFILE
)
5570 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5577 log_error ("ERROR: Invalid gpu-loops specified");
5582 if (gpu_loops
> 1024)
5584 log_error ("ERROR: Invalid gpu-loops specified");
5592 if (workload_profile
!= WORKLOAD_PROFILE
)
5594 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5600 if ((workload_profile
< 1) || (workload_profile
> 3))
5602 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5607 if (show
== 1 || left
== 1)
5609 attack_mode
= ATTACK_MODE_NONE
;
5613 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5618 if (potfile_disable
== 1)
5620 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5626 uint attack_kern
= ATTACK_KERN_NONE
;
5628 switch (attack_mode
)
5630 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5631 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5632 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5633 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5634 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5641 int num_additional_params
= 1;
5643 if (attack_kern
== ATTACK_KERN_COMBI
)
5645 num_additional_params
= 2;
5648 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5650 if (keyspace_wordlist_specified
== 0) optind
--;
5653 if (attack_kern
== ATTACK_KERN_NONE
)
5655 if ((optind
+ 1) != myargc
)
5657 usage_mini_print (myargv
[0]);
5662 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5664 if ((optind
+ 1) > myargc
)
5666 usage_mini_print (myargv
[0]);
5671 else if (attack_kern
== ATTACK_KERN_COMBI
)
5673 if ((optind
+ 3) != myargc
)
5675 usage_mini_print (myargv
[0]);
5680 else if (attack_kern
== ATTACK_KERN_BF
)
5682 if ((optind
+ 1) > myargc
)
5684 usage_mini_print (myargv
[0]);
5691 usage_mini_print (myargv
[0]);
5698 if (myargv
[optind
] != 0)
5700 log_error ("ERROR: Invalid argument for benchmark mode specified");
5705 if (attack_mode_chgd
== 1)
5707 if (attack_mode
!= ATTACK_MODE_BF
)
5709 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5715 if (benchmark_mode
== 0)
5719 else if (benchmark_mode
== 1)
5721 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5723 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5730 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5736 if (skip
!= 0 && limit
!= 0)
5745 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5751 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5756 potfile_disable
= 1;
5758 restore_disable
= 1;
5762 weak_hash_threshold
= 0;
5767 if (remove_timer_chgd
== 1)
5771 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5776 if (remove_timer
< 1)
5778 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5786 if (attack_mode
== ATTACK_MODE_BF
)
5788 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5792 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5794 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5796 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5805 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5807 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5812 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5814 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5822 log_error ("ERROR: Invalid debug-mode specified");
5827 if (debug_file
!= NULL
)
5831 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5837 if (induction_dir
!= NULL
)
5839 if (attack_mode
== ATTACK_MODE_BF
)
5841 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5848 * induction directory
5851 char *induction_directory
= NULL
;
5853 if (attack_mode
!= ATTACK_MODE_BF
)
5855 if (induction_dir
== NULL
)
5857 induction_directory
= (char *) mymalloc (session_size
);
5859 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
5861 // create induction folder if it does not already exist
5865 if (rmdir (induction_directory
) == -1)
5867 if (errno
== ENOENT
)
5869 // good, we can ignore
5871 else if (errno
== ENOTEMPTY
)
5873 char *induction_directory_mv
= (char *) mymalloc (session_size
);
5875 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
5877 if (rename (induction_directory
, induction_directory_mv
) != 0)
5879 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
5886 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5893 #define mkdir(name,mode) mkdir (name)
5896 if (mkdir (induction_directory
, 0700) == -1)
5898 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5906 induction_directory
= induction_dir
;
5910 data
.induction_directory
= induction_directory
;
5916 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
5918 char *loopback_file
= (char *) mymalloc (loopback_size
);
5921 * outfile-check directory
5924 char *outfile_check_directory
= NULL
;
5926 if (outfile_check_dir
== NULL
)
5928 outfile_check_directory
= (char *) mymalloc (session_size
);
5930 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
5934 outfile_check_directory
= outfile_check_dir
;
5937 data
.outfile_check_directory
= outfile_check_directory
;
5941 struct stat outfile_check_stat
;
5943 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
5945 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
5949 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
5954 else if (outfile_check_dir
== NULL
)
5957 #define mkdir(name,mode) mkdir (name)
5960 if (mkdir (outfile_check_directory
, 0700) == -1)
5962 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
5970 * special other stuff
5973 if (hash_mode
== 9710)
5976 outfile_format_chgd
= 1;
5979 if (hash_mode
== 9810)
5982 outfile_format_chgd
= 1;
5985 if (hash_mode
== 10410)
5988 outfile_format_chgd
= 1;
5995 data
.hash_mode
= hash_mode
;
5996 data
.restore
= restore
;
5997 data
.restore_timer
= restore_timer
;
5998 data
.restore_disable
= restore_disable
;
5999 data
.status
= status
;
6000 data
.status_timer
= status_timer
;
6001 data
.status_automat
= status_automat
;
6002 data
.loopback
= loopback
;
6003 data
.runtime
= runtime
;
6004 data
.remove
= remove
;
6005 data
.remove_timer
= remove_timer
;
6006 data
.debug_mode
= debug_mode
;
6007 data
.debug_file
= debug_file
;
6008 data
.username
= username
;
6010 data
.outfile
= outfile
;
6011 data
.outfile_format
= outfile_format
;
6012 data
.outfile_autohex
= outfile_autohex
;
6013 data
.hex_charset
= hex_charset
;
6014 data
.hex_salt
= hex_salt
;
6015 data
.hex_wordlist
= hex_wordlist
;
6016 data
.separator
= separator
;
6017 data
.rp_files
= rp_files
;
6018 data
.rp_files_cnt
= rp_files_cnt
;
6019 data
.rp_gen
= rp_gen
;
6020 data
.rp_gen_seed
= rp_gen_seed
;
6022 data
.benchmark
= benchmark
;
6025 data
.powertune_enable
= powertune_enable
;
6026 data
.logfile_disable
= logfile_disable
;
6027 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6028 data
.scrypt_tmto
= scrypt_tmto
;
6031 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6036 char *resolved_path
= realpath (myargv
[0], NULL
);
6038 char *install_dir
= get_install_dir (resolved_path
);
6039 char *profile_dir
= NULL
;
6040 char *session_dir
= NULL
;
6042 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6044 struct passwd
*pw
= getpwuid (getuid ());
6046 const char *homedir
= pw
->pw_dir
;
6048 profile_dir
= get_profile_dir (homedir
);
6049 session_dir
= get_session_dir (profile_dir
, session
);
6053 profile_dir
= install_dir
;
6054 session_dir
= install_dir
;
6057 myfree (resolved_path
);
6061 char *install_dir
= get_install_dir (myargv
[0]);
6062 char *profile_dir
= install_dir
;
6063 char *session_dir
= install_dir
;
6067 data
.install_dir
= install_dir
;
6068 data
.profile_dir
= profile_dir
;
6069 data
.session_dir
= session_dir
;
6077 set_cpu_affinity (cpu_affinity
);
6080 if (rp_gen_seed_chgd
== 0)
6086 srand (rp_gen_seed
);
6093 if (logfile_disable
== 0)
6095 size_t logfile_size
= strlen (session
) + 32;
6097 char *logfile
= (char *) mymalloc (logfile_size
);
6099 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6101 data
.logfile
= logfile
;
6103 char *topid
= logfile_generate_topid ();
6108 // logfile_append() checks for logfile_disable internally to make it easier from here
6110 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6111 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6112 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6113 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6114 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6115 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6116 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6117 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6118 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6119 #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));
6121 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6122 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6123 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6124 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6125 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6126 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6127 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6128 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6130 logfile_top_msg ("START");
6132 logfile_top_uint (attack_mode
);
6133 logfile_top_uint (attack_kern
);
6134 logfile_top_uint (benchmark
);
6135 logfile_top_uint (benchmark_mode
);
6136 logfile_top_uint (bitmap_min
);
6137 logfile_top_uint (bitmap_max
);
6138 logfile_top_uint (debug_mode
);
6139 logfile_top_uint (force
);
6140 logfile_top_uint (gpu_accel
);
6141 logfile_top_uint (gpu_loops
);
6142 logfile_top_uint (gpu_temp_abort
);
6143 logfile_top_uint (gpu_temp_disable
);
6144 logfile_top_uint (gpu_temp_retain
);
6145 logfile_top_uint (hash_mode
);
6146 logfile_top_uint (hex_charset
);
6147 logfile_top_uint (hex_salt
);
6148 logfile_top_uint (hex_wordlist
);
6149 logfile_top_uint (increment
);
6150 logfile_top_uint (increment_max
);
6151 logfile_top_uint (increment_min
);
6152 logfile_top_uint (keyspace
);
6153 logfile_top_uint (left
);
6154 logfile_top_uint (logfile_disable
);
6155 logfile_top_uint (loopback
);
6156 logfile_top_uint (markov_classic
);
6157 logfile_top_uint (markov_disable
);
6158 logfile_top_uint (markov_threshold
);
6159 logfile_top_uint (outfile_autohex
);
6160 logfile_top_uint (outfile_check_timer
);
6161 logfile_top_uint (outfile_format
);
6162 logfile_top_uint (potfile_disable
);
6163 logfile_top_uint (powertune_enable
);
6164 logfile_top_uint (scrypt_tmto
);
6165 logfile_top_uint (quiet
);
6166 logfile_top_uint (remove
);
6167 logfile_top_uint (remove_timer
);
6168 logfile_top_uint (restore
);
6169 logfile_top_uint (restore_disable
);
6170 logfile_top_uint (restore_timer
);
6171 logfile_top_uint (rp_gen
);
6172 logfile_top_uint (rp_gen_func_max
);
6173 logfile_top_uint (rp_gen_func_min
);
6174 logfile_top_uint (rp_gen_seed
);
6175 logfile_top_uint (runtime
);
6176 logfile_top_uint (segment_size
);
6177 logfile_top_uint (show
);
6178 logfile_top_uint (status
);
6179 logfile_top_uint (status_automat
);
6180 logfile_top_uint (status_timer
);
6181 logfile_top_uint (usage
);
6182 logfile_top_uint (username
);
6183 logfile_top_uint (version
);
6184 logfile_top_uint (weak_hash_threshold
);
6185 logfile_top_uint (workload_profile
);
6186 logfile_top_uint64 (limit
);
6187 logfile_top_uint64 (skip
);
6188 logfile_top_char (separator
);
6189 logfile_top_string (cpu_affinity
);
6190 logfile_top_string (custom_charset_1
);
6191 logfile_top_string (custom_charset_2
);
6192 logfile_top_string (custom_charset_3
);
6193 logfile_top_string (custom_charset_4
);
6194 logfile_top_string (debug_file
);
6195 logfile_top_string (gpu_devices
);
6196 logfile_top_string (induction_dir
);
6197 logfile_top_string (markov_hcstat
);
6198 logfile_top_string (outfile
);
6199 logfile_top_string (outfile_check_dir
);
6200 logfile_top_string (rule_buf_l
);
6201 logfile_top_string (rule_buf_r
);
6202 logfile_top_string (session
);
6203 logfile_top_string (truecrypt_keyfiles
);
6209 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6218 * disable useless stuff for benchmark
6223 restore_disable
= 1;
6224 potfile_disable
= 1;
6225 weak_hash_threshold
= 0;
6227 data
.restore_timer
= restore_timer
;
6228 data
.status_timer
= status_timer
;
6229 data
.restore_disable
= restore_disable
;
6231 if (benchmark_mode
== 1)
6237 * force attack mode to be bruteforce
6240 attack_mode
= ATTACK_MODE_BF
;
6241 attack_kern
= ATTACK_KERN_BF
;
6243 if (runtime_chgd
== 0)
6247 if (benchmark_mode
== 1) runtime
= 17;
6249 data
.runtime
= runtime
;
6259 uint attack_exec
= 0;
6263 uint esalt_size
= 0;
6265 uint dgst_pos0
= -1;
6266 uint dgst_pos1
= -1;
6267 uint dgst_pos2
= -1;
6268 uint dgst_pos3
= -1;
6270 int (*parse_func
) (char *, uint
, hash_t
*);
6271 int (*sort_by_digest
) (const void *, const void *);
6273 uint algorithm_pos
= 0;
6274 uint algorithm_max
= 1;
6276 uint
*algorithms
= default_benchmark_algorithms
;
6278 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6280 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6283 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6284 * the following algos are skipped entirely
6287 if (algorithm_pos
> 0)
6291 rd
= init_restore (argc
, argv
);
6297 * update hash_mode in case of multihash benchmark
6302 if (hash_mode_chgd
== 0)
6304 hash_mode
= algorithms
[algorithm_pos
];
6306 data
.hash_mode
= hash_mode
;
6316 case 0: hash_type
= HASH_TYPE_MD5
;
6317 salt_type
= SALT_TYPE_NONE
;
6318 attack_exec
= ATTACK_EXEC_ON_GPU
;
6319 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6320 | OPTS_TYPE_PT_ADD80
6321 | OPTS_TYPE_PT_ADDBITS14
;
6322 kern_type
= KERN_TYPE_MD5
;
6323 dgst_size
= DGST_SIZE_4_4
;
6324 parse_func
= md5_parse_hash
;
6325 sort_by_digest
= sort_by_digest_4_4
;
6326 opti_type
= OPTI_TYPE_ZERO_BYTE
6327 | OPTI_TYPE_PRECOMPUTE_INIT
6328 | OPTI_TYPE_PRECOMPUTE_MERKLE
6329 | OPTI_TYPE_MEET_IN_MIDDLE
6330 | OPTI_TYPE_EARLY_SKIP
6331 | OPTI_TYPE_NOT_ITERATED
6332 | OPTI_TYPE_NOT_SALTED
6333 | OPTI_TYPE_RAW_HASH
;
6340 case 10: hash_type
= HASH_TYPE_MD5
;
6341 salt_type
= SALT_TYPE_INTERN
;
6342 attack_exec
= ATTACK_EXEC_ON_GPU
;
6343 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6344 | OPTS_TYPE_ST_ADD80
6345 | OPTS_TYPE_ST_ADDBITS14
;
6346 kern_type
= KERN_TYPE_MD5_PWSLT
;
6347 dgst_size
= DGST_SIZE_4_4
;
6348 parse_func
= md5s_parse_hash
;
6349 sort_by_digest
= sort_by_digest_4_4
;
6350 opti_type
= OPTI_TYPE_ZERO_BYTE
6351 | OPTI_TYPE_PRECOMPUTE_INIT
6352 | OPTI_TYPE_PRECOMPUTE_MERKLE
6353 | OPTI_TYPE_MEET_IN_MIDDLE
6354 | OPTI_TYPE_EARLY_SKIP
6355 | OPTI_TYPE_NOT_ITERATED
6356 | OPTI_TYPE_APPENDED_SALT
6357 | OPTI_TYPE_RAW_HASH
;
6364 case 11: hash_type
= HASH_TYPE_MD5
;
6365 salt_type
= SALT_TYPE_INTERN
;
6366 attack_exec
= ATTACK_EXEC_ON_GPU
;
6367 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6368 | OPTS_TYPE_ST_ADD80
6369 | OPTS_TYPE_ST_ADDBITS14
;
6370 kern_type
= KERN_TYPE_MD5_PWSLT
;
6371 dgst_size
= DGST_SIZE_4_4
;
6372 parse_func
= joomla_parse_hash
;
6373 sort_by_digest
= sort_by_digest_4_4
;
6374 opti_type
= OPTI_TYPE_ZERO_BYTE
6375 | OPTI_TYPE_PRECOMPUTE_INIT
6376 | OPTI_TYPE_PRECOMPUTE_MERKLE
6377 | OPTI_TYPE_MEET_IN_MIDDLE
6378 | OPTI_TYPE_EARLY_SKIP
6379 | OPTI_TYPE_NOT_ITERATED
6380 | OPTI_TYPE_APPENDED_SALT
6381 | OPTI_TYPE_RAW_HASH
;
6388 case 12: hash_type
= HASH_TYPE_MD5
;
6389 salt_type
= SALT_TYPE_INTERN
;
6390 attack_exec
= ATTACK_EXEC_ON_GPU
;
6391 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6392 | OPTS_TYPE_ST_ADD80
6393 | OPTS_TYPE_ST_ADDBITS14
;
6394 kern_type
= KERN_TYPE_MD5_PWSLT
;
6395 dgst_size
= DGST_SIZE_4_4
;
6396 parse_func
= postgresql_parse_hash
;
6397 sort_by_digest
= sort_by_digest_4_4
;
6398 opti_type
= OPTI_TYPE_ZERO_BYTE
6399 | OPTI_TYPE_PRECOMPUTE_INIT
6400 | OPTI_TYPE_PRECOMPUTE_MERKLE
6401 | OPTI_TYPE_MEET_IN_MIDDLE
6402 | OPTI_TYPE_EARLY_SKIP
6403 | OPTI_TYPE_NOT_ITERATED
6404 | OPTI_TYPE_APPENDED_SALT
6405 | OPTI_TYPE_RAW_HASH
;
6412 case 20: hash_type
= HASH_TYPE_MD5
;
6413 salt_type
= SALT_TYPE_INTERN
;
6414 attack_exec
= ATTACK_EXEC_ON_GPU
;
6415 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6416 | OPTS_TYPE_PT_ADD80
6417 | OPTS_TYPE_PT_ADDBITS14
;
6418 kern_type
= KERN_TYPE_MD5_SLTPW
;
6419 dgst_size
= DGST_SIZE_4_4
;
6420 parse_func
= md5s_parse_hash
;
6421 sort_by_digest
= sort_by_digest_4_4
;
6422 opti_type
= OPTI_TYPE_ZERO_BYTE
6423 | OPTI_TYPE_PRECOMPUTE_INIT
6424 | OPTI_TYPE_PRECOMPUTE_MERKLE
6425 | OPTI_TYPE_EARLY_SKIP
6426 | OPTI_TYPE_NOT_ITERATED
6427 | OPTI_TYPE_PREPENDED_SALT
6428 | OPTI_TYPE_RAW_HASH
;
6435 case 21: hash_type
= HASH_TYPE_MD5
;
6436 salt_type
= SALT_TYPE_INTERN
;
6437 attack_exec
= ATTACK_EXEC_ON_GPU
;
6438 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6439 | OPTS_TYPE_PT_ADD80
6440 | OPTS_TYPE_PT_ADDBITS14
;
6441 kern_type
= KERN_TYPE_MD5_SLTPW
;
6442 dgst_size
= DGST_SIZE_4_4
;
6443 parse_func
= osc_parse_hash
;
6444 sort_by_digest
= sort_by_digest_4_4
;
6445 opti_type
= OPTI_TYPE_ZERO_BYTE
6446 | OPTI_TYPE_PRECOMPUTE_INIT
6447 | OPTI_TYPE_PRECOMPUTE_MERKLE
6448 | OPTI_TYPE_EARLY_SKIP
6449 | OPTI_TYPE_NOT_ITERATED
6450 | OPTI_TYPE_PREPENDED_SALT
6451 | OPTI_TYPE_RAW_HASH
;
6458 case 22: hash_type
= HASH_TYPE_MD5
;
6459 salt_type
= SALT_TYPE_EMBEDDED
;
6460 attack_exec
= ATTACK_EXEC_ON_GPU
;
6461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6462 | OPTS_TYPE_PT_ADD80
6463 | OPTS_TYPE_PT_ADDBITS14
;
6464 kern_type
= KERN_TYPE_MD5_SLTPW
;
6465 dgst_size
= DGST_SIZE_4_4
;
6466 parse_func
= netscreen_parse_hash
;
6467 sort_by_digest
= sort_by_digest_4_4
;
6468 opti_type
= OPTI_TYPE_ZERO_BYTE
6469 | OPTI_TYPE_PRECOMPUTE_INIT
6470 | OPTI_TYPE_PRECOMPUTE_MERKLE
6471 | OPTI_TYPE_EARLY_SKIP
6472 | OPTI_TYPE_NOT_ITERATED
6473 | OPTI_TYPE_PREPENDED_SALT
6474 | OPTI_TYPE_RAW_HASH
;
6481 case 23: hash_type
= HASH_TYPE_MD5
;
6482 salt_type
= SALT_TYPE_EMBEDDED
;
6483 attack_exec
= ATTACK_EXEC_ON_GPU
;
6484 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6485 | OPTS_TYPE_PT_ADD80
6486 | OPTS_TYPE_PT_ADDBITS14
;
6487 kern_type
= KERN_TYPE_MD5_SLTPW
;
6488 dgst_size
= DGST_SIZE_4_4
;
6489 parse_func
= skype_parse_hash
;
6490 sort_by_digest
= sort_by_digest_4_4
;
6491 opti_type
= OPTI_TYPE_ZERO_BYTE
6492 | OPTI_TYPE_PRECOMPUTE_INIT
6493 | OPTI_TYPE_PRECOMPUTE_MERKLE
6494 | OPTI_TYPE_EARLY_SKIP
6495 | OPTI_TYPE_NOT_ITERATED
6496 | OPTI_TYPE_PREPENDED_SALT
6497 | OPTI_TYPE_RAW_HASH
;
6504 case 30: hash_type
= HASH_TYPE_MD5
;
6505 salt_type
= SALT_TYPE_INTERN
;
6506 attack_exec
= ATTACK_EXEC_ON_GPU
;
6507 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6508 | OPTS_TYPE_PT_UNICODE
6509 | OPTS_TYPE_ST_ADD80
6510 | OPTS_TYPE_ST_ADDBITS14
;
6511 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6512 dgst_size
= DGST_SIZE_4_4
;
6513 parse_func
= md5s_parse_hash
;
6514 sort_by_digest
= sort_by_digest_4_4
;
6515 opti_type
= OPTI_TYPE_ZERO_BYTE
6516 | OPTI_TYPE_PRECOMPUTE_INIT
6517 | OPTI_TYPE_PRECOMPUTE_MERKLE
6518 | OPTI_TYPE_MEET_IN_MIDDLE
6519 | OPTI_TYPE_EARLY_SKIP
6520 | OPTI_TYPE_NOT_ITERATED
6521 | OPTI_TYPE_APPENDED_SALT
6522 | OPTI_TYPE_RAW_HASH
;
6529 case 40: hash_type
= HASH_TYPE_MD5
;
6530 salt_type
= SALT_TYPE_INTERN
;
6531 attack_exec
= ATTACK_EXEC_ON_GPU
;
6532 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6533 | OPTS_TYPE_PT_ADD80
6534 | OPTS_TYPE_PT_ADDBITS14
6535 | OPTS_TYPE_PT_UNICODE
;
6536 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6537 dgst_size
= DGST_SIZE_4_4
;
6538 parse_func
= md5s_parse_hash
;
6539 sort_by_digest
= sort_by_digest_4_4
;
6540 opti_type
= OPTI_TYPE_ZERO_BYTE
6541 | OPTI_TYPE_PRECOMPUTE_INIT
6542 | OPTI_TYPE_PRECOMPUTE_MERKLE
6543 | OPTI_TYPE_EARLY_SKIP
6544 | OPTI_TYPE_NOT_ITERATED
6545 | OPTI_TYPE_PREPENDED_SALT
6546 | OPTI_TYPE_RAW_HASH
;
6553 case 50: hash_type
= HASH_TYPE_MD5
;
6554 salt_type
= SALT_TYPE_INTERN
;
6555 attack_exec
= ATTACK_EXEC_ON_GPU
;
6556 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6557 | OPTS_TYPE_ST_ADD80
6558 | OPTS_TYPE_ST_ADDBITS14
;
6559 kern_type
= KERN_TYPE_HMACMD5_PW
;
6560 dgst_size
= DGST_SIZE_4_4
;
6561 parse_func
= hmacmd5_parse_hash
;
6562 sort_by_digest
= sort_by_digest_4_4
;
6563 opti_type
= OPTI_TYPE_ZERO_BYTE
6564 | OPTI_TYPE_NOT_ITERATED
;
6571 case 60: hash_type
= HASH_TYPE_MD5
;
6572 salt_type
= SALT_TYPE_INTERN
;
6573 attack_exec
= ATTACK_EXEC_ON_GPU
;
6574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6575 | OPTS_TYPE_PT_ADD80
6576 | OPTS_TYPE_PT_ADDBITS14
;
6577 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6578 dgst_size
= DGST_SIZE_4_4
;
6579 parse_func
= hmacmd5_parse_hash
;
6580 sort_by_digest
= sort_by_digest_4_4
;
6581 opti_type
= OPTI_TYPE_ZERO_BYTE
6582 | OPTI_TYPE_NOT_ITERATED
;
6589 case 100: hash_type
= HASH_TYPE_SHA1
;
6590 salt_type
= SALT_TYPE_NONE
;
6591 attack_exec
= ATTACK_EXEC_ON_GPU
;
6592 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6593 | OPTS_TYPE_PT_ADD80
6594 | OPTS_TYPE_PT_ADDBITS15
;
6595 kern_type
= KERN_TYPE_SHA1
;
6596 dgst_size
= DGST_SIZE_4_5
;
6597 parse_func
= sha1_parse_hash
;
6598 sort_by_digest
= sort_by_digest_4_5
;
6599 opti_type
= OPTI_TYPE_ZERO_BYTE
6600 | OPTI_TYPE_PRECOMPUTE_INIT
6601 | OPTI_TYPE_PRECOMPUTE_MERKLE
6602 | OPTI_TYPE_EARLY_SKIP
6603 | OPTI_TYPE_NOT_ITERATED
6604 | OPTI_TYPE_NOT_SALTED
6605 | OPTI_TYPE_RAW_HASH
;
6612 case 101: hash_type
= HASH_TYPE_SHA1
;
6613 salt_type
= SALT_TYPE_NONE
;
6614 attack_exec
= ATTACK_EXEC_ON_GPU
;
6615 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6616 | OPTS_TYPE_PT_ADD80
6617 | OPTS_TYPE_PT_ADDBITS15
;
6618 kern_type
= KERN_TYPE_SHA1
;
6619 dgst_size
= DGST_SIZE_4_5
;
6620 parse_func
= sha1b64_parse_hash
;
6621 sort_by_digest
= sort_by_digest_4_5
;
6622 opti_type
= OPTI_TYPE_ZERO_BYTE
6623 | OPTI_TYPE_PRECOMPUTE_INIT
6624 | OPTI_TYPE_PRECOMPUTE_MERKLE
6625 | OPTI_TYPE_EARLY_SKIP
6626 | OPTI_TYPE_NOT_ITERATED
6627 | OPTI_TYPE_NOT_SALTED
6628 | OPTI_TYPE_RAW_HASH
;
6635 case 110: hash_type
= HASH_TYPE_SHA1
;
6636 salt_type
= SALT_TYPE_INTERN
;
6637 attack_exec
= ATTACK_EXEC_ON_GPU
;
6638 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6639 | OPTS_TYPE_ST_ADD80
6640 | OPTS_TYPE_ST_ADDBITS15
;
6641 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6642 dgst_size
= DGST_SIZE_4_5
;
6643 parse_func
= sha1s_parse_hash
;
6644 sort_by_digest
= sort_by_digest_4_5
;
6645 opti_type
= OPTI_TYPE_ZERO_BYTE
6646 | OPTI_TYPE_PRECOMPUTE_INIT
6647 | OPTI_TYPE_PRECOMPUTE_MERKLE
6648 | OPTI_TYPE_EARLY_SKIP
6649 | OPTI_TYPE_NOT_ITERATED
6650 | OPTI_TYPE_APPENDED_SALT
6651 | OPTI_TYPE_RAW_HASH
;
6658 case 111: hash_type
= HASH_TYPE_SHA1
;
6659 salt_type
= SALT_TYPE_EMBEDDED
;
6660 attack_exec
= ATTACK_EXEC_ON_GPU
;
6661 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6662 | OPTS_TYPE_ST_ADD80
6663 | OPTS_TYPE_ST_ADDBITS15
;
6664 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6665 dgst_size
= DGST_SIZE_4_5
;
6666 parse_func
= sha1b64s_parse_hash
;
6667 sort_by_digest
= sort_by_digest_4_5
;
6668 opti_type
= OPTI_TYPE_ZERO_BYTE
6669 | OPTI_TYPE_PRECOMPUTE_INIT
6670 | OPTI_TYPE_PRECOMPUTE_MERKLE
6671 | OPTI_TYPE_EARLY_SKIP
6672 | OPTI_TYPE_NOT_ITERATED
6673 | OPTI_TYPE_APPENDED_SALT
6674 | OPTI_TYPE_RAW_HASH
;
6681 case 112: hash_type
= HASH_TYPE_SHA1
;
6682 salt_type
= SALT_TYPE_INTERN
;
6683 attack_exec
= ATTACK_EXEC_ON_GPU
;
6684 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6685 | OPTS_TYPE_ST_ADD80
6686 | OPTS_TYPE_ST_ADDBITS15
6688 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6689 dgst_size
= DGST_SIZE_4_5
;
6690 parse_func
= oracles_parse_hash
;
6691 sort_by_digest
= sort_by_digest_4_5
;
6692 opti_type
= OPTI_TYPE_ZERO_BYTE
6693 | OPTI_TYPE_PRECOMPUTE_INIT
6694 | OPTI_TYPE_PRECOMPUTE_MERKLE
6695 | OPTI_TYPE_EARLY_SKIP
6696 | OPTI_TYPE_NOT_ITERATED
6697 | OPTI_TYPE_APPENDED_SALT
6698 | OPTI_TYPE_RAW_HASH
;
6705 case 120: hash_type
= HASH_TYPE_SHA1
;
6706 salt_type
= SALT_TYPE_INTERN
;
6707 attack_exec
= ATTACK_EXEC_ON_GPU
;
6708 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6709 | OPTS_TYPE_PT_ADD80
6710 | OPTS_TYPE_PT_ADDBITS15
;
6711 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6712 dgst_size
= DGST_SIZE_4_5
;
6713 parse_func
= sha1s_parse_hash
;
6714 sort_by_digest
= sort_by_digest_4_5
;
6715 opti_type
= OPTI_TYPE_ZERO_BYTE
6716 | OPTI_TYPE_PRECOMPUTE_INIT
6717 | OPTI_TYPE_PRECOMPUTE_MERKLE
6718 | OPTI_TYPE_EARLY_SKIP
6719 | OPTI_TYPE_NOT_ITERATED
6720 | OPTI_TYPE_PREPENDED_SALT
6721 | OPTI_TYPE_RAW_HASH
;
6728 case 121: hash_type
= HASH_TYPE_SHA1
;
6729 salt_type
= SALT_TYPE_INTERN
;
6730 attack_exec
= ATTACK_EXEC_ON_GPU
;
6731 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6732 | OPTS_TYPE_PT_ADD80
6733 | OPTS_TYPE_PT_ADDBITS15
6734 | OPTS_TYPE_ST_LOWER
;
6735 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6736 dgst_size
= DGST_SIZE_4_5
;
6737 parse_func
= smf_parse_hash
;
6738 sort_by_digest
= sort_by_digest_4_5
;
6739 opti_type
= OPTI_TYPE_ZERO_BYTE
6740 | OPTI_TYPE_PRECOMPUTE_INIT
6741 | OPTI_TYPE_PRECOMPUTE_MERKLE
6742 | OPTI_TYPE_EARLY_SKIP
6743 | OPTI_TYPE_NOT_ITERATED
6744 | OPTI_TYPE_PREPENDED_SALT
6745 | OPTI_TYPE_RAW_HASH
;
6752 case 122: hash_type
= HASH_TYPE_SHA1
;
6753 salt_type
= SALT_TYPE_EMBEDDED
;
6754 attack_exec
= ATTACK_EXEC_ON_GPU
;
6755 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6756 | OPTS_TYPE_PT_ADD80
6757 | OPTS_TYPE_PT_ADDBITS15
6759 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6760 dgst_size
= DGST_SIZE_4_5
;
6761 parse_func
= osx1_parse_hash
;
6762 sort_by_digest
= sort_by_digest_4_5
;
6763 opti_type
= OPTI_TYPE_ZERO_BYTE
6764 | OPTI_TYPE_PRECOMPUTE_INIT
6765 | OPTI_TYPE_PRECOMPUTE_MERKLE
6766 | OPTI_TYPE_EARLY_SKIP
6767 | OPTI_TYPE_NOT_ITERATED
6768 | OPTI_TYPE_PREPENDED_SALT
6769 | OPTI_TYPE_RAW_HASH
;
6776 case 124: hash_type
= HASH_TYPE_SHA1
;
6777 salt_type
= SALT_TYPE_EMBEDDED
;
6778 attack_exec
= ATTACK_EXEC_ON_GPU
;
6779 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6780 | OPTS_TYPE_PT_ADD80
6781 | OPTS_TYPE_PT_ADDBITS15
;
6782 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6783 dgst_size
= DGST_SIZE_4_5
;
6784 parse_func
= djangosha1_parse_hash
;
6785 sort_by_digest
= sort_by_digest_4_5
;
6786 opti_type
= OPTI_TYPE_ZERO_BYTE
6787 | OPTI_TYPE_PRECOMPUTE_INIT
6788 | OPTI_TYPE_PRECOMPUTE_MERKLE
6789 | OPTI_TYPE_EARLY_SKIP
6790 | OPTI_TYPE_NOT_ITERATED
6791 | OPTI_TYPE_PREPENDED_SALT
6792 | OPTI_TYPE_RAW_HASH
;
6799 case 130: hash_type
= HASH_TYPE_SHA1
;
6800 salt_type
= SALT_TYPE_INTERN
;
6801 attack_exec
= ATTACK_EXEC_ON_GPU
;
6802 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6803 | OPTS_TYPE_PT_UNICODE
6804 | OPTS_TYPE_ST_ADD80
6805 | OPTS_TYPE_ST_ADDBITS15
;
6806 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6807 dgst_size
= DGST_SIZE_4_5
;
6808 parse_func
= sha1s_parse_hash
;
6809 sort_by_digest
= sort_by_digest_4_5
;
6810 opti_type
= OPTI_TYPE_ZERO_BYTE
6811 | OPTI_TYPE_PRECOMPUTE_INIT
6812 | OPTI_TYPE_PRECOMPUTE_MERKLE
6813 | OPTI_TYPE_EARLY_SKIP
6814 | OPTI_TYPE_NOT_ITERATED
6815 | OPTI_TYPE_APPENDED_SALT
6816 | OPTI_TYPE_RAW_HASH
;
6823 case 131: hash_type
= HASH_TYPE_SHA1
;
6824 salt_type
= SALT_TYPE_EMBEDDED
;
6825 attack_exec
= ATTACK_EXEC_ON_GPU
;
6826 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6827 | OPTS_TYPE_PT_UNICODE
6828 | OPTS_TYPE_PT_UPPER
6829 | OPTS_TYPE_ST_ADD80
6830 | OPTS_TYPE_ST_ADDBITS15
6832 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6833 dgst_size
= DGST_SIZE_4_5
;
6834 parse_func
= mssql2000_parse_hash
;
6835 sort_by_digest
= sort_by_digest_4_5
;
6836 opti_type
= OPTI_TYPE_ZERO_BYTE
6837 | OPTI_TYPE_PRECOMPUTE_INIT
6838 | OPTI_TYPE_PRECOMPUTE_MERKLE
6839 | OPTI_TYPE_EARLY_SKIP
6840 | OPTI_TYPE_NOT_ITERATED
6841 | OPTI_TYPE_APPENDED_SALT
6842 | OPTI_TYPE_RAW_HASH
;
6849 case 132: hash_type
= HASH_TYPE_SHA1
;
6850 salt_type
= SALT_TYPE_EMBEDDED
;
6851 attack_exec
= ATTACK_EXEC_ON_GPU
;
6852 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6853 | OPTS_TYPE_PT_UNICODE
6854 | OPTS_TYPE_ST_ADD80
6855 | OPTS_TYPE_ST_ADDBITS15
6857 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6858 dgst_size
= DGST_SIZE_4_5
;
6859 parse_func
= mssql2005_parse_hash
;
6860 sort_by_digest
= sort_by_digest_4_5
;
6861 opti_type
= OPTI_TYPE_ZERO_BYTE
6862 | OPTI_TYPE_PRECOMPUTE_INIT
6863 | OPTI_TYPE_PRECOMPUTE_MERKLE
6864 | OPTI_TYPE_EARLY_SKIP
6865 | OPTI_TYPE_NOT_ITERATED
6866 | OPTI_TYPE_APPENDED_SALT
6867 | OPTI_TYPE_RAW_HASH
;
6874 case 133: hash_type
= HASH_TYPE_SHA1
;
6875 salt_type
= SALT_TYPE_EMBEDDED
;
6876 attack_exec
= ATTACK_EXEC_ON_GPU
;
6877 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6878 | OPTS_TYPE_PT_UNICODE
6879 | OPTS_TYPE_ST_ADD80
6880 | OPTS_TYPE_ST_ADDBITS15
;
6881 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6882 dgst_size
= DGST_SIZE_4_5
;
6883 parse_func
= peoplesoft_parse_hash
;
6884 sort_by_digest
= sort_by_digest_4_5
;
6885 opti_type
= OPTI_TYPE_ZERO_BYTE
6886 | OPTI_TYPE_PRECOMPUTE_INIT
6887 | OPTI_TYPE_PRECOMPUTE_MERKLE
6888 | OPTI_TYPE_EARLY_SKIP
6889 | OPTI_TYPE_NOT_ITERATED
6890 | OPTI_TYPE_APPENDED_SALT
6891 | OPTI_TYPE_RAW_HASH
;
6898 case 140: hash_type
= HASH_TYPE_SHA1
;
6899 salt_type
= SALT_TYPE_INTERN
;
6900 attack_exec
= ATTACK_EXEC_ON_GPU
;
6901 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6902 | OPTS_TYPE_PT_ADD80
6903 | OPTS_TYPE_PT_ADDBITS15
6904 | OPTS_TYPE_PT_UNICODE
;
6905 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6906 dgst_size
= DGST_SIZE_4_5
;
6907 parse_func
= sha1s_parse_hash
;
6908 sort_by_digest
= sort_by_digest_4_5
;
6909 opti_type
= OPTI_TYPE_ZERO_BYTE
6910 | OPTI_TYPE_PRECOMPUTE_INIT
6911 | OPTI_TYPE_PRECOMPUTE_MERKLE
6912 | OPTI_TYPE_EARLY_SKIP
6913 | OPTI_TYPE_NOT_ITERATED
6914 | OPTI_TYPE_PREPENDED_SALT
6915 | OPTI_TYPE_RAW_HASH
;
6922 case 141: hash_type
= HASH_TYPE_SHA1
;
6923 salt_type
= SALT_TYPE_EMBEDDED
;
6924 attack_exec
= ATTACK_EXEC_ON_GPU
;
6925 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6926 | OPTS_TYPE_PT_ADD80
6927 | OPTS_TYPE_PT_ADDBITS15
6928 | OPTS_TYPE_PT_UNICODE
6929 | OPTS_TYPE_ST_BASE64
;
6930 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6931 dgst_size
= DGST_SIZE_4_5
;
6932 parse_func
= episerver_parse_hash
;
6933 sort_by_digest
= sort_by_digest_4_5
;
6934 opti_type
= OPTI_TYPE_ZERO_BYTE
6935 | OPTI_TYPE_PRECOMPUTE_INIT
6936 | OPTI_TYPE_PRECOMPUTE_MERKLE
6937 | OPTI_TYPE_EARLY_SKIP
6938 | OPTI_TYPE_NOT_ITERATED
6939 | OPTI_TYPE_PREPENDED_SALT
6940 | OPTI_TYPE_RAW_HASH
;
6947 case 150: hash_type
= HASH_TYPE_SHA1
;
6948 salt_type
= SALT_TYPE_INTERN
;
6949 attack_exec
= ATTACK_EXEC_ON_GPU
;
6950 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6951 | OPTS_TYPE_ST_ADD80
6952 | OPTS_TYPE_ST_ADDBITS15
;
6953 kern_type
= KERN_TYPE_HMACSHA1_PW
;
6954 dgst_size
= DGST_SIZE_4_5
;
6955 parse_func
= hmacsha1_parse_hash
;
6956 sort_by_digest
= sort_by_digest_4_5
;
6957 opti_type
= OPTI_TYPE_ZERO_BYTE
6958 | OPTI_TYPE_NOT_ITERATED
;
6965 case 160: hash_type
= HASH_TYPE_SHA1
;
6966 salt_type
= SALT_TYPE_INTERN
;
6967 attack_exec
= ATTACK_EXEC_ON_GPU
;
6968 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6969 | OPTS_TYPE_PT_ADD80
6970 | OPTS_TYPE_PT_ADDBITS15
;
6971 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
6972 dgst_size
= DGST_SIZE_4_5
;
6973 parse_func
= hmacsha1_parse_hash
;
6974 sort_by_digest
= sort_by_digest_4_5
;
6975 opti_type
= OPTI_TYPE_ZERO_BYTE
6976 | OPTI_TYPE_NOT_ITERATED
;
6983 case 190: hash_type
= HASH_TYPE_SHA1
;
6984 salt_type
= SALT_TYPE_NONE
;
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 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
6990 dgst_size
= DGST_SIZE_4_5
;
6991 parse_func
= sha1linkedin_parse_hash
;
6992 sort_by_digest
= sort_by_digest_4_5
;
6993 opti_type
= OPTI_TYPE_ZERO_BYTE
6994 | OPTI_TYPE_PRECOMPUTE_INIT
6995 | OPTI_TYPE_EARLY_SKIP
6996 | OPTI_TYPE_NOT_ITERATED
6997 | OPTI_TYPE_NOT_SALTED
;
7004 case 200: hash_type
= HASH_TYPE_MYSQL
;
7005 salt_type
= SALT_TYPE_NONE
;
7006 attack_exec
= ATTACK_EXEC_ON_GPU
;
7008 kern_type
= KERN_TYPE_MYSQL
;
7009 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7010 parse_func
= mysql323_parse_hash
;
7011 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7012 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7019 case 300: hash_type
= HASH_TYPE_SHA1
;
7020 salt_type
= SALT_TYPE_NONE
;
7021 attack_exec
= ATTACK_EXEC_ON_GPU
;
7022 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7023 | OPTS_TYPE_PT_ADD80
7024 | OPTS_TYPE_PT_ADDBITS15
;
7025 kern_type
= KERN_TYPE_MYSQL41
;
7026 dgst_size
= DGST_SIZE_4_5
;
7027 parse_func
= sha1_parse_hash
;
7028 sort_by_digest
= sort_by_digest_4_5
;
7029 opti_type
= OPTI_TYPE_ZERO_BYTE
7030 | OPTI_TYPE_PRECOMPUTE_INIT
7031 | OPTI_TYPE_PRECOMPUTE_MERKLE
7032 | OPTI_TYPE_EARLY_SKIP
7033 | OPTI_TYPE_NOT_ITERATED
7034 | OPTI_TYPE_NOT_SALTED
;
7041 case 400: hash_type
= HASH_TYPE_MD5
;
7042 salt_type
= SALT_TYPE_EMBEDDED
;
7043 attack_exec
= ATTACK_EXEC_ON_CPU
;
7044 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7045 kern_type
= KERN_TYPE_PHPASS
;
7046 dgst_size
= DGST_SIZE_4_4
;
7047 parse_func
= phpass_parse_hash
;
7048 sort_by_digest
= sort_by_digest_4_4
;
7049 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7056 case 500: hash_type
= HASH_TYPE_MD5
;
7057 salt_type
= SALT_TYPE_EMBEDDED
;
7058 attack_exec
= ATTACK_EXEC_ON_CPU
;
7059 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7060 kern_type
= KERN_TYPE_MD5CRYPT
;
7061 dgst_size
= DGST_SIZE_4_4
;
7062 parse_func
= md5crypt_parse_hash
;
7063 sort_by_digest
= sort_by_digest_4_4
;
7064 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7071 case 501: hash_type
= HASH_TYPE_MD5
;
7072 salt_type
= SALT_TYPE_EMBEDDED
;
7073 attack_exec
= ATTACK_EXEC_ON_CPU
;
7074 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7075 | OPTS_TYPE_HASH_COPY
;
7076 kern_type
= KERN_TYPE_MD5CRYPT
;
7077 dgst_size
= DGST_SIZE_4_4
;
7078 parse_func
= juniper_parse_hash
;
7079 sort_by_digest
= sort_by_digest_4_4
;
7080 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7087 case 900: hash_type
= HASH_TYPE_MD4
;
7088 salt_type
= SALT_TYPE_NONE
;
7089 attack_exec
= ATTACK_EXEC_ON_GPU
;
7090 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7091 | OPTS_TYPE_PT_ADD80
7092 | OPTS_TYPE_PT_ADDBITS14
;
7093 kern_type
= KERN_TYPE_MD4
;
7094 dgst_size
= DGST_SIZE_4_4
;
7095 parse_func
= md4_parse_hash
;
7096 sort_by_digest
= sort_by_digest_4_4
;
7097 opti_type
= OPTI_TYPE_ZERO_BYTE
7098 | OPTI_TYPE_PRECOMPUTE_INIT
7099 | OPTI_TYPE_PRECOMPUTE_MERKLE
7100 | OPTI_TYPE_MEET_IN_MIDDLE
7101 | OPTI_TYPE_EARLY_SKIP
7102 | OPTI_TYPE_NOT_ITERATED
7103 | OPTI_TYPE_NOT_SALTED
7104 | OPTI_TYPE_RAW_HASH
;
7111 case 1000: hash_type
= HASH_TYPE_MD4
;
7112 salt_type
= SALT_TYPE_NONE
;
7113 attack_exec
= ATTACK_EXEC_ON_GPU
;
7114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7115 | OPTS_TYPE_PT_ADD80
7116 | OPTS_TYPE_PT_ADDBITS14
7117 | OPTS_TYPE_PT_UNICODE
;
7118 kern_type
= KERN_TYPE_MD4_PWU
;
7119 dgst_size
= DGST_SIZE_4_4
;
7120 parse_func
= md4_parse_hash
;
7121 sort_by_digest
= sort_by_digest_4_4
;
7122 opti_type
= OPTI_TYPE_ZERO_BYTE
7123 | OPTI_TYPE_PRECOMPUTE_INIT
7124 | OPTI_TYPE_PRECOMPUTE_MERKLE
7125 | OPTI_TYPE_MEET_IN_MIDDLE
7126 | OPTI_TYPE_EARLY_SKIP
7127 | OPTI_TYPE_NOT_ITERATED
7128 | OPTI_TYPE_NOT_SALTED
7129 | OPTI_TYPE_RAW_HASH
;
7136 case 1100: hash_type
= HASH_TYPE_MD4
;
7137 salt_type
= SALT_TYPE_INTERN
;
7138 attack_exec
= ATTACK_EXEC_ON_GPU
;
7139 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7140 | OPTS_TYPE_PT_ADD80
7141 | OPTS_TYPE_PT_ADDBITS14
7142 | OPTS_TYPE_PT_UNICODE
7143 | OPTS_TYPE_ST_ADD80
7144 | OPTS_TYPE_ST_UNICODE
7145 | OPTS_TYPE_ST_LOWER
;
7146 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7147 dgst_size
= DGST_SIZE_4_4
;
7148 parse_func
= dcc_parse_hash
;
7149 sort_by_digest
= sort_by_digest_4_4
;
7150 opti_type
= OPTI_TYPE_ZERO_BYTE
7151 | OPTI_TYPE_PRECOMPUTE_INIT
7152 | OPTI_TYPE_PRECOMPUTE_MERKLE
7153 | OPTI_TYPE_EARLY_SKIP
7154 | OPTI_TYPE_NOT_ITERATED
;
7161 case 1400: hash_type
= HASH_TYPE_SHA256
;
7162 salt_type
= SALT_TYPE_NONE
;
7163 attack_exec
= ATTACK_EXEC_ON_GPU
;
7164 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7165 | OPTS_TYPE_PT_ADD80
7166 | OPTS_TYPE_PT_ADDBITS15
;
7167 kern_type
= KERN_TYPE_SHA256
;
7168 dgst_size
= DGST_SIZE_4_8
;
7169 parse_func
= sha256_parse_hash
;
7170 sort_by_digest
= sort_by_digest_4_8
;
7171 opti_type
= OPTI_TYPE_ZERO_BYTE
7172 | OPTI_TYPE_PRECOMPUTE_INIT
7173 | OPTI_TYPE_PRECOMPUTE_MERKLE
7174 | OPTI_TYPE_EARLY_SKIP
7175 | OPTI_TYPE_NOT_ITERATED
7176 | OPTI_TYPE_NOT_SALTED
7177 | OPTI_TYPE_RAW_HASH
;
7184 case 1410: hash_type
= HASH_TYPE_SHA256
;
7185 salt_type
= SALT_TYPE_INTERN
;
7186 attack_exec
= ATTACK_EXEC_ON_GPU
;
7187 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7188 | OPTS_TYPE_ST_ADD80
7189 | OPTS_TYPE_ST_ADDBITS15
;
7190 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7191 dgst_size
= DGST_SIZE_4_8
;
7192 parse_func
= sha256s_parse_hash
;
7193 sort_by_digest
= sort_by_digest_4_8
;
7194 opti_type
= OPTI_TYPE_ZERO_BYTE
7195 | OPTI_TYPE_PRECOMPUTE_INIT
7196 | OPTI_TYPE_PRECOMPUTE_MERKLE
7197 | OPTI_TYPE_EARLY_SKIP
7198 | OPTI_TYPE_NOT_ITERATED
7199 | OPTI_TYPE_APPENDED_SALT
7200 | OPTI_TYPE_RAW_HASH
;
7207 case 1420: hash_type
= HASH_TYPE_SHA256
;
7208 salt_type
= SALT_TYPE_INTERN
;
7209 attack_exec
= ATTACK_EXEC_ON_GPU
;
7210 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7211 | OPTS_TYPE_PT_ADD80
7212 | OPTS_TYPE_PT_ADDBITS15
;
7213 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7214 dgst_size
= DGST_SIZE_4_8
;
7215 parse_func
= sha256s_parse_hash
;
7216 sort_by_digest
= sort_by_digest_4_8
;
7217 opti_type
= OPTI_TYPE_ZERO_BYTE
7218 | OPTI_TYPE_PRECOMPUTE_INIT
7219 | OPTI_TYPE_PRECOMPUTE_MERKLE
7220 | OPTI_TYPE_EARLY_SKIP
7221 | OPTI_TYPE_NOT_ITERATED
7222 | OPTI_TYPE_PREPENDED_SALT
7223 | OPTI_TYPE_RAW_HASH
;
7230 case 1421: hash_type
= HASH_TYPE_SHA256
;
7231 salt_type
= SALT_TYPE_EMBEDDED
;
7232 attack_exec
= ATTACK_EXEC_ON_GPU
;
7233 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7234 | OPTS_TYPE_PT_ADD80
7235 | OPTS_TYPE_PT_ADDBITS15
;
7236 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7237 dgst_size
= DGST_SIZE_4_8
;
7238 parse_func
= hmailserver_parse_hash
;
7239 sort_by_digest
= sort_by_digest_4_8
;
7240 opti_type
= OPTI_TYPE_ZERO_BYTE
7241 | OPTI_TYPE_PRECOMPUTE_INIT
7242 | OPTI_TYPE_PRECOMPUTE_MERKLE
7243 | OPTI_TYPE_EARLY_SKIP
7244 | OPTI_TYPE_NOT_ITERATED
7245 | OPTI_TYPE_PREPENDED_SALT
7246 | OPTI_TYPE_RAW_HASH
;
7253 case 1430: hash_type
= HASH_TYPE_SHA256
;
7254 salt_type
= SALT_TYPE_INTERN
;
7255 attack_exec
= ATTACK_EXEC_ON_GPU
;
7256 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7257 | OPTS_TYPE_PT_UNICODE
7258 | OPTS_TYPE_ST_ADD80
7259 | OPTS_TYPE_ST_ADDBITS15
;
7260 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7261 dgst_size
= DGST_SIZE_4_8
;
7262 parse_func
= sha256s_parse_hash
;
7263 sort_by_digest
= sort_by_digest_4_8
;
7264 opti_type
= OPTI_TYPE_ZERO_BYTE
7265 | OPTI_TYPE_PRECOMPUTE_INIT
7266 | OPTI_TYPE_PRECOMPUTE_MERKLE
7267 | OPTI_TYPE_EARLY_SKIP
7268 | OPTI_TYPE_NOT_ITERATED
7269 | OPTI_TYPE_APPENDED_SALT
7270 | OPTI_TYPE_RAW_HASH
;
7277 case 1440: hash_type
= HASH_TYPE_SHA256
;
7278 salt_type
= SALT_TYPE_INTERN
;
7279 attack_exec
= ATTACK_EXEC_ON_GPU
;
7280 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7281 | OPTS_TYPE_PT_ADD80
7282 | OPTS_TYPE_PT_ADDBITS15
7283 | OPTS_TYPE_PT_UNICODE
;
7284 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7285 dgst_size
= DGST_SIZE_4_8
;
7286 parse_func
= sha256s_parse_hash
;
7287 sort_by_digest
= sort_by_digest_4_8
;
7288 opti_type
= OPTI_TYPE_ZERO_BYTE
7289 | OPTI_TYPE_PRECOMPUTE_INIT
7290 | OPTI_TYPE_PRECOMPUTE_MERKLE
7291 | OPTI_TYPE_EARLY_SKIP
7292 | OPTI_TYPE_NOT_ITERATED
7293 | OPTI_TYPE_PREPENDED_SALT
7294 | OPTI_TYPE_RAW_HASH
;
7301 case 1441: hash_type
= HASH_TYPE_SHA256
;
7302 salt_type
= SALT_TYPE_EMBEDDED
;
7303 attack_exec
= ATTACK_EXEC_ON_GPU
;
7304 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7305 | OPTS_TYPE_PT_ADD80
7306 | OPTS_TYPE_PT_ADDBITS15
7307 | OPTS_TYPE_PT_UNICODE
7308 | OPTS_TYPE_ST_BASE64
;
7309 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7310 dgst_size
= DGST_SIZE_4_8
;
7311 parse_func
= episerver4_parse_hash
;
7312 sort_by_digest
= sort_by_digest_4_8
;
7313 opti_type
= OPTI_TYPE_ZERO_BYTE
7314 | OPTI_TYPE_PRECOMPUTE_INIT
7315 | OPTI_TYPE_PRECOMPUTE_MERKLE
7316 | OPTI_TYPE_EARLY_SKIP
7317 | OPTI_TYPE_NOT_ITERATED
7318 | OPTI_TYPE_PREPENDED_SALT
7319 | OPTI_TYPE_RAW_HASH
;
7326 case 1450: hash_type
= HASH_TYPE_SHA256
;
7327 salt_type
= SALT_TYPE_INTERN
;
7328 attack_exec
= ATTACK_EXEC_ON_GPU
;
7329 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7330 | OPTS_TYPE_ST_ADD80
;
7331 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7332 dgst_size
= DGST_SIZE_4_8
;
7333 parse_func
= hmacsha256_parse_hash
;
7334 sort_by_digest
= sort_by_digest_4_8
;
7335 opti_type
= OPTI_TYPE_ZERO_BYTE
7336 | OPTI_TYPE_NOT_ITERATED
;
7343 case 1460: hash_type
= HASH_TYPE_SHA256
;
7344 salt_type
= SALT_TYPE_INTERN
;
7345 attack_exec
= ATTACK_EXEC_ON_GPU
;
7346 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7347 | OPTS_TYPE_PT_ADD80
7348 | OPTS_TYPE_PT_ADDBITS15
;
7349 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7350 dgst_size
= DGST_SIZE_4_8
;
7351 parse_func
= hmacsha256_parse_hash
;
7352 sort_by_digest
= sort_by_digest_4_8
;
7353 opti_type
= OPTI_TYPE_ZERO_BYTE
7354 | OPTI_TYPE_NOT_ITERATED
;
7361 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7362 salt_type
= SALT_TYPE_EMBEDDED
;
7363 attack_exec
= ATTACK_EXEC_ON_GPU
;
7364 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7365 | OPTS_TYPE_PT_BITSLICE
;
7366 kern_type
= KERN_TYPE_DESCRYPT
;
7367 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7368 parse_func
= descrypt_parse_hash
;
7369 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7370 opti_type
= OPTI_TYPE_ZERO_BYTE
7371 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7378 case 1600: hash_type
= HASH_TYPE_MD5
;
7379 salt_type
= SALT_TYPE_EMBEDDED
;
7380 attack_exec
= ATTACK_EXEC_ON_CPU
;
7381 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7382 kern_type
= KERN_TYPE_APR1CRYPT
;
7383 dgst_size
= DGST_SIZE_4_4
;
7384 parse_func
= md5apr1_parse_hash
;
7385 sort_by_digest
= sort_by_digest_4_4
;
7386 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7393 case 1700: hash_type
= HASH_TYPE_SHA512
;
7394 salt_type
= SALT_TYPE_NONE
;
7395 attack_exec
= ATTACK_EXEC_ON_GPU
;
7396 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7397 | OPTS_TYPE_PT_ADD80
7398 | OPTS_TYPE_PT_ADDBITS15
;
7399 kern_type
= KERN_TYPE_SHA512
;
7400 dgst_size
= DGST_SIZE_8_8
;
7401 parse_func
= sha512_parse_hash
;
7402 sort_by_digest
= sort_by_digest_8_8
;
7403 opti_type
= OPTI_TYPE_ZERO_BYTE
7404 | OPTI_TYPE_PRECOMPUTE_INIT
7405 | OPTI_TYPE_PRECOMPUTE_MERKLE
7406 | OPTI_TYPE_EARLY_SKIP
7407 | OPTI_TYPE_NOT_ITERATED
7408 | OPTI_TYPE_NOT_SALTED
7409 | OPTI_TYPE_RAW_HASH
;
7416 case 1710: hash_type
= HASH_TYPE_SHA512
;
7417 salt_type
= SALT_TYPE_INTERN
;
7418 attack_exec
= ATTACK_EXEC_ON_GPU
;
7419 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7420 | OPTS_TYPE_ST_ADD80
7421 | OPTS_TYPE_ST_ADDBITS15
;
7422 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7423 dgst_size
= DGST_SIZE_8_8
;
7424 parse_func
= sha512s_parse_hash
;
7425 sort_by_digest
= sort_by_digest_8_8
;
7426 opti_type
= OPTI_TYPE_ZERO_BYTE
7427 | OPTI_TYPE_PRECOMPUTE_INIT
7428 | OPTI_TYPE_PRECOMPUTE_MERKLE
7429 | OPTI_TYPE_EARLY_SKIP
7430 | OPTI_TYPE_NOT_ITERATED
7431 | OPTI_TYPE_APPENDED_SALT
7432 | OPTI_TYPE_RAW_HASH
;
7439 case 1711: hash_type
= HASH_TYPE_SHA512
;
7440 salt_type
= SALT_TYPE_EMBEDDED
;
7441 attack_exec
= ATTACK_EXEC_ON_GPU
;
7442 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7443 | OPTS_TYPE_ST_ADD80
7444 | OPTS_TYPE_ST_ADDBITS15
;
7445 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7446 dgst_size
= DGST_SIZE_8_8
;
7447 parse_func
= sha512b64s_parse_hash
;
7448 sort_by_digest
= sort_by_digest_8_8
;
7449 opti_type
= OPTI_TYPE_ZERO_BYTE
7450 | OPTI_TYPE_PRECOMPUTE_INIT
7451 | OPTI_TYPE_PRECOMPUTE_MERKLE
7452 | OPTI_TYPE_EARLY_SKIP
7453 | OPTI_TYPE_NOT_ITERATED
7454 | OPTI_TYPE_APPENDED_SALT
7455 | OPTI_TYPE_RAW_HASH
;
7462 case 1720: hash_type
= HASH_TYPE_SHA512
;
7463 salt_type
= SALT_TYPE_INTERN
;
7464 attack_exec
= ATTACK_EXEC_ON_GPU
;
7465 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7466 | OPTS_TYPE_PT_ADD80
7467 | OPTS_TYPE_PT_ADDBITS15
;
7468 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7469 dgst_size
= DGST_SIZE_8_8
;
7470 parse_func
= sha512s_parse_hash
;
7471 sort_by_digest
= sort_by_digest_8_8
;
7472 opti_type
= OPTI_TYPE_ZERO_BYTE
7473 | OPTI_TYPE_PRECOMPUTE_INIT
7474 | OPTI_TYPE_PRECOMPUTE_MERKLE
7475 | OPTI_TYPE_EARLY_SKIP
7476 | OPTI_TYPE_NOT_ITERATED
7477 | OPTI_TYPE_PREPENDED_SALT
7478 | OPTI_TYPE_RAW_HASH
;
7485 case 1722: hash_type
= HASH_TYPE_SHA512
;
7486 salt_type
= SALT_TYPE_EMBEDDED
;
7487 attack_exec
= ATTACK_EXEC_ON_GPU
;
7488 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7489 | OPTS_TYPE_PT_ADD80
7490 | OPTS_TYPE_PT_ADDBITS15
7492 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7493 dgst_size
= DGST_SIZE_8_8
;
7494 parse_func
= osx512_parse_hash
;
7495 sort_by_digest
= sort_by_digest_8_8
;
7496 opti_type
= OPTI_TYPE_ZERO_BYTE
7497 | OPTI_TYPE_PRECOMPUTE_INIT
7498 | OPTI_TYPE_PRECOMPUTE_MERKLE
7499 | OPTI_TYPE_EARLY_SKIP
7500 | OPTI_TYPE_NOT_ITERATED
7501 | OPTI_TYPE_PREPENDED_SALT
7502 | OPTI_TYPE_RAW_HASH
;
7509 case 1730: hash_type
= HASH_TYPE_SHA512
;
7510 salt_type
= SALT_TYPE_INTERN
;
7511 attack_exec
= ATTACK_EXEC_ON_GPU
;
7512 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7513 | OPTS_TYPE_PT_UNICODE
7514 | OPTS_TYPE_ST_ADD80
7515 | OPTS_TYPE_ST_ADDBITS15
;
7516 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7517 dgst_size
= DGST_SIZE_8_8
;
7518 parse_func
= sha512s_parse_hash
;
7519 sort_by_digest
= sort_by_digest_8_8
;
7520 opti_type
= OPTI_TYPE_ZERO_BYTE
7521 | OPTI_TYPE_PRECOMPUTE_INIT
7522 | OPTI_TYPE_PRECOMPUTE_MERKLE
7523 | OPTI_TYPE_EARLY_SKIP
7524 | OPTI_TYPE_NOT_ITERATED
7525 | OPTI_TYPE_APPENDED_SALT
7526 | OPTI_TYPE_RAW_HASH
;
7533 case 1731: hash_type
= HASH_TYPE_SHA512
;
7534 salt_type
= SALT_TYPE_EMBEDDED
;
7535 attack_exec
= ATTACK_EXEC_ON_GPU
;
7536 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7537 | OPTS_TYPE_PT_UNICODE
7538 | OPTS_TYPE_ST_ADD80
7539 | OPTS_TYPE_ST_ADDBITS15
7541 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7542 dgst_size
= DGST_SIZE_8_8
;
7543 parse_func
= mssql2012_parse_hash
;
7544 sort_by_digest
= sort_by_digest_8_8
;
7545 opti_type
= OPTI_TYPE_ZERO_BYTE
7546 | OPTI_TYPE_PRECOMPUTE_INIT
7547 | OPTI_TYPE_PRECOMPUTE_MERKLE
7548 | OPTI_TYPE_EARLY_SKIP
7549 | OPTI_TYPE_NOT_ITERATED
7550 | OPTI_TYPE_APPENDED_SALT
7551 | OPTI_TYPE_RAW_HASH
;
7558 case 1740: hash_type
= HASH_TYPE_SHA512
;
7559 salt_type
= SALT_TYPE_INTERN
;
7560 attack_exec
= ATTACK_EXEC_ON_GPU
;
7561 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7562 | OPTS_TYPE_PT_ADD80
7563 | OPTS_TYPE_PT_ADDBITS15
7564 | OPTS_TYPE_PT_UNICODE
;
7565 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7566 dgst_size
= DGST_SIZE_8_8
;
7567 parse_func
= sha512s_parse_hash
;
7568 sort_by_digest
= sort_by_digest_8_8
;
7569 opti_type
= OPTI_TYPE_ZERO_BYTE
7570 | OPTI_TYPE_PRECOMPUTE_INIT
7571 | OPTI_TYPE_PRECOMPUTE_MERKLE
7572 | OPTI_TYPE_EARLY_SKIP
7573 | OPTI_TYPE_NOT_ITERATED
7574 | OPTI_TYPE_PREPENDED_SALT
7575 | OPTI_TYPE_RAW_HASH
;
7582 case 1750: hash_type
= HASH_TYPE_SHA512
;
7583 salt_type
= SALT_TYPE_INTERN
;
7584 attack_exec
= ATTACK_EXEC_ON_GPU
;
7585 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7586 | OPTS_TYPE_ST_ADD80
;
7587 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7588 dgst_size
= DGST_SIZE_8_8
;
7589 parse_func
= hmacsha512_parse_hash
;
7590 sort_by_digest
= sort_by_digest_8_8
;
7591 opti_type
= OPTI_TYPE_ZERO_BYTE
7592 | OPTI_TYPE_NOT_ITERATED
;
7599 case 1760: hash_type
= HASH_TYPE_SHA512
;
7600 salt_type
= SALT_TYPE_INTERN
;
7601 attack_exec
= ATTACK_EXEC_ON_GPU
;
7602 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7603 | OPTS_TYPE_PT_ADD80
7604 | OPTS_TYPE_PT_ADDBITS15
;
7605 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7606 dgst_size
= DGST_SIZE_8_8
;
7607 parse_func
= hmacsha512_parse_hash
;
7608 sort_by_digest
= sort_by_digest_8_8
;
7609 opti_type
= OPTI_TYPE_ZERO_BYTE
7610 | OPTI_TYPE_NOT_ITERATED
;
7617 case 1800: hash_type
= HASH_TYPE_SHA512
;
7618 salt_type
= SALT_TYPE_EMBEDDED
;
7619 attack_exec
= ATTACK_EXEC_ON_CPU
;
7620 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7621 kern_type
= KERN_TYPE_SHA512CRYPT
;
7622 dgst_size
= DGST_SIZE_8_8
;
7623 parse_func
= sha512crypt_parse_hash
;
7624 sort_by_digest
= sort_by_digest_8_8
;
7625 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7632 case 2100: hash_type
= HASH_TYPE_DCC2
;
7633 salt_type
= SALT_TYPE_EMBEDDED
;
7634 attack_exec
= ATTACK_EXEC_ON_CPU
;
7635 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7636 | OPTS_TYPE_ST_LOWER
7637 | OPTS_TYPE_ST_UNICODE
;
7638 kern_type
= KERN_TYPE_DCC2
;
7639 dgst_size
= DGST_SIZE_4_4
;
7640 parse_func
= dcc2_parse_hash
;
7641 sort_by_digest
= sort_by_digest_4_4
;
7642 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7649 case 2400: hash_type
= HASH_TYPE_MD5
;
7650 salt_type
= SALT_TYPE_NONE
;
7651 attack_exec
= ATTACK_EXEC_ON_GPU
;
7652 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7653 kern_type
= KERN_TYPE_MD5PIX
;
7654 dgst_size
= DGST_SIZE_4_4
;
7655 parse_func
= md5pix_parse_hash
;
7656 sort_by_digest
= sort_by_digest_4_4
;
7657 opti_type
= OPTI_TYPE_ZERO_BYTE
7658 | OPTI_TYPE_PRECOMPUTE_INIT
7659 | OPTI_TYPE_PRECOMPUTE_MERKLE
7660 | OPTI_TYPE_EARLY_SKIP
7661 | OPTI_TYPE_NOT_ITERATED
7662 | OPTI_TYPE_NOT_SALTED
;
7669 case 2410: hash_type
= HASH_TYPE_MD5
;
7670 salt_type
= SALT_TYPE_INTERN
;
7671 attack_exec
= ATTACK_EXEC_ON_GPU
;
7672 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7673 kern_type
= KERN_TYPE_MD5ASA
;
7674 dgst_size
= DGST_SIZE_4_4
;
7675 parse_func
= md5asa_parse_hash
;
7676 sort_by_digest
= sort_by_digest_4_4
;
7677 opti_type
= OPTI_TYPE_ZERO_BYTE
7678 | OPTI_TYPE_PRECOMPUTE_INIT
7679 | OPTI_TYPE_PRECOMPUTE_MERKLE
7680 | OPTI_TYPE_EARLY_SKIP
7681 | OPTI_TYPE_NOT_ITERATED
;
7688 case 2500: hash_type
= HASH_TYPE_WPA
;
7689 salt_type
= SALT_TYPE_EMBEDDED
;
7690 attack_exec
= ATTACK_EXEC_ON_CPU
;
7691 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7692 kern_type
= KERN_TYPE_WPA
;
7693 dgst_size
= DGST_SIZE_4_4
;
7694 parse_func
= wpa_parse_hash
;
7695 sort_by_digest
= sort_by_digest_4_4
;
7696 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7703 case 2600: hash_type
= HASH_TYPE_MD5
;
7704 salt_type
= SALT_TYPE_VIRTUAL
;
7705 attack_exec
= ATTACK_EXEC_ON_GPU
;
7706 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7707 | OPTS_TYPE_PT_ADD80
7708 | OPTS_TYPE_PT_ADDBITS14
7709 | OPTS_TYPE_ST_ADD80
;
7710 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7711 dgst_size
= DGST_SIZE_4_4
;
7712 parse_func
= md5md5_parse_hash
;
7713 sort_by_digest
= sort_by_digest_4_4
;
7714 opti_type
= OPTI_TYPE_ZERO_BYTE
7715 | OPTI_TYPE_PRECOMPUTE_INIT
7716 | OPTI_TYPE_PRECOMPUTE_MERKLE
7717 | OPTI_TYPE_EARLY_SKIP
;
7724 case 2611: hash_type
= HASH_TYPE_MD5
;
7725 salt_type
= SALT_TYPE_INTERN
;
7726 attack_exec
= ATTACK_EXEC_ON_GPU
;
7727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7728 | OPTS_TYPE_PT_ADD80
7729 | OPTS_TYPE_PT_ADDBITS14
7730 | OPTS_TYPE_ST_ADD80
;
7731 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7732 dgst_size
= DGST_SIZE_4_4
;
7733 parse_func
= vb3_parse_hash
;
7734 sort_by_digest
= sort_by_digest_4_4
;
7735 opti_type
= OPTI_TYPE_ZERO_BYTE
7736 | OPTI_TYPE_PRECOMPUTE_INIT
7737 | OPTI_TYPE_PRECOMPUTE_MERKLE
7738 | OPTI_TYPE_EARLY_SKIP
;
7745 case 2612: hash_type
= HASH_TYPE_MD5
;
7746 salt_type
= SALT_TYPE_EMBEDDED
;
7747 attack_exec
= ATTACK_EXEC_ON_GPU
;
7748 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7749 | OPTS_TYPE_PT_ADD80
7750 | OPTS_TYPE_PT_ADDBITS14
7751 | OPTS_TYPE_ST_ADD80
7753 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7754 dgst_size
= DGST_SIZE_4_4
;
7755 parse_func
= phps_parse_hash
;
7756 sort_by_digest
= sort_by_digest_4_4
;
7757 opti_type
= OPTI_TYPE_ZERO_BYTE
7758 | OPTI_TYPE_PRECOMPUTE_INIT
7759 | OPTI_TYPE_PRECOMPUTE_MERKLE
7760 | OPTI_TYPE_EARLY_SKIP
;
7767 case 2711: hash_type
= HASH_TYPE_MD5
;
7768 salt_type
= SALT_TYPE_INTERN
;
7769 attack_exec
= ATTACK_EXEC_ON_GPU
;
7770 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7771 | OPTS_TYPE_PT_ADD80
7772 | OPTS_TYPE_PT_ADDBITS14
7773 | OPTS_TYPE_ST_ADD80
;
7774 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7775 dgst_size
= DGST_SIZE_4_4
;
7776 parse_func
= vb30_parse_hash
;
7777 sort_by_digest
= sort_by_digest_4_4
;
7778 opti_type
= OPTI_TYPE_ZERO_BYTE
7779 | OPTI_TYPE_PRECOMPUTE_INIT
7780 | OPTI_TYPE_EARLY_SKIP
;
7787 case 2811: hash_type
= HASH_TYPE_MD5
;
7788 salt_type
= SALT_TYPE_INTERN
;
7789 attack_exec
= ATTACK_EXEC_ON_GPU
;
7790 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7791 | OPTS_TYPE_PT_ADD80
7792 | OPTS_TYPE_PT_ADDBITS14
;
7793 kern_type
= KERN_TYPE_MD55_SLTPW
;
7794 dgst_size
= DGST_SIZE_4_4
;
7795 parse_func
= ipb2_parse_hash
;
7796 sort_by_digest
= sort_by_digest_4_4
;
7797 opti_type
= OPTI_TYPE_ZERO_BYTE
7798 | OPTI_TYPE_PRECOMPUTE_INIT
7799 | OPTI_TYPE_EARLY_SKIP
;
7806 case 3000: hash_type
= HASH_TYPE_LM
;
7807 salt_type
= SALT_TYPE_NONE
;
7808 attack_exec
= ATTACK_EXEC_ON_GPU
;
7809 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7810 | OPTS_TYPE_PT_UPPER
7811 | OPTS_TYPE_PT_BITSLICE
;
7812 kern_type
= KERN_TYPE_LM
;
7813 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7814 parse_func
= lm_parse_hash
;
7815 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7816 opti_type
= OPTI_TYPE_ZERO_BYTE
7817 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7824 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7825 salt_type
= SALT_TYPE_INTERN
;
7826 attack_exec
= ATTACK_EXEC_ON_GPU
;
7827 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7828 | OPTS_TYPE_PT_UPPER
7829 | OPTS_TYPE_ST_UPPER
;
7830 kern_type
= KERN_TYPE_ORACLEH
;
7831 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7832 parse_func
= oracleh_parse_hash
;
7833 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7834 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7841 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7842 salt_type
= SALT_TYPE_EMBEDDED
;
7843 attack_exec
= ATTACK_EXEC_ON_CPU
;
7844 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7845 | OPTS_TYPE_ST_GENERATE_LE
;
7846 kern_type
= KERN_TYPE_BCRYPT
;
7847 dgst_size
= DGST_SIZE_4_6
;
7848 parse_func
= bcrypt_parse_hash
;
7849 sort_by_digest
= sort_by_digest_4_6
;
7850 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7857 case 3710: hash_type
= HASH_TYPE_MD5
;
7858 salt_type
= SALT_TYPE_INTERN
;
7859 attack_exec
= ATTACK_EXEC_ON_GPU
;
7860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7861 | OPTS_TYPE_PT_ADD80
7862 | OPTS_TYPE_PT_ADDBITS14
;
7863 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7864 dgst_size
= DGST_SIZE_4_4
;
7865 parse_func
= md5s_parse_hash
;
7866 sort_by_digest
= sort_by_digest_4_4
;
7867 opti_type
= OPTI_TYPE_ZERO_BYTE
7868 | OPTI_TYPE_PRECOMPUTE_INIT
7869 | OPTI_TYPE_PRECOMPUTE_MERKLE
7870 | OPTI_TYPE_EARLY_SKIP
;
7877 case 3711: hash_type
= HASH_TYPE_MD5
;
7878 salt_type
= SALT_TYPE_EMBEDDED
;
7879 attack_exec
= ATTACK_EXEC_ON_GPU
;
7880 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7881 | OPTS_TYPE_PT_ADD80
7882 | OPTS_TYPE_PT_ADDBITS14
;
7883 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7884 dgst_size
= DGST_SIZE_4_4
;
7885 parse_func
= mediawiki_b_parse_hash
;
7886 sort_by_digest
= sort_by_digest_4_4
;
7887 opti_type
= OPTI_TYPE_ZERO_BYTE
7888 | OPTI_TYPE_PRECOMPUTE_INIT
7889 | OPTI_TYPE_PRECOMPUTE_MERKLE
7890 | OPTI_TYPE_EARLY_SKIP
;
7897 case 3800: hash_type
= HASH_TYPE_MD5
;
7898 salt_type
= SALT_TYPE_INTERN
;
7899 attack_exec
= ATTACK_EXEC_ON_GPU
;
7900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7901 | OPTS_TYPE_ST_ADDBITS14
;
7902 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
7903 dgst_size
= DGST_SIZE_4_4
;
7904 parse_func
= md5s_parse_hash
;
7905 sort_by_digest
= sort_by_digest_4_4
;
7906 opti_type
= OPTI_TYPE_ZERO_BYTE
7907 | OPTI_TYPE_PRECOMPUTE_INIT
7908 | OPTI_TYPE_PRECOMPUTE_MERKLE
7909 | OPTI_TYPE_EARLY_SKIP
7910 | OPTI_TYPE_NOT_ITERATED
7911 | OPTI_TYPE_RAW_HASH
;
7918 case 4300: hash_type
= HASH_TYPE_MD5
;
7919 salt_type
= SALT_TYPE_VIRTUAL
;
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 | OPTS_TYPE_ST_ADD80
;
7925 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
7926 dgst_size
= DGST_SIZE_4_4
;
7927 parse_func
= md5md5_parse_hash
;
7928 sort_by_digest
= sort_by_digest_4_4
;
7929 opti_type
= OPTI_TYPE_ZERO_BYTE
7930 | OPTI_TYPE_PRECOMPUTE_INIT
7931 | OPTI_TYPE_PRECOMPUTE_MERKLE
7932 | OPTI_TYPE_EARLY_SKIP
;
7940 case 4400: hash_type
= HASH_TYPE_MD5
;
7941 salt_type
= SALT_TYPE_NONE
;
7942 attack_exec
= ATTACK_EXEC_ON_GPU
;
7943 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7944 | OPTS_TYPE_PT_ADD80
7945 | OPTS_TYPE_PT_ADDBITS15
;
7946 kern_type
= KERN_TYPE_MD5_SHA1
;
7947 dgst_size
= DGST_SIZE_4_4
;
7948 parse_func
= md5_parse_hash
;
7949 sort_by_digest
= sort_by_digest_4_4
;
7950 opti_type
= OPTI_TYPE_ZERO_BYTE
7951 | OPTI_TYPE_PRECOMPUTE_INIT
7952 | OPTI_TYPE_PRECOMPUTE_MERKLE
7953 | OPTI_TYPE_EARLY_SKIP
7954 | OPTI_TYPE_NOT_ITERATED
7955 | OPTI_TYPE_NOT_SALTED
7956 | OPTI_TYPE_RAW_HASH
;
7963 case 4500: hash_type
= HASH_TYPE_SHA1
;
7964 salt_type
= SALT_TYPE_NONE
;
7965 attack_exec
= ATTACK_EXEC_ON_GPU
;
7966 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7967 | OPTS_TYPE_PT_ADD80
7968 | OPTS_TYPE_PT_ADDBITS15
;
7969 kern_type
= KERN_TYPE_SHA11
;
7970 dgst_size
= DGST_SIZE_4_5
;
7971 parse_func
= sha1_parse_hash
;
7972 sort_by_digest
= sort_by_digest_4_5
;
7973 opti_type
= OPTI_TYPE_ZERO_BYTE
7974 | OPTI_TYPE_PRECOMPUTE_INIT
7975 | OPTI_TYPE_PRECOMPUTE_MERKLE
7976 | OPTI_TYPE_EARLY_SKIP
7977 | OPTI_TYPE_NOT_SALTED
;
7984 case 4700: hash_type
= HASH_TYPE_SHA1
;
7985 salt_type
= SALT_TYPE_NONE
;
7986 attack_exec
= ATTACK_EXEC_ON_GPU
;
7987 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7988 | OPTS_TYPE_PT_ADD80
7989 | OPTS_TYPE_PT_ADDBITS14
;
7990 kern_type
= KERN_TYPE_SHA1_MD5
;
7991 dgst_size
= DGST_SIZE_4_5
;
7992 parse_func
= sha1_parse_hash
;
7993 sort_by_digest
= sort_by_digest_4_5
;
7994 opti_type
= OPTI_TYPE_ZERO_BYTE
7995 | OPTI_TYPE_PRECOMPUTE_INIT
7996 | OPTI_TYPE_PRECOMPUTE_MERKLE
7997 | OPTI_TYPE_EARLY_SKIP
7998 | OPTI_TYPE_NOT_ITERATED
7999 | OPTI_TYPE_NOT_SALTED
8000 | OPTI_TYPE_RAW_HASH
;
8007 case 4800: hash_type
= HASH_TYPE_MD5
;
8008 salt_type
= SALT_TYPE_EMBEDDED
;
8009 attack_exec
= ATTACK_EXEC_ON_GPU
;
8010 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8011 | OPTS_TYPE_PT_ADDBITS14
;
8012 kern_type
= KERN_TYPE_MD5_CHAP
;
8013 dgst_size
= DGST_SIZE_4_4
;
8014 parse_func
= chap_parse_hash
;
8015 sort_by_digest
= sort_by_digest_4_4
;
8016 opti_type
= OPTI_TYPE_ZERO_BYTE
8017 | OPTI_TYPE_PRECOMPUTE_INIT
8018 | OPTI_TYPE_PRECOMPUTE_MERKLE
8019 | OPTI_TYPE_MEET_IN_MIDDLE
8020 | OPTI_TYPE_EARLY_SKIP
8021 | OPTI_TYPE_NOT_ITERATED
8022 | OPTI_TYPE_RAW_HASH
;
8029 case 4900: hash_type
= HASH_TYPE_SHA1
;
8030 salt_type
= SALT_TYPE_INTERN
;
8031 attack_exec
= ATTACK_EXEC_ON_GPU
;
8032 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8033 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8034 dgst_size
= DGST_SIZE_4_5
;
8035 parse_func
= sha1s_parse_hash
;
8036 sort_by_digest
= sort_by_digest_4_5
;
8037 opti_type
= OPTI_TYPE_ZERO_BYTE
8038 | OPTI_TYPE_PRECOMPUTE_INIT
8039 | OPTI_TYPE_PRECOMPUTE_MERKLE
8040 | OPTI_TYPE_EARLY_SKIP
;
8047 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8048 salt_type
= SALT_TYPE_EMBEDDED
;
8049 attack_exec
= ATTACK_EXEC_ON_GPU
;
8050 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8051 | OPTS_TYPE_PT_ADD01
;
8052 kern_type
= KERN_TYPE_KECCAK
;
8053 dgst_size
= DGST_SIZE_8_25
;
8054 parse_func
= keccak_parse_hash
;
8055 sort_by_digest
= sort_by_digest_8_25
;
8056 opti_type
= OPTI_TYPE_ZERO_BYTE
8057 | OPTI_TYPE_RAW_HASH
;
8064 case 5100: hash_type
= HASH_TYPE_MD5H
;
8065 salt_type
= SALT_TYPE_NONE
;
8066 attack_exec
= ATTACK_EXEC_ON_GPU
;
8067 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8068 | OPTS_TYPE_PT_ADD80
8069 | OPTS_TYPE_PT_ADDBITS14
;
8070 kern_type
= KERN_TYPE_MD5H
;
8071 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8072 parse_func
= md5half_parse_hash
;
8073 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8074 opti_type
= OPTI_TYPE_ZERO_BYTE
8075 | OPTI_TYPE_RAW_HASH
;
8082 case 5200: hash_type
= HASH_TYPE_SHA256
;
8083 salt_type
= SALT_TYPE_EMBEDDED
;
8084 attack_exec
= ATTACK_EXEC_ON_CPU
;
8085 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8086 kern_type
= KERN_TYPE_PSAFE3
;
8087 dgst_size
= DGST_SIZE_4_8
;
8088 parse_func
= psafe3_parse_hash
;
8089 sort_by_digest
= sort_by_digest_4_8
;
8090 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8097 case 5300: hash_type
= HASH_TYPE_MD5
;
8098 salt_type
= SALT_TYPE_EMBEDDED
;
8099 attack_exec
= ATTACK_EXEC_ON_GPU
;
8100 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8101 | OPTS_TYPE_ST_ADD80
;
8102 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8103 dgst_size
= DGST_SIZE_4_4
;
8104 parse_func
= ikepsk_md5_parse_hash
;
8105 sort_by_digest
= sort_by_digest_4_4
;
8106 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8113 case 5400: hash_type
= HASH_TYPE_SHA1
;
8114 salt_type
= SALT_TYPE_EMBEDDED
;
8115 attack_exec
= ATTACK_EXEC_ON_GPU
;
8116 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8117 | OPTS_TYPE_ST_ADD80
;
8118 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8119 dgst_size
= DGST_SIZE_4_5
;
8120 parse_func
= ikepsk_sha1_parse_hash
;
8121 sort_by_digest
= sort_by_digest_4_5
;
8122 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8129 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8130 salt_type
= SALT_TYPE_EMBEDDED
;
8131 attack_exec
= ATTACK_EXEC_ON_GPU
;
8132 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8133 | OPTS_TYPE_PT_ADD80
8134 | OPTS_TYPE_PT_ADDBITS14
8135 | OPTS_TYPE_PT_UNICODE
8137 kern_type
= KERN_TYPE_NETNTLMv1
;
8138 dgst_size
= DGST_SIZE_4_4
;
8139 parse_func
= netntlmv1_parse_hash
;
8140 sort_by_digest
= sort_by_digest_4_4
;
8141 opti_type
= OPTI_TYPE_ZERO_BYTE
8142 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8149 case 5600: hash_type
= HASH_TYPE_MD5
;
8150 salt_type
= SALT_TYPE_EMBEDDED
;
8151 attack_exec
= ATTACK_EXEC_ON_GPU
;
8152 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8153 | OPTS_TYPE_PT_ADD80
8154 | OPTS_TYPE_PT_ADDBITS14
8155 | OPTS_TYPE_PT_UNICODE
;
8156 kern_type
= KERN_TYPE_NETNTLMv2
;
8157 dgst_size
= DGST_SIZE_4_4
;
8158 parse_func
= netntlmv2_parse_hash
;
8159 sort_by_digest
= sort_by_digest_4_4
;
8160 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8167 case 5700: hash_type
= HASH_TYPE_SHA256
;
8168 salt_type
= SALT_TYPE_NONE
;
8169 attack_exec
= ATTACK_EXEC_ON_GPU
;
8170 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8171 | OPTS_TYPE_PT_ADD80
8172 | OPTS_TYPE_PT_ADDBITS15
;
8173 kern_type
= KERN_TYPE_SHA256
;
8174 dgst_size
= DGST_SIZE_4_8
;
8175 parse_func
= cisco4_parse_hash
;
8176 sort_by_digest
= sort_by_digest_4_8
;
8177 opti_type
= OPTI_TYPE_ZERO_BYTE
8178 | OPTI_TYPE_PRECOMPUTE_INIT
8179 | OPTI_TYPE_PRECOMPUTE_MERKLE
8180 | OPTI_TYPE_EARLY_SKIP
8181 | OPTI_TYPE_NOT_ITERATED
8182 | OPTI_TYPE_NOT_SALTED
8183 | OPTI_TYPE_RAW_HASH
;
8190 case 5800: hash_type
= HASH_TYPE_SHA1
;
8191 salt_type
= SALT_TYPE_INTERN
;
8192 attack_exec
= ATTACK_EXEC_ON_CPU
;
8193 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8194 | OPTS_TYPE_ST_ADD80
;
8195 kern_type
= KERN_TYPE_ANDROIDPIN
;
8196 dgst_size
= DGST_SIZE_4_5
;
8197 parse_func
= androidpin_parse_hash
;
8198 sort_by_digest
= sort_by_digest_4_5
;
8199 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8206 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8207 salt_type
= SALT_TYPE_NONE
;
8208 attack_exec
= ATTACK_EXEC_ON_GPU
;
8209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8210 | OPTS_TYPE_PT_ADD80
;
8211 kern_type
= KERN_TYPE_RIPEMD160
;
8212 dgst_size
= DGST_SIZE_4_5
;
8213 parse_func
= ripemd160_parse_hash
;
8214 sort_by_digest
= sort_by_digest_4_5
;
8215 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8222 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8223 salt_type
= SALT_TYPE_NONE
;
8224 attack_exec
= ATTACK_EXEC_ON_GPU
;
8225 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8226 | OPTS_TYPE_PT_ADD80
;
8227 kern_type
= KERN_TYPE_WHIRLPOOL
;
8228 dgst_size
= DGST_SIZE_4_16
;
8229 parse_func
= whirlpool_parse_hash
;
8230 sort_by_digest
= sort_by_digest_4_16
;
8231 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8238 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8239 salt_type
= SALT_TYPE_EMBEDDED
;
8240 attack_exec
= ATTACK_EXEC_ON_CPU
;
8241 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8242 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8243 dgst_size
= DGST_SIZE_4_5
;
8244 parse_func
= truecrypt_parse_hash_2k
;
8245 sort_by_digest
= sort_by_digest_4_5
;
8246 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8253 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8254 salt_type
= SALT_TYPE_EMBEDDED
;
8255 attack_exec
= ATTACK_EXEC_ON_CPU
;
8256 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8257 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8258 dgst_size
= DGST_SIZE_4_5
;
8259 parse_func
= truecrypt_parse_hash_2k
;
8260 sort_by_digest
= sort_by_digest_4_5
;
8261 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8268 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8269 salt_type
= SALT_TYPE_EMBEDDED
;
8270 attack_exec
= ATTACK_EXEC_ON_CPU
;
8271 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8272 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8273 dgst_size
= DGST_SIZE_4_5
;
8274 parse_func
= truecrypt_parse_hash_2k
;
8275 sort_by_digest
= sort_by_digest_4_5
;
8276 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8283 case 6221: hash_type
= HASH_TYPE_SHA512
;
8284 salt_type
= SALT_TYPE_EMBEDDED
;
8285 attack_exec
= ATTACK_EXEC_ON_CPU
;
8286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8287 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8288 dgst_size
= DGST_SIZE_8_8
;
8289 parse_func
= truecrypt_parse_hash_1k
;
8290 sort_by_digest
= sort_by_digest_8_8
;
8291 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8298 case 6222: hash_type
= HASH_TYPE_SHA512
;
8299 salt_type
= SALT_TYPE_EMBEDDED
;
8300 attack_exec
= ATTACK_EXEC_ON_CPU
;
8301 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8302 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8303 dgst_size
= DGST_SIZE_8_8
;
8304 parse_func
= truecrypt_parse_hash_1k
;
8305 sort_by_digest
= sort_by_digest_8_8
;
8306 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8313 case 6223: hash_type
= HASH_TYPE_SHA512
;
8314 salt_type
= SALT_TYPE_EMBEDDED
;
8315 attack_exec
= ATTACK_EXEC_ON_CPU
;
8316 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8317 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8318 dgst_size
= DGST_SIZE_8_8
;
8319 parse_func
= truecrypt_parse_hash_1k
;
8320 sort_by_digest
= sort_by_digest_8_8
;
8321 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8328 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8329 salt_type
= SALT_TYPE_EMBEDDED
;
8330 attack_exec
= ATTACK_EXEC_ON_CPU
;
8331 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8332 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8333 dgst_size
= DGST_SIZE_4_8
;
8334 parse_func
= truecrypt_parse_hash_1k
;
8335 sort_by_digest
= sort_by_digest_4_8
;
8336 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8343 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8344 salt_type
= SALT_TYPE_EMBEDDED
;
8345 attack_exec
= ATTACK_EXEC_ON_CPU
;
8346 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8347 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8348 dgst_size
= DGST_SIZE_4_8
;
8349 parse_func
= truecrypt_parse_hash_1k
;
8350 sort_by_digest
= sort_by_digest_4_8
;
8351 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8358 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8359 salt_type
= SALT_TYPE_EMBEDDED
;
8360 attack_exec
= ATTACK_EXEC_ON_CPU
;
8361 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8362 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8363 dgst_size
= DGST_SIZE_4_8
;
8364 parse_func
= truecrypt_parse_hash_1k
;
8365 sort_by_digest
= sort_by_digest_4_8
;
8366 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8373 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8374 salt_type
= SALT_TYPE_EMBEDDED
;
8375 attack_exec
= ATTACK_EXEC_ON_CPU
;
8376 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8377 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8378 dgst_size
= DGST_SIZE_4_5
;
8379 parse_func
= truecrypt_parse_hash_1k
;
8380 sort_by_digest
= sort_by_digest_4_5
;
8381 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8388 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8389 salt_type
= SALT_TYPE_EMBEDDED
;
8390 attack_exec
= ATTACK_EXEC_ON_CPU
;
8391 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8392 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8393 dgst_size
= DGST_SIZE_4_5
;
8394 parse_func
= truecrypt_parse_hash_1k
;
8395 sort_by_digest
= sort_by_digest_4_5
;
8396 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8403 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8404 salt_type
= SALT_TYPE_EMBEDDED
;
8405 attack_exec
= ATTACK_EXEC_ON_CPU
;
8406 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8407 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8408 dgst_size
= DGST_SIZE_4_5
;
8409 parse_func
= truecrypt_parse_hash_1k
;
8410 sort_by_digest
= sort_by_digest_4_5
;
8411 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8418 case 6300: hash_type
= HASH_TYPE_MD5
;
8419 salt_type
= SALT_TYPE_EMBEDDED
;
8420 attack_exec
= ATTACK_EXEC_ON_CPU
;
8421 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8422 kern_type
= KERN_TYPE_MD5AIX
;
8423 dgst_size
= DGST_SIZE_4_4
;
8424 parse_func
= md5aix_parse_hash
;
8425 sort_by_digest
= sort_by_digest_4_4
;
8426 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8433 case 6400: hash_type
= HASH_TYPE_SHA256
;
8434 salt_type
= SALT_TYPE_EMBEDDED
;
8435 attack_exec
= ATTACK_EXEC_ON_CPU
;
8436 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8437 kern_type
= KERN_TYPE_SHA256AIX
;
8438 dgst_size
= DGST_SIZE_4_8
;
8439 parse_func
= sha256aix_parse_hash
;
8440 sort_by_digest
= sort_by_digest_4_8
;
8441 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8448 case 6500: hash_type
= HASH_TYPE_SHA512
;
8449 salt_type
= SALT_TYPE_EMBEDDED
;
8450 attack_exec
= ATTACK_EXEC_ON_CPU
;
8451 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8452 kern_type
= KERN_TYPE_SHA512AIX
;
8453 dgst_size
= DGST_SIZE_8_8
;
8454 parse_func
= sha512aix_parse_hash
;
8455 sort_by_digest
= sort_by_digest_8_8
;
8456 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8463 case 6600: hash_type
= HASH_TYPE_AES
;
8464 salt_type
= SALT_TYPE_EMBEDDED
;
8465 attack_exec
= ATTACK_EXEC_ON_CPU
;
8466 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8467 kern_type
= KERN_TYPE_AGILEKEY
;
8468 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8469 parse_func
= agilekey_parse_hash
;
8470 sort_by_digest
= sort_by_digest_4_5
;
8471 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8478 case 6700: hash_type
= HASH_TYPE_SHA1
;
8479 salt_type
= SALT_TYPE_EMBEDDED
;
8480 attack_exec
= ATTACK_EXEC_ON_CPU
;
8481 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8482 kern_type
= KERN_TYPE_SHA1AIX
;
8483 dgst_size
= DGST_SIZE_4_5
;
8484 parse_func
= sha1aix_parse_hash
;
8485 sort_by_digest
= sort_by_digest_4_5
;
8486 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8493 case 6800: hash_type
= HASH_TYPE_AES
;
8494 salt_type
= SALT_TYPE_EMBEDDED
;
8495 attack_exec
= ATTACK_EXEC_ON_CPU
;
8496 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8497 kern_type
= KERN_TYPE_LASTPASS
;
8498 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8499 parse_func
= lastpass_parse_hash
;
8500 sort_by_digest
= sort_by_digest_4_8
;
8501 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8508 case 6900: hash_type
= HASH_TYPE_GOST
;
8509 salt_type
= SALT_TYPE_NONE
;
8510 attack_exec
= ATTACK_EXEC_ON_GPU
;
8511 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8512 kern_type
= KERN_TYPE_GOST
;
8513 dgst_size
= DGST_SIZE_4_8
;
8514 parse_func
= gost_parse_hash
;
8515 sort_by_digest
= sort_by_digest_4_8
;
8516 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8523 case 7100: hash_type
= HASH_TYPE_SHA512
;
8524 salt_type
= SALT_TYPE_EMBEDDED
;
8525 attack_exec
= ATTACK_EXEC_ON_CPU
;
8526 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8527 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8528 dgst_size
= DGST_SIZE_8_16
;
8529 parse_func
= sha512osx_parse_hash
;
8530 sort_by_digest
= sort_by_digest_8_16
;
8531 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8538 case 7200: hash_type
= HASH_TYPE_SHA512
;
8539 salt_type
= SALT_TYPE_EMBEDDED
;
8540 attack_exec
= ATTACK_EXEC_ON_CPU
;
8541 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8542 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8543 dgst_size
= DGST_SIZE_8_16
;
8544 parse_func
= sha512grub_parse_hash
;
8545 sort_by_digest
= sort_by_digest_8_16
;
8546 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8553 case 7300: hash_type
= HASH_TYPE_SHA1
;
8554 salt_type
= SALT_TYPE_EMBEDDED
;
8555 attack_exec
= ATTACK_EXEC_ON_GPU
;
8556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8557 | OPTS_TYPE_ST_ADD80
8558 | OPTS_TYPE_ST_ADDBITS15
;
8559 kern_type
= KERN_TYPE_RAKP
;
8560 dgst_size
= DGST_SIZE_4_5
;
8561 parse_func
= rakp_parse_hash
;
8562 sort_by_digest
= sort_by_digest_4_5
;
8563 opti_type
= OPTI_TYPE_ZERO_BYTE
8564 | OPTI_TYPE_NOT_ITERATED
;
8571 case 7400: hash_type
= HASH_TYPE_SHA256
;
8572 salt_type
= SALT_TYPE_EMBEDDED
;
8573 attack_exec
= ATTACK_EXEC_ON_CPU
;
8574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8575 kern_type
= KERN_TYPE_SHA256CRYPT
;
8576 dgst_size
= DGST_SIZE_4_8
;
8577 parse_func
= sha256crypt_parse_hash
;
8578 sort_by_digest
= sort_by_digest_4_8
;
8579 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8586 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8587 salt_type
= SALT_TYPE_EMBEDDED
;
8588 attack_exec
= ATTACK_EXEC_ON_GPU
;
8589 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8590 kern_type
= KERN_TYPE_KRB5PA
;
8591 dgst_size
= DGST_SIZE_4_4
;
8592 parse_func
= krb5pa_parse_hash
;
8593 sort_by_digest
= sort_by_digest_4_4
;
8594 opti_type
= OPTI_TYPE_ZERO_BYTE
8595 | OPTI_TYPE_NOT_ITERATED
;
8602 case 7600: hash_type
= HASH_TYPE_SHA1
;
8603 salt_type
= SALT_TYPE_INTERN
;
8604 attack_exec
= ATTACK_EXEC_ON_GPU
;
8605 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8606 | OPTS_TYPE_PT_ADD80
8607 | OPTS_TYPE_PT_ADDBITS15
;
8608 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8609 dgst_size
= DGST_SIZE_4_5
;
8610 parse_func
= redmine_parse_hash
;
8611 sort_by_digest
= sort_by_digest_4_5
;
8612 opti_type
= OPTI_TYPE_ZERO_BYTE
8613 | OPTI_TYPE_PRECOMPUTE_INIT
8614 | OPTI_TYPE_EARLY_SKIP
8615 | OPTI_TYPE_NOT_ITERATED
8616 | OPTI_TYPE_PREPENDED_SALT
;
8623 case 7700: hash_type
= HASH_TYPE_SAPB
;
8624 salt_type
= SALT_TYPE_EMBEDDED
;
8625 attack_exec
= ATTACK_EXEC_ON_GPU
;
8626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8627 | OPTS_TYPE_PT_UPPER
8628 | OPTS_TYPE_ST_UPPER
;
8629 kern_type
= KERN_TYPE_SAPB
;
8630 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8631 parse_func
= sapb_parse_hash
;
8632 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8633 opti_type
= OPTI_TYPE_ZERO_BYTE
8634 | OPTI_TYPE_PRECOMPUTE_INIT
8635 | OPTI_TYPE_NOT_ITERATED
;
8642 case 7800: hash_type
= HASH_TYPE_SAPG
;
8643 salt_type
= SALT_TYPE_EMBEDDED
;
8644 attack_exec
= ATTACK_EXEC_ON_GPU
;
8645 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8646 | OPTS_TYPE_ST_ADD80
8647 | OPTS_TYPE_ST_UPPER
;
8648 kern_type
= KERN_TYPE_SAPG
;
8649 dgst_size
= DGST_SIZE_4_5
;
8650 parse_func
= sapg_parse_hash
;
8651 sort_by_digest
= sort_by_digest_4_5
;
8652 opti_type
= OPTI_TYPE_ZERO_BYTE
8653 | OPTI_TYPE_PRECOMPUTE_INIT
8654 | OPTI_TYPE_NOT_ITERATED
;
8661 case 7900: hash_type
= HASH_TYPE_SHA512
;
8662 salt_type
= SALT_TYPE_EMBEDDED
;
8663 attack_exec
= ATTACK_EXEC_ON_CPU
;
8664 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8665 kern_type
= KERN_TYPE_DRUPAL7
;
8666 dgst_size
= DGST_SIZE_8_8
;
8667 parse_func
= drupal7_parse_hash
;
8668 sort_by_digest
= sort_by_digest_8_8
;
8669 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8676 case 8000: hash_type
= HASH_TYPE_SHA256
;
8677 salt_type
= SALT_TYPE_EMBEDDED
;
8678 attack_exec
= ATTACK_EXEC_ON_GPU
;
8679 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8680 | OPTS_TYPE_PT_UNICODE
8681 | OPTS_TYPE_ST_ADD80
8683 kern_type
= KERN_TYPE_SYBASEASE
;
8684 dgst_size
= DGST_SIZE_4_8
;
8685 parse_func
= sybasease_parse_hash
;
8686 sort_by_digest
= sort_by_digest_4_8
;
8687 opti_type
= OPTI_TYPE_ZERO_BYTE
8688 | OPTI_TYPE_PRECOMPUTE_INIT
8689 | OPTI_TYPE_EARLY_SKIP
8690 | OPTI_TYPE_NOT_ITERATED
8691 | OPTI_TYPE_RAW_HASH
;
8698 case 8100: hash_type
= HASH_TYPE_SHA1
;
8699 salt_type
= SALT_TYPE_EMBEDDED
;
8700 attack_exec
= ATTACK_EXEC_ON_GPU
;
8701 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8702 kern_type
= KERN_TYPE_NETSCALER
;
8703 dgst_size
= DGST_SIZE_4_5
;
8704 parse_func
= netscaler_parse_hash
;
8705 sort_by_digest
= sort_by_digest_4_5
;
8706 opti_type
= OPTI_TYPE_ZERO_BYTE
8707 | OPTI_TYPE_PRECOMPUTE_INIT
8708 | OPTI_TYPE_PRECOMPUTE_MERKLE
8709 | OPTI_TYPE_EARLY_SKIP
8710 | OPTI_TYPE_NOT_ITERATED
8711 | OPTI_TYPE_PREPENDED_SALT
8712 | OPTI_TYPE_RAW_HASH
;
8719 case 8200: hash_type
= HASH_TYPE_SHA256
;
8720 salt_type
= SALT_TYPE_EMBEDDED
;
8721 attack_exec
= ATTACK_EXEC_ON_CPU
;
8722 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8723 kern_type
= KERN_TYPE_CLOUDKEY
;
8724 dgst_size
= DGST_SIZE_4_8
;
8725 parse_func
= cloudkey_parse_hash
;
8726 sort_by_digest
= sort_by_digest_4_8
;
8727 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8734 case 8300: hash_type
= HASH_TYPE_SHA1
;
8735 salt_type
= SALT_TYPE_EMBEDDED
;
8736 attack_exec
= ATTACK_EXEC_ON_GPU
;
8737 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8739 | OPTS_TYPE_ST_ADD80
;
8740 kern_type
= KERN_TYPE_NSEC3
;
8741 dgst_size
= DGST_SIZE_4_5
;
8742 parse_func
= nsec3_parse_hash
;
8743 sort_by_digest
= sort_by_digest_4_5
;
8744 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8751 case 8400: hash_type
= HASH_TYPE_SHA1
;
8752 salt_type
= SALT_TYPE_INTERN
;
8753 attack_exec
= ATTACK_EXEC_ON_GPU
;
8754 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8755 | OPTS_TYPE_PT_ADD80
8756 | OPTS_TYPE_PT_ADDBITS15
;
8757 kern_type
= KERN_TYPE_WBB3
;
8758 dgst_size
= DGST_SIZE_4_5
;
8759 parse_func
= wbb3_parse_hash
;
8760 sort_by_digest
= sort_by_digest_4_5
;
8761 opti_type
= OPTI_TYPE_ZERO_BYTE
8762 | OPTI_TYPE_PRECOMPUTE_INIT
8763 | OPTI_TYPE_NOT_ITERATED
;
8770 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8771 salt_type
= SALT_TYPE_EMBEDDED
;
8772 attack_exec
= ATTACK_EXEC_ON_GPU
;
8773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8774 | OPTS_TYPE_ST_UPPER
;
8775 kern_type
= KERN_TYPE_RACF
;
8776 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8777 parse_func
= racf_parse_hash
;
8778 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8779 opti_type
= OPTI_TYPE_ZERO_BYTE
8780 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8787 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8788 salt_type
= SALT_TYPE_NONE
;
8789 attack_exec
= ATTACK_EXEC_ON_GPU
;
8790 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8791 kern_type
= KERN_TYPE_LOTUS5
;
8792 dgst_size
= DGST_SIZE_4_4
;
8793 parse_func
= lotus5_parse_hash
;
8794 sort_by_digest
= sort_by_digest_4_4
;
8795 opti_type
= OPTI_TYPE_EARLY_SKIP
8796 | OPTI_TYPE_NOT_ITERATED
8797 | OPTI_TYPE_NOT_SALTED
8798 | OPTI_TYPE_RAW_HASH
;
8805 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8806 salt_type
= SALT_TYPE_EMBEDDED
;
8807 attack_exec
= ATTACK_EXEC_ON_GPU
;
8808 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8809 kern_type
= KERN_TYPE_LOTUS6
;
8810 dgst_size
= DGST_SIZE_4_4
;
8811 parse_func
= lotus6_parse_hash
;
8812 sort_by_digest
= sort_by_digest_4_4
;
8813 opti_type
= OPTI_TYPE_EARLY_SKIP
8814 | OPTI_TYPE_NOT_ITERATED
8815 | OPTI_TYPE_RAW_HASH
;
8822 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8823 salt_type
= SALT_TYPE_EMBEDDED
;
8824 attack_exec
= ATTACK_EXEC_ON_CPU
;
8825 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8826 kern_type
= KERN_TYPE_ANDROIDFDE
;
8827 dgst_size
= DGST_SIZE_4_4
;
8828 parse_func
= androidfde_parse_hash
;
8829 sort_by_digest
= sort_by_digest_4_4
;
8830 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8837 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8838 salt_type
= SALT_TYPE_EMBEDDED
;
8839 attack_exec
= ATTACK_EXEC_ON_CPU
;
8840 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8841 kern_type
= KERN_TYPE_SCRYPT
;
8842 dgst_size
= DGST_SIZE_4_8
;
8843 parse_func
= scrypt_parse_hash
;
8844 sort_by_digest
= sort_by_digest_4_8
;
8845 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8852 case 9000: hash_type
= HASH_TYPE_SHA1
;
8853 salt_type
= SALT_TYPE_EMBEDDED
;
8854 attack_exec
= ATTACK_EXEC_ON_CPU
;
8855 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8856 | OPTS_TYPE_ST_GENERATE_LE
;
8857 kern_type
= KERN_TYPE_PSAFE2
;
8858 dgst_size
= DGST_SIZE_4_5
;
8859 parse_func
= psafe2_parse_hash
;
8860 sort_by_digest
= sort_by_digest_4_5
;
8861 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8868 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
8869 salt_type
= SALT_TYPE_EMBEDDED
;
8870 attack_exec
= ATTACK_EXEC_ON_CPU
;
8871 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8872 kern_type
= KERN_TYPE_LOTUS8
;
8873 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8874 parse_func
= lotus8_parse_hash
;
8875 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8876 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8883 case 9200: hash_type
= HASH_TYPE_SHA256
;
8884 salt_type
= SALT_TYPE_EMBEDDED
;
8885 attack_exec
= ATTACK_EXEC_ON_CPU
;
8886 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8887 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
8888 dgst_size
= DGST_SIZE_4_32
;
8889 parse_func
= cisco8_parse_hash
;
8890 sort_by_digest
= sort_by_digest_4_32
;
8891 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8898 case 9300: 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
= cisco9_parse_hash
;
8905 sort_by_digest
= sort_by_digest_4_8
;
8906 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8913 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
8914 salt_type
= SALT_TYPE_EMBEDDED
;
8915 attack_exec
= ATTACK_EXEC_ON_CPU
;
8916 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8917 kern_type
= KERN_TYPE_OFFICE2007
;
8918 dgst_size
= DGST_SIZE_4_4
;
8919 parse_func
= office2007_parse_hash
;
8920 sort_by_digest
= sort_by_digest_4_4
;
8921 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8928 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
8929 salt_type
= SALT_TYPE_EMBEDDED
;
8930 attack_exec
= ATTACK_EXEC_ON_CPU
;
8931 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8932 kern_type
= KERN_TYPE_OFFICE2010
;
8933 dgst_size
= DGST_SIZE_4_4
;
8934 parse_func
= office2010_parse_hash
;
8935 sort_by_digest
= sort_by_digest_4_4
;
8936 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8943 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
8944 salt_type
= SALT_TYPE_EMBEDDED
;
8945 attack_exec
= ATTACK_EXEC_ON_CPU
;
8946 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8947 kern_type
= KERN_TYPE_OFFICE2013
;
8948 dgst_size
= DGST_SIZE_4_4
;
8949 parse_func
= office2013_parse_hash
;
8950 sort_by_digest
= sort_by_digest_4_4
;
8951 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8958 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
8959 salt_type
= SALT_TYPE_EMBEDDED
;
8960 attack_exec
= ATTACK_EXEC_ON_GPU
;
8961 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8962 | OPTS_TYPE_PT_ADD80
8963 | OPTS_TYPE_PT_UNICODE
;
8964 kern_type
= KERN_TYPE_OLDOFFICE01
;
8965 dgst_size
= DGST_SIZE_4_4
;
8966 parse_func
= oldoffice01_parse_hash
;
8967 sort_by_digest
= sort_by_digest_4_4
;
8968 opti_type
= OPTI_TYPE_ZERO_BYTE
8969 | OPTI_TYPE_PRECOMPUTE_INIT
8970 | OPTI_TYPE_NOT_ITERATED
;
8977 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
8978 salt_type
= SALT_TYPE_EMBEDDED
;
8979 attack_exec
= ATTACK_EXEC_ON_GPU
;
8980 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8981 | OPTS_TYPE_PT_ADD80
;
8982 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
8983 dgst_size
= DGST_SIZE_4_4
;
8984 parse_func
= oldoffice01cm1_parse_hash
;
8985 sort_by_digest
= sort_by_digest_4_4
;
8986 opti_type
= OPTI_TYPE_ZERO_BYTE
8987 | OPTI_TYPE_PRECOMPUTE_INIT
8988 | OPTI_TYPE_NOT_ITERATED
;
8995 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
8996 salt_type
= SALT_TYPE_EMBEDDED
;
8997 attack_exec
= ATTACK_EXEC_ON_GPU
;
8998 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8999 | OPTS_TYPE_PT_ADD80
9000 | OPTS_TYPE_PT_UNICODE
9001 | OPTS_TYPE_PT_NEVERCRACK
;
9002 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9003 dgst_size
= DGST_SIZE_4_4
;
9004 parse_func
= oldoffice01cm2_parse_hash
;
9005 sort_by_digest
= sort_by_digest_4_4
;
9006 opti_type
= OPTI_TYPE_ZERO_BYTE
9007 | OPTI_TYPE_PRECOMPUTE_INIT
9008 | OPTI_TYPE_NOT_ITERATED
;
9015 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9016 salt_type
= SALT_TYPE_EMBEDDED
;
9017 attack_exec
= ATTACK_EXEC_ON_GPU
;
9018 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9019 | OPTS_TYPE_PT_ADD80
9020 | OPTS_TYPE_PT_UNICODE
;
9021 kern_type
= KERN_TYPE_OLDOFFICE34
;
9022 dgst_size
= DGST_SIZE_4_4
;
9023 parse_func
= oldoffice34_parse_hash
;
9024 sort_by_digest
= sort_by_digest_4_4
;
9025 opti_type
= OPTI_TYPE_ZERO_BYTE
9026 | OPTI_TYPE_PRECOMPUTE_INIT
9027 | OPTI_TYPE_NOT_ITERATED
;
9034 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9035 salt_type
= SALT_TYPE_EMBEDDED
;
9036 attack_exec
= ATTACK_EXEC_ON_GPU
;
9037 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9038 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9039 dgst_size
= DGST_SIZE_4_4
;
9040 parse_func
= oldoffice34cm1_parse_hash
;
9041 sort_by_digest
= sort_by_digest_4_4
;
9042 opti_type
= OPTI_TYPE_ZERO_BYTE
9043 | OPTI_TYPE_PRECOMPUTE_INIT
9044 | OPTI_TYPE_NOT_ITERATED
;
9051 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9052 salt_type
= SALT_TYPE_EMBEDDED
;
9053 attack_exec
= ATTACK_EXEC_ON_GPU
;
9054 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9055 | OPTS_TYPE_PT_ADD80
9056 | OPTS_TYPE_PT_UNICODE
9057 | OPTS_TYPE_PT_NEVERCRACK
;
9058 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9059 dgst_size
= DGST_SIZE_4_4
;
9060 parse_func
= oldoffice34cm2_parse_hash
;
9061 sort_by_digest
= sort_by_digest_4_4
;
9062 opti_type
= OPTI_TYPE_ZERO_BYTE
9063 | OPTI_TYPE_PRECOMPUTE_INIT
9064 | OPTI_TYPE_NOT_ITERATED
;
9071 case 9900: hash_type
= HASH_TYPE_MD5
;
9072 salt_type
= SALT_TYPE_NONE
;
9073 attack_exec
= ATTACK_EXEC_ON_GPU
;
9074 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9075 kern_type
= KERN_TYPE_RADMIN2
;
9076 dgst_size
= DGST_SIZE_4_4
;
9077 parse_func
= radmin2_parse_hash
;
9078 sort_by_digest
= sort_by_digest_4_4
;
9079 opti_type
= OPTI_TYPE_ZERO_BYTE
9080 | OPTI_TYPE_PRECOMPUTE_INIT
9081 | OPTI_TYPE_EARLY_SKIP
9082 | OPTI_TYPE_NOT_ITERATED
9083 | OPTI_TYPE_NOT_SALTED
;
9090 case 10000: hash_type
= HASH_TYPE_SHA256
;
9091 salt_type
= SALT_TYPE_EMBEDDED
;
9092 attack_exec
= ATTACK_EXEC_ON_CPU
;
9093 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9094 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9095 dgst_size
= DGST_SIZE_4_32
;
9096 parse_func
= djangopbkdf2_parse_hash
;
9097 sort_by_digest
= sort_by_digest_4_32
;
9098 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9105 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9106 salt_type
= SALT_TYPE_EMBEDDED
;
9107 attack_exec
= ATTACK_EXEC_ON_GPU
;
9108 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9109 kern_type
= KERN_TYPE_SIPHASH
;
9110 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9111 parse_func
= siphash_parse_hash
;
9112 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9113 opti_type
= OPTI_TYPE_ZERO_BYTE
9114 | OPTI_TYPE_NOT_ITERATED
9115 | OPTI_TYPE_RAW_HASH
;
9122 case 10200: hash_type
= HASH_TYPE_MD5
;
9123 salt_type
= SALT_TYPE_EMBEDDED
;
9124 attack_exec
= ATTACK_EXEC_ON_GPU
;
9125 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9126 | OPTS_TYPE_ST_ADD80
9127 | OPTS_TYPE_ST_ADDBITS14
;
9128 kern_type
= KERN_TYPE_HMACMD5_PW
;
9129 dgst_size
= DGST_SIZE_4_4
;
9130 parse_func
= crammd5_parse_hash
;
9131 sort_by_digest
= sort_by_digest_4_4
;
9132 opti_type
= OPTI_TYPE_ZERO_BYTE
9133 | OPTI_TYPE_NOT_ITERATED
;
9140 case 10300: hash_type
= HASH_TYPE_SHA1
;
9141 salt_type
= SALT_TYPE_EMBEDDED
;
9142 attack_exec
= ATTACK_EXEC_ON_CPU
;
9143 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9144 kern_type
= KERN_TYPE_SAPH_SHA1
;
9145 dgst_size
= DGST_SIZE_4_5
;
9146 parse_func
= saph_sha1_parse_hash
;
9147 sort_by_digest
= sort_by_digest_4_5
;
9148 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9155 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9156 salt_type
= SALT_TYPE_EMBEDDED
;
9157 attack_exec
= ATTACK_EXEC_ON_GPU
;
9158 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9159 kern_type
= KERN_TYPE_PDF11
;
9160 dgst_size
= DGST_SIZE_4_4
;
9161 parse_func
= pdf11_parse_hash
;
9162 sort_by_digest
= sort_by_digest_4_4
;
9163 opti_type
= OPTI_TYPE_ZERO_BYTE
9164 | OPTI_TYPE_NOT_ITERATED
;
9171 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9172 salt_type
= SALT_TYPE_EMBEDDED
;
9173 attack_exec
= ATTACK_EXEC_ON_GPU
;
9174 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9175 kern_type
= KERN_TYPE_PDF11CM1
;
9176 dgst_size
= DGST_SIZE_4_4
;
9177 parse_func
= pdf11cm1_parse_hash
;
9178 sort_by_digest
= sort_by_digest_4_4
;
9179 opti_type
= OPTI_TYPE_ZERO_BYTE
9180 | OPTI_TYPE_NOT_ITERATED
;
9187 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9188 salt_type
= SALT_TYPE_EMBEDDED
;
9189 attack_exec
= ATTACK_EXEC_ON_GPU
;
9190 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9191 kern_type
= KERN_TYPE_PDF11CM2
;
9192 dgst_size
= DGST_SIZE_4_4
;
9193 parse_func
= pdf11cm2_parse_hash
;
9194 sort_by_digest
= sort_by_digest_4_4
;
9195 opti_type
= OPTI_TYPE_ZERO_BYTE
9196 | OPTI_TYPE_NOT_ITERATED
;
9203 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9204 salt_type
= SALT_TYPE_EMBEDDED
;
9205 attack_exec
= ATTACK_EXEC_ON_CPU
;
9206 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9207 kern_type
= KERN_TYPE_PDF14
;
9208 dgst_size
= DGST_SIZE_4_4
;
9209 parse_func
= pdf14_parse_hash
;
9210 sort_by_digest
= sort_by_digest_4_4
;
9211 opti_type
= OPTI_TYPE_ZERO_BYTE
9212 | OPTI_TYPE_NOT_ITERATED
;
9219 case 10600: hash_type
= HASH_TYPE_SHA256
;
9220 salt_type
= SALT_TYPE_EMBEDDED
;
9221 attack_exec
= ATTACK_EXEC_ON_GPU
;
9222 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9223 | OPTS_TYPE_ST_ADD80
9224 | OPTS_TYPE_ST_ADDBITS15
9225 | OPTS_TYPE_HASH_COPY
;
9226 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9227 dgst_size
= DGST_SIZE_4_8
;
9228 parse_func
= pdf17l3_parse_hash
;
9229 sort_by_digest
= sort_by_digest_4_8
;
9230 opti_type
= OPTI_TYPE_ZERO_BYTE
9231 | OPTI_TYPE_PRECOMPUTE_INIT
9232 | OPTI_TYPE_PRECOMPUTE_MERKLE
9233 | OPTI_TYPE_EARLY_SKIP
9234 | OPTI_TYPE_NOT_ITERATED
9235 | OPTI_TYPE_APPENDED_SALT
9236 | OPTI_TYPE_RAW_HASH
;
9243 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9244 salt_type
= SALT_TYPE_EMBEDDED
;
9245 attack_exec
= ATTACK_EXEC_ON_CPU
;
9246 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9247 | OPTS_TYPE_HASH_COPY
;
9248 kern_type
= KERN_TYPE_PDF17L8
;
9249 dgst_size
= DGST_SIZE_4_8
;
9250 parse_func
= pdf17l8_parse_hash
;
9251 sort_by_digest
= sort_by_digest_4_8
;
9252 opti_type
= OPTI_TYPE_ZERO_BYTE
9253 | OPTI_TYPE_NOT_ITERATED
;
9260 case 10800: hash_type
= HASH_TYPE_SHA384
;
9261 salt_type
= SALT_TYPE_NONE
;
9262 attack_exec
= ATTACK_EXEC_ON_GPU
;
9263 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9264 | OPTS_TYPE_PT_ADD80
9265 | OPTS_TYPE_PT_ADDBITS15
;
9266 kern_type
= KERN_TYPE_SHA384
;
9267 dgst_size
= DGST_SIZE_8_8
;
9268 parse_func
= sha384_parse_hash
;
9269 sort_by_digest
= sort_by_digest_8_8
;
9270 opti_type
= OPTI_TYPE_ZERO_BYTE
9271 | OPTI_TYPE_PRECOMPUTE_INIT
9272 | OPTI_TYPE_PRECOMPUTE_MERKLE
9273 | OPTI_TYPE_EARLY_SKIP
9274 | OPTI_TYPE_NOT_ITERATED
9275 | OPTI_TYPE_NOT_SALTED
9276 | OPTI_TYPE_RAW_HASH
;
9283 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9284 salt_type
= SALT_TYPE_EMBEDDED
;
9285 attack_exec
= ATTACK_EXEC_ON_CPU
;
9286 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9287 | OPTS_TYPE_ST_BASE64
9288 | OPTS_TYPE_HASH_COPY
;
9289 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9290 dgst_size
= DGST_SIZE_4_32
;
9291 parse_func
= pbkdf2_sha256_parse_hash
;
9292 sort_by_digest
= sort_by_digest_4_32
;
9293 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9300 case 11000: hash_type
= HASH_TYPE_MD5
;
9301 salt_type
= SALT_TYPE_INTERN
;
9302 attack_exec
= ATTACK_EXEC_ON_GPU
;
9303 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9304 | OPTS_TYPE_PT_ADD80
;
9305 kern_type
= KERN_TYPE_PRESTASHOP
;
9306 dgst_size
= DGST_SIZE_4_4
;
9307 parse_func
= prestashop_parse_hash
;
9308 sort_by_digest
= sort_by_digest_4_4
;
9309 opti_type
= OPTI_TYPE_ZERO_BYTE
9310 | OPTI_TYPE_PRECOMPUTE_INIT
9311 | OPTI_TYPE_NOT_ITERATED
9312 | OPTI_TYPE_PREPENDED_SALT
;
9319 case 11100: hash_type
= HASH_TYPE_MD5
;
9320 salt_type
= SALT_TYPE_EMBEDDED
;
9321 attack_exec
= ATTACK_EXEC_ON_GPU
;
9322 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9323 | OPTS_TYPE_ST_ADD80
;
9324 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9325 dgst_size
= DGST_SIZE_4_4
;
9326 parse_func
= postgresql_auth_parse_hash
;
9327 sort_by_digest
= sort_by_digest_4_4
;
9328 opti_type
= OPTI_TYPE_ZERO_BYTE
9329 | OPTI_TYPE_PRECOMPUTE_INIT
9330 | OPTI_TYPE_PRECOMPUTE_MERKLE
9331 | OPTI_TYPE_EARLY_SKIP
;
9338 case 11200: hash_type
= HASH_TYPE_SHA1
;
9339 salt_type
= SALT_TYPE_EMBEDDED
;
9340 attack_exec
= ATTACK_EXEC_ON_GPU
;
9341 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9342 | OPTS_TYPE_PT_ADD80
9344 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9345 dgst_size
= DGST_SIZE_4_5
;
9346 parse_func
= mysql_auth_parse_hash
;
9347 sort_by_digest
= sort_by_digest_4_5
;
9348 opti_type
= OPTI_TYPE_ZERO_BYTE
9349 | OPTI_TYPE_EARLY_SKIP
;
9356 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9357 salt_type
= SALT_TYPE_EMBEDDED
;
9358 attack_exec
= ATTACK_EXEC_ON_CPU
;
9359 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9361 | OPTS_TYPE_ST_ADD80
;
9362 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9363 dgst_size
= DGST_SIZE_4_4
;
9364 parse_func
= bitcoin_wallet_parse_hash
;
9365 sort_by_digest
= sort_by_digest_4_4
;
9366 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9373 case 11400: hash_type
= HASH_TYPE_MD5
;
9374 salt_type
= SALT_TYPE_EMBEDDED
;
9375 attack_exec
= ATTACK_EXEC_ON_GPU
;
9376 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9377 | OPTS_TYPE_PT_ADD80
9378 | OPTS_TYPE_HASH_COPY
;
9379 kern_type
= KERN_TYPE_SIP_AUTH
;
9380 dgst_size
= DGST_SIZE_4_4
;
9381 parse_func
= sip_auth_parse_hash
;
9382 sort_by_digest
= sort_by_digest_4_4
;
9383 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9390 case 11500: hash_type
= HASH_TYPE_CRC32
;
9391 salt_type
= SALT_TYPE_INTERN
;
9392 attack_exec
= ATTACK_EXEC_ON_GPU
;
9393 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9394 | OPTS_TYPE_ST_GENERATE_LE
9396 kern_type
= KERN_TYPE_CRC32
;
9397 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9398 parse_func
= crc32_parse_hash
;
9399 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9400 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9407 case 11600: hash_type
= HASH_TYPE_AES
;
9408 salt_type
= SALT_TYPE_EMBEDDED
;
9409 attack_exec
= ATTACK_EXEC_ON_CPU
;
9410 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9411 | OPTS_TYPE_PT_NEVERCRACK
;
9412 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9413 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9414 parse_func
= seven_zip_parse_hash
;
9415 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9416 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9423 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9424 salt_type
= SALT_TYPE_NONE
;
9425 attack_exec
= ATTACK_EXEC_ON_GPU
;
9426 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9427 | OPTS_TYPE_PT_ADD01
;
9428 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9429 dgst_size
= DGST_SIZE_4_8
;
9430 parse_func
= gost2012sbog_256_parse_hash
;
9431 sort_by_digest
= sort_by_digest_4_8
;
9432 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9439 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9440 salt_type
= SALT_TYPE_NONE
;
9441 attack_exec
= ATTACK_EXEC_ON_GPU
;
9442 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9443 | OPTS_TYPE_PT_ADD01
;
9444 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9445 dgst_size
= DGST_SIZE_4_16
;
9446 parse_func
= gost2012sbog_512_parse_hash
;
9447 sort_by_digest
= sort_by_digest_4_16
;
9448 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9455 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9456 salt_type
= SALT_TYPE_EMBEDDED
;
9457 attack_exec
= ATTACK_EXEC_ON_CPU
;
9458 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9459 | OPTS_TYPE_ST_BASE64
9460 | OPTS_TYPE_HASH_COPY
;
9461 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9462 dgst_size
= DGST_SIZE_4_32
;
9463 parse_func
= pbkdf2_md5_parse_hash
;
9464 sort_by_digest
= sort_by_digest_4_32
;
9465 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9472 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9473 salt_type
= SALT_TYPE_EMBEDDED
;
9474 attack_exec
= ATTACK_EXEC_ON_CPU
;
9475 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9476 | OPTS_TYPE_ST_BASE64
9477 | OPTS_TYPE_HASH_COPY
;
9478 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9479 dgst_size
= DGST_SIZE_4_32
;
9480 parse_func
= pbkdf2_sha1_parse_hash
;
9481 sort_by_digest
= sort_by_digest_4_32
;
9482 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9489 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9490 salt_type
= SALT_TYPE_EMBEDDED
;
9491 attack_exec
= ATTACK_EXEC_ON_CPU
;
9492 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9493 | OPTS_TYPE_ST_BASE64
9494 | OPTS_TYPE_HASH_COPY
;
9495 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9496 dgst_size
= DGST_SIZE_8_16
;
9497 parse_func
= pbkdf2_sha512_parse_hash
;
9498 sort_by_digest
= sort_by_digest_8_16
;
9499 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9506 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9507 salt_type
= SALT_TYPE_EMBEDDED
;
9508 attack_exec
= ATTACK_EXEC_ON_CPU
;
9509 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9510 kern_type
= KERN_TYPE_ECRYPTFS
;
9511 dgst_size
= DGST_SIZE_8_8
;
9512 parse_func
= ecryptfs_parse_hash
;
9513 sort_by_digest
= sort_by_digest_8_8
;
9514 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9521 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9522 salt_type
= SALT_TYPE_EMBEDDED
;
9523 attack_exec
= ATTACK_EXEC_ON_CPU
;
9524 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9525 kern_type
= KERN_TYPE_ORACLET
;
9526 dgst_size
= DGST_SIZE_8_16
;
9527 parse_func
= oraclet_parse_hash
;
9528 sort_by_digest
= sort_by_digest_8_16
;
9529 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9536 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9537 salt_type
= SALT_TYPE_EMBEDDED
;
9538 attack_exec
= ATTACK_EXEC_ON_CPU
;
9539 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9540 kern_type
= KERN_TYPE_BSDICRYPT
;
9541 dgst_size
= DGST_SIZE_4_4
;
9542 parse_func
= bsdicrypt_parse_hash
;
9543 sort_by_digest
= sort_by_digest_4_4
;
9544 opti_type
= OPTI_TYPE_ZERO_BYTE
9545 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9552 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9553 salt_type
= SALT_TYPE_EMBEDDED
;
9554 attack_exec
= ATTACK_EXEC_ON_CPU
;
9555 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9556 kern_type
= KERN_TYPE_RAR3
;
9557 dgst_size
= DGST_SIZE_4_4
;
9558 parse_func
= rar3hp_parse_hash
;
9559 sort_by_digest
= sort_by_digest_4_4
;
9560 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9567 case 12600: hash_type
= HASH_TYPE_SHA256
;
9568 salt_type
= SALT_TYPE_INTERN
;
9569 attack_exec
= ATTACK_EXEC_ON_GPU
;
9570 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9571 | OPTS_TYPE_PT_ADD80
;
9572 kern_type
= KERN_TYPE_CF10
;
9573 dgst_size
= DGST_SIZE_4_8
;
9574 parse_func
= cf10_parse_hash
;
9575 sort_by_digest
= sort_by_digest_4_8
;
9576 opti_type
= OPTI_TYPE_ZERO_BYTE
9577 | OPTI_TYPE_PRECOMPUTE_INIT
9578 | OPTI_TYPE_EARLY_SKIP
9579 | OPTI_TYPE_NOT_ITERATED
;
9586 case 12700: hash_type
= HASH_TYPE_AES
;
9587 salt_type
= SALT_TYPE_EMBEDDED
;
9588 attack_exec
= ATTACK_EXEC_ON_CPU
;
9589 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9590 | OPTS_TYPE_HASH_COPY
;
9591 kern_type
= KERN_TYPE_MYWALLET
;
9592 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9593 parse_func
= mywallet_parse_hash
;
9594 sort_by_digest
= sort_by_digest_4_5
;
9595 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9602 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9603 salt_type
= SALT_TYPE_EMBEDDED
;
9604 attack_exec
= ATTACK_EXEC_ON_CPU
;
9605 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9606 kern_type
= KERN_TYPE_MS_DRSR
;
9607 dgst_size
= DGST_SIZE_4_8
;
9608 parse_func
= ms_drsr_parse_hash
;
9609 sort_by_digest
= sort_by_digest_4_8
;
9610 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9617 default: usage_mini_print (PROGNAME
); return (-1);
9624 data
.parse_func
= parse_func
;
9632 if (salt_type
== SALT_TYPE_INTERN
)
9634 opts_type
|= OPTS_TYPE_ST_HEX
;
9638 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9644 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9645 | (salt_type
== SALT_TYPE_EXTERN
)
9646 | (salt_type
== SALT_TYPE_EMBEDDED
)
9647 | (salt_type
== SALT_TYPE_VIRTUAL
));
9649 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9651 data
.hash_type
= hash_type
;
9652 data
.attack_mode
= attack_mode
;
9653 data
.attack_kern
= attack_kern
;
9654 data
.attack_exec
= attack_exec
;
9655 data
.kern_type
= kern_type
;
9656 data
.opts_type
= opts_type
;
9657 data
.dgst_size
= dgst_size
;
9658 data
.salt_type
= salt_type
;
9659 data
.isSalted
= isSalted
;
9660 data
.sort_by_digest
= sort_by_digest
;
9661 data
.dgst_pos0
= dgst_pos0
;
9662 data
.dgst_pos1
= dgst_pos1
;
9663 data
.dgst_pos2
= dgst_pos2
;
9664 data
.dgst_pos3
= dgst_pos3
;
9670 case 2500: esalt_size
= sizeof (wpa_t
); break;
9671 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9672 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9673 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9674 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9686 case 6243: esalt_size
= sizeof (tc_t
); break;
9687 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9688 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9689 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9690 case 7300: esalt_size
= sizeof (rakp_t
); break;
9691 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9692 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9693 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9694 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9695 case 9400: esalt_size
= sizeof (office2007_t
); break;
9696 case 9500: esalt_size
= sizeof (office2010_t
); break;
9697 case 9600: esalt_size
= sizeof (office2013_t
); break;
9698 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9699 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9700 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9701 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9702 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9703 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9704 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9705 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9706 case 10400: esalt_size
= sizeof (pdf_t
); break;
9707 case 10410: esalt_size
= sizeof (pdf_t
); break;
9708 case 10420: esalt_size
= sizeof (pdf_t
); break;
9709 case 10500: esalt_size
= sizeof (pdf_t
); break;
9710 case 10600: esalt_size
= sizeof (pdf_t
); break;
9711 case 10700: esalt_size
= sizeof (pdf_t
); break;
9712 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9713 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9714 case 11400: esalt_size
= sizeof (sip_t
); break;
9715 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9716 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9717 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9718 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9721 data
.esalt_size
= esalt_size
;
9724 * choose dictionary parser
9727 if (hash_type
== HASH_TYPE_LM
)
9729 get_next_word_func
= get_next_word_lm
;
9731 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9733 get_next_word_func
= get_next_word_uc
;
9737 get_next_word_func
= get_next_word_std
;
9744 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9747 size_t dictstat_nmemb
= 0;
9751 uint dictstat_nmemb
= 0;
9756 FILE *dictstat_fp
= NULL
;
9760 memset (dictstat
, 0, sizeof (dictstat
));
9762 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9764 dictstat_fp
= fopen (dictstat
, "rb");
9769 struct stat tmpstat
;
9771 fstat (fileno (dictstat_fp
), &tmpstat
);
9775 struct stat64 tmpstat
;
9777 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9780 if (tmpstat
.st_mtime
< COMPTIME
)
9782 /* with v0.15 the format changed so we have to ensure user is using a good version
9783 since there is no version-header in the dictstat file */
9785 fclose (dictstat_fp
);
9791 while (!feof (dictstat_fp
))
9795 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9797 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9799 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9801 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9807 fclose (dictstat_fp
);
9818 memset (potfile
, 0, sizeof (potfile
));
9820 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9824 FILE *out_fp
= NULL
;
9825 FILE *pot_fp
= NULL
;
9827 if (show
== 1 || left
== 1)
9829 pot_fp
= fopen (potfile
, "rb");
9833 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9838 if (outfile
!= NULL
)
9840 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9842 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
9856 if (potfile_disable
== 0)
9858 pot_fp
= fopen (potfile
, "ab");
9862 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9867 data
.pot_fp
= pot_fp
;
9876 if (show
== 1 || left
== 1)
9878 SUPPRESS_OUTPUT
= 1;
9880 pot_avail
= count_lines (pot_fp
);
9884 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
9886 uint pot_hashes_avail
= 0;
9890 while (!feof (pot_fp
))
9894 char line_buf
[BUFSIZ
];
9896 int line_len
= fgetl (pot_fp
, line_buf
);
9898 if (line_len
== 0) continue;
9900 char *plain_buf
= line_buf
+ line_len
;
9902 pot_t
*pot_ptr
= &pot
[pot_cnt
];
9904 hash_t
*hashes_buf
= &pot_ptr
->hash
;
9906 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
9907 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
9909 if (pot_cnt
== pot_hashes_avail
)
9913 for (pos
= 0; pos
< INCR_POT
; pos
++)
9915 if ((pot_cnt
+ pos
) >= pot_avail
) break;
9917 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
9919 hash_t
*tmp_hash
= &tmp_pot
->hash
;
9921 tmp_hash
->digest
= mymalloc (dgst_size
);
9925 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
9930 tmp_hash
->esalt
= mymalloc (esalt_size
);
9941 int iter
= MAX_CUT_TRIES
;
9945 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
9947 if (line_buf
[i
] == ':')
9955 if (data
.hash_mode
!= 2500)
9957 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
9961 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
9963 if (line_len
> max_salt_size
)
9965 parser_status
= PARSER_GLOBAL_LENGTH
;
9969 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
9971 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
9973 hashes_buf
->salt
->salt_len
= line_len
;
9975 parser_status
= PARSER_OK
;
9979 // if NOT parsed without error, we add the ":" to the plain
9981 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
9987 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
9989 if (parser_status
< PARSER_GLOBAL_ZERO
)
9991 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
9996 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
9998 pot_ptr
->plain_len
= plain_len
;
10005 SUPPRESS_OUTPUT
= 0;
10007 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10011 * gpu accel and loops auto adjustment
10014 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10015 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10017 if (workload_profile
== 1)
10022 if (gpu_loops
== 0) gpu_loops
= 8;
10023 if (gpu_accel
== 0) gpu_accel
= 2;
10025 else if (workload_profile
== 3)
10030 if (gpu_loops
> 1024) gpu_loops
= 1024;
10031 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10034 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10036 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10041 if (hash_mode
== 12500)
10043 gpu_loops
= ROUNDS_RAR3
/ 16;
10046 data
.gpu_accel
= gpu_accel
;
10047 data
.gpu_loops
= gpu_loops
;
10053 uint pw_min
= PW_MIN
;
10054 uint pw_max
= PW_MAX
;
10058 case 400: if (pw_max
> 40) pw_max
= 40;
10060 case 500: if (pw_max
> 16) pw_max
= 16;
10062 case 1500: if (pw_max
> 8) pw_max
= 8;
10064 case 1600: if (pw_max
> 16) pw_max
= 16;
10066 case 1800: if (pw_max
> 16) pw_max
= 16;
10068 case 2100: if (pw_max
> 16) pw_max
= 16;
10070 case 2500: if (pw_min
< 8) pw_min
= 8;
10072 case 3000: if (pw_max
> 7) pw_max
= 7;
10074 case 5200: if (pw_max
> 24) pw_max
= 24;
10076 case 5800: if (pw_max
> 16) pw_max
= 16;
10078 case 6300: if (pw_max
> 16) pw_max
= 16;
10080 case 7400: if (pw_max
> 16) pw_max
= 16;
10082 case 7900: if (pw_max
> 48) pw_max
= 48;
10084 case 8500: if (pw_max
> 8) pw_max
= 8;
10086 case 8600: if (pw_max
> 16) pw_max
= 16;
10088 case 9710: pw_min
= 5;
10091 case 9810: pw_min
= 5;
10094 case 10410: pw_min
= 5;
10097 case 10300: if (pw_max
< 3) pw_min
= 3;
10098 if (pw_max
> 40) pw_max
= 40;
10100 case 10500: if (pw_max
< 3) pw_min
= 3;
10101 if (pw_max
> 40) pw_max
= 40;
10103 case 10700: if (pw_max
> 16) pw_max
= 16;
10105 case 11300: if (pw_max
> 40) pw_max
= 40;
10107 case 12500: if (pw_max
> 20) pw_max
= 20;
10109 case 12800: if (pw_max
> 24) pw_max
= 24;
10113 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10115 switch (attack_kern
)
10117 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10119 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10125 * charsets : keep them together for more easy maintainnce
10131 memset (mp_sys
, 0, sizeof (mp_sys
));
10132 memset (mp_usr
, 0, sizeof (mp_usr
));
10134 mp_setup_sys (mp_sys
);
10136 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10137 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10138 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10139 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10142 * load hashes, part I: find input mode, count hashes
10145 uint hashlist_mode
= 0;
10146 uint hashlist_format
= HLFMT_HASHCAT
;
10148 uint hashes_avail
= 0;
10150 if (benchmark
== 0)
10154 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10156 if ((hash_mode
== 2500) ||
10157 (hash_mode
== 5200) ||
10158 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10159 (hash_mode
== 9000))
10161 hashlist_mode
= HL_MODE_ARG
;
10163 char *hashfile
= myargv
[optind
];
10165 data
.hashfile
= hashfile
;
10167 logfile_top_var_string ("target", hashfile
);
10170 if (hashlist_mode
== HL_MODE_ARG
)
10172 if (hash_mode
== 2500)
10176 if (stat (data
.hashfile
, &st
) == -1)
10178 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10183 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10190 else if (hashlist_mode
== HL_MODE_FILE
)
10192 char *hashfile
= myargv
[optind
];
10194 data
.hashfile
= hashfile
;
10196 logfile_top_var_string ("target", hashfile
);
10200 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10202 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10207 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10209 hashes_avail
= count_lines (fp
);
10213 if (hashes_avail
== 0)
10215 log_error ("ERROR: hashfile is empty or corrupt");
10222 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10224 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10226 log_error ("ERROR: remove not supported in native hashfile-format mode");
10238 hashlist_mode
= HL_MODE_ARG
;
10243 if (hash_mode
== 3000) hashes_avail
*= 2;
10245 data
.hashlist_mode
= hashlist_mode
;
10246 data
.hashlist_format
= hashlist_format
;
10248 logfile_top_uint (hashlist_mode
);
10249 logfile_top_uint (hashlist_format
);
10252 * load hashes, part II: allocate required memory, set pointers
10255 hash_t
*hashes_buf
= NULL
;
10256 void *digests_buf
= NULL
;
10257 salt_t
*salts_buf
= NULL
;
10258 void *esalts_buf
= NULL
;
10260 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10262 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10264 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10268 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10270 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10272 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10274 if (username
&& (remove
|| show
|| left
))
10276 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10281 hash_info
->orighash
= (char *) mymalloc (256);
10288 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10292 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10297 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10300 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10302 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10306 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10310 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10315 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10320 * load hashes, part III: parse hashes or generate them if benchmark
10323 uint hashes_cnt
= 0;
10325 if (benchmark
== 0)
10329 // useless to read hash file for keyspace, cheat a little bit w/ optind
10331 else if (hashes_avail
== 0)
10334 else if (hashlist_mode
== HL_MODE_ARG
)
10336 char *input_buf
= myargv
[optind
];
10338 uint input_len
= strlen (input_buf
);
10340 logfile_top_var_string ("target", input_buf
);
10342 char *hash_buf
= NULL
;
10345 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10349 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10351 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10353 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10358 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10361 int parser_status
= PARSER_OK
;
10363 if (hash_mode
== 2500)
10367 log_error ("ERROR: hccap file not specified");
10372 hashlist_mode
= HL_MODE_FILE
;
10374 data
.hashlist_mode
= hashlist_mode
;
10376 FILE *fp
= fopen (hash_buf
, "rb");
10380 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10385 if (hashes_avail
< 1)
10387 log_error ("ERROR: hccap file is empty or corrupt");
10394 uint hccap_size
= sizeof (hccap_t
);
10396 char in
[hccap_size
];
10400 int n
= fread (&in
, hccap_size
, 1, fp
);
10404 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10409 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10411 if (parser_status
!= PARSER_OK
)
10413 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10418 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10420 if ((show
== 1) || (left
== 1))
10422 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10424 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10426 int cur_pos
= tmp_salt
->salt_len
;
10427 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10429 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10431 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10433 // do the appending task
10435 snprintf (salt_ptr
+ cur_pos
,
10437 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10438 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10439 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10442 // memset () the remaining part of the salt
10444 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10445 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10447 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10449 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10452 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
);
10453 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
);
10460 else if (hash_mode
== 3000)
10462 if (hash_len
== 32)
10464 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10466 hash_t
*lm_hash_left
= NULL
;
10468 if (parser_status
== PARSER_OK
)
10470 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10476 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10480 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10482 hash_t
*lm_hash_right
= NULL
;
10484 if (parser_status
== PARSER_OK
)
10486 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10492 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10497 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10499 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
);
10500 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
);
10505 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10507 if (parser_status
== PARSER_OK
)
10509 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10510 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10513 if (parser_status
== PARSER_OK
)
10519 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10525 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10527 if (parser_status
== PARSER_OK
)
10529 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10530 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10533 if (parser_status
== PARSER_OK
)
10539 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10544 else if (hashlist_mode
== HL_MODE_FILE
)
10546 char *hashfile
= data
.hashfile
;
10550 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10552 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10563 char line_buf
[BUFSIZ
];
10565 int line_len
= fgetl (fp
, line_buf
);
10567 if (line_len
== 0) continue;
10569 char *hash_buf
= NULL
;
10572 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10576 char *user_buf
= NULL
;
10579 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10581 if (remove
|| show
)
10583 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10585 *user
= (user_t
*) malloc (sizeof (user_t
));
10587 user_t
*user_ptr
= *user
;
10589 if (user_buf
!= NULL
)
10591 user_ptr
->user_name
= mystrdup (user_buf
);
10595 user_ptr
->user_name
= mystrdup ("");
10598 user_ptr
->user_len
= user_len
;
10602 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10604 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10606 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10611 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10614 if (hash_mode
== 3000)
10616 if (hash_len
== 32)
10618 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10620 if (parser_status
< PARSER_GLOBAL_ZERO
)
10622 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10627 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10631 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10633 if (parser_status
< PARSER_GLOBAL_ZERO
)
10635 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10640 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10642 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);
10648 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
);
10649 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
);
10653 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10655 if (parser_status
< PARSER_GLOBAL_ZERO
)
10657 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10662 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);
10664 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10665 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10672 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10674 if (parser_status
< PARSER_GLOBAL_ZERO
)
10676 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10681 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);
10683 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10684 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10692 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10694 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10701 hashes_buf
[0].salt
->salt_len
= 8;
10703 // special salt handling
10707 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10709 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10711 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10713 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10715 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10717 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10719 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10721 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10723 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10725 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10727 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10728 hashes_buf
[0].salt
->scrypt_N
= 1024;
10729 hashes_buf
[0].salt
->scrypt_r
= 1;
10730 hashes_buf
[0].salt
->scrypt_p
= 1;
10732 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10734 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10735 hashes_buf
[0].salt
->scrypt_N
= 16384;
10736 hashes_buf
[0].salt
->scrypt_r
= 1;
10737 hashes_buf
[0].salt
->scrypt_p
= 1;
10739 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10741 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10743 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10745 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10747 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10749 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10751 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10753 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10755 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10757 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10759 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10761 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10763 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10765 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10767 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10771 // special esalt handling
10775 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10777 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10778 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10780 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10781 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10783 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10784 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10785 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10786 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10788 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10789 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10790 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10791 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10793 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10795 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10796 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10797 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10799 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10800 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10801 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10803 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10804 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10805 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10807 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10808 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10809 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10811 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10812 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10813 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10815 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10816 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10817 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10819 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10820 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10821 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10830 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10832 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10834 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10847 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10849 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10851 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10853 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
10857 // set default iterations
10861 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
10863 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10865 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10867 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10869 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
10871 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
10873 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
10875 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
10877 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
10879 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
10883 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
10887 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10891 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10895 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10897 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10899 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
10901 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
10903 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
10905 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
10907 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
10909 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
10911 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
10913 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
10915 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
10917 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
10919 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
10921 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
10923 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
10925 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
10927 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
10929 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
10931 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
10933 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
10935 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
10937 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
10939 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
10941 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
10943 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
10945 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
10947 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
10949 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
10951 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
10953 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
10955 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
10957 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
10959 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
10961 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
10963 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
10965 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
10967 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
10969 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
10973 // set special tuning for benchmark-mode 1
10975 if (benchmark_mode
== 1)
10982 case 400: gpu_loops
= ROUNDS_PHPASS
;
10985 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
10988 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
10991 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
10994 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
10997 case 2100: gpu_loops
= ROUNDS_DCC2
;
11000 case 2500: gpu_loops
= ROUNDS_WPA2
;
11003 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11006 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11009 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11012 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11015 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11018 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11021 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11024 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11027 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11030 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11033 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11036 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11039 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11042 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11045 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11048 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11051 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11054 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11057 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11060 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11063 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11066 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11069 case 7200: gpu_loops
= ROUNDS_GRUB
;
11072 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11075 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11078 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11081 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11084 case 8900: gpu_loops
= 1;
11087 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11090 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11093 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11096 case 9300: gpu_loops
= 1;
11099 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11102 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11105 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11108 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11111 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11114 case 10500: gpu_loops
= ROUNDS_PDF14
;
11117 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11120 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11123 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11126 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11129 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11132 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11135 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11138 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11141 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11144 case 12500: gpu_loops
= ROUNDS_RAR3
;
11147 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11150 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11155 // some algorithm collide too fast, make that impossible
11159 case 11500: ((uint
*) digests_buf
)[1] = 1;
11163 if (gpu_loops
> 1024) gpu_loops
= 1024;
11164 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11167 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11172 if (hash_mode
== 12500)
11174 gpu_loops
= ROUNDS_RAR3
/ 16;
11177 data
.gpu_accel
= gpu_accel
;
11178 data
.gpu_loops
= gpu_loops
;
11183 if (show
== 1 || left
== 1)
11185 for (uint i
= 0; i
< pot_cnt
; i
++)
11187 pot_t
*pot_ptr
= &pot
[i
];
11189 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11191 local_free (hashes_buf
->digest
);
11195 local_free (hashes_buf
->salt
);
11201 if (data
.quiet
== 0) log_info_nn ("");
11208 if (hashes_cnt
== 0)
11210 log_error ("ERROR: No hashes loaded");
11217 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11220 if (data
.outfile
!= NULL
)
11222 if (data
.hashfile
!= NULL
)
11225 struct stat tmpstat_outfile
;
11226 struct stat tmpstat_hashfile
;
11230 struct stat64 tmpstat_outfile
;
11231 struct stat64 tmpstat_hashfile
;
11234 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11236 if (tmp_outfile_fp
)
11239 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11243 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11246 fclose (tmp_outfile_fp
);
11249 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11251 if (tmp_hashfile_fp
)
11254 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11258 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11261 fclose (tmp_hashfile_fp
);
11264 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11266 tmpstat_outfile
.st_mode
= 0;
11267 tmpstat_outfile
.st_nlink
= 0;
11268 tmpstat_outfile
.st_uid
= 0;
11269 tmpstat_outfile
.st_gid
= 0;
11270 tmpstat_outfile
.st_rdev
= 0;
11271 tmpstat_outfile
.st_atime
= 0;
11273 tmpstat_hashfile
.st_mode
= 0;
11274 tmpstat_hashfile
.st_nlink
= 0;
11275 tmpstat_hashfile
.st_uid
= 0;
11276 tmpstat_hashfile
.st_gid
= 0;
11277 tmpstat_hashfile
.st_rdev
= 0;
11278 tmpstat_hashfile
.st_atime
= 0;
11281 tmpstat_outfile
.st_blksize
= 0;
11282 tmpstat_outfile
.st_blocks
= 0;
11284 tmpstat_hashfile
.st_blksize
= 0;
11285 tmpstat_hashfile
.st_blocks
= 0;
11289 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11291 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11298 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11300 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11310 * Remove duplicates
11313 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11317 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11321 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11324 uint hashes_cnt_orig
= hashes_cnt
;
11328 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11332 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11334 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11339 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11342 if (hashes_pos
> hashes_cnt
)
11344 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11354 uint potfile_remove_cracks
= 0;
11356 if (potfile_disable
== 0)
11360 hash_buf
.digest
= mymalloc (dgst_size
);
11361 hash_buf
.salt
= NULL
;
11362 hash_buf
.esalt
= NULL
;
11363 hash_buf
.hash_info
= NULL
;
11364 hash_buf
.cracked
= 0;
11368 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11373 hash_buf
.esalt
= mymalloc (esalt_size
);
11376 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11378 // no solution for these special hash types (for instane because they use hashfile in output etc)
11379 if ((hash_mode
!= 5200) &&
11380 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11381 (hash_mode
!= 9000))
11383 FILE *fp
= fopen (potfile
, "rb");
11389 char line_buf
[BUFSIZ
];
11391 memset (line_buf
, 0, BUFSIZ
);
11393 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11395 if (ptr
== NULL
) break;
11397 int line_len
= strlen (line_buf
);
11399 if (line_len
== 0) continue;
11401 int iter
= MAX_CUT_TRIES
;
11403 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11405 if (line_buf
[i
] != ':') continue;
11409 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11412 hash_t
*found
= NULL
;
11414 if (hash_mode
== 6800)
11416 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11418 // manipulate salt_buf
11419 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11421 hash_buf
.salt
->salt_len
= i
;
11423 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11426 else if (hash_mode
== 2500)
11428 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11430 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11431 // manipulate salt_buf
11433 // to be safe work with a copy (because of line_len loop, i etc)
11435 char line_buf_cpy
[BUFSIZ
];
11436 memset (line_buf_cpy
, 0, BUFSIZ
);
11438 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11440 memcpy (line_buf_cpy
, line_buf
, i
);
11442 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11444 if (mac2_pos
== NULL
) continue;
11449 if (strlen (mac2_pos
) != 12) continue;
11451 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11453 if (mac1_pos
== NULL
) continue;
11458 if (strlen (mac1_pos
) != 12) continue;
11460 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11462 // here we need the ESSID
11463 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11465 hash_buf
.salt
->salt_len
= essid_length
;
11467 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11471 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11475 char *pke_ptr
= (char *) pke
;
11477 for (uint i
= 0; i
< 25; i
++)
11479 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11482 unsigned char mac1
[6];
11483 unsigned char mac2
[6];
11485 memcpy (mac1
, pke_ptr
+ 23, 6);
11486 memcpy (mac2
, pke_ptr
+ 29, 6);
11488 // compare hex string(s) vs binary MAC address(es)
11490 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11492 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11500 if (!found
) continue;
11502 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11504 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11515 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11517 if (parser_status
== PARSER_OK
)
11521 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11525 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11530 if (found
== NULL
) continue;
11532 if (!found
->cracked
) potfile_remove_cracks
++;
11534 found
->cracked
= 1;
11548 local_free (hash_buf
.esalt
);
11553 local_free (hash_buf
.salt
);
11556 local_free (hash_buf
.digest
);
11560 * Now generate all the buffers required for later
11563 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11565 salt_t
*salts_buf_new
= NULL
;
11566 void *esalts_buf_new
= NULL
;
11570 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11574 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11579 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11582 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11584 uint digests_cnt
= hashes_cnt
;
11585 uint digests_done
= 0;
11587 uint size_digests
= digests_cnt
* dgst_size
;
11588 uint size_shown
= digests_cnt
* sizeof (uint
);
11590 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11591 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11593 uint salts_cnt
= 0;
11594 uint salts_done
= 0;
11596 hashinfo_t
**hash_info
= NULL
;
11598 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11600 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11602 if (username
&& (remove
|| show
))
11606 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11608 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11610 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11615 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11620 // copied from inner loop
11622 salt_buf
= &salts_buf_new
[salts_cnt
];
11624 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11628 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11631 salt_buf
->digests_cnt
= 0;
11632 salt_buf
->digests_done
= 0;
11633 salt_buf
->digests_offset
= 0;
11638 if (hashes_buf
[0].cracked
== 1)
11640 digests_shown
[0] = 1;
11644 salt_buf
->digests_done
++;
11647 salt_buf
->digests_cnt
++;
11649 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11651 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11653 hash_info
[0] = hashes_buf
[0].hash_info
;
11656 // copy from inner loop
11658 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11662 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11664 salt_buf
= &salts_buf_new
[salts_cnt
];
11666 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11670 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11673 salt_buf
->digests_cnt
= 0;
11674 salt_buf
->digests_done
= 0;
11675 salt_buf
->digests_offset
= hashes_pos
;
11681 if (hashes_buf
[hashes_pos
].cracked
== 1)
11683 digests_shown
[hashes_pos
] = 1;
11687 salt_buf
->digests_done
++;
11690 salt_buf
->digests_cnt
++;
11692 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11694 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11696 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11700 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11702 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11704 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11706 salts_shown
[salt_pos
] = 1;
11711 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11714 local_free (digests_buf
);
11715 local_free (salts_buf
);
11716 local_free (esalts_buf
);
11718 digests_buf
= digests_buf_new
;
11719 salts_buf
= salts_buf_new
;
11720 esalts_buf
= esalts_buf_new
;
11722 local_free (hashes_buf
);
11725 * special modification not set from parser
11730 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11731 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11732 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11733 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11734 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11735 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11736 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11737 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11738 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11739 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11740 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11741 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11744 if (truecrypt_keyfiles
)
11746 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11748 char *keyfiles
= strdup (truecrypt_keyfiles
);
11750 char *keyfile
= strtok (keyfiles
, ",");
11754 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11756 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11761 data
.digests_cnt
= digests_cnt
;
11762 data
.digests_done
= digests_done
;
11763 data
.digests_buf
= digests_buf
;
11764 data
.digests_shown
= digests_shown
;
11765 data
.digests_shown_tmp
= digests_shown_tmp
;
11767 data
.salts_cnt
= salts_cnt
;
11768 data
.salts_done
= salts_done
;
11769 data
.salts_buf
= salts_buf
;
11770 data
.salts_shown
= salts_shown
;
11772 data
.esalts_buf
= esalts_buf
;
11773 data
.hash_info
= hash_info
;
11776 * Automatic Optimizers
11779 if (salts_cnt
== 1)
11780 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11782 if (digests_cnt
== 1)
11783 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11785 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11786 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11788 if (attack_mode
== ATTACK_MODE_BF
)
11789 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11791 data
.opti_type
= opti_type
;
11793 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11795 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11797 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11799 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11801 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11802 opts_type
|= OPTS_TYPE_PT_ADD80
;
11805 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11807 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11808 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11811 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11813 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11814 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11821 * Some algorithm, like descrypt, can benefit from JIT compilation
11824 uint force_jit_compilation
= 0;
11826 if (hash_mode
== 8900)
11828 force_jit_compilation
= 8900;
11830 else if (hash_mode
== 9300)
11832 force_jit_compilation
= 8900;
11834 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11836 force_jit_compilation
= 1500;
11840 * generate bitmap tables
11843 const uint bitmap_shift1
= 5;
11844 const uint bitmap_shift2
= 13;
11846 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11848 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11849 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11850 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11851 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11852 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11853 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11854 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11855 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11862 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
11864 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
11866 bitmap_nums
= 1 << bitmap_bits
;
11868 bitmap_mask
= bitmap_nums
- 1;
11870 bitmap_size
= bitmap_nums
* sizeof (uint
);
11872 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
11874 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;
11875 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;
11880 bitmap_nums
= 1 << bitmap_bits
;
11882 bitmap_mask
= bitmap_nums
- 1;
11884 bitmap_size
= bitmap_nums
* sizeof (uint
);
11886 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);
11887 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);
11890 * prepare quick rule
11893 data
.rule_buf_l
= rule_buf_l
;
11894 data
.rule_buf_r
= rule_buf_r
;
11896 int rule_len_l
= (int) strlen (rule_buf_l
);
11897 int rule_len_r
= (int) strlen (rule_buf_r
);
11899 data
.rule_len_l
= rule_len_l
;
11900 data
.rule_len_r
= rule_len_r
;
11906 uint
*all_gpu_rules_cnt
= NULL
;
11908 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
11912 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
11914 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
11917 char rule_buf
[BUFSIZ
];
11921 for (uint i
= 0; i
< rp_files_cnt
; i
++)
11923 uint gpu_rules_avail
= 0;
11925 uint gpu_rules_cnt
= 0;
11927 gpu_rule_t
*gpu_rules_buf
= NULL
;
11929 char *rp_file
= rp_files
[i
];
11931 char in
[BLOCK_SIZE
];
11932 char out
[BLOCK_SIZE
];
11936 uint rule_line
= 0;
11938 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
11940 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
11947 memset (rule_buf
, 0, BUFSIZ
);
11949 rule_len
= fgetl (fp
, rule_buf
);
11953 if (rule_len
== 0) continue;
11955 if (rule_buf
[0] == '#') continue;
11957 if (gpu_rules_avail
== gpu_rules_cnt
)
11959 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
11961 gpu_rules_avail
+= INCR_RULES
;
11964 memset (in
, 0, BLOCK_SIZE
);
11965 memset (out
, 0, BLOCK_SIZE
);
11967 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
11971 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
11976 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
11978 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
11980 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
11986 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
11988 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
11999 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12001 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12005 * merge rules or automatic rule generator
12008 uint gpu_rules_cnt
= 0;
12010 gpu_rule_t
*gpu_rules_buf
= NULL
;
12012 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12018 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12020 repeats
[0] = gpu_rules_cnt
;
12022 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12024 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12026 repeats
[i
+ 1] = gpu_rules_cnt
;
12029 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12031 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12033 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12037 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12039 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12041 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12044 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12046 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12048 if (out_pos
== RULES_MAX
- 1)
12050 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12055 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12060 local_free (repeats
);
12064 uint gpu_rules_avail
= 0;
12066 while (gpu_rules_cnt
< rp_gen
)
12068 if (gpu_rules_avail
== gpu_rules_cnt
)
12070 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12072 gpu_rules_avail
+= INCR_RULES
;
12075 memset (rule_buf
, 0, BLOCK_SIZE
);
12077 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12079 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12087 * generate NOP rules
12090 if (gpu_rules_cnt
== 0)
12092 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12094 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12099 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12100 data
.gpu_rules_buf
= gpu_rules_buf
;
12106 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12108 uint CL_platforms_cnt
= 0;
12110 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12112 if (CL_platforms_cnt
== 0)
12114 log_error ("ERROR: No OpenCL compatible platform found");
12119 if (CL_platforms_cnt
> 1)
12121 log_error ("ERROR: Too many OpenCL compatible platforms found");
12126 cl_platform_id CL_platform
= CL_platforms
[0];
12128 char CL_platform_vendor
[INFOSZ
];
12130 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12132 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12136 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12138 vendor_id
= VENDOR_ID_AMD
;
12140 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12142 vendor_id
= VENDOR_ID_NV
;
12144 // make sure that we do not directly control the fan for NVidia
12146 gpu_temp_retain
= 0;
12147 data
.gpu_temp_retain
= gpu_temp_retain
;
12151 vendor_id
= VENDOR_ID_UNKNOWN
;
12154 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12156 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12158 gpu_temp_disable
= 1;
12161 data
.vendor_id
= vendor_id
;
12167 cl_device_id devices_all
[DEVICES_MAX
];
12168 cl_device_id devices
[DEVICES_MAX
];
12170 uint devices_all_cnt
= 0;
12172 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12174 int hm_adapters_all
= devices_all_cnt
;
12176 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12178 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12180 if (gpu_temp_disable
== 0)
12182 if (vendor_id
== VENDOR_ID_NV
)
12185 HM_LIB hm_dll
= hm_init ();
12187 data
.hm_dll
= hm_dll
;
12189 if (hc_NVML_nvmlInit (hm_dll
) == NVML_SUCCESS
)
12191 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12193 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12197 for (int i
= 0; i
< tmp_in
; i
++)
12199 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12202 hm_adapters_all
= tmp_out
;
12204 for (int i
= 0; i
< tmp_out
; i
++)
12206 unsigned int speed
;
12208 if (hc_NVML_nvmlDeviceGetFanSpeed (hm_dll
, 1, hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12214 if (NvAPI_Initialize () == NVAPI_OK
)
12216 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12218 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12222 for (int i
= 0; i
< tmp_in
; i
++)
12224 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12227 hm_adapters_all
= tmp_out
;
12229 for (int i
= 0; i
< tmp_out
; i
++)
12233 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12239 if (vendor_id
== VENDOR_ID_AMD
)
12241 HM_LIB hm_dll
= hm_init ();
12243 data
.hm_dll
= hm_dll
;
12245 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12247 // total number of adapters
12249 int hm_adapters_num
;
12251 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12255 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12257 if (lpAdapterInfo
== NULL
) return (-1);
12259 // get a list (of ids of) valid/usable adapters
12261 int num_adl_adapters
= 0;
12263 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12265 if (num_adl_adapters
> 0)
12267 hc_thread_mutex_lock (mux_adl
);
12269 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12271 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12273 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12274 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12276 hc_thread_mutex_unlock (mux_adl
);
12279 hm_adapters_all
= num_adl_adapters
;
12281 myfree (valid_adl_device_list
);
12282 myfree (lpAdapterInfo
);
12287 if (hm_adapters_all
== 0)
12289 gpu_temp_disable
= 1;
12292 if (gpu_temp_disable
== 1)
12294 gpu_temp_abort
= 0;
12295 gpu_temp_retain
= 0;
12299 * enable custom signal handler(s)
12302 if (benchmark
== 0)
12304 hc_signal (sigHandler_default
);
12308 hc_signal (sigHandler_benchmark
);
12312 * devices mask and properties
12315 uint devices_cnt
= 0;
12317 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12319 if (gpu_devicemask
)
12321 uint device_all_id_mask
= 1 << device_all_id
;
12323 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12325 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12331 const uint device_id
= devices_cnt
;
12333 devices
[device_id
] = devices_all
[device_all_id
];
12335 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12337 char device_name
[INFOSZ
];
12339 memset (device_name
, 0, sizeof (device_name
));
12341 cl_ulong global_mem_size
;
12342 cl_uint max_clock_frequency
;
12343 cl_uint max_compute_units
;
12345 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12346 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12347 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12348 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12350 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12352 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12355 (unsigned int) (global_mem_size
/ 1024 / 1024),
12356 (unsigned int) (max_clock_frequency
),
12357 (unsigned int) max_compute_units
);
12363 if (devices_cnt
== 0)
12365 log_error ("ERROR: No devices left that matches your specification.");
12370 data
.devices_cnt
= devices_cnt
;
12372 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12381 // gpu temp sanity check
12383 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12385 if (gpu_temp_abort
< gpu_temp_retain
)
12387 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12393 data
.gpu_temp_disable
= gpu_temp_disable
;
12394 data
.gpu_temp_abort
= gpu_temp_abort
;
12395 data
.gpu_temp_retain
= gpu_temp_retain
;
12397 if (data
.quiet
== 0)
12399 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12401 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
);
12403 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12405 log_info ("Rules: %u", gpu_rules_cnt
);
12410 log_info ("Applicable Optimizers:");
12412 for (uint i
= 0; i
< 32; i
++)
12414 const uint opti_bit
= 1 << i
;
12416 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12421 * Watchdog and Temperature balance
12424 if (gpu_temp_abort
== 0)
12426 log_info ("Watchdog: Temperature abort trigger disabled");
12430 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12433 if (gpu_temp_retain
== 0)
12435 log_info ("Watchdog: Temperature retain trigger disabled");
12439 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12447 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12449 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12451 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12453 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12455 data
.devices_param
= devices_param
;
12457 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12459 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12461 cl_device_id device
= devices
[device_id
];
12463 device_param
->device
= device
;
12465 cl_uint max_compute_units
= 0;
12467 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12469 device_param
->gpu_processors
= max_compute_units
;
12471 cl_ulong max_mem_alloc_size
= 0;
12473 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12475 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12477 char tmp
[INFOSZ
], t1
[64];
12479 memset (tmp
, 0, sizeof (tmp
));
12481 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12483 device_param
->device_name
= mystrdup (tmp
);
12485 memset (tmp
, 0, sizeof (tmp
));
12487 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12489 memset (t1
, 0, sizeof (t1
));
12491 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12493 device_param
->device_version
= mystrdup (t1
);
12495 memset (tmp
, 0, sizeof (tmp
));
12497 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12499 device_param
->driver_version
= mystrdup (tmp
);
12501 if (vendor_id
== VENDOR_ID_NV
)
12503 cl_uint sm_minor
= 0;
12504 cl_uint sm_major
= 0;
12506 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12507 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12509 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12510 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12512 device_param
->sm_minor
= sm_minor
;
12513 device_param
->sm_major
= sm_major
;
12517 * catalyst driver check
12520 if (vendor_id
== VENDOR_ID_AMD
)
12522 int catalyst_check
= (force
== 1) ? 0 : 1;
12524 int catalyst_warn
= 0;
12526 int catalyst_broken
= 0;
12528 if (catalyst_check
== 1)
12532 // v14.9 and higher
12533 if ((atoi (device_param
->device_version
) >= 1573)
12534 && (atoi (device_param
->driver_version
) >= 1573))
12541 if ((strstr (device_param->device_version, "1573.") != NULL)
12542 && (strstr (device_param->driver_version, "1573.") != NULL))
12547 // v14.12 -- version overlaps with v15.4 beta
12548 if ((strstr (device_param->device_version, "1642.") != NULL)
12549 && (strstr (device_param->driver_version, "1642.") != NULL))
12551 catalyst_broken = 1;
12554 // v15.4 (Beta, Windows only release)
12555 if ((strstr (device_param->device_version, "1642.") != NULL)
12556 && (strstr (device_param->driver_version, "1642.") != NULL))
12561 // v15.5 (Release, Linux)
12562 if ((strstr (device_param->device_version, "1702.") != NULL)
12563 && (strstr (device_param->driver_version, "1702.") != NULL))
12568 // v15.3 (Beta, Ubuntu repository release)
12569 if ((strstr (device_param->device_version, "1729.") != NULL)
12570 && (strstr (device_param->driver_version, "1729.") != NULL))
12576 catalyst_check
= 0;
12579 if (catalyst_broken
== 1)
12582 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12583 log_error ("It will pass over cracked hashes and does not report them as cracked");
12584 log_error ("You are STRONGLY encouraged not to use it");
12585 log_error ("You can use --force to override this but do not post error reports if you do so");
12590 if (catalyst_warn
== 1)
12593 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12594 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12595 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12597 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12599 log_error ("You can use --force to override this but do not post error reports if you do so");
12608 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12609 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12610 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12611 * Driver / ADL bug?
12614 if (vendor_id
== VENDOR_ID_AMD
)
12616 if (powertune_enable
== 1)
12618 hc_thread_mutex_lock (mux_adl
);
12620 for (uint i
= 0; i
< devices_cnt
; i
++)
12622 if (data
.hm_device
[i
].od_version
== 6)
12624 // set powertune value only
12626 int powertune_supported
= 0;
12630 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12632 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12637 if (powertune_supported
!= 0)
12640 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12642 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12644 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12649 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12651 log_error ("ERROR: Failed to set new ADL PowerControl values");
12659 hc_thread_mutex_unlock (mux_adl
);
12663 uint gpu_blocks_all
= 0;
12665 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12671 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12674 * device properties
12677 char *device_name
= device_param
->device_name
;
12678 char *device_version
= device_param
->device_version
;
12679 char *driver_version
= device_param
->driver_version
;
12681 uint gpu_processors
= device_param
->gpu_processors
;
12684 * create context for each device
12687 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12690 * create command-queue
12693 // not support with NV
12694 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12696 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12699 * create input buffers on device
12702 uint gpu_threads
= GPU_THREADS
;
12704 if (hash_mode
== 3200) gpu_threads
= 8;
12705 if (hash_mode
== 9000) gpu_threads
= 8;
12707 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12708 uint gpu_blocks
= gpu_power
;
12710 device_param
->gpu_threads
= gpu_threads
;
12711 device_param
->gpu_power_user
= gpu_power
;
12712 device_param
->gpu_blocks_user
= gpu_blocks
;
12714 gpu_blocks_all
+= gpu_blocks
;
12716 uint size_pws
= gpu_power
* sizeof (pw_t
);
12718 uint size_tmps
= 4;
12722 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12723 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12724 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12725 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12726 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12727 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12728 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12729 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12730 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12731 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12734 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12737 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12740 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12743 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12744 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12745 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12746 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12747 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12748 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12749 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12750 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12751 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12752 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12753 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12754 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12755 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12756 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12757 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12758 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12759 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12760 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12761 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12762 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12763 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12764 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12765 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12766 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12767 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12768 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12769 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12770 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12771 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12772 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12773 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12774 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12775 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12776 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12777 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12778 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12779 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12780 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12783 uint size_hooks
= 4;
12785 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12787 // insert correct hook size
12790 // we can optimize some stuff here...
12792 device_param
->size_pws
= size_pws
;
12793 device_param
->size_tmps
= size_tmps
;
12794 device_param
->size_hooks
= size_hooks
;
12796 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12797 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12799 device_param
->size_root_css
= size_root_css
;
12800 device_param
->size_markov_css
= size_markov_css
;
12802 uint size_results
= GPU_THREADS
* sizeof (uint
);
12804 device_param
->size_results
= size_results
;
12806 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12807 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12808 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12809 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12810 uint size_esalts
= salts_cnt
* esalt_size
;
12812 device_param
->size_plains
= size_plains
;
12813 device_param
->size_digests
= size_digests
;
12814 device_param
->size_shown
= size_shown
;
12815 device_param
->size_salts
= size_salts
;
12817 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12818 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12819 uint size_tm
= 32 * sizeof (bs_word_t
);
12821 uint64_t size_scryptV
= 1;
12823 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12825 #define SHADER_PER_MP 8
12826 #define WAVEFRONTS 64
12828 uint tmto_start
= 2;
12829 uint tmto_stop
= 1024;
12833 tmto_start
= 1 << scrypt_tmto
;
12834 tmto_stop
= tmto_start
+ 1;
12837 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
<<= 1)
12839 // todo -- make sure all salts get the new tmto value
12841 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
12843 size_scryptV
/= tmto
;
12845 size_scryptV
*= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12847 if (size_scryptV
> (device_param
->gpu_maxmem_alloc
/ 2)) continue;
12849 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
12851 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
12852 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12858 if (data
.salts_buf
[0].scrypt_tmto
== 0)
12860 log_error ("ERROR: can't allocate enough GPU memory");
12865 if (quiet
== 0) log_info ("");
12866 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
12873 char build_opts
[1024];
12875 // we don't have sm_* on AMD but it doesn't matter
12877 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
12881 char kernel_file
[256];
12883 memset (kernel_file
, 0, sizeof (kernel_file
));
12885 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
12887 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
12889 #ifdef BINARY_KERNEL
12890 if (force_jit_compilation
== 0)
12892 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12894 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12895 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
);
12896 else if (attack_kern
== ATTACK_KERN_COMBI
)
12897 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
);
12898 else if (attack_kern
== ATTACK_KERN_BF
)
12899 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
);
12903 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
);
12905 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12907 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
);
12911 if (stat (kernel_file
, &st
) == -1)
12913 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_file
);
12915 char module_file
[256];
12917 memset (module_file
, 0, sizeof (module_file
));
12919 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12921 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12922 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a0.llvmir", install_dir
, (int) kern_type
);
12923 else if (attack_kern
== ATTACK_KERN_COMBI
)
12924 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a1.llvmir", install_dir
, (int) kern_type
);
12925 else if (attack_kern
== ATTACK_KERN_BF
)
12926 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a3.llvmir", install_dir
, (int) kern_type
);
12930 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d.llvmir", install_dir
, (int) kern_type
);
12932 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12934 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
);
12938 load_kernel (module_file
, 1, kernel_lengths
, kernel_sources
);
12940 cl_program program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
12942 local_free (kernel_sources
[0]);
12944 hc_clBuildProgram (program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
12946 size_t binary_size
;
12948 clGetProgramInfo (program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
12950 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
12952 clGetProgramInfo (program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
12954 writeProgramBin (kernel_file
, binary
, binary_size
);
12956 local_free (binary
);
12958 stat (kernel_file
, &st
); // to reload filesize
12963 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
12965 if (stat (kernel_file
, &st
) == -1)
12967 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
12975 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
12977 if (stat (kernel_file
, &st
) == -1)
12979 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
12986 load_kernel (kernel_file
, 1, kernel_lengths
, kernel_sources
);
12988 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_file
, st
.st_size
);
12990 #ifdef BINARY_KERNEL
12991 if (force_jit_compilation
== 0)
12993 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
12997 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13000 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13003 local_free (kernel_lengths
);
13005 local_free (kernel_sources
[0]);
13007 local_free (kernel_sources
)
13013 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13015 char kernel_mp_file
[256];
13017 memset (kernel_mp_file
, 0, sizeof (kernel_mp_file
));
13019 size_t *kernel_mp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13021 const unsigned char **kernel_mp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13023 #ifdef BINARY_KERNEL
13024 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13026 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
);
13030 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
);
13033 if (stat (kernel_mp_file
, &st
) == -1)
13035 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_mp_file
);
13037 char module_mp_file
[256];
13039 memset (module_mp_file
, 0, sizeof (module_mp_file
));
13041 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13043 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_be.llvmir", install_dir
);
13047 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_le.llvmir", install_dir
);
13050 load_kernel (module_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13052 cl_program program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13054 local_free (kernel_mp_sources
[0]);
13056 hc_clBuildProgram (program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13058 size_t binary_mp_size
;
13060 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_mp_size
, NULL
);
13062 unsigned char *binary_mp
= (unsigned char *) mymalloc (binary_mp_size
);
13064 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary_mp
), &binary_mp
, NULL
);
13066 writeProgramBin (kernel_mp_file
, binary_mp
, binary_mp_size
);
13068 local_free (binary_mp
);
13070 stat (kernel_mp_file
, &st
); // to reload filesize
13074 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13076 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_be.cl", install_dir
);
13080 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_le.cl", install_dir
);
13083 if (stat (kernel_mp_file
, &st
) == -1)
13085 log_error ("ERROR: %s: %s", kernel_mp_file
, strerror (errno
));
13092 load_kernel (kernel_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13094 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_mp_file
, st
.st_size
);
13096 #ifdef BINARY_KERNEL
13097 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13099 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_mp_sources
, NULL
);
13102 local_free (kernel_mp_lengths
);
13104 local_free (kernel_mp_sources
[0]);
13106 local_free (kernel_mp_sources
);
13113 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13119 char kernel_amp_file
[256];
13121 memset (kernel_amp_file
, 0, sizeof (kernel_amp_file
));
13123 size_t *kernel_amp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13125 const unsigned char **kernel_amp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13127 #ifdef BINARY_KERNEL
13128 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
);
13130 if (stat (kernel_amp_file
, &st
) == -1)
13132 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_amp_file
);
13134 char module_amp_file
[256];
13136 memset (module_amp_file
, 0, sizeof (module_amp_file
));
13138 snprintf (module_amp_file
, sizeof (module_amp_file
) - 1, "%s/kernels/4098/amp_a%d.llvmir", install_dir
, attack_kern
);
13140 load_kernel (module_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13142 cl_program program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13144 local_free (kernel_amp_sources
[0]);
13146 hc_clBuildProgram (program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13148 size_t binary_amp_size
;
13150 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_amp_size
, NULL
);
13152 unsigned char *binary_amp
= (unsigned char *) mymalloc (binary_amp_size
);
13154 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary_amp
), &binary_amp
, NULL
);
13156 writeProgramBin (kernel_amp_file
, binary_amp
, binary_amp_size
);
13158 local_free (binary_amp
);
13160 stat (kernel_amp_file
, &st
); // to reload filesize
13163 snprintf (kernel_amp_file
, sizeof (kernel_amp_file
) - 1, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
13165 if (stat (kernel_amp_file
, &st
) == -1)
13167 log_error ("ERROR: %s: %s", kernel_amp_file
, strerror (errno
));
13173 load_kernel (kernel_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13175 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_amp_file
, st
.st_size
);
13177 #ifdef BINARY_KERNEL
13178 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13180 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_amp_sources
, NULL
);
13183 local_free (kernel_amp_lengths
);
13185 local_free (kernel_amp_sources
[0]);
13187 local_free (kernel_amp_sources
);
13194 //#ifdef BINARY_KERNEL
13196 if (force_jit_compilation
== 0)
13200 else if (force_jit_compilation
== 1500)
13202 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13204 else if (force_jit_compilation
== 8900)
13206 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
);
13211 clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13213 size_t ret_val_size
= 0;
13215 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13217 if (ret_val_size
> 2)
13219 char *build_log
= (char *) malloc (ret_val_size
+ 1);
13221 memset (build_log
, 0, ret_val_size
+ 1);
13223 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13230 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13232 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13235 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13241 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13245 * amp is not independent
13248 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13254 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13261 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13262 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13263 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13264 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13265 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13266 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13267 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13268 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13269 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13270 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13271 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13272 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13273 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13274 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13275 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13276 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13277 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13278 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13280 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13281 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13282 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13283 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13284 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13285 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13286 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13287 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13288 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13289 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13290 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13292 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13293 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13294 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13295 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13296 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13297 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13303 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13305 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13306 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13308 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13310 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13312 else if (attack_kern
== ATTACK_KERN_COMBI
)
13314 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13315 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13316 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13317 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13319 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13320 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13321 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13322 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13324 else if (attack_kern
== ATTACK_KERN_BF
)
13326 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13327 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13328 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13329 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13330 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13332 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13333 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13334 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13335 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13336 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13341 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13343 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13350 uint
*result
= (uint
*) mymalloc (size_results
);
13352 memset (result
, 0, size_results
);
13354 device_param
->result
= result
;
13356 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13358 memset (pws_buf
, 0, size_pws
);
13360 device_param
->pws_buf
= pws_buf
;
13362 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13364 for (int i
= 0; i
< 64; i
++)
13366 pw_caches
[i
].pw_buf
.pw_len
= i
;
13367 pw_caches
[i
].cnt
= 0;
13370 device_param
->pw_caches
= pw_caches
;
13372 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13374 device_param
->combs_buf
= combs_buf
;
13376 void *hooks_buf
= mymalloc (size_hooks
);
13378 device_param
->hooks_buf
= hooks_buf
;
13380 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13381 device_param
->pw_add
= pw_add_to_hc1
;
13387 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13388 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13389 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13390 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13391 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13392 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13393 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13394 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13395 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13396 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13397 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13399 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13400 ? &device_param
->d_pws_buf
13401 : &device_param
->d_pws_amp_buf
;
13402 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13403 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13404 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13405 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13406 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13407 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13408 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13409 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13410 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13411 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13412 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13413 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13414 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13415 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13416 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13417 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13418 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13419 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13420 device_param
->kernel_params
[19] = &device_param
->d_result
;
13421 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13422 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13423 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13424 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13425 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13426 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13427 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13428 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13429 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13430 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13431 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13432 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13434 device_param
->kernel_params_mp_buf64
[3] = 0;
13435 device_param
->kernel_params_mp_buf32
[4] = 0;
13436 device_param
->kernel_params_mp_buf32
[5] = 0;
13437 device_param
->kernel_params_mp_buf32
[6] = 0;
13438 device_param
->kernel_params_mp_buf32
[7] = 0;
13439 device_param
->kernel_params_mp_buf32
[8] = 0;
13441 device_param
->kernel_params_mp
[0] = NULL
;
13442 device_param
->kernel_params_mp
[1] = NULL
;
13443 device_param
->kernel_params_mp
[2] = NULL
;
13444 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13445 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13446 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13447 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13448 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13449 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13451 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13452 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13453 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13454 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13455 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13456 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13457 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13459 device_param
->kernel_params_mp_l
[0] = NULL
;
13460 device_param
->kernel_params_mp_l
[1] = NULL
;
13461 device_param
->kernel_params_mp_l
[2] = NULL
;
13462 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13463 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13464 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13465 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13466 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13467 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13468 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13470 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13471 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13472 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13473 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13474 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13475 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13477 device_param
->kernel_params_mp_r
[0] = NULL
;
13478 device_param
->kernel_params_mp_r
[1] = NULL
;
13479 device_param
->kernel_params_mp_r
[2] = NULL
;
13480 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13481 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13482 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13483 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13484 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13485 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13487 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13488 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13490 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13491 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13492 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13493 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13494 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13495 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13496 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13498 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13500 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13501 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13507 char kernel_name
[64];
13509 memset (kernel_name
, 0, sizeof (kernel_name
));
13511 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13513 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13515 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13517 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13519 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13521 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13523 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13525 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13529 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13531 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13533 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13535 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13537 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13539 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13542 if (data
.attack_mode
== ATTACK_MODE_BF
)
13544 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13546 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13548 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13550 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13552 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13558 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13560 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13562 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13564 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13566 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13568 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13570 if (opts_type
& OPTS_TYPE_HOOK12
)
13572 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13574 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13577 if (opts_type
& OPTS_TYPE_HOOK23
)
13579 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13581 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13585 for (uint i
= 0; i
<= 20; i
++)
13587 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13588 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13589 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13591 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13592 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13595 for (uint i
= 21; i
<= 31; i
++)
13597 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13598 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13599 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13601 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13602 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13605 if (attack_mode
== ATTACK_MODE_BF
)
13607 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13608 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13610 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13612 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13614 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13615 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13618 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13620 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13622 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13624 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13627 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13633 for (uint i
= 0; i
< 5; i
++)
13635 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13638 for (uint i
= 5; i
< 7; i
++)
13640 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13645 * Store initial fanspeed if gpu_temp_retain is enabled
13648 int gpu_temp_retain_set
= 0;
13650 if (gpu_temp_disable
== 0)
13652 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13654 hc_thread_mutex_lock (mux_adl
);
13656 if (data
.hm_device
[device_id
].fan_supported
== 1)
13658 if (gpu_temp_retain_chgd
== 0)
13661 uint default_temp
= 0;
13663 int ADL_rc
= hc_ADL_Overdrive6_TargetTemperatureData_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, (int *) &cur_temp
, (int *) &default_temp
);
13665 if (ADL_rc
== ADL_OK
)
13667 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13669 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13671 // special case with multi gpu setups: always use minimum retain
13673 if (gpu_temp_retain_set
== 0)
13675 gpu_temp_retain
= gpu_temp_retain_target
;
13676 gpu_temp_retain_set
= 1;
13680 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13683 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13687 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13689 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13691 if (fan_speed
== -1)
13693 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13695 temp_retain_fanspeed_value
[device_id
] = 0;
13699 hc_thread_mutex_unlock (mux_adl
);
13704 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13707 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13709 hc_thread_mutex_lock (mux_adl
);
13711 if (data
.hm_device
[device_id
].od_version
== 6)
13715 // check powertune capabilities first, if not available then skip device
13717 int powertune_supported
= 0;
13719 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13721 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13726 if (powertune_supported
!= 0)
13728 // powercontrol settings
13730 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13732 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13734 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13737 if (ADL_rc
!= ADL_OK
)
13739 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13744 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13746 log_error ("ERROR: Failed to set new ADL PowerControl values");
13753 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13755 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13757 if ((ADL_rc
= hc_ADL_Overdrive_StateInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_GETSTATEINFO_CUSTOM_PERFORMANCE
, &od_clock_mem_status
[device_id
])) != ADL_OK
)
13759 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13764 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13766 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13768 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
13770 log_error ("ERROR: Failed to get ADL device capabilities");
13775 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
13776 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
13778 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
13779 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
13781 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
13782 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
13784 // warning if profile has to low max values
13786 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
13788 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13791 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
13793 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13796 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
13798 performance_state
->iNumberOfPerformanceLevels
= 2;
13800 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
13801 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
13802 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
13803 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
13805 if ((ADL_rc
= hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
13807 log_info ("ERROR: Failed to set ADL performance state");
13812 local_free (performance_state
);
13816 hc_thread_mutex_unlock (mux_adl
);
13820 data
.gpu_blocks_all
= gpu_blocks_all
;
13822 if (data
.quiet
== 0) log_info ("");
13825 * Inform user which algorithm is checked and at which workload setting
13828 if (benchmark
== 1)
13832 data
.quiet
= quiet
;
13834 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
13836 log_info ("Hashtype: %s", hash_type
);
13837 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
13842 * keep track of the progress
13845 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13846 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13847 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13854 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
13856 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
13861 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
13863 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
13868 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
13870 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
13880 segment_size
*= (1024 * 1024);
13882 data
.segment_size
= segment_size
;
13884 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
13886 wl_data
->buf
= (char *) mymalloc (segment_size
);
13887 wl_data
->avail
= segment_size
;
13888 wl_data
->incr
= segment_size
;
13892 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
13894 data
.wordlist_mode
= wordlist_mode
;
13896 cs_t
*css_buf
= NULL
;
13900 char **masks
= NULL
;
13901 char **dictfiles
= NULL
;
13903 uint mask_from_file
= 0;
13905 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13907 if (wordlist_mode
== WL_MODE_FILE
)
13909 int wls_left
= myargc
- (optind
+ 1);
13911 for (int i
= 0; i
< wls_left
; i
++)
13913 char *l0_filename
= myargv
[optind
+ 1 + i
];
13915 struct stat l0_stat
;
13917 if (stat (l0_filename
, &l0_stat
) == -1)
13919 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
13924 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
13928 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
13932 dictfiles
[dictcnt
- 1] = l0_filename
;
13936 // do not allow --keyspace w/ a directory
13940 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
13945 char **dictionary_files
= NULL
;
13947 dictionary_files
= scan_directory (l0_filename
);
13949 if (dictionary_files
!= NULL
)
13951 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
13953 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
13955 char *l1_filename
= dictionary_files
[d
];
13957 struct stat l1_stat
;
13959 if (stat (l1_filename
, &l1_stat
) == -1)
13961 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
13966 if (S_ISREG (l1_stat
.st_mode
))
13968 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
13972 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
13977 local_free (dictionary_files
);
13983 log_error ("ERROR: No usable dictionary file found.");
13988 else if (wordlist_mode
== WL_MODE_STDIN
)
13993 else if (attack_mode
== ATTACK_MODE_COMBI
)
13997 char *dictfile1
= myargv
[optind
+ 1 + 0];
13998 char *dictfile2
= myargv
[optind
+ 1 + 1];
14000 // find the bigger dictionary and use as base
14005 struct stat tmp_stat
;
14007 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14009 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14014 if (stat (dictfile1
, &tmp_stat
) == -1)
14016 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14023 if (S_ISDIR (tmp_stat
.st_mode
))
14025 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14032 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14034 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14041 if (stat (dictfile2
, &tmp_stat
) == -1)
14043 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14051 if (S_ISDIR (tmp_stat
.st_mode
))
14053 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14061 data
.combs_cnt
= 1;
14065 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14067 data
.quiet
= quiet
;
14069 if (words1_cnt
== 0)
14071 log_error ("ERROR: %s: empty file", dictfile1
);
14079 data
.combs_cnt
= 1;
14083 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14085 data
.quiet
= quiet
;
14087 if (words2_cnt
== 0)
14089 log_error ("ERROR: %s: empty file", dictfile2
);
14100 data
.dictfile
= dictfile1
;
14101 data
.dictfile2
= dictfile2
;
14103 if (words1_cnt
>= words2_cnt
)
14105 data
.combs_cnt
= words2_cnt
;
14106 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14108 dictfiles
= &data
.dictfile
;
14114 data
.combs_cnt
= words1_cnt
;
14115 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14117 dictfiles
= &data
.dictfile2
;
14121 // we also have to switch wordlist related rules!
14123 char *tmpc
= data
.rule_buf_l
;
14125 data
.rule_buf_l
= data
.rule_buf_r
;
14126 data
.rule_buf_r
= tmpc
;
14128 int tmpi
= data
.rule_len_l
;
14130 data
.rule_len_l
= data
.rule_len_r
;
14131 data
.rule_len_r
= tmpi
;
14134 else if (attack_mode
== ATTACK_MODE_BF
)
14140 if (benchmark
== 0)
14142 mask
= myargv
[optind
+ 1];
14144 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14146 if ((optind
+ 2) <= myargc
)
14148 struct stat file_stat
;
14150 if (stat (mask
, &file_stat
) == -1)
14154 masks
[maskcnt
- 1] = mystrdup (mask
);
14158 int wls_left
= myargc
- (optind
+ 1);
14160 uint masks_avail
= INCR_MASKS
;
14162 for (int i
= 0; i
< wls_left
; i
++)
14166 mask
= myargv
[optind
+ 1 + i
];
14168 if (stat (mask
, &file_stat
) == -1)
14170 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14176 uint is_file
= S_ISREG (file_stat
.st_mode
);
14182 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14184 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14189 char line_buf
[BUFSIZ
];
14191 while (!feof (mask_fp
))
14193 memset (line_buf
, 0, BUFSIZ
);
14195 int line_len
= fgetl (mask_fp
, line_buf
);
14197 if (line_len
== 0) continue;
14199 if (line_buf
[0] == '#') continue;
14201 if (masks_avail
== maskcnt
)
14203 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14205 masks_avail
+= INCR_MASKS
;
14208 masks
[maskcnt
] = mystrdup (line_buf
);
14217 log_error ("ERROR: %s: unsupported file-type", mask
);
14223 mask_from_file
= 1;
14228 custom_charset_1
= (char *) "?l?d?u";
14229 custom_charset_2
= (char *) "?l?d";
14230 custom_charset_3
= (char *) "?l?d*!$@_";
14232 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14233 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14234 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14236 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14238 wordlist_mode
= WL_MODE_MASK
;
14240 data
.wordlist_mode
= wordlist_mode
;
14250 * generate full masks and charsets
14253 masks
= (char **) mymalloc (sizeof (char *));
14257 case 1731: pw_min
= 5;
14259 mask
= mystrdup ("?b?b?b?b?b");
14261 case 12500: pw_min
= 5;
14263 mask
= mystrdup ("?b?b?b?b?b");
14265 default: pw_min
= 7;
14267 mask
= mystrdup ("?b?b?b?b?b?b?b");
14273 masks
[maskcnt
- 1] = mystrdup (mask
);
14275 wordlist_mode
= WL_MODE_MASK
;
14277 data
.wordlist_mode
= wordlist_mode
;
14282 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14286 if (increment_min
> pw_min
) pw_min
= increment_min
;
14288 if (increment_max
< pw_max
) pw_max
= increment_max
;
14291 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14293 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14297 char *mask
= myargv
[myargc
- 1];
14301 masks
= (char **) mymalloc (1 * sizeof (char *));
14305 struct stat file_stat
;
14307 if (stat (mask
, &file_stat
) == -1)
14311 masks
[maskcnt
- 1] = mystrdup (mask
);
14315 uint is_file
= S_ISREG (file_stat
.st_mode
);
14321 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14323 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14328 char line_buf
[BUFSIZ
];
14330 uint masks_avail
= 1;
14332 while (!feof (mask_fp
))
14334 memset (line_buf
, 0, BUFSIZ
);
14336 int line_len
= fgetl (mask_fp
, line_buf
);
14338 if (line_len
== 0) continue;
14340 if (line_buf
[0] == '#') continue;
14342 if (masks_avail
== maskcnt
)
14344 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14346 masks_avail
+= INCR_MASKS
;
14349 masks
[maskcnt
] = mystrdup (line_buf
);
14356 mask_from_file
= 1;
14362 masks
[maskcnt
- 1] = mystrdup (mask
);
14368 int wls_left
= myargc
- (optind
+ 2);
14370 for (int i
= 0; i
< wls_left
; i
++)
14372 char *filename
= myargv
[optind
+ 1 + i
];
14374 struct stat file_stat
;
14376 if (stat (filename
, &file_stat
) == -1)
14378 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14383 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14387 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14391 dictfiles
[dictcnt
- 1] = filename
;
14395 // do not allow --keyspace w/ a directory
14399 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14404 char **dictionary_files
= NULL
;
14406 dictionary_files
= scan_directory (filename
);
14408 if (dictionary_files
!= NULL
)
14410 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14412 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14414 char *l1_filename
= dictionary_files
[d
];
14416 struct stat l1_stat
;
14418 if (stat (l1_filename
, &l1_stat
) == -1)
14420 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14425 if (S_ISREG (l1_stat
.st_mode
))
14427 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14431 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14436 local_free (dictionary_files
);
14442 log_error ("ERROR: No usable dictionary file found.");
14451 uint mask_min
= increment_min
; // we can't reject smaller masks here
14452 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14454 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14456 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14458 if (cur_mask
== NULL
) break;
14460 masks
[maskcnt
] = cur_mask
;
14464 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14468 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14470 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14474 char *mask
= myargv
[optind
+ 1 + 0];
14478 masks
= (char **) mymalloc (1 * sizeof (char *));
14482 struct stat file_stat
;
14484 if (stat (mask
, &file_stat
) == -1)
14488 masks
[maskcnt
- 1] = mystrdup (mask
);
14492 uint is_file
= S_ISREG (file_stat
.st_mode
);
14498 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14500 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14505 char line_buf
[BUFSIZ
];
14507 uint masks_avail
= 1;
14509 while (!feof (mask_fp
))
14511 memset (line_buf
, 0, BUFSIZ
);
14513 int line_len
= fgetl (mask_fp
, line_buf
);
14515 if (line_len
== 0) continue;
14517 if (line_buf
[0] == '#') continue;
14519 if (masks_avail
== maskcnt
)
14521 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14523 masks_avail
+= INCR_MASKS
;
14526 masks
[maskcnt
] = mystrdup (line_buf
);
14533 mask_from_file
= 1;
14539 masks
[maskcnt
- 1] = mystrdup (mask
);
14545 int wls_left
= myargc
- (optind
+ 2);
14547 for (int i
= 0; i
< wls_left
; i
++)
14549 char *filename
= myargv
[optind
+ 2 + i
];
14551 struct stat file_stat
;
14553 if (stat (filename
, &file_stat
) == -1)
14555 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14560 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14564 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14568 dictfiles
[dictcnt
- 1] = filename
;
14572 // do not allow --keyspace w/ a directory
14576 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14581 char **dictionary_files
= NULL
;
14583 dictionary_files
= scan_directory (filename
);
14585 if (dictionary_files
!= NULL
)
14587 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14589 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14591 char *l1_filename
= dictionary_files
[d
];
14593 struct stat l1_stat
;
14595 if (stat (l1_filename
, &l1_stat
) == -1)
14597 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14602 if (S_ISREG (l1_stat
.st_mode
))
14604 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14608 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14613 local_free (dictionary_files
);
14619 log_error ("ERROR: No usable dictionary file found.");
14628 uint mask_min
= increment_min
; // we can't reject smaller masks here
14629 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14631 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14633 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14635 if (cur_mask
== NULL
) break;
14637 masks
[maskcnt
] = cur_mask
;
14641 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14646 data
.pw_min
= pw_min
;
14647 data
.pw_max
= pw_max
;
14653 if (weak_hash_threshold
>= salts_cnt
)
14655 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14657 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14659 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14663 // Display hack, guarantee that there is at least one \r before real start
14665 if (data
.quiet
== 0) log_info_nn ("");
14668 * status and monitor threads
14671 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14673 hc_thread_t i_thread
= 0;
14675 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14677 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14680 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14682 uint ni_threads_cnt
= 0;
14684 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14686 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14696 if (outfile_check_timer
!= 0)
14698 if (data
.outfile_check_directory
!= NULL
)
14700 if ((hash_mode
!= 5200) &&
14701 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14702 (hash_mode
!= 9000))
14704 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14710 outfile_check_timer
= 0;
14715 outfile_check_timer
= 0;
14721 * Inform the user if we got some hashes remove because of the pot file remove feature
14724 if (data
.quiet
== 0)
14726 if (potfile_remove_cracks
> 0)
14728 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14729 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14733 data
.outfile_check_timer
= outfile_check_timer
;
14739 char **induction_dictionaries
= NULL
;
14741 int induction_dictionaries_cnt
= 0;
14743 hcstat_table_t
*root_table_buf
= NULL
;
14744 hcstat_table_t
*markov_table_buf
= NULL
;
14746 uint initial_restore_done
= 0;
14748 data
.maskcnt
= maskcnt
;
14750 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14752 if (data
.devices_status
== STATUS_CRACKED
) break;
14754 data
.devices_status
= STATUS_INIT
;
14756 if (maskpos
> rd
->maskpos
)
14761 rd
->maskpos
= maskpos
;
14762 data
.maskpos
= maskpos
;
14764 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14766 char *mask
= masks
[maskpos
];
14768 if (mask_from_file
== 1)
14770 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14775 uint mask_offset
= 0;
14777 uint separator_cnt
;
14779 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14781 str_ptr
= strstr (mask
+ mask_offset
, ",");
14783 if (str_ptr
== NULL
) break;
14785 str_pos
= str_ptr
- mask
;
14787 // escaped separator, i.e. "\,"
14791 if (mask
[str_pos
- 1] == '\\')
14795 mask_offset
= str_pos
+ 1;
14801 // reset the offset
14805 mask
[str_pos
] = '\0';
14807 switch (separator_cnt
)
14810 mp_reset_usr (mp_usr
, 0);
14812 custom_charset_1
= mask
;
14813 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14817 mp_reset_usr (mp_usr
, 1);
14819 custom_charset_2
= mask
;
14820 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14824 mp_reset_usr (mp_usr
, 2);
14826 custom_charset_3
= mask
;
14827 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14831 mp_reset_usr (mp_usr
, 3);
14833 custom_charset_4
= mask
;
14834 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
14838 mask
= mask
+ str_pos
+ 1;
14842 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
14846 local_free (css_buf
);
14847 local_free (data
.root_css_buf
);
14848 local_free (data
.markov_css_buf
);
14850 local_free (masks
[maskpos
- 1]);
14853 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
14856 data
.css_cnt
= css_cnt
;
14857 data
.css_buf
= css_buf
;
14859 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
14861 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
14863 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
14865 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
14866 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
14868 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
14870 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
14872 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
14873 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
14875 data
.root_css_buf
= root_css_buf
;
14876 data
.markov_css_buf
= markov_css_buf
;
14878 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
14880 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
14882 local_free (root_table_buf
);
14883 local_free (markov_table_buf
);
14887 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
14889 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14891 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
14892 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
14893 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
14895 device_param
->kernel_params_mp_buf64
[3] = 0;
14896 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
14897 device_param
->kernel_params_mp_buf32
[5] = 0;
14898 device_param
->kernel_params_mp_buf32
[6] = 0;
14899 device_param
->kernel_params_mp_buf32
[7] = 0;
14901 if (attack_mode
== ATTACK_MODE_HYBRID1
)
14903 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
14904 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
14905 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
14906 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
14908 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14910 device_param
->kernel_params_mp_buf32
[5] = 0;
14911 device_param
->kernel_params_mp_buf32
[6] = 0;
14912 device_param
->kernel_params_mp_buf32
[7] = 0;
14915 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
14916 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
14917 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
14919 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
);
14920 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
);
14923 else if (attack_mode
== ATTACK_MODE_BF
)
14925 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
14929 for (uint i
= 0; i
< dictcnt
; i
++)
14931 local_free (dictfiles
[i
]);
14934 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
14936 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
14938 if (l1_filename
== NULL
) break;
14942 dictfiles
[dictcnt
- 1] = l1_filename
;
14949 dictfiles
[dictcnt
- 1] = mask
;
14954 log_error ("ERROR: Mask is too small");
14961 free (induction_dictionaries
);
14963 // induction_dictionaries_cnt = 0; // implied
14965 if (attack_mode
!= ATTACK_MODE_BF
)
14969 induction_dictionaries
= scan_directory (induction_directory
);
14971 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
14975 if (induction_dictionaries_cnt
)
14977 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
14981 * prevent the user from using --keyspace together w/ maskfile and or dictfile
14985 if ((maskcnt
> 1) || (dictcnt
> 1))
14987 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
14993 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
14995 char *subid
= logfile_generate_subid ();
14997 data
.subid
= subid
;
14999 logfile_sub_msg ("START");
15001 data
.devices_status
= STATUS_INIT
;
15003 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15004 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15005 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15007 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15011 data
.cpt_start
= time (NULL
);
15013 data
.cpt_total
= 0;
15015 if (data
.restore
== 0)
15017 rd
->words_cur
= skip
;
15024 data
.ms_paused
= 0;
15026 data
.words_cur
= rd
->words_cur
;
15028 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15030 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15032 device_param
->speed_pos
= 0;
15034 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15035 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15036 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15038 device_param
->gpu_power
= device_param
->gpu_power_user
;
15039 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15041 device_param
->outerloop_pos
= 0;
15042 device_param
->outerloop_left
= 0;
15043 device_param
->innerloop_pos
= 0;
15044 device_param
->innerloop_left
= 0;
15046 // some more resets:
15048 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15050 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15052 device_param
->pw_cnt
= 0;
15053 device_param
->pws_cnt
= 0;
15055 device_param
->words_off
= 0;
15056 device_param
->words_done
= 0;
15059 data
.gpu_blocks_div
= 0;
15061 // figure out some workload
15063 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15065 if (data
.wordlist_mode
== WL_MODE_FILE
)
15067 char *dictfile
= NULL
;
15069 if (induction_dictionaries_cnt
)
15071 dictfile
= induction_dictionaries
[0];
15075 dictfile
= dictfiles
[dictpos
];
15078 data
.dictfile
= dictfile
;
15080 logfile_sub_string (dictfile
);
15082 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15084 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15087 FILE *fd2
= fopen (dictfile
, "rb");
15091 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15096 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15100 if (data
.words_cnt
== 0)
15102 if (data
.devices_status
== STATUS_CRACKED
) break;
15103 if (data
.devices_status
== STATUS_ABORTED
) break;
15111 else if (attack_mode
== ATTACK_MODE_COMBI
)
15113 char *dictfile
= data
.dictfile
;
15114 char *dictfile2
= data
.dictfile2
;
15116 logfile_sub_string (dictfile
);
15117 logfile_sub_string (dictfile2
);
15119 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15121 FILE *fd2
= fopen (dictfile
, "rb");
15125 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15130 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15134 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15136 FILE *fd2
= fopen (dictfile2
, "rb");
15140 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15145 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15150 if (data
.words_cnt
== 0)
15152 if (data
.devices_status
== STATUS_CRACKED
) break;
15153 if (data
.devices_status
== STATUS_ABORTED
) break;
15160 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15162 char *dictfile
= NULL
;
15164 if (induction_dictionaries_cnt
)
15166 dictfile
= induction_dictionaries
[0];
15170 dictfile
= dictfiles
[dictpos
];
15173 data
.dictfile
= dictfile
;
15175 char *mask
= data
.mask
;
15177 logfile_sub_string (dictfile
);
15178 logfile_sub_string (mask
);
15180 FILE *fd2
= fopen (dictfile
, "rb");
15184 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15189 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15193 if (data
.words_cnt
== 0)
15195 if (data
.devices_status
== STATUS_CRACKED
) break;
15196 if (data
.devices_status
== STATUS_ABORTED
) break;
15203 else if (attack_mode
== ATTACK_MODE_BF
)
15205 local_free (css_buf
);
15206 local_free (data
.root_css_buf
);
15207 local_free (data
.markov_css_buf
);
15209 char *mask
= dictfiles
[dictpos
];
15211 logfile_sub_string (mask
);
15215 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15217 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15219 uint css_cnt_unicode
= css_cnt
* 2;
15221 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15223 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15225 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15227 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15228 css_buf_unicode
[j
+ 1].cs_len
= 1;
15233 css_buf
= css_buf_unicode
;
15234 css_cnt
= css_cnt_unicode
;
15237 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15239 uint mask_min
= pw_min
;
15240 uint mask_max
= pw_max
;
15242 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15248 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15250 if (css_cnt
< mask_min
)
15252 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15255 if (css_cnt
> mask_max
)
15257 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15260 // skip to next mask
15264 rd
->dictpos
= dictpos
;
15266 logfile_sub_msg ("STOP");
15271 uint save_css_cnt
= css_cnt
;
15273 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15275 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15277 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15278 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15280 uint css_cnt_salt
= css_cnt
+ salt_len
;
15282 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15284 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15286 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15288 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15289 css_buf_salt
[j
].cs_len
= 1;
15294 css_buf
= css_buf_salt
;
15295 css_cnt
= css_cnt_salt
;
15300 data
.css_cnt
= css_cnt
;
15301 data
.css_buf
= css_buf
;
15303 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15305 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15307 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15309 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15311 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15312 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15314 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15316 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15318 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15319 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15321 data
.root_css_buf
= root_css_buf
;
15322 data
.markov_css_buf
= markov_css_buf
;
15324 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15326 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15328 local_free (root_table_buf
);
15329 local_free (markov_table_buf
);
15333 uint css_cnt_l
= css_cnt
;
15336 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15338 if (save_css_cnt
< 6)
15342 else if (save_css_cnt
== 6)
15348 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15350 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15361 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15376 /* unfinished code?
15377 int sum = css_buf[css_cnt_r - 1].cs_len;
15379 for (uint i = 1; i < 4 && i < css_cnt; i++)
15381 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15385 sum *= css_buf[css_cnt_r - 1].cs_len;
15390 css_cnt_l
-= css_cnt_r
;
15392 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15394 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15396 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15398 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15399 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15400 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15402 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15403 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15404 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15405 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15406 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15407 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15409 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15410 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15411 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15412 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15414 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15415 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15416 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15418 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15419 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15420 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15421 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15422 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15424 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
]);
15425 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
]);
15426 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
]);
15428 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
]);
15429 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
]);
15430 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
]);
15432 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
);
15433 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
);
15437 uint64_t words_base
= data
.words_cnt
;
15439 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15441 if (data
.gpu_rules_cnt
)
15443 words_base
/= data
.gpu_rules_cnt
;
15446 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15448 if (data
.combs_cnt
)
15450 words_base
/= data
.combs_cnt
;
15453 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15457 words_base
/= data
.bfs_cnt
;
15461 data
.words_base
= words_base
;
15465 log_info ("%llu", (unsigned long long int) words_base
);
15470 if (data
.words_cur
> data
.words_base
)
15472 log_error ("ERROR: restore value greater keyspace");
15477 if (data
.words_cur
)
15479 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15481 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15483 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15486 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15488 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15490 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15493 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15495 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15497 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15503 * Inform user about possible slow speeds
15506 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15508 if (data
.words_base
< gpu_blocks_all
)
15513 log_info ("ATTENTION!");
15514 log_info (" The wordlist or mask you are using is too small.");
15515 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15516 log_info (" The cracking speed will drop.");
15517 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15524 * Update loopback file
15533 uint random_num
= get_random_num (0, 9999);
15535 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15537 data
.loopback_file
= loopback_file
;
15541 * Update dictionary statistic
15546 dictstat_fp
= fopen (dictstat
, "wb");
15550 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15552 fclose (dictstat_fp
);
15556 data
.devices_status
= STATUS_RUNNING
;
15558 if (initial_restore_done
== 0)
15560 if (data
.restore_disable
== 0) cycle_restore ();
15562 initial_restore_done
= 1;
15565 hc_timer_set (&data
.timer_running
);
15567 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15569 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15571 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15572 if (quiet
== 0) fflush (stdout
);
15575 else if (wordlist_mode
== WL_MODE_STDIN
)
15577 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15578 if (data
.quiet
== 0) log_info ("");
15581 time_t runtime_start
;
15583 time (&runtime_start
);
15585 data
.runtime_start
= runtime_start
;
15588 * create cracker threads
15591 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15593 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15595 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15597 device_param
->device_id
= device_id
;
15599 if (wordlist_mode
== WL_MODE_STDIN
)
15601 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15605 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15609 // wait for crack threads to exit
15611 hc_thread_wait (devices_cnt
, c_threads
);
15613 local_free (c_threads
);
15619 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15621 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15623 if (data
.devices_status
== STATUS_CRACKED
) break;
15624 if (data
.devices_status
== STATUS_ABORTED
) break;
15626 if (data
.devices_status
== STATUS_BYPASS
)
15628 data
.devices_status
= STATUS_RUNNING
;
15631 if (induction_dictionaries_cnt
)
15633 unlink (induction_dictionaries
[0]);
15636 free (induction_dictionaries
);
15638 if (attack_mode
!= ATTACK_MODE_BF
)
15640 induction_dictionaries
= scan_directory (induction_directory
);
15642 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15645 if (benchmark
== 0)
15647 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15649 if (quiet
== 0) clear_prompt ();
15651 if (quiet
== 0) log_info ("");
15659 if (quiet
== 0) status_display ();
15662 if (quiet
== 0) log_info ("");
15666 if (attack_mode
== ATTACK_MODE_BF
)
15670 rd
->dictpos
= dictpos
;
15674 if (induction_dictionaries_cnt
)
15676 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15682 rd
->dictpos
= dictpos
;
15686 time_t runtime_stop
;
15688 time (&runtime_stop
);
15690 data
.runtime_stop
= runtime_stop
;
15692 logfile_sub_uint (runtime_start
);
15693 logfile_sub_uint (runtime_stop
);
15695 logfile_sub_msg ("STOP");
15697 global_free (subid
);
15700 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15702 if (data
.devices_status
== STATUS_CRACKED
) break;
15703 if (data
.devices_status
== STATUS_ABORTED
) break;
15704 if (data
.devices_status
== STATUS_QUIT
) break;
15706 if (data
.devices_status
== STATUS_BYPASS
)
15708 data
.devices_status
= STATUS_RUNNING
;
15712 // 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
15714 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15716 if (data
.wordlist_mode
== WL_MODE_FILE
)
15718 if (data
.dictfile
== NULL
)
15720 if (dictfiles
!= NULL
)
15722 data
.dictfile
= dictfiles
[0];
15724 hc_timer_set (&data
.timer_running
);
15729 // NOTE: combi is okay because it is already set beforehand
15730 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15732 if (data
.dictfile
== NULL
)
15734 if (dictfiles
!= NULL
)
15736 hc_timer_set (&data
.timer_running
);
15738 data
.dictfile
= dictfiles
[0];
15742 else if (attack_mode
== ATTACK_MODE_BF
)
15744 if (data
.mask
== NULL
)
15746 hc_timer_set (&data
.timer_running
);
15748 data
.mask
= masks
[0];
15752 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15754 data
.devices_status
= STATUS_EXHAUSTED
;
15757 // if cracked / aborted remove last induction dictionary
15759 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15761 struct stat induct_stat
;
15763 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15765 unlink (induction_dictionaries
[file_pos
]);
15769 // wait for non-interactive threads
15771 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15773 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15776 local_free (ni_threads
);
15778 // wait for interactive threads
15780 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15782 hc_thread_wait (1, &i_thread
);
15785 // we dont need restore file anymore
15786 if (data
.restore_disable
== 0)
15788 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15790 unlink (eff_restore_file
);
15791 unlink (new_restore_file
);
15799 // finally save left hashes
15801 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15810 if (benchmark
== 1)
15812 status_benchmark ();
15818 if (quiet
== 0) clear_prompt ();
15820 if (quiet
== 0) log_info ("");
15828 if (quiet
== 0) status_display ();
15831 if (quiet
== 0) log_info ("");
15834 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15836 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15838 local_free (device_param
->result
);
15840 local_free (device_param
->pw_caches
);
15842 local_free (device_param
->combs_buf
);
15844 local_free (device_param
->hooks_buf
);
15846 local_free (device_param
->device_name
);
15848 local_free (device_param
->device_version
);
15850 local_free (device_param
->driver_version
);
15852 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
15853 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
15854 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
15855 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
15856 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
15857 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
15858 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
15859 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
15860 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
15861 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
15862 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
15863 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
15864 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
15865 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
15866 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
15867 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
15868 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
15869 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
15870 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
15871 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
15872 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
15873 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
15874 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
15875 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
15876 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
15877 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
15878 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
15879 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
15881 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
15882 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
15883 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
15884 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
15885 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
15886 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
15887 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
15888 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
15890 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
15891 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
15892 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
15893 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
15896 // reset default fan speed
15898 if (gpu_temp_disable
== 0)
15900 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
15902 hc_thread_mutex_lock (mux_adl
);
15904 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
15906 if (data
.hm_device
[i
].fan_supported
== 1)
15908 int fanspeed
= temp_retain_fanspeed_value
[i
];
15910 if (fanspeed
== -1) continue;
15912 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
15914 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
15918 hc_thread_mutex_unlock (mux_adl
);
15922 // reset power tuning
15924 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
15926 hc_thread_mutex_lock (mux_adl
);
15928 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
15930 if (data
.hm_device
[i
].od_version
== 6)
15932 // check powertune capabilities first, if not available then skip device
15934 int powertune_supported
= 0;
15936 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
15938 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
15943 if (powertune_supported
!= 0)
15945 // powercontrol settings
15947 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
15949 log_info ("ERROR: Failed to restore the ADL PowerControl values");
15956 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
15958 performance_state
->iNumberOfPerformanceLevels
= 2;
15960 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
15961 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
15962 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
15963 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
15965 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
15967 log_info ("ERROR: Failed to restore ADL performance state");
15972 local_free (performance_state
);
15977 hc_thread_mutex_unlock (mux_adl
);
15980 if (gpu_temp_disable
== 0)
15982 if (vendor_id
== VENDOR_ID_NV
)
15985 hc_NVML_nvmlShutdown (data
.hm_dll
);
15993 if (vendor_id
== VENDOR_ID_AMD
)
15995 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
15997 hm_close (data
.hm_dll
);
16001 if (vendor_id
== VENDOR_ID_NV
)
16003 hm_close (data
.hm_dll
);
16010 local_free (masks
);
16012 local_free (dictstat_base
);
16014 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16016 pot_t
*pot_ptr
= &pot
[pot_pos
];
16018 hash_t
*hash
= &pot_ptr
->hash
;
16020 local_free (hash
->digest
);
16024 local_free (hash
->salt
);
16030 local_free (all_gpu_rules_cnt
);
16031 local_free (all_gpu_rules_buf
);
16033 local_free (wl_data
->buf
);
16034 local_free (wl_data
);
16036 local_free (bitmap_s1_a
);
16037 local_free (bitmap_s1_b
);
16038 local_free (bitmap_s1_c
);
16039 local_free (bitmap_s1_d
);
16040 local_free (bitmap_s2_a
);
16041 local_free (bitmap_s2_b
);
16042 local_free (bitmap_s2_c
);
16043 local_free (bitmap_s2_d
);
16045 local_free (temp_retain_fanspeed_value
);
16046 local_free (od_clock_mem_status
);
16047 local_free (od_power_control_status
);
16049 global_free (devices_param
);
16051 global_free (gpu_rules_buf
);
16053 global_free (root_css_buf
);
16054 global_free (markov_css_buf
);
16056 global_free (digests_buf
);
16057 global_free (digests_shown
);
16058 global_free (digests_shown_tmp
);
16060 global_free (salts_buf
);
16061 global_free (salts_shown
);
16063 global_free (esalts_buf
);
16065 global_free (words_progress_done
);
16066 global_free (words_progress_rejected
);
16067 global_free (words_progress_restored
);
16069 if (pot_fp
) fclose (pot_fp
);
16071 if (data
.devices_status
== STATUS_QUIT
) break;
16074 // destroy others mutex
16076 hc_thread_mutex_delete (mux_dispatcher
);
16077 hc_thread_mutex_delete (mux_counter
);
16078 hc_thread_mutex_delete (mux_display
);
16079 hc_thread_mutex_delete (mux_adl
);
16083 local_free (eff_restore_file
);
16084 local_free (new_restore_file
);
16090 local_free (loopback_file
);
16092 if (loopback
== 1) unlink (loopback_file
);
16094 // induction directory
16096 if (induction_dir
== NULL
)
16098 if (attack_mode
!= ATTACK_MODE_BF
)
16100 if (rmdir (induction_directory
) == -1)
16102 if (errno
== ENOENT
)
16104 // good, we can ignore
16106 else if (errno
== ENOTEMPTY
)
16108 // good, we can ignore
16112 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16118 local_free (induction_directory
);
16122 // outfile-check directory
16124 if (outfile_check_dir
== NULL
)
16126 if (rmdir (outfile_check_directory
) == -1)
16128 if (errno
== ENOENT
)
16130 // good, we can ignore
16132 else if (errno
== ENOTEMPTY
)
16134 // good, we can ignore
16138 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16144 local_free (outfile_check_directory
);
16151 logfile_top_uint (proc_start
);
16152 logfile_top_uint (proc_stop
);
16154 logfile_top_msg ("STOP");
16156 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16157 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16159 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16160 if (data
.devices_status
== STATUS_QUIT
) return 2;
16161 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16162 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16163 if (data
.devices_status
== STATUS_CRACKED
) return 0;