2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include <rp_gpu_on_cpu.h>
11 const char *PROGNAME
= "oclHashcat";
12 const char *VERSION_TXT
= "2.01";
13 const uint VERSION_BIN
= 201;
14 const uint RESTORE_MIN
= 201;
16 #define INCR_RULES 10000
17 #define INCR_SALTS 100000
18 #define INCR_MASKS 1000
21 // comment-out for kernel source mode
23 //#define BINARY_KERNEL
28 #define MARKOV_THRESHOLD 0
29 #define MARKOV_DISABLE 0
30 #define MARKOV_CLASSIC 0
32 #define BENCHMARK_MODE 1
34 #define RESTORE_TIMER 60
35 #define RESTORE_DISABLE 0
37 #define STATUS_TIMER 10
38 #define STATUS_AUTOMAT 0
40 #define WEAK_HASH_THRESHOLD 100
45 #define REMOVE_TIMER 60
49 #define POTFILE_DISABLE 0
52 #define RP_GEN_FUNC_MIN 1
53 #define RP_GEN_FUNC_MAX 4
55 #define RULE_BUF_L ":"
56 #define RULE_BUF_R ":"
61 #define HEX_WORDLIST 0
62 #define OUTFILE_FORMAT 3
63 #define OUTFILE_AUTOHEX 1
64 #define OUTFILE_CHECK_TIMER 5
67 #define SEGMENT_SIZE 32
69 #define INCREMENT_MIN 1
70 #define INCREMENT_MAX PW_MAX
74 #define GPU_TEMP_DISABLE 0
75 #define GPU_TEMP_ABORT 90
76 #define GPU_TEMP_RETAIN 80
77 #define WORKLOAD_PROFILE 2
80 #define GPU_RULES 1024
81 #define GPU_COMBS 1024
83 #define GPU_THREADS 64
84 #define POWERTUNE_ENABLE 0
85 #define LOGFILE_DISABLE 0
88 #define WL_MODE_STDIN 1
89 #define WL_MODE_FILE 2
90 #define WL_MODE_MASK 3
92 #define HL_MODE_FILE 4
95 #define HLFMT_HASHCAT 0
96 #define HLFMT_PWDUMP 1
97 #define HLFMT_PASSWD 2
98 #define HLFMT_SHADOW 3
101 #define HLFMT_NETNTLM1 7
102 #define HLFMT_NETNTLM2 8
103 #define HLFMT_NSLDAP 9
104 #define HLFMT_NSLDAPS 10
105 #define HLFMTS_CNT 11
107 #define ATTACK_MODE_STRAIGHT 0
108 #define ATTACK_MODE_COMBI 1
109 #define ATTACK_MODE_TOGGLE 2
110 #define ATTACK_MODE_BF 3
111 #define ATTACK_MODE_PERM 4
112 #define ATTACK_MODE_TABLE 5
113 #define ATTACK_MODE_HYBRID1 6
114 #define ATTACK_MODE_HYBRID2 7
115 #define ATTACK_MODE_NONE 100
117 #define ATTACK_KERN_STRAIGHT 0
118 #define ATTACK_KERN_COMBI 1
119 #define ATTACK_KERN_BF 3
120 #define ATTACK_KERN_NONE 100
122 #define ATTACK_EXEC_ON_CPU 10
123 #define ATTACK_EXEC_ON_GPU 11
125 #define COMBINATOR_MODE_BASE_LEFT 10001
126 #define COMBINATOR_MODE_BASE_RIGHT 10002
128 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
129 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
131 #define MAX_CUT_TRIES 4
133 #define MAX_DICTSTAT 10000
135 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 128
137 #define global_free(attr) \
139 myfree ((void *) data.attr); \
144 #define local_free(attr) \
146 myfree ((void *) attr); \
151 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
287 static void (*get_next_word_func
) (char *, uint32_t, uint32_t *, uint32_t *);
293 static unsigned int full01
= 0x01010101;
294 static unsigned int full80
= 0x80808080;
296 int SUPPRESS_OUTPUT
= 0;
298 hc_thread_mutex_t mux_adl
;
299 hc_thread_mutex_t mux_counter
;
300 hc_thread_mutex_t mux_dispatcher
;
301 hc_thread_mutex_t mux_display
;
303 hc_global_data_t data
;
305 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
307 const char *USAGE_MINI
[] =
309 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
311 "Try --help for more help.",
315 const char *USAGE_BIG
[] =
317 "%s, advanced password recovery",
319 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
327 " -m, --hash-type=NUM Hash-type, see references below",
328 " -a, --attack-mode=NUM Attack-mode, see references below",
329 " -V, --version Print version",
330 " -h, --help Print help",
331 " --quiet Suppress output",
335 " -b, --benchmark Run benchmark",
336 " --benchmark-mode=NUM Benchmark-mode, see references below",
340 " --hex-charset Assume charset is given in hex",
341 " --hex-salt Assume salt is given in hex",
342 " --hex-wordlist Assume words in wordlist is given in hex",
343 " --force Ignore warnings",
344 " --status Enable automatic update of the status-screen",
345 " --status-timer=NUM Seconds between status-screen update",
346 " --status-automat Display the status view in a machine readable format",
347 " --loopback Add new plains to induct directory",
348 " --weak-hash-threshold=NUM Threshold when to stop checking for weak hashes, default is 100 salts",
352 " --markov-hcstat=FILE Specify hcstat file to use, default is hashcat.hcstat",
353 " --markov-disable Disables markov-chains, emulates classic brute-force",
354 " --markov-classic Enables classic markov-chains, no per-position enhancement",
355 " -t, --markov-threshold=NUM Threshold when to stop accepting new markov-chains",
359 " --runtime=NUM Abort session after NUM seconds of runtime",
360 " --session=STR Define specific session name",
361 " --restore Restore session from --session",
362 " --restore-disable Do not write restore file",
366 " -o, --outfile=FILE Define outfile for recovered hash",
367 " --outfile-format=NUM Define outfile-format for recovered hash, see references below",
368 " --outfile-autohex-disable Disable the use of $HEX[] in output plains",
369 " --outfile-check-timer=NUM Seconds between outfile checks",
370 " -p, --separator=CHAR Separator char for hashlists and outfile",
371 " --show Show cracked passwords only",
372 " --left Show un-cracked passwords only",
373 " --username Enable ignoring of usernames in hashfile (recommended: also use --show)",
374 " --remove Enable remove of hash once it is cracked",
375 " --remove-timer=NUM Update input hash file each NUM seconds",
376 " --potfile-disable Do not write potfile",
377 " --debug-mode=NUM Defines the debug mode (hybrid only by using rules), see references below",
378 " --debug-file=FILE Output file for debugging rules (see also --debug-mode)",
379 " --induction-dir=FOLDER Specify induction directory to use, default is $session.induct",
380 " --outfile-check-dir=FOLDER Specify the outfile directory which should be monitored, default is $session.outfiles",
381 " --logfile-disable Disable the logfile",
382 " --truecrypt-keyfiles=FILE Keyfiles used, seperate with comma",
386 " -c, --segment-size=NUM Size in MB to cache from the wordfile",
387 " --bitmap-min=NUM Minimum number of bits allowed for bitmaps",
388 " --bitmap-max=NUM Maximum number of bits allowed for bitmaps",
389 " --cpu-affinity=STR Locks to CPU devices, seperate with comma",
390 " -d, --gpu-devices=STR Devices to use, separate with comma",
391 " -w, --workload-profile=NUM Enable a specific workload profile, see references below",
392 " -n, --gpu-accel=NUM Workload tuning: 1, 8, 40, 80, 160",
393 " -u, --gpu-loops=NUM Workload fine-tuning: 8 - 1024",
394 " --gpu-temp-disable Disable temperature and fanspeed readings and triggers",
395 " --gpu-temp-abort=NUM Abort session if GPU temperature reaches NUM degrees celsius",
396 " --gpu-temp-retain=NUM Try to retain GPU temperature at NUM degrees celsius (AMD only)",
397 " --powertune-enable Enable automatic power tuning option (AMD OverDrive 6 only)",
398 " --scrypt-tmto=NUM Manually override automatically calculated TMTO value for scrypt",
402 " -s, --skip=NUM Skip number of words",
403 " -l, --limit=NUM Limit number of words",
404 " --keyspace Show keyspace base:mod values and quit",
408 " -j, --rule-left=RULE Single rule applied to each word from left dict",
409 " -k, --rule-right=RULE Single rule applied to each word from right dict",
410 " -r, --rules-file=FILE Rules-file, multi use: -r 1.rule -r 2.rule",
411 " -g, --generate-rules=NUM Generate NUM random rules",
412 " --generate-rules-func-min=NUM Force NUM functions per random rule min",
413 " --generate-rules-func-max=NUM Force NUM functions per random rule max",
414 " --generate-rules-seed=NUM Force RNG seed to NUM",
416 "* Custom charsets:",
418 " -1, --custom-charset1=CS User-defined charsets",
419 " -2, --custom-charset2=CS Example:",
420 " -3, --custom-charset3=CS --custom-charset1=?dabcdef : sets charset ?1 to 0123456789abcdef",
421 " -4, --custom-charset4=CS -2 mycharset.hcchr : sets charset ?2 to chars contained in file",
425 " -i, --increment Enable increment mode",
426 " --increment-min=NUM Start incrementing at NUM",
427 " --increment-max=NUM Stop incrementing at NUM",
433 "* Workload Profile:",
435 " 1 = Reduced performance profile (low latency desktop)",
436 " 2 = Default performance profile",
437 " 3 = Tuned performance profile (high latency desktop)",
439 "* Benchmark Settings:",
441 " 0 = Manual Tuning",
442 " 1 = Performance Tuning, default",
444 "* Outfile Formats:",
448 " 3 = hash[:salt]:plain",
450 " 5 = hash[:salt]:hex_plain",
451 " 6 = plain:hex_plain",
452 " 7 = hash[:salt]:plain:hex_plain",
454 " 9 = hash[:salt]:crackpos",
455 " 10 = plain:crackpos",
456 " 11 = hash[:salt]:plain:crackpos",
457 " 12 = hex_plain:crackpos",
458 " 13 = hash[:salt]:hex_plain:crackpos",
459 " 14 = plain:hex_plain:crackpos",
460 " 15 = hash[:salt]:plain:hex_plain:crackpos",
462 "* Debug mode output formats (for hybrid mode only, by using rules):",
464 " 1 = save finding rule",
465 " 2 = save original word",
466 " 3 = save original word and finding rule",
467 " 4 = save original word, finding rule and modified plain",
469 "* Built-in charsets:",
471 " ?l = abcdefghijklmnopqrstuvwxyz",
472 " ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ",
474 " ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
483 " 6 = Hybrid dict + mask",
484 " 7 = Hybrid mask + dict",
488 "[[ Roll-your-own: Raw Hashes ]]",
497 " 5000 = SHA-3(Keccak)",
501 " 6900 = GOST R 34.11-94",
502 " 11700 = GOST R 34.11-2012 (Streebog) 256-bit",
503 " 11800 = GOST R 34.11-2012 (Streebog) 512-bit",
505 "[[ Roll-your-own: Iterated and / or Salted Hashes ]]",
507 " 10 = md5($pass.$salt)",
508 " 20 = md5($salt.$pass)",
509 " 30 = md5(unicode($pass).$salt)",
510 " 40 = md5($salt.unicode($pass))",
511 " 3800 = md5($salt.$pass.$salt)",
512 " 3710 = md5($salt.md5($pass))",
513 " 2600 = md5(md5($pass)",
514 " 4300 = md5(strtoupper(md5($pass)))",
515 " 4400 = md5(sha1($pass))",
516 " 110 = sha1($pass.$salt)",
517 " 120 = sha1($salt.$pass)",
518 " 130 = sha1(unicode($pass).$salt)",
519 " 140 = sha1($salt.unicode($pass))",
520 " 4500 = sha1(sha1($pass)",
521 " 4700 = sha1(md5($pass))",
522 " 4900 = sha1($salt.$pass.$salt)",
523 " 1410 = sha256($pass.$salt)",
524 " 1420 = sha256($salt.$pass)",
525 " 1430 = sha256(unicode($pass).$salt)",
526 " 1440 = sha256($salt.unicode($pass))",
527 " 1710 = sha512($pass.$salt)",
528 " 1720 = sha512($salt.$pass)",
529 " 1730 = sha512(unicode($pass).$salt)",
530 " 1740 = sha512($salt.unicode($pass))",
532 "[[ Roll-your-own: Authenticated Hashes ]]",
534 " 50 = HMAC-MD5 (key = $pass)",
535 " 60 = HMAC-MD5 (key = $salt)",
536 " 150 = HMAC-SHA1 (key = $pass)",
537 " 160 = HMAC-SHA1 (key = $salt)",
538 " 1450 = HMAC-SHA256 (key = $pass)",
539 " 1460 = HMAC-SHA256 (key = $salt)",
540 " 1750 = HMAC-SHA512 (key = $pass)",
541 " 1760 = HMAC-SHA512 (key = $salt)",
547 " 11900 = PBKDF2-HMAC-MD5",
548 " 12000 = PBKDF2-HMAC-SHA1",
549 " 10900 = PBKDF2-HMAC-SHA256",
550 " 12100 = PBKDF2-HMAC-SHA512",
552 "[[ Network protocols, Challenge-Response ]]",
556 " 4800 = iSCSI CHAP authentication, MD5(Chap)",
557 " 5300 = IKE-PSK MD5",
558 " 5400 = IKE-PSK SHA1",
560 " 5500 = NetNTLMv1 + ESS",
562 " 7300 = IPMI2 RAKP HMAC-SHA1",
563 " 7500 = Kerberos 5 AS-REQ Pre-Auth etype 23",
564 " 8300 = DNSSEC (NSEC3)",
566 " 11100 = PostgreSQL Challenge-Response Authentication (MD5)",
567 " 11200 = MySQL Challenge-Response Authentication (SHA1)",
568 " 11400 = SIP digest authentication (MD5)",
570 "[[ Forums, CMS, E-Commerce, Frameworks, Middleware, Wiki, Management ]]",
572 " 121 = SMF (Simple Machines Forum)",
574 " 2611 = vBulletin < v3.8.5",
575 " 2711 = vBulletin > v3.8.5",
577 " 2811 = IPB (Invison Power Board)",
578 " 8400 = WBB3 (Woltlab Burning Board)",
579 " 11 = Joomla < 2.5.18",
580 " 400 = Joomla > 2.5.18",
586 " 11000 = PrestaShop",
587 " 124 = Django (SHA-1)",
588 " 10000 = Django (PBKDF2-SHA256)",
589 " 3711 = Mediawiki B type",
592 "[[ Database Server ]]",
595 " 131 = MSSQL(2000)",
596 " 132 = MSSQL(2005)",
597 " 1731 = MSSQL(2012)",
598 " 1731 = MSSQL(2014)",
600 " 300 = MySQL4.1/MySQL5",
601 " 3100 = Oracle H: Type (Oracle 7+)",
602 " 112 = Oracle S: Type (Oracle 11+)",
603 " 12300 = Oracle T: Type (Oracle 12+)",
604 " 8000 = Sybase ASE",
606 "[[ HTTP, SMTP, LDAP Server]]",
608 " 141 = EPiServer 6.x < v4",
609 " 1441 = EPiServer 6.x > v4",
610 " 1600 = Apache $apr1$",
611 " 12600 = ColdFusion 10+",
612 " 1421 = hMailServer",
613 " 101 = nsldap, SHA-1(Base64), Netscape LDAP SHA",
614 " 111 = nsldaps, SSHA-1(Base64), Netscape LDAP SSHA",
615 " 1711 = SSHA-512(Base64), LDAP {SSHA512}",
621 "[[ Operating-Systems ]]",
625 " 1100 = Domain Cached Credentials (DCC), MS Cache",
626 " 2100 = Domain Cached Credentials 2 (DCC2), MS Cache 2",
627 " 12800 = MS-AzureSync PBKDF2-HMAC-SHA256",
628 " 1500 = descrypt, DES(Unix), Traditional DES",
629 " 12400 = BSDiCrypt, Extended DES",
630 " 500 = md5crypt $1$, MD5(Unix)",
631 " 3200 = bcrypt $2*$, Blowfish(Unix)",
632 " 7400 = sha256crypt $5$, SHA256(Unix)",
633 " 1800 = sha512crypt $6$, SHA512(Unix)",
640 " 7100 = OSX v10.10",
641 " 6300 = AIX {smd5}",
642 " 6700 = AIX {ssha1}",
643 " 6400 = AIX {ssha256}",
644 " 6500 = AIX {ssha512}",
647 " 500 = Cisco-IOS $1$",
648 " 5700 = Cisco-IOS $4$",
649 " 9200 = Cisco-IOS $8$",
650 " 9300 = Cisco-IOS $9$",
651 " 22 = Juniper Netscreen/SSG (ScreenOS)",
652 " 501 = Juniper IVE",
653 " 5800 = Android PIN",
654 " 8100 = Citrix Netscaler",
659 "[[ Enterprise Application Software (EAS) ]]",
661 " 7700 = SAP CODVN B (BCODE)",
662 " 7800 = SAP CODVN F/G (PASSCODE)",
663 " 10300 = SAP CODVN H (PWDSALTEDHASH) iSSHA-1",
664 " 8600 = Lotus Notes/Domino 5",
665 " 8700 = Lotus Notes/Domino 6",
666 " 9100 = Lotus Notes/Domino 8",
674 "[[ Full-Disk encryptions (FDE) ]]",
676 " 62XY = TrueCrypt 5.0+",
677 " X = 1 = PBKDF2-HMAC-RipeMD160",
678 " X = 2 = PBKDF2-HMAC-SHA512",
679 " X = 3 = PBKDF2-HMAC-Whirlpool",
680 " X = 4 = PBKDF2-HMAC-RipeMD160 + boot-mode",
681 " Y = 1 = XTS 512 bit (Ciphers: AES or Serpent or Twofish)",
682 " Y = 2 = XTS 1024 bit (Ciphers: AES or Serpent or Twofish or AES-Twofish or Serpent-AES or Twofish-Serpent)",
683 " Y = 3 = XTS 1536 bit (Ciphers: All)",
684 " 8800 = Android FDE < v4.3",
689 " 9700 = MS Office <= 2003 MD5 + RC4, oldoffice$0, oldoffice$1",
690 " 9710 = MS Office <= 2003 MD5 + RC4, collider-mode #1",
691 " 9720 = MS Office <= 2003 MD5 + RC4, collider-mode #2",
692 " 9800 = MS Office <= 2003 SHA1 + RC4, oldoffice$3, oldoffice$4",
693 " 9810 = MS Office <= 2003 SHA1 + RC4, collider-mode #1",
694 " 9820 = MS Office <= 2003 SHA1 + RC4, collider-mode #2",
695 " 9400 = MS Office 2007",
696 " 9500 = MS Office 2010",
697 " 9600 = MS Office 2013",
698 " 10400 = PDF 1.1 - 1.3 (Acrobat 2 - 4)",
699 " 10410 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #1",
700 " 10420 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #2",
701 " 10500 = PDF 1.4 - 1.6 (Acrobat 5 - 8)",
702 " 10600 = PDF 1.7 Level 3 (Acrobat 9)",
703 " 10700 = PDF 1.7 Level 8 (Acrobat 10 - 11)",
705 "[[ Password Managers ]]",
707 " 9000 = Password Safe v2",
708 " 5200 = Password Safe v3",
710 " 6600 = 1Password, agilekeychain",
711 " 8200 = 1Password, cloudkeychain",
712 " 11300 = Bitcoin/Litecoin wallet.dat",
713 " 12700 = Blockchain, My Wallet",
719 * oclHashcat specific functions
722 void status_display_automat ()
726 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
732 fprintf (out
, "SPEED\t");
734 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
736 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
738 uint64_t speed_cnt
= 0;
741 for (int i
= 0; i
< SPEED_CACHE
; i
++)
745 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
747 if (rec_ms
> SPEED_MAXAGE
) continue;
749 speed_cnt
+= device_param
->speed_cnt
[i
];
750 speed_ms
+= device_param
->speed_ms
[i
];
753 speed_cnt
/= SPEED_CACHE
;
754 speed_ms
/= SPEED_CACHE
;
756 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
763 uint64_t words_cur
= get_lowest_words_done ();
765 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
771 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
773 if (salts_left
== 0) salts_left
= 1;
775 uint64_t progress_total
= data
.words_cnt
* salts_left
;
777 uint64_t all_done
= 0;
778 uint64_t all_rejected
= 0;
779 uint64_t all_restored
= 0;
781 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
785 // otherwise the final cracked status shows 0/XXX progress
787 if (data
.salts_shown
[salt_pos
] == 1) continue;
790 all_done
+= data
.words_progress_done
[salt_pos
];
791 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
792 all_restored
+= data
.words_progress_restored
[salt_pos
];
795 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
796 uint64_t progress_end
= progress_total
;
798 uint64_t progress_skip
= 0;
802 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
804 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
805 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
806 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
811 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
813 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
814 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
815 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
818 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
819 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
821 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
827 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
828 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
834 if (data
.gpu_temp_disable
== 0)
836 fprintf (out
, "TEMP\t");
838 hc_thread_mutex_lock (mux_adl
);
840 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
842 int temp
= hm_get_temperature_with_device_id (i
);
844 fprintf (out
, "%d\t", temp
);
847 hc_thread_mutex_unlock (mux_adl
);
862 void status_display ()
864 if (data
.devices_status
== STATUS_INIT
) return;
865 if (data
.devices_status
== STATUS_STARTING
) return;
866 if (data
.devices_status
== STATUS_BYPASS
) return;
868 if (data
.status_automat
== 1)
870 status_display_automat ();
879 log_info ("Session.Name...: %s", data
.session
);
881 char *status_type
= strstatus (data
.devices_status
);
883 uint hash_mode
= data
.hash_mode
;
885 char *hash_type
= strhashtype (hash_mode
); // not a bug
887 log_info ("Status.........: %s", status_type
);
893 if (data
.rp_files_cnt
)
897 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
899 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
902 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
904 log_info ("Rules.Type.....: %s", tmp_buf
);
911 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
913 if (data
.rp_gen_seed
)
915 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
923 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
925 if (data
.wordlist_mode
== WL_MODE_FILE
)
927 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
929 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
931 log_info ("Input.Mode.....: Pipe");
934 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
936 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
937 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
939 else if (data
.attack_mode
== ATTACK_MODE_BF
)
941 char *mask
= data
.mask
;
945 uint mask_len
= data
.css_cnt
;
947 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
951 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
953 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
955 mask_len
-= data
.salts_buf
[0].salt_len
;
959 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
961 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
964 if (data
.maskcnt
> 1)
966 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
968 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
971 log_info ("Input.Mode.....: %s", tmp_buf
);
976 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
978 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
979 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
981 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
983 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
984 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
987 if (data
.digests_cnt
== 1)
989 if (data
.hash_mode
== 2500)
991 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
995 char *pke_ptr
= (char *) pke
;
997 for (uint i
= 0; i
< 25; i
++)
999 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
1005 memcpy (mac1
, pke_ptr
+ 23, 6);
1006 memcpy (mac2
, pke_ptr
+ 29, 6);
1008 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1009 (char *) data
.salts_buf
[0].salt_buf
,
1023 else if (data
.hash_mode
== 5200)
1025 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1027 else if (data
.hash_mode
== 9000)
1029 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1031 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1033 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1039 ascii_digest (out_buf
, 0, 0);
1042 if (strlen (out_buf
) > 40)
1050 log_info ("Hash.Target....: %s", out_buf
);
1055 if (data
.hash_mode
== 3000)
1057 char out_buf1
[4096];
1058 char out_buf2
[4096];
1060 ascii_digest (out_buf1
, 0, 0);
1061 ascii_digest (out_buf2
, 0, 1);
1063 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1067 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1071 log_info ("Hash.Type......: %s", hash_type
);
1077 uint64_t speed_cnt
[DEVICES_MAX
];
1078 float speed_ms
[DEVICES_MAX
];
1080 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1082 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1084 // we need to clear values (set to 0) because in case the gpu does
1085 // not get new candidates it idles around but speed display would
1086 // show it as working.
1087 // if we instantly set it to 0 after reading it happens that the
1088 // speed can be shown as zero if the users refreshs to fast.
1089 // therefore, we add a timestamp when a stat was recorded and if its
1090 // to old we will not use it
1092 speed_cnt
[device_id
] = 0;
1093 speed_ms
[device_id
] = 0;
1095 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1099 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
1101 if (rec_ms
> SPEED_MAXAGE
) continue;
1103 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1104 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1107 speed_cnt
[device_id
] /= SPEED_CACHE
;
1108 speed_ms
[device_id
] /= SPEED_CACHE
;
1111 float hashes_all_ms
= 0;
1113 float hashes_dev_ms
[DEVICES_MAX
];
1115 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1117 hashes_dev_ms
[device_id
] = 0;
1119 if (speed_ms
[device_id
])
1121 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1123 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1131 float ms_running
= 0;
1133 hc_timer_get (data
.timer_running
, ms_running
);
1135 float ms_paused
= data
.ms_paused
;
1137 if (data
.devices_status
== STATUS_PAUSED
)
1139 float ms_paused_tmp
= 0;
1141 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1143 ms_paused
+= ms_paused_tmp
;
1148 __time64_t sec_run
= ms_running
/ 1000;
1152 time_t sec_run
= ms_running
/ 1000;
1158 char display_run
[32];
1166 tmp
= _gmtime64 (&sec_run
);
1170 tmp
= gmtime (&sec_run
);
1176 memcpy (&tm_run
, tmp
, sizeof (struct tm
));
1178 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1180 char *start
= ctime (&data
.proc_start
);
1182 size_t start_len
= strlen (start
);
1184 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1185 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1187 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1192 log_info ("Time.Started...: 0 secs");
1199 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
1201 if (salts_left
== 0) salts_left
= 1;
1203 uint64_t progress_total
= data
.words_cnt
* salts_left
;
1205 uint64_t all_done
= 0;
1206 uint64_t all_rejected
= 0;
1207 uint64_t all_restored
= 0;
1209 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1213 // otherwise the final cracked status shows 0/XXX progress
1215 if (data
.salts_shown
[salt_pos
] == 1) continue;
1218 all_done
+= data
.words_progress_done
[salt_pos
];
1219 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1220 all_restored
+= data
.words_progress_restored
[salt_pos
];
1223 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
1224 uint64_t progress_end
= progress_total
;
1226 uint64_t progress_skip
= 0;
1230 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
1232 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
1233 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1234 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1239 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
1241 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
1242 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1243 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1246 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
1247 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
1249 float speed_ms_real
= ms_running
- ms_paused
;
1250 uint64_t speed_plains_real
= all_done
;
1252 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1254 if (data
.devices_status
!= STATUS_CRACKED
)
1256 uint64_t words_per_ms
= 0;
1258 if (speed_plains_real
&& speed_ms_real
)
1260 words_per_ms
= speed_plains_real
/ speed_ms_real
;
1264 __time64_t sec_etc
= 0;
1271 uint64_t progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1273 uint64_t ms_left
= progress_left_relative_skip
/ words_per_ms
;
1275 sec_etc
= ms_left
/ 1000;
1280 log_info ("Time.Estimated.: 0 secs");
1282 else if ((uint64_t) sec_etc
> ETC_MAX
)
1284 log_info ("Time.Estimated.: > 10 Years");
1288 char display_etc
[32];
1296 tmp
= _gmtime64 (&sec_etc
);
1300 tmp
= gmtime (&sec_etc
);
1306 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1308 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1316 char *etc
= ctime (&now
);
1318 size_t etc_len
= strlen (etc
);
1320 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1321 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1323 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1329 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1331 char display_dev_cur
[16];
1333 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1335 strncpy (display_dev_cur
, "0.00", 4);
1337 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1339 log_info ("Speed.GPU.#%d...: %9sH/s", device_id
+ 1, display_dev_cur
);
1342 char display_all_cur
[16];
1344 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1346 strncpy (display_all_cur
, "0.00", 4);
1348 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1350 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*...: %9sH/s", display_all_cur
);
1352 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1353 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1355 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);
1359 if (data
.digests_cnt
> 100)
1361 time_t now
= time (NULL
);
1363 int cpt_cur_min
= 0;
1364 int cpt_cur_hour
= 0;
1365 int cpt_cur_day
= 0;
1367 for (int i
= 0; i
< CPT_BUF
; i
++)
1369 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1370 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1372 if ((timestamp
+ 60) > now
)
1374 cpt_cur_min
+= cracked
;
1377 if ((timestamp
+ 3600) > now
)
1379 cpt_cur_hour
+= cracked
;
1382 if ((timestamp
+ 86400) > now
)
1384 cpt_cur_day
+= cracked
;
1388 float cpt_avg_min
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 60);
1389 float cpt_avg_hour
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 3600);
1390 float cpt_avg_day
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 86400);
1392 if ((data
.cpt_start
+ 86400) < now
)
1394 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1402 else if ((data
.cpt_start
+ 3600) < now
)
1404 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1411 else if ((data
.cpt_start
+ 60) < now
)
1413 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1421 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1430 uint64_t restore_point
= get_lowest_words_done ();
1432 uint64_t restore_total
= data
.words_base
;
1434 float percent_restore
= 0;
1436 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1438 if (progress_end_relative_skip
)
1440 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1442 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1443 float percent_rejected
= 0.0;
1447 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1450 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);
1451 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1453 if (data
.restore_disable
== 0)
1455 if (percent_finished
!= 1)
1457 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1464 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1466 log_info ("Progress.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1467 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1469 if (data
.restore_disable
== 0)
1471 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1476 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1477 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1479 // --restore not allowed if stdin is used -- really? why?
1481 //if (data.restore_disable == 0)
1483 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1488 if (data
.gpu_temp_disable
== 0)
1490 hc_thread_mutex_lock (mux_adl
);
1492 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
1494 if (data
.hm_device
[i
].fan_supported
== 1)
1496 const int temperature
= hm_get_temperature_with_device_id (i
);
1497 const int utilization
= hm_get_utilization_with_device_id (i
);
1498 const int fanspeed
= hm_get_fanspeed_with_device_id (i
);
1500 if (data
.vendor_id
== VENDOR_ID_AMD
)
1502 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1505 if (data
.vendor_id
== VENDOR_ID_NV
)
1508 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1510 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2drpm Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1516 const int temperature
= hm_get_temperature_with_device_id (i
);
1517 const int utilization
= hm_get_utilization_with_device_id (i
);
1519 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, N/A Fan", i
+ 1, utilization
, temperature
);
1523 hc_thread_mutex_unlock (mux_adl
);
1527 static void status_benchmark ()
1529 if (data
.devices_status
== STATUS_INIT
) return;
1530 if (data
.devices_status
== STATUS_STARTING
) return;
1532 if (data
.words_cnt
== 0) return;
1534 uint64_t speed_cnt
[DEVICES_MAX
];
1535 float speed_ms
[DEVICES_MAX
];
1539 for (device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1541 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1543 speed_cnt
[device_id
] = 0;
1544 speed_ms
[device_id
] = 0;
1546 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1548 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1549 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1552 speed_cnt
[device_id
] /= SPEED_CACHE
;
1553 speed_ms
[device_id
] /= SPEED_CACHE
;
1556 float hashes_all_ms
= 0;
1558 float hashes_dev_ms
[DEVICES_MAX
];
1560 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1562 hashes_dev_ms
[device_id
] = 0;
1564 if (speed_ms
[device_id
])
1566 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1568 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1572 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1574 char display_dev_cur
[16];
1576 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1578 strncpy (display_dev_cur
, "0.00", 4);
1580 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1582 log_info ("Speed.GPU.#%d.: %9sH/s", device_id
+ 1, display_dev_cur
);
1585 char display_all_cur
[16];
1587 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1589 strncpy (display_all_cur
, "0.00", 4);
1591 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1593 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*.: %9sH/s", display_all_cur
);
1597 * oclHashcat -only- functions
1600 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *kernel_file
)
1602 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1604 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1605 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a0.cl", install_dir
, (int) kern_type
);
1606 else if (attack_kern
== ATTACK_KERN_COMBI
)
1607 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a1.cl", install_dir
, (int) kern_type
);
1608 else if (attack_kern
== ATTACK_KERN_BF
)
1609 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d_a3.cl", install_dir
, (int) kern_type
);
1612 snprintf (kernel_file
, 255, "%s/OpenCL/m%05d.cl", install_dir
, (int) kern_type
);
1615 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1617 if (line_len
& 1) return (line_len
); // not in hex
1619 if (data
.hex_wordlist
== 1)
1624 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1626 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1629 memset (line_buf
+ i
, 0, line_len
- i
);
1633 else if (line_len
>= 6) // $HEX[] = 6
1635 if (line_buf
[0] != '$') return (line_len
);
1636 if (line_buf
[1] != 'H') return (line_len
);
1637 if (line_buf
[2] != 'E') return (line_len
);
1638 if (line_buf
[3] != 'X') return (line_len
);
1639 if (line_buf
[4] != '[') return (line_len
);
1640 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1645 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1647 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1650 memset (line_buf
+ i
, 0, line_len
- i
);
1658 static uint
count_lines (FILE *fd
)
1662 char *buf
= (char *) mymalloc (BUFSIZ
);
1664 size_t nread_tmp
= 0;
1670 size_t nread
= fread (buf
, sizeof (char), BUFSIZ
, fd
);
1673 if (nread
< 1) continue;
1679 if (*ptr
++ == '\n') cnt
++;
1684 // special case (if last line did not contain a newline char ... at the very end of the file)
1694 if (*ptr
!= '\n') // needed ? different on windows systems?
1706 static void clear_prompt ()
1708 fputc ('\r', stdout
);
1710 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1712 fputc (' ', stdout
);
1715 fputc ('\r', stdout
);
1720 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const uint64_t gidd
, pw_t
*pw
)
1722 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1725 static void check_hash (hc_device_param_t
*device_param
, const uint salt_pos
, const uint digest_pos
)
1727 char *outfile
= data
.outfile
;
1728 uint quiet
= data
.quiet
;
1729 FILE *pot_fp
= data
.pot_fp
;
1730 uint loopback
= data
.loopback
;
1731 uint debug_mode
= data
.debug_mode
;
1732 char *debug_file
= data
.debug_file
;
1734 char debug_rule_buf
[BLOCK_SIZE
];
1735 int debug_rule_len
= 0; // -1 error
1736 uint debug_plain_len
= 0;
1738 unsigned char debug_plain_ptr
[BLOCK_SIZE
];
1742 char out_buf
[4096]; memset (out_buf
, 0, sizeof (out_buf
));
1744 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1746 uint idx
= data
.salts_buf
[salt_pos
].digests_offset
+ digest_pos
;
1752 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, idx
* sizeof (plain_t
), sizeof (plain_t
), &plain
, 0, NULL
, NULL
);
1754 uint gidvid
= plain
.gidvid
;
1755 uint il_pos
= plain
.il_pos
;
1757 uint64_t crackpos
= device_param
->words_off
;
1761 unsigned char *plain_ptr
= (unsigned char *) plain_buf
;
1762 unsigned int plain_len
= 0;
1764 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1766 uint64_t gidd
= gidvid
;
1771 gidd_to_pw_t (device_param
, gidd
, &pw
);
1773 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1775 plain_buf
[i
] = pw
.hi1
[0][j
];
1778 plain_len
= pw
.pw_len
;
1780 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1787 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1789 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1791 debug_rule_len
= gpu_rule_to_cpu_rule (debug_rule_buf
, &data
.gpu_rules_buf
[off
]);
1795 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1797 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1799 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1801 debug_plain_len
= plain_len
;
1805 plain_len
= apply_rules (data
.gpu_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1808 crackpos
*= data
.gpu_rules_cnt
;
1809 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1811 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1813 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1815 uint64_t gidd
= gidvid
;
1820 gidd_to_pw_t (device_param
, gidd
, &pw
);
1822 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1824 plain_buf
[i
] = pw
.hi1
[0][j
];
1827 plain_len
= pw
.pw_len
;
1829 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1830 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1832 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1834 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1838 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1840 memcpy (plain_ptr
, comb_buf
, comb_len
);
1843 plain_len
+= comb_len
;
1846 crackpos
*= data
.combs_cnt
;
1847 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1849 if (data
.pw_max
!= PW_DICTMAX1
)
1851 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1854 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1856 uint64_t l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1857 uint64_t r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1859 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1860 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1862 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1863 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1865 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1866 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1868 plain_len
= data
.css_cnt
;
1871 crackpos
*= data
.bfs_cnt
;
1872 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1874 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1876 uint64_t gidd
= gidvid
;
1881 gidd_to_pw_t (device_param
, gidd
, &pw
);
1883 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1885 plain_buf
[i
] = pw
.hi1
[0][j
];
1888 plain_len
= pw
.pw_len
;
1890 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1893 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1895 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1897 plain_len
+= start
+ stop
;
1900 crackpos
*= data
.combs_cnt
;
1901 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1903 if (data
.pw_max
!= PW_DICTMAX1
)
1905 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1908 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1910 uint64_t gidd
= gidvid
;
1915 gidd_to_pw_t (device_param
, gidd
, &pw
);
1917 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1919 plain_buf
[i
] = pw
.hi1
[0][j
];
1922 plain_len
= pw
.pw_len
;
1924 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1927 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1929 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
1931 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1933 plain_len
+= start
+ stop
;
1936 crackpos
*= data
.combs_cnt
;
1937 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1939 if (data
.pw_max
!= PW_DICTMAX1
)
1941 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1945 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
1947 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1949 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1951 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
1955 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
1957 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
1959 plain_ptr
[j
] = plain_ptr
[i
];
1962 plain_len
= plain_len
/ 2;
1966 // if enabled, update also the potfile
1970 fprintf (pot_fp
, "%s:", out_buf
);
1972 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
1974 fputc ('\n', pot_fp
);
1981 FILE *out_fp
= NULL
;
1983 if (outfile
!= NULL
)
1985 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
1987 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
1996 if (quiet
== 0) clear_prompt ();
1999 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2001 if (outfile
!= NULL
)
2003 if (out_fp
!= stdout
)
2010 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2012 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2014 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2015 if (quiet
== 0) fflush (stdout
);
2024 char *loopback_file
= data
.loopback_file
;
2028 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2030 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2032 fputc ('\n', fb_fp
);
2038 // (rule) debug mode
2040 // the next check implies that:
2041 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2044 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2046 if (debug_rule_len
< 0) debug_rule_len
= 0;
2048 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2050 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2052 if ((quiet
== 0) && (debug_file
== NULL
))
2054 fprintf (stdout
, "%s", PROMPT
);
2060 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2062 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2066 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2068 for (uint i
= 0; i
< GPU_THREADS
; i
++) if (device_param
->result
[i
] == 1) found
= 1;
2072 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2076 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
);
2078 uint cpt_cracked
= 0;
2080 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2082 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2084 if (data
.digests_shown_tmp
[idx
] == 0) continue;
2086 if (data
.digests_shown
[idx
] == 1) continue;
2088 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2090 data
.digests_shown
[idx
] = 1;
2092 data
.digests_done
++;
2096 salt_buf
->digests_done
++;
2098 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2100 data
.salts_shown
[salt_pos
] = 1;
2106 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2108 check_hash (device_param
, salt_pos
, digest_pos
);
2111 if (cpt_cracked
> 0)
2113 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2114 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2118 data
.cpt_total
+= cpt_cracked
;
2120 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2123 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2125 // we need to reset cracked state on the gpu
2126 // otherwise host thinks again and again the hash was cracked
2127 // and returns invalid password each time
2129 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2131 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
);
2134 memset (device_param
->result
, 0, device_param
->size_results
);
2136 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2140 static void save_hash ()
2142 char *hashfile
= data
.hashfile
;
2144 char new_hashfile
[256];
2145 char old_hashfile
[256];
2147 memset (new_hashfile
, 0, sizeof (new_hashfile
));
2148 memset (old_hashfile
, 0, sizeof (old_hashfile
));
2150 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2151 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2153 unlink (new_hashfile
);
2155 char separator
= data
.separator
;
2157 FILE *fp
= fopen (new_hashfile
, "wb");
2161 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2166 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2168 if (data
.salts_shown
[salt_pos
] == 1) continue;
2170 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2172 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2174 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2176 if (data
.digests_shown
[idx
] == 1) continue;
2178 if (data
.hash_mode
!= 2500)
2182 memset (out_buf
, 0, sizeof (out_buf
));
2184 if (data
.username
== 1)
2186 user_t
*user
= data
.hash_info
[idx
]->user
;
2190 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2192 fputc (separator
, fp
);
2195 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2197 fputs (out_buf
, fp
);
2205 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2207 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2216 unlink (old_hashfile
);
2218 if (rename (hashfile
, old_hashfile
) != 0)
2220 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2227 if (rename (new_hashfile
, hashfile
) != 0)
2229 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2234 unlink (old_hashfile
);
2237 static float find_gpu_blocks_div (const uint64_t total_left
, const uint gpu_blocks_all
)
2239 // function called only in case gpu_blocks_all > words_left)
2241 float gpu_blocks_div
= (float) (total_left
) / gpu_blocks_all
;
2243 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2245 uint32_t gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2247 while (gpu_blocks_new
< total_left
)
2249 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2251 gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2254 if (data
.quiet
== 0)
2260 log_info ("INFO: approaching final keyspace, workload adjusted");
2264 fprintf (stdout
, "%s", PROMPT
);
2269 if ((gpu_blocks_all
* gpu_blocks_div
) < 8) return 1;
2271 return gpu_blocks_div
;
2274 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2276 uint num_elements
= num
;
2278 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2279 device_param
->kernel_params_buf32
[31] = num
;
2281 uint gpu_threads
= device_param
->gpu_threads
;
2283 while (num_elements
% gpu_threads
) num_elements
++;
2285 cl_kernel kernel
= NULL
;
2289 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2290 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2291 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2292 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2293 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2296 hc_clSetKernelArg (kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2297 hc_clSetKernelArg (kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2298 hc_clSetKernelArg (kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2299 hc_clSetKernelArg (kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2300 hc_clSetKernelArg (kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2301 hc_clSetKernelArg (kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2302 hc_clSetKernelArg (kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2303 hc_clSetKernelArg (kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2304 hc_clSetKernelArg (kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2305 hc_clSetKernelArg (kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2306 hc_clSetKernelArg (kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2308 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2310 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2311 const size_t local_work_size
[3] = { gpu_threads
/ 32, 32, 1 };
2313 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2317 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2318 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2320 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2323 hc_clFlush (device_param
->command_queue
);
2325 hc_clFinish (device_param
->command_queue
);
2328 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2330 uint num_elements
= num
;
2334 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2335 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2336 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2339 // causes problems with special threads like in bcrypt
2340 // const uint gpu_threads = device_param->gpu_threads;
2342 const uint gpu_threads
= GPU_THREADS
;
2344 while (num_elements
% gpu_threads
) num_elements
++;
2346 cl_kernel kernel
= NULL
;
2350 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2351 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2352 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2357 case KERN_RUN_MP
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2358 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2359 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2360 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2361 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2362 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2364 case KERN_RUN_MP_R
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2365 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2366 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2367 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2368 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2369 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2371 case KERN_RUN_MP_L
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2372 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2373 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2374 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2375 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2376 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2377 hc_clSetKernelArg (kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2381 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2382 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2384 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2386 hc_clFlush (device_param
->command_queue
);
2388 hc_clFinish (device_param
->command_queue
);
2391 static void run_kernel_tb (hc_device_param_t
*device_param
, const uint num
)
2393 uint num_elements
= num
;
2395 uint gpu_threads
= device_param
->gpu_threads
;
2397 while (num_elements
% gpu_threads
) num_elements
++;
2399 cl_kernel kernel
= device_param
->kernel_tb
;
2401 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2402 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2404 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2406 hc_clFlush (device_param
->command_queue
);
2408 hc_clFinish (device_param
->command_queue
);
2411 static void run_kernel_tm (hc_device_param_t
*device_param
)
2413 const uint num_elements
= 1024; // fixed
2415 const uint gpu_threads
= 32;
2417 cl_kernel kernel
= device_param
->kernel_tm
;
2419 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2420 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2422 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2424 hc_clFlush (device_param
->command_queue
);
2426 hc_clFinish (device_param
->command_queue
);
2429 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2431 uint num_elements
= num
;
2433 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2434 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2436 // causes problems with special threads like in bcrypt
2437 // const uint gpu_threads = device_param->gpu_threads;
2439 const uint gpu_threads
= GPU_THREADS
;
2441 while (num_elements
% gpu_threads
) num_elements
++;
2443 cl_kernel kernel
= device_param
->kernel_amp
;
2445 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2446 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2448 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2449 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2451 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2453 hc_clFlush (device_param
->command_queue
);
2455 hc_clFinish (device_param
->command_queue
);
2458 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const uint size
)
2460 if (data
.vendor_id
== VENDOR_ID_AMD
)
2462 const cl_uchar zero
= 0;
2464 hc_clEnqueueFillBuffer (device_param
->command_queue
, buf
, &zero
, sizeof (cl_uchar
), 0, size
, 0, NULL
, NULL
);
2467 if (data
.vendor_id
== VENDOR_ID_NV
)
2469 // NOTE: clEnqueueFillBuffer () always fails with -59
2470 // IOW, it's not supported by Nvidia ForceWare <= 352.21,
2471 // How's that possible, OpenCL 1.2 support is advertised??
2472 // We need to workaround...
2474 #define FILLSZ 0x100000
2476 char *tmp
= (char *) mymalloc (FILLSZ
);
2478 memset (tmp
, 0, FILLSZ
);
2480 for (uint i
= 0; i
< size
; i
+= FILLSZ
)
2482 const int left
= size
- i
;
2484 const int fillsz
= MIN (FILLSZ
, left
);
2486 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, i
, fillsz
, tmp
, 0, NULL
, NULL
);
2493 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2499 else if (rule_len
== 1)
2501 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2507 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2509 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2511 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
);
2513 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2515 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
);
2517 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2519 const uint64_t off
= device_param
->words_off
;
2521 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2523 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2527 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2529 const uint gpu_loops
= data
.gpu_loops
;
2533 uint speed_pos
= device_param
->speed_pos
;
2536 if (device_param
->timer_speed
.tv_sec
== 0)
2538 hc_timer_set (&device_param
->timer_speed
);
2543 if (device_param
->timer_speed
.QuadPart
== 0)
2545 hc_timer_set (&device_param
->timer_speed
);
2549 // find higest password length, this is for optimization stuff
2551 uint highest_pw_len
= 0;
2553 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2556 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2559 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2561 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2562 + device_param
->kernel_params_mp_l_buf32
[5];
2565 // bitslice optimization stuff
2567 if (data
.attack_mode
== ATTACK_MODE_BF
)
2569 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2571 run_kernel_tb (device_param
, pws_cnt
);
2577 uint innerloop_step
= 0;
2578 uint innerloop_cnt
= 0;
2580 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2581 else innerloop_step
= 1;
2583 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2584 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2585 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2587 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2589 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2591 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2593 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2595 if (data
.devices_status
== STATUS_CRACKED
) break;
2596 if (data
.devices_status
== STATUS_ABORTED
) break;
2597 if (data
.devices_status
== STATUS_QUIT
) break;
2598 if (data
.devices_status
== STATUS_BYPASS
) break;
2600 if (data
.salts_shown
[salt_pos
] == 1) continue;
2602 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2604 device_param
->kernel_params_buf32
[24] = salt_pos
;
2605 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2606 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2608 FILE *combs_fp
= device_param
->combs_fp
;
2610 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2617 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2619 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2621 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2623 if (data
.devices_status
== STATUS_CRACKED
) break;
2624 if (data
.devices_status
== STATUS_ABORTED
) break;
2625 if (data
.devices_status
== STATUS_QUIT
) break;
2626 if (data
.devices_status
== STATUS_BYPASS
) break;
2628 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2630 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2632 device_param
->innerloop_pos
= innerloop_pos
;
2633 device_param
->innerloop_left
= innerloop_left
;
2635 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2637 if (innerloop_left
== 0) continue;
2639 // initialize amplifiers
2641 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2643 char line_buf
[BUFSIZ
];
2647 while (i
< innerloop_left
)
2649 if (feof (combs_fp
)) break;
2651 int line_len
= fgetl (combs_fp
, line_buf
);
2653 if (line_len
>= PW_MAX1
) continue;
2655 line_len
= convert_from_hex (line_buf
, line_len
);
2657 char *line_buf_new
= line_buf
;
2659 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2661 char rule_buf_out
[BLOCK_SIZE
];
2663 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2665 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2667 if (rule_len_out
< 0)
2669 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2674 line_len
= rule_len_out
;
2676 line_buf_new
= rule_buf_out
;
2679 line_len
= MIN (line_len
, PW_DICTMAX
);
2681 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2683 memcpy (ptr
, line_buf_new
, line_len
);
2685 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2687 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2689 uppercase (ptr
, line_len
);
2692 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2694 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2696 ptr
[line_len
] = 0x80;
2699 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2701 ptr
[line_len
] = 0x01;
2705 device_param
->combs_buf
[i
].pw_len
= line_len
;
2710 for (uint j
= i
; j
< innerloop_left
; j
++)
2712 device_param
->combs_buf
[j
].i
[0] = 0;
2713 device_param
->combs_buf
[j
].i
[1] = 0;
2714 device_param
->combs_buf
[j
].i
[2] = 0;
2715 device_param
->combs_buf
[j
].i
[3] = 0;
2716 device_param
->combs_buf
[j
].i
[4] = 0;
2717 device_param
->combs_buf
[j
].i
[5] = 0;
2718 device_param
->combs_buf
[j
].i
[6] = 0;
2719 device_param
->combs_buf
[j
].i
[7] = 0;
2721 device_param
->combs_buf
[j
].pw_len
= 0;
2726 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2728 uint64_t off
= innerloop_pos
;
2730 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2732 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2734 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2736 uint64_t off
= innerloop_pos
;
2738 device_param
->kernel_params_mp_buf64
[3] = off
;
2740 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2742 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2744 uint64_t off
= innerloop_pos
;
2746 device_param
->kernel_params_mp_buf64
[3] = off
;
2748 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2753 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2755 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
);
2757 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2759 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
);
2761 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2763 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
);
2765 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2767 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
);
2769 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2771 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
);
2774 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2776 if (data
.attack_mode
== ATTACK_MODE_BF
)
2778 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2780 const uint size_tm
= 32 * sizeof (bs_word_t
);
2782 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2784 run_kernel_tm (device_param
);
2786 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2790 if (highest_pw_len
< 16)
2792 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2794 else if (highest_pw_len
< 32)
2796 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2800 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2805 run_kernel_amp (device_param
, pws_cnt
);
2807 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2809 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2811 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2814 uint iter
= salt_buf
->salt_iter
;
2816 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2818 uint loop_left
= iter
- loop_pos
;
2820 loop_left
= MIN (loop_left
, gpu_loops
);
2822 device_param
->kernel_params_buf32
[25] = loop_pos
;
2823 device_param
->kernel_params_buf32
[26] = loop_left
;
2825 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2827 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2829 if (data
.devices_status
== STATUS_CRACKED
) break;
2830 if (data
.devices_status
== STATUS_ABORTED
) break;
2831 if (data
.devices_status
== STATUS_QUIT
) break;
2834 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2836 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2838 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2840 // do something with data
2842 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2845 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2848 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2850 if (data
.devices_status
== STATUS_CRACKED
) break;
2851 if (data
.devices_status
== STATUS_ABORTED
) break;
2852 if (data
.devices_status
== STATUS_QUIT
) break;
2858 hc_thread_mutex_lock (mux_display
);
2860 check_cracked (device_param
, salt_pos
);
2862 hc_thread_mutex_unlock (mux_display
);
2868 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2870 hc_thread_mutex_lock (mux_counter
);
2872 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2874 hc_thread_mutex_unlock (mux_counter
);
2882 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2884 hc_timer_set (&device_param
->timer_speed
);
2886 hc_thread_mutex_lock (mux_display
);
2888 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2890 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2892 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2894 hc_thread_mutex_unlock (mux_display
);
2898 if (speed_pos
== SPEED_CACHE
)
2905 device_param
->speed_pos
= speed_pos
;
2908 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2910 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2914 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2916 wl_data
->buf
[wl_data
->cnt
] = 0;
2918 if (wl_data
->cnt
== 0) return;
2920 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2924 if (wl_data
->cnt
== wl_data
->avail
)
2926 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2928 wl_data
->avail
+= wl_data
->incr
;
2931 const int c
= fgetc (fd
);
2933 if (c
== EOF
) break;
2935 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2939 if (c
== '\n') break;
2942 // ensure stream ends with a newline
2944 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2948 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
2954 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2958 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2960 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2970 if (*ptr
!= '\n') continue;
2974 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2985 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2989 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2991 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2993 if (*ptr
!= '\n') continue;
2997 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3008 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3012 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3014 if (*ptr
!= '\n') continue;
3018 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3029 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3031 while (wl_data
->pos
< wl_data
->cnt
)
3036 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3038 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3040 wl_data
->pos
+= off
;
3042 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3044 char rule_buf_out
[BLOCK_SIZE
];
3046 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3048 int rule_len_out
= -1;
3050 if (len
< BLOCK_SIZE
)
3052 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3055 if (rule_len_out
< 0)
3060 if (rule_len_out
> PW_MAX
)
3081 fprintf (stderr
, "bug!!\n");
3086 load_segment (wl_data
, fd
);
3088 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3092 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3096 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3106 fstat (fileno (fd
), &d
.stat
);
3110 _fstat64 (fileno (fd
), &d
.stat
);
3114 d
.stat
.st_nlink
= 0;
3118 d
.stat
.st_atime
= 0;
3121 d
.stat
.st_blksize
= 0;
3122 d
.stat
.st_blocks
= 0;
3125 if (d
.stat
.st_size
== 0) return 0;
3127 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3129 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3133 uint64_t cnt
= d_cache
->cnt
;
3135 uint64_t keyspace
= cnt
;
3137 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3139 keyspace
*= data
.gpu_rules_cnt
;
3141 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3143 keyspace
*= data
.combs_cnt
;
3146 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
);
3147 if (data
.quiet
== 0) log_info ("");
3149 hc_signal (sigHandler_default
);
3164 load_segment (wl_data
, fd
);
3166 comp
+= wl_data
->cnt
;
3170 while (i
< wl_data
->cnt
)
3175 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3177 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3179 char rule_buf_out
[BLOCK_SIZE
];
3181 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3183 int rule_len_out
= -1;
3185 if (len
< BLOCK_SIZE
)
3187 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3190 if (rule_len_out
< 0)
3202 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3204 cnt
+= data
.gpu_rules_cnt
;
3206 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3208 cnt
+= data
.combs_cnt
;
3221 if ((now
- prev
) == 0) continue;
3223 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3225 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
);
3230 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
);
3231 if (data
.quiet
== 0) log_info ("");
3233 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3235 hc_signal (sigHandler_default
);
3240 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3242 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3245 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3247 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3249 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3251 uint cache_cnt
= pw_cache
->cnt
;
3253 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3255 memcpy (pw_hc1
, pw_buf
, pw_len
);
3257 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3259 uint pws_cnt
= device_param
->pws_cnt
;
3263 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3265 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3267 pw
->pw_len
= pw_len
;
3271 device_param
->pws_cnt
= pws_cnt
;
3272 device_param
->pw_cnt
= pws_cnt
* 1;
3276 pw_cache
->cnt
= cache_cnt
;
3281 static void *thread_monitor (void *p
)
3283 uint runtime_check
= 0;
3284 uint remove_check
= 0;
3285 uint status_check
= 0;
3286 uint hwmon_check
= 0;
3287 uint restore_check
= 0;
3289 uint restore_left
= data
.restore_timer
;
3290 uint remove_left
= data
.remove_timer
;
3291 uint status_left
= data
.status_timer
;
3293 // these variables are mainly used for fan control (AMD only)
3295 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3297 // temperature controller "loopback" values
3299 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3300 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3302 int temp_threshold
= 1; // degrees celcius
3304 int fan_speed_min
= 15; // in percentage
3305 int fan_speed_max
= 100;
3307 time_t last_temp_check_time
;
3309 uint sleep_time
= 1;
3316 if (data
.restore_timer
)
3321 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3326 if (data
.status
== 1)
3331 if (data
.gpu_temp_disable
== 0)
3333 time (&last_temp_check_time
);
3338 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3343 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3345 hc_sleep (sleep_time
);
3347 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3349 if (hwmon_check
== 1)
3351 hc_thread_mutex_lock (mux_adl
);
3353 time_t temp_check_time
;
3355 time (&temp_check_time
);
3357 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3359 if (Ta
== 0) Ta
= 1;
3361 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
3363 const int temperature
= hm_get_temperature_with_device_id (i
);
3365 if (temperature
> (int) data
.gpu_temp_abort
)
3367 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i
+ 1);
3369 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3374 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3376 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3378 if (data
.hm_device
[i
].fan_supported
== 1)
3380 int temp_cur
= temperature
;
3382 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3384 temp_diff_sum
[i
] = temp_diff_sum
[i
] + temp_diff_new
;
3386 // calculate Ta value (time difference in seconds between the last check and this check)
3388 last_temp_check_time
= temp_check_time
;
3394 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3396 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
);
3398 if (abs (fan_diff_required
) >= temp_threshold
)
3400 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (i
);
3402 int fan_speed_level
= fan_speed_cur
;
3404 if (fan_speed_chgd
[i
] == 0) fan_speed_level
= temp_cur
;
3406 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3408 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3409 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3411 if (fan_speed_new
!= fan_speed_cur
)
3413 int freely_change_fan_speed
= (fan_speed_chgd
[i
] == 1);
3414 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3416 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3418 hm_set_fanspeed_with_device_id_amd (i
, fan_speed_new
);
3420 fan_speed_chgd
[i
] = 1;
3423 temp_diff_old
[i
] = temp_diff_new
;
3430 hc_thread_mutex_unlock (mux_adl
);
3433 if (restore_check
== 1)
3437 if (restore_left
== 0)
3439 if (data
.restore_disable
== 0) cycle_restore ();
3441 restore_left
= data
.restore_timer
;
3445 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3449 time (&runtime_cur
);
3451 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3453 if (runtime_left
<= 0)
3455 if (data
.benchmark
== 0)
3457 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3460 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3464 if (remove_check
== 1)
3468 if (remove_left
== 0)
3470 if (data
.digests_saved
!= data
.digests_done
)
3472 data
.digests_saved
= data
.digests_done
;
3477 remove_left
= data
.remove_timer
;
3481 if (status_check
== 1)
3485 if (status_left
== 0)
3487 hc_thread_mutex_lock (mux_display
);
3489 if (data
.quiet
== 0) clear_prompt ();
3491 if (data
.quiet
== 0) log_info ("");
3495 if (data
.quiet
== 0) log_info ("");
3497 hc_thread_mutex_unlock (mux_display
);
3499 status_left
= data
.status_timer
;
3504 myfree (fan_speed_chgd
);
3506 myfree (temp_diff_old
);
3507 myfree (temp_diff_sum
);
3514 static void *thread_outfile_remove (void *p
)
3516 // some hash-dependent constants
3517 char *outfile_dir
= data
.outfile_check_directory
;
3518 uint dgst_size
= data
.dgst_size
;
3519 uint isSalted
= data
.isSalted
;
3520 uint esalt_size
= data
.esalt_size
;
3521 uint hash_mode
= data
.hash_mode
;
3523 uint outfile_check_timer
= data
.outfile_check_timer
;
3525 char separator
= data
.separator
;
3527 // some hash-dependent functions
3528 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3529 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3534 memset (&hash_buf
, 0, sizeof (hash_buf
));
3536 hash_buf
.digest
= mymalloc (dgst_size
);
3538 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3540 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3542 uint digest_buf
[64];
3544 outfile_data_t
*out_info
= NULL
;
3546 char **out_files
= NULL
;
3548 time_t folder_mtime
= 0;
3552 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3554 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3558 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3562 if (check_left
== 0)
3564 struct stat outfile_check_stat
;
3566 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3568 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3572 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3574 char **out_files_new
= scan_directory (outfile_dir
);
3576 int out_cnt_new
= count_dictionaries (out_files_new
);
3578 outfile_data_t
*out_info_new
= NULL
;
3580 if (out_cnt_new
> 0)
3582 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3584 for (int i
= 0; i
< out_cnt_new
; i
++)
3586 out_info_new
[i
].file_name
= out_files_new
[i
];
3588 // check if there are files that we have seen/checked before (and not changed)
3590 for (int j
= 0; j
< out_cnt
; j
++)
3592 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3594 struct stat outfile_stat
;
3596 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3598 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3600 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3601 out_info_new
[i
].seek
= out_info
[j
].seek
;
3609 local_free (out_info
);
3610 local_free (out_files
);
3612 out_files
= out_files_new
;
3613 out_cnt
= out_cnt_new
;
3614 out_info
= out_info_new
;
3616 folder_mtime
= outfile_check_stat
.st_mtime
;
3619 for (int j
= 0; j
< out_cnt
; j
++)
3621 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3625 //hc_thread_mutex_lock (mux_display);
3628 struct stat outfile_stat
;
3630 fstat (fileno (fp
), &outfile_stat
);
3634 struct stat64 outfile_stat
;
3636 _fstat64 (fileno (fp
), &outfile_stat
);
3639 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3641 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3642 out_info
[j
].seek
= 0;
3645 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3649 char line_buf
[BUFSIZ
];
3651 memset (line_buf
, 0, BUFSIZ
);
3653 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3655 if (ptr
== NULL
) break;
3657 int line_len
= strlen (line_buf
);
3659 if (line_len
<= 0) continue;
3661 int iter
= MAX_CUT_TRIES
;
3663 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3665 if (line_buf
[i
] != separator
) continue;
3667 int parser_status
= PARSER_OK
;
3669 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3671 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3676 if (parser_status
== PARSER_OK
)
3678 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3680 if (data
.salts_shown
[salt_pos
] == 1) continue;
3682 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3684 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3686 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3688 if (data
.digests_shown
[idx
] == 1) continue;
3692 if (hash_mode
== 6800)
3694 if (i
== salt_buf
->salt_len
)
3696 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3699 else if (hash_mode
== 2500)
3701 // BSSID : MAC1 : MAC2 (:plain)
3702 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3704 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3706 if (!cracked
) continue;
3708 // now compare MAC1 and MAC2 too, since we have this additional info
3709 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3710 char *mac2_pos
= mac1_pos
+ 12 + 1;
3712 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3713 wpa_t
*wpa
= &wpas
[salt_pos
];
3717 char *pke_ptr
= (char *) pke
;
3719 for (uint i
= 0; i
< 25; i
++)
3721 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3724 unsigned char mac1
[6];
3725 unsigned char mac2
[6];
3727 memcpy (mac1
, pke_ptr
+ 23, 6);
3728 memcpy (mac2
, pke_ptr
+ 29, 6);
3730 // compare hex string(s) vs binary MAC address(es)
3732 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3734 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3742 if (!cracked
) continue;
3744 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3746 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3756 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3758 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3760 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3767 data
.digests_shown
[idx
] = 1;
3769 data
.digests_done
++;
3771 salt_buf
->digests_done
++;
3773 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3775 data
.salts_shown
[salt_pos
] = 1;
3779 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3784 if (data
.devices_status
== STATUS_CRACKED
) break;
3790 if (data
.devices_status
== STATUS_CRACKED
) break;
3795 if (data
.devices_status
== STATUS_CRACKED
) break;
3798 out_info
[j
].seek
= ftell (fp
);
3800 //hc_thread_mutex_unlock (mux_display);
3808 check_left
= outfile_check_timer
;
3812 if (esalt_size
) local_free (hash_buf
.esalt
);
3814 if (isSalted
) local_free (hash_buf
.salt
);
3816 local_free (hash_buf
.digest
);
3818 local_free (out_info
);
3820 local_free (out_files
);
3827 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3829 hc_thread_mutex_lock (mux_dispatcher
);
3831 const uint64_t words_cur
= data
.words_cur
;
3832 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3834 device_param
->words_off
= words_cur
;
3836 const uint64_t words_left
= words_base
- words_cur
;
3838 if (data
.gpu_blocks_all
> words_left
)
3840 if (data
.gpu_blocks_div
== 0)
3842 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3846 if (data
.gpu_blocks_div
)
3848 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3850 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3851 const uint32_t gpu_power_new
= gpu_blocks_new
;
3853 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3855 device_param
->gpu_blocks
= gpu_blocks_new
;
3856 device_param
->gpu_power
= gpu_power_new
;
3861 const uint gpu_blocks
= device_param
->gpu_blocks
;
3863 uint work
= MIN (words_left
, gpu_blocks
);
3865 work
= MIN (work
, max
);
3867 data
.words_cur
+= work
;
3869 hc_thread_mutex_unlock (mux_dispatcher
);
3874 static void *thread_calc_stdin (void *p
)
3876 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3878 const uint attack_kern
= data
.attack_kern
;
3880 const uint gpu_blocks
= device_param
->gpu_blocks
;
3882 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3884 hc_thread_mutex_lock (mux_dispatcher
);
3886 if (feof (stdin
) != 0)
3888 hc_thread_mutex_unlock (mux_dispatcher
);
3895 while (words_cur
< gpu_blocks
)
3899 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3901 if (line_buf
== NULL
) break;
3903 uint line_len
= in_superchop (line_buf
);
3905 line_len
= convert_from_hex (line_buf
, line_len
);
3907 // post-process rule engine
3909 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3911 char rule_buf_out
[BLOCK_SIZE
];
3913 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3915 int rule_len_out
= -1;
3917 if (line_len
< BLOCK_SIZE
)
3919 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3922 if (rule_len_out
< 0) continue;
3924 line_buf
= rule_buf_out
;
3925 line_len
= rule_len_out
;
3928 if (line_len
> PW_MAX
)
3933 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3935 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3937 hc_thread_mutex_lock (mux_counter
);
3939 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3941 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3944 hc_thread_mutex_unlock (mux_counter
);
3949 else if (attack_kern
== ATTACK_KERN_COMBI
)
3951 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
3952 // since we still need to combine the plains
3954 if (line_len
> data
.pw_max
)
3956 hc_thread_mutex_lock (mux_counter
);
3958 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3960 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
3963 hc_thread_mutex_unlock (mux_counter
);
3969 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
3973 if (data
.devices_status
== STATUS_CRACKED
) break;
3974 if (data
.devices_status
== STATUS_ABORTED
) break;
3975 if (data
.devices_status
== STATUS_QUIT
) break;
3976 if (data
.devices_status
== STATUS_BYPASS
) break;
3979 hc_thread_mutex_unlock (mux_dispatcher
);
3981 if (data
.devices_status
== STATUS_CRACKED
) break;
3982 if (data
.devices_status
== STATUS_ABORTED
) break;
3983 if (data
.devices_status
== STATUS_QUIT
) break;
3984 if (data
.devices_status
== STATUS_BYPASS
) break;
3986 // we need 2 flushing because we have two independant caches and it can occur
3987 // that one buffer is already at threshold plus for that length also exists
3988 // more data in the 2nd buffer so it would overflow
3993 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
3995 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
3997 const uint pw_cache_cnt
= pw_cache
->cnt
;
3999 if (pw_cache_cnt
== 0) continue;
4003 uint pws_cnt
= device_param
->pws_cnt
;
4005 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4007 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4009 pw
->pw_len
= pw_len
;
4011 uint pw_cnt
= device_param
->pw_cnt
;
4013 pw_cnt
+= pw_cache_cnt
;
4015 device_param
->pw_cnt
= pw_cnt
;
4019 device_param
->pws_cnt
= pws_cnt
;
4021 if (pws_cnt
== device_param
->gpu_power_user
) break;
4024 const uint pw_cnt
= device_param
->pw_cnt
;
4025 const uint pws_cnt
= device_param
->pws_cnt
;
4029 run_copy (device_param
, pws_cnt
);
4031 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4033 device_param
->pw_cnt
= 0;
4034 device_param
->pws_cnt
= 0;
4041 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4043 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4045 const uint pw_cache_cnt
= pw_cache
->cnt
;
4047 if (pw_cache_cnt
== 0) continue;
4051 uint pws_cnt
= device_param
->pws_cnt
;
4053 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4055 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4057 pw
->pw_len
= pw_len
;
4059 uint pw_cnt
= device_param
->pw_cnt
;
4061 pw_cnt
+= pw_cache_cnt
;
4063 device_param
->pw_cnt
= pw_cnt
;
4067 device_param
->pws_cnt
= pws_cnt
;
4070 const uint pw_cnt
= device_param
->pw_cnt
;
4071 const uint pws_cnt
= device_param
->pws_cnt
;
4075 run_copy (device_param
, pws_cnt
);
4077 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4079 device_param
->pw_cnt
= 0;
4080 device_param
->pws_cnt
= 0;
4088 static void *thread_calc (void *p
)
4090 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4092 const uint attack_mode
= data
.attack_mode
;
4093 const uint attack_kern
= data
.attack_kern
;
4095 if (attack_mode
== ATTACK_MODE_BF
)
4097 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4099 const uint work
= get_work (device_param
, -1);
4101 if (work
== 0) break;
4103 const uint64_t words_off
= device_param
->words_off
;
4104 const uint64_t words_fin
= words_off
+ work
;
4106 const uint pw_cnt
= work
;
4107 const uint pws_cnt
= work
;
4109 device_param
->pw_cnt
= pw_cnt
;
4110 device_param
->pws_cnt
= pws_cnt
;
4114 run_copy (device_param
, pws_cnt
);
4116 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4118 device_param
->pw_cnt
= 0;
4119 device_param
->pws_cnt
= 0;
4122 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4124 if (data
.devices_status
== STATUS_CRACKED
) break;
4125 if (data
.devices_status
== STATUS_ABORTED
) break;
4126 if (data
.devices_status
== STATUS_QUIT
) break;
4127 if (data
.devices_status
== STATUS_BYPASS
) break;
4129 device_param
->words_done
= words_fin
;
4134 const uint segment_size
= data
.segment_size
;
4136 char *dictfile
= data
.dictfile
;
4138 if (attack_mode
== ATTACK_MODE_COMBI
)
4140 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4142 dictfile
= data
.dictfile2
;
4146 FILE *fd
= fopen (dictfile
, "rb");
4150 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4155 if (attack_mode
== ATTACK_MODE_COMBI
)
4157 const uint combs_mode
= data
.combs_mode
;
4159 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4161 const char *dictfilec
= data
.dictfile2
;
4163 FILE *combs_fp
= fopen (dictfilec
, "rb");
4165 if (combs_fp
== NULL
)
4167 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4174 device_param
->combs_fp
= combs_fp
;
4176 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4178 const char *dictfilec
= data
.dictfile
;
4180 FILE *combs_fp
= fopen (dictfilec
, "rb");
4182 if (combs_fp
== NULL
)
4184 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4191 device_param
->combs_fp
= combs_fp
;
4195 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4197 wl_data
->buf
= (char *) mymalloc (segment_size
);
4198 wl_data
->avail
= segment_size
;
4199 wl_data
->incr
= segment_size
;
4203 uint64_t words_cur
= 0;
4205 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4207 uint64_t words_off
= 0;
4208 uint64_t words_fin
= 0;
4214 const uint work
= get_work (device_param
, max
);
4216 if (work
== 0) break;
4218 words_off
= device_param
->words_off
;
4219 words_fin
= words_off
+ work
;
4224 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4228 for ( ; words_cur
< words_fin
; words_cur
++)
4230 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4232 line_len
= convert_from_hex (line_buf
, line_len
);
4234 // post-process rule engine
4236 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4238 char rule_buf_out
[BLOCK_SIZE
];
4240 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4242 int rule_len_out
= -1;
4244 if (line_len
< BLOCK_SIZE
)
4246 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4249 if (rule_len_out
< 0) continue;
4251 line_buf
= rule_buf_out
;
4252 line_len
= rule_len_out
;
4255 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4257 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4261 hc_thread_mutex_lock (mux_counter
);
4263 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4265 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4268 hc_thread_mutex_unlock (mux_counter
);
4273 else if (attack_kern
== ATTACK_KERN_COMBI
)
4275 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4276 // since we still need to combine the plains
4278 if (line_len
> data
.pw_max
)
4282 hc_thread_mutex_lock (mux_counter
);
4284 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4286 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4289 hc_thread_mutex_unlock (mux_counter
);
4295 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4297 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4299 if (data
.devices_status
== STATUS_CRACKED
) break;
4300 if (data
.devices_status
== STATUS_ABORTED
) break;
4301 if (data
.devices_status
== STATUS_QUIT
) break;
4302 if (data
.devices_status
== STATUS_BYPASS
) break;
4305 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4307 if (data
.devices_status
== STATUS_CRACKED
) break;
4308 if (data
.devices_status
== STATUS_ABORTED
) break;
4309 if (data
.devices_status
== STATUS_QUIT
) break;
4310 if (data
.devices_status
== STATUS_BYPASS
) break;
4313 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4315 if (data
.devices_status
== STATUS_CRACKED
) break;
4316 if (data
.devices_status
== STATUS_ABORTED
) break;
4317 if (data
.devices_status
== STATUS_QUIT
) break;
4318 if (data
.devices_status
== STATUS_BYPASS
) break;
4320 // we need 2 flushing because we have two independant caches and it can occur
4321 // that one buffer is already at threshold plus for that length also exists
4322 // more data in the 2nd buffer so it would overflow
4329 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4331 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4333 const uint pw_cache_cnt
= pw_cache
->cnt
;
4335 if (pw_cache_cnt
== 0) continue;
4339 uint pws_cnt
= device_param
->pws_cnt
;
4341 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4343 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4345 pw
->pw_len
= pw_len
;
4347 uint pw_cnt
= device_param
->pw_cnt
;
4349 pw_cnt
+= pw_cache_cnt
;
4351 device_param
->pw_cnt
= pw_cnt
;
4355 device_param
->pws_cnt
= pws_cnt
;
4357 if (pws_cnt
== device_param
->gpu_power_user
) break;
4360 const uint pw_cnt
= device_param
->pw_cnt
;
4361 const uint pws_cnt
= device_param
->pws_cnt
;
4365 run_copy (device_param
, pws_cnt
);
4367 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4369 device_param
->pw_cnt
= 0;
4370 device_param
->pws_cnt
= 0;
4373 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4375 if (data
.devices_status
== STATUS_CRACKED
) break;
4376 if (data
.devices_status
== STATUS_ABORTED
) break;
4377 if (data
.devices_status
== STATUS_QUIT
) break;
4378 if (data
.devices_status
== STATUS_BYPASS
) break;
4386 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4388 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4390 const uint pw_cache_cnt
= pw_cache
->cnt
;
4392 if (pw_cache_cnt
== 0) continue;
4396 uint pws_cnt
= device_param
->pws_cnt
;
4398 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4400 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4402 pw
->pw_len
= pw_len
;
4404 uint pw_cnt
= device_param
->pw_cnt
;
4406 pw_cnt
+= pw_cache_cnt
;
4408 device_param
->pw_cnt
= pw_cnt
;
4412 device_param
->pws_cnt
= pws_cnt
;
4415 const uint pw_cnt
= device_param
->pw_cnt
;
4416 const uint pws_cnt
= device_param
->pws_cnt
;
4420 run_copy (device_param
, pws_cnt
);
4422 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4424 device_param
->pw_cnt
= 0;
4425 device_param
->pws_cnt
= 0;
4428 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4430 if (data
.devices_status
== STATUS_CRACKED
) break;
4431 if (data
.devices_status
== STATUS_ABORTED
) break;
4432 if (data
.devices_status
== STATUS_QUIT
) break;
4433 if (data
.devices_status
== STATUS_BYPASS
) break;
4436 if (words_fin
== 0) break;
4438 device_param
->words_done
= words_fin
;
4441 if (attack_mode
== ATTACK_MODE_COMBI
)
4443 fclose (device_param
->combs_fp
);
4446 free (wl_data
->buf
);
4455 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4457 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4459 device_param
->kernel_params_buf32
[24] = salt_pos
;
4460 device_param
->kernel_params_buf32
[27] = 1;
4461 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4462 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4463 device_param
->kernel_params_buf32
[30] = 0;
4464 device_param
->kernel_params_buf32
[31] = 1;
4466 char *dictfile_old
= data
.dictfile
;
4467 char *dictfile2_old
= data
.dictfile2
;
4468 char *mask_old
= data
.mask
;
4470 const char *weak_hash_check
= "weak-hash-check";
4472 data
.dictfile
= (char *) weak_hash_check
;
4473 data
.dictfile2
= (char *) weak_hash_check
;
4474 data
.mask
= (char *) weak_hash_check
;
4480 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4482 run_kernel (KERN_RUN_1
, device_param
, 1);
4486 run_kernel (KERN_RUN_1
, device_param
, 1);
4488 const uint iter
= salt_buf
->salt_iter
;
4490 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4492 uint loop_left
= iter
- loop_pos
;
4494 loop_left
= MIN (loop_left
, gpu_loops
);
4496 device_param
->kernel_params_buf32
[25] = loop_pos
;
4497 device_param
->kernel_params_buf32
[26] = loop_left
;
4499 run_kernel (KERN_RUN_2
, device_param
, 1);
4502 run_kernel (KERN_RUN_3
, device_param
, 1);
4509 check_cracked (device_param
, salt_pos
);
4515 device_param
->kernel_params_buf32
[24] = 0;
4516 device_param
->kernel_params_buf32
[25] = 0;
4517 device_param
->kernel_params_buf32
[26] = 0;
4518 device_param
->kernel_params_buf32
[27] = 0;
4519 device_param
->kernel_params_buf32
[28] = 0;
4520 device_param
->kernel_params_buf32
[29] = 0;
4521 device_param
->kernel_params_buf32
[30] = 0;
4522 device_param
->kernel_params_buf32
[31] = 0;
4524 data
.dictfile
= dictfile_old
;
4525 data
.dictfile2
= dictfile2_old
;
4526 data
.mask
= mask_old
;
4531 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4533 if (data
.username
== 0)
4535 *hashbuf_pos
= line_buf
;
4536 *hashbuf_len
= line_len
;
4540 char *pos
= line_buf
;
4543 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4545 if (line_buf
[i
] == data
.separator
)
4560 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4567 for (int i
= 0; i
< line_len
; i
++)
4569 if (line_buf
[i
] == data
.separator
)
4578 if (pos
== NULL
) pos
= line_buf
+ i
;
4590 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4597 for (int i
= 0; i
< line_len
; i
++)
4599 if (line_buf
[i
] == ':')
4606 if (sep_cnt
== 2) sep2_len
++;
4607 if (sep_cnt
== 3) sep3_len
++;
4610 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4615 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4622 for (int i
= 0; i
< line_len
; i
++)
4624 if (line_buf
[i
] == ':')
4631 if (data
.hash_mode
== 1000)
4635 if (pos
== NULL
) pos
= line_buf
+ i
;
4640 else if (data
.hash_mode
== 3000)
4644 if (pos
== NULL
) pos
= line_buf
+ i
;
4655 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4662 for (int i
= 0; i
< line_len
; i
++)
4664 if (line_buf
[i
] == ':')
4673 if (pos
== NULL
) pos
= line_buf
+ i
;
4685 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4689 char sep5_first
= 0;
4690 char sep6_first
= 0;
4692 for (int i
= 0; i
< line_len
; i
++)
4694 if (line_buf
[i
] == ':')
4701 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4702 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4705 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4710 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4717 for (int i
= 0; i
< line_len
; i
++)
4719 if (line_buf
[i
] == ':')
4728 if (pos
== NULL
) pos
= line_buf
+ i
;
4738 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4745 for (int i
= 0; i
< line_len
; i
++)
4747 if (line_buf
[i
] == ':')
4756 if (pos
== NULL
) pos
= line_buf
+ i
;
4768 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4772 for (int i
= 0; i
< line_len
; i
++)
4774 if (line_buf
[i
] == ':') sep_cnt
++;
4777 if (sep_cnt
== 8) return 1;
4782 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4784 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4787 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4789 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4794 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4796 switch (hashfile_format
)
4798 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4799 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4800 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4801 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4805 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4807 switch (hashfile_format
)
4809 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4810 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4811 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4812 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4816 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4818 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4820 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4821 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4823 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4829 char line_buf
[BUFSIZ
];
4831 int line_len
= fgetl (fp
, line_buf
);
4833 if (line_len
== 0) continue;
4835 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4836 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4837 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4839 if (num_check
== max_check
) break;
4844 uint hashlist_format
= HLFMT_HASHCAT
;
4846 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4848 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4850 hashlist_format
= i
;
4855 return hashlist_format
;
4859 * some further helper function
4862 // wrapper around mymalloc for ADL
4864 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4866 return mymalloc (iSize
);
4869 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
)
4871 uint64_t collisions
= 0;
4873 const uint dgst_pos0
= data
.dgst_pos0
;
4874 const uint dgst_pos1
= data
.dgst_pos1
;
4875 const uint dgst_pos2
= data
.dgst_pos2
;
4876 const uint dgst_pos3
= data
.dgst_pos3
;
4878 memset (bitmap_a
, 0, bitmap_size
);
4879 memset (bitmap_b
, 0, bitmap_size
);
4880 memset (bitmap_c
, 0, bitmap_size
);
4881 memset (bitmap_d
, 0, bitmap_size
);
4883 for (uint i
= 0; i
< digests_cnt
; i
++)
4885 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4887 digests_buf_ptr
+= dgst_size
;
4889 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4890 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4891 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4892 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4894 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4895 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4896 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4897 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4899 if (bitmap_a
[idx0
] & val0
) collisions
++;
4900 if (bitmap_b
[idx1
] & val1
) collisions
++;
4901 if (bitmap_c
[idx2
] & val2
) collisions
++;
4902 if (bitmap_d
[idx3
] & val3
) collisions
++;
4904 bitmap_a
[idx0
] |= val0
;
4905 bitmap_b
[idx1
] |= val1
;
4906 bitmap_c
[idx2
] |= val2
;
4907 bitmap_d
[idx3
] |= val3
;
4909 if (collisions
>= collisions_max
) return 0x7fffffff;
4919 int main (int argc
, char **argv
)
4922 * To help users a bit
4925 char *compute
= getenv ("COMPUTE");
4931 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4937 if (getenv ("DISPLAY") == NULL
)
4938 putenv ((char *) "DISPLAY=:0");
4942 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4943 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4945 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4946 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
4953 memset (&data
, 0, sizeof (hc_global_data_t
));
4959 data
.proc_start
= proc_start
;
4962 char **myargv
= argv
;
4964 hc_thread_mutex_init (mux_dispatcher
);
4965 hc_thread_mutex_init (mux_counter
);
4966 hc_thread_mutex_init (mux_display
);
4967 hc_thread_mutex_init (mux_adl
);
4970 * commandline parameters
4974 uint version
= VERSION
;
4976 uint benchmark
= BENCHMARK
;
4977 uint benchmark_mode
= BENCHMARK_MODE
;
4980 uint username
= USERNAME
;
4981 uint remove
= REMOVE
;
4982 uint remove_timer
= REMOVE_TIMER
;
4983 uint64_t skip
= SKIP
;
4984 uint64_t limit
= LIMIT
;
4985 uint keyspace
= KEYSPACE
;
4986 uint potfile_disable
= POTFILE_DISABLE
;
4987 uint debug_mode
= DEBUG_MODE
;
4988 char *debug_file
= NULL
;
4989 char *induction_dir
= NULL
;
4990 char *outfile_check_dir
= NULL
;
4992 uint runtime
= RUNTIME
;
4993 uint hash_mode
= HASH_MODE
;
4994 uint attack_mode
= ATTACK_MODE
;
4995 uint markov_disable
= MARKOV_DISABLE
;
4996 uint markov_classic
= MARKOV_CLASSIC
;
4997 uint markov_threshold
= MARKOV_THRESHOLD
;
4998 char *markov_hcstat
= NULL
;
4999 char *outfile
= NULL
;
5000 uint outfile_format
= OUTFILE_FORMAT
;
5001 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5002 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5003 uint restore
= RESTORE
;
5004 uint restore_timer
= RESTORE_TIMER
;
5005 uint restore_disable
= RESTORE_DISABLE
;
5006 uint status
= STATUS
;
5007 uint status_timer
= STATUS_TIMER
;
5008 uint status_automat
= STATUS_AUTOMAT
;
5009 uint loopback
= LOOPBACK
;
5010 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5011 char *session
= NULL
;
5012 uint hex_charset
= HEX_CHARSET
;
5013 uint hex_salt
= HEX_SALT
;
5014 uint hex_wordlist
= HEX_WORDLIST
;
5015 uint rp_gen
= RP_GEN
;
5016 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5017 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5018 uint rp_gen_seed
= RP_GEN_SEED
;
5019 char *rule_buf_l
= (char *) RULE_BUF_L
;
5020 char *rule_buf_r
= (char *) RULE_BUF_R
;
5021 uint increment
= INCREMENT
;
5022 uint increment_min
= INCREMENT_MIN
;
5023 uint increment_max
= INCREMENT_MAX
;
5024 char *cpu_affinity
= NULL
;
5025 char *gpu_devices
= NULL
;
5026 char *truecrypt_keyfiles
= NULL
;
5027 uint workload_profile
= WORKLOAD_PROFILE
;
5028 uint gpu_accel
= GPU_ACCEL
;
5029 uint gpu_loops
= GPU_LOOPS
;
5030 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5031 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5032 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5033 uint powertune_enable
= POWERTUNE_ENABLE
;
5034 uint logfile_disable
= LOGFILE_DISABLE
;
5035 uint segment_size
= SEGMENT_SIZE
;
5036 uint scrypt_tmto
= SCRYPT_TMTO
;
5037 char separator
= SEPARATOR
;
5038 uint bitmap_min
= BITMAP_MIN
;
5039 uint bitmap_max
= BITMAP_MAX
;
5040 char *custom_charset_1
= NULL
;
5041 char *custom_charset_2
= NULL
;
5042 char *custom_charset_3
= NULL
;
5043 char *custom_charset_4
= NULL
;
5045 #define IDX_HELP 'h'
5046 #define IDX_VERSION 'V'
5047 #define IDX_VERSION_LOWER 'v'
5048 #define IDX_QUIET 0xff02
5049 #define IDX_SHOW 0xff03
5050 #define IDX_LEFT 0xff04
5051 #define IDX_REMOVE 0xff05
5052 #define IDX_REMOVE_TIMER 0xff37
5053 #define IDX_SKIP 's'
5054 #define IDX_LIMIT 'l'
5055 #define IDX_KEYSPACE 0xff35
5056 #define IDX_POTFILE_DISABLE 0xff06
5057 #define IDX_DEBUG_MODE 0xff43
5058 #define IDX_DEBUG_FILE 0xff44
5059 #define IDX_INDUCTION_DIR 0xff46
5060 #define IDX_OUTFILE_CHECK_DIR 0xff47
5061 #define IDX_USERNAME 0xff07
5062 #define IDX_FORCE 0xff08
5063 #define IDX_RUNTIME 0xff09
5064 #define IDX_BENCHMARK 'b'
5065 #define IDX_BENCHMARK_MODE 0xff32
5066 #define IDX_HASH_MODE 'm'
5067 #define IDX_ATTACK_MODE 'a'
5068 #define IDX_RP_FILE 'r'
5069 #define IDX_RP_GEN 'g'
5070 #define IDX_RP_GEN_FUNC_MIN 0xff10
5071 #define IDX_RP_GEN_FUNC_MAX 0xff11
5072 #define IDX_RP_GEN_SEED 0xff34
5073 #define IDX_RULE_BUF_L 'j'
5074 #define IDX_RULE_BUF_R 'k'
5075 #define IDX_INCREMENT 'i'
5076 #define IDX_INCREMENT_MIN 0xff12
5077 #define IDX_INCREMENT_MAX 0xff13
5078 #define IDX_OUTFILE 'o'
5079 #define IDX_OUTFILE_FORMAT 0xff14
5080 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5081 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5082 #define IDX_RESTORE 0xff15
5083 #define IDX_RESTORE_DISABLE 0xff27
5084 #define IDX_STATUS 0xff17
5085 #define IDX_STATUS_TIMER 0xff18
5086 #define IDX_STATUS_AUTOMAT 0xff50
5087 #define IDX_LOOPBACK 0xff38
5088 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5089 #define IDX_SESSION 0xff19
5090 #define IDX_HEX_CHARSET 0xff20
5091 #define IDX_HEX_SALT 0xff21
5092 #define IDX_HEX_WORDLIST 0xff40
5093 #define IDX_MARKOV_DISABLE 0xff22
5094 #define IDX_MARKOV_CLASSIC 0xff23
5095 #define IDX_MARKOV_THRESHOLD 't'
5096 #define IDX_MARKOV_HCSTAT 0xff24
5097 #define IDX_CPU_AFFINITY 0xff25
5098 #define IDX_GPU_DEVICES 'd'
5099 #define IDX_WORKLOAD_PROFILE 'w'
5100 #define IDX_GPU_ACCEL 'n'
5101 #define IDX_GPU_LOOPS 'u'
5102 #define IDX_GPU_TEMP_DISABLE 0xff29
5103 #define IDX_GPU_TEMP_ABORT 0xff30
5104 #define IDX_GPU_TEMP_RETAIN 0xff31
5105 #define IDX_POWERTUNE_ENABLE 0xff41
5106 #define IDX_LOGFILE_DISABLE 0xff51
5107 #define IDX_TRUECRYPT_KEYFILES 0xff52
5108 #define IDX_SCRYPT_TMTO 0xff61
5109 #define IDX_SEGMENT_SIZE 'c'
5110 #define IDX_SEPARATOR 'p'
5111 #define IDX_BITMAP_MIN 0xff70
5112 #define IDX_BITMAP_MAX 0xff71
5113 #define IDX_CUSTOM_CHARSET_1 '1'
5114 #define IDX_CUSTOM_CHARSET_2 '2'
5115 #define IDX_CUSTOM_CHARSET_3 '3'
5116 #define IDX_CUSTOM_CHARSET_4 '4'
5118 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5120 struct option long_options
[] =
5122 {"help", no_argument
, 0, IDX_HELP
},
5123 {"version", no_argument
, 0, IDX_VERSION
},
5124 {"quiet", no_argument
, 0, IDX_QUIET
},
5125 {"show", no_argument
, 0, IDX_SHOW
},
5126 {"left", no_argument
, 0, IDX_LEFT
},
5127 {"username", no_argument
, 0, IDX_USERNAME
},
5128 {"remove", no_argument
, 0, IDX_REMOVE
},
5129 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5130 {"skip", required_argument
, 0, IDX_SKIP
},
5131 {"limit", required_argument
, 0, IDX_LIMIT
},
5132 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5133 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5134 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5135 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5136 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5137 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5138 {"force", no_argument
, 0, IDX_FORCE
},
5139 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5140 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5141 {"restore", no_argument
, 0, IDX_RESTORE
},
5142 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5143 {"status", no_argument
, 0, IDX_STATUS
},
5144 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5145 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5146 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5147 {"weak-hash-threshold",
5148 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5149 {"session", required_argument
, 0, IDX_SESSION
},
5150 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5151 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5152 {"generate-rules-func-min",
5153 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5154 {"generate-rules-func-max",
5155 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5156 {"generate-rules-seed",
5157 required_argument
, 0, IDX_RP_GEN_SEED
},
5158 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5159 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5160 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5161 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5162 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5163 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5164 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5165 {"outfile-autohex-disable",
5166 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5167 {"outfile-check-timer",
5168 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5169 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5170 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5171 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5172 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5173 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5174 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5175 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5176 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5177 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5178 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5179 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5180 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5181 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5182 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5183 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5184 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5185 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5186 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5187 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5188 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5190 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5191 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5192 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5193 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5194 {"increment", no_argument
, 0, IDX_INCREMENT
},
5195 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5196 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5197 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5198 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5199 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5200 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5205 uint rp_files_cnt
= 0;
5207 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5216 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5220 case IDX_HELP
: usage
= 1; break;
5222 case IDX_VERSION_LOWER
: version
= 1; break;
5223 case IDX_RESTORE
: restore
= 1; break;
5224 case IDX_SESSION
: session
= optarg
; break;
5225 case IDX_SHOW
: show
= 1; break;
5226 case IDX_LEFT
: left
= 1; break;
5227 case '?': return (-1);
5233 log_error ("ERROR: Invalid argument specified");
5244 log_info (VERSION_TXT
);
5251 usage_big_print (PROGNAME
);
5260 if (session
== NULL
) session
= (char *) PROGNAME
;
5262 size_t session_size
= strlen (session
) + 32;
5264 data
.session
= session
;
5266 char *eff_restore_file
= (char *) mymalloc (session_size
);
5267 char *new_restore_file
= (char *) mymalloc (session_size
);
5269 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5270 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5272 data
.eff_restore_file
= eff_restore_file
;
5273 data
.new_restore_file
= new_restore_file
;
5275 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5277 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5278 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5283 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5284 if ((show
== 1) || (left
== 1))
5286 restore_disable
= 1;
5291 data
.restore_disable
= restore_disable
;
5293 restore_data_t
*rd
= init_restore (argc
, argv
);
5303 read_restore (eff_restore_file
, rd
);
5305 if (rd
->version_bin
< RESTORE_MIN
)
5307 log_error ("ERROR: Incompatible restore-file version");
5316 rd
->pid
= getpid ();
5318 rd
->pid
= GetCurrentProcessId ();
5322 uint hash_mode_chgd
= 0;
5323 uint runtime_chgd
= 0;
5324 uint gpu_loops_chgd
= 0;
5325 uint gpu_accel_chgd
= 0;
5326 uint attack_mode_chgd
= 0;
5327 uint outfile_format_chgd
= 0;
5328 uint rp_gen_seed_chgd
= 0;
5329 uint remove_timer_chgd
= 0;
5330 uint increment_min_chgd
= 0;
5331 uint increment_max_chgd
= 0;
5332 uint gpu_temp_abort_chgd
= 0;
5333 uint gpu_temp_retain_chgd
= 0;
5339 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5343 //case IDX_HELP: usage = 1; break;
5344 //case IDX_VERSION: version = 1; break;
5345 //case IDX_RESTORE: restore = 1; break;
5346 case IDX_QUIET
: quiet
= 1; break;
5347 //case IDX_SHOW: show = 1; break;
5348 case IDX_SHOW
: break;
5349 //case IDX_LEFT: left = 1; break;
5350 case IDX_LEFT
: break;
5351 case IDX_USERNAME
: username
= 1; break;
5352 case IDX_REMOVE
: remove
= 1; break;
5353 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5354 remove_timer_chgd
= 1; break;
5355 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5356 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5357 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5358 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5359 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5360 case IDX_FORCE
: force
= 1; break;
5361 case IDX_SKIP
: skip
= atoll (optarg
); break;
5362 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5363 case IDX_KEYSPACE
: keyspace
= 1; break;
5364 case IDX_BENCHMARK
: benchmark
= 1; break;
5365 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5366 case IDX_RESTORE
: break;
5367 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5368 case IDX_STATUS
: status
= 1; break;
5369 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5370 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5371 case IDX_LOOPBACK
: loopback
= 1; break;
5372 case IDX_WEAK_HASH_THRESHOLD
:
5373 weak_hash_threshold
= atoi (optarg
); break;
5374 //case IDX_SESSION: session = optarg; break;
5375 case IDX_SESSION
: break;
5376 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5377 hash_mode_chgd
= 1; break;
5378 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5379 runtime_chgd
= 1; break;
5380 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5381 attack_mode_chgd
= 1; break;
5382 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5383 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5384 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5385 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5386 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5387 rp_gen_seed_chgd
= 1; break;
5388 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5389 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5390 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5391 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5392 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5393 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5394 case IDX_OUTFILE
: outfile
= optarg
; break;
5395 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5396 outfile_format_chgd
= 1; break;
5397 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5398 outfile_autohex
= 0; break;
5399 case IDX_OUTFILE_CHECK_TIMER
:
5400 outfile_check_timer
= atoi (optarg
); break;
5401 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5402 case IDX_HEX_SALT
: hex_salt
= 1; break;
5403 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5404 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5405 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5406 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5407 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5408 gpu_accel_chgd
= 1; break;
5409 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5410 gpu_loops_chgd
= 1; break;
5411 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5412 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5413 gpu_temp_abort
= atoi (optarg
); break;
5414 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5415 gpu_temp_retain
= atoi (optarg
); break;
5416 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5417 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5418 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5419 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5420 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5421 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5422 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5423 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5424 case IDX_INCREMENT
: increment
= 1; break;
5425 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5426 increment_min_chgd
= 1; break;
5427 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5428 increment_max_chgd
= 1; break;
5429 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5430 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5431 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5432 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5435 log_error ("ERROR: Invalid argument specified");
5442 log_error ("ERROR: Invalid argument specified");
5448 * Inform user things getting started,
5449 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5450 * - we do not need to check algorithm_pos
5457 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5461 else if (restore
== 1)
5463 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5469 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5479 if (attack_mode
> 7)
5481 log_error ("ERROR: Invalid attack-mode specified");
5486 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5488 log_error ("ERROR: Invalid runtime specified");
5493 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5495 log_error ("ERROR: Invalid hash-type specified");
5500 // renamed hash modes
5514 log_error ("Old -m specified, use -m %d instead", n
);
5522 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5524 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5530 if (outfile_format
> 16)
5532 log_error ("ERROR: Invalid outfile-format specified");
5539 if (outfile_format_chgd
== 1)
5541 if (outfile_format
> 1)
5543 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5550 outfile_format
= OUTFILE_FMT_HASH
;
5556 if (outfile_format_chgd
== 1)
5558 if ((outfile_format
> 7) && (outfile_format
< 16))
5560 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5567 if (increment_min
< INCREMENT_MIN
)
5569 log_error ("ERROR: Invalid increment-min specified");
5574 if (increment_max
> INCREMENT_MAX
)
5576 log_error ("ERROR: Invalid increment-max specified");
5581 if (increment_min
> increment_max
)
5583 log_error ("ERROR: Invalid increment-min specified");
5588 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5590 log_error ("ERROR: increment is not allowed in attack-mode 0");
5595 if ((increment
== 0) && (increment_min_chgd
== 1))
5597 log_error ("ERROR: increment-min is only supported together with increment switch");
5602 if ((increment
== 0) && (increment_max_chgd
== 1))
5604 log_error ("ERROR: increment-max is only supported together with increment switch");
5609 if (rp_files_cnt
&& rp_gen
)
5611 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5616 if (rp_files_cnt
|| rp_gen
)
5618 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5620 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5626 if (rp_gen_func_min
> rp_gen_func_max
)
5628 log_error ("ERROR: Invalid rp-gen-func-min specified");
5633 if (gpu_accel_chgd
== 1)
5635 if (workload_profile
!= WORKLOAD_PROFILE
)
5637 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5644 log_error ("ERROR: Invalid gpu-accel specified");
5649 if (gpu_accel
> 800)
5651 log_error ("ERROR: Invalid gpu-accel specified");
5657 if (gpu_loops_chgd
== 1)
5659 if (workload_profile
!= WORKLOAD_PROFILE
)
5661 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5668 log_error ("ERROR: Invalid gpu-loops specified");
5673 if (gpu_loops
> 1024)
5675 log_error ("ERROR: Invalid gpu-loops specified");
5683 if (workload_profile
!= WORKLOAD_PROFILE
)
5685 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5691 if ((workload_profile
< 1) || (workload_profile
> 3))
5693 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5698 if (show
== 1 || left
== 1)
5700 attack_mode
= ATTACK_MODE_NONE
;
5704 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5709 if (potfile_disable
== 1)
5711 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5717 uint attack_kern
= ATTACK_KERN_NONE
;
5719 switch (attack_mode
)
5721 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5722 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5723 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5724 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5725 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5732 int num_additional_params
= 1;
5734 if (attack_kern
== ATTACK_KERN_COMBI
)
5736 num_additional_params
= 2;
5739 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5741 if (keyspace_wordlist_specified
== 0) optind
--;
5744 if (attack_kern
== ATTACK_KERN_NONE
)
5746 if ((optind
+ 1) != myargc
)
5748 usage_mini_print (myargv
[0]);
5753 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5755 if ((optind
+ 1) > myargc
)
5757 usage_mini_print (myargv
[0]);
5762 else if (attack_kern
== ATTACK_KERN_COMBI
)
5764 if ((optind
+ 3) != myargc
)
5766 usage_mini_print (myargv
[0]);
5771 else if (attack_kern
== ATTACK_KERN_BF
)
5773 if ((optind
+ 1) > myargc
)
5775 usage_mini_print (myargv
[0]);
5782 usage_mini_print (myargv
[0]);
5789 if (myargv
[optind
] != 0)
5791 log_error ("ERROR: Invalid argument for benchmark mode specified");
5796 if (attack_mode_chgd
== 1)
5798 if (attack_mode
!= ATTACK_MODE_BF
)
5800 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5806 if (benchmark_mode
== 0)
5810 else if (benchmark_mode
== 1)
5812 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5814 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5821 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5827 if (skip
!= 0 && limit
!= 0)
5836 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5842 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5847 potfile_disable
= 1;
5849 restore_disable
= 1;
5853 weak_hash_threshold
= 0;
5858 if (remove_timer_chgd
== 1)
5862 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5867 if (remove_timer
< 1)
5869 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5877 if (attack_mode
== ATTACK_MODE_BF
)
5879 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5883 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5885 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5887 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5896 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5898 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5903 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5905 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5913 log_error ("ERROR: Invalid debug-mode specified");
5918 if (debug_file
!= NULL
)
5922 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5928 if (induction_dir
!= NULL
)
5930 if (attack_mode
== ATTACK_MODE_BF
)
5932 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5939 * induction directory
5942 char *induction_directory
= NULL
;
5944 if (attack_mode
!= ATTACK_MODE_BF
)
5946 if (induction_dir
== NULL
)
5948 induction_directory
= (char *) mymalloc (session_size
);
5950 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
5952 // create induction folder if it does not already exist
5956 if (rmdir (induction_directory
) == -1)
5958 if (errno
== ENOENT
)
5960 // good, we can ignore
5962 else if (errno
== ENOTEMPTY
)
5964 char *induction_directory_mv
= (char *) mymalloc (session_size
);
5966 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
5968 if (rename (induction_directory
, induction_directory_mv
) != 0)
5970 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
5977 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5984 #define mkdir(name,mode) mkdir (name)
5987 if (mkdir (induction_directory
, 0700) == -1)
5989 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5997 induction_directory
= induction_dir
;
6001 data
.induction_directory
= induction_directory
;
6007 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
6009 char *loopback_file
= (char *) mymalloc (loopback_size
);
6012 * outfile-check directory
6015 char *outfile_check_directory
= NULL
;
6017 if (outfile_check_dir
== NULL
)
6019 outfile_check_directory
= (char *) mymalloc (session_size
);
6021 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
6025 outfile_check_directory
= outfile_check_dir
;
6028 data
.outfile_check_directory
= outfile_check_directory
;
6032 struct stat outfile_check_stat
;
6034 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6036 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6040 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6045 else if (outfile_check_dir
== NULL
)
6048 #define mkdir(name,mode) mkdir (name)
6051 if (mkdir (outfile_check_directory
, 0700) == -1)
6053 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6061 * special other stuff
6064 if (hash_mode
== 9710)
6067 outfile_format_chgd
= 1;
6070 if (hash_mode
== 9810)
6073 outfile_format_chgd
= 1;
6076 if (hash_mode
== 10410)
6079 outfile_format_chgd
= 1;
6086 data
.hash_mode
= hash_mode
;
6087 data
.restore
= restore
;
6088 data
.restore_timer
= restore_timer
;
6089 data
.restore_disable
= restore_disable
;
6090 data
.status
= status
;
6091 data
.status_timer
= status_timer
;
6092 data
.status_automat
= status_automat
;
6093 data
.loopback
= loopback
;
6094 data
.runtime
= runtime
;
6095 data
.remove
= remove
;
6096 data
.remove_timer
= remove_timer
;
6097 data
.debug_mode
= debug_mode
;
6098 data
.debug_file
= debug_file
;
6099 data
.username
= username
;
6101 data
.outfile
= outfile
;
6102 data
.outfile_format
= outfile_format
;
6103 data
.outfile_autohex
= outfile_autohex
;
6104 data
.hex_charset
= hex_charset
;
6105 data
.hex_salt
= hex_salt
;
6106 data
.hex_wordlist
= hex_wordlist
;
6107 data
.separator
= separator
;
6108 data
.rp_files
= rp_files
;
6109 data
.rp_files_cnt
= rp_files_cnt
;
6110 data
.rp_gen
= rp_gen
;
6111 data
.rp_gen_seed
= rp_gen_seed
;
6113 data
.benchmark
= benchmark
;
6116 data
.powertune_enable
= powertune_enable
;
6117 data
.logfile_disable
= logfile_disable
;
6118 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6119 data
.scrypt_tmto
= scrypt_tmto
;
6122 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6127 char *resolved_path
= realpath (myargv
[0], NULL
);
6129 char *install_dir
= get_install_dir (resolved_path
);
6130 char *profile_dir
= NULL
;
6131 char *session_dir
= NULL
;
6133 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6135 struct passwd
*pw
= getpwuid (getuid ());
6137 const char *homedir
= pw
->pw_dir
;
6139 profile_dir
= get_profile_dir (homedir
);
6140 session_dir
= get_session_dir (profile_dir
, session
);
6144 profile_dir
= install_dir
;
6145 session_dir
= install_dir
;
6148 myfree (resolved_path
);
6152 char *install_dir
= get_install_dir (myargv
[0]);
6153 char *profile_dir
= install_dir
;
6154 char *session_dir
= install_dir
;
6158 data
.install_dir
= install_dir
;
6159 data
.profile_dir
= profile_dir
;
6160 data
.session_dir
= session_dir
;
6168 set_cpu_affinity (cpu_affinity
);
6171 if (rp_gen_seed_chgd
== 0)
6177 srand (rp_gen_seed
);
6184 if (logfile_disable
== 0)
6186 size_t logfile_size
= strlen (session
) + 32;
6188 char *logfile
= (char *) mymalloc (logfile_size
);
6190 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6192 data
.logfile
= logfile
;
6194 char *topid
= logfile_generate_topid ();
6199 // logfile_append() checks for logfile_disable internally to make it easier from here
6201 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6202 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6203 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6204 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6205 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6206 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6207 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6208 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6209 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6210 #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));
6212 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6213 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6214 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6215 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6216 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6217 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6218 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6219 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6221 logfile_top_msg ("START");
6223 logfile_top_uint (attack_mode
);
6224 logfile_top_uint (attack_kern
);
6225 logfile_top_uint (benchmark
);
6226 logfile_top_uint (benchmark_mode
);
6227 logfile_top_uint (bitmap_min
);
6228 logfile_top_uint (bitmap_max
);
6229 logfile_top_uint (debug_mode
);
6230 logfile_top_uint (force
);
6231 logfile_top_uint (gpu_accel
);
6232 logfile_top_uint (gpu_loops
);
6233 logfile_top_uint (gpu_temp_abort
);
6234 logfile_top_uint (gpu_temp_disable
);
6235 logfile_top_uint (gpu_temp_retain
);
6236 logfile_top_uint (hash_mode
);
6237 logfile_top_uint (hex_charset
);
6238 logfile_top_uint (hex_salt
);
6239 logfile_top_uint (hex_wordlist
);
6240 logfile_top_uint (increment
);
6241 logfile_top_uint (increment_max
);
6242 logfile_top_uint (increment_min
);
6243 logfile_top_uint (keyspace
);
6244 logfile_top_uint (left
);
6245 logfile_top_uint (logfile_disable
);
6246 logfile_top_uint (loopback
);
6247 logfile_top_uint (markov_classic
);
6248 logfile_top_uint (markov_disable
);
6249 logfile_top_uint (markov_threshold
);
6250 logfile_top_uint (outfile_autohex
);
6251 logfile_top_uint (outfile_check_timer
);
6252 logfile_top_uint (outfile_format
);
6253 logfile_top_uint (potfile_disable
);
6254 logfile_top_uint (powertune_enable
);
6255 logfile_top_uint (scrypt_tmto
);
6256 logfile_top_uint (quiet
);
6257 logfile_top_uint (remove
);
6258 logfile_top_uint (remove_timer
);
6259 logfile_top_uint (restore
);
6260 logfile_top_uint (restore_disable
);
6261 logfile_top_uint (restore_timer
);
6262 logfile_top_uint (rp_gen
);
6263 logfile_top_uint (rp_gen_func_max
);
6264 logfile_top_uint (rp_gen_func_min
);
6265 logfile_top_uint (rp_gen_seed
);
6266 logfile_top_uint (runtime
);
6267 logfile_top_uint (segment_size
);
6268 logfile_top_uint (show
);
6269 logfile_top_uint (status
);
6270 logfile_top_uint (status_automat
);
6271 logfile_top_uint (status_timer
);
6272 logfile_top_uint (usage
);
6273 logfile_top_uint (username
);
6274 logfile_top_uint (version
);
6275 logfile_top_uint (weak_hash_threshold
);
6276 logfile_top_uint (workload_profile
);
6277 logfile_top_uint64 (limit
);
6278 logfile_top_uint64 (skip
);
6279 logfile_top_char (separator
);
6280 logfile_top_string (cpu_affinity
);
6281 logfile_top_string (custom_charset_1
);
6282 logfile_top_string (custom_charset_2
);
6283 logfile_top_string (custom_charset_3
);
6284 logfile_top_string (custom_charset_4
);
6285 logfile_top_string (debug_file
);
6286 logfile_top_string (gpu_devices
);
6287 logfile_top_string (induction_dir
);
6288 logfile_top_string (markov_hcstat
);
6289 logfile_top_string (outfile
);
6290 logfile_top_string (outfile_check_dir
);
6291 logfile_top_string (rule_buf_l
);
6292 logfile_top_string (rule_buf_r
);
6293 logfile_top_string (session
);
6294 logfile_top_string (truecrypt_keyfiles
);
6300 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6309 * disable useless stuff for benchmark
6314 restore_disable
= 1;
6315 potfile_disable
= 1;
6316 weak_hash_threshold
= 0;
6318 data
.restore_timer
= restore_timer
;
6319 data
.status_timer
= status_timer
;
6320 data
.restore_disable
= restore_disable
;
6322 if (benchmark_mode
== 1)
6328 * force attack mode to be bruteforce
6331 attack_mode
= ATTACK_MODE_BF
;
6332 attack_kern
= ATTACK_KERN_BF
;
6334 if (runtime_chgd
== 0)
6338 if (benchmark_mode
== 1) runtime
= 17;
6340 data
.runtime
= runtime
;
6350 uint attack_exec
= 0;
6354 uint esalt_size
= 0;
6356 uint dgst_pos0
= -1;
6357 uint dgst_pos1
= -1;
6358 uint dgst_pos2
= -1;
6359 uint dgst_pos3
= -1;
6361 int (*parse_func
) (char *, uint
, hash_t
*);
6362 int (*sort_by_digest
) (const void *, const void *);
6364 uint algorithm_pos
= 0;
6365 uint algorithm_max
= 1;
6367 uint
*algorithms
= default_benchmark_algorithms
;
6369 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6371 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6374 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6375 * the following algos are skipped entirely
6378 if (algorithm_pos
> 0)
6382 rd
= init_restore (argc
, argv
);
6388 * update hash_mode in case of multihash benchmark
6393 if (hash_mode_chgd
== 0)
6395 hash_mode
= algorithms
[algorithm_pos
];
6397 data
.hash_mode
= hash_mode
;
6407 case 0: hash_type
= HASH_TYPE_MD5
;
6408 salt_type
= SALT_TYPE_NONE
;
6409 attack_exec
= ATTACK_EXEC_ON_GPU
;
6410 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6411 | OPTS_TYPE_PT_ADD80
6412 | OPTS_TYPE_PT_ADDBITS14
;
6413 kern_type
= KERN_TYPE_MD5
;
6414 dgst_size
= DGST_SIZE_4_4
;
6415 parse_func
= md5_parse_hash
;
6416 sort_by_digest
= sort_by_digest_4_4
;
6417 opti_type
= OPTI_TYPE_ZERO_BYTE
6418 | OPTI_TYPE_PRECOMPUTE_INIT
6419 | OPTI_TYPE_PRECOMPUTE_MERKLE
6420 | OPTI_TYPE_MEET_IN_MIDDLE
6421 | OPTI_TYPE_EARLY_SKIP
6422 | OPTI_TYPE_NOT_ITERATED
6423 | OPTI_TYPE_NOT_SALTED
6424 | OPTI_TYPE_RAW_HASH
;
6431 case 10: hash_type
= HASH_TYPE_MD5
;
6432 salt_type
= SALT_TYPE_INTERN
;
6433 attack_exec
= ATTACK_EXEC_ON_GPU
;
6434 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6435 | OPTS_TYPE_ST_ADD80
6436 | OPTS_TYPE_ST_ADDBITS14
;
6437 kern_type
= KERN_TYPE_MD5_PWSLT
;
6438 dgst_size
= DGST_SIZE_4_4
;
6439 parse_func
= md5s_parse_hash
;
6440 sort_by_digest
= sort_by_digest_4_4
;
6441 opti_type
= OPTI_TYPE_ZERO_BYTE
6442 | OPTI_TYPE_PRECOMPUTE_INIT
6443 | OPTI_TYPE_PRECOMPUTE_MERKLE
6444 | OPTI_TYPE_MEET_IN_MIDDLE
6445 | OPTI_TYPE_EARLY_SKIP
6446 | OPTI_TYPE_NOT_ITERATED
6447 | OPTI_TYPE_APPENDED_SALT
6448 | OPTI_TYPE_RAW_HASH
;
6455 case 11: hash_type
= HASH_TYPE_MD5
;
6456 salt_type
= SALT_TYPE_INTERN
;
6457 attack_exec
= ATTACK_EXEC_ON_GPU
;
6458 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6459 | OPTS_TYPE_ST_ADD80
6460 | OPTS_TYPE_ST_ADDBITS14
;
6461 kern_type
= KERN_TYPE_MD5_PWSLT
;
6462 dgst_size
= DGST_SIZE_4_4
;
6463 parse_func
= joomla_parse_hash
;
6464 sort_by_digest
= sort_by_digest_4_4
;
6465 opti_type
= OPTI_TYPE_ZERO_BYTE
6466 | OPTI_TYPE_PRECOMPUTE_INIT
6467 | OPTI_TYPE_PRECOMPUTE_MERKLE
6468 | OPTI_TYPE_MEET_IN_MIDDLE
6469 | OPTI_TYPE_EARLY_SKIP
6470 | OPTI_TYPE_NOT_ITERATED
6471 | OPTI_TYPE_APPENDED_SALT
6472 | OPTI_TYPE_RAW_HASH
;
6479 case 12: hash_type
= HASH_TYPE_MD5
;
6480 salt_type
= SALT_TYPE_INTERN
;
6481 attack_exec
= ATTACK_EXEC_ON_GPU
;
6482 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6483 | OPTS_TYPE_ST_ADD80
6484 | OPTS_TYPE_ST_ADDBITS14
;
6485 kern_type
= KERN_TYPE_MD5_PWSLT
;
6486 dgst_size
= DGST_SIZE_4_4
;
6487 parse_func
= postgresql_parse_hash
;
6488 sort_by_digest
= sort_by_digest_4_4
;
6489 opti_type
= OPTI_TYPE_ZERO_BYTE
6490 | OPTI_TYPE_PRECOMPUTE_INIT
6491 | OPTI_TYPE_PRECOMPUTE_MERKLE
6492 | OPTI_TYPE_MEET_IN_MIDDLE
6493 | OPTI_TYPE_EARLY_SKIP
6494 | OPTI_TYPE_NOT_ITERATED
6495 | OPTI_TYPE_APPENDED_SALT
6496 | OPTI_TYPE_RAW_HASH
;
6503 case 20: hash_type
= HASH_TYPE_MD5
;
6504 salt_type
= SALT_TYPE_INTERN
;
6505 attack_exec
= ATTACK_EXEC_ON_GPU
;
6506 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6507 | OPTS_TYPE_PT_ADD80
6508 | OPTS_TYPE_PT_ADDBITS14
;
6509 kern_type
= KERN_TYPE_MD5_SLTPW
;
6510 dgst_size
= DGST_SIZE_4_4
;
6511 parse_func
= md5s_parse_hash
;
6512 sort_by_digest
= sort_by_digest_4_4
;
6513 opti_type
= OPTI_TYPE_ZERO_BYTE
6514 | OPTI_TYPE_PRECOMPUTE_INIT
6515 | OPTI_TYPE_PRECOMPUTE_MERKLE
6516 | OPTI_TYPE_EARLY_SKIP
6517 | OPTI_TYPE_NOT_ITERATED
6518 | OPTI_TYPE_PREPENDED_SALT
6519 | OPTI_TYPE_RAW_HASH
;
6526 case 21: hash_type
= HASH_TYPE_MD5
;
6527 salt_type
= SALT_TYPE_INTERN
;
6528 attack_exec
= ATTACK_EXEC_ON_GPU
;
6529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6530 | OPTS_TYPE_PT_ADD80
6531 | OPTS_TYPE_PT_ADDBITS14
;
6532 kern_type
= KERN_TYPE_MD5_SLTPW
;
6533 dgst_size
= DGST_SIZE_4_4
;
6534 parse_func
= osc_parse_hash
;
6535 sort_by_digest
= sort_by_digest_4_4
;
6536 opti_type
= OPTI_TYPE_ZERO_BYTE
6537 | OPTI_TYPE_PRECOMPUTE_INIT
6538 | OPTI_TYPE_PRECOMPUTE_MERKLE
6539 | OPTI_TYPE_EARLY_SKIP
6540 | OPTI_TYPE_NOT_ITERATED
6541 | OPTI_TYPE_PREPENDED_SALT
6542 | OPTI_TYPE_RAW_HASH
;
6549 case 22: hash_type
= HASH_TYPE_MD5
;
6550 salt_type
= SALT_TYPE_EMBEDDED
;
6551 attack_exec
= ATTACK_EXEC_ON_GPU
;
6552 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6553 | OPTS_TYPE_PT_ADD80
6554 | OPTS_TYPE_PT_ADDBITS14
;
6555 kern_type
= KERN_TYPE_MD5_SLTPW
;
6556 dgst_size
= DGST_SIZE_4_4
;
6557 parse_func
= netscreen_parse_hash
;
6558 sort_by_digest
= sort_by_digest_4_4
;
6559 opti_type
= OPTI_TYPE_ZERO_BYTE
6560 | OPTI_TYPE_PRECOMPUTE_INIT
6561 | OPTI_TYPE_PRECOMPUTE_MERKLE
6562 | OPTI_TYPE_EARLY_SKIP
6563 | OPTI_TYPE_NOT_ITERATED
6564 | OPTI_TYPE_PREPENDED_SALT
6565 | OPTI_TYPE_RAW_HASH
;
6572 case 23: hash_type
= HASH_TYPE_MD5
;
6573 salt_type
= SALT_TYPE_EMBEDDED
;
6574 attack_exec
= ATTACK_EXEC_ON_GPU
;
6575 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6576 | OPTS_TYPE_PT_ADD80
6577 | OPTS_TYPE_PT_ADDBITS14
;
6578 kern_type
= KERN_TYPE_MD5_SLTPW
;
6579 dgst_size
= DGST_SIZE_4_4
;
6580 parse_func
= skype_parse_hash
;
6581 sort_by_digest
= sort_by_digest_4_4
;
6582 opti_type
= OPTI_TYPE_ZERO_BYTE
6583 | OPTI_TYPE_PRECOMPUTE_INIT
6584 | OPTI_TYPE_PRECOMPUTE_MERKLE
6585 | OPTI_TYPE_EARLY_SKIP
6586 | OPTI_TYPE_NOT_ITERATED
6587 | OPTI_TYPE_PREPENDED_SALT
6588 | OPTI_TYPE_RAW_HASH
;
6595 case 30: hash_type
= HASH_TYPE_MD5
;
6596 salt_type
= SALT_TYPE_INTERN
;
6597 attack_exec
= ATTACK_EXEC_ON_GPU
;
6598 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6599 | OPTS_TYPE_PT_UNICODE
6600 | OPTS_TYPE_ST_ADD80
6601 | OPTS_TYPE_ST_ADDBITS14
;
6602 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6603 dgst_size
= DGST_SIZE_4_4
;
6604 parse_func
= md5s_parse_hash
;
6605 sort_by_digest
= sort_by_digest_4_4
;
6606 opti_type
= OPTI_TYPE_ZERO_BYTE
6607 | OPTI_TYPE_PRECOMPUTE_INIT
6608 | OPTI_TYPE_PRECOMPUTE_MERKLE
6609 | OPTI_TYPE_MEET_IN_MIDDLE
6610 | OPTI_TYPE_EARLY_SKIP
6611 | OPTI_TYPE_NOT_ITERATED
6612 | OPTI_TYPE_APPENDED_SALT
6613 | OPTI_TYPE_RAW_HASH
;
6620 case 40: hash_type
= HASH_TYPE_MD5
;
6621 salt_type
= SALT_TYPE_INTERN
;
6622 attack_exec
= ATTACK_EXEC_ON_GPU
;
6623 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6624 | OPTS_TYPE_PT_ADD80
6625 | OPTS_TYPE_PT_ADDBITS14
6626 | OPTS_TYPE_PT_UNICODE
;
6627 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6628 dgst_size
= DGST_SIZE_4_4
;
6629 parse_func
= md5s_parse_hash
;
6630 sort_by_digest
= sort_by_digest_4_4
;
6631 opti_type
= OPTI_TYPE_ZERO_BYTE
6632 | OPTI_TYPE_PRECOMPUTE_INIT
6633 | OPTI_TYPE_PRECOMPUTE_MERKLE
6634 | OPTI_TYPE_EARLY_SKIP
6635 | OPTI_TYPE_NOT_ITERATED
6636 | OPTI_TYPE_PREPENDED_SALT
6637 | OPTI_TYPE_RAW_HASH
;
6644 case 50: hash_type
= HASH_TYPE_MD5
;
6645 salt_type
= SALT_TYPE_INTERN
;
6646 attack_exec
= ATTACK_EXEC_ON_GPU
;
6647 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6648 | OPTS_TYPE_ST_ADD80
6649 | OPTS_TYPE_ST_ADDBITS14
;
6650 kern_type
= KERN_TYPE_HMACMD5_PW
;
6651 dgst_size
= DGST_SIZE_4_4
;
6652 parse_func
= hmacmd5_parse_hash
;
6653 sort_by_digest
= sort_by_digest_4_4
;
6654 opti_type
= OPTI_TYPE_ZERO_BYTE
6655 | OPTI_TYPE_NOT_ITERATED
;
6662 case 60: hash_type
= HASH_TYPE_MD5
;
6663 salt_type
= SALT_TYPE_INTERN
;
6664 attack_exec
= ATTACK_EXEC_ON_GPU
;
6665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6666 | OPTS_TYPE_PT_ADD80
6667 | OPTS_TYPE_PT_ADDBITS14
;
6668 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6669 dgst_size
= DGST_SIZE_4_4
;
6670 parse_func
= hmacmd5_parse_hash
;
6671 sort_by_digest
= sort_by_digest_4_4
;
6672 opti_type
= OPTI_TYPE_ZERO_BYTE
6673 | OPTI_TYPE_NOT_ITERATED
;
6680 case 100: hash_type
= HASH_TYPE_SHA1
;
6681 salt_type
= SALT_TYPE_NONE
;
6682 attack_exec
= ATTACK_EXEC_ON_GPU
;
6683 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6684 | OPTS_TYPE_PT_ADD80
6685 | OPTS_TYPE_PT_ADDBITS15
;
6686 kern_type
= KERN_TYPE_SHA1
;
6687 dgst_size
= DGST_SIZE_4_5
;
6688 parse_func
= sha1_parse_hash
;
6689 sort_by_digest
= sort_by_digest_4_5
;
6690 opti_type
= OPTI_TYPE_ZERO_BYTE
6691 | OPTI_TYPE_PRECOMPUTE_INIT
6692 | OPTI_TYPE_PRECOMPUTE_MERKLE
6693 | OPTI_TYPE_EARLY_SKIP
6694 | OPTI_TYPE_NOT_ITERATED
6695 | OPTI_TYPE_NOT_SALTED
6696 | OPTI_TYPE_RAW_HASH
;
6703 case 101: hash_type
= HASH_TYPE_SHA1
;
6704 salt_type
= SALT_TYPE_NONE
;
6705 attack_exec
= ATTACK_EXEC_ON_GPU
;
6706 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6707 | OPTS_TYPE_PT_ADD80
6708 | OPTS_TYPE_PT_ADDBITS15
;
6709 kern_type
= KERN_TYPE_SHA1
;
6710 dgst_size
= DGST_SIZE_4_5
;
6711 parse_func
= sha1b64_parse_hash
;
6712 sort_by_digest
= sort_by_digest_4_5
;
6713 opti_type
= OPTI_TYPE_ZERO_BYTE
6714 | OPTI_TYPE_PRECOMPUTE_INIT
6715 | OPTI_TYPE_PRECOMPUTE_MERKLE
6716 | OPTI_TYPE_EARLY_SKIP
6717 | OPTI_TYPE_NOT_ITERATED
6718 | OPTI_TYPE_NOT_SALTED
6719 | OPTI_TYPE_RAW_HASH
;
6726 case 110: hash_type
= HASH_TYPE_SHA1
;
6727 salt_type
= SALT_TYPE_INTERN
;
6728 attack_exec
= ATTACK_EXEC_ON_GPU
;
6729 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6730 | OPTS_TYPE_ST_ADD80
6731 | OPTS_TYPE_ST_ADDBITS15
;
6732 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6733 dgst_size
= DGST_SIZE_4_5
;
6734 parse_func
= sha1s_parse_hash
;
6735 sort_by_digest
= sort_by_digest_4_5
;
6736 opti_type
= OPTI_TYPE_ZERO_BYTE
6737 | OPTI_TYPE_PRECOMPUTE_INIT
6738 | OPTI_TYPE_PRECOMPUTE_MERKLE
6739 | OPTI_TYPE_EARLY_SKIP
6740 | OPTI_TYPE_NOT_ITERATED
6741 | OPTI_TYPE_APPENDED_SALT
6742 | OPTI_TYPE_RAW_HASH
;
6749 case 111: hash_type
= HASH_TYPE_SHA1
;
6750 salt_type
= SALT_TYPE_EMBEDDED
;
6751 attack_exec
= ATTACK_EXEC_ON_GPU
;
6752 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6753 | OPTS_TYPE_ST_ADD80
6754 | OPTS_TYPE_ST_ADDBITS15
;
6755 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6756 dgst_size
= DGST_SIZE_4_5
;
6757 parse_func
= sha1b64s_parse_hash
;
6758 sort_by_digest
= sort_by_digest_4_5
;
6759 opti_type
= OPTI_TYPE_ZERO_BYTE
6760 | OPTI_TYPE_PRECOMPUTE_INIT
6761 | OPTI_TYPE_PRECOMPUTE_MERKLE
6762 | OPTI_TYPE_EARLY_SKIP
6763 | OPTI_TYPE_NOT_ITERATED
6764 | OPTI_TYPE_APPENDED_SALT
6765 | OPTI_TYPE_RAW_HASH
;
6772 case 112: hash_type
= HASH_TYPE_SHA1
;
6773 salt_type
= SALT_TYPE_INTERN
;
6774 attack_exec
= ATTACK_EXEC_ON_GPU
;
6775 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6776 | OPTS_TYPE_ST_ADD80
6777 | OPTS_TYPE_ST_ADDBITS15
6779 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6780 dgst_size
= DGST_SIZE_4_5
;
6781 parse_func
= oracles_parse_hash
;
6782 sort_by_digest
= sort_by_digest_4_5
;
6783 opti_type
= OPTI_TYPE_ZERO_BYTE
6784 | OPTI_TYPE_PRECOMPUTE_INIT
6785 | OPTI_TYPE_PRECOMPUTE_MERKLE
6786 | OPTI_TYPE_EARLY_SKIP
6787 | OPTI_TYPE_NOT_ITERATED
6788 | OPTI_TYPE_APPENDED_SALT
6789 | OPTI_TYPE_RAW_HASH
;
6796 case 120: hash_type
= HASH_TYPE_SHA1
;
6797 salt_type
= SALT_TYPE_INTERN
;
6798 attack_exec
= ATTACK_EXEC_ON_GPU
;
6799 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6800 | OPTS_TYPE_PT_ADD80
6801 | OPTS_TYPE_PT_ADDBITS15
;
6802 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6803 dgst_size
= DGST_SIZE_4_5
;
6804 parse_func
= sha1s_parse_hash
;
6805 sort_by_digest
= sort_by_digest_4_5
;
6806 opti_type
= OPTI_TYPE_ZERO_BYTE
6807 | OPTI_TYPE_PRECOMPUTE_INIT
6808 | OPTI_TYPE_PRECOMPUTE_MERKLE
6809 | OPTI_TYPE_EARLY_SKIP
6810 | OPTI_TYPE_NOT_ITERATED
6811 | OPTI_TYPE_PREPENDED_SALT
6812 | OPTI_TYPE_RAW_HASH
;
6819 case 121: hash_type
= HASH_TYPE_SHA1
;
6820 salt_type
= SALT_TYPE_INTERN
;
6821 attack_exec
= ATTACK_EXEC_ON_GPU
;
6822 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6823 | OPTS_TYPE_PT_ADD80
6824 | OPTS_TYPE_PT_ADDBITS15
6825 | OPTS_TYPE_ST_LOWER
;
6826 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6827 dgst_size
= DGST_SIZE_4_5
;
6828 parse_func
= smf_parse_hash
;
6829 sort_by_digest
= sort_by_digest_4_5
;
6830 opti_type
= OPTI_TYPE_ZERO_BYTE
6831 | OPTI_TYPE_PRECOMPUTE_INIT
6832 | OPTI_TYPE_PRECOMPUTE_MERKLE
6833 | OPTI_TYPE_EARLY_SKIP
6834 | OPTI_TYPE_NOT_ITERATED
6835 | OPTI_TYPE_PREPENDED_SALT
6836 | OPTI_TYPE_RAW_HASH
;
6843 case 122: hash_type
= HASH_TYPE_SHA1
;
6844 salt_type
= SALT_TYPE_EMBEDDED
;
6845 attack_exec
= ATTACK_EXEC_ON_GPU
;
6846 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6847 | OPTS_TYPE_PT_ADD80
6848 | OPTS_TYPE_PT_ADDBITS15
6850 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6851 dgst_size
= DGST_SIZE_4_5
;
6852 parse_func
= osx1_parse_hash
;
6853 sort_by_digest
= sort_by_digest_4_5
;
6854 opti_type
= OPTI_TYPE_ZERO_BYTE
6855 | OPTI_TYPE_PRECOMPUTE_INIT
6856 | OPTI_TYPE_PRECOMPUTE_MERKLE
6857 | OPTI_TYPE_EARLY_SKIP
6858 | OPTI_TYPE_NOT_ITERATED
6859 | OPTI_TYPE_PREPENDED_SALT
6860 | OPTI_TYPE_RAW_HASH
;
6867 case 124: hash_type
= HASH_TYPE_SHA1
;
6868 salt_type
= SALT_TYPE_EMBEDDED
;
6869 attack_exec
= ATTACK_EXEC_ON_GPU
;
6870 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6871 | OPTS_TYPE_PT_ADD80
6872 | OPTS_TYPE_PT_ADDBITS15
;
6873 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6874 dgst_size
= DGST_SIZE_4_5
;
6875 parse_func
= djangosha1_parse_hash
;
6876 sort_by_digest
= sort_by_digest_4_5
;
6877 opti_type
= OPTI_TYPE_ZERO_BYTE
6878 | OPTI_TYPE_PRECOMPUTE_INIT
6879 | OPTI_TYPE_PRECOMPUTE_MERKLE
6880 | OPTI_TYPE_EARLY_SKIP
6881 | OPTI_TYPE_NOT_ITERATED
6882 | OPTI_TYPE_PREPENDED_SALT
6883 | OPTI_TYPE_RAW_HASH
;
6890 case 130: hash_type
= HASH_TYPE_SHA1
;
6891 salt_type
= SALT_TYPE_INTERN
;
6892 attack_exec
= ATTACK_EXEC_ON_GPU
;
6893 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6894 | OPTS_TYPE_PT_UNICODE
6895 | OPTS_TYPE_ST_ADD80
6896 | OPTS_TYPE_ST_ADDBITS15
;
6897 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6898 dgst_size
= DGST_SIZE_4_5
;
6899 parse_func
= sha1s_parse_hash
;
6900 sort_by_digest
= sort_by_digest_4_5
;
6901 opti_type
= OPTI_TYPE_ZERO_BYTE
6902 | OPTI_TYPE_PRECOMPUTE_INIT
6903 | OPTI_TYPE_PRECOMPUTE_MERKLE
6904 | OPTI_TYPE_EARLY_SKIP
6905 | OPTI_TYPE_NOT_ITERATED
6906 | OPTI_TYPE_APPENDED_SALT
6907 | OPTI_TYPE_RAW_HASH
;
6914 case 131: hash_type
= HASH_TYPE_SHA1
;
6915 salt_type
= SALT_TYPE_EMBEDDED
;
6916 attack_exec
= ATTACK_EXEC_ON_GPU
;
6917 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6918 | OPTS_TYPE_PT_UNICODE
6919 | OPTS_TYPE_PT_UPPER
6920 | OPTS_TYPE_ST_ADD80
6921 | OPTS_TYPE_ST_ADDBITS15
6923 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6924 dgst_size
= DGST_SIZE_4_5
;
6925 parse_func
= mssql2000_parse_hash
;
6926 sort_by_digest
= sort_by_digest_4_5
;
6927 opti_type
= OPTI_TYPE_ZERO_BYTE
6928 | OPTI_TYPE_PRECOMPUTE_INIT
6929 | OPTI_TYPE_PRECOMPUTE_MERKLE
6930 | OPTI_TYPE_EARLY_SKIP
6931 | OPTI_TYPE_NOT_ITERATED
6932 | OPTI_TYPE_APPENDED_SALT
6933 | OPTI_TYPE_RAW_HASH
;
6940 case 132: hash_type
= HASH_TYPE_SHA1
;
6941 salt_type
= SALT_TYPE_EMBEDDED
;
6942 attack_exec
= ATTACK_EXEC_ON_GPU
;
6943 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6944 | OPTS_TYPE_PT_UNICODE
6945 | OPTS_TYPE_ST_ADD80
6946 | OPTS_TYPE_ST_ADDBITS15
6948 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6949 dgst_size
= DGST_SIZE_4_5
;
6950 parse_func
= mssql2005_parse_hash
;
6951 sort_by_digest
= sort_by_digest_4_5
;
6952 opti_type
= OPTI_TYPE_ZERO_BYTE
6953 | OPTI_TYPE_PRECOMPUTE_INIT
6954 | OPTI_TYPE_PRECOMPUTE_MERKLE
6955 | OPTI_TYPE_EARLY_SKIP
6956 | OPTI_TYPE_NOT_ITERATED
6957 | OPTI_TYPE_APPENDED_SALT
6958 | OPTI_TYPE_RAW_HASH
;
6965 case 133: hash_type
= HASH_TYPE_SHA1
;
6966 salt_type
= SALT_TYPE_EMBEDDED
;
6967 attack_exec
= ATTACK_EXEC_ON_GPU
;
6968 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6969 | OPTS_TYPE_PT_UNICODE
6970 | OPTS_TYPE_ST_ADD80
6971 | OPTS_TYPE_ST_ADDBITS15
;
6972 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6973 dgst_size
= DGST_SIZE_4_5
;
6974 parse_func
= peoplesoft_parse_hash
;
6975 sort_by_digest
= sort_by_digest_4_5
;
6976 opti_type
= OPTI_TYPE_ZERO_BYTE
6977 | OPTI_TYPE_PRECOMPUTE_INIT
6978 | OPTI_TYPE_PRECOMPUTE_MERKLE
6979 | OPTI_TYPE_EARLY_SKIP
6980 | OPTI_TYPE_NOT_ITERATED
6981 | OPTI_TYPE_APPENDED_SALT
6982 | OPTI_TYPE_RAW_HASH
;
6989 case 140: hash_type
= HASH_TYPE_SHA1
;
6990 salt_type
= SALT_TYPE_INTERN
;
6991 attack_exec
= ATTACK_EXEC_ON_GPU
;
6992 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6993 | OPTS_TYPE_PT_ADD80
6994 | OPTS_TYPE_PT_ADDBITS15
6995 | OPTS_TYPE_PT_UNICODE
;
6996 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6997 dgst_size
= DGST_SIZE_4_5
;
6998 parse_func
= sha1s_parse_hash
;
6999 sort_by_digest
= sort_by_digest_4_5
;
7000 opti_type
= OPTI_TYPE_ZERO_BYTE
7001 | OPTI_TYPE_PRECOMPUTE_INIT
7002 | OPTI_TYPE_PRECOMPUTE_MERKLE
7003 | OPTI_TYPE_EARLY_SKIP
7004 | OPTI_TYPE_NOT_ITERATED
7005 | OPTI_TYPE_PREPENDED_SALT
7006 | OPTI_TYPE_RAW_HASH
;
7013 case 141: hash_type
= HASH_TYPE_SHA1
;
7014 salt_type
= SALT_TYPE_EMBEDDED
;
7015 attack_exec
= ATTACK_EXEC_ON_GPU
;
7016 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7017 | OPTS_TYPE_PT_ADD80
7018 | OPTS_TYPE_PT_ADDBITS15
7019 | OPTS_TYPE_PT_UNICODE
7020 | OPTS_TYPE_ST_BASE64
;
7021 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7022 dgst_size
= DGST_SIZE_4_5
;
7023 parse_func
= episerver_parse_hash
;
7024 sort_by_digest
= sort_by_digest_4_5
;
7025 opti_type
= OPTI_TYPE_ZERO_BYTE
7026 | OPTI_TYPE_PRECOMPUTE_INIT
7027 | OPTI_TYPE_PRECOMPUTE_MERKLE
7028 | OPTI_TYPE_EARLY_SKIP
7029 | OPTI_TYPE_NOT_ITERATED
7030 | OPTI_TYPE_PREPENDED_SALT
7031 | OPTI_TYPE_RAW_HASH
;
7038 case 150: hash_type
= HASH_TYPE_SHA1
;
7039 salt_type
= SALT_TYPE_INTERN
;
7040 attack_exec
= ATTACK_EXEC_ON_GPU
;
7041 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7042 | OPTS_TYPE_ST_ADD80
7043 | OPTS_TYPE_ST_ADDBITS15
;
7044 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7045 dgst_size
= DGST_SIZE_4_5
;
7046 parse_func
= hmacsha1_parse_hash
;
7047 sort_by_digest
= sort_by_digest_4_5
;
7048 opti_type
= OPTI_TYPE_ZERO_BYTE
7049 | OPTI_TYPE_NOT_ITERATED
;
7056 case 160: hash_type
= HASH_TYPE_SHA1
;
7057 salt_type
= SALT_TYPE_INTERN
;
7058 attack_exec
= ATTACK_EXEC_ON_GPU
;
7059 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7060 | OPTS_TYPE_PT_ADD80
7061 | OPTS_TYPE_PT_ADDBITS15
;
7062 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7063 dgst_size
= DGST_SIZE_4_5
;
7064 parse_func
= hmacsha1_parse_hash
;
7065 sort_by_digest
= sort_by_digest_4_5
;
7066 opti_type
= OPTI_TYPE_ZERO_BYTE
7067 | OPTI_TYPE_NOT_ITERATED
;
7074 case 190: hash_type
= HASH_TYPE_SHA1
;
7075 salt_type
= SALT_TYPE_NONE
;
7076 attack_exec
= ATTACK_EXEC_ON_GPU
;
7077 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7078 | OPTS_TYPE_PT_ADD80
7079 | OPTS_TYPE_PT_ADDBITS15
;
7080 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7081 dgst_size
= DGST_SIZE_4_5
;
7082 parse_func
= sha1linkedin_parse_hash
;
7083 sort_by_digest
= sort_by_digest_4_5
;
7084 opti_type
= OPTI_TYPE_ZERO_BYTE
7085 | OPTI_TYPE_PRECOMPUTE_INIT
7086 | OPTI_TYPE_EARLY_SKIP
7087 | OPTI_TYPE_NOT_ITERATED
7088 | OPTI_TYPE_NOT_SALTED
;
7095 case 200: hash_type
= HASH_TYPE_MYSQL
;
7096 salt_type
= SALT_TYPE_NONE
;
7097 attack_exec
= ATTACK_EXEC_ON_GPU
;
7099 kern_type
= KERN_TYPE_MYSQL
;
7100 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7101 parse_func
= mysql323_parse_hash
;
7102 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7103 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7110 case 300: hash_type
= HASH_TYPE_SHA1
;
7111 salt_type
= SALT_TYPE_NONE
;
7112 attack_exec
= ATTACK_EXEC_ON_GPU
;
7113 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7114 | OPTS_TYPE_PT_ADD80
7115 | OPTS_TYPE_PT_ADDBITS15
;
7116 kern_type
= KERN_TYPE_MYSQL41
;
7117 dgst_size
= DGST_SIZE_4_5
;
7118 parse_func
= sha1_parse_hash
;
7119 sort_by_digest
= sort_by_digest_4_5
;
7120 opti_type
= OPTI_TYPE_ZERO_BYTE
7121 | OPTI_TYPE_PRECOMPUTE_INIT
7122 | OPTI_TYPE_PRECOMPUTE_MERKLE
7123 | OPTI_TYPE_EARLY_SKIP
7124 | OPTI_TYPE_NOT_ITERATED
7125 | OPTI_TYPE_NOT_SALTED
;
7132 case 400: hash_type
= HASH_TYPE_MD5
;
7133 salt_type
= SALT_TYPE_EMBEDDED
;
7134 attack_exec
= ATTACK_EXEC_ON_CPU
;
7135 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7136 kern_type
= KERN_TYPE_PHPASS
;
7137 dgst_size
= DGST_SIZE_4_4
;
7138 parse_func
= phpass_parse_hash
;
7139 sort_by_digest
= sort_by_digest_4_4
;
7140 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7147 case 500: hash_type
= HASH_TYPE_MD5
;
7148 salt_type
= SALT_TYPE_EMBEDDED
;
7149 attack_exec
= ATTACK_EXEC_ON_CPU
;
7150 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7151 kern_type
= KERN_TYPE_MD5CRYPT
;
7152 dgst_size
= DGST_SIZE_4_4
;
7153 parse_func
= md5crypt_parse_hash
;
7154 sort_by_digest
= sort_by_digest_4_4
;
7155 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7162 case 501: hash_type
= HASH_TYPE_MD5
;
7163 salt_type
= SALT_TYPE_EMBEDDED
;
7164 attack_exec
= ATTACK_EXEC_ON_CPU
;
7165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7166 | OPTS_TYPE_HASH_COPY
;
7167 kern_type
= KERN_TYPE_MD5CRYPT
;
7168 dgst_size
= DGST_SIZE_4_4
;
7169 parse_func
= juniper_parse_hash
;
7170 sort_by_digest
= sort_by_digest_4_4
;
7171 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7178 case 900: hash_type
= HASH_TYPE_MD4
;
7179 salt_type
= SALT_TYPE_NONE
;
7180 attack_exec
= ATTACK_EXEC_ON_GPU
;
7181 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7182 | OPTS_TYPE_PT_ADD80
7183 | OPTS_TYPE_PT_ADDBITS14
;
7184 kern_type
= KERN_TYPE_MD4
;
7185 dgst_size
= DGST_SIZE_4_4
;
7186 parse_func
= md4_parse_hash
;
7187 sort_by_digest
= sort_by_digest_4_4
;
7188 opti_type
= OPTI_TYPE_ZERO_BYTE
7189 | OPTI_TYPE_PRECOMPUTE_INIT
7190 | OPTI_TYPE_PRECOMPUTE_MERKLE
7191 | OPTI_TYPE_MEET_IN_MIDDLE
7192 | OPTI_TYPE_EARLY_SKIP
7193 | OPTI_TYPE_NOT_ITERATED
7194 | OPTI_TYPE_NOT_SALTED
7195 | OPTI_TYPE_RAW_HASH
;
7202 case 1000: hash_type
= HASH_TYPE_MD4
;
7203 salt_type
= SALT_TYPE_NONE
;
7204 attack_exec
= ATTACK_EXEC_ON_GPU
;
7205 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7206 | OPTS_TYPE_PT_ADD80
7207 | OPTS_TYPE_PT_ADDBITS14
7208 | OPTS_TYPE_PT_UNICODE
;
7209 kern_type
= KERN_TYPE_MD4_PWU
;
7210 dgst_size
= DGST_SIZE_4_4
;
7211 parse_func
= md4_parse_hash
;
7212 sort_by_digest
= sort_by_digest_4_4
;
7213 opti_type
= OPTI_TYPE_ZERO_BYTE
7214 | OPTI_TYPE_PRECOMPUTE_INIT
7215 | OPTI_TYPE_PRECOMPUTE_MERKLE
7216 | OPTI_TYPE_MEET_IN_MIDDLE
7217 | OPTI_TYPE_EARLY_SKIP
7218 | OPTI_TYPE_NOT_ITERATED
7219 | OPTI_TYPE_NOT_SALTED
7220 | OPTI_TYPE_RAW_HASH
;
7227 case 1100: hash_type
= HASH_TYPE_MD4
;
7228 salt_type
= SALT_TYPE_INTERN
;
7229 attack_exec
= ATTACK_EXEC_ON_GPU
;
7230 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7231 | OPTS_TYPE_PT_ADD80
7232 | OPTS_TYPE_PT_ADDBITS14
7233 | OPTS_TYPE_PT_UNICODE
7234 | OPTS_TYPE_ST_ADD80
7235 | OPTS_TYPE_ST_UNICODE
7236 | OPTS_TYPE_ST_LOWER
;
7237 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7238 dgst_size
= DGST_SIZE_4_4
;
7239 parse_func
= dcc_parse_hash
;
7240 sort_by_digest
= sort_by_digest_4_4
;
7241 opti_type
= OPTI_TYPE_ZERO_BYTE
7242 | OPTI_TYPE_PRECOMPUTE_INIT
7243 | OPTI_TYPE_PRECOMPUTE_MERKLE
7244 | OPTI_TYPE_EARLY_SKIP
7245 | OPTI_TYPE_NOT_ITERATED
;
7252 case 1400: hash_type
= HASH_TYPE_SHA256
;
7253 salt_type
= SALT_TYPE_NONE
;
7254 attack_exec
= ATTACK_EXEC_ON_GPU
;
7255 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7256 | OPTS_TYPE_PT_ADD80
7257 | OPTS_TYPE_PT_ADDBITS15
;
7258 kern_type
= KERN_TYPE_SHA256
;
7259 dgst_size
= DGST_SIZE_4_8
;
7260 parse_func
= sha256_parse_hash
;
7261 sort_by_digest
= sort_by_digest_4_8
;
7262 opti_type
= OPTI_TYPE_ZERO_BYTE
7263 | OPTI_TYPE_PRECOMPUTE_INIT
7264 | OPTI_TYPE_PRECOMPUTE_MERKLE
7265 | OPTI_TYPE_EARLY_SKIP
7266 | OPTI_TYPE_NOT_ITERATED
7267 | OPTI_TYPE_NOT_SALTED
7268 | OPTI_TYPE_RAW_HASH
;
7275 case 1410: hash_type
= HASH_TYPE_SHA256
;
7276 salt_type
= SALT_TYPE_INTERN
;
7277 attack_exec
= ATTACK_EXEC_ON_GPU
;
7278 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7279 | OPTS_TYPE_ST_ADD80
7280 | OPTS_TYPE_ST_ADDBITS15
;
7281 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7282 dgst_size
= DGST_SIZE_4_8
;
7283 parse_func
= sha256s_parse_hash
;
7284 sort_by_digest
= sort_by_digest_4_8
;
7285 opti_type
= OPTI_TYPE_ZERO_BYTE
7286 | OPTI_TYPE_PRECOMPUTE_INIT
7287 | OPTI_TYPE_PRECOMPUTE_MERKLE
7288 | OPTI_TYPE_EARLY_SKIP
7289 | OPTI_TYPE_NOT_ITERATED
7290 | OPTI_TYPE_APPENDED_SALT
7291 | OPTI_TYPE_RAW_HASH
;
7298 case 1420: hash_type
= HASH_TYPE_SHA256
;
7299 salt_type
= SALT_TYPE_INTERN
;
7300 attack_exec
= ATTACK_EXEC_ON_GPU
;
7301 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7302 | OPTS_TYPE_PT_ADD80
7303 | OPTS_TYPE_PT_ADDBITS15
;
7304 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7305 dgst_size
= DGST_SIZE_4_8
;
7306 parse_func
= sha256s_parse_hash
;
7307 sort_by_digest
= sort_by_digest_4_8
;
7308 opti_type
= OPTI_TYPE_ZERO_BYTE
7309 | OPTI_TYPE_PRECOMPUTE_INIT
7310 | OPTI_TYPE_PRECOMPUTE_MERKLE
7311 | OPTI_TYPE_EARLY_SKIP
7312 | OPTI_TYPE_NOT_ITERATED
7313 | OPTI_TYPE_PREPENDED_SALT
7314 | OPTI_TYPE_RAW_HASH
;
7321 case 1421: hash_type
= HASH_TYPE_SHA256
;
7322 salt_type
= SALT_TYPE_EMBEDDED
;
7323 attack_exec
= ATTACK_EXEC_ON_GPU
;
7324 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7325 | OPTS_TYPE_PT_ADD80
7326 | OPTS_TYPE_PT_ADDBITS15
;
7327 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7328 dgst_size
= DGST_SIZE_4_8
;
7329 parse_func
= hmailserver_parse_hash
;
7330 sort_by_digest
= sort_by_digest_4_8
;
7331 opti_type
= OPTI_TYPE_ZERO_BYTE
7332 | OPTI_TYPE_PRECOMPUTE_INIT
7333 | OPTI_TYPE_PRECOMPUTE_MERKLE
7334 | OPTI_TYPE_EARLY_SKIP
7335 | OPTI_TYPE_NOT_ITERATED
7336 | OPTI_TYPE_PREPENDED_SALT
7337 | OPTI_TYPE_RAW_HASH
;
7344 case 1430: hash_type
= HASH_TYPE_SHA256
;
7345 salt_type
= SALT_TYPE_INTERN
;
7346 attack_exec
= ATTACK_EXEC_ON_GPU
;
7347 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7348 | OPTS_TYPE_PT_UNICODE
7349 | OPTS_TYPE_ST_ADD80
7350 | OPTS_TYPE_ST_ADDBITS15
;
7351 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7352 dgst_size
= DGST_SIZE_4_8
;
7353 parse_func
= sha256s_parse_hash
;
7354 sort_by_digest
= sort_by_digest_4_8
;
7355 opti_type
= OPTI_TYPE_ZERO_BYTE
7356 | OPTI_TYPE_PRECOMPUTE_INIT
7357 | OPTI_TYPE_PRECOMPUTE_MERKLE
7358 | OPTI_TYPE_EARLY_SKIP
7359 | OPTI_TYPE_NOT_ITERATED
7360 | OPTI_TYPE_APPENDED_SALT
7361 | OPTI_TYPE_RAW_HASH
;
7368 case 1440: hash_type
= HASH_TYPE_SHA256
;
7369 salt_type
= SALT_TYPE_INTERN
;
7370 attack_exec
= ATTACK_EXEC_ON_GPU
;
7371 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7372 | OPTS_TYPE_PT_ADD80
7373 | OPTS_TYPE_PT_ADDBITS15
7374 | OPTS_TYPE_PT_UNICODE
;
7375 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7376 dgst_size
= DGST_SIZE_4_8
;
7377 parse_func
= sha256s_parse_hash
;
7378 sort_by_digest
= sort_by_digest_4_8
;
7379 opti_type
= OPTI_TYPE_ZERO_BYTE
7380 | OPTI_TYPE_PRECOMPUTE_INIT
7381 | OPTI_TYPE_PRECOMPUTE_MERKLE
7382 | OPTI_TYPE_EARLY_SKIP
7383 | OPTI_TYPE_NOT_ITERATED
7384 | OPTI_TYPE_PREPENDED_SALT
7385 | OPTI_TYPE_RAW_HASH
;
7392 case 1441: hash_type
= HASH_TYPE_SHA256
;
7393 salt_type
= SALT_TYPE_EMBEDDED
;
7394 attack_exec
= ATTACK_EXEC_ON_GPU
;
7395 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7396 | OPTS_TYPE_PT_ADD80
7397 | OPTS_TYPE_PT_ADDBITS15
7398 | OPTS_TYPE_PT_UNICODE
7399 | OPTS_TYPE_ST_BASE64
;
7400 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7401 dgst_size
= DGST_SIZE_4_8
;
7402 parse_func
= episerver4_parse_hash
;
7403 sort_by_digest
= sort_by_digest_4_8
;
7404 opti_type
= OPTI_TYPE_ZERO_BYTE
7405 | OPTI_TYPE_PRECOMPUTE_INIT
7406 | OPTI_TYPE_PRECOMPUTE_MERKLE
7407 | OPTI_TYPE_EARLY_SKIP
7408 | OPTI_TYPE_NOT_ITERATED
7409 | OPTI_TYPE_PREPENDED_SALT
7410 | OPTI_TYPE_RAW_HASH
;
7417 case 1450: hash_type
= HASH_TYPE_SHA256
;
7418 salt_type
= SALT_TYPE_INTERN
;
7419 attack_exec
= ATTACK_EXEC_ON_GPU
;
7420 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7421 | OPTS_TYPE_ST_ADD80
;
7422 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7423 dgst_size
= DGST_SIZE_4_8
;
7424 parse_func
= hmacsha256_parse_hash
;
7425 sort_by_digest
= sort_by_digest_4_8
;
7426 opti_type
= OPTI_TYPE_ZERO_BYTE
7427 | OPTI_TYPE_NOT_ITERATED
;
7434 case 1460: hash_type
= HASH_TYPE_SHA256
;
7435 salt_type
= SALT_TYPE_INTERN
;
7436 attack_exec
= ATTACK_EXEC_ON_GPU
;
7437 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7438 | OPTS_TYPE_PT_ADD80
7439 | OPTS_TYPE_PT_ADDBITS15
;
7440 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7441 dgst_size
= DGST_SIZE_4_8
;
7442 parse_func
= hmacsha256_parse_hash
;
7443 sort_by_digest
= sort_by_digest_4_8
;
7444 opti_type
= OPTI_TYPE_ZERO_BYTE
7445 | OPTI_TYPE_NOT_ITERATED
;
7452 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7453 salt_type
= SALT_TYPE_EMBEDDED
;
7454 attack_exec
= ATTACK_EXEC_ON_GPU
;
7455 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7456 | OPTS_TYPE_PT_BITSLICE
;
7457 kern_type
= KERN_TYPE_DESCRYPT
;
7458 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7459 parse_func
= descrypt_parse_hash
;
7460 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7461 opti_type
= OPTI_TYPE_ZERO_BYTE
7462 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7469 case 1600: hash_type
= HASH_TYPE_MD5
;
7470 salt_type
= SALT_TYPE_EMBEDDED
;
7471 attack_exec
= ATTACK_EXEC_ON_CPU
;
7472 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7473 kern_type
= KERN_TYPE_APR1CRYPT
;
7474 dgst_size
= DGST_SIZE_4_4
;
7475 parse_func
= md5apr1_parse_hash
;
7476 sort_by_digest
= sort_by_digest_4_4
;
7477 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7484 case 1700: hash_type
= HASH_TYPE_SHA512
;
7485 salt_type
= SALT_TYPE_NONE
;
7486 attack_exec
= ATTACK_EXEC_ON_GPU
;
7487 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7488 | OPTS_TYPE_PT_ADD80
7489 | OPTS_TYPE_PT_ADDBITS15
;
7490 kern_type
= KERN_TYPE_SHA512
;
7491 dgst_size
= DGST_SIZE_8_8
;
7492 parse_func
= sha512_parse_hash
;
7493 sort_by_digest
= sort_by_digest_8_8
;
7494 opti_type
= OPTI_TYPE_ZERO_BYTE
7495 | OPTI_TYPE_PRECOMPUTE_INIT
7496 | OPTI_TYPE_PRECOMPUTE_MERKLE
7497 | OPTI_TYPE_EARLY_SKIP
7498 | OPTI_TYPE_NOT_ITERATED
7499 | OPTI_TYPE_NOT_SALTED
7500 | OPTI_TYPE_RAW_HASH
;
7507 case 1710: hash_type
= HASH_TYPE_SHA512
;
7508 salt_type
= SALT_TYPE_INTERN
;
7509 attack_exec
= ATTACK_EXEC_ON_GPU
;
7510 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7511 | OPTS_TYPE_ST_ADD80
7512 | OPTS_TYPE_ST_ADDBITS15
;
7513 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7514 dgst_size
= DGST_SIZE_8_8
;
7515 parse_func
= sha512s_parse_hash
;
7516 sort_by_digest
= sort_by_digest_8_8
;
7517 opti_type
= OPTI_TYPE_ZERO_BYTE
7518 | OPTI_TYPE_PRECOMPUTE_INIT
7519 | OPTI_TYPE_PRECOMPUTE_MERKLE
7520 | OPTI_TYPE_EARLY_SKIP
7521 | OPTI_TYPE_NOT_ITERATED
7522 | OPTI_TYPE_APPENDED_SALT
7523 | OPTI_TYPE_RAW_HASH
;
7530 case 1711: hash_type
= HASH_TYPE_SHA512
;
7531 salt_type
= SALT_TYPE_EMBEDDED
;
7532 attack_exec
= ATTACK_EXEC_ON_GPU
;
7533 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7534 | OPTS_TYPE_ST_ADD80
7535 | OPTS_TYPE_ST_ADDBITS15
;
7536 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7537 dgst_size
= DGST_SIZE_8_8
;
7538 parse_func
= sha512b64s_parse_hash
;
7539 sort_by_digest
= sort_by_digest_8_8
;
7540 opti_type
= OPTI_TYPE_ZERO_BYTE
7541 | OPTI_TYPE_PRECOMPUTE_INIT
7542 | OPTI_TYPE_PRECOMPUTE_MERKLE
7543 | OPTI_TYPE_EARLY_SKIP
7544 | OPTI_TYPE_NOT_ITERATED
7545 | OPTI_TYPE_APPENDED_SALT
7546 | OPTI_TYPE_RAW_HASH
;
7553 case 1720: hash_type
= HASH_TYPE_SHA512
;
7554 salt_type
= SALT_TYPE_INTERN
;
7555 attack_exec
= ATTACK_EXEC_ON_GPU
;
7556 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7557 | OPTS_TYPE_PT_ADD80
7558 | OPTS_TYPE_PT_ADDBITS15
;
7559 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7560 dgst_size
= DGST_SIZE_8_8
;
7561 parse_func
= sha512s_parse_hash
;
7562 sort_by_digest
= sort_by_digest_8_8
;
7563 opti_type
= OPTI_TYPE_ZERO_BYTE
7564 | OPTI_TYPE_PRECOMPUTE_INIT
7565 | OPTI_TYPE_PRECOMPUTE_MERKLE
7566 | OPTI_TYPE_EARLY_SKIP
7567 | OPTI_TYPE_NOT_ITERATED
7568 | OPTI_TYPE_PREPENDED_SALT
7569 | OPTI_TYPE_RAW_HASH
;
7576 case 1722: hash_type
= HASH_TYPE_SHA512
;
7577 salt_type
= SALT_TYPE_EMBEDDED
;
7578 attack_exec
= ATTACK_EXEC_ON_GPU
;
7579 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7580 | OPTS_TYPE_PT_ADD80
7581 | OPTS_TYPE_PT_ADDBITS15
7583 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7584 dgst_size
= DGST_SIZE_8_8
;
7585 parse_func
= osx512_parse_hash
;
7586 sort_by_digest
= sort_by_digest_8_8
;
7587 opti_type
= OPTI_TYPE_ZERO_BYTE
7588 | OPTI_TYPE_PRECOMPUTE_INIT
7589 | OPTI_TYPE_PRECOMPUTE_MERKLE
7590 | OPTI_TYPE_EARLY_SKIP
7591 | OPTI_TYPE_NOT_ITERATED
7592 | OPTI_TYPE_PREPENDED_SALT
7593 | OPTI_TYPE_RAW_HASH
;
7600 case 1730: hash_type
= HASH_TYPE_SHA512
;
7601 salt_type
= SALT_TYPE_INTERN
;
7602 attack_exec
= ATTACK_EXEC_ON_GPU
;
7603 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7604 | OPTS_TYPE_PT_UNICODE
7605 | OPTS_TYPE_ST_ADD80
7606 | OPTS_TYPE_ST_ADDBITS15
;
7607 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7608 dgst_size
= DGST_SIZE_8_8
;
7609 parse_func
= sha512s_parse_hash
;
7610 sort_by_digest
= sort_by_digest_8_8
;
7611 opti_type
= OPTI_TYPE_ZERO_BYTE
7612 | OPTI_TYPE_PRECOMPUTE_INIT
7613 | OPTI_TYPE_PRECOMPUTE_MERKLE
7614 | OPTI_TYPE_EARLY_SKIP
7615 | OPTI_TYPE_NOT_ITERATED
7616 | OPTI_TYPE_APPENDED_SALT
7617 | OPTI_TYPE_RAW_HASH
;
7624 case 1731: hash_type
= HASH_TYPE_SHA512
;
7625 salt_type
= SALT_TYPE_EMBEDDED
;
7626 attack_exec
= ATTACK_EXEC_ON_GPU
;
7627 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7628 | OPTS_TYPE_PT_UNICODE
7629 | OPTS_TYPE_ST_ADD80
7630 | OPTS_TYPE_ST_ADDBITS15
7632 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7633 dgst_size
= DGST_SIZE_8_8
;
7634 parse_func
= mssql2012_parse_hash
;
7635 sort_by_digest
= sort_by_digest_8_8
;
7636 opti_type
= OPTI_TYPE_ZERO_BYTE
7637 | OPTI_TYPE_PRECOMPUTE_INIT
7638 | OPTI_TYPE_PRECOMPUTE_MERKLE
7639 | OPTI_TYPE_EARLY_SKIP
7640 | OPTI_TYPE_NOT_ITERATED
7641 | OPTI_TYPE_APPENDED_SALT
7642 | OPTI_TYPE_RAW_HASH
;
7649 case 1740: hash_type
= HASH_TYPE_SHA512
;
7650 salt_type
= SALT_TYPE_INTERN
;
7651 attack_exec
= ATTACK_EXEC_ON_GPU
;
7652 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7653 | OPTS_TYPE_PT_ADD80
7654 | OPTS_TYPE_PT_ADDBITS15
7655 | OPTS_TYPE_PT_UNICODE
;
7656 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7657 dgst_size
= DGST_SIZE_8_8
;
7658 parse_func
= sha512s_parse_hash
;
7659 sort_by_digest
= sort_by_digest_8_8
;
7660 opti_type
= OPTI_TYPE_ZERO_BYTE
7661 | OPTI_TYPE_PRECOMPUTE_INIT
7662 | OPTI_TYPE_PRECOMPUTE_MERKLE
7663 | OPTI_TYPE_EARLY_SKIP
7664 | OPTI_TYPE_NOT_ITERATED
7665 | OPTI_TYPE_PREPENDED_SALT
7666 | OPTI_TYPE_RAW_HASH
;
7673 case 1750: hash_type
= HASH_TYPE_SHA512
;
7674 salt_type
= SALT_TYPE_INTERN
;
7675 attack_exec
= ATTACK_EXEC_ON_GPU
;
7676 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7677 | OPTS_TYPE_ST_ADD80
;
7678 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7679 dgst_size
= DGST_SIZE_8_8
;
7680 parse_func
= hmacsha512_parse_hash
;
7681 sort_by_digest
= sort_by_digest_8_8
;
7682 opti_type
= OPTI_TYPE_ZERO_BYTE
7683 | OPTI_TYPE_NOT_ITERATED
;
7690 case 1760: hash_type
= HASH_TYPE_SHA512
;
7691 salt_type
= SALT_TYPE_INTERN
;
7692 attack_exec
= ATTACK_EXEC_ON_GPU
;
7693 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7694 | OPTS_TYPE_PT_ADD80
7695 | OPTS_TYPE_PT_ADDBITS15
;
7696 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7697 dgst_size
= DGST_SIZE_8_8
;
7698 parse_func
= hmacsha512_parse_hash
;
7699 sort_by_digest
= sort_by_digest_8_8
;
7700 opti_type
= OPTI_TYPE_ZERO_BYTE
7701 | OPTI_TYPE_NOT_ITERATED
;
7708 case 1800: hash_type
= HASH_TYPE_SHA512
;
7709 salt_type
= SALT_TYPE_EMBEDDED
;
7710 attack_exec
= ATTACK_EXEC_ON_CPU
;
7711 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7712 kern_type
= KERN_TYPE_SHA512CRYPT
;
7713 dgst_size
= DGST_SIZE_8_8
;
7714 parse_func
= sha512crypt_parse_hash
;
7715 sort_by_digest
= sort_by_digest_8_8
;
7716 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7723 case 2100: hash_type
= HASH_TYPE_DCC2
;
7724 salt_type
= SALT_TYPE_EMBEDDED
;
7725 attack_exec
= ATTACK_EXEC_ON_CPU
;
7726 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7727 | OPTS_TYPE_ST_LOWER
7728 | OPTS_TYPE_ST_UNICODE
;
7729 kern_type
= KERN_TYPE_DCC2
;
7730 dgst_size
= DGST_SIZE_4_4
;
7731 parse_func
= dcc2_parse_hash
;
7732 sort_by_digest
= sort_by_digest_4_4
;
7733 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7740 case 2400: hash_type
= HASH_TYPE_MD5
;
7741 salt_type
= SALT_TYPE_NONE
;
7742 attack_exec
= ATTACK_EXEC_ON_GPU
;
7743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7744 kern_type
= KERN_TYPE_MD5PIX
;
7745 dgst_size
= DGST_SIZE_4_4
;
7746 parse_func
= md5pix_parse_hash
;
7747 sort_by_digest
= sort_by_digest_4_4
;
7748 opti_type
= OPTI_TYPE_ZERO_BYTE
7749 | OPTI_TYPE_PRECOMPUTE_INIT
7750 | OPTI_TYPE_PRECOMPUTE_MERKLE
7751 | OPTI_TYPE_EARLY_SKIP
7752 | OPTI_TYPE_NOT_ITERATED
7753 | OPTI_TYPE_NOT_SALTED
;
7760 case 2410: hash_type
= HASH_TYPE_MD5
;
7761 salt_type
= SALT_TYPE_INTERN
;
7762 attack_exec
= ATTACK_EXEC_ON_GPU
;
7763 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7764 kern_type
= KERN_TYPE_MD5ASA
;
7765 dgst_size
= DGST_SIZE_4_4
;
7766 parse_func
= md5asa_parse_hash
;
7767 sort_by_digest
= sort_by_digest_4_4
;
7768 opti_type
= OPTI_TYPE_ZERO_BYTE
7769 | OPTI_TYPE_PRECOMPUTE_INIT
7770 | OPTI_TYPE_PRECOMPUTE_MERKLE
7771 | OPTI_TYPE_EARLY_SKIP
7772 | OPTI_TYPE_NOT_ITERATED
;
7779 case 2500: hash_type
= HASH_TYPE_WPA
;
7780 salt_type
= SALT_TYPE_EMBEDDED
;
7781 attack_exec
= ATTACK_EXEC_ON_CPU
;
7782 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7783 kern_type
= KERN_TYPE_WPA
;
7784 dgst_size
= DGST_SIZE_4_4
;
7785 parse_func
= wpa_parse_hash
;
7786 sort_by_digest
= sort_by_digest_4_4
;
7787 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7794 case 2600: hash_type
= HASH_TYPE_MD5
;
7795 salt_type
= SALT_TYPE_VIRTUAL
;
7796 attack_exec
= ATTACK_EXEC_ON_GPU
;
7797 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7798 | OPTS_TYPE_PT_ADD80
7799 | OPTS_TYPE_PT_ADDBITS14
7800 | OPTS_TYPE_ST_ADD80
;
7801 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7802 dgst_size
= DGST_SIZE_4_4
;
7803 parse_func
= md5md5_parse_hash
;
7804 sort_by_digest
= sort_by_digest_4_4
;
7805 opti_type
= OPTI_TYPE_ZERO_BYTE
7806 | OPTI_TYPE_PRECOMPUTE_INIT
7807 | OPTI_TYPE_PRECOMPUTE_MERKLE
7808 | OPTI_TYPE_EARLY_SKIP
;
7815 case 2611: hash_type
= HASH_TYPE_MD5
;
7816 salt_type
= SALT_TYPE_INTERN
;
7817 attack_exec
= ATTACK_EXEC_ON_GPU
;
7818 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7819 | OPTS_TYPE_PT_ADD80
7820 | OPTS_TYPE_PT_ADDBITS14
7821 | OPTS_TYPE_ST_ADD80
;
7822 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7823 dgst_size
= DGST_SIZE_4_4
;
7824 parse_func
= vb3_parse_hash
;
7825 sort_by_digest
= sort_by_digest_4_4
;
7826 opti_type
= OPTI_TYPE_ZERO_BYTE
7827 | OPTI_TYPE_PRECOMPUTE_INIT
7828 | OPTI_TYPE_PRECOMPUTE_MERKLE
7829 | OPTI_TYPE_EARLY_SKIP
;
7836 case 2612: hash_type
= HASH_TYPE_MD5
;
7837 salt_type
= SALT_TYPE_EMBEDDED
;
7838 attack_exec
= ATTACK_EXEC_ON_GPU
;
7839 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7840 | OPTS_TYPE_PT_ADD80
7841 | OPTS_TYPE_PT_ADDBITS14
7842 | OPTS_TYPE_ST_ADD80
7844 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7845 dgst_size
= DGST_SIZE_4_4
;
7846 parse_func
= phps_parse_hash
;
7847 sort_by_digest
= sort_by_digest_4_4
;
7848 opti_type
= OPTI_TYPE_ZERO_BYTE
7849 | OPTI_TYPE_PRECOMPUTE_INIT
7850 | OPTI_TYPE_PRECOMPUTE_MERKLE
7851 | OPTI_TYPE_EARLY_SKIP
;
7858 case 2711: hash_type
= HASH_TYPE_MD5
;
7859 salt_type
= SALT_TYPE_INTERN
;
7860 attack_exec
= ATTACK_EXEC_ON_GPU
;
7861 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7862 | OPTS_TYPE_PT_ADD80
7863 | OPTS_TYPE_PT_ADDBITS14
7864 | OPTS_TYPE_ST_ADD80
;
7865 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7866 dgst_size
= DGST_SIZE_4_4
;
7867 parse_func
= vb30_parse_hash
;
7868 sort_by_digest
= sort_by_digest_4_4
;
7869 opti_type
= OPTI_TYPE_ZERO_BYTE
7870 | OPTI_TYPE_PRECOMPUTE_INIT
7871 | OPTI_TYPE_EARLY_SKIP
;
7878 case 2811: hash_type
= HASH_TYPE_MD5
;
7879 salt_type
= SALT_TYPE_INTERN
;
7880 attack_exec
= ATTACK_EXEC_ON_GPU
;
7881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7882 | OPTS_TYPE_PT_ADD80
7883 | OPTS_TYPE_PT_ADDBITS14
;
7884 kern_type
= KERN_TYPE_MD55_SLTPW
;
7885 dgst_size
= DGST_SIZE_4_4
;
7886 parse_func
= ipb2_parse_hash
;
7887 sort_by_digest
= sort_by_digest_4_4
;
7888 opti_type
= OPTI_TYPE_ZERO_BYTE
7889 | OPTI_TYPE_PRECOMPUTE_INIT
7890 | OPTI_TYPE_EARLY_SKIP
;
7897 case 3000: hash_type
= HASH_TYPE_LM
;
7898 salt_type
= SALT_TYPE_NONE
;
7899 attack_exec
= ATTACK_EXEC_ON_GPU
;
7900 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7901 | OPTS_TYPE_PT_UPPER
7902 | OPTS_TYPE_PT_BITSLICE
;
7903 kern_type
= KERN_TYPE_LM
;
7904 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7905 parse_func
= lm_parse_hash
;
7906 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7907 opti_type
= OPTI_TYPE_ZERO_BYTE
7908 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7915 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7916 salt_type
= SALT_TYPE_INTERN
;
7917 attack_exec
= ATTACK_EXEC_ON_GPU
;
7918 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7919 | OPTS_TYPE_PT_UPPER
7920 | OPTS_TYPE_ST_UPPER
;
7921 kern_type
= KERN_TYPE_ORACLEH
;
7922 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7923 parse_func
= oracleh_parse_hash
;
7924 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7925 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7932 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7933 salt_type
= SALT_TYPE_EMBEDDED
;
7934 attack_exec
= ATTACK_EXEC_ON_CPU
;
7935 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7936 | OPTS_TYPE_ST_GENERATE_LE
;
7937 kern_type
= KERN_TYPE_BCRYPT
;
7938 dgst_size
= DGST_SIZE_4_6
;
7939 parse_func
= bcrypt_parse_hash
;
7940 sort_by_digest
= sort_by_digest_4_6
;
7941 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7948 case 3710: hash_type
= HASH_TYPE_MD5
;
7949 salt_type
= SALT_TYPE_INTERN
;
7950 attack_exec
= ATTACK_EXEC_ON_GPU
;
7951 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7952 | OPTS_TYPE_PT_ADD80
7953 | OPTS_TYPE_PT_ADDBITS14
;
7954 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7955 dgst_size
= DGST_SIZE_4_4
;
7956 parse_func
= md5s_parse_hash
;
7957 sort_by_digest
= sort_by_digest_4_4
;
7958 opti_type
= OPTI_TYPE_ZERO_BYTE
7959 | OPTI_TYPE_PRECOMPUTE_INIT
7960 | OPTI_TYPE_PRECOMPUTE_MERKLE
7961 | OPTI_TYPE_EARLY_SKIP
;
7968 case 3711: hash_type
= HASH_TYPE_MD5
;
7969 salt_type
= SALT_TYPE_EMBEDDED
;
7970 attack_exec
= ATTACK_EXEC_ON_GPU
;
7971 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7972 | OPTS_TYPE_PT_ADD80
7973 | OPTS_TYPE_PT_ADDBITS14
;
7974 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7975 dgst_size
= DGST_SIZE_4_4
;
7976 parse_func
= mediawiki_b_parse_hash
;
7977 sort_by_digest
= sort_by_digest_4_4
;
7978 opti_type
= OPTI_TYPE_ZERO_BYTE
7979 | OPTI_TYPE_PRECOMPUTE_INIT
7980 | OPTI_TYPE_PRECOMPUTE_MERKLE
7981 | OPTI_TYPE_EARLY_SKIP
;
7988 case 3800: hash_type
= HASH_TYPE_MD5
;
7989 salt_type
= SALT_TYPE_INTERN
;
7990 attack_exec
= ATTACK_EXEC_ON_GPU
;
7991 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7992 | OPTS_TYPE_ST_ADDBITS14
;
7993 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
7994 dgst_size
= DGST_SIZE_4_4
;
7995 parse_func
= md5s_parse_hash
;
7996 sort_by_digest
= sort_by_digest_4_4
;
7997 opti_type
= OPTI_TYPE_ZERO_BYTE
7998 | OPTI_TYPE_PRECOMPUTE_INIT
7999 | OPTI_TYPE_PRECOMPUTE_MERKLE
8000 | OPTI_TYPE_EARLY_SKIP
8001 | OPTI_TYPE_NOT_ITERATED
8002 | OPTI_TYPE_RAW_HASH
;
8009 case 4300: hash_type
= HASH_TYPE_MD5
;
8010 salt_type
= SALT_TYPE_VIRTUAL
;
8011 attack_exec
= ATTACK_EXEC_ON_GPU
;
8012 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8013 | OPTS_TYPE_PT_ADD80
8014 | OPTS_TYPE_PT_ADDBITS14
8015 | OPTS_TYPE_ST_ADD80
;
8016 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8017 dgst_size
= DGST_SIZE_4_4
;
8018 parse_func
= md5md5_parse_hash
;
8019 sort_by_digest
= sort_by_digest_4_4
;
8020 opti_type
= OPTI_TYPE_ZERO_BYTE
8021 | OPTI_TYPE_PRECOMPUTE_INIT
8022 | OPTI_TYPE_PRECOMPUTE_MERKLE
8023 | OPTI_TYPE_EARLY_SKIP
;
8031 case 4400: hash_type
= HASH_TYPE_MD5
;
8032 salt_type
= SALT_TYPE_NONE
;
8033 attack_exec
= ATTACK_EXEC_ON_GPU
;
8034 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8035 | OPTS_TYPE_PT_ADD80
8036 | OPTS_TYPE_PT_ADDBITS15
;
8037 kern_type
= KERN_TYPE_MD5_SHA1
;
8038 dgst_size
= DGST_SIZE_4_4
;
8039 parse_func
= md5_parse_hash
;
8040 sort_by_digest
= sort_by_digest_4_4
;
8041 opti_type
= OPTI_TYPE_ZERO_BYTE
8042 | OPTI_TYPE_PRECOMPUTE_INIT
8043 | OPTI_TYPE_PRECOMPUTE_MERKLE
8044 | OPTI_TYPE_EARLY_SKIP
8045 | OPTI_TYPE_NOT_ITERATED
8046 | OPTI_TYPE_NOT_SALTED
8047 | OPTI_TYPE_RAW_HASH
;
8054 case 4500: hash_type
= HASH_TYPE_SHA1
;
8055 salt_type
= SALT_TYPE_NONE
;
8056 attack_exec
= ATTACK_EXEC_ON_GPU
;
8057 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8058 | OPTS_TYPE_PT_ADD80
8059 | OPTS_TYPE_PT_ADDBITS15
;
8060 kern_type
= KERN_TYPE_SHA11
;
8061 dgst_size
= DGST_SIZE_4_5
;
8062 parse_func
= sha1_parse_hash
;
8063 sort_by_digest
= sort_by_digest_4_5
;
8064 opti_type
= OPTI_TYPE_ZERO_BYTE
8065 | OPTI_TYPE_PRECOMPUTE_INIT
8066 | OPTI_TYPE_PRECOMPUTE_MERKLE
8067 | OPTI_TYPE_EARLY_SKIP
8068 | OPTI_TYPE_NOT_SALTED
;
8075 case 4700: hash_type
= HASH_TYPE_SHA1
;
8076 salt_type
= SALT_TYPE_NONE
;
8077 attack_exec
= ATTACK_EXEC_ON_GPU
;
8078 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8079 | OPTS_TYPE_PT_ADD80
8080 | OPTS_TYPE_PT_ADDBITS14
;
8081 kern_type
= KERN_TYPE_SHA1_MD5
;
8082 dgst_size
= DGST_SIZE_4_5
;
8083 parse_func
= sha1_parse_hash
;
8084 sort_by_digest
= sort_by_digest_4_5
;
8085 opti_type
= OPTI_TYPE_ZERO_BYTE
8086 | OPTI_TYPE_PRECOMPUTE_INIT
8087 | OPTI_TYPE_PRECOMPUTE_MERKLE
8088 | OPTI_TYPE_EARLY_SKIP
8089 | OPTI_TYPE_NOT_ITERATED
8090 | OPTI_TYPE_NOT_SALTED
8091 | OPTI_TYPE_RAW_HASH
;
8098 case 4800: hash_type
= HASH_TYPE_MD5
;
8099 salt_type
= SALT_TYPE_EMBEDDED
;
8100 attack_exec
= ATTACK_EXEC_ON_GPU
;
8101 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8102 | OPTS_TYPE_PT_ADDBITS14
;
8103 kern_type
= KERN_TYPE_MD5_CHAP
;
8104 dgst_size
= DGST_SIZE_4_4
;
8105 parse_func
= chap_parse_hash
;
8106 sort_by_digest
= sort_by_digest_4_4
;
8107 opti_type
= OPTI_TYPE_ZERO_BYTE
8108 | OPTI_TYPE_PRECOMPUTE_INIT
8109 | OPTI_TYPE_PRECOMPUTE_MERKLE
8110 | OPTI_TYPE_MEET_IN_MIDDLE
8111 | OPTI_TYPE_EARLY_SKIP
8112 | OPTI_TYPE_NOT_ITERATED
8113 | OPTI_TYPE_RAW_HASH
;
8120 case 4900: hash_type
= HASH_TYPE_SHA1
;
8121 salt_type
= SALT_TYPE_INTERN
;
8122 attack_exec
= ATTACK_EXEC_ON_GPU
;
8123 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8124 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8125 dgst_size
= DGST_SIZE_4_5
;
8126 parse_func
= sha1s_parse_hash
;
8127 sort_by_digest
= sort_by_digest_4_5
;
8128 opti_type
= OPTI_TYPE_ZERO_BYTE
8129 | OPTI_TYPE_PRECOMPUTE_INIT
8130 | OPTI_TYPE_PRECOMPUTE_MERKLE
8131 | OPTI_TYPE_EARLY_SKIP
;
8138 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8139 salt_type
= SALT_TYPE_EMBEDDED
;
8140 attack_exec
= ATTACK_EXEC_ON_GPU
;
8141 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8142 | OPTS_TYPE_PT_ADD01
;
8143 kern_type
= KERN_TYPE_KECCAK
;
8144 dgst_size
= DGST_SIZE_8_25
;
8145 parse_func
= keccak_parse_hash
;
8146 sort_by_digest
= sort_by_digest_8_25
;
8147 opti_type
= OPTI_TYPE_ZERO_BYTE
8148 | OPTI_TYPE_RAW_HASH
;
8155 case 5100: hash_type
= HASH_TYPE_MD5H
;
8156 salt_type
= SALT_TYPE_NONE
;
8157 attack_exec
= ATTACK_EXEC_ON_GPU
;
8158 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8159 | OPTS_TYPE_PT_ADD80
8160 | OPTS_TYPE_PT_ADDBITS14
;
8161 kern_type
= KERN_TYPE_MD5H
;
8162 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8163 parse_func
= md5half_parse_hash
;
8164 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8165 opti_type
= OPTI_TYPE_ZERO_BYTE
8166 | OPTI_TYPE_RAW_HASH
;
8173 case 5200: hash_type
= HASH_TYPE_SHA256
;
8174 salt_type
= SALT_TYPE_EMBEDDED
;
8175 attack_exec
= ATTACK_EXEC_ON_CPU
;
8176 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8177 kern_type
= KERN_TYPE_PSAFE3
;
8178 dgst_size
= DGST_SIZE_4_8
;
8179 parse_func
= psafe3_parse_hash
;
8180 sort_by_digest
= sort_by_digest_4_8
;
8181 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8188 case 5300: hash_type
= HASH_TYPE_MD5
;
8189 salt_type
= SALT_TYPE_EMBEDDED
;
8190 attack_exec
= ATTACK_EXEC_ON_GPU
;
8191 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8192 | OPTS_TYPE_ST_ADD80
;
8193 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8194 dgst_size
= DGST_SIZE_4_4
;
8195 parse_func
= ikepsk_md5_parse_hash
;
8196 sort_by_digest
= sort_by_digest_4_4
;
8197 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8204 case 5400: hash_type
= HASH_TYPE_SHA1
;
8205 salt_type
= SALT_TYPE_EMBEDDED
;
8206 attack_exec
= ATTACK_EXEC_ON_GPU
;
8207 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8208 | OPTS_TYPE_ST_ADD80
;
8209 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8210 dgst_size
= DGST_SIZE_4_5
;
8211 parse_func
= ikepsk_sha1_parse_hash
;
8212 sort_by_digest
= sort_by_digest_4_5
;
8213 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8220 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8221 salt_type
= SALT_TYPE_EMBEDDED
;
8222 attack_exec
= ATTACK_EXEC_ON_GPU
;
8223 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8224 | OPTS_TYPE_PT_ADD80
8225 | OPTS_TYPE_PT_ADDBITS14
8226 | OPTS_TYPE_PT_UNICODE
8228 kern_type
= KERN_TYPE_NETNTLMv1
;
8229 dgst_size
= DGST_SIZE_4_4
;
8230 parse_func
= netntlmv1_parse_hash
;
8231 sort_by_digest
= sort_by_digest_4_4
;
8232 opti_type
= OPTI_TYPE_ZERO_BYTE
8233 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8240 case 5600: hash_type
= HASH_TYPE_MD5
;
8241 salt_type
= SALT_TYPE_EMBEDDED
;
8242 attack_exec
= ATTACK_EXEC_ON_GPU
;
8243 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8244 | OPTS_TYPE_PT_ADD80
8245 | OPTS_TYPE_PT_ADDBITS14
8246 | OPTS_TYPE_PT_UNICODE
;
8247 kern_type
= KERN_TYPE_NETNTLMv2
;
8248 dgst_size
= DGST_SIZE_4_4
;
8249 parse_func
= netntlmv2_parse_hash
;
8250 sort_by_digest
= sort_by_digest_4_4
;
8251 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8258 case 5700: hash_type
= HASH_TYPE_SHA256
;
8259 salt_type
= SALT_TYPE_NONE
;
8260 attack_exec
= ATTACK_EXEC_ON_GPU
;
8261 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8262 | OPTS_TYPE_PT_ADD80
8263 | OPTS_TYPE_PT_ADDBITS15
;
8264 kern_type
= KERN_TYPE_SHA256
;
8265 dgst_size
= DGST_SIZE_4_8
;
8266 parse_func
= cisco4_parse_hash
;
8267 sort_by_digest
= sort_by_digest_4_8
;
8268 opti_type
= OPTI_TYPE_ZERO_BYTE
8269 | OPTI_TYPE_PRECOMPUTE_INIT
8270 | OPTI_TYPE_PRECOMPUTE_MERKLE
8271 | OPTI_TYPE_EARLY_SKIP
8272 | OPTI_TYPE_NOT_ITERATED
8273 | OPTI_TYPE_NOT_SALTED
8274 | OPTI_TYPE_RAW_HASH
;
8281 case 5800: hash_type
= HASH_TYPE_SHA1
;
8282 salt_type
= SALT_TYPE_INTERN
;
8283 attack_exec
= ATTACK_EXEC_ON_CPU
;
8284 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8285 | OPTS_TYPE_ST_ADD80
;
8286 kern_type
= KERN_TYPE_ANDROIDPIN
;
8287 dgst_size
= DGST_SIZE_4_5
;
8288 parse_func
= androidpin_parse_hash
;
8289 sort_by_digest
= sort_by_digest_4_5
;
8290 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8297 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8298 salt_type
= SALT_TYPE_NONE
;
8299 attack_exec
= ATTACK_EXEC_ON_GPU
;
8300 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8301 | OPTS_TYPE_PT_ADD80
;
8302 kern_type
= KERN_TYPE_RIPEMD160
;
8303 dgst_size
= DGST_SIZE_4_5
;
8304 parse_func
= ripemd160_parse_hash
;
8305 sort_by_digest
= sort_by_digest_4_5
;
8306 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8313 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8314 salt_type
= SALT_TYPE_NONE
;
8315 attack_exec
= ATTACK_EXEC_ON_GPU
;
8316 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8317 | OPTS_TYPE_PT_ADD80
;
8318 kern_type
= KERN_TYPE_WHIRLPOOL
;
8319 dgst_size
= DGST_SIZE_4_16
;
8320 parse_func
= whirlpool_parse_hash
;
8321 sort_by_digest
= sort_by_digest_4_16
;
8322 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8329 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8330 salt_type
= SALT_TYPE_EMBEDDED
;
8331 attack_exec
= ATTACK_EXEC_ON_CPU
;
8332 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8333 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8334 dgst_size
= DGST_SIZE_4_5
;
8335 parse_func
= truecrypt_parse_hash_2k
;
8336 sort_by_digest
= sort_by_digest_4_5
;
8337 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8344 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8345 salt_type
= SALT_TYPE_EMBEDDED
;
8346 attack_exec
= ATTACK_EXEC_ON_CPU
;
8347 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8348 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8349 dgst_size
= DGST_SIZE_4_5
;
8350 parse_func
= truecrypt_parse_hash_2k
;
8351 sort_by_digest
= sort_by_digest_4_5
;
8352 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8359 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8360 salt_type
= SALT_TYPE_EMBEDDED
;
8361 attack_exec
= ATTACK_EXEC_ON_CPU
;
8362 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8363 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8364 dgst_size
= DGST_SIZE_4_5
;
8365 parse_func
= truecrypt_parse_hash_2k
;
8366 sort_by_digest
= sort_by_digest_4_5
;
8367 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8374 case 6221: hash_type
= HASH_TYPE_SHA512
;
8375 salt_type
= SALT_TYPE_EMBEDDED
;
8376 attack_exec
= ATTACK_EXEC_ON_CPU
;
8377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8378 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8379 dgst_size
= DGST_SIZE_8_8
;
8380 parse_func
= truecrypt_parse_hash_1k
;
8381 sort_by_digest
= sort_by_digest_8_8
;
8382 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8389 case 6222: hash_type
= HASH_TYPE_SHA512
;
8390 salt_type
= SALT_TYPE_EMBEDDED
;
8391 attack_exec
= ATTACK_EXEC_ON_CPU
;
8392 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8393 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8394 dgst_size
= DGST_SIZE_8_8
;
8395 parse_func
= truecrypt_parse_hash_1k
;
8396 sort_by_digest
= sort_by_digest_8_8
;
8397 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8404 case 6223: hash_type
= HASH_TYPE_SHA512
;
8405 salt_type
= SALT_TYPE_EMBEDDED
;
8406 attack_exec
= ATTACK_EXEC_ON_CPU
;
8407 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8408 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8409 dgst_size
= DGST_SIZE_8_8
;
8410 parse_func
= truecrypt_parse_hash_1k
;
8411 sort_by_digest
= sort_by_digest_8_8
;
8412 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8419 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8420 salt_type
= SALT_TYPE_EMBEDDED
;
8421 attack_exec
= ATTACK_EXEC_ON_CPU
;
8422 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8423 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8424 dgst_size
= DGST_SIZE_4_8
;
8425 parse_func
= truecrypt_parse_hash_1k
;
8426 sort_by_digest
= sort_by_digest_4_8
;
8427 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8434 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8435 salt_type
= SALT_TYPE_EMBEDDED
;
8436 attack_exec
= ATTACK_EXEC_ON_CPU
;
8437 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8438 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8439 dgst_size
= DGST_SIZE_4_8
;
8440 parse_func
= truecrypt_parse_hash_1k
;
8441 sort_by_digest
= sort_by_digest_4_8
;
8442 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8449 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8450 salt_type
= SALT_TYPE_EMBEDDED
;
8451 attack_exec
= ATTACK_EXEC_ON_CPU
;
8452 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8453 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8454 dgst_size
= DGST_SIZE_4_8
;
8455 parse_func
= truecrypt_parse_hash_1k
;
8456 sort_by_digest
= sort_by_digest_4_8
;
8457 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8464 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8465 salt_type
= SALT_TYPE_EMBEDDED
;
8466 attack_exec
= ATTACK_EXEC_ON_CPU
;
8467 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8468 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8469 dgst_size
= DGST_SIZE_4_5
;
8470 parse_func
= truecrypt_parse_hash_1k
;
8471 sort_by_digest
= sort_by_digest_4_5
;
8472 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8479 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8480 salt_type
= SALT_TYPE_EMBEDDED
;
8481 attack_exec
= ATTACK_EXEC_ON_CPU
;
8482 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8483 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8484 dgst_size
= DGST_SIZE_4_5
;
8485 parse_func
= truecrypt_parse_hash_1k
;
8486 sort_by_digest
= sort_by_digest_4_5
;
8487 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8494 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8495 salt_type
= SALT_TYPE_EMBEDDED
;
8496 attack_exec
= ATTACK_EXEC_ON_CPU
;
8497 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8498 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8499 dgst_size
= DGST_SIZE_4_5
;
8500 parse_func
= truecrypt_parse_hash_1k
;
8501 sort_by_digest
= sort_by_digest_4_5
;
8502 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8509 case 6300: hash_type
= HASH_TYPE_MD5
;
8510 salt_type
= SALT_TYPE_EMBEDDED
;
8511 attack_exec
= ATTACK_EXEC_ON_CPU
;
8512 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8513 kern_type
= KERN_TYPE_MD5AIX
;
8514 dgst_size
= DGST_SIZE_4_4
;
8515 parse_func
= md5aix_parse_hash
;
8516 sort_by_digest
= sort_by_digest_4_4
;
8517 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8524 case 6400: hash_type
= HASH_TYPE_SHA256
;
8525 salt_type
= SALT_TYPE_EMBEDDED
;
8526 attack_exec
= ATTACK_EXEC_ON_CPU
;
8527 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8528 kern_type
= KERN_TYPE_SHA256AIX
;
8529 dgst_size
= DGST_SIZE_4_8
;
8530 parse_func
= sha256aix_parse_hash
;
8531 sort_by_digest
= sort_by_digest_4_8
;
8532 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8539 case 6500: hash_type
= HASH_TYPE_SHA512
;
8540 salt_type
= SALT_TYPE_EMBEDDED
;
8541 attack_exec
= ATTACK_EXEC_ON_CPU
;
8542 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8543 kern_type
= KERN_TYPE_SHA512AIX
;
8544 dgst_size
= DGST_SIZE_8_8
;
8545 parse_func
= sha512aix_parse_hash
;
8546 sort_by_digest
= sort_by_digest_8_8
;
8547 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8554 case 6600: hash_type
= HASH_TYPE_AES
;
8555 salt_type
= SALT_TYPE_EMBEDDED
;
8556 attack_exec
= ATTACK_EXEC_ON_CPU
;
8557 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8558 kern_type
= KERN_TYPE_AGILEKEY
;
8559 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8560 parse_func
= agilekey_parse_hash
;
8561 sort_by_digest
= sort_by_digest_4_5
;
8562 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8569 case 6700: hash_type
= HASH_TYPE_SHA1
;
8570 salt_type
= SALT_TYPE_EMBEDDED
;
8571 attack_exec
= ATTACK_EXEC_ON_CPU
;
8572 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8573 kern_type
= KERN_TYPE_SHA1AIX
;
8574 dgst_size
= DGST_SIZE_4_5
;
8575 parse_func
= sha1aix_parse_hash
;
8576 sort_by_digest
= sort_by_digest_4_5
;
8577 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8584 case 6800: hash_type
= HASH_TYPE_AES
;
8585 salt_type
= SALT_TYPE_EMBEDDED
;
8586 attack_exec
= ATTACK_EXEC_ON_CPU
;
8587 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8588 kern_type
= KERN_TYPE_LASTPASS
;
8589 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8590 parse_func
= lastpass_parse_hash
;
8591 sort_by_digest
= sort_by_digest_4_8
;
8592 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8599 case 6900: hash_type
= HASH_TYPE_GOST
;
8600 salt_type
= SALT_TYPE_NONE
;
8601 attack_exec
= ATTACK_EXEC_ON_GPU
;
8602 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8603 kern_type
= KERN_TYPE_GOST
;
8604 dgst_size
= DGST_SIZE_4_8
;
8605 parse_func
= gost_parse_hash
;
8606 sort_by_digest
= sort_by_digest_4_8
;
8607 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8614 case 7100: hash_type
= HASH_TYPE_SHA512
;
8615 salt_type
= SALT_TYPE_EMBEDDED
;
8616 attack_exec
= ATTACK_EXEC_ON_CPU
;
8617 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8618 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8619 dgst_size
= DGST_SIZE_8_16
;
8620 parse_func
= sha512osx_parse_hash
;
8621 sort_by_digest
= sort_by_digest_8_16
;
8622 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8629 case 7200: hash_type
= HASH_TYPE_SHA512
;
8630 salt_type
= SALT_TYPE_EMBEDDED
;
8631 attack_exec
= ATTACK_EXEC_ON_CPU
;
8632 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8633 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8634 dgst_size
= DGST_SIZE_8_16
;
8635 parse_func
= sha512grub_parse_hash
;
8636 sort_by_digest
= sort_by_digest_8_16
;
8637 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8644 case 7300: hash_type
= HASH_TYPE_SHA1
;
8645 salt_type
= SALT_TYPE_EMBEDDED
;
8646 attack_exec
= ATTACK_EXEC_ON_GPU
;
8647 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8648 | OPTS_TYPE_ST_ADD80
8649 | OPTS_TYPE_ST_ADDBITS15
;
8650 kern_type
= KERN_TYPE_RAKP
;
8651 dgst_size
= DGST_SIZE_4_5
;
8652 parse_func
= rakp_parse_hash
;
8653 sort_by_digest
= sort_by_digest_4_5
;
8654 opti_type
= OPTI_TYPE_ZERO_BYTE
8655 | OPTI_TYPE_NOT_ITERATED
;
8662 case 7400: hash_type
= HASH_TYPE_SHA256
;
8663 salt_type
= SALT_TYPE_EMBEDDED
;
8664 attack_exec
= ATTACK_EXEC_ON_CPU
;
8665 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8666 kern_type
= KERN_TYPE_SHA256CRYPT
;
8667 dgst_size
= DGST_SIZE_4_8
;
8668 parse_func
= sha256crypt_parse_hash
;
8669 sort_by_digest
= sort_by_digest_4_8
;
8670 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8677 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8678 salt_type
= SALT_TYPE_EMBEDDED
;
8679 attack_exec
= ATTACK_EXEC_ON_GPU
;
8680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8681 kern_type
= KERN_TYPE_KRB5PA
;
8682 dgst_size
= DGST_SIZE_4_4
;
8683 parse_func
= krb5pa_parse_hash
;
8684 sort_by_digest
= sort_by_digest_4_4
;
8685 opti_type
= OPTI_TYPE_ZERO_BYTE
8686 | OPTI_TYPE_NOT_ITERATED
;
8693 case 7600: hash_type
= HASH_TYPE_SHA1
;
8694 salt_type
= SALT_TYPE_INTERN
;
8695 attack_exec
= ATTACK_EXEC_ON_GPU
;
8696 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8697 | OPTS_TYPE_PT_ADD80
8698 | OPTS_TYPE_PT_ADDBITS15
;
8699 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8700 dgst_size
= DGST_SIZE_4_5
;
8701 parse_func
= redmine_parse_hash
;
8702 sort_by_digest
= sort_by_digest_4_5
;
8703 opti_type
= OPTI_TYPE_ZERO_BYTE
8704 | OPTI_TYPE_PRECOMPUTE_INIT
8705 | OPTI_TYPE_EARLY_SKIP
8706 | OPTI_TYPE_NOT_ITERATED
8707 | OPTI_TYPE_PREPENDED_SALT
;
8714 case 7700: hash_type
= HASH_TYPE_SAPB
;
8715 salt_type
= SALT_TYPE_EMBEDDED
;
8716 attack_exec
= ATTACK_EXEC_ON_GPU
;
8717 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8718 | OPTS_TYPE_PT_UPPER
8719 | OPTS_TYPE_ST_UPPER
;
8720 kern_type
= KERN_TYPE_SAPB
;
8721 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8722 parse_func
= sapb_parse_hash
;
8723 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8724 opti_type
= OPTI_TYPE_ZERO_BYTE
8725 | OPTI_TYPE_PRECOMPUTE_INIT
8726 | OPTI_TYPE_NOT_ITERATED
;
8733 case 7800: hash_type
= HASH_TYPE_SAPG
;
8734 salt_type
= SALT_TYPE_EMBEDDED
;
8735 attack_exec
= ATTACK_EXEC_ON_GPU
;
8736 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8737 | OPTS_TYPE_ST_ADD80
8738 | OPTS_TYPE_ST_UPPER
;
8739 kern_type
= KERN_TYPE_SAPG
;
8740 dgst_size
= DGST_SIZE_4_5
;
8741 parse_func
= sapg_parse_hash
;
8742 sort_by_digest
= sort_by_digest_4_5
;
8743 opti_type
= OPTI_TYPE_ZERO_BYTE
8744 | OPTI_TYPE_PRECOMPUTE_INIT
8745 | OPTI_TYPE_NOT_ITERATED
;
8752 case 7900: hash_type
= HASH_TYPE_SHA512
;
8753 salt_type
= SALT_TYPE_EMBEDDED
;
8754 attack_exec
= ATTACK_EXEC_ON_CPU
;
8755 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8756 kern_type
= KERN_TYPE_DRUPAL7
;
8757 dgst_size
= DGST_SIZE_8_8
;
8758 parse_func
= drupal7_parse_hash
;
8759 sort_by_digest
= sort_by_digest_8_8
;
8760 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8767 case 8000: hash_type
= HASH_TYPE_SHA256
;
8768 salt_type
= SALT_TYPE_EMBEDDED
;
8769 attack_exec
= ATTACK_EXEC_ON_GPU
;
8770 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8771 | OPTS_TYPE_PT_UNICODE
8772 | OPTS_TYPE_ST_ADD80
8774 kern_type
= KERN_TYPE_SYBASEASE
;
8775 dgst_size
= DGST_SIZE_4_8
;
8776 parse_func
= sybasease_parse_hash
;
8777 sort_by_digest
= sort_by_digest_4_8
;
8778 opti_type
= OPTI_TYPE_ZERO_BYTE
8779 | OPTI_TYPE_PRECOMPUTE_INIT
8780 | OPTI_TYPE_EARLY_SKIP
8781 | OPTI_TYPE_NOT_ITERATED
8782 | OPTI_TYPE_RAW_HASH
;
8789 case 8100: hash_type
= HASH_TYPE_SHA1
;
8790 salt_type
= SALT_TYPE_EMBEDDED
;
8791 attack_exec
= ATTACK_EXEC_ON_GPU
;
8792 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8793 kern_type
= KERN_TYPE_NETSCALER
;
8794 dgst_size
= DGST_SIZE_4_5
;
8795 parse_func
= netscaler_parse_hash
;
8796 sort_by_digest
= sort_by_digest_4_5
;
8797 opti_type
= OPTI_TYPE_ZERO_BYTE
8798 | OPTI_TYPE_PRECOMPUTE_INIT
8799 | OPTI_TYPE_PRECOMPUTE_MERKLE
8800 | OPTI_TYPE_EARLY_SKIP
8801 | OPTI_TYPE_NOT_ITERATED
8802 | OPTI_TYPE_PREPENDED_SALT
8803 | OPTI_TYPE_RAW_HASH
;
8810 case 8200: hash_type
= HASH_TYPE_SHA256
;
8811 salt_type
= SALT_TYPE_EMBEDDED
;
8812 attack_exec
= ATTACK_EXEC_ON_CPU
;
8813 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8814 kern_type
= KERN_TYPE_CLOUDKEY
;
8815 dgst_size
= DGST_SIZE_4_8
;
8816 parse_func
= cloudkey_parse_hash
;
8817 sort_by_digest
= sort_by_digest_4_8
;
8818 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8825 case 8300: hash_type
= HASH_TYPE_SHA1
;
8826 salt_type
= SALT_TYPE_EMBEDDED
;
8827 attack_exec
= ATTACK_EXEC_ON_GPU
;
8828 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8830 | OPTS_TYPE_ST_ADD80
;
8831 kern_type
= KERN_TYPE_NSEC3
;
8832 dgst_size
= DGST_SIZE_4_5
;
8833 parse_func
= nsec3_parse_hash
;
8834 sort_by_digest
= sort_by_digest_4_5
;
8835 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8842 case 8400: hash_type
= HASH_TYPE_SHA1
;
8843 salt_type
= SALT_TYPE_INTERN
;
8844 attack_exec
= ATTACK_EXEC_ON_GPU
;
8845 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8846 | OPTS_TYPE_PT_ADD80
8847 | OPTS_TYPE_PT_ADDBITS15
;
8848 kern_type
= KERN_TYPE_WBB3
;
8849 dgst_size
= DGST_SIZE_4_5
;
8850 parse_func
= wbb3_parse_hash
;
8851 sort_by_digest
= sort_by_digest_4_5
;
8852 opti_type
= OPTI_TYPE_ZERO_BYTE
8853 | OPTI_TYPE_PRECOMPUTE_INIT
8854 | OPTI_TYPE_NOT_ITERATED
;
8861 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8862 salt_type
= SALT_TYPE_EMBEDDED
;
8863 attack_exec
= ATTACK_EXEC_ON_GPU
;
8864 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8865 | OPTS_TYPE_ST_UPPER
;
8866 kern_type
= KERN_TYPE_RACF
;
8867 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8868 parse_func
= racf_parse_hash
;
8869 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8870 opti_type
= OPTI_TYPE_ZERO_BYTE
8871 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8878 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8879 salt_type
= SALT_TYPE_NONE
;
8880 attack_exec
= ATTACK_EXEC_ON_GPU
;
8881 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8882 kern_type
= KERN_TYPE_LOTUS5
;
8883 dgst_size
= DGST_SIZE_4_4
;
8884 parse_func
= lotus5_parse_hash
;
8885 sort_by_digest
= sort_by_digest_4_4
;
8886 opti_type
= OPTI_TYPE_EARLY_SKIP
8887 | OPTI_TYPE_NOT_ITERATED
8888 | OPTI_TYPE_NOT_SALTED
8889 | OPTI_TYPE_RAW_HASH
;
8896 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8897 salt_type
= SALT_TYPE_EMBEDDED
;
8898 attack_exec
= ATTACK_EXEC_ON_GPU
;
8899 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8900 kern_type
= KERN_TYPE_LOTUS6
;
8901 dgst_size
= DGST_SIZE_4_4
;
8902 parse_func
= lotus6_parse_hash
;
8903 sort_by_digest
= sort_by_digest_4_4
;
8904 opti_type
= OPTI_TYPE_EARLY_SKIP
8905 | OPTI_TYPE_NOT_ITERATED
8906 | OPTI_TYPE_RAW_HASH
;
8913 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
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_ANDROIDFDE
;
8918 dgst_size
= DGST_SIZE_4_4
;
8919 parse_func
= androidfde_parse_hash
;
8920 sort_by_digest
= sort_by_digest_4_4
;
8921 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8928 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
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_SCRYPT
;
8933 dgst_size
= DGST_SIZE_4_8
;
8934 parse_func
= scrypt_parse_hash
;
8935 sort_by_digest
= sort_by_digest_4_8
;
8936 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8943 case 9000: hash_type
= HASH_TYPE_SHA1
;
8944 salt_type
= SALT_TYPE_EMBEDDED
;
8945 attack_exec
= ATTACK_EXEC_ON_CPU
;
8946 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8947 | OPTS_TYPE_ST_GENERATE_LE
;
8948 kern_type
= KERN_TYPE_PSAFE2
;
8949 dgst_size
= DGST_SIZE_4_5
;
8950 parse_func
= psafe2_parse_hash
;
8951 sort_by_digest
= sort_by_digest_4_5
;
8952 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8959 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
8960 salt_type
= SALT_TYPE_EMBEDDED
;
8961 attack_exec
= ATTACK_EXEC_ON_CPU
;
8962 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8963 kern_type
= KERN_TYPE_LOTUS8
;
8964 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8965 parse_func
= lotus8_parse_hash
;
8966 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8967 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8974 case 9200: hash_type
= HASH_TYPE_SHA256
;
8975 salt_type
= SALT_TYPE_EMBEDDED
;
8976 attack_exec
= ATTACK_EXEC_ON_CPU
;
8977 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8978 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
8979 dgst_size
= DGST_SIZE_4_32
;
8980 parse_func
= cisco8_parse_hash
;
8981 sort_by_digest
= sort_by_digest_4_32
;
8982 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8989 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
8990 salt_type
= SALT_TYPE_EMBEDDED
;
8991 attack_exec
= ATTACK_EXEC_ON_CPU
;
8992 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8993 kern_type
= KERN_TYPE_SCRYPT
;
8994 dgst_size
= DGST_SIZE_4_8
;
8995 parse_func
= cisco9_parse_hash
;
8996 sort_by_digest
= sort_by_digest_4_8
;
8997 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9004 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9005 salt_type
= SALT_TYPE_EMBEDDED
;
9006 attack_exec
= ATTACK_EXEC_ON_CPU
;
9007 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9008 kern_type
= KERN_TYPE_OFFICE2007
;
9009 dgst_size
= DGST_SIZE_4_4
;
9010 parse_func
= office2007_parse_hash
;
9011 sort_by_digest
= sort_by_digest_4_4
;
9012 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9019 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9020 salt_type
= SALT_TYPE_EMBEDDED
;
9021 attack_exec
= ATTACK_EXEC_ON_CPU
;
9022 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9023 kern_type
= KERN_TYPE_OFFICE2010
;
9024 dgst_size
= DGST_SIZE_4_4
;
9025 parse_func
= office2010_parse_hash
;
9026 sort_by_digest
= sort_by_digest_4_4
;
9027 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9034 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9035 salt_type
= SALT_TYPE_EMBEDDED
;
9036 attack_exec
= ATTACK_EXEC_ON_CPU
;
9037 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9038 kern_type
= KERN_TYPE_OFFICE2013
;
9039 dgst_size
= DGST_SIZE_4_4
;
9040 parse_func
= office2013_parse_hash
;
9041 sort_by_digest
= sort_by_digest_4_4
;
9042 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9049 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9050 salt_type
= SALT_TYPE_EMBEDDED
;
9051 attack_exec
= ATTACK_EXEC_ON_GPU
;
9052 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9053 | OPTS_TYPE_PT_ADD80
9054 | OPTS_TYPE_PT_UNICODE
;
9055 kern_type
= KERN_TYPE_OLDOFFICE01
;
9056 dgst_size
= DGST_SIZE_4_4
;
9057 parse_func
= oldoffice01_parse_hash
;
9058 sort_by_digest
= sort_by_digest_4_4
;
9059 opti_type
= OPTI_TYPE_ZERO_BYTE
9060 | OPTI_TYPE_PRECOMPUTE_INIT
9061 | OPTI_TYPE_NOT_ITERATED
;
9068 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9069 salt_type
= SALT_TYPE_EMBEDDED
;
9070 attack_exec
= ATTACK_EXEC_ON_GPU
;
9071 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9072 | OPTS_TYPE_PT_ADD80
;
9073 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9074 dgst_size
= DGST_SIZE_4_4
;
9075 parse_func
= oldoffice01cm1_parse_hash
;
9076 sort_by_digest
= sort_by_digest_4_4
;
9077 opti_type
= OPTI_TYPE_ZERO_BYTE
9078 | OPTI_TYPE_PRECOMPUTE_INIT
9079 | OPTI_TYPE_NOT_ITERATED
;
9086 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9087 salt_type
= SALT_TYPE_EMBEDDED
;
9088 attack_exec
= ATTACK_EXEC_ON_GPU
;
9089 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9090 | OPTS_TYPE_PT_ADD80
9091 | OPTS_TYPE_PT_UNICODE
9092 | OPTS_TYPE_PT_NEVERCRACK
;
9093 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9094 dgst_size
= DGST_SIZE_4_4
;
9095 parse_func
= oldoffice01cm2_parse_hash
;
9096 sort_by_digest
= sort_by_digest_4_4
;
9097 opti_type
= OPTI_TYPE_ZERO_BYTE
9098 | OPTI_TYPE_PRECOMPUTE_INIT
9099 | OPTI_TYPE_NOT_ITERATED
;
9106 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9107 salt_type
= SALT_TYPE_EMBEDDED
;
9108 attack_exec
= ATTACK_EXEC_ON_GPU
;
9109 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9110 | OPTS_TYPE_PT_ADD80
9111 | OPTS_TYPE_PT_UNICODE
;
9112 kern_type
= KERN_TYPE_OLDOFFICE34
;
9113 dgst_size
= DGST_SIZE_4_4
;
9114 parse_func
= oldoffice34_parse_hash
;
9115 sort_by_digest
= sort_by_digest_4_4
;
9116 opti_type
= OPTI_TYPE_ZERO_BYTE
9117 | OPTI_TYPE_PRECOMPUTE_INIT
9118 | OPTI_TYPE_NOT_ITERATED
;
9125 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9126 salt_type
= SALT_TYPE_EMBEDDED
;
9127 attack_exec
= ATTACK_EXEC_ON_GPU
;
9128 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9129 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9130 dgst_size
= DGST_SIZE_4_4
;
9131 parse_func
= oldoffice34cm1_parse_hash
;
9132 sort_by_digest
= sort_by_digest_4_4
;
9133 opti_type
= OPTI_TYPE_ZERO_BYTE
9134 | OPTI_TYPE_PRECOMPUTE_INIT
9135 | OPTI_TYPE_NOT_ITERATED
;
9142 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9143 salt_type
= SALT_TYPE_EMBEDDED
;
9144 attack_exec
= ATTACK_EXEC_ON_GPU
;
9145 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9146 | OPTS_TYPE_PT_ADD80
9147 | OPTS_TYPE_PT_UNICODE
9148 | OPTS_TYPE_PT_NEVERCRACK
;
9149 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9150 dgst_size
= DGST_SIZE_4_4
;
9151 parse_func
= oldoffice34cm2_parse_hash
;
9152 sort_by_digest
= sort_by_digest_4_4
;
9153 opti_type
= OPTI_TYPE_ZERO_BYTE
9154 | OPTI_TYPE_PRECOMPUTE_INIT
9155 | OPTI_TYPE_NOT_ITERATED
;
9162 case 9900: hash_type
= HASH_TYPE_MD5
;
9163 salt_type
= SALT_TYPE_NONE
;
9164 attack_exec
= ATTACK_EXEC_ON_GPU
;
9165 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9166 kern_type
= KERN_TYPE_RADMIN2
;
9167 dgst_size
= DGST_SIZE_4_4
;
9168 parse_func
= radmin2_parse_hash
;
9169 sort_by_digest
= sort_by_digest_4_4
;
9170 opti_type
= OPTI_TYPE_ZERO_BYTE
9171 | OPTI_TYPE_PRECOMPUTE_INIT
9172 | OPTI_TYPE_EARLY_SKIP
9173 | OPTI_TYPE_NOT_ITERATED
9174 | OPTI_TYPE_NOT_SALTED
;
9181 case 10000: hash_type
= HASH_TYPE_SHA256
;
9182 salt_type
= SALT_TYPE_EMBEDDED
;
9183 attack_exec
= ATTACK_EXEC_ON_CPU
;
9184 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9185 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9186 dgst_size
= DGST_SIZE_4_32
;
9187 parse_func
= djangopbkdf2_parse_hash
;
9188 sort_by_digest
= sort_by_digest_4_32
;
9189 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9196 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9197 salt_type
= SALT_TYPE_EMBEDDED
;
9198 attack_exec
= ATTACK_EXEC_ON_GPU
;
9199 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9200 kern_type
= KERN_TYPE_SIPHASH
;
9201 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9202 parse_func
= siphash_parse_hash
;
9203 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9204 opti_type
= OPTI_TYPE_ZERO_BYTE
9205 | OPTI_TYPE_NOT_ITERATED
9206 | OPTI_TYPE_RAW_HASH
;
9213 case 10200: hash_type
= HASH_TYPE_MD5
;
9214 salt_type
= SALT_TYPE_EMBEDDED
;
9215 attack_exec
= ATTACK_EXEC_ON_GPU
;
9216 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9217 | OPTS_TYPE_ST_ADD80
9218 | OPTS_TYPE_ST_ADDBITS14
;
9219 kern_type
= KERN_TYPE_HMACMD5_PW
;
9220 dgst_size
= DGST_SIZE_4_4
;
9221 parse_func
= crammd5_parse_hash
;
9222 sort_by_digest
= sort_by_digest_4_4
;
9223 opti_type
= OPTI_TYPE_ZERO_BYTE
9224 | OPTI_TYPE_NOT_ITERATED
;
9231 case 10300: hash_type
= HASH_TYPE_SHA1
;
9232 salt_type
= SALT_TYPE_EMBEDDED
;
9233 attack_exec
= ATTACK_EXEC_ON_CPU
;
9234 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9235 kern_type
= KERN_TYPE_SAPH_SHA1
;
9236 dgst_size
= DGST_SIZE_4_5
;
9237 parse_func
= saph_sha1_parse_hash
;
9238 sort_by_digest
= sort_by_digest_4_5
;
9239 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9246 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9247 salt_type
= SALT_TYPE_EMBEDDED
;
9248 attack_exec
= ATTACK_EXEC_ON_GPU
;
9249 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9250 kern_type
= KERN_TYPE_PDF11
;
9251 dgst_size
= DGST_SIZE_4_4
;
9252 parse_func
= pdf11_parse_hash
;
9253 sort_by_digest
= sort_by_digest_4_4
;
9254 opti_type
= OPTI_TYPE_ZERO_BYTE
9255 | OPTI_TYPE_NOT_ITERATED
;
9262 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9263 salt_type
= SALT_TYPE_EMBEDDED
;
9264 attack_exec
= ATTACK_EXEC_ON_GPU
;
9265 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9266 kern_type
= KERN_TYPE_PDF11CM1
;
9267 dgst_size
= DGST_SIZE_4_4
;
9268 parse_func
= pdf11cm1_parse_hash
;
9269 sort_by_digest
= sort_by_digest_4_4
;
9270 opti_type
= OPTI_TYPE_ZERO_BYTE
9271 | OPTI_TYPE_NOT_ITERATED
;
9278 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9279 salt_type
= SALT_TYPE_EMBEDDED
;
9280 attack_exec
= ATTACK_EXEC_ON_GPU
;
9281 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9282 kern_type
= KERN_TYPE_PDF11CM2
;
9283 dgst_size
= DGST_SIZE_4_4
;
9284 parse_func
= pdf11cm2_parse_hash
;
9285 sort_by_digest
= sort_by_digest_4_4
;
9286 opti_type
= OPTI_TYPE_ZERO_BYTE
9287 | OPTI_TYPE_NOT_ITERATED
;
9294 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9295 salt_type
= SALT_TYPE_EMBEDDED
;
9296 attack_exec
= ATTACK_EXEC_ON_CPU
;
9297 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9298 kern_type
= KERN_TYPE_PDF14
;
9299 dgst_size
= DGST_SIZE_4_4
;
9300 parse_func
= pdf14_parse_hash
;
9301 sort_by_digest
= sort_by_digest_4_4
;
9302 opti_type
= OPTI_TYPE_ZERO_BYTE
9303 | OPTI_TYPE_NOT_ITERATED
;
9310 case 10600: hash_type
= HASH_TYPE_SHA256
;
9311 salt_type
= SALT_TYPE_EMBEDDED
;
9312 attack_exec
= ATTACK_EXEC_ON_GPU
;
9313 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9314 | OPTS_TYPE_ST_ADD80
9315 | OPTS_TYPE_ST_ADDBITS15
9316 | OPTS_TYPE_HASH_COPY
;
9317 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9318 dgst_size
= DGST_SIZE_4_8
;
9319 parse_func
= pdf17l3_parse_hash
;
9320 sort_by_digest
= sort_by_digest_4_8
;
9321 opti_type
= OPTI_TYPE_ZERO_BYTE
9322 | OPTI_TYPE_PRECOMPUTE_INIT
9323 | OPTI_TYPE_PRECOMPUTE_MERKLE
9324 | OPTI_TYPE_EARLY_SKIP
9325 | OPTI_TYPE_NOT_ITERATED
9326 | OPTI_TYPE_APPENDED_SALT
9327 | OPTI_TYPE_RAW_HASH
;
9334 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9335 salt_type
= SALT_TYPE_EMBEDDED
;
9336 attack_exec
= ATTACK_EXEC_ON_CPU
;
9337 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9338 | OPTS_TYPE_HASH_COPY
;
9339 kern_type
= KERN_TYPE_PDF17L8
;
9340 dgst_size
= DGST_SIZE_4_8
;
9341 parse_func
= pdf17l8_parse_hash
;
9342 sort_by_digest
= sort_by_digest_4_8
;
9343 opti_type
= OPTI_TYPE_ZERO_BYTE
9344 | OPTI_TYPE_NOT_ITERATED
;
9351 case 10800: hash_type
= HASH_TYPE_SHA384
;
9352 salt_type
= SALT_TYPE_NONE
;
9353 attack_exec
= ATTACK_EXEC_ON_GPU
;
9354 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9355 | OPTS_TYPE_PT_ADD80
9356 | OPTS_TYPE_PT_ADDBITS15
;
9357 kern_type
= KERN_TYPE_SHA384
;
9358 dgst_size
= DGST_SIZE_8_8
;
9359 parse_func
= sha384_parse_hash
;
9360 sort_by_digest
= sort_by_digest_8_8
;
9361 opti_type
= OPTI_TYPE_ZERO_BYTE
9362 | OPTI_TYPE_PRECOMPUTE_INIT
9363 | OPTI_TYPE_PRECOMPUTE_MERKLE
9364 | OPTI_TYPE_EARLY_SKIP
9365 | OPTI_TYPE_NOT_ITERATED
9366 | OPTI_TYPE_NOT_SALTED
9367 | OPTI_TYPE_RAW_HASH
;
9374 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9375 salt_type
= SALT_TYPE_EMBEDDED
;
9376 attack_exec
= ATTACK_EXEC_ON_CPU
;
9377 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9378 | OPTS_TYPE_ST_BASE64
9379 | OPTS_TYPE_HASH_COPY
;
9380 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9381 dgst_size
= DGST_SIZE_4_32
;
9382 parse_func
= pbkdf2_sha256_parse_hash
;
9383 sort_by_digest
= sort_by_digest_4_32
;
9384 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9391 case 11000: hash_type
= HASH_TYPE_MD5
;
9392 salt_type
= SALT_TYPE_INTERN
;
9393 attack_exec
= ATTACK_EXEC_ON_GPU
;
9394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9395 | OPTS_TYPE_PT_ADD80
;
9396 kern_type
= KERN_TYPE_PRESTASHOP
;
9397 dgst_size
= DGST_SIZE_4_4
;
9398 parse_func
= prestashop_parse_hash
;
9399 sort_by_digest
= sort_by_digest_4_4
;
9400 opti_type
= OPTI_TYPE_ZERO_BYTE
9401 | OPTI_TYPE_PRECOMPUTE_INIT
9402 | OPTI_TYPE_NOT_ITERATED
9403 | OPTI_TYPE_PREPENDED_SALT
;
9410 case 11100: hash_type
= HASH_TYPE_MD5
;
9411 salt_type
= SALT_TYPE_EMBEDDED
;
9412 attack_exec
= ATTACK_EXEC_ON_GPU
;
9413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9414 | OPTS_TYPE_ST_ADD80
;
9415 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9416 dgst_size
= DGST_SIZE_4_4
;
9417 parse_func
= postgresql_auth_parse_hash
;
9418 sort_by_digest
= sort_by_digest_4_4
;
9419 opti_type
= OPTI_TYPE_ZERO_BYTE
9420 | OPTI_TYPE_PRECOMPUTE_INIT
9421 | OPTI_TYPE_PRECOMPUTE_MERKLE
9422 | OPTI_TYPE_EARLY_SKIP
;
9429 case 11200: hash_type
= HASH_TYPE_SHA1
;
9430 salt_type
= SALT_TYPE_EMBEDDED
;
9431 attack_exec
= ATTACK_EXEC_ON_GPU
;
9432 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9433 | OPTS_TYPE_PT_ADD80
9435 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9436 dgst_size
= DGST_SIZE_4_5
;
9437 parse_func
= mysql_auth_parse_hash
;
9438 sort_by_digest
= sort_by_digest_4_5
;
9439 opti_type
= OPTI_TYPE_ZERO_BYTE
9440 | OPTI_TYPE_EARLY_SKIP
;
9447 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9448 salt_type
= SALT_TYPE_EMBEDDED
;
9449 attack_exec
= ATTACK_EXEC_ON_CPU
;
9450 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9452 | OPTS_TYPE_ST_ADD80
;
9453 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9454 dgst_size
= DGST_SIZE_4_4
;
9455 parse_func
= bitcoin_wallet_parse_hash
;
9456 sort_by_digest
= sort_by_digest_4_4
;
9457 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9464 case 11400: hash_type
= HASH_TYPE_MD5
;
9465 salt_type
= SALT_TYPE_EMBEDDED
;
9466 attack_exec
= ATTACK_EXEC_ON_GPU
;
9467 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9468 | OPTS_TYPE_PT_ADD80
9469 | OPTS_TYPE_HASH_COPY
;
9470 kern_type
= KERN_TYPE_SIP_AUTH
;
9471 dgst_size
= DGST_SIZE_4_4
;
9472 parse_func
= sip_auth_parse_hash
;
9473 sort_by_digest
= sort_by_digest_4_4
;
9474 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9481 case 11500: hash_type
= HASH_TYPE_CRC32
;
9482 salt_type
= SALT_TYPE_INTERN
;
9483 attack_exec
= ATTACK_EXEC_ON_GPU
;
9484 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9485 | OPTS_TYPE_ST_GENERATE_LE
9487 kern_type
= KERN_TYPE_CRC32
;
9488 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9489 parse_func
= crc32_parse_hash
;
9490 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9491 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9498 case 11600: hash_type
= HASH_TYPE_AES
;
9499 salt_type
= SALT_TYPE_EMBEDDED
;
9500 attack_exec
= ATTACK_EXEC_ON_CPU
;
9501 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9502 | OPTS_TYPE_PT_NEVERCRACK
;
9503 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9504 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9505 parse_func
= seven_zip_parse_hash
;
9506 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9507 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9514 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9515 salt_type
= SALT_TYPE_NONE
;
9516 attack_exec
= ATTACK_EXEC_ON_GPU
;
9517 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9518 | OPTS_TYPE_PT_ADD01
;
9519 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9520 dgst_size
= DGST_SIZE_4_8
;
9521 parse_func
= gost2012sbog_256_parse_hash
;
9522 sort_by_digest
= sort_by_digest_4_8
;
9523 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9530 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9531 salt_type
= SALT_TYPE_NONE
;
9532 attack_exec
= ATTACK_EXEC_ON_GPU
;
9533 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9534 | OPTS_TYPE_PT_ADD01
;
9535 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9536 dgst_size
= DGST_SIZE_4_16
;
9537 parse_func
= gost2012sbog_512_parse_hash
;
9538 sort_by_digest
= sort_by_digest_4_16
;
9539 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9546 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9547 salt_type
= SALT_TYPE_EMBEDDED
;
9548 attack_exec
= ATTACK_EXEC_ON_CPU
;
9549 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9550 | OPTS_TYPE_ST_BASE64
9551 | OPTS_TYPE_HASH_COPY
;
9552 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9553 dgst_size
= DGST_SIZE_4_32
;
9554 parse_func
= pbkdf2_md5_parse_hash
;
9555 sort_by_digest
= sort_by_digest_4_32
;
9556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9563 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9564 salt_type
= SALT_TYPE_EMBEDDED
;
9565 attack_exec
= ATTACK_EXEC_ON_CPU
;
9566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9567 | OPTS_TYPE_ST_BASE64
9568 | OPTS_TYPE_HASH_COPY
;
9569 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9570 dgst_size
= DGST_SIZE_4_32
;
9571 parse_func
= pbkdf2_sha1_parse_hash
;
9572 sort_by_digest
= sort_by_digest_4_32
;
9573 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9580 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9581 salt_type
= SALT_TYPE_EMBEDDED
;
9582 attack_exec
= ATTACK_EXEC_ON_CPU
;
9583 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9584 | OPTS_TYPE_ST_BASE64
9585 | OPTS_TYPE_HASH_COPY
;
9586 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9587 dgst_size
= DGST_SIZE_8_16
;
9588 parse_func
= pbkdf2_sha512_parse_hash
;
9589 sort_by_digest
= sort_by_digest_8_16
;
9590 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9597 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9598 salt_type
= SALT_TYPE_EMBEDDED
;
9599 attack_exec
= ATTACK_EXEC_ON_CPU
;
9600 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9601 kern_type
= KERN_TYPE_ECRYPTFS
;
9602 dgst_size
= DGST_SIZE_8_8
;
9603 parse_func
= ecryptfs_parse_hash
;
9604 sort_by_digest
= sort_by_digest_8_8
;
9605 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9612 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9613 salt_type
= SALT_TYPE_EMBEDDED
;
9614 attack_exec
= ATTACK_EXEC_ON_CPU
;
9615 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9616 kern_type
= KERN_TYPE_ORACLET
;
9617 dgst_size
= DGST_SIZE_8_16
;
9618 parse_func
= oraclet_parse_hash
;
9619 sort_by_digest
= sort_by_digest_8_16
;
9620 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9627 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9628 salt_type
= SALT_TYPE_EMBEDDED
;
9629 attack_exec
= ATTACK_EXEC_ON_CPU
;
9630 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9631 kern_type
= KERN_TYPE_BSDICRYPT
;
9632 dgst_size
= DGST_SIZE_4_4
;
9633 parse_func
= bsdicrypt_parse_hash
;
9634 sort_by_digest
= sort_by_digest_4_4
;
9635 opti_type
= OPTI_TYPE_ZERO_BYTE
9636 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9643 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9644 salt_type
= SALT_TYPE_EMBEDDED
;
9645 attack_exec
= ATTACK_EXEC_ON_CPU
;
9646 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9647 kern_type
= KERN_TYPE_RAR3
;
9648 dgst_size
= DGST_SIZE_4_4
;
9649 parse_func
= rar3hp_parse_hash
;
9650 sort_by_digest
= sort_by_digest_4_4
;
9651 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9658 case 12600: hash_type
= HASH_TYPE_SHA256
;
9659 salt_type
= SALT_TYPE_INTERN
;
9660 attack_exec
= ATTACK_EXEC_ON_GPU
;
9661 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9662 | OPTS_TYPE_PT_ADD80
;
9663 kern_type
= KERN_TYPE_CF10
;
9664 dgst_size
= DGST_SIZE_4_8
;
9665 parse_func
= cf10_parse_hash
;
9666 sort_by_digest
= sort_by_digest_4_8
;
9667 opti_type
= OPTI_TYPE_ZERO_BYTE
9668 | OPTI_TYPE_PRECOMPUTE_INIT
9669 | OPTI_TYPE_EARLY_SKIP
9670 | OPTI_TYPE_NOT_ITERATED
;
9677 case 12700: hash_type
= HASH_TYPE_AES
;
9678 salt_type
= SALT_TYPE_EMBEDDED
;
9679 attack_exec
= ATTACK_EXEC_ON_CPU
;
9680 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9681 | OPTS_TYPE_HASH_COPY
;
9682 kern_type
= KERN_TYPE_MYWALLET
;
9683 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9684 parse_func
= mywallet_parse_hash
;
9685 sort_by_digest
= sort_by_digest_4_5
;
9686 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9693 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9694 salt_type
= SALT_TYPE_EMBEDDED
;
9695 attack_exec
= ATTACK_EXEC_ON_CPU
;
9696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9697 kern_type
= KERN_TYPE_MS_DRSR
;
9698 dgst_size
= DGST_SIZE_4_8
;
9699 parse_func
= ms_drsr_parse_hash
;
9700 sort_by_digest
= sort_by_digest_4_8
;
9701 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9708 default: usage_mini_print (PROGNAME
); return (-1);
9715 data
.parse_func
= parse_func
;
9723 if (salt_type
== SALT_TYPE_INTERN
)
9725 opts_type
|= OPTS_TYPE_ST_HEX
;
9729 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9735 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9736 | (salt_type
== SALT_TYPE_EXTERN
)
9737 | (salt_type
== SALT_TYPE_EMBEDDED
)
9738 | (salt_type
== SALT_TYPE_VIRTUAL
));
9740 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9742 data
.hash_type
= hash_type
;
9743 data
.attack_mode
= attack_mode
;
9744 data
.attack_kern
= attack_kern
;
9745 data
.attack_exec
= attack_exec
;
9746 data
.kern_type
= kern_type
;
9747 data
.opts_type
= opts_type
;
9748 data
.dgst_size
= dgst_size
;
9749 data
.salt_type
= salt_type
;
9750 data
.isSalted
= isSalted
;
9751 data
.sort_by_digest
= sort_by_digest
;
9752 data
.dgst_pos0
= dgst_pos0
;
9753 data
.dgst_pos1
= dgst_pos1
;
9754 data
.dgst_pos2
= dgst_pos2
;
9755 data
.dgst_pos3
= dgst_pos3
;
9761 case 2500: esalt_size
= sizeof (wpa_t
); break;
9762 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9763 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9764 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9765 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9777 case 6243: esalt_size
= sizeof (tc_t
); break;
9778 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9779 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9780 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9781 case 7300: esalt_size
= sizeof (rakp_t
); break;
9782 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9783 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9784 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9785 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9786 case 9400: esalt_size
= sizeof (office2007_t
); break;
9787 case 9500: esalt_size
= sizeof (office2010_t
); break;
9788 case 9600: esalt_size
= sizeof (office2013_t
); break;
9789 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9790 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9791 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9792 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9793 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9794 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9795 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9796 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9797 case 10400: esalt_size
= sizeof (pdf_t
); break;
9798 case 10410: esalt_size
= sizeof (pdf_t
); break;
9799 case 10420: esalt_size
= sizeof (pdf_t
); break;
9800 case 10500: esalt_size
= sizeof (pdf_t
); break;
9801 case 10600: esalt_size
= sizeof (pdf_t
); break;
9802 case 10700: esalt_size
= sizeof (pdf_t
); break;
9803 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9804 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9805 case 11400: esalt_size
= sizeof (sip_t
); break;
9806 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9807 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9808 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9809 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9812 data
.esalt_size
= esalt_size
;
9815 * choose dictionary parser
9818 if (hash_type
== HASH_TYPE_LM
)
9820 get_next_word_func
= get_next_word_lm
;
9822 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9824 get_next_word_func
= get_next_word_uc
;
9828 get_next_word_func
= get_next_word_std
;
9835 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9838 size_t dictstat_nmemb
= 0;
9842 uint dictstat_nmemb
= 0;
9847 FILE *dictstat_fp
= NULL
;
9851 memset (dictstat
, 0, sizeof (dictstat
));
9853 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9855 dictstat_fp
= fopen (dictstat
, "rb");
9860 struct stat tmpstat
;
9862 fstat (fileno (dictstat_fp
), &tmpstat
);
9866 struct stat64 tmpstat
;
9868 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9871 if (tmpstat
.st_mtime
< COMPTIME
)
9873 /* with v0.15 the format changed so we have to ensure user is using a good version
9874 since there is no version-header in the dictstat file */
9876 fclose (dictstat_fp
);
9882 while (!feof (dictstat_fp
))
9886 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9888 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9890 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9892 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9898 fclose (dictstat_fp
);
9909 memset (potfile
, 0, sizeof (potfile
));
9911 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9915 FILE *out_fp
= NULL
;
9916 FILE *pot_fp
= NULL
;
9918 if (show
== 1 || left
== 1)
9920 pot_fp
= fopen (potfile
, "rb");
9924 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9929 if (outfile
!= NULL
)
9931 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9933 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
9947 if (potfile_disable
== 0)
9949 pot_fp
= fopen (potfile
, "ab");
9953 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9958 data
.pot_fp
= pot_fp
;
9967 if (show
== 1 || left
== 1)
9969 SUPPRESS_OUTPUT
= 1;
9971 pot_avail
= count_lines (pot_fp
);
9975 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
9977 uint pot_hashes_avail
= 0;
9981 while (!feof (pot_fp
))
9985 char line_buf
[BUFSIZ
];
9987 int line_len
= fgetl (pot_fp
, line_buf
);
9989 if (line_len
== 0) continue;
9991 char *plain_buf
= line_buf
+ line_len
;
9993 pot_t
*pot_ptr
= &pot
[pot_cnt
];
9995 hash_t
*hashes_buf
= &pot_ptr
->hash
;
9997 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
9998 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
10000 if (pot_cnt
== pot_hashes_avail
)
10004 for (pos
= 0; pos
< INCR_POT
; pos
++)
10006 if ((pot_cnt
+ pos
) >= pot_avail
) break;
10008 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
10010 hash_t
*tmp_hash
= &tmp_pot
->hash
;
10012 tmp_hash
->digest
= mymalloc (dgst_size
);
10016 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
10021 tmp_hash
->esalt
= mymalloc (esalt_size
);
10024 pot_hashes_avail
++;
10032 int iter
= MAX_CUT_TRIES
;
10036 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10038 if (line_buf
[i
] == ':')
10046 if (data
.hash_mode
!= 2500)
10048 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10052 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10054 if (line_len
> max_salt_size
)
10056 parser_status
= PARSER_GLOBAL_LENGTH
;
10060 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10062 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10064 hashes_buf
->salt
->salt_len
= line_len
;
10066 parser_status
= PARSER_OK
;
10070 // if NOT parsed without error, we add the ":" to the plain
10072 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10078 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10080 if (parser_status
< PARSER_GLOBAL_ZERO
)
10082 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10087 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10089 pot_ptr
->plain_len
= plain_len
;
10096 SUPPRESS_OUTPUT
= 0;
10098 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10102 * gpu accel and loops auto adjustment
10105 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10106 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10108 if (workload_profile
== 1)
10113 if (gpu_loops
== 0) gpu_loops
= 8;
10114 if (gpu_accel
== 0) gpu_accel
= 2;
10116 else if (workload_profile
== 3)
10121 if (gpu_loops
> 1024) gpu_loops
= 1024;
10122 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10125 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10127 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10132 if (hash_mode
== 12500)
10134 gpu_loops
= ROUNDS_RAR3
/ 16;
10137 data
.gpu_accel
= gpu_accel
;
10138 data
.gpu_loops
= gpu_loops
;
10144 uint pw_min
= PW_MIN
;
10145 uint pw_max
= PW_MAX
;
10149 case 400: if (pw_max
> 40) pw_max
= 40;
10151 case 500: if (pw_max
> 16) pw_max
= 16;
10153 case 1500: if (pw_max
> 8) pw_max
= 8;
10155 case 1600: if (pw_max
> 16) pw_max
= 16;
10157 case 1800: if (pw_max
> 16) pw_max
= 16;
10159 case 2100: if (pw_max
> 16) pw_max
= 16;
10161 case 2500: if (pw_min
< 8) pw_min
= 8;
10163 case 3000: if (pw_max
> 7) pw_max
= 7;
10165 case 5200: if (pw_max
> 24) pw_max
= 24;
10167 case 5800: if (pw_max
> 16) pw_max
= 16;
10169 case 6300: if (pw_max
> 16) pw_max
= 16;
10171 case 7400: if (pw_max
> 16) pw_max
= 16;
10173 case 7900: if (pw_max
> 48) pw_max
= 48;
10175 case 8500: if (pw_max
> 8) pw_max
= 8;
10177 case 8600: if (pw_max
> 16) pw_max
= 16;
10179 case 9710: pw_min
= 5;
10182 case 9810: pw_min
= 5;
10185 case 10410: pw_min
= 5;
10188 case 10300: if (pw_max
< 3) pw_min
= 3;
10189 if (pw_max
> 40) pw_max
= 40;
10191 case 10500: if (pw_max
< 3) pw_min
= 3;
10192 if (pw_max
> 40) pw_max
= 40;
10194 case 10700: if (pw_max
> 16) pw_max
= 16;
10196 case 11300: if (pw_max
> 40) pw_max
= 40;
10198 case 12500: if (pw_max
> 20) pw_max
= 20;
10200 case 12800: if (pw_max
> 24) pw_max
= 24;
10204 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10206 switch (attack_kern
)
10208 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10210 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10216 * charsets : keep them together for more easy maintainnce
10222 memset (mp_sys
, 0, sizeof (mp_sys
));
10223 memset (mp_usr
, 0, sizeof (mp_usr
));
10225 mp_setup_sys (mp_sys
);
10227 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10228 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10229 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10230 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10233 * load hashes, part I: find input mode, count hashes
10236 uint hashlist_mode
= 0;
10237 uint hashlist_format
= HLFMT_HASHCAT
;
10239 uint hashes_avail
= 0;
10241 if (benchmark
== 0)
10245 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10247 if ((hash_mode
== 2500) ||
10248 (hash_mode
== 5200) ||
10249 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10250 (hash_mode
== 9000))
10252 hashlist_mode
= HL_MODE_ARG
;
10254 char *hashfile
= myargv
[optind
];
10256 data
.hashfile
= hashfile
;
10258 logfile_top_var_string ("target", hashfile
);
10261 if (hashlist_mode
== HL_MODE_ARG
)
10263 if (hash_mode
== 2500)
10267 if (stat (data
.hashfile
, &st
) == -1)
10269 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10274 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10281 else if (hashlist_mode
== HL_MODE_FILE
)
10283 char *hashfile
= myargv
[optind
];
10285 data
.hashfile
= hashfile
;
10287 logfile_top_var_string ("target", hashfile
);
10291 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10293 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10298 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10300 hashes_avail
= count_lines (fp
);
10304 if (hashes_avail
== 0)
10306 log_error ("ERROR: hashfile is empty or corrupt");
10313 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10315 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10317 log_error ("ERROR: remove not supported in native hashfile-format mode");
10329 hashlist_mode
= HL_MODE_ARG
;
10334 if (hash_mode
== 3000) hashes_avail
*= 2;
10336 data
.hashlist_mode
= hashlist_mode
;
10337 data
.hashlist_format
= hashlist_format
;
10339 logfile_top_uint (hashlist_mode
);
10340 logfile_top_uint (hashlist_format
);
10343 * load hashes, part II: allocate required memory, set pointers
10346 hash_t
*hashes_buf
= NULL
;
10347 void *digests_buf
= NULL
;
10348 salt_t
*salts_buf
= NULL
;
10349 void *esalts_buf
= NULL
;
10351 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10353 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10355 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10359 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10361 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10363 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10365 if (username
&& (remove
|| show
|| left
))
10367 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10372 hash_info
->orighash
= (char *) mymalloc (256);
10379 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10383 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10388 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10391 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10393 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10397 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10401 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10406 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10411 * load hashes, part III: parse hashes or generate them if benchmark
10414 uint hashes_cnt
= 0;
10416 if (benchmark
== 0)
10420 // useless to read hash file for keyspace, cheat a little bit w/ optind
10422 else if (hashes_avail
== 0)
10425 else if (hashlist_mode
== HL_MODE_ARG
)
10427 char *input_buf
= myargv
[optind
];
10429 uint input_len
= strlen (input_buf
);
10431 logfile_top_var_string ("target", input_buf
);
10433 char *hash_buf
= NULL
;
10436 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10440 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10442 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10444 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10449 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10452 int parser_status
= PARSER_OK
;
10454 if (hash_mode
== 2500)
10458 log_error ("ERROR: hccap file not specified");
10463 hashlist_mode
= HL_MODE_FILE
;
10465 data
.hashlist_mode
= hashlist_mode
;
10467 FILE *fp
= fopen (hash_buf
, "rb");
10471 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10476 if (hashes_avail
< 1)
10478 log_error ("ERROR: hccap file is empty or corrupt");
10485 uint hccap_size
= sizeof (hccap_t
);
10487 char in
[hccap_size
];
10491 int n
= fread (&in
, hccap_size
, 1, fp
);
10495 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10500 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10502 if (parser_status
!= PARSER_OK
)
10504 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10509 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10511 if ((show
== 1) || (left
== 1))
10513 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10515 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10517 int cur_pos
= tmp_salt
->salt_len
;
10518 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10520 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10522 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10524 // do the appending task
10526 snprintf (salt_ptr
+ cur_pos
,
10528 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10529 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10530 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10533 // memset () the remaining part of the salt
10535 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10536 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10538 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10540 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10543 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
);
10544 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
);
10551 else if (hash_mode
== 3000)
10553 if (hash_len
== 32)
10555 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10557 hash_t
*lm_hash_left
= NULL
;
10559 if (parser_status
== PARSER_OK
)
10561 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10567 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10571 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10573 hash_t
*lm_hash_right
= NULL
;
10575 if (parser_status
== PARSER_OK
)
10577 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10583 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10588 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10590 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
);
10591 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
);
10596 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10598 if (parser_status
== PARSER_OK
)
10600 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10601 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10604 if (parser_status
== PARSER_OK
)
10610 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10616 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10618 if (parser_status
== PARSER_OK
)
10620 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10621 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10624 if (parser_status
== PARSER_OK
)
10630 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10635 else if (hashlist_mode
== HL_MODE_FILE
)
10637 char *hashfile
= data
.hashfile
;
10641 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10643 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10654 char line_buf
[BUFSIZ
];
10656 int line_len
= fgetl (fp
, line_buf
);
10658 if (line_len
== 0) continue;
10660 char *hash_buf
= NULL
;
10663 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10667 char *user_buf
= NULL
;
10670 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10672 if (remove
|| show
)
10674 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10676 *user
= (user_t
*) malloc (sizeof (user_t
));
10678 user_t
*user_ptr
= *user
;
10680 if (user_buf
!= NULL
)
10682 user_ptr
->user_name
= mystrdup (user_buf
);
10686 user_ptr
->user_name
= mystrdup ("");
10689 user_ptr
->user_len
= user_len
;
10693 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10695 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10697 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10702 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10705 if (hash_mode
== 3000)
10707 if (hash_len
== 32)
10709 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10711 if (parser_status
< PARSER_GLOBAL_ZERO
)
10713 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10718 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10722 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10724 if (parser_status
< PARSER_GLOBAL_ZERO
)
10726 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10731 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10733 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);
10739 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
);
10740 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
);
10744 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10746 if (parser_status
< PARSER_GLOBAL_ZERO
)
10748 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10753 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);
10755 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10756 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10763 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10765 if (parser_status
< PARSER_GLOBAL_ZERO
)
10767 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10772 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);
10774 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10775 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10783 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10785 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10792 hashes_buf
[0].salt
->salt_len
= 8;
10794 // special salt handling
10798 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10800 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10802 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10804 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10806 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10808 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10810 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10812 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10814 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10816 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10818 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10819 hashes_buf
[0].salt
->scrypt_N
= 1024;
10820 hashes_buf
[0].salt
->scrypt_r
= 1;
10821 hashes_buf
[0].salt
->scrypt_p
= 1;
10823 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10825 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10826 hashes_buf
[0].salt
->scrypt_N
= 16384;
10827 hashes_buf
[0].salt
->scrypt_r
= 1;
10828 hashes_buf
[0].salt
->scrypt_p
= 1;
10830 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10832 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10834 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10836 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10838 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10840 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10842 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10844 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10846 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10848 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10850 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10852 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10854 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10856 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10858 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10862 // special esalt handling
10866 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10868 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10869 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10871 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10872 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10874 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10875 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10876 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10877 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10879 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10880 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10881 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10882 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10884 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10886 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10887 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10888 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10890 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10891 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10892 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10894 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10895 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10896 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10898 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10899 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10900 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10902 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10903 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10904 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10906 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10907 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10908 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10910 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10911 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10912 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10921 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10923 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10925 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10938 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10940 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10942 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10944 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
10948 // set default iterations
10952 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
10954 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10956 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10958 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10960 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
10962 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
10964 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
10966 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
10968 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
10970 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
10974 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
10978 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10982 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10986 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10988 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10990 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
10992 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
10994 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
10996 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
10998 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
11000 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
11002 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
11004 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
11006 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
11008 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
11010 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
11012 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
11014 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
11016 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
11018 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
11020 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
11022 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
11024 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
11026 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
11028 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11030 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11032 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11034 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11036 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11038 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11040 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11042 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11044 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11046 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11048 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11050 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11052 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11054 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11056 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11058 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11060 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11064 // set special tuning for benchmark-mode 1
11066 if (benchmark_mode
== 1)
11073 case 400: gpu_loops
= ROUNDS_PHPASS
;
11076 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11079 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11082 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11085 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11088 case 2100: gpu_loops
= ROUNDS_DCC2
;
11091 case 2500: gpu_loops
= ROUNDS_WPA2
;
11094 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11097 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11100 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11103 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11106 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11109 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11112 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11115 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11118 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11121 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11124 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11127 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11130 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11133 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11136 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11139 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11142 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11145 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11148 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11151 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11154 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11157 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11160 case 7200: gpu_loops
= ROUNDS_GRUB
;
11163 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11166 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11169 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11172 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11175 case 8900: gpu_loops
= 1;
11178 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11181 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11184 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11187 case 9300: gpu_loops
= 1;
11190 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11193 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11196 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11199 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11202 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11205 case 10500: gpu_loops
= ROUNDS_PDF14
;
11208 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11211 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11214 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11217 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11220 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11223 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11226 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11229 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11232 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11235 case 12500: gpu_loops
= ROUNDS_RAR3
;
11238 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11241 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11246 // some algorithm collide too fast, make that impossible
11250 case 11500: ((uint
*) digests_buf
)[1] = 1;
11254 if (gpu_loops
> 1024) gpu_loops
= 1024;
11255 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11258 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11263 if (hash_mode
== 12500)
11265 gpu_loops
= ROUNDS_RAR3
/ 16;
11268 data
.gpu_accel
= gpu_accel
;
11269 data
.gpu_loops
= gpu_loops
;
11274 if (show
== 1 || left
== 1)
11276 for (uint i
= 0; i
< pot_cnt
; i
++)
11278 pot_t
*pot_ptr
= &pot
[i
];
11280 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11282 local_free (hashes_buf
->digest
);
11286 local_free (hashes_buf
->salt
);
11292 if (data
.quiet
== 0) log_info_nn ("");
11299 if (hashes_cnt
== 0)
11301 log_error ("ERROR: No hashes loaded");
11308 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11311 if (data
.outfile
!= NULL
)
11313 if (data
.hashfile
!= NULL
)
11316 struct stat tmpstat_outfile
;
11317 struct stat tmpstat_hashfile
;
11321 struct stat64 tmpstat_outfile
;
11322 struct stat64 tmpstat_hashfile
;
11325 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11327 if (tmp_outfile_fp
)
11330 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11334 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11337 fclose (tmp_outfile_fp
);
11340 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11342 if (tmp_hashfile_fp
)
11345 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11349 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11352 fclose (tmp_hashfile_fp
);
11355 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11357 tmpstat_outfile
.st_mode
= 0;
11358 tmpstat_outfile
.st_nlink
= 0;
11359 tmpstat_outfile
.st_uid
= 0;
11360 tmpstat_outfile
.st_gid
= 0;
11361 tmpstat_outfile
.st_rdev
= 0;
11362 tmpstat_outfile
.st_atime
= 0;
11364 tmpstat_hashfile
.st_mode
= 0;
11365 tmpstat_hashfile
.st_nlink
= 0;
11366 tmpstat_hashfile
.st_uid
= 0;
11367 tmpstat_hashfile
.st_gid
= 0;
11368 tmpstat_hashfile
.st_rdev
= 0;
11369 tmpstat_hashfile
.st_atime
= 0;
11372 tmpstat_outfile
.st_blksize
= 0;
11373 tmpstat_outfile
.st_blocks
= 0;
11375 tmpstat_hashfile
.st_blksize
= 0;
11376 tmpstat_hashfile
.st_blocks
= 0;
11380 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11382 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11389 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11391 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11401 * Remove duplicates
11404 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11408 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11412 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11415 uint hashes_cnt_orig
= hashes_cnt
;
11419 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11423 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11425 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11430 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11433 if (hashes_pos
> hashes_cnt
)
11435 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11445 uint potfile_remove_cracks
= 0;
11447 if (potfile_disable
== 0)
11451 hash_buf
.digest
= mymalloc (dgst_size
);
11452 hash_buf
.salt
= NULL
;
11453 hash_buf
.esalt
= NULL
;
11454 hash_buf
.hash_info
= NULL
;
11455 hash_buf
.cracked
= 0;
11459 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11464 hash_buf
.esalt
= mymalloc (esalt_size
);
11467 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11469 // no solution for these special hash types (for instane because they use hashfile in output etc)
11470 if ((hash_mode
!= 5200) &&
11471 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11472 (hash_mode
!= 9000))
11474 FILE *fp
= fopen (potfile
, "rb");
11480 char line_buf
[BUFSIZ
];
11482 memset (line_buf
, 0, BUFSIZ
);
11484 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11486 if (ptr
== NULL
) break;
11488 int line_len
= strlen (line_buf
);
11490 if (line_len
== 0) continue;
11492 int iter
= MAX_CUT_TRIES
;
11494 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11496 if (line_buf
[i
] != ':') continue;
11500 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11503 hash_t
*found
= NULL
;
11505 if (hash_mode
== 6800)
11507 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11509 // manipulate salt_buf
11510 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11512 hash_buf
.salt
->salt_len
= i
;
11514 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11517 else if (hash_mode
== 2500)
11519 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11521 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11522 // manipulate salt_buf
11524 // to be safe work with a copy (because of line_len loop, i etc)
11526 char line_buf_cpy
[BUFSIZ
];
11527 memset (line_buf_cpy
, 0, BUFSIZ
);
11529 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11531 memcpy (line_buf_cpy
, line_buf
, i
);
11533 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11535 if (mac2_pos
== NULL
) continue;
11540 if (strlen (mac2_pos
) != 12) continue;
11542 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11544 if (mac1_pos
== NULL
) continue;
11549 if (strlen (mac1_pos
) != 12) continue;
11551 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11553 // here we need the ESSID
11554 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11556 hash_buf
.salt
->salt_len
= essid_length
;
11558 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11562 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11566 char *pke_ptr
= (char *) pke
;
11568 for (uint i
= 0; i
< 25; i
++)
11570 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11573 unsigned char mac1
[6];
11574 unsigned char mac2
[6];
11576 memcpy (mac1
, pke_ptr
+ 23, 6);
11577 memcpy (mac2
, pke_ptr
+ 29, 6);
11579 // compare hex string(s) vs binary MAC address(es)
11581 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11583 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11591 if (!found
) continue;
11593 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11595 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11606 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11608 if (parser_status
== PARSER_OK
)
11612 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11616 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11621 if (found
== NULL
) continue;
11623 if (!found
->cracked
) potfile_remove_cracks
++;
11625 found
->cracked
= 1;
11639 local_free (hash_buf
.esalt
);
11644 local_free (hash_buf
.salt
);
11647 local_free (hash_buf
.digest
);
11651 * Now generate all the buffers required for later
11654 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11656 salt_t
*salts_buf_new
= NULL
;
11657 void *esalts_buf_new
= NULL
;
11661 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11665 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11670 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11673 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11675 uint digests_cnt
= hashes_cnt
;
11676 uint digests_done
= 0;
11678 uint size_digests
= digests_cnt
* dgst_size
;
11679 uint size_shown
= digests_cnt
* sizeof (uint
);
11681 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11682 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11684 uint salts_cnt
= 0;
11685 uint salts_done
= 0;
11687 hashinfo_t
**hash_info
= NULL
;
11689 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11691 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11693 if (username
&& (remove
|| show
))
11697 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11699 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11701 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11706 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11711 // copied from inner loop
11713 salt_buf
= &salts_buf_new
[salts_cnt
];
11715 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11719 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11722 salt_buf
->digests_cnt
= 0;
11723 salt_buf
->digests_done
= 0;
11724 salt_buf
->digests_offset
= 0;
11729 if (hashes_buf
[0].cracked
== 1)
11731 digests_shown
[0] = 1;
11735 salt_buf
->digests_done
++;
11738 salt_buf
->digests_cnt
++;
11740 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11742 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11744 hash_info
[0] = hashes_buf
[0].hash_info
;
11747 // copy from inner loop
11749 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11753 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11755 salt_buf
= &salts_buf_new
[salts_cnt
];
11757 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11761 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11764 salt_buf
->digests_cnt
= 0;
11765 salt_buf
->digests_done
= 0;
11766 salt_buf
->digests_offset
= hashes_pos
;
11772 if (hashes_buf
[hashes_pos
].cracked
== 1)
11774 digests_shown
[hashes_pos
] = 1;
11778 salt_buf
->digests_done
++;
11781 salt_buf
->digests_cnt
++;
11783 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11785 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11787 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11791 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11793 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11795 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11797 salts_shown
[salt_pos
] = 1;
11802 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11805 local_free (digests_buf
);
11806 local_free (salts_buf
);
11807 local_free (esalts_buf
);
11809 digests_buf
= digests_buf_new
;
11810 salts_buf
= salts_buf_new
;
11811 esalts_buf
= esalts_buf_new
;
11813 local_free (hashes_buf
);
11816 * special modification not set from parser
11821 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11822 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11823 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11824 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11825 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11826 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11827 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11828 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11829 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11830 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11831 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11832 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11835 if (truecrypt_keyfiles
)
11837 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11839 char *keyfiles
= strdup (truecrypt_keyfiles
);
11841 char *keyfile
= strtok (keyfiles
, ",");
11845 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11847 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11852 data
.digests_cnt
= digests_cnt
;
11853 data
.digests_done
= digests_done
;
11854 data
.digests_buf
= digests_buf
;
11855 data
.digests_shown
= digests_shown
;
11856 data
.digests_shown_tmp
= digests_shown_tmp
;
11858 data
.salts_cnt
= salts_cnt
;
11859 data
.salts_done
= salts_done
;
11860 data
.salts_buf
= salts_buf
;
11861 data
.salts_shown
= salts_shown
;
11863 data
.esalts_buf
= esalts_buf
;
11864 data
.hash_info
= hash_info
;
11867 * Automatic Optimizers
11870 if (salts_cnt
== 1)
11871 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11873 if (digests_cnt
== 1)
11874 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11876 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11877 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11879 if (attack_mode
== ATTACK_MODE_BF
)
11880 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11882 data
.opti_type
= opti_type
;
11884 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11886 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11888 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11890 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11892 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11893 opts_type
|= OPTS_TYPE_PT_ADD80
;
11896 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11898 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11899 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11902 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11904 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11905 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11912 * Some algorithm, like descrypt, can benefit from JIT compilation
11915 uint force_jit_compilation
= 0;
11917 if (hash_mode
== 8900)
11919 force_jit_compilation
= 8900;
11921 else if (hash_mode
== 9300)
11923 force_jit_compilation
= 8900;
11925 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11927 force_jit_compilation
= 1500;
11931 * generate bitmap tables
11934 const uint bitmap_shift1
= 5;
11935 const uint bitmap_shift2
= 13;
11937 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11939 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11940 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11941 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11942 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11943 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11944 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11945 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11946 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11953 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
11955 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
11957 bitmap_nums
= 1 << bitmap_bits
;
11959 bitmap_mask
= bitmap_nums
- 1;
11961 bitmap_size
= bitmap_nums
* sizeof (uint
);
11963 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
11965 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;
11966 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;
11971 bitmap_nums
= 1 << bitmap_bits
;
11973 bitmap_mask
= bitmap_nums
- 1;
11975 bitmap_size
= bitmap_nums
* sizeof (uint
);
11977 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);
11978 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);
11981 * prepare quick rule
11984 data
.rule_buf_l
= rule_buf_l
;
11985 data
.rule_buf_r
= rule_buf_r
;
11987 int rule_len_l
= (int) strlen (rule_buf_l
);
11988 int rule_len_r
= (int) strlen (rule_buf_r
);
11990 data
.rule_len_l
= rule_len_l
;
11991 data
.rule_len_r
= rule_len_r
;
11997 uint
*all_gpu_rules_cnt
= NULL
;
11999 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
12003 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12005 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
12008 char rule_buf
[BUFSIZ
];
12012 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12014 uint gpu_rules_avail
= 0;
12016 uint gpu_rules_cnt
= 0;
12018 gpu_rule_t
*gpu_rules_buf
= NULL
;
12020 char *rp_file
= rp_files
[i
];
12022 char in
[BLOCK_SIZE
];
12023 char out
[BLOCK_SIZE
];
12027 uint rule_line
= 0;
12029 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12031 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12038 memset (rule_buf
, 0, BUFSIZ
);
12040 rule_len
= fgetl (fp
, rule_buf
);
12044 if (rule_len
== 0) continue;
12046 if (rule_buf
[0] == '#') continue;
12048 if (gpu_rules_avail
== gpu_rules_cnt
)
12050 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12052 gpu_rules_avail
+= INCR_RULES
;
12055 memset (in
, 0, BLOCK_SIZE
);
12056 memset (out
, 0, BLOCK_SIZE
);
12058 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12062 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12067 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12069 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12071 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12077 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12079 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12090 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12092 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12096 * merge rules or automatic rule generator
12099 uint gpu_rules_cnt
= 0;
12101 gpu_rule_t
*gpu_rules_buf
= NULL
;
12103 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12109 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12111 repeats
[0] = gpu_rules_cnt
;
12113 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12115 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12117 repeats
[i
+ 1] = gpu_rules_cnt
;
12120 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12122 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12124 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12128 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12130 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12132 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12135 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12137 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12139 if (out_pos
== RULES_MAX
- 1)
12141 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12146 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12151 local_free (repeats
);
12155 uint gpu_rules_avail
= 0;
12157 while (gpu_rules_cnt
< rp_gen
)
12159 if (gpu_rules_avail
== gpu_rules_cnt
)
12161 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12163 gpu_rules_avail
+= INCR_RULES
;
12166 memset (rule_buf
, 0, BLOCK_SIZE
);
12168 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12170 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12178 * generate NOP rules
12181 if (gpu_rules_cnt
== 0)
12183 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12185 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12190 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12191 data
.gpu_rules_buf
= gpu_rules_buf
;
12197 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12199 uint CL_platforms_cnt
= 0;
12201 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12203 if (CL_platforms_cnt
== 0)
12205 log_error ("ERROR: No OpenCL compatible platform found");
12210 if (CL_platforms_cnt
> 1)
12212 log_error ("ERROR: Too many OpenCL compatible platforms found");
12217 cl_platform_id CL_platform
= CL_platforms
[0];
12219 char CL_platform_vendor
[INFOSZ
];
12221 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12223 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12227 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12229 vendor_id
= VENDOR_ID_AMD
;
12231 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12233 vendor_id
= VENDOR_ID_NV
;
12235 // make sure that we do not directly control the fan for NVidia
12237 gpu_temp_retain
= 0;
12238 data
.gpu_temp_retain
= gpu_temp_retain
;
12242 vendor_id
= VENDOR_ID_UNKNOWN
;
12245 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12247 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12249 gpu_temp_disable
= 1;
12252 data
.vendor_id
= vendor_id
;
12258 cl_device_id devices_all
[DEVICES_MAX
];
12259 cl_device_id devices
[DEVICES_MAX
];
12261 uint devices_all_cnt
= 0;
12263 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12265 int hm_adapters_all
= devices_all_cnt
;
12267 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12269 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12271 if (gpu_temp_disable
== 0)
12273 if (vendor_id
== VENDOR_ID_NV
)
12276 HM_LIB hm_dll
= hm_init ();
12278 data
.hm_dll
= hm_dll
;
12280 if (hc_NVML_nvmlInit (hm_dll
) == NVML_SUCCESS
)
12282 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12284 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12288 for (int i
= 0; i
< tmp_in
; i
++)
12290 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12293 hm_adapters_all
= tmp_out
;
12295 for (int i
= 0; i
< tmp_out
; i
++)
12297 unsigned int speed
;
12299 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;
12305 if (NvAPI_Initialize () == NVAPI_OK
)
12307 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12309 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12313 for (int i
= 0; i
< tmp_in
; i
++)
12315 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12318 hm_adapters_all
= tmp_out
;
12320 for (int i
= 0; i
< tmp_out
; i
++)
12324 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12330 if (vendor_id
== VENDOR_ID_AMD
)
12332 HM_LIB hm_dll
= hm_init ();
12334 data
.hm_dll
= hm_dll
;
12336 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12338 // total number of adapters
12340 int hm_adapters_num
;
12342 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12346 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12348 if (lpAdapterInfo
== NULL
) return (-1);
12350 // get a list (of ids of) valid/usable adapters
12352 int num_adl_adapters
= 0;
12354 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12356 if (num_adl_adapters
> 0)
12358 hc_thread_mutex_lock (mux_adl
);
12360 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12362 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12364 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12365 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12367 hc_thread_mutex_unlock (mux_adl
);
12370 hm_adapters_all
= num_adl_adapters
;
12372 myfree (valid_adl_device_list
);
12373 myfree (lpAdapterInfo
);
12378 if (hm_adapters_all
== 0)
12380 gpu_temp_disable
= 1;
12383 if (gpu_temp_disable
== 1)
12385 gpu_temp_abort
= 0;
12386 gpu_temp_retain
= 0;
12390 * enable custom signal handler(s)
12393 if (benchmark
== 0)
12395 hc_signal (sigHandler_default
);
12399 hc_signal (sigHandler_benchmark
);
12403 * devices mask and properties
12406 uint devices_cnt
= 0;
12408 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12410 if (gpu_devicemask
)
12412 uint device_all_id_mask
= 1 << device_all_id
;
12414 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12416 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12422 const uint device_id
= devices_cnt
;
12424 devices
[device_id
] = devices_all
[device_all_id
];
12426 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12428 char device_name
[INFOSZ
];
12430 memset (device_name
, 0, sizeof (device_name
));
12432 cl_ulong global_mem_size
;
12433 cl_uint max_clock_frequency
;
12434 cl_uint max_compute_units
;
12436 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12437 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12438 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12439 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12441 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12443 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12446 (unsigned int) (global_mem_size
/ 1024 / 1024),
12447 (unsigned int) (max_clock_frequency
),
12448 (unsigned int) max_compute_units
);
12454 if (devices_cnt
== 0)
12456 log_error ("ERROR: No devices left that matches your specification.");
12461 data
.devices_cnt
= devices_cnt
;
12463 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12472 // gpu temp sanity check
12474 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12476 if (gpu_temp_abort
< gpu_temp_retain
)
12478 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12484 data
.gpu_temp_disable
= gpu_temp_disable
;
12485 data
.gpu_temp_abort
= gpu_temp_abort
;
12486 data
.gpu_temp_retain
= gpu_temp_retain
;
12488 if (data
.quiet
== 0)
12490 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12492 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
);
12494 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12496 log_info ("Rules: %u", gpu_rules_cnt
);
12501 log_info ("Applicable Optimizers:");
12503 for (uint i
= 0; i
< 32; i
++)
12505 const uint opti_bit
= 1 << i
;
12507 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12512 * Watchdog and Temperature balance
12515 if (gpu_temp_abort
== 0)
12517 log_info ("Watchdog: Temperature abort trigger disabled");
12521 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12524 if (gpu_temp_retain
== 0)
12526 log_info ("Watchdog: Temperature retain trigger disabled");
12530 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12538 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12540 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12542 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12544 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12546 data
.devices_param
= devices_param
;
12548 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12550 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12552 cl_device_id device
= devices
[device_id
];
12554 device_param
->device
= device
;
12556 cl_uint max_compute_units
= 0;
12558 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12560 device_param
->gpu_processors
= max_compute_units
;
12562 cl_ulong max_mem_alloc_size
= 0;
12564 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12566 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12568 char tmp
[INFOSZ
], t1
[64];
12570 memset (tmp
, 0, sizeof (tmp
));
12572 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12574 device_param
->device_name
= mystrdup (tmp
);
12576 memset (tmp
, 0, sizeof (tmp
));
12578 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12580 memset (t1
, 0, sizeof (t1
));
12582 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12584 device_param
->device_version
= mystrdup (t1
);
12586 memset (tmp
, 0, sizeof (tmp
));
12588 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12590 device_param
->driver_version
= mystrdup (tmp
);
12592 if (vendor_id
== VENDOR_ID_NV
)
12594 cl_uint sm_minor
= 0;
12595 cl_uint sm_major
= 0;
12597 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12598 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12600 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12601 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12603 device_param
->sm_minor
= sm_minor
;
12604 device_param
->sm_major
= sm_major
;
12608 * catalyst driver check
12611 if (vendor_id
== VENDOR_ID_AMD
)
12613 int catalyst_check
= (force
== 1) ? 0 : 1;
12615 int catalyst_warn
= 0;
12617 int catalyst_broken
= 0;
12619 if (catalyst_check
== 1)
12623 // v14.9 and higher
12624 if ((atoi (device_param
->device_version
) >= 1573)
12625 && (atoi (device_param
->driver_version
) >= 1573))
12632 if ((strstr (device_param->device_version, "1573.") != NULL)
12633 && (strstr (device_param->driver_version, "1573.") != NULL))
12638 // v14.12 -- version overlaps with v15.4 beta
12639 if ((strstr (device_param->device_version, "1642.") != NULL)
12640 && (strstr (device_param->driver_version, "1642.") != NULL))
12642 catalyst_broken = 1;
12645 // v15.4 (Beta, Windows only release)
12646 if ((strstr (device_param->device_version, "1642.") != NULL)
12647 && (strstr (device_param->driver_version, "1642.") != NULL))
12652 // v15.5 (Release, Linux)
12653 if ((strstr (device_param->device_version, "1702.") != NULL)
12654 && (strstr (device_param->driver_version, "1702.") != NULL))
12659 // v15.3 (Beta, Ubuntu repository release)
12660 if ((strstr (device_param->device_version, "1729.") != NULL)
12661 && (strstr (device_param->driver_version, "1729.") != NULL))
12667 catalyst_check
= 0;
12670 if (catalyst_broken
== 1)
12673 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12674 log_error ("It will pass over cracked hashes and does not report them as cracked");
12675 log_error ("You are STRONGLY encouraged not to use it");
12676 log_error ("You can use --force to override this but do not post error reports if you do so");
12681 if (catalyst_warn
== 1)
12684 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12685 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12686 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12688 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12690 log_error ("You can use --force to override this but do not post error reports if you do so");
12699 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12700 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12701 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12702 * Driver / ADL bug?
12705 if (vendor_id
== VENDOR_ID_AMD
)
12707 if (powertune_enable
== 1)
12709 hc_thread_mutex_lock (mux_adl
);
12711 for (uint i
= 0; i
< devices_cnt
; i
++)
12713 if (data
.hm_device
[i
].od_version
== 6)
12715 // set powertune value only
12717 int powertune_supported
= 0;
12721 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12723 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12728 if (powertune_supported
!= 0)
12731 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12733 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12735 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12740 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12742 log_error ("ERROR: Failed to set new ADL PowerControl values");
12750 hc_thread_mutex_unlock (mux_adl
);
12754 uint gpu_blocks_all
= 0;
12756 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12762 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12765 * device properties
12768 char *device_name
= device_param
->device_name
;
12769 char *device_version
= device_param
->device_version
;
12770 char *driver_version
= device_param
->driver_version
;
12772 uint gpu_processors
= device_param
->gpu_processors
;
12775 * create context for each device
12778 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12781 * create command-queue
12784 // not support with NV
12785 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12787 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12790 * create input buffers on device
12793 uint gpu_threads
= GPU_THREADS
;
12795 if (hash_mode
== 3200) gpu_threads
= 8;
12796 if (hash_mode
== 9000) gpu_threads
= 8;
12798 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12799 uint gpu_blocks
= gpu_power
;
12801 device_param
->gpu_threads
= gpu_threads
;
12802 device_param
->gpu_power_user
= gpu_power
;
12803 device_param
->gpu_blocks_user
= gpu_blocks
;
12805 gpu_blocks_all
+= gpu_blocks
;
12807 uint size_pws
= gpu_power
* sizeof (pw_t
);
12809 uint size_tmps
= 4;
12813 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12814 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12815 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12816 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12817 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12818 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12819 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12820 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12821 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12822 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12825 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12828 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12831 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12834 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12835 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12836 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12837 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12838 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12839 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12840 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12841 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12842 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12843 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12844 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12845 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12846 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12847 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12848 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12849 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12850 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12851 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12852 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12853 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12854 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12855 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12856 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12857 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12858 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12859 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12860 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12861 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12862 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12863 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12864 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12865 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12866 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12867 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12868 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12869 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12870 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12871 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12874 uint size_hooks
= 4;
12876 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12878 // insert correct hook size
12881 // we can optimize some stuff here...
12883 device_param
->size_pws
= size_pws
;
12884 device_param
->size_tmps
= size_tmps
;
12885 device_param
->size_hooks
= size_hooks
;
12887 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12888 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12890 device_param
->size_root_css
= size_root_css
;
12891 device_param
->size_markov_css
= size_markov_css
;
12893 uint size_results
= GPU_THREADS
* sizeof (uint
);
12895 device_param
->size_results
= size_results
;
12897 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12898 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12899 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12900 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12901 uint size_esalts
= salts_cnt
* esalt_size
;
12903 device_param
->size_plains
= size_plains
;
12904 device_param
->size_digests
= size_digests
;
12905 device_param
->size_shown
= size_shown
;
12906 device_param
->size_salts
= size_salts
;
12908 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12909 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12910 uint size_tm
= 32 * sizeof (bs_word_t
);
12912 uint64_t size_scryptV
= 1;
12914 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12916 #define SHADER_PER_MP 8
12917 #define WAVEFRONTS 64
12919 uint tmto_start
= 2;
12920 uint tmto_stop
= 1024;
12924 tmto_start
= 1 << scrypt_tmto
;
12925 tmto_stop
= tmto_start
+ 1;
12928 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
<<= 1)
12930 // todo -- make sure all salts get the new tmto value
12932 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
12934 size_scryptV
/= tmto
;
12936 size_scryptV
*= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12938 if (size_scryptV
> (device_param
->gpu_maxmem_alloc
/ 2)) continue;
12940 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
12942 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
12943 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12949 if (data
.salts_buf
[0].scrypt_tmto
== 0)
12951 log_error ("ERROR: can't allocate enough GPU memory");
12956 if (quiet
== 0) log_info ("");
12957 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
12964 char build_opts
[1024];
12966 // we don't have sm_* on AMD but it doesn't matter
12968 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
12972 char kernel_file
[256];
12974 memset (kernel_file
, 0, sizeof (kernel_file
));
12976 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
12978 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
12980 #ifdef BINARY_KERNEL
12981 if (force_jit_compilation
== 0)
12983 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12985 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12986 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
);
12987 else if (attack_kern
== ATTACK_KERN_COMBI
)
12988 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
);
12989 else if (attack_kern
== ATTACK_KERN_BF
)
12990 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
);
12994 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
);
12996 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12998 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
);
13002 if (stat (kernel_file
, &st
) == -1)
13004 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_file
);
13006 char module_file
[256];
13008 memset (module_file
, 0, sizeof (module_file
));
13010 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13012 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13013 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a0.llvmir", install_dir
, (int) kern_type
);
13014 else if (attack_kern
== ATTACK_KERN_COMBI
)
13015 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a1.llvmir", install_dir
, (int) kern_type
);
13016 else if (attack_kern
== ATTACK_KERN_BF
)
13017 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a3.llvmir", install_dir
, (int) kern_type
);
13021 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d.llvmir", install_dir
, (int) kern_type
);
13023 if ((hash_mode
== 8900) || (hash_mode
== 9300))
13025 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
);
13029 load_kernel (module_file
, 1, kernel_lengths
, kernel_sources
);
13031 cl_program program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13033 local_free (kernel_sources
[0]);
13035 hc_clBuildProgram (program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13037 size_t binary_size
;
13039 clGetProgramInfo (program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13041 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13043 clGetProgramInfo (program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13045 writeProgramBin (kernel_file
, binary
, binary_size
);
13047 local_free (binary
);
13049 stat (kernel_file
, &st
); // to reload filesize
13054 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13056 if (stat (kernel_file
, &st
) == -1)
13058 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13066 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13068 if (stat (kernel_file
, &st
) == -1)
13070 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13077 load_kernel (kernel_file
, 1, kernel_lengths
, kernel_sources
);
13079 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_file
, st
.st_size
);
13081 #ifdef BINARY_KERNEL
13082 if (force_jit_compilation
== 0)
13084 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13088 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13091 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13094 local_free (kernel_lengths
);
13096 local_free (kernel_sources
[0]);
13098 local_free (kernel_sources
)
13104 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13106 char kernel_mp_file
[256];
13108 memset (kernel_mp_file
, 0, sizeof (kernel_mp_file
));
13110 size_t *kernel_mp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13112 const unsigned char **kernel_mp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13114 #ifdef BINARY_KERNEL
13115 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13117 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
);
13121 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
);
13124 if (stat (kernel_mp_file
, &st
) == -1)
13126 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_mp_file
);
13128 char module_mp_file
[256];
13130 memset (module_mp_file
, 0, sizeof (module_mp_file
));
13132 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13134 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_be.llvmir", install_dir
);
13138 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_le.llvmir", install_dir
);
13141 load_kernel (module_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13143 cl_program program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13145 local_free (kernel_mp_sources
[0]);
13147 hc_clBuildProgram (program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13149 size_t binary_mp_size
;
13151 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_mp_size
, NULL
);
13153 unsigned char *binary_mp
= (unsigned char *) mymalloc (binary_mp_size
);
13155 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary_mp
), &binary_mp
, NULL
);
13157 writeProgramBin (kernel_mp_file
, binary_mp
, binary_mp_size
);
13159 local_free (binary_mp
);
13161 stat (kernel_mp_file
, &st
); // to reload filesize
13165 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13167 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_be.cl", install_dir
);
13171 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_le.cl", install_dir
);
13174 if (stat (kernel_mp_file
, &st
) == -1)
13176 log_error ("ERROR: %s: %s", kernel_mp_file
, strerror (errno
));
13183 load_kernel (kernel_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13185 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_mp_file
, st
.st_size
);
13187 #ifdef BINARY_KERNEL
13188 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13190 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_mp_sources
, NULL
);
13193 local_free (kernel_mp_lengths
);
13195 local_free (kernel_mp_sources
[0]);
13197 local_free (kernel_mp_sources
);
13204 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13210 char kernel_amp_file
[256];
13212 memset (kernel_amp_file
, 0, sizeof (kernel_amp_file
));
13214 size_t *kernel_amp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13216 const unsigned char **kernel_amp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13218 #ifdef BINARY_KERNEL
13219 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
);
13221 if (stat (kernel_amp_file
, &st
) == -1)
13223 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_amp_file
);
13225 char module_amp_file
[256];
13227 memset (module_amp_file
, 0, sizeof (module_amp_file
));
13229 snprintf (module_amp_file
, sizeof (module_amp_file
) - 1, "%s/kernels/4098/amp_a%d.llvmir", install_dir
, attack_kern
);
13231 load_kernel (module_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13233 cl_program program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13235 local_free (kernel_amp_sources
[0]);
13237 hc_clBuildProgram (program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13239 size_t binary_amp_size
;
13241 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_amp_size
, NULL
);
13243 unsigned char *binary_amp
= (unsigned char *) mymalloc (binary_amp_size
);
13245 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary_amp
), &binary_amp
, NULL
);
13247 writeProgramBin (kernel_amp_file
, binary_amp
, binary_amp_size
);
13249 local_free (binary_amp
);
13251 stat (kernel_amp_file
, &st
); // to reload filesize
13254 snprintf (kernel_amp_file
, sizeof (kernel_amp_file
) - 1, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
13256 if (stat (kernel_amp_file
, &st
) == -1)
13258 log_error ("ERROR: %s: %s", kernel_amp_file
, strerror (errno
));
13264 load_kernel (kernel_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13266 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_amp_file
, st
.st_size
);
13268 #ifdef BINARY_KERNEL
13269 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13271 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_amp_sources
, NULL
);
13274 local_free (kernel_amp_lengths
);
13276 local_free (kernel_amp_sources
[0]);
13278 local_free (kernel_amp_sources
);
13285 //#ifdef BINARY_KERNEL
13287 if (force_jit_compilation
== 0)
13291 else if (force_jit_compilation
== 1500)
13293 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13295 else if (force_jit_compilation
== 8900)
13297 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
);
13302 clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13304 size_t ret_val_size
= 0;
13306 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13308 if (ret_val_size
> 2)
13310 char *build_log
= (char *) malloc (ret_val_size
+ 1);
13312 memset (build_log
, 0, ret_val_size
+ 1);
13314 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13321 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13323 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13326 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13332 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13336 * amp is not independent
13339 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13345 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13352 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13353 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13354 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13355 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13356 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13357 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13358 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13359 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13360 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13361 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13362 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13363 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13364 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13365 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13366 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13367 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13368 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13369 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13371 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13372 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13373 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13374 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13375 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13376 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13377 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13378 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13379 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13380 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13381 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13383 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13384 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13385 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13386 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13387 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13388 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13394 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13396 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13397 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13399 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13401 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13403 else if (attack_kern
== ATTACK_KERN_COMBI
)
13405 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13406 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13407 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13408 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13410 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13411 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13412 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13413 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13415 else if (attack_kern
== ATTACK_KERN_BF
)
13417 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13418 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13419 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13420 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13421 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13423 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13424 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13425 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13426 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13427 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13432 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13434 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13441 uint
*result
= (uint
*) mymalloc (size_results
);
13443 memset (result
, 0, size_results
);
13445 device_param
->result
= result
;
13447 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13449 memset (pws_buf
, 0, size_pws
);
13451 device_param
->pws_buf
= pws_buf
;
13453 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13455 for (int i
= 0; i
< 64; i
++)
13457 pw_caches
[i
].pw_buf
.pw_len
= i
;
13458 pw_caches
[i
].cnt
= 0;
13461 device_param
->pw_caches
= pw_caches
;
13463 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13465 device_param
->combs_buf
= combs_buf
;
13467 void *hooks_buf
= mymalloc (size_hooks
);
13469 device_param
->hooks_buf
= hooks_buf
;
13471 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13472 device_param
->pw_add
= pw_add_to_hc1
;
13478 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13479 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13480 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13481 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13482 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13483 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13484 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13485 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13486 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13487 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13488 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13490 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13491 ? &device_param
->d_pws_buf
13492 : &device_param
->d_pws_amp_buf
;
13493 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13494 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13495 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13496 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13497 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13498 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13499 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13500 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13501 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13502 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13503 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13504 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13505 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13506 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13507 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13508 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13509 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13510 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13511 device_param
->kernel_params
[19] = &device_param
->d_result
;
13512 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13513 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13514 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13515 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13516 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13517 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13518 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13519 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13520 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13521 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13522 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13523 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13525 device_param
->kernel_params_mp_buf64
[3] = 0;
13526 device_param
->kernel_params_mp_buf32
[4] = 0;
13527 device_param
->kernel_params_mp_buf32
[5] = 0;
13528 device_param
->kernel_params_mp_buf32
[6] = 0;
13529 device_param
->kernel_params_mp_buf32
[7] = 0;
13530 device_param
->kernel_params_mp_buf32
[8] = 0;
13532 device_param
->kernel_params_mp
[0] = NULL
;
13533 device_param
->kernel_params_mp
[1] = NULL
;
13534 device_param
->kernel_params_mp
[2] = NULL
;
13535 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13536 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13537 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13538 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13539 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13540 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13542 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13543 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13544 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13545 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13546 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13547 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13548 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13550 device_param
->kernel_params_mp_l
[0] = NULL
;
13551 device_param
->kernel_params_mp_l
[1] = NULL
;
13552 device_param
->kernel_params_mp_l
[2] = NULL
;
13553 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13554 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13555 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13556 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13557 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13558 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13559 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13561 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13562 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13563 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13564 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13565 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13566 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13568 device_param
->kernel_params_mp_r
[0] = NULL
;
13569 device_param
->kernel_params_mp_r
[1] = NULL
;
13570 device_param
->kernel_params_mp_r
[2] = NULL
;
13571 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13572 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13573 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13574 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13575 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13576 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13578 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13579 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13581 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13582 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13583 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13584 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13585 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13586 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13587 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13589 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13591 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13592 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13598 char kernel_name
[64];
13600 memset (kernel_name
, 0, sizeof (kernel_name
));
13602 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13604 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13606 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13608 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13610 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13612 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13614 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13616 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13620 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13622 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13624 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13626 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13628 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13630 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13633 if (data
.attack_mode
== ATTACK_MODE_BF
)
13635 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13637 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13639 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13641 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13643 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13649 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13651 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13653 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13655 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13657 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13659 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13661 if (opts_type
& OPTS_TYPE_HOOK12
)
13663 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13665 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13668 if (opts_type
& OPTS_TYPE_HOOK23
)
13670 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13672 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13676 for (uint i
= 0; i
<= 20; i
++)
13678 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13679 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13680 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13682 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13683 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13686 for (uint i
= 21; i
<= 31; i
++)
13688 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13689 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13690 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13692 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13693 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13696 if (attack_mode
== ATTACK_MODE_BF
)
13698 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13699 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13701 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13703 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13705 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13706 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13709 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13711 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13713 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13715 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13718 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13724 for (uint i
= 0; i
< 5; i
++)
13726 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13729 for (uint i
= 5; i
< 7; i
++)
13731 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13736 * Store initial fanspeed if gpu_temp_retain is enabled
13739 int gpu_temp_retain_set
= 0;
13741 if (gpu_temp_disable
== 0)
13743 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13745 hc_thread_mutex_lock (mux_adl
);
13747 if (data
.hm_device
[device_id
].fan_supported
== 1)
13749 if (gpu_temp_retain_chgd
== 0)
13752 uint default_temp
= 0;
13754 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
);
13756 if (ADL_rc
== ADL_OK
)
13758 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13760 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13762 // special case with multi gpu setups: always use minimum retain
13764 if (gpu_temp_retain_set
== 0)
13766 gpu_temp_retain
= gpu_temp_retain_target
;
13767 gpu_temp_retain_set
= 1;
13771 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13774 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13778 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13780 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13782 if (fan_speed
== -1)
13784 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13786 temp_retain_fanspeed_value
[device_id
] = 0;
13790 hc_thread_mutex_unlock (mux_adl
);
13795 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13798 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13800 hc_thread_mutex_lock (mux_adl
);
13802 if (data
.hm_device
[device_id
].od_version
== 6)
13806 // check powertune capabilities first, if not available then skip device
13808 int powertune_supported
= 0;
13810 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13812 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13817 if (powertune_supported
!= 0)
13819 // powercontrol settings
13821 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13823 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13825 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13828 if (ADL_rc
!= ADL_OK
)
13830 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13835 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13837 log_error ("ERROR: Failed to set new ADL PowerControl values");
13844 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13846 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13848 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
)
13850 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13855 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13857 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13859 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
13861 log_error ("ERROR: Failed to get ADL device capabilities");
13866 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
13867 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
13869 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
13870 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
13872 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
13873 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
13875 // warning if profile has to low max values
13877 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
13879 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13882 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
13884 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13887 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
13889 performance_state
->iNumberOfPerformanceLevels
= 2;
13891 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
13892 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
13893 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
13894 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
13896 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
)
13898 log_info ("ERROR: Failed to set ADL performance state");
13903 local_free (performance_state
);
13907 hc_thread_mutex_unlock (mux_adl
);
13911 data
.gpu_blocks_all
= gpu_blocks_all
;
13913 if (data
.quiet
== 0) log_info ("");
13916 * Inform user which algorithm is checked and at which workload setting
13919 if (benchmark
== 1)
13923 data
.quiet
= quiet
;
13925 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
13927 log_info ("Hashtype: %s", hash_type
);
13928 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
13933 * keep track of the progress
13936 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13937 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13938 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13945 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
13947 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
13952 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
13954 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
13959 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
13961 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
13971 segment_size
*= (1024 * 1024);
13973 data
.segment_size
= segment_size
;
13975 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
13977 wl_data
->buf
= (char *) mymalloc (segment_size
);
13978 wl_data
->avail
= segment_size
;
13979 wl_data
->incr
= segment_size
;
13983 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
13985 data
.wordlist_mode
= wordlist_mode
;
13987 cs_t
*css_buf
= NULL
;
13991 char **masks
= NULL
;
13992 char **dictfiles
= NULL
;
13994 uint mask_from_file
= 0;
13996 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13998 if (wordlist_mode
== WL_MODE_FILE
)
14000 int wls_left
= myargc
- (optind
+ 1);
14002 for (int i
= 0; i
< wls_left
; i
++)
14004 char *l0_filename
= myargv
[optind
+ 1 + i
];
14006 struct stat l0_stat
;
14008 if (stat (l0_filename
, &l0_stat
) == -1)
14010 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
14015 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
14019 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14023 dictfiles
[dictcnt
- 1] = l0_filename
;
14027 // do not allow --keyspace w/ a directory
14031 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14036 char **dictionary_files
= NULL
;
14038 dictionary_files
= scan_directory (l0_filename
);
14040 if (dictionary_files
!= NULL
)
14042 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14044 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14046 char *l1_filename
= dictionary_files
[d
];
14048 struct stat l1_stat
;
14050 if (stat (l1_filename
, &l1_stat
) == -1)
14052 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14057 if (S_ISREG (l1_stat
.st_mode
))
14059 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14063 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14068 local_free (dictionary_files
);
14074 log_error ("ERROR: No usable dictionary file found.");
14079 else if (wordlist_mode
== WL_MODE_STDIN
)
14084 else if (attack_mode
== ATTACK_MODE_COMBI
)
14088 char *dictfile1
= myargv
[optind
+ 1 + 0];
14089 char *dictfile2
= myargv
[optind
+ 1 + 1];
14091 // find the bigger dictionary and use as base
14096 struct stat tmp_stat
;
14098 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14100 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14105 if (stat (dictfile1
, &tmp_stat
) == -1)
14107 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14114 if (S_ISDIR (tmp_stat
.st_mode
))
14116 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14123 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14125 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14132 if (stat (dictfile2
, &tmp_stat
) == -1)
14134 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14142 if (S_ISDIR (tmp_stat
.st_mode
))
14144 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14152 data
.combs_cnt
= 1;
14156 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14158 data
.quiet
= quiet
;
14160 if (words1_cnt
== 0)
14162 log_error ("ERROR: %s: empty file", dictfile1
);
14170 data
.combs_cnt
= 1;
14174 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14176 data
.quiet
= quiet
;
14178 if (words2_cnt
== 0)
14180 log_error ("ERROR: %s: empty file", dictfile2
);
14191 data
.dictfile
= dictfile1
;
14192 data
.dictfile2
= dictfile2
;
14194 if (words1_cnt
>= words2_cnt
)
14196 data
.combs_cnt
= words2_cnt
;
14197 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14199 dictfiles
= &data
.dictfile
;
14205 data
.combs_cnt
= words1_cnt
;
14206 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14208 dictfiles
= &data
.dictfile2
;
14212 // we also have to switch wordlist related rules!
14214 char *tmpc
= data
.rule_buf_l
;
14216 data
.rule_buf_l
= data
.rule_buf_r
;
14217 data
.rule_buf_r
= tmpc
;
14219 int tmpi
= data
.rule_len_l
;
14221 data
.rule_len_l
= data
.rule_len_r
;
14222 data
.rule_len_r
= tmpi
;
14225 else if (attack_mode
== ATTACK_MODE_BF
)
14231 if (benchmark
== 0)
14233 mask
= myargv
[optind
+ 1];
14235 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14237 if ((optind
+ 2) <= myargc
)
14239 struct stat file_stat
;
14241 if (stat (mask
, &file_stat
) == -1)
14245 masks
[maskcnt
- 1] = mystrdup (mask
);
14249 int wls_left
= myargc
- (optind
+ 1);
14251 uint masks_avail
= INCR_MASKS
;
14253 for (int i
= 0; i
< wls_left
; i
++)
14257 mask
= myargv
[optind
+ 1 + i
];
14259 if (stat (mask
, &file_stat
) == -1)
14261 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14267 uint is_file
= S_ISREG (file_stat
.st_mode
);
14273 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14275 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14280 char line_buf
[BUFSIZ
];
14282 while (!feof (mask_fp
))
14284 memset (line_buf
, 0, BUFSIZ
);
14286 int line_len
= fgetl (mask_fp
, line_buf
);
14288 if (line_len
== 0) continue;
14290 if (line_buf
[0] == '#') continue;
14292 if (masks_avail
== maskcnt
)
14294 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14296 masks_avail
+= INCR_MASKS
;
14299 masks
[maskcnt
] = mystrdup (line_buf
);
14308 log_error ("ERROR: %s: unsupported file-type", mask
);
14314 mask_from_file
= 1;
14319 custom_charset_1
= (char *) "?l?d?u";
14320 custom_charset_2
= (char *) "?l?d";
14321 custom_charset_3
= (char *) "?l?d*!$@_";
14323 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14324 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14325 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14327 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14329 wordlist_mode
= WL_MODE_MASK
;
14331 data
.wordlist_mode
= wordlist_mode
;
14341 * generate full masks and charsets
14344 masks
= (char **) mymalloc (sizeof (char *));
14348 case 1731: pw_min
= 5;
14350 mask
= mystrdup ("?b?b?b?b?b");
14352 case 12500: pw_min
= 5;
14354 mask
= mystrdup ("?b?b?b?b?b");
14356 default: pw_min
= 7;
14358 mask
= mystrdup ("?b?b?b?b?b?b?b");
14364 masks
[maskcnt
- 1] = mystrdup (mask
);
14366 wordlist_mode
= WL_MODE_MASK
;
14368 data
.wordlist_mode
= wordlist_mode
;
14373 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14377 if (increment_min
> pw_min
) pw_min
= increment_min
;
14379 if (increment_max
< pw_max
) pw_max
= increment_max
;
14382 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14384 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14388 char *mask
= myargv
[myargc
- 1];
14392 masks
= (char **) mymalloc (1 * sizeof (char *));
14396 struct stat file_stat
;
14398 if (stat (mask
, &file_stat
) == -1)
14402 masks
[maskcnt
- 1] = mystrdup (mask
);
14406 uint is_file
= S_ISREG (file_stat
.st_mode
);
14412 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14414 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14419 char line_buf
[BUFSIZ
];
14421 uint masks_avail
= 1;
14423 while (!feof (mask_fp
))
14425 memset (line_buf
, 0, BUFSIZ
);
14427 int line_len
= fgetl (mask_fp
, line_buf
);
14429 if (line_len
== 0) continue;
14431 if (line_buf
[0] == '#') continue;
14433 if (masks_avail
== maskcnt
)
14435 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14437 masks_avail
+= INCR_MASKS
;
14440 masks
[maskcnt
] = mystrdup (line_buf
);
14447 mask_from_file
= 1;
14453 masks
[maskcnt
- 1] = mystrdup (mask
);
14459 int wls_left
= myargc
- (optind
+ 2);
14461 for (int i
= 0; i
< wls_left
; i
++)
14463 char *filename
= myargv
[optind
+ 1 + i
];
14465 struct stat file_stat
;
14467 if (stat (filename
, &file_stat
) == -1)
14469 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14474 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14478 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14482 dictfiles
[dictcnt
- 1] = filename
;
14486 // do not allow --keyspace w/ a directory
14490 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14495 char **dictionary_files
= NULL
;
14497 dictionary_files
= scan_directory (filename
);
14499 if (dictionary_files
!= NULL
)
14501 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14503 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14505 char *l1_filename
= dictionary_files
[d
];
14507 struct stat l1_stat
;
14509 if (stat (l1_filename
, &l1_stat
) == -1)
14511 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14516 if (S_ISREG (l1_stat
.st_mode
))
14518 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14522 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14527 local_free (dictionary_files
);
14533 log_error ("ERROR: No usable dictionary file found.");
14542 uint mask_min
= increment_min
; // we can't reject smaller masks here
14543 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14545 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14547 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14549 if (cur_mask
== NULL
) break;
14551 masks
[maskcnt
] = cur_mask
;
14555 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14559 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14561 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14565 char *mask
= myargv
[optind
+ 1 + 0];
14569 masks
= (char **) mymalloc (1 * sizeof (char *));
14573 struct stat file_stat
;
14575 if (stat (mask
, &file_stat
) == -1)
14579 masks
[maskcnt
- 1] = mystrdup (mask
);
14583 uint is_file
= S_ISREG (file_stat
.st_mode
);
14589 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14591 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14596 char line_buf
[BUFSIZ
];
14598 uint masks_avail
= 1;
14600 while (!feof (mask_fp
))
14602 memset (line_buf
, 0, BUFSIZ
);
14604 int line_len
= fgetl (mask_fp
, line_buf
);
14606 if (line_len
== 0) continue;
14608 if (line_buf
[0] == '#') continue;
14610 if (masks_avail
== maskcnt
)
14612 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14614 masks_avail
+= INCR_MASKS
;
14617 masks
[maskcnt
] = mystrdup (line_buf
);
14624 mask_from_file
= 1;
14630 masks
[maskcnt
- 1] = mystrdup (mask
);
14636 int wls_left
= myargc
- (optind
+ 2);
14638 for (int i
= 0; i
< wls_left
; i
++)
14640 char *filename
= myargv
[optind
+ 2 + i
];
14642 struct stat file_stat
;
14644 if (stat (filename
, &file_stat
) == -1)
14646 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14651 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14655 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14659 dictfiles
[dictcnt
- 1] = filename
;
14663 // do not allow --keyspace w/ a directory
14667 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14672 char **dictionary_files
= NULL
;
14674 dictionary_files
= scan_directory (filename
);
14676 if (dictionary_files
!= NULL
)
14678 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14680 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14682 char *l1_filename
= dictionary_files
[d
];
14684 struct stat l1_stat
;
14686 if (stat (l1_filename
, &l1_stat
) == -1)
14688 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14693 if (S_ISREG (l1_stat
.st_mode
))
14695 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14699 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14704 local_free (dictionary_files
);
14710 log_error ("ERROR: No usable dictionary file found.");
14719 uint mask_min
= increment_min
; // we can't reject smaller masks here
14720 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14722 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14724 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14726 if (cur_mask
== NULL
) break;
14728 masks
[maskcnt
] = cur_mask
;
14732 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14737 data
.pw_min
= pw_min
;
14738 data
.pw_max
= pw_max
;
14744 if (weak_hash_threshold
>= salts_cnt
)
14746 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14748 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14750 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14754 // Display hack, guarantee that there is at least one \r before real start
14756 if (data
.quiet
== 0) log_info_nn ("");
14759 * status and monitor threads
14762 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14764 hc_thread_t i_thread
= 0;
14766 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14768 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14771 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14773 uint ni_threads_cnt
= 0;
14775 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14777 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14787 if (outfile_check_timer
!= 0)
14789 if (data
.outfile_check_directory
!= NULL
)
14791 if ((hash_mode
!= 5200) &&
14792 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14793 (hash_mode
!= 9000))
14795 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14801 outfile_check_timer
= 0;
14806 outfile_check_timer
= 0;
14812 * Inform the user if we got some hashes remove because of the pot file remove feature
14815 if (data
.quiet
== 0)
14817 if (potfile_remove_cracks
> 0)
14819 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14820 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14824 data
.outfile_check_timer
= outfile_check_timer
;
14830 char **induction_dictionaries
= NULL
;
14832 int induction_dictionaries_cnt
= 0;
14834 hcstat_table_t
*root_table_buf
= NULL
;
14835 hcstat_table_t
*markov_table_buf
= NULL
;
14837 uint initial_restore_done
= 0;
14839 data
.maskcnt
= maskcnt
;
14841 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14843 if (data
.devices_status
== STATUS_CRACKED
) break;
14845 data
.devices_status
= STATUS_INIT
;
14847 if (maskpos
> rd
->maskpos
)
14852 rd
->maskpos
= maskpos
;
14853 data
.maskpos
= maskpos
;
14855 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14857 char *mask
= masks
[maskpos
];
14859 if (mask_from_file
== 1)
14861 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14866 uint mask_offset
= 0;
14868 uint separator_cnt
;
14870 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14872 str_ptr
= strstr (mask
+ mask_offset
, ",");
14874 if (str_ptr
== NULL
) break;
14876 str_pos
= str_ptr
- mask
;
14878 // escaped separator, i.e. "\,"
14882 if (mask
[str_pos
- 1] == '\\')
14886 mask_offset
= str_pos
+ 1;
14892 // reset the offset
14896 mask
[str_pos
] = '\0';
14898 switch (separator_cnt
)
14901 mp_reset_usr (mp_usr
, 0);
14903 custom_charset_1
= mask
;
14904 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14908 mp_reset_usr (mp_usr
, 1);
14910 custom_charset_2
= mask
;
14911 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14915 mp_reset_usr (mp_usr
, 2);
14917 custom_charset_3
= mask
;
14918 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14922 mp_reset_usr (mp_usr
, 3);
14924 custom_charset_4
= mask
;
14925 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
14929 mask
= mask
+ str_pos
+ 1;
14933 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
14937 local_free (css_buf
);
14938 local_free (data
.root_css_buf
);
14939 local_free (data
.markov_css_buf
);
14941 local_free (masks
[maskpos
- 1]);
14944 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
14947 data
.css_cnt
= css_cnt
;
14948 data
.css_buf
= css_buf
;
14950 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
14952 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
14954 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
14956 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
14957 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
14959 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
14961 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
14963 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
14964 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
14966 data
.root_css_buf
= root_css_buf
;
14967 data
.markov_css_buf
= markov_css_buf
;
14969 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
14971 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
14973 local_free (root_table_buf
);
14974 local_free (markov_table_buf
);
14978 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
14980 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14982 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
14983 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
14984 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
14986 device_param
->kernel_params_mp_buf64
[3] = 0;
14987 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
14988 device_param
->kernel_params_mp_buf32
[5] = 0;
14989 device_param
->kernel_params_mp_buf32
[6] = 0;
14990 device_param
->kernel_params_mp_buf32
[7] = 0;
14992 if (attack_mode
== ATTACK_MODE_HYBRID1
)
14994 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
14995 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
14996 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
14997 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
14999 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15001 device_param
->kernel_params_mp_buf32
[5] = 0;
15002 device_param
->kernel_params_mp_buf32
[6] = 0;
15003 device_param
->kernel_params_mp_buf32
[7] = 0;
15006 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
15007 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
15008 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
15010 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
);
15011 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
);
15014 else if (attack_mode
== ATTACK_MODE_BF
)
15016 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
15020 for (uint i
= 0; i
< dictcnt
; i
++)
15022 local_free (dictfiles
[i
]);
15025 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
15027 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
15029 if (l1_filename
== NULL
) break;
15033 dictfiles
[dictcnt
- 1] = l1_filename
;
15040 dictfiles
[dictcnt
- 1] = mask
;
15045 log_error ("ERROR: Mask is too small");
15052 free (induction_dictionaries
);
15054 // induction_dictionaries_cnt = 0; // implied
15056 if (attack_mode
!= ATTACK_MODE_BF
)
15060 induction_dictionaries
= scan_directory (induction_directory
);
15062 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15066 if (induction_dictionaries_cnt
)
15068 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15072 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15076 if ((maskcnt
> 1) || (dictcnt
> 1))
15078 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15084 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15086 char *subid
= logfile_generate_subid ();
15088 data
.subid
= subid
;
15090 logfile_sub_msg ("START");
15092 data
.devices_status
= STATUS_INIT
;
15094 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15095 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15096 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15098 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15102 data
.cpt_start
= time (NULL
);
15104 data
.cpt_total
= 0;
15106 if (data
.restore
== 0)
15108 rd
->words_cur
= skip
;
15115 data
.ms_paused
= 0;
15117 data
.words_cur
= rd
->words_cur
;
15119 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15121 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15123 device_param
->speed_pos
= 0;
15125 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15126 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15127 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15129 device_param
->gpu_power
= device_param
->gpu_power_user
;
15130 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15132 device_param
->outerloop_pos
= 0;
15133 device_param
->outerloop_left
= 0;
15134 device_param
->innerloop_pos
= 0;
15135 device_param
->innerloop_left
= 0;
15137 // some more resets:
15139 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15141 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15143 device_param
->pw_cnt
= 0;
15144 device_param
->pws_cnt
= 0;
15146 device_param
->words_off
= 0;
15147 device_param
->words_done
= 0;
15150 data
.gpu_blocks_div
= 0;
15152 // figure out some workload
15154 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15156 if (data
.wordlist_mode
== WL_MODE_FILE
)
15158 char *dictfile
= NULL
;
15160 if (induction_dictionaries_cnt
)
15162 dictfile
= induction_dictionaries
[0];
15166 dictfile
= dictfiles
[dictpos
];
15169 data
.dictfile
= dictfile
;
15171 logfile_sub_string (dictfile
);
15173 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15175 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15178 FILE *fd2
= fopen (dictfile
, "rb");
15182 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15187 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15191 if (data
.words_cnt
== 0)
15193 if (data
.devices_status
== STATUS_CRACKED
) break;
15194 if (data
.devices_status
== STATUS_ABORTED
) break;
15202 else if (attack_mode
== ATTACK_MODE_COMBI
)
15204 char *dictfile
= data
.dictfile
;
15205 char *dictfile2
= data
.dictfile2
;
15207 logfile_sub_string (dictfile
);
15208 logfile_sub_string (dictfile2
);
15210 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15212 FILE *fd2
= fopen (dictfile
, "rb");
15216 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15221 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15225 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15227 FILE *fd2
= fopen (dictfile2
, "rb");
15231 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15236 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15241 if (data
.words_cnt
== 0)
15243 if (data
.devices_status
== STATUS_CRACKED
) break;
15244 if (data
.devices_status
== STATUS_ABORTED
) break;
15251 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15253 char *dictfile
= NULL
;
15255 if (induction_dictionaries_cnt
)
15257 dictfile
= induction_dictionaries
[0];
15261 dictfile
= dictfiles
[dictpos
];
15264 data
.dictfile
= dictfile
;
15266 char *mask
= data
.mask
;
15268 logfile_sub_string (dictfile
);
15269 logfile_sub_string (mask
);
15271 FILE *fd2
= fopen (dictfile
, "rb");
15275 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15280 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15284 if (data
.words_cnt
== 0)
15286 if (data
.devices_status
== STATUS_CRACKED
) break;
15287 if (data
.devices_status
== STATUS_ABORTED
) break;
15294 else if (attack_mode
== ATTACK_MODE_BF
)
15296 local_free (css_buf
);
15297 local_free (data
.root_css_buf
);
15298 local_free (data
.markov_css_buf
);
15300 char *mask
= dictfiles
[dictpos
];
15302 logfile_sub_string (mask
);
15306 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15308 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15310 uint css_cnt_unicode
= css_cnt
* 2;
15312 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15314 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15316 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15318 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15319 css_buf_unicode
[j
+ 1].cs_len
= 1;
15324 css_buf
= css_buf_unicode
;
15325 css_cnt
= css_cnt_unicode
;
15328 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15330 uint mask_min
= pw_min
;
15331 uint mask_max
= pw_max
;
15333 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15339 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15341 if (css_cnt
< mask_min
)
15343 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15346 if (css_cnt
> mask_max
)
15348 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15351 // skip to next mask
15355 rd
->dictpos
= dictpos
;
15357 logfile_sub_msg ("STOP");
15362 uint save_css_cnt
= css_cnt
;
15364 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15366 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15368 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15369 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15371 uint css_cnt_salt
= css_cnt
+ salt_len
;
15373 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15375 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15377 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15379 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15380 css_buf_salt
[j
].cs_len
= 1;
15385 css_buf
= css_buf_salt
;
15386 css_cnt
= css_cnt_salt
;
15391 data
.css_cnt
= css_cnt
;
15392 data
.css_buf
= css_buf
;
15394 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15396 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15398 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15400 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15402 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15403 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15405 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15407 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15409 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15410 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15412 data
.root_css_buf
= root_css_buf
;
15413 data
.markov_css_buf
= markov_css_buf
;
15415 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15417 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15419 local_free (root_table_buf
);
15420 local_free (markov_table_buf
);
15424 uint css_cnt_l
= css_cnt
;
15427 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15429 if (save_css_cnt
< 6)
15433 else if (save_css_cnt
== 6)
15439 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15441 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15452 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15467 /* unfinished code?
15468 int sum = css_buf[css_cnt_r - 1].cs_len;
15470 for (uint i = 1; i < 4 && i < css_cnt; i++)
15472 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15476 sum *= css_buf[css_cnt_r - 1].cs_len;
15481 css_cnt_l
-= css_cnt_r
;
15483 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15485 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15487 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15489 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15490 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15491 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15493 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15494 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15495 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15496 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15497 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15498 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15500 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15501 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15502 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15503 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15505 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15506 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15507 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15509 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15510 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15511 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15512 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15513 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15515 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
]);
15516 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
]);
15517 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
]);
15519 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
]);
15520 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
]);
15521 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
]);
15523 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
);
15524 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
);
15528 uint64_t words_base
= data
.words_cnt
;
15530 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15532 if (data
.gpu_rules_cnt
)
15534 words_base
/= data
.gpu_rules_cnt
;
15537 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15539 if (data
.combs_cnt
)
15541 words_base
/= data
.combs_cnt
;
15544 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15548 words_base
/= data
.bfs_cnt
;
15552 data
.words_base
= words_base
;
15556 log_info ("%llu", (unsigned long long int) words_base
);
15561 if (data
.words_cur
> data
.words_base
)
15563 log_error ("ERROR: restore value greater keyspace");
15568 if (data
.words_cur
)
15570 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15572 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15574 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15577 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15579 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15581 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15584 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15586 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15588 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15594 * Inform user about possible slow speeds
15597 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15599 if (data
.words_base
< gpu_blocks_all
)
15604 log_info ("ATTENTION!");
15605 log_info (" The wordlist or mask you are using is too small.");
15606 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15607 log_info (" The cracking speed will drop.");
15608 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15615 * Update loopback file
15624 uint random_num
= get_random_num (0, 9999);
15626 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15628 data
.loopback_file
= loopback_file
;
15632 * Update dictionary statistic
15637 dictstat_fp
= fopen (dictstat
, "wb");
15641 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15643 fclose (dictstat_fp
);
15647 data
.devices_status
= STATUS_RUNNING
;
15649 if (initial_restore_done
== 0)
15651 if (data
.restore_disable
== 0) cycle_restore ();
15653 initial_restore_done
= 1;
15656 hc_timer_set (&data
.timer_running
);
15658 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15660 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15662 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15663 if (quiet
== 0) fflush (stdout
);
15666 else if (wordlist_mode
== WL_MODE_STDIN
)
15668 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15669 if (data
.quiet
== 0) log_info ("");
15672 time_t runtime_start
;
15674 time (&runtime_start
);
15676 data
.runtime_start
= runtime_start
;
15679 * create cracker threads
15682 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15684 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15686 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15688 device_param
->device_id
= device_id
;
15690 if (wordlist_mode
== WL_MODE_STDIN
)
15692 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15696 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15700 // wait for crack threads to exit
15702 hc_thread_wait (devices_cnt
, c_threads
);
15704 local_free (c_threads
);
15710 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15712 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15714 if (data
.devices_status
== STATUS_CRACKED
) break;
15715 if (data
.devices_status
== STATUS_ABORTED
) break;
15717 if (data
.devices_status
== STATUS_BYPASS
)
15719 data
.devices_status
= STATUS_RUNNING
;
15722 if (induction_dictionaries_cnt
)
15724 unlink (induction_dictionaries
[0]);
15727 free (induction_dictionaries
);
15729 if (attack_mode
!= ATTACK_MODE_BF
)
15731 induction_dictionaries
= scan_directory (induction_directory
);
15733 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15736 if (benchmark
== 0)
15738 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15740 if (quiet
== 0) clear_prompt ();
15742 if (quiet
== 0) log_info ("");
15750 if (quiet
== 0) status_display ();
15753 if (quiet
== 0) log_info ("");
15757 if (attack_mode
== ATTACK_MODE_BF
)
15761 rd
->dictpos
= dictpos
;
15765 if (induction_dictionaries_cnt
)
15767 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15773 rd
->dictpos
= dictpos
;
15777 time_t runtime_stop
;
15779 time (&runtime_stop
);
15781 data
.runtime_stop
= runtime_stop
;
15783 logfile_sub_uint (runtime_start
);
15784 logfile_sub_uint (runtime_stop
);
15786 logfile_sub_msg ("STOP");
15788 global_free (subid
);
15791 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15793 if (data
.devices_status
== STATUS_CRACKED
) break;
15794 if (data
.devices_status
== STATUS_ABORTED
) break;
15795 if (data
.devices_status
== STATUS_QUIT
) break;
15797 if (data
.devices_status
== STATUS_BYPASS
)
15799 data
.devices_status
= STATUS_RUNNING
;
15803 // 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
15805 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15807 if (data
.wordlist_mode
== WL_MODE_FILE
)
15809 if (data
.dictfile
== NULL
)
15811 if (dictfiles
!= NULL
)
15813 data
.dictfile
= dictfiles
[0];
15815 hc_timer_set (&data
.timer_running
);
15820 // NOTE: combi is okay because it is already set beforehand
15821 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15823 if (data
.dictfile
== NULL
)
15825 if (dictfiles
!= NULL
)
15827 hc_timer_set (&data
.timer_running
);
15829 data
.dictfile
= dictfiles
[0];
15833 else if (attack_mode
== ATTACK_MODE_BF
)
15835 if (data
.mask
== NULL
)
15837 hc_timer_set (&data
.timer_running
);
15839 data
.mask
= masks
[0];
15843 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15845 data
.devices_status
= STATUS_EXHAUSTED
;
15848 // if cracked / aborted remove last induction dictionary
15850 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15852 struct stat induct_stat
;
15854 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15856 unlink (induction_dictionaries
[file_pos
]);
15860 // wait for non-interactive threads
15862 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15864 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15867 local_free (ni_threads
);
15869 // wait for interactive threads
15871 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15873 hc_thread_wait (1, &i_thread
);
15876 // we dont need restore file anymore
15877 if (data
.restore_disable
== 0)
15879 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15881 unlink (eff_restore_file
);
15882 unlink (new_restore_file
);
15890 // finally save left hashes
15892 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15901 if (benchmark
== 1)
15903 status_benchmark ();
15909 if (quiet
== 0) clear_prompt ();
15911 if (quiet
== 0) log_info ("");
15919 if (quiet
== 0) status_display ();
15922 if (quiet
== 0) log_info ("");
15925 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15927 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15929 local_free (device_param
->result
);
15931 local_free (device_param
->pw_caches
);
15933 local_free (device_param
->combs_buf
);
15935 local_free (device_param
->hooks_buf
);
15937 local_free (device_param
->device_name
);
15939 local_free (device_param
->device_version
);
15941 local_free (device_param
->driver_version
);
15943 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
15944 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
15945 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
15946 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
15947 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
15948 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
15949 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
15950 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
15951 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
15952 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
15953 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
15954 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
15955 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
15956 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
15957 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
15958 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
15959 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
15960 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
15961 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
15962 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
15963 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
15964 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
15965 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
15966 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
15967 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
15968 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
15969 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
15970 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
15972 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
15973 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
15974 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
15975 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
15976 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
15977 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
15978 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
15979 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
15981 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
15982 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
15983 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
15984 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
15987 // reset default fan speed
15989 if (gpu_temp_disable
== 0)
15991 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
15993 hc_thread_mutex_lock (mux_adl
);
15995 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
15997 if (data
.hm_device
[i
].fan_supported
== 1)
15999 int fanspeed
= temp_retain_fanspeed_value
[i
];
16001 if (fanspeed
== -1) continue;
16003 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
16005 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
16009 hc_thread_mutex_unlock (mux_adl
);
16013 // reset power tuning
16015 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
16017 hc_thread_mutex_lock (mux_adl
);
16019 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16021 if (data
.hm_device
[i
].od_version
== 6)
16023 // check powertune capabilities first, if not available then skip device
16025 int powertune_supported
= 0;
16027 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
16029 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
16034 if (powertune_supported
!= 0)
16036 // powercontrol settings
16038 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
16040 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16047 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
16049 performance_state
->iNumberOfPerformanceLevels
= 2;
16051 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
16052 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
16053 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
16054 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
16056 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
16058 log_info ("ERROR: Failed to restore ADL performance state");
16063 local_free (performance_state
);
16068 hc_thread_mutex_unlock (mux_adl
);
16071 if (gpu_temp_disable
== 0)
16073 if (vendor_id
== VENDOR_ID_NV
)
16076 hc_NVML_nvmlShutdown (data
.hm_dll
);
16084 if (vendor_id
== VENDOR_ID_AMD
)
16086 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
16088 hm_close (data
.hm_dll
);
16092 if (vendor_id
== VENDOR_ID_NV
)
16094 hm_close (data
.hm_dll
);
16101 local_free (masks
);
16103 local_free (dictstat_base
);
16105 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16107 pot_t
*pot_ptr
= &pot
[pot_pos
];
16109 hash_t
*hash
= &pot_ptr
->hash
;
16111 local_free (hash
->digest
);
16115 local_free (hash
->salt
);
16121 local_free (all_gpu_rules_cnt
);
16122 local_free (all_gpu_rules_buf
);
16124 local_free (wl_data
->buf
);
16125 local_free (wl_data
);
16127 local_free (bitmap_s1_a
);
16128 local_free (bitmap_s1_b
);
16129 local_free (bitmap_s1_c
);
16130 local_free (bitmap_s1_d
);
16131 local_free (bitmap_s2_a
);
16132 local_free (bitmap_s2_b
);
16133 local_free (bitmap_s2_c
);
16134 local_free (bitmap_s2_d
);
16136 local_free (temp_retain_fanspeed_value
);
16137 local_free (od_clock_mem_status
);
16138 local_free (od_power_control_status
);
16140 global_free (devices_param
);
16142 global_free (gpu_rules_buf
);
16144 global_free (root_css_buf
);
16145 global_free (markov_css_buf
);
16147 global_free (digests_buf
);
16148 global_free (digests_shown
);
16149 global_free (digests_shown_tmp
);
16151 global_free (salts_buf
);
16152 global_free (salts_shown
);
16154 global_free (esalts_buf
);
16156 global_free (words_progress_done
);
16157 global_free (words_progress_rejected
);
16158 global_free (words_progress_restored
);
16160 if (pot_fp
) fclose (pot_fp
);
16162 if (data
.devices_status
== STATUS_QUIT
) break;
16165 // destroy others mutex
16167 hc_thread_mutex_delete (mux_dispatcher
);
16168 hc_thread_mutex_delete (mux_counter
);
16169 hc_thread_mutex_delete (mux_display
);
16170 hc_thread_mutex_delete (mux_adl
);
16174 local_free (eff_restore_file
);
16175 local_free (new_restore_file
);
16181 local_free (loopback_file
);
16183 if (loopback
== 1) unlink (loopback_file
);
16185 // induction directory
16187 if (induction_dir
== NULL
)
16189 if (attack_mode
!= ATTACK_MODE_BF
)
16191 if (rmdir (induction_directory
) == -1)
16193 if (errno
== ENOENT
)
16195 // good, we can ignore
16197 else if (errno
== ENOTEMPTY
)
16199 // good, we can ignore
16203 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16209 local_free (induction_directory
);
16213 // outfile-check directory
16215 if (outfile_check_dir
== NULL
)
16217 if (rmdir (outfile_check_directory
) == -1)
16219 if (errno
== ENOENT
)
16221 // good, we can ignore
16223 else if (errno
== ENOTEMPTY
)
16225 // good, we can ignore
16229 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16235 local_free (outfile_check_directory
);
16242 logfile_top_uint (proc_start
);
16243 logfile_top_uint (proc_stop
);
16245 logfile_top_msg ("STOP");
16247 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16248 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16250 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16251 if (data
.devices_status
== STATUS_QUIT
) return 2;
16252 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16253 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16254 if (data
.devices_status
== STATUS_CRACKED
) return 0;