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 // not supported with Nvidia
2461 // hc_clEnqueueFillBuffer (device_param->command_queue, buf, &zero, sizeof (cl_uchar), 0, size, 0, NULL, NULL);
2463 char *tmp
= (char *) mymalloc (size
);
2465 memset (tmp
, 0, size
);
2467 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, 0, size
, tmp
, 0, NULL
, NULL
);
2472 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2478 else if (rule_len
== 1)
2480 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2486 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2488 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2490 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
);
2492 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2494 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, 0, pws_cnt
* sizeof (pw_t
), device_param
->pws_buf
, 0, NULL
, NULL
);
2496 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2498 const uint64_t off
= device_param
->words_off
;
2500 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2502 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2506 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2508 const uint gpu_loops
= data
.gpu_loops
;
2512 uint speed_pos
= device_param
->speed_pos
;
2515 if (device_param
->timer_speed
.tv_sec
== 0)
2517 hc_timer_set (&device_param
->timer_speed
);
2522 if (device_param
->timer_speed
.QuadPart
== 0)
2524 hc_timer_set (&device_param
->timer_speed
);
2528 // find higest password length, this is for optimization stuff
2530 uint highest_pw_len
= 0;
2532 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2535 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2538 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2540 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2541 + device_param
->kernel_params_mp_l_buf32
[5];
2544 // bitslice optimization stuff
2546 if (data
.attack_mode
== ATTACK_MODE_BF
)
2548 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2550 run_kernel_tb (device_param
, pws_cnt
);
2556 uint innerloop_step
= 0;
2557 uint innerloop_cnt
= 0;
2559 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2560 else innerloop_step
= 1;
2562 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2563 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2564 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2566 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2568 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2570 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2572 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2574 if (data
.devices_status
== STATUS_CRACKED
) break;
2575 if (data
.devices_status
== STATUS_ABORTED
) break;
2576 if (data
.devices_status
== STATUS_QUIT
) break;
2577 if (data
.devices_status
== STATUS_BYPASS
) break;
2579 if (data
.salts_shown
[salt_pos
] == 1) continue;
2581 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2583 device_param
->kernel_params_buf32
[24] = salt_pos
;
2584 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2585 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2587 FILE *combs_fp
= device_param
->combs_fp
;
2589 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2596 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2598 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2600 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2602 if (data
.devices_status
== STATUS_CRACKED
) break;
2603 if (data
.devices_status
== STATUS_ABORTED
) break;
2604 if (data
.devices_status
== STATUS_QUIT
) break;
2605 if (data
.devices_status
== STATUS_BYPASS
) break;
2607 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2609 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2611 device_param
->innerloop_pos
= innerloop_pos
;
2612 device_param
->innerloop_left
= innerloop_left
;
2614 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2616 if (innerloop_left
== 0) continue;
2618 // initialize amplifiers
2620 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2622 char line_buf
[BUFSIZ
];
2626 while (i
< innerloop_left
)
2628 if (feof (combs_fp
)) break;
2630 int line_len
= fgetl (combs_fp
, line_buf
);
2632 if (line_len
>= PW_MAX1
) continue;
2634 line_len
= convert_from_hex (line_buf
, line_len
);
2636 char *line_buf_new
= line_buf
;
2638 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2640 char rule_buf_out
[BLOCK_SIZE
];
2642 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2644 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2646 if (rule_len_out
< 0)
2648 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2653 line_len
= rule_len_out
;
2655 line_buf_new
= rule_buf_out
;
2658 line_len
= MIN (line_len
, PW_DICTMAX
);
2660 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2662 memcpy (ptr
, line_buf_new
, line_len
);
2664 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2666 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2668 uppercase (ptr
, line_len
);
2671 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2673 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2675 ptr
[line_len
] = 0x80;
2678 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2680 ptr
[line_len
] = 0x01;
2684 device_param
->combs_buf
[i
].pw_len
= line_len
;
2689 for (uint j
= i
; j
< innerloop_left
; j
++)
2691 device_param
->combs_buf
[j
].i
[0] = 0;
2692 device_param
->combs_buf
[j
].i
[1] = 0;
2693 device_param
->combs_buf
[j
].i
[2] = 0;
2694 device_param
->combs_buf
[j
].i
[3] = 0;
2695 device_param
->combs_buf
[j
].i
[4] = 0;
2696 device_param
->combs_buf
[j
].i
[5] = 0;
2697 device_param
->combs_buf
[j
].i
[6] = 0;
2698 device_param
->combs_buf
[j
].i
[7] = 0;
2700 device_param
->combs_buf
[j
].pw_len
= 0;
2705 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2707 uint64_t off
= innerloop_pos
;
2709 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2711 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2713 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2715 uint64_t off
= innerloop_pos
;
2717 device_param
->kernel_params_mp_buf64
[3] = off
;
2719 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2721 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2723 uint64_t off
= innerloop_pos
;
2725 device_param
->kernel_params_mp_buf64
[3] = off
;
2727 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2732 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2734 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
);
2736 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2738 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
);
2740 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2742 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
);
2744 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2746 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
);
2748 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2750 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_combs
, device_param
->d_combs_c
, 0, 0, innerloop_left
* sizeof (comb_t
), 0, NULL
, NULL
);
2753 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2755 if (data
.attack_mode
== ATTACK_MODE_BF
)
2757 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2759 const uint size_tm
= 32 * sizeof (bs_word_t
);
2761 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2763 run_kernel_tm (device_param
);
2765 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2769 if (highest_pw_len
< 16)
2771 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2773 else if (highest_pw_len
< 32)
2775 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2779 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2784 run_kernel_amp (device_param
, pws_cnt
);
2786 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2788 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2790 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2793 uint iter
= salt_buf
->salt_iter
;
2795 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2797 uint loop_left
= iter
- loop_pos
;
2799 loop_left
= MIN (loop_left
, gpu_loops
);
2801 device_param
->kernel_params_buf32
[25] = loop_pos
;
2802 device_param
->kernel_params_buf32
[26] = loop_left
;
2804 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2806 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2808 if (data
.devices_status
== STATUS_CRACKED
) break;
2809 if (data
.devices_status
== STATUS_ABORTED
) break;
2810 if (data
.devices_status
== STATUS_QUIT
) break;
2813 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2815 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2817 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2819 // do something with data
2821 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2824 run_kernel (KERN_RUN_3
, 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;
2837 hc_thread_mutex_lock (mux_display
);
2839 check_cracked (device_param
, salt_pos
);
2841 hc_thread_mutex_unlock (mux_display
);
2847 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2849 hc_thread_mutex_lock (mux_counter
);
2851 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2853 hc_thread_mutex_unlock (mux_counter
);
2861 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2863 hc_timer_set (&device_param
->timer_speed
);
2865 hc_thread_mutex_lock (mux_display
);
2867 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2869 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2871 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2873 hc_thread_mutex_unlock (mux_display
);
2877 if (speed_pos
== SPEED_CACHE
)
2884 device_param
->speed_pos
= speed_pos
;
2887 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2889 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2893 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2895 wl_data
->buf
[wl_data
->cnt
] = 0;
2897 if (wl_data
->cnt
== 0) return;
2899 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2903 if (wl_data
->cnt
== wl_data
->avail
)
2905 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2907 wl_data
->avail
+= wl_data
->incr
;
2910 const int c
= fgetc (fd
);
2912 if (c
== EOF
) break;
2914 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2918 if (c
== '\n') break;
2921 // ensure stream ends with a newline
2923 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2927 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
2933 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2937 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2939 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2949 if (*ptr
!= '\n') continue;
2953 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2964 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2968 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2970 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
2972 if (*ptr
!= '\n') continue;
2976 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
2987 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
2991 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
2993 if (*ptr
!= '\n') continue;
2997 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3008 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3010 while (wl_data
->pos
< wl_data
->cnt
)
3015 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3017 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3019 wl_data
->pos
+= off
;
3021 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3023 char rule_buf_out
[BLOCK_SIZE
];
3025 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3027 int rule_len_out
= -1;
3029 if (len
< BLOCK_SIZE
)
3031 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3034 if (rule_len_out
< 0)
3039 if (rule_len_out
> PW_MAX
)
3060 fprintf (stderr
, "bug!!\n");
3065 load_segment (wl_data
, fd
);
3067 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3071 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3075 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3085 fstat (fileno (fd
), &d
.stat
);
3089 _fstat64 (fileno (fd
), &d
.stat
);
3093 d
.stat
.st_nlink
= 0;
3097 d
.stat
.st_atime
= 0;
3100 d
.stat
.st_blksize
= 0;
3101 d
.stat
.st_blocks
= 0;
3104 if (d
.stat
.st_size
== 0) return 0;
3106 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3108 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3112 uint64_t cnt
= d_cache
->cnt
;
3114 uint64_t keyspace
= cnt
;
3116 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3118 keyspace
*= data
.gpu_rules_cnt
;
3120 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3122 keyspace
*= data
.combs_cnt
;
3125 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
);
3126 if (data
.quiet
== 0) log_info ("");
3128 hc_signal (sigHandler_default
);
3143 load_segment (wl_data
, fd
);
3145 comp
+= wl_data
->cnt
;
3149 while (i
< wl_data
->cnt
)
3154 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3156 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3158 char rule_buf_out
[BLOCK_SIZE
];
3160 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3162 int rule_len_out
= -1;
3164 if (len
< BLOCK_SIZE
)
3166 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3169 if (rule_len_out
< 0)
3181 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3183 cnt
+= data
.gpu_rules_cnt
;
3185 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3187 cnt
+= data
.combs_cnt
;
3200 if ((now
- prev
) == 0) continue;
3202 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3204 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
);
3209 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
);
3210 if (data
.quiet
== 0) log_info ("");
3212 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3214 hc_signal (sigHandler_default
);
3219 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3221 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3224 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3226 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3228 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3230 uint cache_cnt
= pw_cache
->cnt
;
3232 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3234 memcpy (pw_hc1
, pw_buf
, pw_len
);
3236 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3238 uint pws_cnt
= device_param
->pws_cnt
;
3242 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3244 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3246 pw
->pw_len
= pw_len
;
3250 device_param
->pws_cnt
= pws_cnt
;
3251 device_param
->pw_cnt
= pws_cnt
* 1;
3255 pw_cache
->cnt
= cache_cnt
;
3260 static void *thread_monitor (void *p
)
3262 uint runtime_check
= 0;
3263 uint remove_check
= 0;
3264 uint status_check
= 0;
3265 uint hwmon_check
= 0;
3266 uint restore_check
= 0;
3268 uint restore_left
= data
.restore_timer
;
3269 uint remove_left
= data
.remove_timer
;
3270 uint status_left
= data
.status_timer
;
3272 // these variables are mainly used for fan control (AMD only)
3274 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3276 // temperature controller "loopback" values
3278 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3279 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3281 int temp_threshold
= 1; // degrees celcius
3283 int fan_speed_min
= 15; // in percentage
3284 int fan_speed_max
= 100;
3286 time_t last_temp_check_time
;
3288 uint sleep_time
= 1;
3295 if (data
.restore_timer
)
3300 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3305 if (data
.status
== 1)
3310 if (data
.gpu_temp_disable
== 0)
3312 time (&last_temp_check_time
);
3317 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3322 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3324 hc_sleep (sleep_time
);
3326 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3328 if (hwmon_check
== 1)
3330 hc_thread_mutex_lock (mux_adl
);
3332 time_t temp_check_time
;
3334 time (&temp_check_time
);
3336 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3338 if (Ta
== 0) Ta
= 1;
3340 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
3342 const int temperature
= hm_get_temperature_with_device_id (i
);
3344 if (temperature
> (int) data
.gpu_temp_abort
)
3346 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i
+ 1);
3348 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3353 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3355 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3357 if (data
.hm_device
[i
].fan_supported
== 1)
3359 int temp_cur
= temperature
;
3361 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3363 temp_diff_sum
[i
] = temp_diff_sum
[i
] + temp_diff_new
;
3365 // calculate Ta value (time difference in seconds between the last check and this check)
3367 last_temp_check_time
= temp_check_time
;
3373 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3375 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
);
3377 if (abs (fan_diff_required
) >= temp_threshold
)
3379 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (i
);
3381 int fan_speed_level
= fan_speed_cur
;
3383 if (fan_speed_chgd
[i
] == 0) fan_speed_level
= temp_cur
;
3385 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3387 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3388 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3390 if (fan_speed_new
!= fan_speed_cur
)
3392 int freely_change_fan_speed
= (fan_speed_chgd
[i
] == 1);
3393 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3395 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3397 hm_set_fanspeed_with_device_id_amd (i
, fan_speed_new
);
3399 fan_speed_chgd
[i
] = 1;
3402 temp_diff_old
[i
] = temp_diff_new
;
3409 hc_thread_mutex_unlock (mux_adl
);
3412 if (restore_check
== 1)
3416 if (restore_left
== 0)
3418 if (data
.restore_disable
== 0) cycle_restore ();
3420 restore_left
= data
.restore_timer
;
3424 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3428 time (&runtime_cur
);
3430 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3432 if (runtime_left
<= 0)
3434 if (data
.benchmark
== 0)
3436 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3439 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3443 if (remove_check
== 1)
3447 if (remove_left
== 0)
3449 if (data
.digests_saved
!= data
.digests_done
)
3451 data
.digests_saved
= data
.digests_done
;
3456 remove_left
= data
.remove_timer
;
3460 if (status_check
== 1)
3464 if (status_left
== 0)
3466 hc_thread_mutex_lock (mux_display
);
3468 if (data
.quiet
== 0) clear_prompt ();
3470 if (data
.quiet
== 0) log_info ("");
3474 if (data
.quiet
== 0) log_info ("");
3476 hc_thread_mutex_unlock (mux_display
);
3478 status_left
= data
.status_timer
;
3483 myfree (fan_speed_chgd
);
3485 myfree (temp_diff_old
);
3486 myfree (temp_diff_sum
);
3493 static void *thread_outfile_remove (void *p
)
3495 // some hash-dependent constants
3496 char *outfile_dir
= data
.outfile_check_directory
;
3497 uint dgst_size
= data
.dgst_size
;
3498 uint isSalted
= data
.isSalted
;
3499 uint esalt_size
= data
.esalt_size
;
3500 uint hash_mode
= data
.hash_mode
;
3502 uint outfile_check_timer
= data
.outfile_check_timer
;
3504 char separator
= data
.separator
;
3506 // some hash-dependent functions
3507 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3508 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3513 memset (&hash_buf
, 0, sizeof (hash_buf
));
3515 hash_buf
.digest
= mymalloc (dgst_size
);
3517 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3519 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3521 uint digest_buf
[64];
3523 outfile_data_t
*out_info
= NULL
;
3525 char **out_files
= NULL
;
3527 time_t folder_mtime
= 0;
3531 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3533 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3537 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3541 if (check_left
== 0)
3543 struct stat outfile_check_stat
;
3545 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3547 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3551 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3553 char **out_files_new
= scan_directory (outfile_dir
);
3555 int out_cnt_new
= count_dictionaries (out_files_new
);
3557 outfile_data_t
*out_info_new
= NULL
;
3559 if (out_cnt_new
> 0)
3561 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3563 for (int i
= 0; i
< out_cnt_new
; i
++)
3565 out_info_new
[i
].file_name
= out_files_new
[i
];
3567 // check if there are files that we have seen/checked before (and not changed)
3569 for (int j
= 0; j
< out_cnt
; j
++)
3571 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3573 struct stat outfile_stat
;
3575 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3577 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3579 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3580 out_info_new
[i
].seek
= out_info
[j
].seek
;
3588 local_free (out_info
);
3589 local_free (out_files
);
3591 out_files
= out_files_new
;
3592 out_cnt
= out_cnt_new
;
3593 out_info
= out_info_new
;
3595 folder_mtime
= outfile_check_stat
.st_mtime
;
3598 for (int j
= 0; j
< out_cnt
; j
++)
3600 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3604 //hc_thread_mutex_lock (mux_display);
3607 struct stat outfile_stat
;
3609 fstat (fileno (fp
), &outfile_stat
);
3613 struct stat64 outfile_stat
;
3615 _fstat64 (fileno (fp
), &outfile_stat
);
3618 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3620 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3621 out_info
[j
].seek
= 0;
3624 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3628 char line_buf
[BUFSIZ
];
3630 memset (line_buf
, 0, BUFSIZ
);
3632 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3634 if (ptr
== NULL
) break;
3636 int line_len
= strlen (line_buf
);
3638 if (line_len
<= 0) continue;
3640 int iter
= MAX_CUT_TRIES
;
3642 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3644 if (line_buf
[i
] != separator
) continue;
3646 int parser_status
= PARSER_OK
;
3648 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3650 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3655 if (parser_status
== PARSER_OK
)
3657 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3659 if (data
.salts_shown
[salt_pos
] == 1) continue;
3661 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3663 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3665 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3667 if (data
.digests_shown
[idx
] == 1) continue;
3671 if (hash_mode
== 6800)
3673 if (i
== salt_buf
->salt_len
)
3675 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3678 else if (hash_mode
== 2500)
3680 // BSSID : MAC1 : MAC2 (:plain)
3681 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3683 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3685 if (!cracked
) continue;
3687 // now compare MAC1 and MAC2 too, since we have this additional info
3688 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3689 char *mac2_pos
= mac1_pos
+ 12 + 1;
3691 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3692 wpa_t
*wpa
= &wpas
[salt_pos
];
3696 char *pke_ptr
= (char *) pke
;
3698 for (uint i
= 0; i
< 25; i
++)
3700 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3703 unsigned char mac1
[6];
3704 unsigned char mac2
[6];
3706 memcpy (mac1
, pke_ptr
+ 23, 6);
3707 memcpy (mac2
, pke_ptr
+ 29, 6);
3709 // compare hex string(s) vs binary MAC address(es)
3711 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3713 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3721 if (!cracked
) continue;
3723 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3725 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3735 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3737 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3739 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3746 data
.digests_shown
[idx
] = 1;
3748 data
.digests_done
++;
3750 salt_buf
->digests_done
++;
3752 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3754 data
.salts_shown
[salt_pos
] = 1;
3758 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3763 if (data
.devices_status
== STATUS_CRACKED
) break;
3769 if (data
.devices_status
== STATUS_CRACKED
) break;
3774 if (data
.devices_status
== STATUS_CRACKED
) break;
3777 out_info
[j
].seek
= ftell (fp
);
3779 //hc_thread_mutex_unlock (mux_display);
3787 check_left
= outfile_check_timer
;
3791 if (esalt_size
) local_free (hash_buf
.esalt
);
3793 if (isSalted
) local_free (hash_buf
.salt
);
3795 local_free (hash_buf
.digest
);
3797 local_free (out_info
);
3799 local_free (out_files
);
3806 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3808 hc_thread_mutex_lock (mux_dispatcher
);
3810 const uint64_t words_cur
= data
.words_cur
;
3811 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3813 device_param
->words_off
= words_cur
;
3815 const uint64_t words_left
= words_base
- words_cur
;
3817 if (data
.gpu_blocks_all
> words_left
)
3819 if (data
.gpu_blocks_div
== 0)
3821 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3825 if (data
.gpu_blocks_div
)
3827 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3829 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3830 const uint32_t gpu_power_new
= gpu_blocks_new
;
3832 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3834 device_param
->gpu_blocks
= gpu_blocks_new
;
3835 device_param
->gpu_power
= gpu_power_new
;
3840 const uint gpu_blocks
= device_param
->gpu_blocks
;
3842 uint work
= MIN (words_left
, gpu_blocks
);
3844 work
= MIN (work
, max
);
3846 data
.words_cur
+= work
;
3848 hc_thread_mutex_unlock (mux_dispatcher
);
3853 static void *thread_calc_stdin (void *p
)
3855 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3857 const uint attack_kern
= data
.attack_kern
;
3859 const uint gpu_blocks
= device_param
->gpu_blocks
;
3861 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3863 hc_thread_mutex_lock (mux_dispatcher
);
3865 if (feof (stdin
) != 0)
3867 hc_thread_mutex_unlock (mux_dispatcher
);
3874 while (words_cur
< gpu_blocks
)
3878 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3880 if (line_buf
== NULL
) break;
3882 uint line_len
= in_superchop (line_buf
);
3884 line_len
= convert_from_hex (line_buf
, line_len
);
3886 // post-process rule engine
3888 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3890 char rule_buf_out
[BLOCK_SIZE
];
3892 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3894 int rule_len_out
= -1;
3896 if (line_len
< BLOCK_SIZE
)
3898 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3901 if (rule_len_out
< 0) continue;
3903 line_buf
= rule_buf_out
;
3904 line_len
= rule_len_out
;
3907 if (line_len
> PW_MAX
)
3912 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3914 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3916 hc_thread_mutex_lock (mux_counter
);
3918 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3920 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3923 hc_thread_mutex_unlock (mux_counter
);
3928 else if (attack_kern
== ATTACK_KERN_COMBI
)
3930 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
3931 // since we still need to combine the plains
3933 if (line_len
> data
.pw_max
)
3935 hc_thread_mutex_lock (mux_counter
);
3937 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3939 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
3942 hc_thread_mutex_unlock (mux_counter
);
3948 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
3952 if (data
.devices_status
== STATUS_CRACKED
) break;
3953 if (data
.devices_status
== STATUS_ABORTED
) break;
3954 if (data
.devices_status
== STATUS_QUIT
) break;
3955 if (data
.devices_status
== STATUS_BYPASS
) break;
3958 hc_thread_mutex_unlock (mux_dispatcher
);
3960 if (data
.devices_status
== STATUS_CRACKED
) break;
3961 if (data
.devices_status
== STATUS_ABORTED
) break;
3962 if (data
.devices_status
== STATUS_QUIT
) break;
3963 if (data
.devices_status
== STATUS_BYPASS
) break;
3965 // we need 2 flushing because we have two independant caches and it can occur
3966 // that one buffer is already at threshold plus for that length also exists
3967 // more data in the 2nd buffer so it would overflow
3972 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
3974 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
3976 const uint pw_cache_cnt
= pw_cache
->cnt
;
3978 if (pw_cache_cnt
== 0) continue;
3982 uint pws_cnt
= device_param
->pws_cnt
;
3984 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3986 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3988 pw
->pw_len
= pw_len
;
3990 uint pw_cnt
= device_param
->pw_cnt
;
3992 pw_cnt
+= pw_cache_cnt
;
3994 device_param
->pw_cnt
= pw_cnt
;
3998 device_param
->pws_cnt
= pws_cnt
;
4000 if (pws_cnt
== device_param
->gpu_power_user
) break;
4003 const uint pw_cnt
= device_param
->pw_cnt
;
4004 const uint pws_cnt
= device_param
->pws_cnt
;
4008 run_copy (device_param
, pws_cnt
);
4010 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4012 device_param
->pw_cnt
= 0;
4013 device_param
->pws_cnt
= 0;
4020 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4022 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4024 const uint pw_cache_cnt
= pw_cache
->cnt
;
4026 if (pw_cache_cnt
== 0) continue;
4030 uint pws_cnt
= device_param
->pws_cnt
;
4032 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4034 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4036 pw
->pw_len
= pw_len
;
4038 uint pw_cnt
= device_param
->pw_cnt
;
4040 pw_cnt
+= pw_cache_cnt
;
4042 device_param
->pw_cnt
= pw_cnt
;
4046 device_param
->pws_cnt
= pws_cnt
;
4049 const uint pw_cnt
= device_param
->pw_cnt
;
4050 const uint pws_cnt
= device_param
->pws_cnt
;
4054 run_copy (device_param
, pws_cnt
);
4056 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4058 device_param
->pw_cnt
= 0;
4059 device_param
->pws_cnt
= 0;
4067 static void *thread_calc (void *p
)
4069 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4071 const uint attack_mode
= data
.attack_mode
;
4072 const uint attack_kern
= data
.attack_kern
;
4074 if (attack_mode
== ATTACK_MODE_BF
)
4076 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4078 const uint work
= get_work (device_param
, -1);
4080 if (work
== 0) break;
4082 const uint64_t words_off
= device_param
->words_off
;
4083 const uint64_t words_fin
= words_off
+ work
;
4085 const uint pw_cnt
= work
;
4086 const uint pws_cnt
= work
;
4088 device_param
->pw_cnt
= pw_cnt
;
4089 device_param
->pws_cnt
= pws_cnt
;
4093 run_copy (device_param
, pws_cnt
);
4095 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4097 device_param
->pw_cnt
= 0;
4098 device_param
->pws_cnt
= 0;
4101 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4103 if (data
.devices_status
== STATUS_CRACKED
) break;
4104 if (data
.devices_status
== STATUS_ABORTED
) break;
4105 if (data
.devices_status
== STATUS_QUIT
) break;
4106 if (data
.devices_status
== STATUS_BYPASS
) break;
4108 device_param
->words_done
= words_fin
;
4113 const uint segment_size
= data
.segment_size
;
4115 char *dictfile
= data
.dictfile
;
4117 if (attack_mode
== ATTACK_MODE_COMBI
)
4119 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4121 dictfile
= data
.dictfile2
;
4125 FILE *fd
= fopen (dictfile
, "rb");
4129 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4134 if (attack_mode
== ATTACK_MODE_COMBI
)
4136 const uint combs_mode
= data
.combs_mode
;
4138 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4140 const char *dictfilec
= data
.dictfile2
;
4142 FILE *combs_fp
= fopen (dictfilec
, "rb");
4144 if (combs_fp
== NULL
)
4146 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4153 device_param
->combs_fp
= combs_fp
;
4155 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4157 const char *dictfilec
= data
.dictfile
;
4159 FILE *combs_fp
= fopen (dictfilec
, "rb");
4161 if (combs_fp
== NULL
)
4163 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4170 device_param
->combs_fp
= combs_fp
;
4174 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4176 wl_data
->buf
= (char *) mymalloc (segment_size
);
4177 wl_data
->avail
= segment_size
;
4178 wl_data
->incr
= segment_size
;
4182 uint64_t words_cur
= 0;
4184 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4186 uint64_t words_off
= 0;
4187 uint64_t words_fin
= 0;
4193 const uint work
= get_work (device_param
, max
);
4195 if (work
== 0) break;
4197 words_off
= device_param
->words_off
;
4198 words_fin
= words_off
+ work
;
4203 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4207 for ( ; words_cur
< words_fin
; words_cur
++)
4209 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4211 line_len
= convert_from_hex (line_buf
, line_len
);
4213 // post-process rule engine
4215 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4217 char rule_buf_out
[BLOCK_SIZE
];
4219 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4221 int rule_len_out
= -1;
4223 if (line_len
< BLOCK_SIZE
)
4225 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4228 if (rule_len_out
< 0) continue;
4230 line_buf
= rule_buf_out
;
4231 line_len
= rule_len_out
;
4234 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4236 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4240 hc_thread_mutex_lock (mux_counter
);
4242 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4244 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4247 hc_thread_mutex_unlock (mux_counter
);
4252 else if (attack_kern
== ATTACK_KERN_COMBI
)
4254 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4255 // since we still need to combine the plains
4257 if (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
.combs_cnt
;
4268 hc_thread_mutex_unlock (mux_counter
);
4274 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4276 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4278 if (data
.devices_status
== STATUS_CRACKED
) break;
4279 if (data
.devices_status
== STATUS_ABORTED
) break;
4280 if (data
.devices_status
== STATUS_QUIT
) break;
4281 if (data
.devices_status
== STATUS_BYPASS
) break;
4284 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4286 if (data
.devices_status
== STATUS_CRACKED
) break;
4287 if (data
.devices_status
== STATUS_ABORTED
) break;
4288 if (data
.devices_status
== STATUS_QUIT
) break;
4289 if (data
.devices_status
== STATUS_BYPASS
) break;
4292 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4294 if (data
.devices_status
== STATUS_CRACKED
) break;
4295 if (data
.devices_status
== STATUS_ABORTED
) break;
4296 if (data
.devices_status
== STATUS_QUIT
) break;
4297 if (data
.devices_status
== STATUS_BYPASS
) break;
4299 // we need 2 flushing because we have two independant caches and it can occur
4300 // that one buffer is already at threshold plus for that length also exists
4301 // more data in the 2nd buffer so it would overflow
4308 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4310 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4312 const uint pw_cache_cnt
= pw_cache
->cnt
;
4314 if (pw_cache_cnt
== 0) continue;
4318 uint pws_cnt
= device_param
->pws_cnt
;
4320 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4322 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4324 pw
->pw_len
= pw_len
;
4326 uint pw_cnt
= device_param
->pw_cnt
;
4328 pw_cnt
+= pw_cache_cnt
;
4330 device_param
->pw_cnt
= pw_cnt
;
4334 device_param
->pws_cnt
= pws_cnt
;
4336 if (pws_cnt
== device_param
->gpu_power_user
) break;
4339 const uint pw_cnt
= device_param
->pw_cnt
;
4340 const uint pws_cnt
= device_param
->pws_cnt
;
4344 run_copy (device_param
, pws_cnt
);
4346 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4348 device_param
->pw_cnt
= 0;
4349 device_param
->pws_cnt
= 0;
4352 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4354 if (data
.devices_status
== STATUS_CRACKED
) break;
4355 if (data
.devices_status
== STATUS_ABORTED
) break;
4356 if (data
.devices_status
== STATUS_QUIT
) break;
4357 if (data
.devices_status
== STATUS_BYPASS
) break;
4365 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4367 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4369 const uint pw_cache_cnt
= pw_cache
->cnt
;
4371 if (pw_cache_cnt
== 0) continue;
4375 uint pws_cnt
= device_param
->pws_cnt
;
4377 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4379 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4381 pw
->pw_len
= pw_len
;
4383 uint pw_cnt
= device_param
->pw_cnt
;
4385 pw_cnt
+= pw_cache_cnt
;
4387 device_param
->pw_cnt
= pw_cnt
;
4391 device_param
->pws_cnt
= pws_cnt
;
4394 const uint pw_cnt
= device_param
->pw_cnt
;
4395 const uint pws_cnt
= device_param
->pws_cnt
;
4399 run_copy (device_param
, pws_cnt
);
4401 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4403 device_param
->pw_cnt
= 0;
4404 device_param
->pws_cnt
= 0;
4407 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4409 if (data
.devices_status
== STATUS_CRACKED
) break;
4410 if (data
.devices_status
== STATUS_ABORTED
) break;
4411 if (data
.devices_status
== STATUS_QUIT
) break;
4412 if (data
.devices_status
== STATUS_BYPASS
) break;
4415 if (words_fin
== 0) break;
4417 device_param
->words_done
= words_fin
;
4420 if (attack_mode
== ATTACK_MODE_COMBI
)
4422 fclose (device_param
->combs_fp
);
4425 free (wl_data
->buf
);
4434 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4436 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4438 device_param
->kernel_params_buf32
[24] = salt_pos
;
4439 device_param
->kernel_params_buf32
[27] = 1;
4440 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4441 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4442 device_param
->kernel_params_buf32
[30] = 0;
4443 device_param
->kernel_params_buf32
[31] = 1;
4445 char *dictfile_old
= data
.dictfile
;
4446 char *dictfile2_old
= data
.dictfile2
;
4447 char *mask_old
= data
.mask
;
4449 const char *weak_hash_check
= "weak-hash-check";
4451 data
.dictfile
= (char *) weak_hash_check
;
4452 data
.dictfile2
= (char *) weak_hash_check
;
4453 data
.mask
= (char *) weak_hash_check
;
4459 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4461 run_kernel (KERN_RUN_1
, device_param
, 1);
4465 run_kernel (KERN_RUN_1
, device_param
, 1);
4467 const uint iter
= salt_buf
->salt_iter
;
4469 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4471 uint loop_left
= iter
- loop_pos
;
4473 loop_left
= MIN (loop_left
, gpu_loops
);
4475 device_param
->kernel_params_buf32
[25] = loop_pos
;
4476 device_param
->kernel_params_buf32
[26] = loop_left
;
4478 run_kernel (KERN_RUN_2
, device_param
, 1);
4481 run_kernel (KERN_RUN_3
, device_param
, 1);
4488 check_cracked (device_param
, salt_pos
);
4494 device_param
->kernel_params_buf32
[24] = 0;
4495 device_param
->kernel_params_buf32
[25] = 0;
4496 device_param
->kernel_params_buf32
[26] = 0;
4497 device_param
->kernel_params_buf32
[27] = 0;
4498 device_param
->kernel_params_buf32
[28] = 0;
4499 device_param
->kernel_params_buf32
[29] = 0;
4500 device_param
->kernel_params_buf32
[30] = 0;
4501 device_param
->kernel_params_buf32
[31] = 0;
4503 data
.dictfile
= dictfile_old
;
4504 data
.dictfile2
= dictfile2_old
;
4505 data
.mask
= mask_old
;
4510 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4512 if (data
.username
== 0)
4514 *hashbuf_pos
= line_buf
;
4515 *hashbuf_len
= line_len
;
4519 char *pos
= line_buf
;
4522 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4524 if (line_buf
[i
] == data
.separator
)
4539 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4546 for (int i
= 0; i
< line_len
; i
++)
4548 if (line_buf
[i
] == data
.separator
)
4557 if (pos
== NULL
) pos
= line_buf
+ i
;
4569 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4576 for (int i
= 0; i
< line_len
; i
++)
4578 if (line_buf
[i
] == ':')
4585 if (sep_cnt
== 2) sep2_len
++;
4586 if (sep_cnt
== 3) sep3_len
++;
4589 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4594 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4601 for (int i
= 0; i
< line_len
; i
++)
4603 if (line_buf
[i
] == ':')
4610 if (data
.hash_mode
== 1000)
4614 if (pos
== NULL
) pos
= line_buf
+ i
;
4619 else if (data
.hash_mode
== 3000)
4623 if (pos
== NULL
) pos
= line_buf
+ i
;
4634 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4641 for (int i
= 0; i
< line_len
; i
++)
4643 if (line_buf
[i
] == ':')
4652 if (pos
== NULL
) pos
= line_buf
+ i
;
4664 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4668 char sep5_first
= 0;
4669 char sep6_first
= 0;
4671 for (int i
= 0; i
< line_len
; i
++)
4673 if (line_buf
[i
] == ':')
4680 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4681 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4684 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4689 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4696 for (int i
= 0; i
< line_len
; i
++)
4698 if (line_buf
[i
] == ':')
4707 if (pos
== NULL
) pos
= line_buf
+ i
;
4717 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4724 for (int i
= 0; i
< line_len
; i
++)
4726 if (line_buf
[i
] == ':')
4735 if (pos
== NULL
) pos
= line_buf
+ i
;
4747 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4751 for (int i
= 0; i
< line_len
; i
++)
4753 if (line_buf
[i
] == ':') sep_cnt
++;
4756 if (sep_cnt
== 8) return 1;
4761 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4763 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4766 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4768 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4773 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4775 switch (hashfile_format
)
4777 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4778 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4779 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4780 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4784 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4786 switch (hashfile_format
)
4788 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4789 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4790 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4791 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4795 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4797 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4799 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4800 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4802 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4808 char line_buf
[BUFSIZ
];
4810 int line_len
= fgetl (fp
, line_buf
);
4812 if (line_len
== 0) continue;
4814 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4815 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4816 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4818 if (num_check
== max_check
) break;
4823 uint hashlist_format
= HLFMT_HASHCAT
;
4825 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4827 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4829 hashlist_format
= i
;
4834 return hashlist_format
;
4838 * some further helper function
4841 // wrapper around mymalloc for ADL
4843 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4845 return mymalloc (iSize
);
4848 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
)
4850 uint64_t collisions
= 0;
4852 const uint dgst_pos0
= data
.dgst_pos0
;
4853 const uint dgst_pos1
= data
.dgst_pos1
;
4854 const uint dgst_pos2
= data
.dgst_pos2
;
4855 const uint dgst_pos3
= data
.dgst_pos3
;
4857 memset (bitmap_a
, 0, bitmap_size
);
4858 memset (bitmap_b
, 0, bitmap_size
);
4859 memset (bitmap_c
, 0, bitmap_size
);
4860 memset (bitmap_d
, 0, bitmap_size
);
4862 for (uint i
= 0; i
< digests_cnt
; i
++)
4864 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4866 digests_buf_ptr
+= dgst_size
;
4868 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4869 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4870 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4871 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4873 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4874 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4875 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4876 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4878 if (bitmap_a
[idx0
] & val0
) collisions
++;
4879 if (bitmap_b
[idx1
] & val1
) collisions
++;
4880 if (bitmap_c
[idx2
] & val2
) collisions
++;
4881 if (bitmap_d
[idx3
] & val3
) collisions
++;
4883 bitmap_a
[idx0
] |= val0
;
4884 bitmap_b
[idx1
] |= val1
;
4885 bitmap_c
[idx2
] |= val2
;
4886 bitmap_d
[idx3
] |= val3
;
4888 if (collisions
>= collisions_max
) return 0x7fffffff;
4898 int main (int argc
, char **argv
)
4901 * To help users a bit
4904 char *compute
= getenv ("COMPUTE");
4910 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4916 if (getenv ("DISPLAY") == NULL
)
4917 putenv ((char *) "DISPLAY=:0");
4921 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4922 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4924 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4925 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
4932 memset (&data
, 0, sizeof (hc_global_data_t
));
4938 data
.proc_start
= proc_start
;
4941 char **myargv
= argv
;
4943 hc_thread_mutex_init (mux_dispatcher
);
4944 hc_thread_mutex_init (mux_counter
);
4945 hc_thread_mutex_init (mux_display
);
4946 hc_thread_mutex_init (mux_adl
);
4949 * commandline parameters
4953 uint version
= VERSION
;
4955 uint benchmark
= BENCHMARK
;
4956 uint benchmark_mode
= BENCHMARK_MODE
;
4959 uint username
= USERNAME
;
4960 uint remove
= REMOVE
;
4961 uint remove_timer
= REMOVE_TIMER
;
4962 uint64_t skip
= SKIP
;
4963 uint64_t limit
= LIMIT
;
4964 uint keyspace
= KEYSPACE
;
4965 uint potfile_disable
= POTFILE_DISABLE
;
4966 uint debug_mode
= DEBUG_MODE
;
4967 char *debug_file
= NULL
;
4968 char *induction_dir
= NULL
;
4969 char *outfile_check_dir
= NULL
;
4971 uint runtime
= RUNTIME
;
4972 uint hash_mode
= HASH_MODE
;
4973 uint attack_mode
= ATTACK_MODE
;
4974 uint markov_disable
= MARKOV_DISABLE
;
4975 uint markov_classic
= MARKOV_CLASSIC
;
4976 uint markov_threshold
= MARKOV_THRESHOLD
;
4977 char *markov_hcstat
= NULL
;
4978 char *outfile
= NULL
;
4979 uint outfile_format
= OUTFILE_FORMAT
;
4980 uint outfile_autohex
= OUTFILE_AUTOHEX
;
4981 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
4982 uint restore
= RESTORE
;
4983 uint restore_timer
= RESTORE_TIMER
;
4984 uint restore_disable
= RESTORE_DISABLE
;
4985 uint status
= STATUS
;
4986 uint status_timer
= STATUS_TIMER
;
4987 uint status_automat
= STATUS_AUTOMAT
;
4988 uint loopback
= LOOPBACK
;
4989 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
4990 char *session
= NULL
;
4991 uint hex_charset
= HEX_CHARSET
;
4992 uint hex_salt
= HEX_SALT
;
4993 uint hex_wordlist
= HEX_WORDLIST
;
4994 uint rp_gen
= RP_GEN
;
4995 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
4996 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
4997 uint rp_gen_seed
= RP_GEN_SEED
;
4998 char *rule_buf_l
= (char *) RULE_BUF_L
;
4999 char *rule_buf_r
= (char *) RULE_BUF_R
;
5000 uint increment
= INCREMENT
;
5001 uint increment_min
= INCREMENT_MIN
;
5002 uint increment_max
= INCREMENT_MAX
;
5003 char *cpu_affinity
= NULL
;
5004 char *gpu_devices
= NULL
;
5005 char *truecrypt_keyfiles
= NULL
;
5006 uint workload_profile
= WORKLOAD_PROFILE
;
5007 uint gpu_accel
= GPU_ACCEL
;
5008 uint gpu_loops
= GPU_LOOPS
;
5009 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5010 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5011 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5012 uint powertune_enable
= POWERTUNE_ENABLE
;
5013 uint logfile_disable
= LOGFILE_DISABLE
;
5014 uint segment_size
= SEGMENT_SIZE
;
5015 uint scrypt_tmto
= SCRYPT_TMTO
;
5016 char separator
= SEPARATOR
;
5017 uint bitmap_min
= BITMAP_MIN
;
5018 uint bitmap_max
= BITMAP_MAX
;
5019 char *custom_charset_1
= NULL
;
5020 char *custom_charset_2
= NULL
;
5021 char *custom_charset_3
= NULL
;
5022 char *custom_charset_4
= NULL
;
5024 #define IDX_HELP 'h'
5025 #define IDX_VERSION 'V'
5026 #define IDX_VERSION_LOWER 'v'
5027 #define IDX_QUIET 0xff02
5028 #define IDX_SHOW 0xff03
5029 #define IDX_LEFT 0xff04
5030 #define IDX_REMOVE 0xff05
5031 #define IDX_REMOVE_TIMER 0xff37
5032 #define IDX_SKIP 's'
5033 #define IDX_LIMIT 'l'
5034 #define IDX_KEYSPACE 0xff35
5035 #define IDX_POTFILE_DISABLE 0xff06
5036 #define IDX_DEBUG_MODE 0xff43
5037 #define IDX_DEBUG_FILE 0xff44
5038 #define IDX_INDUCTION_DIR 0xff46
5039 #define IDX_OUTFILE_CHECK_DIR 0xff47
5040 #define IDX_USERNAME 0xff07
5041 #define IDX_FORCE 0xff08
5042 #define IDX_RUNTIME 0xff09
5043 #define IDX_BENCHMARK 'b'
5044 #define IDX_BENCHMARK_MODE 0xff32
5045 #define IDX_HASH_MODE 'm'
5046 #define IDX_ATTACK_MODE 'a'
5047 #define IDX_RP_FILE 'r'
5048 #define IDX_RP_GEN 'g'
5049 #define IDX_RP_GEN_FUNC_MIN 0xff10
5050 #define IDX_RP_GEN_FUNC_MAX 0xff11
5051 #define IDX_RP_GEN_SEED 0xff34
5052 #define IDX_RULE_BUF_L 'j'
5053 #define IDX_RULE_BUF_R 'k'
5054 #define IDX_INCREMENT 'i'
5055 #define IDX_INCREMENT_MIN 0xff12
5056 #define IDX_INCREMENT_MAX 0xff13
5057 #define IDX_OUTFILE 'o'
5058 #define IDX_OUTFILE_FORMAT 0xff14
5059 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5060 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5061 #define IDX_RESTORE 0xff15
5062 #define IDX_RESTORE_DISABLE 0xff27
5063 #define IDX_STATUS 0xff17
5064 #define IDX_STATUS_TIMER 0xff18
5065 #define IDX_STATUS_AUTOMAT 0xff50
5066 #define IDX_LOOPBACK 0xff38
5067 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5068 #define IDX_SESSION 0xff19
5069 #define IDX_HEX_CHARSET 0xff20
5070 #define IDX_HEX_SALT 0xff21
5071 #define IDX_HEX_WORDLIST 0xff40
5072 #define IDX_MARKOV_DISABLE 0xff22
5073 #define IDX_MARKOV_CLASSIC 0xff23
5074 #define IDX_MARKOV_THRESHOLD 't'
5075 #define IDX_MARKOV_HCSTAT 0xff24
5076 #define IDX_CPU_AFFINITY 0xff25
5077 #define IDX_GPU_DEVICES 'd'
5078 #define IDX_WORKLOAD_PROFILE 'w'
5079 #define IDX_GPU_ACCEL 'n'
5080 #define IDX_GPU_LOOPS 'u'
5081 #define IDX_GPU_TEMP_DISABLE 0xff29
5082 #define IDX_GPU_TEMP_ABORT 0xff30
5083 #define IDX_GPU_TEMP_RETAIN 0xff31
5084 #define IDX_POWERTUNE_ENABLE 0xff41
5085 #define IDX_LOGFILE_DISABLE 0xff51
5086 #define IDX_TRUECRYPT_KEYFILES 0xff52
5087 #define IDX_SCRYPT_TMTO 0xff61
5088 #define IDX_SEGMENT_SIZE 'c'
5089 #define IDX_SEPARATOR 'p'
5090 #define IDX_BITMAP_MIN 0xff70
5091 #define IDX_BITMAP_MAX 0xff71
5092 #define IDX_CUSTOM_CHARSET_1 '1'
5093 #define IDX_CUSTOM_CHARSET_2 '2'
5094 #define IDX_CUSTOM_CHARSET_3 '3'
5095 #define IDX_CUSTOM_CHARSET_4 '4'
5097 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5099 struct option long_options
[] =
5101 {"help", no_argument
, 0, IDX_HELP
},
5102 {"version", no_argument
, 0, IDX_VERSION
},
5103 {"quiet", no_argument
, 0, IDX_QUIET
},
5104 {"show", no_argument
, 0, IDX_SHOW
},
5105 {"left", no_argument
, 0, IDX_LEFT
},
5106 {"username", no_argument
, 0, IDX_USERNAME
},
5107 {"remove", no_argument
, 0, IDX_REMOVE
},
5108 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5109 {"skip", required_argument
, 0, IDX_SKIP
},
5110 {"limit", required_argument
, 0, IDX_LIMIT
},
5111 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5112 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5113 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5114 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5115 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5116 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5117 {"force", no_argument
, 0, IDX_FORCE
},
5118 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5119 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5120 {"restore", no_argument
, 0, IDX_RESTORE
},
5121 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5122 {"status", no_argument
, 0, IDX_STATUS
},
5123 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5124 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5125 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5126 {"weak-hash-threshold",
5127 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5128 {"session", required_argument
, 0, IDX_SESSION
},
5129 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5130 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5131 {"generate-rules-func-min",
5132 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5133 {"generate-rules-func-max",
5134 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5135 {"generate-rules-seed",
5136 required_argument
, 0, IDX_RP_GEN_SEED
},
5137 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5138 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5139 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5140 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5141 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5142 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5143 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5144 {"outfile-autohex-disable",
5145 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5146 {"outfile-check-timer",
5147 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5148 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5149 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5150 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5151 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5152 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5153 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5154 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5155 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5156 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5157 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5158 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5159 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5160 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5161 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5162 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5163 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5164 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5165 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5166 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5167 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5169 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5170 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5171 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5172 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5173 {"increment", no_argument
, 0, IDX_INCREMENT
},
5174 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5175 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5176 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5177 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5178 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5179 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5184 uint rp_files_cnt
= 0;
5186 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5195 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5199 case IDX_HELP
: usage
= 1; break;
5201 case IDX_VERSION_LOWER
: version
= 1; break;
5202 case IDX_RESTORE
: restore
= 1; break;
5203 case IDX_SESSION
: session
= optarg
; break;
5204 case IDX_SHOW
: show
= 1; break;
5205 case IDX_LEFT
: left
= 1; break;
5206 case '?': return (-1);
5212 log_error ("ERROR: Invalid argument specified");
5223 log_info (VERSION_TXT
);
5230 usage_big_print (PROGNAME
);
5239 if (session
== NULL
) session
= (char *) PROGNAME
;
5241 size_t session_size
= strlen (session
) + 32;
5243 data
.session
= session
;
5245 char *eff_restore_file
= (char *) mymalloc (session_size
);
5246 char *new_restore_file
= (char *) mymalloc (session_size
);
5248 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5249 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5251 data
.eff_restore_file
= eff_restore_file
;
5252 data
.new_restore_file
= new_restore_file
;
5254 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5256 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5257 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5262 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5263 if ((show
== 1) || (left
== 1))
5265 restore_disable
= 1;
5270 data
.restore_disable
= restore_disable
;
5272 restore_data_t
*rd
= init_restore (argc
, argv
);
5282 read_restore (eff_restore_file
, rd
);
5284 if (rd
->version_bin
< RESTORE_MIN
)
5286 log_error ("ERROR: Incompatible restore-file version");
5295 rd
->pid
= getpid ();
5297 rd
->pid
= GetCurrentProcessId ();
5301 uint hash_mode_chgd
= 0;
5302 uint runtime_chgd
= 0;
5303 uint gpu_loops_chgd
= 0;
5304 uint gpu_accel_chgd
= 0;
5305 uint attack_mode_chgd
= 0;
5306 uint outfile_format_chgd
= 0;
5307 uint rp_gen_seed_chgd
= 0;
5308 uint remove_timer_chgd
= 0;
5309 uint increment_min_chgd
= 0;
5310 uint increment_max_chgd
= 0;
5311 uint gpu_temp_abort_chgd
= 0;
5312 uint gpu_temp_retain_chgd
= 0;
5318 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5322 //case IDX_HELP: usage = 1; break;
5323 //case IDX_VERSION: version = 1; break;
5324 //case IDX_RESTORE: restore = 1; break;
5325 case IDX_QUIET
: quiet
= 1; break;
5326 //case IDX_SHOW: show = 1; break;
5327 case IDX_SHOW
: break;
5328 //case IDX_LEFT: left = 1; break;
5329 case IDX_LEFT
: break;
5330 case IDX_USERNAME
: username
= 1; break;
5331 case IDX_REMOVE
: remove
= 1; break;
5332 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5333 remove_timer_chgd
= 1; break;
5334 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5335 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5336 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5337 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5338 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5339 case IDX_FORCE
: force
= 1; break;
5340 case IDX_SKIP
: skip
= atoll (optarg
); break;
5341 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5342 case IDX_KEYSPACE
: keyspace
= 1; break;
5343 case IDX_BENCHMARK
: benchmark
= 1; break;
5344 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5345 case IDX_RESTORE
: break;
5346 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5347 case IDX_STATUS
: status
= 1; break;
5348 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5349 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5350 case IDX_LOOPBACK
: loopback
= 1; break;
5351 case IDX_WEAK_HASH_THRESHOLD
:
5352 weak_hash_threshold
= atoi (optarg
); break;
5353 //case IDX_SESSION: session = optarg; break;
5354 case IDX_SESSION
: break;
5355 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5356 hash_mode_chgd
= 1; break;
5357 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5358 runtime_chgd
= 1; break;
5359 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5360 attack_mode_chgd
= 1; break;
5361 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5362 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5363 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5364 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5365 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5366 rp_gen_seed_chgd
= 1; break;
5367 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5368 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5369 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5370 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5371 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5372 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5373 case IDX_OUTFILE
: outfile
= optarg
; break;
5374 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5375 outfile_format_chgd
= 1; break;
5376 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5377 outfile_autohex
= 0; break;
5378 case IDX_OUTFILE_CHECK_TIMER
:
5379 outfile_check_timer
= atoi (optarg
); break;
5380 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5381 case IDX_HEX_SALT
: hex_salt
= 1; break;
5382 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5383 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5384 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5385 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5386 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5387 gpu_accel_chgd
= 1; break;
5388 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5389 gpu_loops_chgd
= 1; break;
5390 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5391 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5392 gpu_temp_abort
= atoi (optarg
); break;
5393 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5394 gpu_temp_retain
= atoi (optarg
); break;
5395 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5396 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5397 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5398 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5399 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5400 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5401 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5402 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5403 case IDX_INCREMENT
: increment
= 1; break;
5404 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5405 increment_min_chgd
= 1; break;
5406 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5407 increment_max_chgd
= 1; break;
5408 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5409 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5410 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5411 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5414 log_error ("ERROR: Invalid argument specified");
5421 log_error ("ERROR: Invalid argument specified");
5427 * Inform user things getting started,
5428 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5429 * - we do not need to check algorithm_pos
5436 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5440 else if (restore
== 1)
5442 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5448 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5458 if (attack_mode
> 7)
5460 log_error ("ERROR: Invalid attack-mode specified");
5465 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5467 log_error ("ERROR: Invalid runtime specified");
5472 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5474 log_error ("ERROR: Invalid hash-type specified");
5479 // renamed hash modes
5493 log_error ("Old -m specified, use -m %d instead", n
);
5501 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5503 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5509 if (outfile_format
> 16)
5511 log_error ("ERROR: Invalid outfile-format specified");
5518 if (outfile_format_chgd
== 1)
5520 if (outfile_format
> 1)
5522 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5529 outfile_format
= OUTFILE_FMT_HASH
;
5535 if (outfile_format_chgd
== 1)
5537 if ((outfile_format
> 7) && (outfile_format
< 16))
5539 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5546 if (increment_min
< INCREMENT_MIN
)
5548 log_error ("ERROR: Invalid increment-min specified");
5553 if (increment_max
> INCREMENT_MAX
)
5555 log_error ("ERROR: Invalid increment-max specified");
5560 if (increment_min
> increment_max
)
5562 log_error ("ERROR: Invalid increment-min specified");
5567 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5569 log_error ("ERROR: increment is not allowed in attack-mode 0");
5574 if ((increment
== 0) && (increment_min_chgd
== 1))
5576 log_error ("ERROR: increment-min is only supported together with increment switch");
5581 if ((increment
== 0) && (increment_max_chgd
== 1))
5583 log_error ("ERROR: increment-max is only supported together with increment switch");
5588 if (rp_files_cnt
&& rp_gen
)
5590 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5595 if (rp_files_cnt
|| rp_gen
)
5597 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5599 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5605 if (rp_gen_func_min
> rp_gen_func_max
)
5607 log_error ("ERROR: Invalid rp-gen-func-min specified");
5612 if (gpu_accel_chgd
== 1)
5614 if (workload_profile
!= WORKLOAD_PROFILE
)
5616 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5623 log_error ("ERROR: Invalid gpu-accel specified");
5628 if (gpu_accel
> 800)
5630 log_error ("ERROR: Invalid gpu-accel specified");
5636 if (gpu_loops_chgd
== 1)
5638 if (workload_profile
!= WORKLOAD_PROFILE
)
5640 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5647 log_error ("ERROR: Invalid gpu-loops specified");
5652 if (gpu_loops
> 1024)
5654 log_error ("ERROR: Invalid gpu-loops specified");
5662 if (workload_profile
!= WORKLOAD_PROFILE
)
5664 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5670 if ((workload_profile
< 1) || (workload_profile
> 3))
5672 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5677 if (show
== 1 || left
== 1)
5679 attack_mode
= ATTACK_MODE_NONE
;
5683 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5688 if (potfile_disable
== 1)
5690 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5696 uint attack_kern
= ATTACK_KERN_NONE
;
5698 switch (attack_mode
)
5700 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5701 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5702 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5703 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5704 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5711 int num_additional_params
= 1;
5713 if (attack_kern
== ATTACK_KERN_COMBI
)
5715 num_additional_params
= 2;
5718 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5720 if (keyspace_wordlist_specified
== 0) optind
--;
5723 if (attack_kern
== ATTACK_KERN_NONE
)
5725 if ((optind
+ 1) != myargc
)
5727 usage_mini_print (myargv
[0]);
5732 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5734 if ((optind
+ 1) > myargc
)
5736 usage_mini_print (myargv
[0]);
5741 else if (attack_kern
== ATTACK_KERN_COMBI
)
5743 if ((optind
+ 3) != myargc
)
5745 usage_mini_print (myargv
[0]);
5750 else if (attack_kern
== ATTACK_KERN_BF
)
5752 if ((optind
+ 1) > myargc
)
5754 usage_mini_print (myargv
[0]);
5761 usage_mini_print (myargv
[0]);
5768 if (myargv
[optind
] != 0)
5770 log_error ("ERROR: Invalid argument for benchmark mode specified");
5775 if (attack_mode_chgd
== 1)
5777 if (attack_mode
!= ATTACK_MODE_BF
)
5779 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5785 if (benchmark_mode
== 0)
5789 else if (benchmark_mode
== 1)
5791 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5793 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5800 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5806 if (skip
!= 0 && limit
!= 0)
5815 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5821 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5826 potfile_disable
= 1;
5828 restore_disable
= 1;
5832 weak_hash_threshold
= 0;
5837 if (remove_timer_chgd
== 1)
5841 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5846 if (remove_timer
< 1)
5848 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5856 if (attack_mode
== ATTACK_MODE_BF
)
5858 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5862 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5864 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5866 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5875 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5877 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5882 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5884 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5892 log_error ("ERROR: Invalid debug-mode specified");
5897 if (debug_file
!= NULL
)
5901 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5907 if (induction_dir
!= NULL
)
5909 if (attack_mode
== ATTACK_MODE_BF
)
5911 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5918 * induction directory
5921 char *induction_directory
= NULL
;
5923 if (attack_mode
!= ATTACK_MODE_BF
)
5925 if (induction_dir
== NULL
)
5927 induction_directory
= (char *) mymalloc (session_size
);
5929 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
5931 // create induction folder if it does not already exist
5935 if (rmdir (induction_directory
) == -1)
5937 if (errno
== ENOENT
)
5939 // good, we can ignore
5941 else if (errno
== ENOTEMPTY
)
5943 char *induction_directory_mv
= (char *) mymalloc (session_size
);
5945 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
5947 if (rename (induction_directory
, induction_directory_mv
) != 0)
5949 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
5956 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5963 #define mkdir(name,mode) mkdir (name)
5966 if (mkdir (induction_directory
, 0700) == -1)
5968 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
5976 induction_directory
= induction_dir
;
5980 data
.induction_directory
= induction_directory
;
5986 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
5988 char *loopback_file
= (char *) mymalloc (loopback_size
);
5991 * outfile-check directory
5994 char *outfile_check_directory
= NULL
;
5996 if (outfile_check_dir
== NULL
)
5998 outfile_check_directory
= (char *) mymalloc (session_size
);
6000 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
6004 outfile_check_directory
= outfile_check_dir
;
6007 data
.outfile_check_directory
= outfile_check_directory
;
6011 struct stat outfile_check_stat
;
6013 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6015 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6019 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6024 else if (outfile_check_dir
== NULL
)
6027 #define mkdir(name,mode) mkdir (name)
6030 if (mkdir (outfile_check_directory
, 0700) == -1)
6032 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6040 * special other stuff
6043 if (hash_mode
== 9710)
6046 outfile_format_chgd
= 1;
6049 if (hash_mode
== 9810)
6052 outfile_format_chgd
= 1;
6055 if (hash_mode
== 10410)
6058 outfile_format_chgd
= 1;
6065 data
.hash_mode
= hash_mode
;
6066 data
.restore
= restore
;
6067 data
.restore_timer
= restore_timer
;
6068 data
.restore_disable
= restore_disable
;
6069 data
.status
= status
;
6070 data
.status_timer
= status_timer
;
6071 data
.status_automat
= status_automat
;
6072 data
.loopback
= loopback
;
6073 data
.runtime
= runtime
;
6074 data
.remove
= remove
;
6075 data
.remove_timer
= remove_timer
;
6076 data
.debug_mode
= debug_mode
;
6077 data
.debug_file
= debug_file
;
6078 data
.username
= username
;
6080 data
.outfile
= outfile
;
6081 data
.outfile_format
= outfile_format
;
6082 data
.outfile_autohex
= outfile_autohex
;
6083 data
.hex_charset
= hex_charset
;
6084 data
.hex_salt
= hex_salt
;
6085 data
.hex_wordlist
= hex_wordlist
;
6086 data
.separator
= separator
;
6087 data
.rp_files
= rp_files
;
6088 data
.rp_files_cnt
= rp_files_cnt
;
6089 data
.rp_gen
= rp_gen
;
6090 data
.rp_gen_seed
= rp_gen_seed
;
6092 data
.benchmark
= benchmark
;
6095 data
.powertune_enable
= powertune_enable
;
6096 data
.logfile_disable
= logfile_disable
;
6097 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6098 data
.scrypt_tmto
= scrypt_tmto
;
6101 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6106 char *resolved_path
= realpath (myargv
[0], NULL
);
6108 char *install_dir
= get_install_dir (resolved_path
);
6109 char *profile_dir
= NULL
;
6110 char *session_dir
= NULL
;
6112 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6114 struct passwd
*pw
= getpwuid (getuid ());
6116 const char *homedir
= pw
->pw_dir
;
6118 profile_dir
= get_profile_dir (homedir
);
6119 session_dir
= get_session_dir (profile_dir
, session
);
6123 profile_dir
= install_dir
;
6124 session_dir
= install_dir
;
6127 myfree (resolved_path
);
6131 char *install_dir
= get_install_dir (myargv
[0]);
6132 char *profile_dir
= install_dir
;
6133 char *session_dir
= install_dir
;
6137 data
.install_dir
= install_dir
;
6138 data
.profile_dir
= profile_dir
;
6139 data
.session_dir
= session_dir
;
6147 set_cpu_affinity (cpu_affinity
);
6150 if (rp_gen_seed_chgd
== 0)
6156 srand (rp_gen_seed
);
6163 if (logfile_disable
== 0)
6165 size_t logfile_size
= strlen (session
) + 32;
6167 char *logfile
= (char *) mymalloc (logfile_size
);
6169 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6171 data
.logfile
= logfile
;
6173 char *topid
= logfile_generate_topid ();
6178 // logfile_append() checks for logfile_disable internally to make it easier from here
6180 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6181 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6182 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6183 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6184 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6185 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6186 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6187 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6188 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6189 #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));
6191 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6192 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6193 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6194 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6195 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6196 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6197 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6198 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6200 logfile_top_msg ("START");
6202 logfile_top_uint (attack_mode
);
6203 logfile_top_uint (attack_kern
);
6204 logfile_top_uint (benchmark
);
6205 logfile_top_uint (benchmark_mode
);
6206 logfile_top_uint (bitmap_min
);
6207 logfile_top_uint (bitmap_max
);
6208 logfile_top_uint (debug_mode
);
6209 logfile_top_uint (force
);
6210 logfile_top_uint (gpu_accel
);
6211 logfile_top_uint (gpu_loops
);
6212 logfile_top_uint (gpu_temp_abort
);
6213 logfile_top_uint (gpu_temp_disable
);
6214 logfile_top_uint (gpu_temp_retain
);
6215 logfile_top_uint (hash_mode
);
6216 logfile_top_uint (hex_charset
);
6217 logfile_top_uint (hex_salt
);
6218 logfile_top_uint (hex_wordlist
);
6219 logfile_top_uint (increment
);
6220 logfile_top_uint (increment_max
);
6221 logfile_top_uint (increment_min
);
6222 logfile_top_uint (keyspace
);
6223 logfile_top_uint (left
);
6224 logfile_top_uint (logfile_disable
);
6225 logfile_top_uint (loopback
);
6226 logfile_top_uint (markov_classic
);
6227 logfile_top_uint (markov_disable
);
6228 logfile_top_uint (markov_threshold
);
6229 logfile_top_uint (outfile_autohex
);
6230 logfile_top_uint (outfile_check_timer
);
6231 logfile_top_uint (outfile_format
);
6232 logfile_top_uint (potfile_disable
);
6233 logfile_top_uint (powertune_enable
);
6234 logfile_top_uint (scrypt_tmto
);
6235 logfile_top_uint (quiet
);
6236 logfile_top_uint (remove
);
6237 logfile_top_uint (remove_timer
);
6238 logfile_top_uint (restore
);
6239 logfile_top_uint (restore_disable
);
6240 logfile_top_uint (restore_timer
);
6241 logfile_top_uint (rp_gen
);
6242 logfile_top_uint (rp_gen_func_max
);
6243 logfile_top_uint (rp_gen_func_min
);
6244 logfile_top_uint (rp_gen_seed
);
6245 logfile_top_uint (runtime
);
6246 logfile_top_uint (segment_size
);
6247 logfile_top_uint (show
);
6248 logfile_top_uint (status
);
6249 logfile_top_uint (status_automat
);
6250 logfile_top_uint (status_timer
);
6251 logfile_top_uint (usage
);
6252 logfile_top_uint (username
);
6253 logfile_top_uint (version
);
6254 logfile_top_uint (weak_hash_threshold
);
6255 logfile_top_uint (workload_profile
);
6256 logfile_top_uint64 (limit
);
6257 logfile_top_uint64 (skip
);
6258 logfile_top_char (separator
);
6259 logfile_top_string (cpu_affinity
);
6260 logfile_top_string (custom_charset_1
);
6261 logfile_top_string (custom_charset_2
);
6262 logfile_top_string (custom_charset_3
);
6263 logfile_top_string (custom_charset_4
);
6264 logfile_top_string (debug_file
);
6265 logfile_top_string (gpu_devices
);
6266 logfile_top_string (induction_dir
);
6267 logfile_top_string (markov_hcstat
);
6268 logfile_top_string (outfile
);
6269 logfile_top_string (outfile_check_dir
);
6270 logfile_top_string (rule_buf_l
);
6271 logfile_top_string (rule_buf_r
);
6272 logfile_top_string (session
);
6273 logfile_top_string (truecrypt_keyfiles
);
6279 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6288 * disable useless stuff for benchmark
6293 restore_disable
= 1;
6294 potfile_disable
= 1;
6295 weak_hash_threshold
= 0;
6297 data
.restore_timer
= restore_timer
;
6298 data
.status_timer
= status_timer
;
6299 data
.restore_disable
= restore_disable
;
6301 if (benchmark_mode
== 1)
6307 * force attack mode to be bruteforce
6310 attack_mode
= ATTACK_MODE_BF
;
6311 attack_kern
= ATTACK_KERN_BF
;
6313 if (runtime_chgd
== 0)
6317 if (benchmark_mode
== 1) runtime
= 17;
6319 data
.runtime
= runtime
;
6329 uint attack_exec
= 0;
6333 uint esalt_size
= 0;
6335 uint dgst_pos0
= -1;
6336 uint dgst_pos1
= -1;
6337 uint dgst_pos2
= -1;
6338 uint dgst_pos3
= -1;
6340 int (*parse_func
) (char *, uint
, hash_t
*);
6341 int (*sort_by_digest
) (const void *, const void *);
6343 uint algorithm_pos
= 0;
6344 uint algorithm_max
= 1;
6346 uint
*algorithms
= default_benchmark_algorithms
;
6348 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6350 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6353 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6354 * the following algos are skipped entirely
6357 if (algorithm_pos
> 0)
6361 rd
= init_restore (argc
, argv
);
6367 * update hash_mode in case of multihash benchmark
6372 if (hash_mode_chgd
== 0)
6374 hash_mode
= algorithms
[algorithm_pos
];
6376 data
.hash_mode
= hash_mode
;
6386 case 0: hash_type
= HASH_TYPE_MD5
;
6387 salt_type
= SALT_TYPE_NONE
;
6388 attack_exec
= ATTACK_EXEC_ON_GPU
;
6389 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6390 | OPTS_TYPE_PT_ADD80
6391 | OPTS_TYPE_PT_ADDBITS14
;
6392 kern_type
= KERN_TYPE_MD5
;
6393 dgst_size
= DGST_SIZE_4_4
;
6394 parse_func
= md5_parse_hash
;
6395 sort_by_digest
= sort_by_digest_4_4
;
6396 opti_type
= OPTI_TYPE_ZERO_BYTE
6397 | OPTI_TYPE_PRECOMPUTE_INIT
6398 | OPTI_TYPE_PRECOMPUTE_MERKLE
6399 | OPTI_TYPE_MEET_IN_MIDDLE
6400 | OPTI_TYPE_EARLY_SKIP
6401 | OPTI_TYPE_NOT_ITERATED
6402 | OPTI_TYPE_NOT_SALTED
6403 | OPTI_TYPE_RAW_HASH
;
6410 case 10: hash_type
= HASH_TYPE_MD5
;
6411 salt_type
= SALT_TYPE_INTERN
;
6412 attack_exec
= ATTACK_EXEC_ON_GPU
;
6413 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6414 | OPTS_TYPE_ST_ADD80
6415 | OPTS_TYPE_ST_ADDBITS14
;
6416 kern_type
= KERN_TYPE_MD5_PWSLT
;
6417 dgst_size
= DGST_SIZE_4_4
;
6418 parse_func
= md5s_parse_hash
;
6419 sort_by_digest
= sort_by_digest_4_4
;
6420 opti_type
= OPTI_TYPE_ZERO_BYTE
6421 | OPTI_TYPE_PRECOMPUTE_INIT
6422 | OPTI_TYPE_PRECOMPUTE_MERKLE
6423 | OPTI_TYPE_MEET_IN_MIDDLE
6424 | OPTI_TYPE_EARLY_SKIP
6425 | OPTI_TYPE_NOT_ITERATED
6426 | OPTI_TYPE_APPENDED_SALT
6427 | OPTI_TYPE_RAW_HASH
;
6434 case 11: hash_type
= HASH_TYPE_MD5
;
6435 salt_type
= SALT_TYPE_INTERN
;
6436 attack_exec
= ATTACK_EXEC_ON_GPU
;
6437 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6438 | OPTS_TYPE_ST_ADD80
6439 | OPTS_TYPE_ST_ADDBITS14
;
6440 kern_type
= KERN_TYPE_MD5_PWSLT
;
6441 dgst_size
= DGST_SIZE_4_4
;
6442 parse_func
= joomla_parse_hash
;
6443 sort_by_digest
= sort_by_digest_4_4
;
6444 opti_type
= OPTI_TYPE_ZERO_BYTE
6445 | OPTI_TYPE_PRECOMPUTE_INIT
6446 | OPTI_TYPE_PRECOMPUTE_MERKLE
6447 | OPTI_TYPE_MEET_IN_MIDDLE
6448 | OPTI_TYPE_EARLY_SKIP
6449 | OPTI_TYPE_NOT_ITERATED
6450 | OPTI_TYPE_APPENDED_SALT
6451 | OPTI_TYPE_RAW_HASH
;
6458 case 12: hash_type
= HASH_TYPE_MD5
;
6459 salt_type
= SALT_TYPE_INTERN
;
6460 attack_exec
= ATTACK_EXEC_ON_GPU
;
6461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6462 | OPTS_TYPE_ST_ADD80
6463 | OPTS_TYPE_ST_ADDBITS14
;
6464 kern_type
= KERN_TYPE_MD5_PWSLT
;
6465 dgst_size
= DGST_SIZE_4_4
;
6466 parse_func
= postgresql_parse_hash
;
6467 sort_by_digest
= sort_by_digest_4_4
;
6468 opti_type
= OPTI_TYPE_ZERO_BYTE
6469 | OPTI_TYPE_PRECOMPUTE_INIT
6470 | OPTI_TYPE_PRECOMPUTE_MERKLE
6471 | OPTI_TYPE_MEET_IN_MIDDLE
6472 | OPTI_TYPE_EARLY_SKIP
6473 | OPTI_TYPE_NOT_ITERATED
6474 | OPTI_TYPE_APPENDED_SALT
6475 | OPTI_TYPE_RAW_HASH
;
6482 case 20: hash_type
= HASH_TYPE_MD5
;
6483 salt_type
= SALT_TYPE_INTERN
;
6484 attack_exec
= ATTACK_EXEC_ON_GPU
;
6485 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6486 | OPTS_TYPE_PT_ADD80
6487 | OPTS_TYPE_PT_ADDBITS14
;
6488 kern_type
= KERN_TYPE_MD5_SLTPW
;
6489 dgst_size
= DGST_SIZE_4_4
;
6490 parse_func
= md5s_parse_hash
;
6491 sort_by_digest
= sort_by_digest_4_4
;
6492 opti_type
= OPTI_TYPE_ZERO_BYTE
6493 | OPTI_TYPE_PRECOMPUTE_INIT
6494 | OPTI_TYPE_PRECOMPUTE_MERKLE
6495 | OPTI_TYPE_EARLY_SKIP
6496 | OPTI_TYPE_NOT_ITERATED
6497 | OPTI_TYPE_PREPENDED_SALT
6498 | OPTI_TYPE_RAW_HASH
;
6505 case 21: hash_type
= HASH_TYPE_MD5
;
6506 salt_type
= SALT_TYPE_INTERN
;
6507 attack_exec
= ATTACK_EXEC_ON_GPU
;
6508 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6509 | OPTS_TYPE_PT_ADD80
6510 | OPTS_TYPE_PT_ADDBITS14
;
6511 kern_type
= KERN_TYPE_MD5_SLTPW
;
6512 dgst_size
= DGST_SIZE_4_4
;
6513 parse_func
= osc_parse_hash
;
6514 sort_by_digest
= sort_by_digest_4_4
;
6515 opti_type
= OPTI_TYPE_ZERO_BYTE
6516 | OPTI_TYPE_PRECOMPUTE_INIT
6517 | OPTI_TYPE_PRECOMPUTE_MERKLE
6518 | OPTI_TYPE_EARLY_SKIP
6519 | OPTI_TYPE_NOT_ITERATED
6520 | OPTI_TYPE_PREPENDED_SALT
6521 | OPTI_TYPE_RAW_HASH
;
6528 case 22: hash_type
= HASH_TYPE_MD5
;
6529 salt_type
= SALT_TYPE_EMBEDDED
;
6530 attack_exec
= ATTACK_EXEC_ON_GPU
;
6531 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6532 | OPTS_TYPE_PT_ADD80
6533 | OPTS_TYPE_PT_ADDBITS14
;
6534 kern_type
= KERN_TYPE_MD5_SLTPW
;
6535 dgst_size
= DGST_SIZE_4_4
;
6536 parse_func
= netscreen_parse_hash
;
6537 sort_by_digest
= sort_by_digest_4_4
;
6538 opti_type
= OPTI_TYPE_ZERO_BYTE
6539 | OPTI_TYPE_PRECOMPUTE_INIT
6540 | OPTI_TYPE_PRECOMPUTE_MERKLE
6541 | OPTI_TYPE_EARLY_SKIP
6542 | OPTI_TYPE_NOT_ITERATED
6543 | OPTI_TYPE_PREPENDED_SALT
6544 | OPTI_TYPE_RAW_HASH
;
6551 case 23: hash_type
= HASH_TYPE_MD5
;
6552 salt_type
= SALT_TYPE_EMBEDDED
;
6553 attack_exec
= ATTACK_EXEC_ON_GPU
;
6554 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6555 | OPTS_TYPE_PT_ADD80
6556 | OPTS_TYPE_PT_ADDBITS14
;
6557 kern_type
= KERN_TYPE_MD5_SLTPW
;
6558 dgst_size
= DGST_SIZE_4_4
;
6559 parse_func
= skype_parse_hash
;
6560 sort_by_digest
= sort_by_digest_4_4
;
6561 opti_type
= OPTI_TYPE_ZERO_BYTE
6562 | OPTI_TYPE_PRECOMPUTE_INIT
6563 | OPTI_TYPE_PRECOMPUTE_MERKLE
6564 | OPTI_TYPE_EARLY_SKIP
6565 | OPTI_TYPE_NOT_ITERATED
6566 | OPTI_TYPE_PREPENDED_SALT
6567 | OPTI_TYPE_RAW_HASH
;
6574 case 30: hash_type
= HASH_TYPE_MD5
;
6575 salt_type
= SALT_TYPE_INTERN
;
6576 attack_exec
= ATTACK_EXEC_ON_GPU
;
6577 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6578 | OPTS_TYPE_PT_UNICODE
6579 | OPTS_TYPE_ST_ADD80
6580 | OPTS_TYPE_ST_ADDBITS14
;
6581 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6582 dgst_size
= DGST_SIZE_4_4
;
6583 parse_func
= md5s_parse_hash
;
6584 sort_by_digest
= sort_by_digest_4_4
;
6585 opti_type
= OPTI_TYPE_ZERO_BYTE
6586 | OPTI_TYPE_PRECOMPUTE_INIT
6587 | OPTI_TYPE_PRECOMPUTE_MERKLE
6588 | OPTI_TYPE_MEET_IN_MIDDLE
6589 | OPTI_TYPE_EARLY_SKIP
6590 | OPTI_TYPE_NOT_ITERATED
6591 | OPTI_TYPE_APPENDED_SALT
6592 | OPTI_TYPE_RAW_HASH
;
6599 case 40: hash_type
= HASH_TYPE_MD5
;
6600 salt_type
= SALT_TYPE_INTERN
;
6601 attack_exec
= ATTACK_EXEC_ON_GPU
;
6602 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6603 | OPTS_TYPE_PT_ADD80
6604 | OPTS_TYPE_PT_ADDBITS14
6605 | OPTS_TYPE_PT_UNICODE
;
6606 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6607 dgst_size
= DGST_SIZE_4_4
;
6608 parse_func
= md5s_parse_hash
;
6609 sort_by_digest
= sort_by_digest_4_4
;
6610 opti_type
= OPTI_TYPE_ZERO_BYTE
6611 | OPTI_TYPE_PRECOMPUTE_INIT
6612 | OPTI_TYPE_PRECOMPUTE_MERKLE
6613 | OPTI_TYPE_EARLY_SKIP
6614 | OPTI_TYPE_NOT_ITERATED
6615 | OPTI_TYPE_PREPENDED_SALT
6616 | OPTI_TYPE_RAW_HASH
;
6623 case 50: hash_type
= HASH_TYPE_MD5
;
6624 salt_type
= SALT_TYPE_INTERN
;
6625 attack_exec
= ATTACK_EXEC_ON_GPU
;
6626 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6627 | OPTS_TYPE_ST_ADD80
6628 | OPTS_TYPE_ST_ADDBITS14
;
6629 kern_type
= KERN_TYPE_HMACMD5_PW
;
6630 dgst_size
= DGST_SIZE_4_4
;
6631 parse_func
= hmacmd5_parse_hash
;
6632 sort_by_digest
= sort_by_digest_4_4
;
6633 opti_type
= OPTI_TYPE_ZERO_BYTE
6634 | OPTI_TYPE_NOT_ITERATED
;
6641 case 60: hash_type
= HASH_TYPE_MD5
;
6642 salt_type
= SALT_TYPE_INTERN
;
6643 attack_exec
= ATTACK_EXEC_ON_GPU
;
6644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6645 | OPTS_TYPE_PT_ADD80
6646 | OPTS_TYPE_PT_ADDBITS14
;
6647 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6648 dgst_size
= DGST_SIZE_4_4
;
6649 parse_func
= hmacmd5_parse_hash
;
6650 sort_by_digest
= sort_by_digest_4_4
;
6651 opti_type
= OPTI_TYPE_ZERO_BYTE
6652 | OPTI_TYPE_NOT_ITERATED
;
6659 case 100: hash_type
= HASH_TYPE_SHA1
;
6660 salt_type
= SALT_TYPE_NONE
;
6661 attack_exec
= ATTACK_EXEC_ON_GPU
;
6662 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6663 | OPTS_TYPE_PT_ADD80
6664 | OPTS_TYPE_PT_ADDBITS15
;
6665 kern_type
= KERN_TYPE_SHA1
;
6666 dgst_size
= DGST_SIZE_4_5
;
6667 parse_func
= sha1_parse_hash
;
6668 sort_by_digest
= sort_by_digest_4_5
;
6669 opti_type
= OPTI_TYPE_ZERO_BYTE
6670 | OPTI_TYPE_PRECOMPUTE_INIT
6671 | OPTI_TYPE_PRECOMPUTE_MERKLE
6672 | OPTI_TYPE_EARLY_SKIP
6673 | OPTI_TYPE_NOT_ITERATED
6674 | OPTI_TYPE_NOT_SALTED
6675 | OPTI_TYPE_RAW_HASH
;
6682 case 101: hash_type
= HASH_TYPE_SHA1
;
6683 salt_type
= SALT_TYPE_NONE
;
6684 attack_exec
= ATTACK_EXEC_ON_GPU
;
6685 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6686 | OPTS_TYPE_PT_ADD80
6687 | OPTS_TYPE_PT_ADDBITS15
;
6688 kern_type
= KERN_TYPE_SHA1
;
6689 dgst_size
= DGST_SIZE_4_5
;
6690 parse_func
= sha1b64_parse_hash
;
6691 sort_by_digest
= sort_by_digest_4_5
;
6692 opti_type
= OPTI_TYPE_ZERO_BYTE
6693 | OPTI_TYPE_PRECOMPUTE_INIT
6694 | OPTI_TYPE_PRECOMPUTE_MERKLE
6695 | OPTI_TYPE_EARLY_SKIP
6696 | OPTI_TYPE_NOT_ITERATED
6697 | OPTI_TYPE_NOT_SALTED
6698 | OPTI_TYPE_RAW_HASH
;
6705 case 110: hash_type
= HASH_TYPE_SHA1
;
6706 salt_type
= SALT_TYPE_INTERN
;
6707 attack_exec
= ATTACK_EXEC_ON_GPU
;
6708 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6709 | OPTS_TYPE_ST_ADD80
6710 | OPTS_TYPE_ST_ADDBITS15
;
6711 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6712 dgst_size
= DGST_SIZE_4_5
;
6713 parse_func
= sha1s_parse_hash
;
6714 sort_by_digest
= sort_by_digest_4_5
;
6715 opti_type
= OPTI_TYPE_ZERO_BYTE
6716 | OPTI_TYPE_PRECOMPUTE_INIT
6717 | OPTI_TYPE_PRECOMPUTE_MERKLE
6718 | OPTI_TYPE_EARLY_SKIP
6719 | OPTI_TYPE_NOT_ITERATED
6720 | OPTI_TYPE_APPENDED_SALT
6721 | OPTI_TYPE_RAW_HASH
;
6728 case 111: hash_type
= HASH_TYPE_SHA1
;
6729 salt_type
= SALT_TYPE_EMBEDDED
;
6730 attack_exec
= ATTACK_EXEC_ON_GPU
;
6731 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6732 | OPTS_TYPE_ST_ADD80
6733 | OPTS_TYPE_ST_ADDBITS15
;
6734 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6735 dgst_size
= DGST_SIZE_4_5
;
6736 parse_func
= sha1b64s_parse_hash
;
6737 sort_by_digest
= sort_by_digest_4_5
;
6738 opti_type
= OPTI_TYPE_ZERO_BYTE
6739 | OPTI_TYPE_PRECOMPUTE_INIT
6740 | OPTI_TYPE_PRECOMPUTE_MERKLE
6741 | OPTI_TYPE_EARLY_SKIP
6742 | OPTI_TYPE_NOT_ITERATED
6743 | OPTI_TYPE_APPENDED_SALT
6744 | OPTI_TYPE_RAW_HASH
;
6751 case 112: hash_type
= HASH_TYPE_SHA1
;
6752 salt_type
= SALT_TYPE_INTERN
;
6753 attack_exec
= ATTACK_EXEC_ON_GPU
;
6754 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6755 | OPTS_TYPE_ST_ADD80
6756 | OPTS_TYPE_ST_ADDBITS15
6758 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6759 dgst_size
= DGST_SIZE_4_5
;
6760 parse_func
= oracles_parse_hash
;
6761 sort_by_digest
= sort_by_digest_4_5
;
6762 opti_type
= OPTI_TYPE_ZERO_BYTE
6763 | OPTI_TYPE_PRECOMPUTE_INIT
6764 | OPTI_TYPE_PRECOMPUTE_MERKLE
6765 | OPTI_TYPE_EARLY_SKIP
6766 | OPTI_TYPE_NOT_ITERATED
6767 | OPTI_TYPE_APPENDED_SALT
6768 | OPTI_TYPE_RAW_HASH
;
6775 case 120: hash_type
= HASH_TYPE_SHA1
;
6776 salt_type
= SALT_TYPE_INTERN
;
6777 attack_exec
= ATTACK_EXEC_ON_GPU
;
6778 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6779 | OPTS_TYPE_PT_ADD80
6780 | OPTS_TYPE_PT_ADDBITS15
;
6781 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6782 dgst_size
= DGST_SIZE_4_5
;
6783 parse_func
= sha1s_parse_hash
;
6784 sort_by_digest
= sort_by_digest_4_5
;
6785 opti_type
= OPTI_TYPE_ZERO_BYTE
6786 | OPTI_TYPE_PRECOMPUTE_INIT
6787 | OPTI_TYPE_PRECOMPUTE_MERKLE
6788 | OPTI_TYPE_EARLY_SKIP
6789 | OPTI_TYPE_NOT_ITERATED
6790 | OPTI_TYPE_PREPENDED_SALT
6791 | OPTI_TYPE_RAW_HASH
;
6798 case 121: hash_type
= HASH_TYPE_SHA1
;
6799 salt_type
= SALT_TYPE_INTERN
;
6800 attack_exec
= ATTACK_EXEC_ON_GPU
;
6801 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6802 | OPTS_TYPE_PT_ADD80
6803 | OPTS_TYPE_PT_ADDBITS15
6804 | OPTS_TYPE_ST_LOWER
;
6805 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6806 dgst_size
= DGST_SIZE_4_5
;
6807 parse_func
= smf_parse_hash
;
6808 sort_by_digest
= sort_by_digest_4_5
;
6809 opti_type
= OPTI_TYPE_ZERO_BYTE
6810 | OPTI_TYPE_PRECOMPUTE_INIT
6811 | OPTI_TYPE_PRECOMPUTE_MERKLE
6812 | OPTI_TYPE_EARLY_SKIP
6813 | OPTI_TYPE_NOT_ITERATED
6814 | OPTI_TYPE_PREPENDED_SALT
6815 | OPTI_TYPE_RAW_HASH
;
6822 case 122: hash_type
= HASH_TYPE_SHA1
;
6823 salt_type
= SALT_TYPE_EMBEDDED
;
6824 attack_exec
= ATTACK_EXEC_ON_GPU
;
6825 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6826 | OPTS_TYPE_PT_ADD80
6827 | OPTS_TYPE_PT_ADDBITS15
6829 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6830 dgst_size
= DGST_SIZE_4_5
;
6831 parse_func
= osx1_parse_hash
;
6832 sort_by_digest
= sort_by_digest_4_5
;
6833 opti_type
= OPTI_TYPE_ZERO_BYTE
6834 | OPTI_TYPE_PRECOMPUTE_INIT
6835 | OPTI_TYPE_PRECOMPUTE_MERKLE
6836 | OPTI_TYPE_EARLY_SKIP
6837 | OPTI_TYPE_NOT_ITERATED
6838 | OPTI_TYPE_PREPENDED_SALT
6839 | OPTI_TYPE_RAW_HASH
;
6846 case 124: hash_type
= HASH_TYPE_SHA1
;
6847 salt_type
= SALT_TYPE_EMBEDDED
;
6848 attack_exec
= ATTACK_EXEC_ON_GPU
;
6849 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6850 | OPTS_TYPE_PT_ADD80
6851 | OPTS_TYPE_PT_ADDBITS15
;
6852 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6853 dgst_size
= DGST_SIZE_4_5
;
6854 parse_func
= djangosha1_parse_hash
;
6855 sort_by_digest
= sort_by_digest_4_5
;
6856 opti_type
= OPTI_TYPE_ZERO_BYTE
6857 | OPTI_TYPE_PRECOMPUTE_INIT
6858 | OPTI_TYPE_PRECOMPUTE_MERKLE
6859 | OPTI_TYPE_EARLY_SKIP
6860 | OPTI_TYPE_NOT_ITERATED
6861 | OPTI_TYPE_PREPENDED_SALT
6862 | OPTI_TYPE_RAW_HASH
;
6869 case 130: hash_type
= HASH_TYPE_SHA1
;
6870 salt_type
= SALT_TYPE_INTERN
;
6871 attack_exec
= ATTACK_EXEC_ON_GPU
;
6872 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6873 | OPTS_TYPE_PT_UNICODE
6874 | OPTS_TYPE_ST_ADD80
6875 | OPTS_TYPE_ST_ADDBITS15
;
6876 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6877 dgst_size
= DGST_SIZE_4_5
;
6878 parse_func
= sha1s_parse_hash
;
6879 sort_by_digest
= sort_by_digest_4_5
;
6880 opti_type
= OPTI_TYPE_ZERO_BYTE
6881 | OPTI_TYPE_PRECOMPUTE_INIT
6882 | OPTI_TYPE_PRECOMPUTE_MERKLE
6883 | OPTI_TYPE_EARLY_SKIP
6884 | OPTI_TYPE_NOT_ITERATED
6885 | OPTI_TYPE_APPENDED_SALT
6886 | OPTI_TYPE_RAW_HASH
;
6893 case 131: hash_type
= HASH_TYPE_SHA1
;
6894 salt_type
= SALT_TYPE_EMBEDDED
;
6895 attack_exec
= ATTACK_EXEC_ON_GPU
;
6896 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6897 | OPTS_TYPE_PT_UNICODE
6898 | OPTS_TYPE_PT_UPPER
6899 | OPTS_TYPE_ST_ADD80
6900 | OPTS_TYPE_ST_ADDBITS15
6902 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6903 dgst_size
= DGST_SIZE_4_5
;
6904 parse_func
= mssql2000_parse_hash
;
6905 sort_by_digest
= sort_by_digest_4_5
;
6906 opti_type
= OPTI_TYPE_ZERO_BYTE
6907 | OPTI_TYPE_PRECOMPUTE_INIT
6908 | OPTI_TYPE_PRECOMPUTE_MERKLE
6909 | OPTI_TYPE_EARLY_SKIP
6910 | OPTI_TYPE_NOT_ITERATED
6911 | OPTI_TYPE_APPENDED_SALT
6912 | OPTI_TYPE_RAW_HASH
;
6919 case 132: hash_type
= HASH_TYPE_SHA1
;
6920 salt_type
= SALT_TYPE_EMBEDDED
;
6921 attack_exec
= ATTACK_EXEC_ON_GPU
;
6922 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6923 | OPTS_TYPE_PT_UNICODE
6924 | OPTS_TYPE_ST_ADD80
6925 | OPTS_TYPE_ST_ADDBITS15
6927 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6928 dgst_size
= DGST_SIZE_4_5
;
6929 parse_func
= mssql2005_parse_hash
;
6930 sort_by_digest
= sort_by_digest_4_5
;
6931 opti_type
= OPTI_TYPE_ZERO_BYTE
6932 | OPTI_TYPE_PRECOMPUTE_INIT
6933 | OPTI_TYPE_PRECOMPUTE_MERKLE
6934 | OPTI_TYPE_EARLY_SKIP
6935 | OPTI_TYPE_NOT_ITERATED
6936 | OPTI_TYPE_APPENDED_SALT
6937 | OPTI_TYPE_RAW_HASH
;
6944 case 133: hash_type
= HASH_TYPE_SHA1
;
6945 salt_type
= SALT_TYPE_EMBEDDED
;
6946 attack_exec
= ATTACK_EXEC_ON_GPU
;
6947 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6948 | OPTS_TYPE_PT_UNICODE
6949 | OPTS_TYPE_ST_ADD80
6950 | OPTS_TYPE_ST_ADDBITS15
;
6951 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6952 dgst_size
= DGST_SIZE_4_5
;
6953 parse_func
= peoplesoft_parse_hash
;
6954 sort_by_digest
= sort_by_digest_4_5
;
6955 opti_type
= OPTI_TYPE_ZERO_BYTE
6956 | OPTI_TYPE_PRECOMPUTE_INIT
6957 | OPTI_TYPE_PRECOMPUTE_MERKLE
6958 | OPTI_TYPE_EARLY_SKIP
6959 | OPTI_TYPE_NOT_ITERATED
6960 | OPTI_TYPE_APPENDED_SALT
6961 | OPTI_TYPE_RAW_HASH
;
6968 case 140: hash_type
= HASH_TYPE_SHA1
;
6969 salt_type
= SALT_TYPE_INTERN
;
6970 attack_exec
= ATTACK_EXEC_ON_GPU
;
6971 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6972 | OPTS_TYPE_PT_ADD80
6973 | OPTS_TYPE_PT_ADDBITS15
6974 | OPTS_TYPE_PT_UNICODE
;
6975 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
6976 dgst_size
= DGST_SIZE_4_5
;
6977 parse_func
= sha1s_parse_hash
;
6978 sort_by_digest
= sort_by_digest_4_5
;
6979 opti_type
= OPTI_TYPE_ZERO_BYTE
6980 | OPTI_TYPE_PRECOMPUTE_INIT
6981 | OPTI_TYPE_PRECOMPUTE_MERKLE
6982 | OPTI_TYPE_EARLY_SKIP
6983 | OPTI_TYPE_NOT_ITERATED
6984 | OPTI_TYPE_PREPENDED_SALT
6985 | OPTI_TYPE_RAW_HASH
;
6992 case 141: hash_type
= HASH_TYPE_SHA1
;
6993 salt_type
= SALT_TYPE_EMBEDDED
;
6994 attack_exec
= ATTACK_EXEC_ON_GPU
;
6995 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6996 | OPTS_TYPE_PT_ADD80
6997 | OPTS_TYPE_PT_ADDBITS15
6998 | OPTS_TYPE_PT_UNICODE
6999 | OPTS_TYPE_ST_BASE64
;
7000 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7001 dgst_size
= DGST_SIZE_4_5
;
7002 parse_func
= episerver_parse_hash
;
7003 sort_by_digest
= sort_by_digest_4_5
;
7004 opti_type
= OPTI_TYPE_ZERO_BYTE
7005 | OPTI_TYPE_PRECOMPUTE_INIT
7006 | OPTI_TYPE_PRECOMPUTE_MERKLE
7007 | OPTI_TYPE_EARLY_SKIP
7008 | OPTI_TYPE_NOT_ITERATED
7009 | OPTI_TYPE_PREPENDED_SALT
7010 | OPTI_TYPE_RAW_HASH
;
7017 case 150: hash_type
= HASH_TYPE_SHA1
;
7018 salt_type
= SALT_TYPE_INTERN
;
7019 attack_exec
= ATTACK_EXEC_ON_GPU
;
7020 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7021 | OPTS_TYPE_ST_ADD80
7022 | OPTS_TYPE_ST_ADDBITS15
;
7023 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7024 dgst_size
= DGST_SIZE_4_5
;
7025 parse_func
= hmacsha1_parse_hash
;
7026 sort_by_digest
= sort_by_digest_4_5
;
7027 opti_type
= OPTI_TYPE_ZERO_BYTE
7028 | OPTI_TYPE_NOT_ITERATED
;
7035 case 160: hash_type
= HASH_TYPE_SHA1
;
7036 salt_type
= SALT_TYPE_INTERN
;
7037 attack_exec
= ATTACK_EXEC_ON_GPU
;
7038 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7039 | OPTS_TYPE_PT_ADD80
7040 | OPTS_TYPE_PT_ADDBITS15
;
7041 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7042 dgst_size
= DGST_SIZE_4_5
;
7043 parse_func
= hmacsha1_parse_hash
;
7044 sort_by_digest
= sort_by_digest_4_5
;
7045 opti_type
= OPTI_TYPE_ZERO_BYTE
7046 | OPTI_TYPE_NOT_ITERATED
;
7053 case 190: hash_type
= HASH_TYPE_SHA1
;
7054 salt_type
= SALT_TYPE_NONE
;
7055 attack_exec
= ATTACK_EXEC_ON_GPU
;
7056 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7057 | OPTS_TYPE_PT_ADD80
7058 | OPTS_TYPE_PT_ADDBITS15
;
7059 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7060 dgst_size
= DGST_SIZE_4_5
;
7061 parse_func
= sha1linkedin_parse_hash
;
7062 sort_by_digest
= sort_by_digest_4_5
;
7063 opti_type
= OPTI_TYPE_ZERO_BYTE
7064 | OPTI_TYPE_PRECOMPUTE_INIT
7065 | OPTI_TYPE_EARLY_SKIP
7066 | OPTI_TYPE_NOT_ITERATED
7067 | OPTI_TYPE_NOT_SALTED
;
7074 case 200: hash_type
= HASH_TYPE_MYSQL
;
7075 salt_type
= SALT_TYPE_NONE
;
7076 attack_exec
= ATTACK_EXEC_ON_GPU
;
7078 kern_type
= KERN_TYPE_MYSQL
;
7079 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7080 parse_func
= mysql323_parse_hash
;
7081 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7082 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7089 case 300: hash_type
= HASH_TYPE_SHA1
;
7090 salt_type
= SALT_TYPE_NONE
;
7091 attack_exec
= ATTACK_EXEC_ON_GPU
;
7092 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7093 | OPTS_TYPE_PT_ADD80
7094 | OPTS_TYPE_PT_ADDBITS15
;
7095 kern_type
= KERN_TYPE_MYSQL41
;
7096 dgst_size
= DGST_SIZE_4_5
;
7097 parse_func
= sha1_parse_hash
;
7098 sort_by_digest
= sort_by_digest_4_5
;
7099 opti_type
= OPTI_TYPE_ZERO_BYTE
7100 | OPTI_TYPE_PRECOMPUTE_INIT
7101 | OPTI_TYPE_PRECOMPUTE_MERKLE
7102 | OPTI_TYPE_EARLY_SKIP
7103 | OPTI_TYPE_NOT_ITERATED
7104 | OPTI_TYPE_NOT_SALTED
;
7111 case 400: hash_type
= HASH_TYPE_MD5
;
7112 salt_type
= SALT_TYPE_EMBEDDED
;
7113 attack_exec
= ATTACK_EXEC_ON_CPU
;
7114 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7115 kern_type
= KERN_TYPE_PHPASS
;
7116 dgst_size
= DGST_SIZE_4_4
;
7117 parse_func
= phpass_parse_hash
;
7118 sort_by_digest
= sort_by_digest_4_4
;
7119 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7126 case 500: hash_type
= HASH_TYPE_MD5
;
7127 salt_type
= SALT_TYPE_EMBEDDED
;
7128 attack_exec
= ATTACK_EXEC_ON_CPU
;
7129 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7130 kern_type
= KERN_TYPE_MD5CRYPT
;
7131 dgst_size
= DGST_SIZE_4_4
;
7132 parse_func
= md5crypt_parse_hash
;
7133 sort_by_digest
= sort_by_digest_4_4
;
7134 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7141 case 501: hash_type
= HASH_TYPE_MD5
;
7142 salt_type
= SALT_TYPE_EMBEDDED
;
7143 attack_exec
= ATTACK_EXEC_ON_CPU
;
7144 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7145 | OPTS_TYPE_HASH_COPY
;
7146 kern_type
= KERN_TYPE_MD5CRYPT
;
7147 dgst_size
= DGST_SIZE_4_4
;
7148 parse_func
= juniper_parse_hash
;
7149 sort_by_digest
= sort_by_digest_4_4
;
7150 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7157 case 900: hash_type
= HASH_TYPE_MD4
;
7158 salt_type
= SALT_TYPE_NONE
;
7159 attack_exec
= ATTACK_EXEC_ON_GPU
;
7160 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7161 | OPTS_TYPE_PT_ADD80
7162 | OPTS_TYPE_PT_ADDBITS14
;
7163 kern_type
= KERN_TYPE_MD4
;
7164 dgst_size
= DGST_SIZE_4_4
;
7165 parse_func
= md4_parse_hash
;
7166 sort_by_digest
= sort_by_digest_4_4
;
7167 opti_type
= OPTI_TYPE_ZERO_BYTE
7168 | OPTI_TYPE_PRECOMPUTE_INIT
7169 | OPTI_TYPE_PRECOMPUTE_MERKLE
7170 | OPTI_TYPE_MEET_IN_MIDDLE
7171 | OPTI_TYPE_EARLY_SKIP
7172 | OPTI_TYPE_NOT_ITERATED
7173 | OPTI_TYPE_NOT_SALTED
7174 | OPTI_TYPE_RAW_HASH
;
7181 case 1000: hash_type
= HASH_TYPE_MD4
;
7182 salt_type
= SALT_TYPE_NONE
;
7183 attack_exec
= ATTACK_EXEC_ON_GPU
;
7184 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7185 | OPTS_TYPE_PT_ADD80
7186 | OPTS_TYPE_PT_ADDBITS14
7187 | OPTS_TYPE_PT_UNICODE
;
7188 kern_type
= KERN_TYPE_MD4_PWU
;
7189 dgst_size
= DGST_SIZE_4_4
;
7190 parse_func
= md4_parse_hash
;
7191 sort_by_digest
= sort_by_digest_4_4
;
7192 opti_type
= OPTI_TYPE_ZERO_BYTE
7193 | OPTI_TYPE_PRECOMPUTE_INIT
7194 | OPTI_TYPE_PRECOMPUTE_MERKLE
7195 | OPTI_TYPE_MEET_IN_MIDDLE
7196 | OPTI_TYPE_EARLY_SKIP
7197 | OPTI_TYPE_NOT_ITERATED
7198 | OPTI_TYPE_NOT_SALTED
7199 | OPTI_TYPE_RAW_HASH
;
7206 case 1100: hash_type
= HASH_TYPE_MD4
;
7207 salt_type
= SALT_TYPE_INTERN
;
7208 attack_exec
= ATTACK_EXEC_ON_GPU
;
7209 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7210 | OPTS_TYPE_PT_ADD80
7211 | OPTS_TYPE_PT_ADDBITS14
7212 | OPTS_TYPE_PT_UNICODE
7213 | OPTS_TYPE_ST_ADD80
7214 | OPTS_TYPE_ST_UNICODE
7215 | OPTS_TYPE_ST_LOWER
;
7216 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7217 dgst_size
= DGST_SIZE_4_4
;
7218 parse_func
= dcc_parse_hash
;
7219 sort_by_digest
= sort_by_digest_4_4
;
7220 opti_type
= OPTI_TYPE_ZERO_BYTE
7221 | OPTI_TYPE_PRECOMPUTE_INIT
7222 | OPTI_TYPE_PRECOMPUTE_MERKLE
7223 | OPTI_TYPE_EARLY_SKIP
7224 | OPTI_TYPE_NOT_ITERATED
;
7231 case 1400: hash_type
= HASH_TYPE_SHA256
;
7232 salt_type
= SALT_TYPE_NONE
;
7233 attack_exec
= ATTACK_EXEC_ON_GPU
;
7234 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7235 | OPTS_TYPE_PT_ADD80
7236 | OPTS_TYPE_PT_ADDBITS15
;
7237 kern_type
= KERN_TYPE_SHA256
;
7238 dgst_size
= DGST_SIZE_4_8
;
7239 parse_func
= sha256_parse_hash
;
7240 sort_by_digest
= sort_by_digest_4_8
;
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
7246 | OPTI_TYPE_NOT_SALTED
7247 | OPTI_TYPE_RAW_HASH
;
7254 case 1410: hash_type
= HASH_TYPE_SHA256
;
7255 salt_type
= SALT_TYPE_INTERN
;
7256 attack_exec
= ATTACK_EXEC_ON_GPU
;
7257 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7258 | OPTS_TYPE_ST_ADD80
7259 | OPTS_TYPE_ST_ADDBITS15
;
7260 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7261 dgst_size
= DGST_SIZE_4_8
;
7262 parse_func
= sha256s_parse_hash
;
7263 sort_by_digest
= sort_by_digest_4_8
;
7264 opti_type
= OPTI_TYPE_ZERO_BYTE
7265 | OPTI_TYPE_PRECOMPUTE_INIT
7266 | OPTI_TYPE_PRECOMPUTE_MERKLE
7267 | OPTI_TYPE_EARLY_SKIP
7268 | OPTI_TYPE_NOT_ITERATED
7269 | OPTI_TYPE_APPENDED_SALT
7270 | OPTI_TYPE_RAW_HASH
;
7277 case 1420: hash_type
= HASH_TYPE_SHA256
;
7278 salt_type
= SALT_TYPE_INTERN
;
7279 attack_exec
= ATTACK_EXEC_ON_GPU
;
7280 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7281 | OPTS_TYPE_PT_ADD80
7282 | OPTS_TYPE_PT_ADDBITS15
;
7283 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7284 dgst_size
= DGST_SIZE_4_8
;
7285 parse_func
= sha256s_parse_hash
;
7286 sort_by_digest
= sort_by_digest_4_8
;
7287 opti_type
= OPTI_TYPE_ZERO_BYTE
7288 | OPTI_TYPE_PRECOMPUTE_INIT
7289 | OPTI_TYPE_PRECOMPUTE_MERKLE
7290 | OPTI_TYPE_EARLY_SKIP
7291 | OPTI_TYPE_NOT_ITERATED
7292 | OPTI_TYPE_PREPENDED_SALT
7293 | OPTI_TYPE_RAW_HASH
;
7300 case 1421: hash_type
= HASH_TYPE_SHA256
;
7301 salt_type
= SALT_TYPE_EMBEDDED
;
7302 attack_exec
= ATTACK_EXEC_ON_GPU
;
7303 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7304 | OPTS_TYPE_PT_ADD80
7305 | OPTS_TYPE_PT_ADDBITS15
;
7306 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7307 dgst_size
= DGST_SIZE_4_8
;
7308 parse_func
= hmailserver_parse_hash
;
7309 sort_by_digest
= sort_by_digest_4_8
;
7310 opti_type
= OPTI_TYPE_ZERO_BYTE
7311 | OPTI_TYPE_PRECOMPUTE_INIT
7312 | OPTI_TYPE_PRECOMPUTE_MERKLE
7313 | OPTI_TYPE_EARLY_SKIP
7314 | OPTI_TYPE_NOT_ITERATED
7315 | OPTI_TYPE_PREPENDED_SALT
7316 | OPTI_TYPE_RAW_HASH
;
7323 case 1430: hash_type
= HASH_TYPE_SHA256
;
7324 salt_type
= SALT_TYPE_INTERN
;
7325 attack_exec
= ATTACK_EXEC_ON_GPU
;
7326 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7327 | OPTS_TYPE_PT_UNICODE
7328 | OPTS_TYPE_ST_ADD80
7329 | OPTS_TYPE_ST_ADDBITS15
;
7330 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7331 dgst_size
= DGST_SIZE_4_8
;
7332 parse_func
= sha256s_parse_hash
;
7333 sort_by_digest
= sort_by_digest_4_8
;
7334 opti_type
= OPTI_TYPE_ZERO_BYTE
7335 | OPTI_TYPE_PRECOMPUTE_INIT
7336 | OPTI_TYPE_PRECOMPUTE_MERKLE
7337 | OPTI_TYPE_EARLY_SKIP
7338 | OPTI_TYPE_NOT_ITERATED
7339 | OPTI_TYPE_APPENDED_SALT
7340 | OPTI_TYPE_RAW_HASH
;
7347 case 1440: hash_type
= HASH_TYPE_SHA256
;
7348 salt_type
= SALT_TYPE_INTERN
;
7349 attack_exec
= ATTACK_EXEC_ON_GPU
;
7350 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7351 | OPTS_TYPE_PT_ADD80
7352 | OPTS_TYPE_PT_ADDBITS15
7353 | OPTS_TYPE_PT_UNICODE
;
7354 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7355 dgst_size
= DGST_SIZE_4_8
;
7356 parse_func
= sha256s_parse_hash
;
7357 sort_by_digest
= sort_by_digest_4_8
;
7358 opti_type
= OPTI_TYPE_ZERO_BYTE
7359 | OPTI_TYPE_PRECOMPUTE_INIT
7360 | OPTI_TYPE_PRECOMPUTE_MERKLE
7361 | OPTI_TYPE_EARLY_SKIP
7362 | OPTI_TYPE_NOT_ITERATED
7363 | OPTI_TYPE_PREPENDED_SALT
7364 | OPTI_TYPE_RAW_HASH
;
7371 case 1441: hash_type
= HASH_TYPE_SHA256
;
7372 salt_type
= SALT_TYPE_EMBEDDED
;
7373 attack_exec
= ATTACK_EXEC_ON_GPU
;
7374 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7375 | OPTS_TYPE_PT_ADD80
7376 | OPTS_TYPE_PT_ADDBITS15
7377 | OPTS_TYPE_PT_UNICODE
7378 | OPTS_TYPE_ST_BASE64
;
7379 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7380 dgst_size
= DGST_SIZE_4_8
;
7381 parse_func
= episerver4_parse_hash
;
7382 sort_by_digest
= sort_by_digest_4_8
;
7383 opti_type
= OPTI_TYPE_ZERO_BYTE
7384 | OPTI_TYPE_PRECOMPUTE_INIT
7385 | OPTI_TYPE_PRECOMPUTE_MERKLE
7386 | OPTI_TYPE_EARLY_SKIP
7387 | OPTI_TYPE_NOT_ITERATED
7388 | OPTI_TYPE_PREPENDED_SALT
7389 | OPTI_TYPE_RAW_HASH
;
7396 case 1450: hash_type
= HASH_TYPE_SHA256
;
7397 salt_type
= SALT_TYPE_INTERN
;
7398 attack_exec
= ATTACK_EXEC_ON_GPU
;
7399 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7400 | OPTS_TYPE_ST_ADD80
;
7401 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7402 dgst_size
= DGST_SIZE_4_8
;
7403 parse_func
= hmacsha256_parse_hash
;
7404 sort_by_digest
= sort_by_digest_4_8
;
7405 opti_type
= OPTI_TYPE_ZERO_BYTE
7406 | OPTI_TYPE_NOT_ITERATED
;
7413 case 1460: hash_type
= HASH_TYPE_SHA256
;
7414 salt_type
= SALT_TYPE_INTERN
;
7415 attack_exec
= ATTACK_EXEC_ON_GPU
;
7416 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7417 | OPTS_TYPE_PT_ADD80
7418 | OPTS_TYPE_PT_ADDBITS15
;
7419 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7420 dgst_size
= DGST_SIZE_4_8
;
7421 parse_func
= hmacsha256_parse_hash
;
7422 sort_by_digest
= sort_by_digest_4_8
;
7423 opti_type
= OPTI_TYPE_ZERO_BYTE
7424 | OPTI_TYPE_NOT_ITERATED
;
7431 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7432 salt_type
= SALT_TYPE_EMBEDDED
;
7433 attack_exec
= ATTACK_EXEC_ON_GPU
;
7434 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7435 | OPTS_TYPE_PT_BITSLICE
;
7436 kern_type
= KERN_TYPE_DESCRYPT
;
7437 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7438 parse_func
= descrypt_parse_hash
;
7439 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7440 opti_type
= OPTI_TYPE_ZERO_BYTE
7441 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7448 case 1600: hash_type
= HASH_TYPE_MD5
;
7449 salt_type
= SALT_TYPE_EMBEDDED
;
7450 attack_exec
= ATTACK_EXEC_ON_CPU
;
7451 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7452 kern_type
= KERN_TYPE_APR1CRYPT
;
7453 dgst_size
= DGST_SIZE_4_4
;
7454 parse_func
= md5apr1_parse_hash
;
7455 sort_by_digest
= sort_by_digest_4_4
;
7456 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7463 case 1700: hash_type
= HASH_TYPE_SHA512
;
7464 salt_type
= SALT_TYPE_NONE
;
7465 attack_exec
= ATTACK_EXEC_ON_GPU
;
7466 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7467 | OPTS_TYPE_PT_ADD80
7468 | OPTS_TYPE_PT_ADDBITS15
;
7469 kern_type
= KERN_TYPE_SHA512
;
7470 dgst_size
= DGST_SIZE_8_8
;
7471 parse_func
= sha512_parse_hash
;
7472 sort_by_digest
= sort_by_digest_8_8
;
7473 opti_type
= OPTI_TYPE_ZERO_BYTE
7474 | OPTI_TYPE_PRECOMPUTE_INIT
7475 | OPTI_TYPE_PRECOMPUTE_MERKLE
7476 | OPTI_TYPE_EARLY_SKIP
7477 | OPTI_TYPE_NOT_ITERATED
7478 | OPTI_TYPE_NOT_SALTED
7479 | OPTI_TYPE_RAW_HASH
;
7486 case 1710: hash_type
= HASH_TYPE_SHA512
;
7487 salt_type
= SALT_TYPE_INTERN
;
7488 attack_exec
= ATTACK_EXEC_ON_GPU
;
7489 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7490 | OPTS_TYPE_ST_ADD80
7491 | OPTS_TYPE_ST_ADDBITS15
;
7492 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7493 dgst_size
= DGST_SIZE_8_8
;
7494 parse_func
= sha512s_parse_hash
;
7495 sort_by_digest
= sort_by_digest_8_8
;
7496 opti_type
= OPTI_TYPE_ZERO_BYTE
7497 | OPTI_TYPE_PRECOMPUTE_INIT
7498 | OPTI_TYPE_PRECOMPUTE_MERKLE
7499 | OPTI_TYPE_EARLY_SKIP
7500 | OPTI_TYPE_NOT_ITERATED
7501 | OPTI_TYPE_APPENDED_SALT
7502 | OPTI_TYPE_RAW_HASH
;
7509 case 1711: hash_type
= HASH_TYPE_SHA512
;
7510 salt_type
= SALT_TYPE_EMBEDDED
;
7511 attack_exec
= ATTACK_EXEC_ON_GPU
;
7512 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7513 | OPTS_TYPE_ST_ADD80
7514 | OPTS_TYPE_ST_ADDBITS15
;
7515 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7516 dgst_size
= DGST_SIZE_8_8
;
7517 parse_func
= sha512b64s_parse_hash
;
7518 sort_by_digest
= sort_by_digest_8_8
;
7519 opti_type
= OPTI_TYPE_ZERO_BYTE
7520 | OPTI_TYPE_PRECOMPUTE_INIT
7521 | OPTI_TYPE_PRECOMPUTE_MERKLE
7522 | OPTI_TYPE_EARLY_SKIP
7523 | OPTI_TYPE_NOT_ITERATED
7524 | OPTI_TYPE_APPENDED_SALT
7525 | OPTI_TYPE_RAW_HASH
;
7532 case 1720: hash_type
= HASH_TYPE_SHA512
;
7533 salt_type
= SALT_TYPE_INTERN
;
7534 attack_exec
= ATTACK_EXEC_ON_GPU
;
7535 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7536 | OPTS_TYPE_PT_ADD80
7537 | OPTS_TYPE_PT_ADDBITS15
;
7538 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7539 dgst_size
= DGST_SIZE_8_8
;
7540 parse_func
= sha512s_parse_hash
;
7541 sort_by_digest
= sort_by_digest_8_8
;
7542 opti_type
= OPTI_TYPE_ZERO_BYTE
7543 | OPTI_TYPE_PRECOMPUTE_INIT
7544 | OPTI_TYPE_PRECOMPUTE_MERKLE
7545 | OPTI_TYPE_EARLY_SKIP
7546 | OPTI_TYPE_NOT_ITERATED
7547 | OPTI_TYPE_PREPENDED_SALT
7548 | OPTI_TYPE_RAW_HASH
;
7555 case 1722: hash_type
= HASH_TYPE_SHA512
;
7556 salt_type
= SALT_TYPE_EMBEDDED
;
7557 attack_exec
= ATTACK_EXEC_ON_GPU
;
7558 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7559 | OPTS_TYPE_PT_ADD80
7560 | OPTS_TYPE_PT_ADDBITS15
7562 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7563 dgst_size
= DGST_SIZE_8_8
;
7564 parse_func
= osx512_parse_hash
;
7565 sort_by_digest
= sort_by_digest_8_8
;
7566 opti_type
= OPTI_TYPE_ZERO_BYTE
7567 | OPTI_TYPE_PRECOMPUTE_INIT
7568 | OPTI_TYPE_PRECOMPUTE_MERKLE
7569 | OPTI_TYPE_EARLY_SKIP
7570 | OPTI_TYPE_NOT_ITERATED
7571 | OPTI_TYPE_PREPENDED_SALT
7572 | OPTI_TYPE_RAW_HASH
;
7579 case 1730: hash_type
= HASH_TYPE_SHA512
;
7580 salt_type
= SALT_TYPE_INTERN
;
7581 attack_exec
= ATTACK_EXEC_ON_GPU
;
7582 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7583 | OPTS_TYPE_PT_UNICODE
7584 | OPTS_TYPE_ST_ADD80
7585 | OPTS_TYPE_ST_ADDBITS15
;
7586 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7587 dgst_size
= DGST_SIZE_8_8
;
7588 parse_func
= sha512s_parse_hash
;
7589 sort_by_digest
= sort_by_digest_8_8
;
7590 opti_type
= OPTI_TYPE_ZERO_BYTE
7591 | OPTI_TYPE_PRECOMPUTE_INIT
7592 | OPTI_TYPE_PRECOMPUTE_MERKLE
7593 | OPTI_TYPE_EARLY_SKIP
7594 | OPTI_TYPE_NOT_ITERATED
7595 | OPTI_TYPE_APPENDED_SALT
7596 | OPTI_TYPE_RAW_HASH
;
7603 case 1731: hash_type
= HASH_TYPE_SHA512
;
7604 salt_type
= SALT_TYPE_EMBEDDED
;
7605 attack_exec
= ATTACK_EXEC_ON_GPU
;
7606 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7607 | OPTS_TYPE_PT_UNICODE
7608 | OPTS_TYPE_ST_ADD80
7609 | OPTS_TYPE_ST_ADDBITS15
7611 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7612 dgst_size
= DGST_SIZE_8_8
;
7613 parse_func
= mssql2012_parse_hash
;
7614 sort_by_digest
= sort_by_digest_8_8
;
7615 opti_type
= OPTI_TYPE_ZERO_BYTE
7616 | OPTI_TYPE_PRECOMPUTE_INIT
7617 | OPTI_TYPE_PRECOMPUTE_MERKLE
7618 | OPTI_TYPE_EARLY_SKIP
7619 | OPTI_TYPE_NOT_ITERATED
7620 | OPTI_TYPE_APPENDED_SALT
7621 | OPTI_TYPE_RAW_HASH
;
7628 case 1740: hash_type
= HASH_TYPE_SHA512
;
7629 salt_type
= SALT_TYPE_INTERN
;
7630 attack_exec
= ATTACK_EXEC_ON_GPU
;
7631 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7632 | OPTS_TYPE_PT_ADD80
7633 | OPTS_TYPE_PT_ADDBITS15
7634 | OPTS_TYPE_PT_UNICODE
;
7635 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7636 dgst_size
= DGST_SIZE_8_8
;
7637 parse_func
= sha512s_parse_hash
;
7638 sort_by_digest
= sort_by_digest_8_8
;
7639 opti_type
= OPTI_TYPE_ZERO_BYTE
7640 | OPTI_TYPE_PRECOMPUTE_INIT
7641 | OPTI_TYPE_PRECOMPUTE_MERKLE
7642 | OPTI_TYPE_EARLY_SKIP
7643 | OPTI_TYPE_NOT_ITERATED
7644 | OPTI_TYPE_PREPENDED_SALT
7645 | OPTI_TYPE_RAW_HASH
;
7652 case 1750: hash_type
= HASH_TYPE_SHA512
;
7653 salt_type
= SALT_TYPE_INTERN
;
7654 attack_exec
= ATTACK_EXEC_ON_GPU
;
7655 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7656 | OPTS_TYPE_ST_ADD80
;
7657 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7658 dgst_size
= DGST_SIZE_8_8
;
7659 parse_func
= hmacsha512_parse_hash
;
7660 sort_by_digest
= sort_by_digest_8_8
;
7661 opti_type
= OPTI_TYPE_ZERO_BYTE
7662 | OPTI_TYPE_NOT_ITERATED
;
7669 case 1760: hash_type
= HASH_TYPE_SHA512
;
7670 salt_type
= SALT_TYPE_INTERN
;
7671 attack_exec
= ATTACK_EXEC_ON_GPU
;
7672 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7673 | OPTS_TYPE_PT_ADD80
7674 | OPTS_TYPE_PT_ADDBITS15
;
7675 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7676 dgst_size
= DGST_SIZE_8_8
;
7677 parse_func
= hmacsha512_parse_hash
;
7678 sort_by_digest
= sort_by_digest_8_8
;
7679 opti_type
= OPTI_TYPE_ZERO_BYTE
7680 | OPTI_TYPE_NOT_ITERATED
;
7687 case 1800: hash_type
= HASH_TYPE_SHA512
;
7688 salt_type
= SALT_TYPE_EMBEDDED
;
7689 attack_exec
= ATTACK_EXEC_ON_CPU
;
7690 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7691 kern_type
= KERN_TYPE_SHA512CRYPT
;
7692 dgst_size
= DGST_SIZE_8_8
;
7693 parse_func
= sha512crypt_parse_hash
;
7694 sort_by_digest
= sort_by_digest_8_8
;
7695 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7702 case 2100: hash_type
= HASH_TYPE_DCC2
;
7703 salt_type
= SALT_TYPE_EMBEDDED
;
7704 attack_exec
= ATTACK_EXEC_ON_CPU
;
7705 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7706 | OPTS_TYPE_ST_LOWER
7707 | OPTS_TYPE_ST_UNICODE
;
7708 kern_type
= KERN_TYPE_DCC2
;
7709 dgst_size
= DGST_SIZE_4_4
;
7710 parse_func
= dcc2_parse_hash
;
7711 sort_by_digest
= sort_by_digest_4_4
;
7712 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7719 case 2400: hash_type
= HASH_TYPE_MD5
;
7720 salt_type
= SALT_TYPE_NONE
;
7721 attack_exec
= ATTACK_EXEC_ON_GPU
;
7722 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7723 kern_type
= KERN_TYPE_MD5PIX
;
7724 dgst_size
= DGST_SIZE_4_4
;
7725 parse_func
= md5pix_parse_hash
;
7726 sort_by_digest
= sort_by_digest_4_4
;
7727 opti_type
= OPTI_TYPE_ZERO_BYTE
7728 | OPTI_TYPE_PRECOMPUTE_INIT
7729 | OPTI_TYPE_PRECOMPUTE_MERKLE
7730 | OPTI_TYPE_EARLY_SKIP
7731 | OPTI_TYPE_NOT_ITERATED
7732 | OPTI_TYPE_NOT_SALTED
;
7739 case 2410: hash_type
= HASH_TYPE_MD5
;
7740 salt_type
= SALT_TYPE_INTERN
;
7741 attack_exec
= ATTACK_EXEC_ON_GPU
;
7742 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7743 kern_type
= KERN_TYPE_MD5ASA
;
7744 dgst_size
= DGST_SIZE_4_4
;
7745 parse_func
= md5asa_parse_hash
;
7746 sort_by_digest
= sort_by_digest_4_4
;
7747 opti_type
= OPTI_TYPE_ZERO_BYTE
7748 | OPTI_TYPE_PRECOMPUTE_INIT
7749 | OPTI_TYPE_PRECOMPUTE_MERKLE
7750 | OPTI_TYPE_EARLY_SKIP
7751 | OPTI_TYPE_NOT_ITERATED
;
7758 case 2500: hash_type
= HASH_TYPE_WPA
;
7759 salt_type
= SALT_TYPE_EMBEDDED
;
7760 attack_exec
= ATTACK_EXEC_ON_CPU
;
7761 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7762 kern_type
= KERN_TYPE_WPA
;
7763 dgst_size
= DGST_SIZE_4_4
;
7764 parse_func
= wpa_parse_hash
;
7765 sort_by_digest
= sort_by_digest_4_4
;
7766 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7773 case 2600: hash_type
= HASH_TYPE_MD5
;
7774 salt_type
= SALT_TYPE_VIRTUAL
;
7775 attack_exec
= ATTACK_EXEC_ON_GPU
;
7776 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7777 | OPTS_TYPE_PT_ADD80
7778 | OPTS_TYPE_PT_ADDBITS14
7779 | OPTS_TYPE_ST_ADD80
;
7780 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7781 dgst_size
= DGST_SIZE_4_4
;
7782 parse_func
= md5md5_parse_hash
;
7783 sort_by_digest
= sort_by_digest_4_4
;
7784 opti_type
= OPTI_TYPE_ZERO_BYTE
7785 | OPTI_TYPE_PRECOMPUTE_INIT
7786 | OPTI_TYPE_PRECOMPUTE_MERKLE
7787 | OPTI_TYPE_EARLY_SKIP
;
7794 case 2611: hash_type
= HASH_TYPE_MD5
;
7795 salt_type
= SALT_TYPE_INTERN
;
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
= vb3_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 2612: hash_type
= HASH_TYPE_MD5
;
7816 salt_type
= SALT_TYPE_EMBEDDED
;
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
7823 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7824 dgst_size
= DGST_SIZE_4_4
;
7825 parse_func
= phps_parse_hash
;
7826 sort_by_digest
= sort_by_digest_4_4
;
7827 opti_type
= OPTI_TYPE_ZERO_BYTE
7828 | OPTI_TYPE_PRECOMPUTE_INIT
7829 | OPTI_TYPE_PRECOMPUTE_MERKLE
7830 | OPTI_TYPE_EARLY_SKIP
;
7837 case 2711: hash_type
= HASH_TYPE_MD5
;
7838 salt_type
= SALT_TYPE_INTERN
;
7839 attack_exec
= ATTACK_EXEC_ON_GPU
;
7840 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7841 | OPTS_TYPE_PT_ADD80
7842 | OPTS_TYPE_PT_ADDBITS14
7843 | OPTS_TYPE_ST_ADD80
;
7844 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7845 dgst_size
= DGST_SIZE_4_4
;
7846 parse_func
= vb30_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_EARLY_SKIP
;
7857 case 2811: hash_type
= HASH_TYPE_MD5
;
7858 salt_type
= SALT_TYPE_INTERN
;
7859 attack_exec
= ATTACK_EXEC_ON_GPU
;
7860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7861 | OPTS_TYPE_PT_ADD80
7862 | OPTS_TYPE_PT_ADDBITS14
;
7863 kern_type
= KERN_TYPE_MD55_SLTPW
;
7864 dgst_size
= DGST_SIZE_4_4
;
7865 parse_func
= ipb2_parse_hash
;
7866 sort_by_digest
= sort_by_digest_4_4
;
7867 opti_type
= OPTI_TYPE_ZERO_BYTE
7868 | OPTI_TYPE_PRECOMPUTE_INIT
7869 | OPTI_TYPE_EARLY_SKIP
;
7876 case 3000: hash_type
= HASH_TYPE_LM
;
7877 salt_type
= SALT_TYPE_NONE
;
7878 attack_exec
= ATTACK_EXEC_ON_GPU
;
7879 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7880 | OPTS_TYPE_PT_UPPER
7881 | OPTS_TYPE_PT_BITSLICE
;
7882 kern_type
= KERN_TYPE_LM
;
7883 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7884 parse_func
= lm_parse_hash
;
7885 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7886 opti_type
= OPTI_TYPE_ZERO_BYTE
7887 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7894 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7895 salt_type
= SALT_TYPE_INTERN
;
7896 attack_exec
= ATTACK_EXEC_ON_GPU
;
7897 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7898 | OPTS_TYPE_PT_UPPER
7899 | OPTS_TYPE_ST_UPPER
;
7900 kern_type
= KERN_TYPE_ORACLEH
;
7901 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7902 parse_func
= oracleh_parse_hash
;
7903 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7904 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7911 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7912 salt_type
= SALT_TYPE_EMBEDDED
;
7913 attack_exec
= ATTACK_EXEC_ON_CPU
;
7914 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7915 | OPTS_TYPE_ST_GENERATE_LE
;
7916 kern_type
= KERN_TYPE_BCRYPT
;
7917 dgst_size
= DGST_SIZE_4_6
;
7918 parse_func
= bcrypt_parse_hash
;
7919 sort_by_digest
= sort_by_digest_4_6
;
7920 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7927 case 3710: hash_type
= HASH_TYPE_MD5
;
7928 salt_type
= SALT_TYPE_INTERN
;
7929 attack_exec
= ATTACK_EXEC_ON_GPU
;
7930 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7931 | OPTS_TYPE_PT_ADD80
7932 | OPTS_TYPE_PT_ADDBITS14
;
7933 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7934 dgst_size
= DGST_SIZE_4_4
;
7935 parse_func
= md5s_parse_hash
;
7936 sort_by_digest
= sort_by_digest_4_4
;
7937 opti_type
= OPTI_TYPE_ZERO_BYTE
7938 | OPTI_TYPE_PRECOMPUTE_INIT
7939 | OPTI_TYPE_PRECOMPUTE_MERKLE
7940 | OPTI_TYPE_EARLY_SKIP
;
7947 case 3711: hash_type
= HASH_TYPE_MD5
;
7948 salt_type
= SALT_TYPE_EMBEDDED
;
7949 attack_exec
= ATTACK_EXEC_ON_GPU
;
7950 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7951 | OPTS_TYPE_PT_ADD80
7952 | OPTS_TYPE_PT_ADDBITS14
;
7953 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
7954 dgst_size
= DGST_SIZE_4_4
;
7955 parse_func
= mediawiki_b_parse_hash
;
7956 sort_by_digest
= sort_by_digest_4_4
;
7957 opti_type
= OPTI_TYPE_ZERO_BYTE
7958 | OPTI_TYPE_PRECOMPUTE_INIT
7959 | OPTI_TYPE_PRECOMPUTE_MERKLE
7960 | OPTI_TYPE_EARLY_SKIP
;
7967 case 3800: hash_type
= HASH_TYPE_MD5
;
7968 salt_type
= SALT_TYPE_INTERN
;
7969 attack_exec
= ATTACK_EXEC_ON_GPU
;
7970 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7971 | OPTS_TYPE_ST_ADDBITS14
;
7972 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
7973 dgst_size
= DGST_SIZE_4_4
;
7974 parse_func
= md5s_parse_hash
;
7975 sort_by_digest
= sort_by_digest_4_4
;
7976 opti_type
= OPTI_TYPE_ZERO_BYTE
7977 | OPTI_TYPE_PRECOMPUTE_INIT
7978 | OPTI_TYPE_PRECOMPUTE_MERKLE
7979 | OPTI_TYPE_EARLY_SKIP
7980 | OPTI_TYPE_NOT_ITERATED
7981 | OPTI_TYPE_RAW_HASH
;
7988 case 4300: hash_type
= HASH_TYPE_MD5
;
7989 salt_type
= SALT_TYPE_VIRTUAL
;
7990 attack_exec
= ATTACK_EXEC_ON_GPU
;
7991 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7992 | OPTS_TYPE_PT_ADD80
7993 | OPTS_TYPE_PT_ADDBITS14
7994 | OPTS_TYPE_ST_ADD80
;
7995 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
7996 dgst_size
= DGST_SIZE_4_4
;
7997 parse_func
= md5md5_parse_hash
;
7998 sort_by_digest
= sort_by_digest_4_4
;
7999 opti_type
= OPTI_TYPE_ZERO_BYTE
8000 | OPTI_TYPE_PRECOMPUTE_INIT
8001 | OPTI_TYPE_PRECOMPUTE_MERKLE
8002 | OPTI_TYPE_EARLY_SKIP
;
8010 case 4400: hash_type
= HASH_TYPE_MD5
;
8011 salt_type
= SALT_TYPE_NONE
;
8012 attack_exec
= ATTACK_EXEC_ON_GPU
;
8013 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8014 | OPTS_TYPE_PT_ADD80
8015 | OPTS_TYPE_PT_ADDBITS15
;
8016 kern_type
= KERN_TYPE_MD5_SHA1
;
8017 dgst_size
= DGST_SIZE_4_4
;
8018 parse_func
= md5_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
8024 | OPTI_TYPE_NOT_ITERATED
8025 | OPTI_TYPE_NOT_SALTED
8026 | OPTI_TYPE_RAW_HASH
;
8033 case 4500: hash_type
= HASH_TYPE_SHA1
;
8034 salt_type
= SALT_TYPE_NONE
;
8035 attack_exec
= ATTACK_EXEC_ON_GPU
;
8036 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8037 | OPTS_TYPE_PT_ADD80
8038 | OPTS_TYPE_PT_ADDBITS15
;
8039 kern_type
= KERN_TYPE_SHA11
;
8040 dgst_size
= DGST_SIZE_4_5
;
8041 parse_func
= sha1_parse_hash
;
8042 sort_by_digest
= sort_by_digest_4_5
;
8043 opti_type
= OPTI_TYPE_ZERO_BYTE
8044 | OPTI_TYPE_PRECOMPUTE_INIT
8045 | OPTI_TYPE_PRECOMPUTE_MERKLE
8046 | OPTI_TYPE_EARLY_SKIP
8047 | OPTI_TYPE_NOT_SALTED
;
8054 case 4700: 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_LE
8058 | OPTS_TYPE_PT_ADD80
8059 | OPTS_TYPE_PT_ADDBITS14
;
8060 kern_type
= KERN_TYPE_SHA1_MD5
;
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_ITERATED
8069 | OPTI_TYPE_NOT_SALTED
8070 | OPTI_TYPE_RAW_HASH
;
8077 case 4800: hash_type
= HASH_TYPE_MD5
;
8078 salt_type
= SALT_TYPE_EMBEDDED
;
8079 attack_exec
= ATTACK_EXEC_ON_GPU
;
8080 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8081 | OPTS_TYPE_PT_ADDBITS14
;
8082 kern_type
= KERN_TYPE_MD5_CHAP
;
8083 dgst_size
= DGST_SIZE_4_4
;
8084 parse_func
= chap_parse_hash
;
8085 sort_by_digest
= sort_by_digest_4_4
;
8086 opti_type
= OPTI_TYPE_ZERO_BYTE
8087 | OPTI_TYPE_PRECOMPUTE_INIT
8088 | OPTI_TYPE_PRECOMPUTE_MERKLE
8089 | OPTI_TYPE_MEET_IN_MIDDLE
8090 | OPTI_TYPE_EARLY_SKIP
8091 | OPTI_TYPE_NOT_ITERATED
8092 | OPTI_TYPE_RAW_HASH
;
8099 case 4900: hash_type
= HASH_TYPE_SHA1
;
8100 salt_type
= SALT_TYPE_INTERN
;
8101 attack_exec
= ATTACK_EXEC_ON_GPU
;
8102 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8103 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8104 dgst_size
= DGST_SIZE_4_5
;
8105 parse_func
= sha1s_parse_hash
;
8106 sort_by_digest
= sort_by_digest_4_5
;
8107 opti_type
= OPTI_TYPE_ZERO_BYTE
8108 | OPTI_TYPE_PRECOMPUTE_INIT
8109 | OPTI_TYPE_PRECOMPUTE_MERKLE
8110 | OPTI_TYPE_EARLY_SKIP
;
8117 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8118 salt_type
= SALT_TYPE_EMBEDDED
;
8119 attack_exec
= ATTACK_EXEC_ON_GPU
;
8120 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8121 | OPTS_TYPE_PT_ADD01
;
8122 kern_type
= KERN_TYPE_KECCAK
;
8123 dgst_size
= DGST_SIZE_8_25
;
8124 parse_func
= keccak_parse_hash
;
8125 sort_by_digest
= sort_by_digest_8_25
;
8126 opti_type
= OPTI_TYPE_ZERO_BYTE
8127 | OPTI_TYPE_RAW_HASH
;
8134 case 5100: hash_type
= HASH_TYPE_MD5H
;
8135 salt_type
= SALT_TYPE_NONE
;
8136 attack_exec
= ATTACK_EXEC_ON_GPU
;
8137 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8138 | OPTS_TYPE_PT_ADD80
8139 | OPTS_TYPE_PT_ADDBITS14
;
8140 kern_type
= KERN_TYPE_MD5H
;
8141 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8142 parse_func
= md5half_parse_hash
;
8143 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8144 opti_type
= OPTI_TYPE_ZERO_BYTE
8145 | OPTI_TYPE_RAW_HASH
;
8152 case 5200: hash_type
= HASH_TYPE_SHA256
;
8153 salt_type
= SALT_TYPE_EMBEDDED
;
8154 attack_exec
= ATTACK_EXEC_ON_CPU
;
8155 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8156 kern_type
= KERN_TYPE_PSAFE3
;
8157 dgst_size
= DGST_SIZE_4_8
;
8158 parse_func
= psafe3_parse_hash
;
8159 sort_by_digest
= sort_by_digest_4_8
;
8160 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8167 case 5300: hash_type
= HASH_TYPE_MD5
;
8168 salt_type
= SALT_TYPE_EMBEDDED
;
8169 attack_exec
= ATTACK_EXEC_ON_GPU
;
8170 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8171 | OPTS_TYPE_ST_ADD80
;
8172 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8173 dgst_size
= DGST_SIZE_4_4
;
8174 parse_func
= ikepsk_md5_parse_hash
;
8175 sort_by_digest
= sort_by_digest_4_4
;
8176 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8183 case 5400: hash_type
= HASH_TYPE_SHA1
;
8184 salt_type
= SALT_TYPE_EMBEDDED
;
8185 attack_exec
= ATTACK_EXEC_ON_GPU
;
8186 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8187 | OPTS_TYPE_ST_ADD80
;
8188 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8189 dgst_size
= DGST_SIZE_4_5
;
8190 parse_func
= ikepsk_sha1_parse_hash
;
8191 sort_by_digest
= sort_by_digest_4_5
;
8192 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8199 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8200 salt_type
= SALT_TYPE_EMBEDDED
;
8201 attack_exec
= ATTACK_EXEC_ON_GPU
;
8202 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8203 | OPTS_TYPE_PT_ADD80
8204 | OPTS_TYPE_PT_ADDBITS14
8205 | OPTS_TYPE_PT_UNICODE
8207 kern_type
= KERN_TYPE_NETNTLMv1
;
8208 dgst_size
= DGST_SIZE_4_4
;
8209 parse_func
= netntlmv1_parse_hash
;
8210 sort_by_digest
= sort_by_digest_4_4
;
8211 opti_type
= OPTI_TYPE_ZERO_BYTE
8212 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8219 case 5600: hash_type
= HASH_TYPE_MD5
;
8220 salt_type
= SALT_TYPE_EMBEDDED
;
8221 attack_exec
= ATTACK_EXEC_ON_GPU
;
8222 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8223 | OPTS_TYPE_PT_ADD80
8224 | OPTS_TYPE_PT_ADDBITS14
8225 | OPTS_TYPE_PT_UNICODE
;
8226 kern_type
= KERN_TYPE_NETNTLMv2
;
8227 dgst_size
= DGST_SIZE_4_4
;
8228 parse_func
= netntlmv2_parse_hash
;
8229 sort_by_digest
= sort_by_digest_4_4
;
8230 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8237 case 5700: hash_type
= HASH_TYPE_SHA256
;
8238 salt_type
= SALT_TYPE_NONE
;
8239 attack_exec
= ATTACK_EXEC_ON_GPU
;
8240 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8241 | OPTS_TYPE_PT_ADD80
8242 | OPTS_TYPE_PT_ADDBITS15
;
8243 kern_type
= KERN_TYPE_SHA256
;
8244 dgst_size
= DGST_SIZE_4_8
;
8245 parse_func
= cisco4_parse_hash
;
8246 sort_by_digest
= sort_by_digest_4_8
;
8247 opti_type
= OPTI_TYPE_ZERO_BYTE
8248 | OPTI_TYPE_PRECOMPUTE_INIT
8249 | OPTI_TYPE_PRECOMPUTE_MERKLE
8250 | OPTI_TYPE_EARLY_SKIP
8251 | OPTI_TYPE_NOT_ITERATED
8252 | OPTI_TYPE_NOT_SALTED
8253 | OPTI_TYPE_RAW_HASH
;
8260 case 5800: hash_type
= HASH_TYPE_SHA1
;
8261 salt_type
= SALT_TYPE_INTERN
;
8262 attack_exec
= ATTACK_EXEC_ON_CPU
;
8263 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8264 | OPTS_TYPE_ST_ADD80
;
8265 kern_type
= KERN_TYPE_ANDROIDPIN
;
8266 dgst_size
= DGST_SIZE_4_5
;
8267 parse_func
= androidpin_parse_hash
;
8268 sort_by_digest
= sort_by_digest_4_5
;
8269 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8276 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8277 salt_type
= SALT_TYPE_NONE
;
8278 attack_exec
= ATTACK_EXEC_ON_GPU
;
8279 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8280 | OPTS_TYPE_PT_ADD80
;
8281 kern_type
= KERN_TYPE_RIPEMD160
;
8282 dgst_size
= DGST_SIZE_4_5
;
8283 parse_func
= ripemd160_parse_hash
;
8284 sort_by_digest
= sort_by_digest_4_5
;
8285 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8292 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8293 salt_type
= SALT_TYPE_NONE
;
8294 attack_exec
= ATTACK_EXEC_ON_GPU
;
8295 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8296 | OPTS_TYPE_PT_ADD80
;
8297 kern_type
= KERN_TYPE_WHIRLPOOL
;
8298 dgst_size
= DGST_SIZE_4_16
;
8299 parse_func
= whirlpool_parse_hash
;
8300 sort_by_digest
= sort_by_digest_4_16
;
8301 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8308 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8309 salt_type
= SALT_TYPE_EMBEDDED
;
8310 attack_exec
= ATTACK_EXEC_ON_CPU
;
8311 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8312 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8313 dgst_size
= DGST_SIZE_4_5
;
8314 parse_func
= truecrypt_parse_hash_2k
;
8315 sort_by_digest
= sort_by_digest_4_5
;
8316 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8323 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8324 salt_type
= SALT_TYPE_EMBEDDED
;
8325 attack_exec
= ATTACK_EXEC_ON_CPU
;
8326 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8327 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8328 dgst_size
= DGST_SIZE_4_5
;
8329 parse_func
= truecrypt_parse_hash_2k
;
8330 sort_by_digest
= sort_by_digest_4_5
;
8331 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8338 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8339 salt_type
= SALT_TYPE_EMBEDDED
;
8340 attack_exec
= ATTACK_EXEC_ON_CPU
;
8341 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8342 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8343 dgst_size
= DGST_SIZE_4_5
;
8344 parse_func
= truecrypt_parse_hash_2k
;
8345 sort_by_digest
= sort_by_digest_4_5
;
8346 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8353 case 6221: hash_type
= HASH_TYPE_SHA512
;
8354 salt_type
= SALT_TYPE_EMBEDDED
;
8355 attack_exec
= ATTACK_EXEC_ON_CPU
;
8356 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8357 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8358 dgst_size
= DGST_SIZE_8_8
;
8359 parse_func
= truecrypt_parse_hash_1k
;
8360 sort_by_digest
= sort_by_digest_8_8
;
8361 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8368 case 6222: hash_type
= HASH_TYPE_SHA512
;
8369 salt_type
= SALT_TYPE_EMBEDDED
;
8370 attack_exec
= ATTACK_EXEC_ON_CPU
;
8371 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8372 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8373 dgst_size
= DGST_SIZE_8_8
;
8374 parse_func
= truecrypt_parse_hash_1k
;
8375 sort_by_digest
= sort_by_digest_8_8
;
8376 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8383 case 6223: hash_type
= HASH_TYPE_SHA512
;
8384 salt_type
= SALT_TYPE_EMBEDDED
;
8385 attack_exec
= ATTACK_EXEC_ON_CPU
;
8386 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8387 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8388 dgst_size
= DGST_SIZE_8_8
;
8389 parse_func
= truecrypt_parse_hash_1k
;
8390 sort_by_digest
= sort_by_digest_8_8
;
8391 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8398 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8399 salt_type
= SALT_TYPE_EMBEDDED
;
8400 attack_exec
= ATTACK_EXEC_ON_CPU
;
8401 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8402 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8403 dgst_size
= DGST_SIZE_4_8
;
8404 parse_func
= truecrypt_parse_hash_1k
;
8405 sort_by_digest
= sort_by_digest_4_8
;
8406 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8413 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8414 salt_type
= SALT_TYPE_EMBEDDED
;
8415 attack_exec
= ATTACK_EXEC_ON_CPU
;
8416 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8417 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8418 dgst_size
= DGST_SIZE_4_8
;
8419 parse_func
= truecrypt_parse_hash_1k
;
8420 sort_by_digest
= sort_by_digest_4_8
;
8421 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8428 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8429 salt_type
= SALT_TYPE_EMBEDDED
;
8430 attack_exec
= ATTACK_EXEC_ON_CPU
;
8431 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8432 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8433 dgst_size
= DGST_SIZE_4_8
;
8434 parse_func
= truecrypt_parse_hash_1k
;
8435 sort_by_digest
= sort_by_digest_4_8
;
8436 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8443 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8444 salt_type
= SALT_TYPE_EMBEDDED
;
8445 attack_exec
= ATTACK_EXEC_ON_CPU
;
8446 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8447 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8448 dgst_size
= DGST_SIZE_4_5
;
8449 parse_func
= truecrypt_parse_hash_1k
;
8450 sort_by_digest
= sort_by_digest_4_5
;
8451 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8458 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8459 salt_type
= SALT_TYPE_EMBEDDED
;
8460 attack_exec
= ATTACK_EXEC_ON_CPU
;
8461 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8462 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8463 dgst_size
= DGST_SIZE_4_5
;
8464 parse_func
= truecrypt_parse_hash_1k
;
8465 sort_by_digest
= sort_by_digest_4_5
;
8466 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8473 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8474 salt_type
= SALT_TYPE_EMBEDDED
;
8475 attack_exec
= ATTACK_EXEC_ON_CPU
;
8476 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8477 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8478 dgst_size
= DGST_SIZE_4_5
;
8479 parse_func
= truecrypt_parse_hash_1k
;
8480 sort_by_digest
= sort_by_digest_4_5
;
8481 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8488 case 6300: hash_type
= HASH_TYPE_MD5
;
8489 salt_type
= SALT_TYPE_EMBEDDED
;
8490 attack_exec
= ATTACK_EXEC_ON_CPU
;
8491 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8492 kern_type
= KERN_TYPE_MD5AIX
;
8493 dgst_size
= DGST_SIZE_4_4
;
8494 parse_func
= md5aix_parse_hash
;
8495 sort_by_digest
= sort_by_digest_4_4
;
8496 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8503 case 6400: hash_type
= HASH_TYPE_SHA256
;
8504 salt_type
= SALT_TYPE_EMBEDDED
;
8505 attack_exec
= ATTACK_EXEC_ON_CPU
;
8506 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8507 kern_type
= KERN_TYPE_SHA256AIX
;
8508 dgst_size
= DGST_SIZE_4_8
;
8509 parse_func
= sha256aix_parse_hash
;
8510 sort_by_digest
= sort_by_digest_4_8
;
8511 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8518 case 6500: hash_type
= HASH_TYPE_SHA512
;
8519 salt_type
= SALT_TYPE_EMBEDDED
;
8520 attack_exec
= ATTACK_EXEC_ON_CPU
;
8521 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8522 kern_type
= KERN_TYPE_SHA512AIX
;
8523 dgst_size
= DGST_SIZE_8_8
;
8524 parse_func
= sha512aix_parse_hash
;
8525 sort_by_digest
= sort_by_digest_8_8
;
8526 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8533 case 6600: hash_type
= HASH_TYPE_AES
;
8534 salt_type
= SALT_TYPE_EMBEDDED
;
8535 attack_exec
= ATTACK_EXEC_ON_CPU
;
8536 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8537 kern_type
= KERN_TYPE_AGILEKEY
;
8538 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8539 parse_func
= agilekey_parse_hash
;
8540 sort_by_digest
= sort_by_digest_4_5
;
8541 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8548 case 6700: hash_type
= HASH_TYPE_SHA1
;
8549 salt_type
= SALT_TYPE_EMBEDDED
;
8550 attack_exec
= ATTACK_EXEC_ON_CPU
;
8551 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8552 kern_type
= KERN_TYPE_SHA1AIX
;
8553 dgst_size
= DGST_SIZE_4_5
;
8554 parse_func
= sha1aix_parse_hash
;
8555 sort_by_digest
= sort_by_digest_4_5
;
8556 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8563 case 6800: hash_type
= HASH_TYPE_AES
;
8564 salt_type
= SALT_TYPE_EMBEDDED
;
8565 attack_exec
= ATTACK_EXEC_ON_CPU
;
8566 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8567 kern_type
= KERN_TYPE_LASTPASS
;
8568 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8569 parse_func
= lastpass_parse_hash
;
8570 sort_by_digest
= sort_by_digest_4_8
;
8571 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8578 case 6900: hash_type
= HASH_TYPE_GOST
;
8579 salt_type
= SALT_TYPE_NONE
;
8580 attack_exec
= ATTACK_EXEC_ON_GPU
;
8581 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8582 kern_type
= KERN_TYPE_GOST
;
8583 dgst_size
= DGST_SIZE_4_8
;
8584 parse_func
= gost_parse_hash
;
8585 sort_by_digest
= sort_by_digest_4_8
;
8586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8593 case 7100: hash_type
= HASH_TYPE_SHA512
;
8594 salt_type
= SALT_TYPE_EMBEDDED
;
8595 attack_exec
= ATTACK_EXEC_ON_CPU
;
8596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8597 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8598 dgst_size
= DGST_SIZE_8_16
;
8599 parse_func
= sha512osx_parse_hash
;
8600 sort_by_digest
= sort_by_digest_8_16
;
8601 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8608 case 7200: hash_type
= HASH_TYPE_SHA512
;
8609 salt_type
= SALT_TYPE_EMBEDDED
;
8610 attack_exec
= ATTACK_EXEC_ON_CPU
;
8611 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8612 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8613 dgst_size
= DGST_SIZE_8_16
;
8614 parse_func
= sha512grub_parse_hash
;
8615 sort_by_digest
= sort_by_digest_8_16
;
8616 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8623 case 7300: hash_type
= HASH_TYPE_SHA1
;
8624 salt_type
= SALT_TYPE_EMBEDDED
;
8625 attack_exec
= ATTACK_EXEC_ON_GPU
;
8626 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8627 | OPTS_TYPE_ST_ADD80
8628 | OPTS_TYPE_ST_ADDBITS15
;
8629 kern_type
= KERN_TYPE_RAKP
;
8630 dgst_size
= DGST_SIZE_4_5
;
8631 parse_func
= rakp_parse_hash
;
8632 sort_by_digest
= sort_by_digest_4_5
;
8633 opti_type
= OPTI_TYPE_ZERO_BYTE
8634 | OPTI_TYPE_NOT_ITERATED
;
8641 case 7400: hash_type
= HASH_TYPE_SHA256
;
8642 salt_type
= SALT_TYPE_EMBEDDED
;
8643 attack_exec
= ATTACK_EXEC_ON_CPU
;
8644 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8645 kern_type
= KERN_TYPE_SHA256CRYPT
;
8646 dgst_size
= DGST_SIZE_4_8
;
8647 parse_func
= sha256crypt_parse_hash
;
8648 sort_by_digest
= sort_by_digest_4_8
;
8649 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8656 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8657 salt_type
= SALT_TYPE_EMBEDDED
;
8658 attack_exec
= ATTACK_EXEC_ON_GPU
;
8659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8660 kern_type
= KERN_TYPE_KRB5PA
;
8661 dgst_size
= DGST_SIZE_4_4
;
8662 parse_func
= krb5pa_parse_hash
;
8663 sort_by_digest
= sort_by_digest_4_4
;
8664 opti_type
= OPTI_TYPE_ZERO_BYTE
8665 | OPTI_TYPE_NOT_ITERATED
;
8672 case 7600: hash_type
= HASH_TYPE_SHA1
;
8673 salt_type
= SALT_TYPE_INTERN
;
8674 attack_exec
= ATTACK_EXEC_ON_GPU
;
8675 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8676 | OPTS_TYPE_PT_ADD80
8677 | OPTS_TYPE_PT_ADDBITS15
;
8678 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8679 dgst_size
= DGST_SIZE_4_5
;
8680 parse_func
= redmine_parse_hash
;
8681 sort_by_digest
= sort_by_digest_4_5
;
8682 opti_type
= OPTI_TYPE_ZERO_BYTE
8683 | OPTI_TYPE_PRECOMPUTE_INIT
8684 | OPTI_TYPE_EARLY_SKIP
8685 | OPTI_TYPE_NOT_ITERATED
8686 | OPTI_TYPE_PREPENDED_SALT
;
8693 case 7700: hash_type
= HASH_TYPE_SAPB
;
8694 salt_type
= SALT_TYPE_EMBEDDED
;
8695 attack_exec
= ATTACK_EXEC_ON_GPU
;
8696 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8697 | OPTS_TYPE_PT_UPPER
8698 | OPTS_TYPE_ST_UPPER
;
8699 kern_type
= KERN_TYPE_SAPB
;
8700 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8701 parse_func
= sapb_parse_hash
;
8702 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8703 opti_type
= OPTI_TYPE_ZERO_BYTE
8704 | OPTI_TYPE_PRECOMPUTE_INIT
8705 | OPTI_TYPE_NOT_ITERATED
;
8712 case 7800: hash_type
= HASH_TYPE_SAPG
;
8713 salt_type
= SALT_TYPE_EMBEDDED
;
8714 attack_exec
= ATTACK_EXEC_ON_GPU
;
8715 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8716 | OPTS_TYPE_ST_ADD80
8717 | OPTS_TYPE_ST_UPPER
;
8718 kern_type
= KERN_TYPE_SAPG
;
8719 dgst_size
= DGST_SIZE_4_5
;
8720 parse_func
= sapg_parse_hash
;
8721 sort_by_digest
= sort_by_digest_4_5
;
8722 opti_type
= OPTI_TYPE_ZERO_BYTE
8723 | OPTI_TYPE_PRECOMPUTE_INIT
8724 | OPTI_TYPE_NOT_ITERATED
;
8731 case 7900: hash_type
= HASH_TYPE_SHA512
;
8732 salt_type
= SALT_TYPE_EMBEDDED
;
8733 attack_exec
= ATTACK_EXEC_ON_CPU
;
8734 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8735 kern_type
= KERN_TYPE_DRUPAL7
;
8736 dgst_size
= DGST_SIZE_8_8
;
8737 parse_func
= drupal7_parse_hash
;
8738 sort_by_digest
= sort_by_digest_8_8
;
8739 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8746 case 8000: hash_type
= HASH_TYPE_SHA256
;
8747 salt_type
= SALT_TYPE_EMBEDDED
;
8748 attack_exec
= ATTACK_EXEC_ON_GPU
;
8749 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8750 | OPTS_TYPE_PT_UNICODE
8751 | OPTS_TYPE_ST_ADD80
8753 kern_type
= KERN_TYPE_SYBASEASE
;
8754 dgst_size
= DGST_SIZE_4_8
;
8755 parse_func
= sybasease_parse_hash
;
8756 sort_by_digest
= sort_by_digest_4_8
;
8757 opti_type
= OPTI_TYPE_ZERO_BYTE
8758 | OPTI_TYPE_PRECOMPUTE_INIT
8759 | OPTI_TYPE_EARLY_SKIP
8760 | OPTI_TYPE_NOT_ITERATED
8761 | OPTI_TYPE_RAW_HASH
;
8768 case 8100: hash_type
= HASH_TYPE_SHA1
;
8769 salt_type
= SALT_TYPE_EMBEDDED
;
8770 attack_exec
= ATTACK_EXEC_ON_GPU
;
8771 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8772 kern_type
= KERN_TYPE_NETSCALER
;
8773 dgst_size
= DGST_SIZE_4_5
;
8774 parse_func
= netscaler_parse_hash
;
8775 sort_by_digest
= sort_by_digest_4_5
;
8776 opti_type
= OPTI_TYPE_ZERO_BYTE
8777 | OPTI_TYPE_PRECOMPUTE_INIT
8778 | OPTI_TYPE_PRECOMPUTE_MERKLE
8779 | OPTI_TYPE_EARLY_SKIP
8780 | OPTI_TYPE_NOT_ITERATED
8781 | OPTI_TYPE_PREPENDED_SALT
8782 | OPTI_TYPE_RAW_HASH
;
8789 case 8200: hash_type
= HASH_TYPE_SHA256
;
8790 salt_type
= SALT_TYPE_EMBEDDED
;
8791 attack_exec
= ATTACK_EXEC_ON_CPU
;
8792 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8793 kern_type
= KERN_TYPE_CLOUDKEY
;
8794 dgst_size
= DGST_SIZE_4_8
;
8795 parse_func
= cloudkey_parse_hash
;
8796 sort_by_digest
= sort_by_digest_4_8
;
8797 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8804 case 8300: hash_type
= HASH_TYPE_SHA1
;
8805 salt_type
= SALT_TYPE_EMBEDDED
;
8806 attack_exec
= ATTACK_EXEC_ON_GPU
;
8807 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8809 | OPTS_TYPE_ST_ADD80
;
8810 kern_type
= KERN_TYPE_NSEC3
;
8811 dgst_size
= DGST_SIZE_4_5
;
8812 parse_func
= nsec3_parse_hash
;
8813 sort_by_digest
= sort_by_digest_4_5
;
8814 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8821 case 8400: hash_type
= HASH_TYPE_SHA1
;
8822 salt_type
= SALT_TYPE_INTERN
;
8823 attack_exec
= ATTACK_EXEC_ON_GPU
;
8824 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8825 | OPTS_TYPE_PT_ADD80
8826 | OPTS_TYPE_PT_ADDBITS15
;
8827 kern_type
= KERN_TYPE_WBB3
;
8828 dgst_size
= DGST_SIZE_4_5
;
8829 parse_func
= wbb3_parse_hash
;
8830 sort_by_digest
= sort_by_digest_4_5
;
8831 opti_type
= OPTI_TYPE_ZERO_BYTE
8832 | OPTI_TYPE_PRECOMPUTE_INIT
8833 | OPTI_TYPE_NOT_ITERATED
;
8840 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8841 salt_type
= SALT_TYPE_EMBEDDED
;
8842 attack_exec
= ATTACK_EXEC_ON_GPU
;
8843 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8844 | OPTS_TYPE_ST_UPPER
;
8845 kern_type
= KERN_TYPE_RACF
;
8846 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8847 parse_func
= racf_parse_hash
;
8848 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8849 opti_type
= OPTI_TYPE_ZERO_BYTE
8850 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8857 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8858 salt_type
= SALT_TYPE_NONE
;
8859 attack_exec
= ATTACK_EXEC_ON_GPU
;
8860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8861 kern_type
= KERN_TYPE_LOTUS5
;
8862 dgst_size
= DGST_SIZE_4_4
;
8863 parse_func
= lotus5_parse_hash
;
8864 sort_by_digest
= sort_by_digest_4_4
;
8865 opti_type
= OPTI_TYPE_EARLY_SKIP
8866 | OPTI_TYPE_NOT_ITERATED
8867 | OPTI_TYPE_NOT_SALTED
8868 | OPTI_TYPE_RAW_HASH
;
8875 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8876 salt_type
= SALT_TYPE_EMBEDDED
;
8877 attack_exec
= ATTACK_EXEC_ON_GPU
;
8878 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8879 kern_type
= KERN_TYPE_LOTUS6
;
8880 dgst_size
= DGST_SIZE_4_4
;
8881 parse_func
= lotus6_parse_hash
;
8882 sort_by_digest
= sort_by_digest_4_4
;
8883 opti_type
= OPTI_TYPE_EARLY_SKIP
8884 | OPTI_TYPE_NOT_ITERATED
8885 | OPTI_TYPE_RAW_HASH
;
8892 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8893 salt_type
= SALT_TYPE_EMBEDDED
;
8894 attack_exec
= ATTACK_EXEC_ON_CPU
;
8895 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8896 kern_type
= KERN_TYPE_ANDROIDFDE
;
8897 dgst_size
= DGST_SIZE_4_4
;
8898 parse_func
= androidfde_parse_hash
;
8899 sort_by_digest
= sort_by_digest_4_4
;
8900 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8907 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8908 salt_type
= SALT_TYPE_EMBEDDED
;
8909 attack_exec
= ATTACK_EXEC_ON_CPU
;
8910 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8911 kern_type
= KERN_TYPE_SCRYPT
;
8912 dgst_size
= DGST_SIZE_4_8
;
8913 parse_func
= scrypt_parse_hash
;
8914 sort_by_digest
= sort_by_digest_4_8
;
8915 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8922 case 9000: hash_type
= HASH_TYPE_SHA1
;
8923 salt_type
= SALT_TYPE_EMBEDDED
;
8924 attack_exec
= ATTACK_EXEC_ON_CPU
;
8925 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8926 | OPTS_TYPE_ST_GENERATE_LE
;
8927 kern_type
= KERN_TYPE_PSAFE2
;
8928 dgst_size
= DGST_SIZE_4_5
;
8929 parse_func
= psafe2_parse_hash
;
8930 sort_by_digest
= sort_by_digest_4_5
;
8931 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8938 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
8939 salt_type
= SALT_TYPE_EMBEDDED
;
8940 attack_exec
= ATTACK_EXEC_ON_CPU
;
8941 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8942 kern_type
= KERN_TYPE_LOTUS8
;
8943 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8944 parse_func
= lotus8_parse_hash
;
8945 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8946 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8953 case 9200: hash_type
= HASH_TYPE_SHA256
;
8954 salt_type
= SALT_TYPE_EMBEDDED
;
8955 attack_exec
= ATTACK_EXEC_ON_CPU
;
8956 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8957 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
8958 dgst_size
= DGST_SIZE_4_32
;
8959 parse_func
= cisco8_parse_hash
;
8960 sort_by_digest
= sort_by_digest_4_32
;
8961 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8968 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
8969 salt_type
= SALT_TYPE_EMBEDDED
;
8970 attack_exec
= ATTACK_EXEC_ON_CPU
;
8971 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8972 kern_type
= KERN_TYPE_SCRYPT
;
8973 dgst_size
= DGST_SIZE_4_8
;
8974 parse_func
= cisco9_parse_hash
;
8975 sort_by_digest
= sort_by_digest_4_8
;
8976 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8983 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
8984 salt_type
= SALT_TYPE_EMBEDDED
;
8985 attack_exec
= ATTACK_EXEC_ON_CPU
;
8986 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8987 kern_type
= KERN_TYPE_OFFICE2007
;
8988 dgst_size
= DGST_SIZE_4_4
;
8989 parse_func
= office2007_parse_hash
;
8990 sort_by_digest
= sort_by_digest_4_4
;
8991 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8998 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
8999 salt_type
= SALT_TYPE_EMBEDDED
;
9000 attack_exec
= ATTACK_EXEC_ON_CPU
;
9001 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9002 kern_type
= KERN_TYPE_OFFICE2010
;
9003 dgst_size
= DGST_SIZE_4_4
;
9004 parse_func
= office2010_parse_hash
;
9005 sort_by_digest
= sort_by_digest_4_4
;
9006 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9013 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9014 salt_type
= SALT_TYPE_EMBEDDED
;
9015 attack_exec
= ATTACK_EXEC_ON_CPU
;
9016 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9017 kern_type
= KERN_TYPE_OFFICE2013
;
9018 dgst_size
= DGST_SIZE_4_4
;
9019 parse_func
= office2013_parse_hash
;
9020 sort_by_digest
= sort_by_digest_4_4
;
9021 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9028 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9029 salt_type
= SALT_TYPE_EMBEDDED
;
9030 attack_exec
= ATTACK_EXEC_ON_GPU
;
9031 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9032 | OPTS_TYPE_PT_ADD80
9033 | OPTS_TYPE_PT_UNICODE
;
9034 kern_type
= KERN_TYPE_OLDOFFICE01
;
9035 dgst_size
= DGST_SIZE_4_4
;
9036 parse_func
= oldoffice01_parse_hash
;
9037 sort_by_digest
= sort_by_digest_4_4
;
9038 opti_type
= OPTI_TYPE_ZERO_BYTE
9039 | OPTI_TYPE_PRECOMPUTE_INIT
9040 | OPTI_TYPE_NOT_ITERATED
;
9047 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9048 salt_type
= SALT_TYPE_EMBEDDED
;
9049 attack_exec
= ATTACK_EXEC_ON_GPU
;
9050 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9051 | OPTS_TYPE_PT_ADD80
;
9052 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9053 dgst_size
= DGST_SIZE_4_4
;
9054 parse_func
= oldoffice01cm1_parse_hash
;
9055 sort_by_digest
= sort_by_digest_4_4
;
9056 opti_type
= OPTI_TYPE_ZERO_BYTE
9057 | OPTI_TYPE_PRECOMPUTE_INIT
9058 | OPTI_TYPE_NOT_ITERATED
;
9065 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9066 salt_type
= SALT_TYPE_EMBEDDED
;
9067 attack_exec
= ATTACK_EXEC_ON_GPU
;
9068 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9069 | OPTS_TYPE_PT_ADD80
9070 | OPTS_TYPE_PT_UNICODE
9071 | OPTS_TYPE_PT_NEVERCRACK
;
9072 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9073 dgst_size
= DGST_SIZE_4_4
;
9074 parse_func
= oldoffice01cm2_parse_hash
;
9075 sort_by_digest
= sort_by_digest_4_4
;
9076 opti_type
= OPTI_TYPE_ZERO_BYTE
9077 | OPTI_TYPE_PRECOMPUTE_INIT
9078 | OPTI_TYPE_NOT_ITERATED
;
9085 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9086 salt_type
= SALT_TYPE_EMBEDDED
;
9087 attack_exec
= ATTACK_EXEC_ON_GPU
;
9088 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9089 | OPTS_TYPE_PT_ADD80
9090 | OPTS_TYPE_PT_UNICODE
;
9091 kern_type
= KERN_TYPE_OLDOFFICE34
;
9092 dgst_size
= DGST_SIZE_4_4
;
9093 parse_func
= oldoffice34_parse_hash
;
9094 sort_by_digest
= sort_by_digest_4_4
;
9095 opti_type
= OPTI_TYPE_ZERO_BYTE
9096 | OPTI_TYPE_PRECOMPUTE_INIT
9097 | OPTI_TYPE_NOT_ITERATED
;
9104 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9105 salt_type
= SALT_TYPE_EMBEDDED
;
9106 attack_exec
= ATTACK_EXEC_ON_GPU
;
9107 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9108 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9109 dgst_size
= DGST_SIZE_4_4
;
9110 parse_func
= oldoffice34cm1_parse_hash
;
9111 sort_by_digest
= sort_by_digest_4_4
;
9112 opti_type
= OPTI_TYPE_ZERO_BYTE
9113 | OPTI_TYPE_PRECOMPUTE_INIT
9114 | OPTI_TYPE_NOT_ITERATED
;
9121 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9122 salt_type
= SALT_TYPE_EMBEDDED
;
9123 attack_exec
= ATTACK_EXEC_ON_GPU
;
9124 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9125 | OPTS_TYPE_PT_ADD80
9126 | OPTS_TYPE_PT_UNICODE
9127 | OPTS_TYPE_PT_NEVERCRACK
;
9128 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9129 dgst_size
= DGST_SIZE_4_4
;
9130 parse_func
= oldoffice34cm2_parse_hash
;
9131 sort_by_digest
= sort_by_digest_4_4
;
9132 opti_type
= OPTI_TYPE_ZERO_BYTE
9133 | OPTI_TYPE_PRECOMPUTE_INIT
9134 | OPTI_TYPE_NOT_ITERATED
;
9141 case 9900: hash_type
= HASH_TYPE_MD5
;
9142 salt_type
= SALT_TYPE_NONE
;
9143 attack_exec
= ATTACK_EXEC_ON_GPU
;
9144 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9145 kern_type
= KERN_TYPE_RADMIN2
;
9146 dgst_size
= DGST_SIZE_4_4
;
9147 parse_func
= radmin2_parse_hash
;
9148 sort_by_digest
= sort_by_digest_4_4
;
9149 opti_type
= OPTI_TYPE_ZERO_BYTE
9150 | OPTI_TYPE_PRECOMPUTE_INIT
9151 | OPTI_TYPE_EARLY_SKIP
9152 | OPTI_TYPE_NOT_ITERATED
9153 | OPTI_TYPE_NOT_SALTED
;
9160 case 10000: hash_type
= HASH_TYPE_SHA256
;
9161 salt_type
= SALT_TYPE_EMBEDDED
;
9162 attack_exec
= ATTACK_EXEC_ON_CPU
;
9163 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9164 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9165 dgst_size
= DGST_SIZE_4_32
;
9166 parse_func
= djangopbkdf2_parse_hash
;
9167 sort_by_digest
= sort_by_digest_4_32
;
9168 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9175 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9176 salt_type
= SALT_TYPE_EMBEDDED
;
9177 attack_exec
= ATTACK_EXEC_ON_GPU
;
9178 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9179 kern_type
= KERN_TYPE_SIPHASH
;
9180 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9181 parse_func
= siphash_parse_hash
;
9182 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9183 opti_type
= OPTI_TYPE_ZERO_BYTE
9184 | OPTI_TYPE_NOT_ITERATED
9185 | OPTI_TYPE_RAW_HASH
;
9192 case 10200: hash_type
= HASH_TYPE_MD5
;
9193 salt_type
= SALT_TYPE_EMBEDDED
;
9194 attack_exec
= ATTACK_EXEC_ON_GPU
;
9195 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9196 | OPTS_TYPE_ST_ADD80
9197 | OPTS_TYPE_ST_ADDBITS14
;
9198 kern_type
= KERN_TYPE_HMACMD5_PW
;
9199 dgst_size
= DGST_SIZE_4_4
;
9200 parse_func
= crammd5_parse_hash
;
9201 sort_by_digest
= sort_by_digest_4_4
;
9202 opti_type
= OPTI_TYPE_ZERO_BYTE
9203 | OPTI_TYPE_NOT_ITERATED
;
9210 case 10300: hash_type
= HASH_TYPE_SHA1
;
9211 salt_type
= SALT_TYPE_EMBEDDED
;
9212 attack_exec
= ATTACK_EXEC_ON_CPU
;
9213 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9214 kern_type
= KERN_TYPE_SAPH_SHA1
;
9215 dgst_size
= DGST_SIZE_4_5
;
9216 parse_func
= saph_sha1_parse_hash
;
9217 sort_by_digest
= sort_by_digest_4_5
;
9218 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9225 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9226 salt_type
= SALT_TYPE_EMBEDDED
;
9227 attack_exec
= ATTACK_EXEC_ON_GPU
;
9228 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9229 kern_type
= KERN_TYPE_PDF11
;
9230 dgst_size
= DGST_SIZE_4_4
;
9231 parse_func
= pdf11_parse_hash
;
9232 sort_by_digest
= sort_by_digest_4_4
;
9233 opti_type
= OPTI_TYPE_ZERO_BYTE
9234 | OPTI_TYPE_NOT_ITERATED
;
9241 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9242 salt_type
= SALT_TYPE_EMBEDDED
;
9243 attack_exec
= ATTACK_EXEC_ON_GPU
;
9244 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9245 kern_type
= KERN_TYPE_PDF11CM1
;
9246 dgst_size
= DGST_SIZE_4_4
;
9247 parse_func
= pdf11cm1_parse_hash
;
9248 sort_by_digest
= sort_by_digest_4_4
;
9249 opti_type
= OPTI_TYPE_ZERO_BYTE
9250 | OPTI_TYPE_NOT_ITERATED
;
9257 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9258 salt_type
= SALT_TYPE_EMBEDDED
;
9259 attack_exec
= ATTACK_EXEC_ON_GPU
;
9260 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9261 kern_type
= KERN_TYPE_PDF11CM2
;
9262 dgst_size
= DGST_SIZE_4_4
;
9263 parse_func
= pdf11cm2_parse_hash
;
9264 sort_by_digest
= sort_by_digest_4_4
;
9265 opti_type
= OPTI_TYPE_ZERO_BYTE
9266 | OPTI_TYPE_NOT_ITERATED
;
9273 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9274 salt_type
= SALT_TYPE_EMBEDDED
;
9275 attack_exec
= ATTACK_EXEC_ON_CPU
;
9276 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9277 kern_type
= KERN_TYPE_PDF14
;
9278 dgst_size
= DGST_SIZE_4_4
;
9279 parse_func
= pdf14_parse_hash
;
9280 sort_by_digest
= sort_by_digest_4_4
;
9281 opti_type
= OPTI_TYPE_ZERO_BYTE
9282 | OPTI_TYPE_NOT_ITERATED
;
9289 case 10600: hash_type
= HASH_TYPE_SHA256
;
9290 salt_type
= SALT_TYPE_EMBEDDED
;
9291 attack_exec
= ATTACK_EXEC_ON_GPU
;
9292 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9293 | OPTS_TYPE_ST_ADD80
9294 | OPTS_TYPE_ST_ADDBITS15
9295 | OPTS_TYPE_HASH_COPY
;
9296 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9297 dgst_size
= DGST_SIZE_4_8
;
9298 parse_func
= pdf17l3_parse_hash
;
9299 sort_by_digest
= sort_by_digest_4_8
;
9300 opti_type
= OPTI_TYPE_ZERO_BYTE
9301 | OPTI_TYPE_PRECOMPUTE_INIT
9302 | OPTI_TYPE_PRECOMPUTE_MERKLE
9303 | OPTI_TYPE_EARLY_SKIP
9304 | OPTI_TYPE_NOT_ITERATED
9305 | OPTI_TYPE_APPENDED_SALT
9306 | OPTI_TYPE_RAW_HASH
;
9313 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9314 salt_type
= SALT_TYPE_EMBEDDED
;
9315 attack_exec
= ATTACK_EXEC_ON_CPU
;
9316 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9317 | OPTS_TYPE_HASH_COPY
;
9318 kern_type
= KERN_TYPE_PDF17L8
;
9319 dgst_size
= DGST_SIZE_4_8
;
9320 parse_func
= pdf17l8_parse_hash
;
9321 sort_by_digest
= sort_by_digest_4_8
;
9322 opti_type
= OPTI_TYPE_ZERO_BYTE
9323 | OPTI_TYPE_NOT_ITERATED
;
9330 case 10800: hash_type
= HASH_TYPE_SHA384
;
9331 salt_type
= SALT_TYPE_NONE
;
9332 attack_exec
= ATTACK_EXEC_ON_GPU
;
9333 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9334 | OPTS_TYPE_PT_ADD80
9335 | OPTS_TYPE_PT_ADDBITS15
;
9336 kern_type
= KERN_TYPE_SHA384
;
9337 dgst_size
= DGST_SIZE_8_8
;
9338 parse_func
= sha384_parse_hash
;
9339 sort_by_digest
= sort_by_digest_8_8
;
9340 opti_type
= OPTI_TYPE_ZERO_BYTE
9341 | OPTI_TYPE_PRECOMPUTE_INIT
9342 | OPTI_TYPE_PRECOMPUTE_MERKLE
9343 | OPTI_TYPE_EARLY_SKIP
9344 | OPTI_TYPE_NOT_ITERATED
9345 | OPTI_TYPE_NOT_SALTED
9346 | OPTI_TYPE_RAW_HASH
;
9353 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9354 salt_type
= SALT_TYPE_EMBEDDED
;
9355 attack_exec
= ATTACK_EXEC_ON_CPU
;
9356 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9357 | OPTS_TYPE_ST_BASE64
9358 | OPTS_TYPE_HASH_COPY
;
9359 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9360 dgst_size
= DGST_SIZE_4_32
;
9361 parse_func
= pbkdf2_sha256_parse_hash
;
9362 sort_by_digest
= sort_by_digest_4_32
;
9363 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9370 case 11000: hash_type
= HASH_TYPE_MD5
;
9371 salt_type
= SALT_TYPE_INTERN
;
9372 attack_exec
= ATTACK_EXEC_ON_GPU
;
9373 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9374 | OPTS_TYPE_PT_ADD80
;
9375 kern_type
= KERN_TYPE_PRESTASHOP
;
9376 dgst_size
= DGST_SIZE_4_4
;
9377 parse_func
= prestashop_parse_hash
;
9378 sort_by_digest
= sort_by_digest_4_4
;
9379 opti_type
= OPTI_TYPE_ZERO_BYTE
9380 | OPTI_TYPE_PRECOMPUTE_INIT
9381 | OPTI_TYPE_NOT_ITERATED
9382 | OPTI_TYPE_PREPENDED_SALT
;
9389 case 11100: hash_type
= HASH_TYPE_MD5
;
9390 salt_type
= SALT_TYPE_EMBEDDED
;
9391 attack_exec
= ATTACK_EXEC_ON_GPU
;
9392 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9393 | OPTS_TYPE_ST_ADD80
;
9394 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9395 dgst_size
= DGST_SIZE_4_4
;
9396 parse_func
= postgresql_auth_parse_hash
;
9397 sort_by_digest
= sort_by_digest_4_4
;
9398 opti_type
= OPTI_TYPE_ZERO_BYTE
9399 | OPTI_TYPE_PRECOMPUTE_INIT
9400 | OPTI_TYPE_PRECOMPUTE_MERKLE
9401 | OPTI_TYPE_EARLY_SKIP
;
9408 case 11200: hash_type
= HASH_TYPE_SHA1
;
9409 salt_type
= SALT_TYPE_EMBEDDED
;
9410 attack_exec
= ATTACK_EXEC_ON_GPU
;
9411 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9412 | OPTS_TYPE_PT_ADD80
9414 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9415 dgst_size
= DGST_SIZE_4_5
;
9416 parse_func
= mysql_auth_parse_hash
;
9417 sort_by_digest
= sort_by_digest_4_5
;
9418 opti_type
= OPTI_TYPE_ZERO_BYTE
9419 | OPTI_TYPE_EARLY_SKIP
;
9426 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9427 salt_type
= SALT_TYPE_EMBEDDED
;
9428 attack_exec
= ATTACK_EXEC_ON_CPU
;
9429 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9431 | OPTS_TYPE_ST_ADD80
;
9432 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9433 dgst_size
= DGST_SIZE_4_4
;
9434 parse_func
= bitcoin_wallet_parse_hash
;
9435 sort_by_digest
= sort_by_digest_4_4
;
9436 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9443 case 11400: hash_type
= HASH_TYPE_MD5
;
9444 salt_type
= SALT_TYPE_EMBEDDED
;
9445 attack_exec
= ATTACK_EXEC_ON_GPU
;
9446 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9447 | OPTS_TYPE_PT_ADD80
9448 | OPTS_TYPE_HASH_COPY
;
9449 kern_type
= KERN_TYPE_SIP_AUTH
;
9450 dgst_size
= DGST_SIZE_4_4
;
9451 parse_func
= sip_auth_parse_hash
;
9452 sort_by_digest
= sort_by_digest_4_4
;
9453 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9460 case 11500: hash_type
= HASH_TYPE_CRC32
;
9461 salt_type
= SALT_TYPE_INTERN
;
9462 attack_exec
= ATTACK_EXEC_ON_GPU
;
9463 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9464 | OPTS_TYPE_ST_GENERATE_LE
9466 kern_type
= KERN_TYPE_CRC32
;
9467 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9468 parse_func
= crc32_parse_hash
;
9469 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9470 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9477 case 11600: hash_type
= HASH_TYPE_AES
;
9478 salt_type
= SALT_TYPE_EMBEDDED
;
9479 attack_exec
= ATTACK_EXEC_ON_CPU
;
9480 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9481 | OPTS_TYPE_PT_NEVERCRACK
;
9482 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9483 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9484 parse_func
= seven_zip_parse_hash
;
9485 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9486 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9493 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9494 salt_type
= SALT_TYPE_NONE
;
9495 attack_exec
= ATTACK_EXEC_ON_GPU
;
9496 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9497 | OPTS_TYPE_PT_ADD01
;
9498 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9499 dgst_size
= DGST_SIZE_4_8
;
9500 parse_func
= gost2012sbog_256_parse_hash
;
9501 sort_by_digest
= sort_by_digest_4_8
;
9502 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9509 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9510 salt_type
= SALT_TYPE_NONE
;
9511 attack_exec
= ATTACK_EXEC_ON_GPU
;
9512 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9513 | OPTS_TYPE_PT_ADD01
;
9514 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9515 dgst_size
= DGST_SIZE_4_16
;
9516 parse_func
= gost2012sbog_512_parse_hash
;
9517 sort_by_digest
= sort_by_digest_4_16
;
9518 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9525 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9526 salt_type
= SALT_TYPE_EMBEDDED
;
9527 attack_exec
= ATTACK_EXEC_ON_CPU
;
9528 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9529 | OPTS_TYPE_ST_BASE64
9530 | OPTS_TYPE_HASH_COPY
;
9531 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9532 dgst_size
= DGST_SIZE_4_32
;
9533 parse_func
= pbkdf2_md5_parse_hash
;
9534 sort_by_digest
= sort_by_digest_4_32
;
9535 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9542 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9543 salt_type
= SALT_TYPE_EMBEDDED
;
9544 attack_exec
= ATTACK_EXEC_ON_CPU
;
9545 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9546 | OPTS_TYPE_ST_BASE64
9547 | OPTS_TYPE_HASH_COPY
;
9548 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9549 dgst_size
= DGST_SIZE_4_32
;
9550 parse_func
= pbkdf2_sha1_parse_hash
;
9551 sort_by_digest
= sort_by_digest_4_32
;
9552 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9559 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9560 salt_type
= SALT_TYPE_EMBEDDED
;
9561 attack_exec
= ATTACK_EXEC_ON_CPU
;
9562 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9563 | OPTS_TYPE_ST_BASE64
9564 | OPTS_TYPE_HASH_COPY
;
9565 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9566 dgst_size
= DGST_SIZE_8_16
;
9567 parse_func
= pbkdf2_sha512_parse_hash
;
9568 sort_by_digest
= sort_by_digest_8_16
;
9569 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9576 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9577 salt_type
= SALT_TYPE_EMBEDDED
;
9578 attack_exec
= ATTACK_EXEC_ON_CPU
;
9579 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9580 kern_type
= KERN_TYPE_ECRYPTFS
;
9581 dgst_size
= DGST_SIZE_8_8
;
9582 parse_func
= ecryptfs_parse_hash
;
9583 sort_by_digest
= sort_by_digest_8_8
;
9584 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9591 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9592 salt_type
= SALT_TYPE_EMBEDDED
;
9593 attack_exec
= ATTACK_EXEC_ON_CPU
;
9594 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9595 kern_type
= KERN_TYPE_ORACLET
;
9596 dgst_size
= DGST_SIZE_8_16
;
9597 parse_func
= oraclet_parse_hash
;
9598 sort_by_digest
= sort_by_digest_8_16
;
9599 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9606 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9607 salt_type
= SALT_TYPE_EMBEDDED
;
9608 attack_exec
= ATTACK_EXEC_ON_CPU
;
9609 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9610 kern_type
= KERN_TYPE_BSDICRYPT
;
9611 dgst_size
= DGST_SIZE_4_4
;
9612 parse_func
= bsdicrypt_parse_hash
;
9613 sort_by_digest
= sort_by_digest_4_4
;
9614 opti_type
= OPTI_TYPE_ZERO_BYTE
9615 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9622 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9623 salt_type
= SALT_TYPE_EMBEDDED
;
9624 attack_exec
= ATTACK_EXEC_ON_CPU
;
9625 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9626 kern_type
= KERN_TYPE_RAR3
;
9627 dgst_size
= DGST_SIZE_4_4
;
9628 parse_func
= rar3hp_parse_hash
;
9629 sort_by_digest
= sort_by_digest_4_4
;
9630 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9637 case 12600: hash_type
= HASH_TYPE_SHA256
;
9638 salt_type
= SALT_TYPE_INTERN
;
9639 attack_exec
= ATTACK_EXEC_ON_GPU
;
9640 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9641 | OPTS_TYPE_PT_ADD80
;
9642 kern_type
= KERN_TYPE_CF10
;
9643 dgst_size
= DGST_SIZE_4_8
;
9644 parse_func
= cf10_parse_hash
;
9645 sort_by_digest
= sort_by_digest_4_8
;
9646 opti_type
= OPTI_TYPE_ZERO_BYTE
9647 | OPTI_TYPE_PRECOMPUTE_INIT
9648 | OPTI_TYPE_EARLY_SKIP
9649 | OPTI_TYPE_NOT_ITERATED
;
9656 case 12700: hash_type
= HASH_TYPE_AES
;
9657 salt_type
= SALT_TYPE_EMBEDDED
;
9658 attack_exec
= ATTACK_EXEC_ON_CPU
;
9659 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9660 | OPTS_TYPE_HASH_COPY
;
9661 kern_type
= KERN_TYPE_MYWALLET
;
9662 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9663 parse_func
= mywallet_parse_hash
;
9664 sort_by_digest
= sort_by_digest_4_5
;
9665 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9672 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9673 salt_type
= SALT_TYPE_EMBEDDED
;
9674 attack_exec
= ATTACK_EXEC_ON_CPU
;
9675 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9676 kern_type
= KERN_TYPE_MS_DRSR
;
9677 dgst_size
= DGST_SIZE_4_8
;
9678 parse_func
= ms_drsr_parse_hash
;
9679 sort_by_digest
= sort_by_digest_4_8
;
9680 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9687 default: usage_mini_print (PROGNAME
); return (-1);
9694 data
.parse_func
= parse_func
;
9702 if (salt_type
== SALT_TYPE_INTERN
)
9704 opts_type
|= OPTS_TYPE_ST_HEX
;
9708 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9714 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9715 | (salt_type
== SALT_TYPE_EXTERN
)
9716 | (salt_type
== SALT_TYPE_EMBEDDED
)
9717 | (salt_type
== SALT_TYPE_VIRTUAL
));
9719 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9721 data
.hash_type
= hash_type
;
9722 data
.attack_mode
= attack_mode
;
9723 data
.attack_kern
= attack_kern
;
9724 data
.attack_exec
= attack_exec
;
9725 data
.kern_type
= kern_type
;
9726 data
.opts_type
= opts_type
;
9727 data
.dgst_size
= dgst_size
;
9728 data
.salt_type
= salt_type
;
9729 data
.isSalted
= isSalted
;
9730 data
.sort_by_digest
= sort_by_digest
;
9731 data
.dgst_pos0
= dgst_pos0
;
9732 data
.dgst_pos1
= dgst_pos1
;
9733 data
.dgst_pos2
= dgst_pos2
;
9734 data
.dgst_pos3
= dgst_pos3
;
9740 case 2500: esalt_size
= sizeof (wpa_t
); break;
9741 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9742 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9743 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9744 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9756 case 6243: esalt_size
= sizeof (tc_t
); break;
9757 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9758 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9759 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9760 case 7300: esalt_size
= sizeof (rakp_t
); break;
9761 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9762 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9763 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9764 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9765 case 9400: esalt_size
= sizeof (office2007_t
); break;
9766 case 9500: esalt_size
= sizeof (office2010_t
); break;
9767 case 9600: esalt_size
= sizeof (office2013_t
); break;
9768 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9769 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9770 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9771 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9772 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9773 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9774 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9775 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9776 case 10400: esalt_size
= sizeof (pdf_t
); break;
9777 case 10410: esalt_size
= sizeof (pdf_t
); break;
9778 case 10420: esalt_size
= sizeof (pdf_t
); break;
9779 case 10500: esalt_size
= sizeof (pdf_t
); break;
9780 case 10600: esalt_size
= sizeof (pdf_t
); break;
9781 case 10700: esalt_size
= sizeof (pdf_t
); break;
9782 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9783 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9784 case 11400: esalt_size
= sizeof (sip_t
); break;
9785 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9786 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9787 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9788 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9791 data
.esalt_size
= esalt_size
;
9794 * choose dictionary parser
9797 if (hash_type
== HASH_TYPE_LM
)
9799 get_next_word_func
= get_next_word_lm
;
9801 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9803 get_next_word_func
= get_next_word_uc
;
9807 get_next_word_func
= get_next_word_std
;
9814 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9817 size_t dictstat_nmemb
= 0;
9821 uint dictstat_nmemb
= 0;
9826 FILE *dictstat_fp
= NULL
;
9830 memset (dictstat
, 0, sizeof (dictstat
));
9832 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9834 dictstat_fp
= fopen (dictstat
, "rb");
9839 struct stat tmpstat
;
9841 fstat (fileno (dictstat_fp
), &tmpstat
);
9845 struct stat64 tmpstat
;
9847 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9850 if (tmpstat
.st_mtime
< COMPTIME
)
9852 /* with v0.15 the format changed so we have to ensure user is using a good version
9853 since there is no version-header in the dictstat file */
9855 fclose (dictstat_fp
);
9861 while (!feof (dictstat_fp
))
9865 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9867 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9869 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9871 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9877 fclose (dictstat_fp
);
9888 memset (potfile
, 0, sizeof (potfile
));
9890 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9894 FILE *out_fp
= NULL
;
9895 FILE *pot_fp
= NULL
;
9897 if (show
== 1 || left
== 1)
9899 pot_fp
= fopen (potfile
, "rb");
9903 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9908 if (outfile
!= NULL
)
9910 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9912 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
9926 if (potfile_disable
== 0)
9928 pot_fp
= fopen (potfile
, "ab");
9932 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9937 data
.pot_fp
= pot_fp
;
9946 if (show
== 1 || left
== 1)
9948 SUPPRESS_OUTPUT
= 1;
9950 pot_avail
= count_lines (pot_fp
);
9954 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
9956 uint pot_hashes_avail
= 0;
9960 while (!feof (pot_fp
))
9964 char line_buf
[BUFSIZ
];
9966 int line_len
= fgetl (pot_fp
, line_buf
);
9968 if (line_len
== 0) continue;
9970 char *plain_buf
= line_buf
+ line_len
;
9972 pot_t
*pot_ptr
= &pot
[pot_cnt
];
9974 hash_t
*hashes_buf
= &pot_ptr
->hash
;
9976 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
9977 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
9979 if (pot_cnt
== pot_hashes_avail
)
9983 for (pos
= 0; pos
< INCR_POT
; pos
++)
9985 if ((pot_cnt
+ pos
) >= pot_avail
) break;
9987 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
9989 hash_t
*tmp_hash
= &tmp_pot
->hash
;
9991 tmp_hash
->digest
= mymalloc (dgst_size
);
9995 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
10000 tmp_hash
->esalt
= mymalloc (esalt_size
);
10003 pot_hashes_avail
++;
10011 int iter
= MAX_CUT_TRIES
;
10015 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10017 if (line_buf
[i
] == ':')
10025 if (data
.hash_mode
!= 2500)
10027 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10031 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10033 if (line_len
> max_salt_size
)
10035 parser_status
= PARSER_GLOBAL_LENGTH
;
10039 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10041 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10043 hashes_buf
->salt
->salt_len
= line_len
;
10045 parser_status
= PARSER_OK
;
10049 // if NOT parsed without error, we add the ":" to the plain
10051 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10057 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10059 if (parser_status
< PARSER_GLOBAL_ZERO
)
10061 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10066 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10068 pot_ptr
->plain_len
= plain_len
;
10075 SUPPRESS_OUTPUT
= 0;
10077 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10081 * gpu accel and loops auto adjustment
10084 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10085 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10087 if (workload_profile
== 1)
10092 if (gpu_loops
== 0) gpu_loops
= 8;
10093 if (gpu_accel
== 0) gpu_accel
= 2;
10095 else if (workload_profile
== 3)
10100 if (gpu_loops
> 1024) gpu_loops
= 1024;
10101 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10104 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10106 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10111 if (hash_mode
== 12500)
10113 gpu_loops
= ROUNDS_RAR3
/ 16;
10116 data
.gpu_accel
= gpu_accel
;
10117 data
.gpu_loops
= gpu_loops
;
10123 uint pw_min
= PW_MIN
;
10124 uint pw_max
= PW_MAX
;
10128 case 400: if (pw_max
> 40) pw_max
= 40;
10130 case 500: if (pw_max
> 16) pw_max
= 16;
10132 case 1500: if (pw_max
> 8) pw_max
= 8;
10134 case 1600: if (pw_max
> 16) pw_max
= 16;
10136 case 1800: if (pw_max
> 16) pw_max
= 16;
10138 case 2100: if (pw_max
> 16) pw_max
= 16;
10140 case 2500: if (pw_min
< 8) pw_min
= 8;
10142 case 3000: if (pw_max
> 7) pw_max
= 7;
10144 case 5200: if (pw_max
> 24) pw_max
= 24;
10146 case 5800: if (pw_max
> 16) pw_max
= 16;
10148 case 6300: if (pw_max
> 16) pw_max
= 16;
10150 case 7400: if (pw_max
> 16) pw_max
= 16;
10152 case 7900: if (pw_max
> 48) pw_max
= 48;
10154 case 8500: if (pw_max
> 8) pw_max
= 8;
10156 case 8600: if (pw_max
> 16) pw_max
= 16;
10158 case 9710: pw_min
= 5;
10161 case 9810: pw_min
= 5;
10164 case 10410: pw_min
= 5;
10167 case 10300: if (pw_max
< 3) pw_min
= 3;
10168 if (pw_max
> 40) pw_max
= 40;
10170 case 10500: if (pw_max
< 3) pw_min
= 3;
10171 if (pw_max
> 40) pw_max
= 40;
10173 case 10700: if (pw_max
> 16) pw_max
= 16;
10175 case 11300: if (pw_max
> 40) pw_max
= 40;
10177 case 12500: if (pw_max
> 20) pw_max
= 20;
10179 case 12800: if (pw_max
> 24) pw_max
= 24;
10183 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10185 switch (attack_kern
)
10187 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10189 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10195 * charsets : keep them together for more easy maintainnce
10201 memset (mp_sys
, 0, sizeof (mp_sys
));
10202 memset (mp_usr
, 0, sizeof (mp_usr
));
10204 mp_setup_sys (mp_sys
);
10206 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10207 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10208 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10209 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10212 * load hashes, part I: find input mode, count hashes
10215 uint hashlist_mode
= 0;
10216 uint hashlist_format
= HLFMT_HASHCAT
;
10218 uint hashes_avail
= 0;
10220 if (benchmark
== 0)
10224 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10226 if ((hash_mode
== 2500) ||
10227 (hash_mode
== 5200) ||
10228 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10229 (hash_mode
== 9000))
10231 hashlist_mode
= HL_MODE_ARG
;
10233 char *hashfile
= myargv
[optind
];
10235 data
.hashfile
= hashfile
;
10237 logfile_top_var_string ("target", hashfile
);
10240 if (hashlist_mode
== HL_MODE_ARG
)
10242 if (hash_mode
== 2500)
10246 if (stat (data
.hashfile
, &st
) == -1)
10248 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10253 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10260 else if (hashlist_mode
== HL_MODE_FILE
)
10262 char *hashfile
= myargv
[optind
];
10264 data
.hashfile
= hashfile
;
10266 logfile_top_var_string ("target", hashfile
);
10270 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10272 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10277 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10279 hashes_avail
= count_lines (fp
);
10283 if (hashes_avail
== 0)
10285 log_error ("ERROR: hashfile is empty or corrupt");
10292 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10294 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10296 log_error ("ERROR: remove not supported in native hashfile-format mode");
10308 hashlist_mode
= HL_MODE_ARG
;
10313 if (hash_mode
== 3000) hashes_avail
*= 2;
10315 data
.hashlist_mode
= hashlist_mode
;
10316 data
.hashlist_format
= hashlist_format
;
10318 logfile_top_uint (hashlist_mode
);
10319 logfile_top_uint (hashlist_format
);
10322 * load hashes, part II: allocate required memory, set pointers
10325 hash_t
*hashes_buf
= NULL
;
10326 void *digests_buf
= NULL
;
10327 salt_t
*salts_buf
= NULL
;
10328 void *esalts_buf
= NULL
;
10330 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10332 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10334 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10338 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10340 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10342 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10344 if (username
&& (remove
|| show
|| left
))
10346 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10351 hash_info
->orighash
= (char *) mymalloc (256);
10358 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10362 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10367 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10370 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10372 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10376 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10380 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10385 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10390 * load hashes, part III: parse hashes or generate them if benchmark
10393 uint hashes_cnt
= 0;
10395 if (benchmark
== 0)
10399 // useless to read hash file for keyspace, cheat a little bit w/ optind
10401 else if (hashes_avail
== 0)
10404 else if (hashlist_mode
== HL_MODE_ARG
)
10406 char *input_buf
= myargv
[optind
];
10408 uint input_len
= strlen (input_buf
);
10410 logfile_top_var_string ("target", input_buf
);
10412 char *hash_buf
= NULL
;
10415 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10419 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10421 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10423 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10428 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10431 int parser_status
= PARSER_OK
;
10433 if (hash_mode
== 2500)
10437 log_error ("ERROR: hccap file not specified");
10442 hashlist_mode
= HL_MODE_FILE
;
10444 data
.hashlist_mode
= hashlist_mode
;
10446 FILE *fp
= fopen (hash_buf
, "rb");
10450 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10455 if (hashes_avail
< 1)
10457 log_error ("ERROR: hccap file is empty or corrupt");
10464 uint hccap_size
= sizeof (hccap_t
);
10466 char in
[hccap_size
];
10470 int n
= fread (&in
, hccap_size
, 1, fp
);
10474 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10479 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10481 if (parser_status
!= PARSER_OK
)
10483 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10488 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10490 if ((show
== 1) || (left
== 1))
10492 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10494 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10496 int cur_pos
= tmp_salt
->salt_len
;
10497 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10499 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10501 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10503 // do the appending task
10505 snprintf (salt_ptr
+ cur_pos
,
10507 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10508 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10509 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10512 // memset () the remaining part of the salt
10514 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10515 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10517 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10519 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10522 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
);
10523 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
);
10530 else if (hash_mode
== 3000)
10532 if (hash_len
== 32)
10534 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10536 hash_t
*lm_hash_left
= NULL
;
10538 if (parser_status
== PARSER_OK
)
10540 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10546 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10550 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10552 hash_t
*lm_hash_right
= NULL
;
10554 if (parser_status
== PARSER_OK
)
10556 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10562 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10567 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10569 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
);
10570 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
);
10575 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10577 if (parser_status
== PARSER_OK
)
10579 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10580 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10583 if (parser_status
== PARSER_OK
)
10589 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10595 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10597 if (parser_status
== PARSER_OK
)
10599 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10600 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10603 if (parser_status
== PARSER_OK
)
10609 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10614 else if (hashlist_mode
== HL_MODE_FILE
)
10616 char *hashfile
= data
.hashfile
;
10620 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10622 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10633 char line_buf
[BUFSIZ
];
10635 int line_len
= fgetl (fp
, line_buf
);
10637 if (line_len
== 0) continue;
10639 char *hash_buf
= NULL
;
10642 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10646 char *user_buf
= NULL
;
10649 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10651 if (remove
|| show
)
10653 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10655 *user
= (user_t
*) malloc (sizeof (user_t
));
10657 user_t
*user_ptr
= *user
;
10659 if (user_buf
!= NULL
)
10661 user_ptr
->user_name
= mystrdup (user_buf
);
10665 user_ptr
->user_name
= mystrdup ("");
10668 user_ptr
->user_len
= user_len
;
10672 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10674 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10676 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10681 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10684 if (hash_mode
== 3000)
10686 if (hash_len
== 32)
10688 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10690 if (parser_status
< PARSER_GLOBAL_ZERO
)
10692 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10697 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10701 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10703 if (parser_status
< PARSER_GLOBAL_ZERO
)
10705 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10710 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10712 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);
10718 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
);
10719 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
);
10723 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10725 if (parser_status
< PARSER_GLOBAL_ZERO
)
10727 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10732 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);
10734 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10735 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10742 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10744 if (parser_status
< PARSER_GLOBAL_ZERO
)
10746 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10751 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);
10753 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10754 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10762 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10764 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10771 hashes_buf
[0].salt
->salt_len
= 8;
10773 // special salt handling
10777 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10779 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10781 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10783 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10785 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10787 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10789 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10791 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10793 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10795 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10797 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10798 hashes_buf
[0].salt
->scrypt_N
= 1024;
10799 hashes_buf
[0].salt
->scrypt_r
= 1;
10800 hashes_buf
[0].salt
->scrypt_p
= 1;
10802 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10804 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10805 hashes_buf
[0].salt
->scrypt_N
= 16384;
10806 hashes_buf
[0].salt
->scrypt_r
= 1;
10807 hashes_buf
[0].salt
->scrypt_p
= 1;
10809 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10811 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10813 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10815 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10817 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10819 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10821 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10823 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10825 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10827 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10829 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10831 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10833 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10835 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10837 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10841 // special esalt handling
10845 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10847 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10848 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10850 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10851 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10853 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10854 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10855 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10856 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10858 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10859 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10860 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10861 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10863 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10865 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10866 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10867 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10869 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10870 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10871 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10873 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10874 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10875 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10877 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10878 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10879 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10881 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10882 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10883 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10885 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10886 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10887 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10889 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10890 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10891 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10900 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10902 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10904 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10917 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10919 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10921 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10923 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
10927 // set default iterations
10931 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
10933 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10935 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10937 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10939 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
10941 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
10943 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
10945 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
10947 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
10949 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
10953 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
10957 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10961 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10965 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
10967 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
10969 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
10971 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
10973 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
10975 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
10977 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
10979 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
10981 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
10983 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
10985 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
10987 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
10989 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
10991 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
10993 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
10995 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
10997 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
10999 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
11001 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
11003 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
11005 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
11007 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11009 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11011 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11013 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11015 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11017 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11019 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11021 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11023 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11025 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11027 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11029 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11031 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11033 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11035 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11037 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11039 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11043 // set special tuning for benchmark-mode 1
11045 if (benchmark_mode
== 1)
11052 case 400: gpu_loops
= ROUNDS_PHPASS
;
11055 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11058 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11061 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11064 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11067 case 2100: gpu_loops
= ROUNDS_DCC2
;
11070 case 2500: gpu_loops
= ROUNDS_WPA2
;
11073 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11076 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11079 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11082 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11085 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11088 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11091 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11094 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11097 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11100 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11103 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11106 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11109 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11112 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11115 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11118 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11121 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11124 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11127 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11130 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11133 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11136 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11139 case 7200: gpu_loops
= ROUNDS_GRUB
;
11142 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11145 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11148 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11151 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11154 case 8900: gpu_loops
= 1;
11157 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11160 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11163 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11166 case 9300: gpu_loops
= 1;
11169 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11172 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11175 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11178 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11181 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11184 case 10500: gpu_loops
= ROUNDS_PDF14
;
11187 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11190 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11193 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11196 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11199 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11202 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11205 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11208 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11211 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11214 case 12500: gpu_loops
= ROUNDS_RAR3
;
11217 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11220 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11225 // some algorithm collide too fast, make that impossible
11229 case 11500: ((uint
*) digests_buf
)[1] = 1;
11233 if (gpu_loops
> 1024) gpu_loops
= 1024;
11234 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11237 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11242 if (hash_mode
== 12500)
11244 gpu_loops
= ROUNDS_RAR3
/ 16;
11247 data
.gpu_accel
= gpu_accel
;
11248 data
.gpu_loops
= gpu_loops
;
11253 if (show
== 1 || left
== 1)
11255 for (uint i
= 0; i
< pot_cnt
; i
++)
11257 pot_t
*pot_ptr
= &pot
[i
];
11259 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11261 local_free (hashes_buf
->digest
);
11265 local_free (hashes_buf
->salt
);
11271 if (data
.quiet
== 0) log_info_nn ("");
11278 if (hashes_cnt
== 0)
11280 log_error ("ERROR: No hashes loaded");
11287 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11290 if (data
.outfile
!= NULL
)
11292 if (data
.hashfile
!= NULL
)
11295 struct stat tmpstat_outfile
;
11296 struct stat tmpstat_hashfile
;
11300 struct stat64 tmpstat_outfile
;
11301 struct stat64 tmpstat_hashfile
;
11304 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11306 if (tmp_outfile_fp
)
11309 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11313 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11316 fclose (tmp_outfile_fp
);
11319 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11321 if (tmp_hashfile_fp
)
11324 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11328 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11331 fclose (tmp_hashfile_fp
);
11334 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11336 tmpstat_outfile
.st_mode
= 0;
11337 tmpstat_outfile
.st_nlink
= 0;
11338 tmpstat_outfile
.st_uid
= 0;
11339 tmpstat_outfile
.st_gid
= 0;
11340 tmpstat_outfile
.st_rdev
= 0;
11341 tmpstat_outfile
.st_atime
= 0;
11343 tmpstat_hashfile
.st_mode
= 0;
11344 tmpstat_hashfile
.st_nlink
= 0;
11345 tmpstat_hashfile
.st_uid
= 0;
11346 tmpstat_hashfile
.st_gid
= 0;
11347 tmpstat_hashfile
.st_rdev
= 0;
11348 tmpstat_hashfile
.st_atime
= 0;
11351 tmpstat_outfile
.st_blksize
= 0;
11352 tmpstat_outfile
.st_blocks
= 0;
11354 tmpstat_hashfile
.st_blksize
= 0;
11355 tmpstat_hashfile
.st_blocks
= 0;
11359 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11361 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11368 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11370 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11380 * Remove duplicates
11383 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11387 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11391 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11394 uint hashes_cnt_orig
= hashes_cnt
;
11398 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11402 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11404 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11409 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11412 if (hashes_pos
> hashes_cnt
)
11414 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11424 uint potfile_remove_cracks
= 0;
11426 if (potfile_disable
== 0)
11430 hash_buf
.digest
= mymalloc (dgst_size
);
11431 hash_buf
.salt
= NULL
;
11432 hash_buf
.esalt
= NULL
;
11433 hash_buf
.hash_info
= NULL
;
11434 hash_buf
.cracked
= 0;
11438 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11443 hash_buf
.esalt
= mymalloc (esalt_size
);
11446 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11448 // no solution for these special hash types (for instane because they use hashfile in output etc)
11449 if ((hash_mode
!= 5200) &&
11450 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11451 (hash_mode
!= 9000))
11453 FILE *fp
= fopen (potfile
, "rb");
11459 char line_buf
[BUFSIZ
];
11461 memset (line_buf
, 0, BUFSIZ
);
11463 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11465 if (ptr
== NULL
) break;
11467 int line_len
= strlen (line_buf
);
11469 if (line_len
== 0) continue;
11471 int iter
= MAX_CUT_TRIES
;
11473 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11475 if (line_buf
[i
] != ':') continue;
11479 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11482 hash_t
*found
= NULL
;
11484 if (hash_mode
== 6800)
11486 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11488 // manipulate salt_buf
11489 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11491 hash_buf
.salt
->salt_len
= i
;
11493 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11496 else if (hash_mode
== 2500)
11498 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11500 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11501 // manipulate salt_buf
11503 // to be safe work with a copy (because of line_len loop, i etc)
11505 char line_buf_cpy
[BUFSIZ
];
11506 memset (line_buf_cpy
, 0, BUFSIZ
);
11508 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11510 memcpy (line_buf_cpy
, line_buf
, i
);
11512 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11514 if (mac2_pos
== NULL
) continue;
11519 if (strlen (mac2_pos
) != 12) continue;
11521 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11523 if (mac1_pos
== NULL
) continue;
11528 if (strlen (mac1_pos
) != 12) continue;
11530 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11532 // here we need the ESSID
11533 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11535 hash_buf
.salt
->salt_len
= essid_length
;
11537 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11541 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11545 char *pke_ptr
= (char *) pke
;
11547 for (uint i
= 0; i
< 25; i
++)
11549 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11552 unsigned char mac1
[6];
11553 unsigned char mac2
[6];
11555 memcpy (mac1
, pke_ptr
+ 23, 6);
11556 memcpy (mac2
, pke_ptr
+ 29, 6);
11558 // compare hex string(s) vs binary MAC address(es)
11560 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11562 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11570 if (!found
) continue;
11572 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11574 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11585 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11587 if (parser_status
== PARSER_OK
)
11591 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11595 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11600 if (found
== NULL
) continue;
11602 if (!found
->cracked
) potfile_remove_cracks
++;
11604 found
->cracked
= 1;
11618 local_free (hash_buf
.esalt
);
11623 local_free (hash_buf
.salt
);
11626 local_free (hash_buf
.digest
);
11630 * Now generate all the buffers required for later
11633 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11635 salt_t
*salts_buf_new
= NULL
;
11636 void *esalts_buf_new
= NULL
;
11640 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11644 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11649 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11652 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11654 uint digests_cnt
= hashes_cnt
;
11655 uint digests_done
= 0;
11657 uint size_digests
= digests_cnt
* dgst_size
;
11658 uint size_shown
= digests_cnt
* sizeof (uint
);
11660 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11661 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11663 uint salts_cnt
= 0;
11664 uint salts_done
= 0;
11666 hashinfo_t
**hash_info
= NULL
;
11668 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11670 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11672 if (username
&& (remove
|| show
))
11676 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11678 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11680 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11685 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11690 // copied from inner loop
11692 salt_buf
= &salts_buf_new
[salts_cnt
];
11694 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11698 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11701 salt_buf
->digests_cnt
= 0;
11702 salt_buf
->digests_done
= 0;
11703 salt_buf
->digests_offset
= 0;
11708 if (hashes_buf
[0].cracked
== 1)
11710 digests_shown
[0] = 1;
11714 salt_buf
->digests_done
++;
11717 salt_buf
->digests_cnt
++;
11719 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11721 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11723 hash_info
[0] = hashes_buf
[0].hash_info
;
11726 // copy from inner loop
11728 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11732 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11734 salt_buf
= &salts_buf_new
[salts_cnt
];
11736 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11740 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11743 salt_buf
->digests_cnt
= 0;
11744 salt_buf
->digests_done
= 0;
11745 salt_buf
->digests_offset
= hashes_pos
;
11751 if (hashes_buf
[hashes_pos
].cracked
== 1)
11753 digests_shown
[hashes_pos
] = 1;
11757 salt_buf
->digests_done
++;
11760 salt_buf
->digests_cnt
++;
11762 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11764 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11766 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11770 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11772 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11774 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11776 salts_shown
[salt_pos
] = 1;
11781 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11784 local_free (digests_buf
);
11785 local_free (salts_buf
);
11786 local_free (esalts_buf
);
11788 digests_buf
= digests_buf_new
;
11789 salts_buf
= salts_buf_new
;
11790 esalts_buf
= esalts_buf_new
;
11792 local_free (hashes_buf
);
11795 * special modification not set from parser
11800 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11801 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11802 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11803 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11804 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11805 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11806 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11807 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11808 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11809 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11810 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11811 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11814 if (truecrypt_keyfiles
)
11816 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11818 char *keyfiles
= strdup (truecrypt_keyfiles
);
11820 char *keyfile
= strtok (keyfiles
, ",");
11824 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11826 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11831 data
.digests_cnt
= digests_cnt
;
11832 data
.digests_done
= digests_done
;
11833 data
.digests_buf
= digests_buf
;
11834 data
.digests_shown
= digests_shown
;
11835 data
.digests_shown_tmp
= digests_shown_tmp
;
11837 data
.salts_cnt
= salts_cnt
;
11838 data
.salts_done
= salts_done
;
11839 data
.salts_buf
= salts_buf
;
11840 data
.salts_shown
= salts_shown
;
11842 data
.esalts_buf
= esalts_buf
;
11843 data
.hash_info
= hash_info
;
11846 * Automatic Optimizers
11849 if (salts_cnt
== 1)
11850 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11852 if (digests_cnt
== 1)
11853 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11855 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11856 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11858 if (attack_mode
== ATTACK_MODE_BF
)
11859 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11861 data
.opti_type
= opti_type
;
11863 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11865 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11867 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11869 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11871 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11872 opts_type
|= OPTS_TYPE_PT_ADD80
;
11875 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11877 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11878 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11881 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11883 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11884 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11891 * Some algorithm, like descrypt, can benefit from JIT compilation
11894 uint force_jit_compilation
= 0;
11896 if (hash_mode
== 8900)
11898 force_jit_compilation
= 8900;
11900 else if (hash_mode
== 9300)
11902 force_jit_compilation
= 8900;
11904 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11906 force_jit_compilation
= 1500;
11910 * generate bitmap tables
11913 const uint bitmap_shift1
= 5;
11914 const uint bitmap_shift2
= 13;
11916 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11918 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11919 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11920 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11921 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11922 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11923 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11924 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11925 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11932 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
11934 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
11936 bitmap_nums
= 1 << bitmap_bits
;
11938 bitmap_mask
= bitmap_nums
- 1;
11940 bitmap_size
= bitmap_nums
* sizeof (uint
);
11942 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
11944 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;
11945 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;
11950 bitmap_nums
= 1 << bitmap_bits
;
11952 bitmap_mask
= bitmap_nums
- 1;
11954 bitmap_size
= bitmap_nums
* sizeof (uint
);
11956 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);
11957 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);
11960 * prepare quick rule
11963 data
.rule_buf_l
= rule_buf_l
;
11964 data
.rule_buf_r
= rule_buf_r
;
11966 int rule_len_l
= (int) strlen (rule_buf_l
);
11967 int rule_len_r
= (int) strlen (rule_buf_r
);
11969 data
.rule_len_l
= rule_len_l
;
11970 data
.rule_len_r
= rule_len_r
;
11976 uint
*all_gpu_rules_cnt
= NULL
;
11978 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
11982 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
11984 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
11987 char rule_buf
[BUFSIZ
];
11991 for (uint i
= 0; i
< rp_files_cnt
; i
++)
11993 uint gpu_rules_avail
= 0;
11995 uint gpu_rules_cnt
= 0;
11997 gpu_rule_t
*gpu_rules_buf
= NULL
;
11999 char *rp_file
= rp_files
[i
];
12001 char in
[BLOCK_SIZE
];
12002 char out
[BLOCK_SIZE
];
12006 uint rule_line
= 0;
12008 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12010 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12017 memset (rule_buf
, 0, BUFSIZ
);
12019 rule_len
= fgetl (fp
, rule_buf
);
12023 if (rule_len
== 0) continue;
12025 if (rule_buf
[0] == '#') continue;
12027 if (gpu_rules_avail
== gpu_rules_cnt
)
12029 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12031 gpu_rules_avail
+= INCR_RULES
;
12034 memset (in
, 0, BLOCK_SIZE
);
12035 memset (out
, 0, BLOCK_SIZE
);
12037 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12041 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12046 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12048 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12050 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12056 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12058 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12069 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12071 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12075 * merge rules or automatic rule generator
12078 uint gpu_rules_cnt
= 0;
12080 gpu_rule_t
*gpu_rules_buf
= NULL
;
12082 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12088 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12090 repeats
[0] = gpu_rules_cnt
;
12092 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12094 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12096 repeats
[i
+ 1] = gpu_rules_cnt
;
12099 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12101 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12103 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12107 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12109 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12111 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12114 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12116 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12118 if (out_pos
== RULES_MAX
- 1)
12120 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12125 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12130 local_free (repeats
);
12134 uint gpu_rules_avail
= 0;
12136 while (gpu_rules_cnt
< rp_gen
)
12138 if (gpu_rules_avail
== gpu_rules_cnt
)
12140 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12142 gpu_rules_avail
+= INCR_RULES
;
12145 memset (rule_buf
, 0, BLOCK_SIZE
);
12147 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12149 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12157 * generate NOP rules
12160 if (gpu_rules_cnt
== 0)
12162 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12164 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12169 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12170 data
.gpu_rules_buf
= gpu_rules_buf
;
12176 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12178 uint CL_platforms_cnt
= 0;
12180 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12182 if (CL_platforms_cnt
== 0)
12184 log_error ("ERROR: No OpenCL compatible platform found");
12189 if (CL_platforms_cnt
> 1)
12191 log_error ("ERROR: Too many OpenCL compatible platforms found");
12196 cl_platform_id CL_platform
= CL_platforms
[0];
12198 char CL_platform_vendor
[INFOSZ
];
12200 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12202 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12206 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12208 vendor_id
= VENDOR_ID_AMD
;
12210 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12212 vendor_id
= VENDOR_ID_NV
;
12214 // make sure that we do not directly control the fan for NVidia
12216 gpu_temp_retain
= 0;
12217 data
.gpu_temp_retain
= gpu_temp_retain
;
12221 vendor_id
= VENDOR_ID_UNKNOWN
;
12224 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12226 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12228 gpu_temp_disable
= 1;
12231 data
.vendor_id
= vendor_id
;
12237 cl_device_id devices_all
[DEVICES_MAX
];
12238 cl_device_id devices
[DEVICES_MAX
];
12240 uint devices_all_cnt
= 0;
12242 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12244 int hm_adapters_all
= devices_all_cnt
;
12246 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12248 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12250 if (gpu_temp_disable
== 0)
12252 if (vendor_id
== VENDOR_ID_NV
)
12255 if (hc_NVML_nvmlInit () == NVML_SUCCESS
)
12257 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12259 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12263 for (int i
= 0; i
< tmp_in
; i
++)
12265 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12268 hm_adapters_all
= tmp_out
;
12270 for (int i
= 0; i
< tmp_out
; i
++)
12272 unsigned int speed
;
12274 if (nvmlDeviceGetFanSpeed (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12280 if (NvAPI_Initialize () == NVAPI_OK
)
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
++)
12299 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12305 if (vendor_id
== VENDOR_ID_AMD
)
12307 HM_LIB hm_dll
= hm_init_amd ();
12309 data
.hm_dll
= hm_dll
;
12311 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12313 // total number of adapters
12315 int hm_adapters_num
;
12317 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12321 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12323 if (lpAdapterInfo
== NULL
) return (-1);
12325 // get a list (of ids of) valid/usable adapters
12327 int num_adl_adapters
= 0;
12329 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12331 if (num_adl_adapters
> 0)
12333 hc_thread_mutex_lock (mux_adl
);
12335 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12337 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12339 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12340 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12342 hc_thread_mutex_unlock (mux_adl
);
12345 hm_adapters_all
= num_adl_adapters
;
12347 myfree (valid_adl_device_list
);
12348 myfree (lpAdapterInfo
);
12353 if (hm_adapters_all
== 0)
12355 gpu_temp_disable
= 1;
12358 if (gpu_temp_disable
== 1)
12360 gpu_temp_abort
= 0;
12361 gpu_temp_retain
= 0;
12365 * enable custom signal handler(s)
12368 if (benchmark
== 0)
12370 hc_signal (sigHandler_default
);
12374 hc_signal (sigHandler_benchmark
);
12378 * devices mask and properties
12381 uint devices_cnt
= 0;
12383 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12385 if (gpu_devicemask
)
12387 uint device_all_id_mask
= 1 << device_all_id
;
12389 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12391 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12397 const uint device_id
= devices_cnt
;
12399 devices
[device_id
] = devices_all
[device_all_id
];
12401 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12403 char device_name
[INFOSZ
];
12405 memset (device_name
, 0, sizeof (device_name
));
12407 cl_ulong global_mem_size
;
12408 cl_uint max_clock_frequency
;
12409 cl_uint max_compute_units
;
12411 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12412 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12413 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12414 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12416 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12418 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12421 (unsigned int) (global_mem_size
/ 1024 / 1024),
12422 (unsigned int) (max_clock_frequency
),
12423 (unsigned int) max_compute_units
);
12429 if (devices_cnt
== 0)
12431 log_error ("ERROR: No devices left that matches your specification.");
12436 data
.devices_cnt
= devices_cnt
;
12438 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12447 // gpu temp sanity check
12449 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12451 if (gpu_temp_abort
< gpu_temp_retain
)
12453 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12459 data
.gpu_temp_disable
= gpu_temp_disable
;
12460 data
.gpu_temp_abort
= gpu_temp_abort
;
12461 data
.gpu_temp_retain
= gpu_temp_retain
;
12463 if (data
.quiet
== 0)
12465 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12467 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
);
12469 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12471 log_info ("Rules: %u", gpu_rules_cnt
);
12476 log_info ("Applicable Optimizers:");
12478 for (uint i
= 0; i
< 32; i
++)
12480 const uint opti_bit
= 1 << i
;
12482 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12487 * Watchdog and Temperature balance
12490 if (gpu_temp_abort
== 0)
12492 log_info ("Watchdog: Temperature abort trigger disabled");
12496 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12499 if (gpu_temp_retain
== 0)
12501 log_info ("Watchdog: Temperature retain trigger disabled");
12505 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12513 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12515 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12517 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12519 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12521 data
.devices_param
= devices_param
;
12523 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12525 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12527 cl_device_id device
= devices
[device_id
];
12529 device_param
->device
= device
;
12531 cl_uint max_compute_units
= 0;
12533 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12535 device_param
->gpu_processors
= max_compute_units
;
12537 cl_ulong max_mem_alloc_size
= 0;
12539 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12541 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12543 char tmp
[INFOSZ
], t1
[64];
12545 memset (tmp
, 0, sizeof (tmp
));
12547 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12549 device_param
->device_name
= mystrdup (tmp
);
12551 memset (tmp
, 0, sizeof (tmp
));
12553 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12555 memset (t1
, 0, sizeof (t1
));
12557 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12559 device_param
->device_version
= mystrdup (t1
);
12561 memset (tmp
, 0, sizeof (tmp
));
12563 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12565 device_param
->driver_version
= mystrdup (tmp
);
12567 if (vendor_id
== VENDOR_ID_NV
)
12569 cl_uint sm_minor
= 0;
12570 cl_uint sm_major
= 0;
12572 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12573 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12575 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12576 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12578 device_param
->sm_minor
= sm_minor
;
12579 device_param
->sm_major
= sm_major
;
12583 * catalyst driver check
12586 if (vendor_id
== VENDOR_ID_AMD
)
12588 int catalyst_check
= (force
== 1) ? 0 : 1;
12590 int catalyst_warn
= 0;
12592 int catalyst_broken
= 0;
12594 if (catalyst_check
== 1)
12598 // v14.9 and higher
12599 if ((atoi (device_param
->device_version
) >= 1573)
12600 && (atoi (device_param
->driver_version
) >= 1573))
12607 if ((strstr (device_param->device_version, "1573.") != NULL)
12608 && (strstr (device_param->driver_version, "1573.") != NULL))
12613 // v14.12 -- version overlaps with v15.4 beta
12614 if ((strstr (device_param->device_version, "1642.") != NULL)
12615 && (strstr (device_param->driver_version, "1642.") != NULL))
12617 catalyst_broken = 1;
12620 // v15.4 (Beta, Windows only release)
12621 if ((strstr (device_param->device_version, "1642.") != NULL)
12622 && (strstr (device_param->driver_version, "1642.") != NULL))
12627 // v15.5 (Release, Linux)
12628 if ((strstr (device_param->device_version, "1702.") != NULL)
12629 && (strstr (device_param->driver_version, "1702.") != NULL))
12634 // v15.3 (Beta, Ubuntu repository release)
12635 if ((strstr (device_param->device_version, "1729.") != NULL)
12636 && (strstr (device_param->driver_version, "1729.") != NULL))
12642 catalyst_check
= 0;
12645 if (catalyst_broken
== 1)
12648 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12649 log_error ("It will pass over cracked hashes and does not report them as cracked");
12650 log_error ("You are STRONGLY encouraged not to use it");
12651 log_error ("You can use --force to override this but do not post error reports if you do so");
12656 if (catalyst_warn
== 1)
12659 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12660 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12661 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12663 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12665 log_error ("You can use --force to override this but do not post error reports if you do so");
12674 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12675 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12676 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12677 * Driver / ADL bug?
12680 if (vendor_id
== VENDOR_ID_AMD
)
12682 if (powertune_enable
== 1)
12684 hc_thread_mutex_lock (mux_adl
);
12686 for (uint i
= 0; i
< devices_cnt
; i
++)
12688 if (data
.hm_device
[i
].od_version
== 6)
12690 // set powertune value only
12692 int powertune_supported
= 0;
12696 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12698 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12703 if (powertune_supported
!= 0)
12706 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12708 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12710 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12715 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12717 log_error ("ERROR: Failed to set new ADL PowerControl values");
12725 hc_thread_mutex_unlock (mux_adl
);
12729 uint gpu_blocks_all
= 0;
12731 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12737 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12740 * device properties
12743 char *device_name
= device_param
->device_name
;
12744 char *device_version
= device_param
->device_version
;
12745 char *driver_version
= device_param
->driver_version
;
12747 uint gpu_processors
= device_param
->gpu_processors
;
12750 * create context for each device
12753 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12756 * create command-queue
12759 // not support with NV
12760 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12762 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12765 * create input buffers on device
12768 uint gpu_threads
= GPU_THREADS
;
12770 if (hash_mode
== 3200) gpu_threads
= 8;
12771 if (hash_mode
== 9000) gpu_threads
= 8;
12773 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12774 uint gpu_blocks
= gpu_power
;
12776 device_param
->gpu_threads
= gpu_threads
;
12777 device_param
->gpu_power_user
= gpu_power
;
12778 device_param
->gpu_blocks_user
= gpu_blocks
;
12780 gpu_blocks_all
+= gpu_blocks
;
12782 uint size_pws
= gpu_power
* sizeof (pw_t
);
12784 uint size_tmps
= 4;
12788 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12789 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12790 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12791 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12792 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12793 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12794 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12795 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12796 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12797 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12800 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12803 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12806 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12809 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12810 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12811 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12812 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12813 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12814 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12815 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12816 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12817 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12818 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12819 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12820 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12821 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12822 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12823 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12824 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12825 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12826 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12827 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12828 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12829 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12830 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12831 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12832 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12833 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12834 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12835 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12836 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12837 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12838 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12839 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12840 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12841 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12842 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12843 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12844 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12845 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12846 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12849 uint size_hooks
= 4;
12851 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12853 // insert correct hook size
12856 // we can optimize some stuff here...
12858 device_param
->size_pws
= size_pws
;
12859 device_param
->size_tmps
= size_tmps
;
12860 device_param
->size_hooks
= size_hooks
;
12862 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12863 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12865 device_param
->size_root_css
= size_root_css
;
12866 device_param
->size_markov_css
= size_markov_css
;
12868 uint size_results
= GPU_THREADS
* sizeof (uint
);
12870 device_param
->size_results
= size_results
;
12872 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12873 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12874 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12875 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12876 uint size_esalts
= salts_cnt
* esalt_size
;
12878 device_param
->size_plains
= size_plains
;
12879 device_param
->size_digests
= size_digests
;
12880 device_param
->size_shown
= size_shown
;
12881 device_param
->size_salts
= size_salts
;
12883 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12884 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12885 uint size_tm
= 32 * sizeof (bs_word_t
);
12887 uint64_t size_scryptV
= 1;
12889 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12891 #define SHADER_PER_MP 8
12892 #define WAVEFRONTS 64
12894 uint tmto_start
= 2;
12895 uint tmto_stop
= 1024;
12899 tmto_start
= 1 << scrypt_tmto
;
12900 tmto_stop
= tmto_start
+ 1;
12903 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
<<= 1)
12905 // todo -- make sure all salts get the new tmto value
12907 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
12909 size_scryptV
/= tmto
;
12911 size_scryptV
*= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12913 if (size_scryptV
> (device_param
->gpu_maxmem_alloc
/ 2)) continue;
12915 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
12917 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
12918 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* WAVEFRONTS
* SHADER_PER_MP
;
12924 if (data
.salts_buf
[0].scrypt_tmto
== 0)
12926 log_error ("ERROR: can't allocate enough GPU memory");
12931 if (quiet
== 0) log_info ("");
12932 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
12939 char build_opts
[100];
12941 // we don't have sm_* on AMD but it doesn't matter
12943 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
12947 char kernel_file
[256];
12949 memset (kernel_file
, 0, sizeof (kernel_file
));
12951 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
12953 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
12955 #ifdef BINARY_KERNEL
12956 if (force_jit_compilation
== 0)
12958 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12960 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12961 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
);
12962 else if (attack_kern
== ATTACK_KERN_COMBI
)
12963 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
);
12964 else if (attack_kern
== ATTACK_KERN_BF
)
12965 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
);
12969 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
);
12971 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12973 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
);
12977 if (stat (kernel_file
, &st
) == -1)
12979 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_file
);
12981 char module_file
[256];
12983 memset (module_file
, 0, sizeof (module_file
));
12985 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
12987 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
12988 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a0.llvmir", install_dir
, (int) kern_type
);
12989 else if (attack_kern
== ATTACK_KERN_COMBI
)
12990 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a1.llvmir", install_dir
, (int) kern_type
);
12991 else if (attack_kern
== ATTACK_KERN_BF
)
12992 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d_a3.llvmir", install_dir
, (int) kern_type
);
12996 snprintf (module_file
, sizeof (module_file
) - 1, "%s/kernels/4098/m%05d.llvmir", install_dir
, (int) kern_type
);
12998 if ((hash_mode
== 8900) || (hash_mode
== 9300))
13000 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
);
13004 load_kernel (module_file
, 1, kernel_lengths
, kernel_sources
);
13006 cl_program program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13008 local_free (kernel_sources
[0]);
13010 hc_clBuildProgram (program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13012 size_t binary_size
;
13014 clGetProgramInfo (program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13016 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13018 clGetProgramInfo (program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13020 writeProgramBin (kernel_file
, binary
, binary_size
);
13022 local_free (binary
);
13024 stat (kernel_file
, &st
); // to reload filesize
13029 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13031 if (stat (kernel_file
, &st
) == -1)
13033 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13041 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, kernel_file
);
13043 if (stat (kernel_file
, &st
) == -1)
13045 log_error ("ERROR: %s: %s", kernel_file
, strerror (errno
));
13052 load_kernel (kernel_file
, 1, kernel_lengths
, kernel_sources
);
13054 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_file
, st
.st_size
);
13056 #ifdef BINARY_KERNEL
13057 if (force_jit_compilation
== 0)
13059 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13063 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13066 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13069 local_free (kernel_lengths
);
13071 local_free (kernel_sources
[0]);
13073 local_free (kernel_sources
)
13079 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13081 char kernel_mp_file
[256];
13083 memset (kernel_mp_file
, 0, sizeof (kernel_mp_file
));
13085 size_t *kernel_mp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13087 const unsigned char **kernel_mp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13089 #ifdef BINARY_KERNEL
13090 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13092 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
);
13096 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
);
13099 if (stat (kernel_mp_file
, &st
) == -1)
13101 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_mp_file
);
13103 char module_mp_file
[256];
13105 memset (module_mp_file
, 0, sizeof (module_mp_file
));
13107 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13109 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_be.llvmir", install_dir
);
13113 snprintf (module_mp_file
, sizeof (module_mp_file
) - 1, "%s/kernels/4098/markov_le.llvmir", install_dir
);
13116 load_kernel (module_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13118 cl_program program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13120 local_free (kernel_mp_sources
[0]);
13122 hc_clBuildProgram (program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13124 size_t binary_mp_size
;
13126 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_mp_size
, NULL
);
13128 unsigned char *binary_mp
= (unsigned char *) mymalloc (binary_mp_size
);
13130 clGetProgramInfo (program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary_mp
), &binary_mp
, NULL
);
13132 writeProgramBin (kernel_mp_file
, binary_mp
, binary_mp_size
);
13134 local_free (binary_mp
);
13136 stat (kernel_mp_file
, &st
); // to reload filesize
13140 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
13142 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_be.cl", install_dir
);
13146 snprintf (kernel_mp_file
, sizeof (kernel_mp_file
) - 1, "%s/OpenCL/markov_le.cl", install_dir
);
13149 if (stat (kernel_mp_file
, &st
) == -1)
13151 log_error ("ERROR: %s: %s", kernel_mp_file
, strerror (errno
));
13158 load_kernel (kernel_mp_file
, 1, kernel_mp_lengths
, kernel_mp_sources
);
13160 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_mp_file
, st
.st_size
);
13162 #ifdef BINARY_KERNEL
13163 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_mp_lengths
, (const unsigned char **) kernel_mp_sources
, NULL
);
13165 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_mp_sources
, NULL
);
13168 local_free (kernel_mp_lengths
);
13170 local_free (kernel_mp_sources
[0]);
13172 local_free (kernel_mp_sources
);
13179 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13185 char kernel_amp_file
[256];
13187 memset (kernel_amp_file
, 0, sizeof (kernel_amp_file
));
13189 size_t *kernel_amp_lengths
= (size_t *) mymalloc (sizeof (size_t));
13191 const unsigned char **kernel_amp_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13193 #ifdef BINARY_KERNEL
13194 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
);
13196 if (stat (kernel_amp_file
, &st
) == -1)
13198 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, kernel_amp_file
);
13200 char module_amp_file
[256];
13202 memset (module_amp_file
, 0, sizeof (module_amp_file
));
13204 snprintf (module_amp_file
, sizeof (module_amp_file
) - 1, "%s/kernels/4098/amp_a%d.llvmir", install_dir
, attack_kern
);
13206 load_kernel (module_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13208 cl_program program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13210 local_free (kernel_amp_sources
[0]);
13212 hc_clBuildProgram (program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13214 size_t binary_amp_size
;
13216 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_amp_size
, NULL
);
13218 unsigned char *binary_amp
= (unsigned char *) mymalloc (binary_amp_size
);
13220 clGetProgramInfo (program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary_amp
), &binary_amp
, NULL
);
13222 writeProgramBin (kernel_amp_file
, binary_amp
, binary_amp_size
);
13224 local_free (binary_amp
);
13226 stat (kernel_amp_file
, &st
); // to reload filesize
13229 snprintf (kernel_amp_file
, sizeof (kernel_amp_file
) - 1, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
13231 if (stat (kernel_amp_file
, &st
) == -1)
13233 log_error ("ERROR: %s: %s", kernel_amp_file
, strerror (errno
));
13239 load_kernel (kernel_amp_file
, 1, kernel_amp_lengths
, kernel_amp_sources
);
13241 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, kernel_amp_file
, st
.st_size
);
13243 #ifdef BINARY_KERNEL
13244 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_amp_lengths
, (const unsigned char **) kernel_amp_sources
, NULL
);
13246 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_amp_sources
, NULL
);
13249 local_free (kernel_amp_lengths
);
13251 local_free (kernel_amp_sources
[0]);
13253 local_free (kernel_amp_sources
);
13260 #ifdef BINARY_KERNEL
13262 if (force_jit_compilation
== 0)
13266 else if (force_jit_compilation
== 1500)
13268 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13270 else if (force_jit_compilation
== 8900)
13272 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
);
13277 clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13279 size_t ret_val_size
= 0;
13281 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13283 if (ret_val_size
> 1)
13285 char *build_log
= (char *) malloc (ret_val_size
+ 1);
13287 memset (build_log
, 0, ret_val_size
+ 1);
13289 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13296 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13298 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13301 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13307 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13311 * amp is not independent
13314 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13320 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13327 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13328 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13329 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13330 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13331 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13332 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13333 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13334 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13335 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13336 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13337 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13338 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13339 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13340 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13341 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13342 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13343 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13344 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13346 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13347 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13348 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13349 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13350 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13351 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13352 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13353 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13354 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13355 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13356 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13358 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13359 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13360 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13361 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13362 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13363 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13369 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13371 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13372 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13374 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13376 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13378 else if (attack_kern
== ATTACK_KERN_COMBI
)
13380 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13381 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13382 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13383 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13385 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13386 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13387 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13388 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13390 else if (attack_kern
== ATTACK_KERN_BF
)
13392 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13393 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13394 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13395 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13396 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13398 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13399 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13400 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13401 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13402 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13407 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13409 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13416 uint
*result
= (uint
*) mymalloc (size_results
);
13418 memset (result
, 0, size_results
);
13420 device_param
->result
= result
;
13422 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13424 memset (pws_buf
, 0, size_pws
);
13426 device_param
->pws_buf
= pws_buf
;
13428 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13430 for (int i
= 0; i
< 64; i
++)
13432 pw_caches
[i
].pw_buf
.pw_len
= i
;
13433 pw_caches
[i
].cnt
= 0;
13436 device_param
->pw_caches
= pw_caches
;
13438 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13440 device_param
->combs_buf
= combs_buf
;
13442 void *hooks_buf
= mymalloc (size_hooks
);
13444 device_param
->hooks_buf
= hooks_buf
;
13446 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13447 device_param
->pw_add
= pw_add_to_hc1
;
13453 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13454 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13455 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13456 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13457 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13458 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13459 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13460 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13461 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13462 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13463 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13465 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13466 ? &device_param
->d_pws_buf
13467 : &device_param
->d_pws_amp_buf
;
13468 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13469 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13470 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13471 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13472 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13473 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13474 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13475 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13476 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13477 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13478 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13479 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13480 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13481 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13482 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13483 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13484 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13485 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13486 device_param
->kernel_params
[19] = &device_param
->d_result
;
13487 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13488 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13489 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13490 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13491 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13492 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13493 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13494 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13495 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13496 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13497 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13498 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13500 device_param
->kernel_params_mp_buf64
[3] = 0;
13501 device_param
->kernel_params_mp_buf32
[4] = 0;
13502 device_param
->kernel_params_mp_buf32
[5] = 0;
13503 device_param
->kernel_params_mp_buf32
[6] = 0;
13504 device_param
->kernel_params_mp_buf32
[7] = 0;
13505 device_param
->kernel_params_mp_buf32
[8] = 0;
13507 device_param
->kernel_params_mp
[0] = NULL
;
13508 device_param
->kernel_params_mp
[1] = NULL
;
13509 device_param
->kernel_params_mp
[2] = NULL
;
13510 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13511 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13512 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13513 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13514 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13515 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13517 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13518 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13519 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13520 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13521 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13522 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13523 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13525 device_param
->kernel_params_mp_l
[0] = NULL
;
13526 device_param
->kernel_params_mp_l
[1] = NULL
;
13527 device_param
->kernel_params_mp_l
[2] = NULL
;
13528 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13529 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13530 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13531 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13532 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13533 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13534 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13536 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13537 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13538 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13539 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13540 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13541 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13543 device_param
->kernel_params_mp_r
[0] = NULL
;
13544 device_param
->kernel_params_mp_r
[1] = NULL
;
13545 device_param
->kernel_params_mp_r
[2] = NULL
;
13546 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13547 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13548 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13549 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13550 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13551 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13553 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13554 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13556 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13557 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13558 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13559 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13560 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13561 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13562 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13564 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13566 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13567 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13573 char kernel_name
[64];
13575 memset (kernel_name
, 0, sizeof (kernel_name
));
13577 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13579 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13581 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13583 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13585 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13587 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13589 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13591 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13595 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13597 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13599 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13601 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13603 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13605 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13608 if (data
.attack_mode
== ATTACK_MODE_BF
)
13610 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13612 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13614 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13616 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13618 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13624 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13626 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13628 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13630 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13632 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13634 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13636 if (opts_type
& OPTS_TYPE_HOOK12
)
13638 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13640 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13643 if (opts_type
& OPTS_TYPE_HOOK23
)
13645 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13647 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13651 for (uint i
= 0; i
<= 20; i
++)
13653 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13654 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13655 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13657 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13658 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13661 for (uint i
= 21; i
<= 31; i
++)
13663 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13664 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13665 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13667 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13668 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13671 if (attack_mode
== ATTACK_MODE_BF
)
13673 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13674 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13676 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13678 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13680 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13681 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13684 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13686 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13688 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13690 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13693 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13699 for (uint i
= 0; i
< 5; i
++)
13701 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13704 for (uint i
= 5; i
< 7; i
++)
13706 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13711 * Store initial fanspeed if gpu_temp_retain is enabled
13714 int gpu_temp_retain_set
= 0;
13716 if (gpu_temp_disable
== 0)
13718 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13720 hc_thread_mutex_lock (mux_adl
);
13722 if (data
.hm_device
[device_id
].fan_supported
== 1)
13724 if (gpu_temp_retain_chgd
== 0)
13727 uint default_temp
= 0;
13729 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
);
13731 if (ADL_rc
== ADL_OK
)
13733 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13735 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13737 // special case with multi gpu setups: always use minimum retain
13739 if (gpu_temp_retain_set
== 0)
13741 gpu_temp_retain
= gpu_temp_retain_target
;
13742 gpu_temp_retain_set
= 1;
13746 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13749 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13753 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13755 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13757 if (fan_speed
== -1)
13759 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13761 temp_retain_fanspeed_value
[device_id
] = 0;
13765 hc_thread_mutex_unlock (mux_adl
);
13770 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13773 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13775 hc_thread_mutex_lock (mux_adl
);
13777 if (data
.hm_device
[device_id
].od_version
== 6)
13781 // check powertune capabilities first, if not available then skip device
13783 int powertune_supported
= 0;
13785 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13787 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13792 if (powertune_supported
!= 0)
13794 // powercontrol settings
13796 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13798 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13800 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13803 if (ADL_rc
!= ADL_OK
)
13805 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13810 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13812 log_error ("ERROR: Failed to set new ADL PowerControl values");
13819 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13821 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13823 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
)
13825 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13830 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13832 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13834 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
13836 log_error ("ERROR: Failed to get ADL device capabilities");
13841 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
13842 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
13844 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
13845 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
13847 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
13848 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
13850 // warning if profile has to low max values
13852 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
13854 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13857 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
13859 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13862 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
13864 performance_state
->iNumberOfPerformanceLevels
= 2;
13866 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
13867 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
13868 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
13869 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
13871 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
)
13873 log_info ("ERROR: Failed to set ADL performance state");
13878 local_free (performance_state
);
13882 hc_thread_mutex_unlock (mux_adl
);
13886 data
.gpu_blocks_all
= gpu_blocks_all
;
13888 if (data
.quiet
== 0) log_info ("");
13891 * Inform user which algorithm is checked and at which workload setting
13894 if (benchmark
== 1)
13898 data
.quiet
= quiet
;
13900 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
13902 log_info ("Hashtype: %s", hash_type
);
13903 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
13908 * keep track of the progress
13911 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13912 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13913 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13920 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
13922 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
13927 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
13929 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
13934 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
13936 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
13946 segment_size
*= (1024 * 1024);
13948 data
.segment_size
= segment_size
;
13950 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
13952 wl_data
->buf
= (char *) mymalloc (segment_size
);
13953 wl_data
->avail
= segment_size
;
13954 wl_data
->incr
= segment_size
;
13958 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
13960 data
.wordlist_mode
= wordlist_mode
;
13962 cs_t
*css_buf
= NULL
;
13966 char **masks
= NULL
;
13967 char **dictfiles
= NULL
;
13969 uint mask_from_file
= 0;
13971 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
13973 if (wordlist_mode
== WL_MODE_FILE
)
13975 int wls_left
= myargc
- (optind
+ 1);
13977 for (int i
= 0; i
< wls_left
; i
++)
13979 char *l0_filename
= myargv
[optind
+ 1 + i
];
13981 struct stat l0_stat
;
13983 if (stat (l0_filename
, &l0_stat
) == -1)
13985 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
13990 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
13994 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
13998 dictfiles
[dictcnt
- 1] = l0_filename
;
14002 // do not allow --keyspace w/ a directory
14006 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14011 char **dictionary_files
= NULL
;
14013 dictionary_files
= scan_directory (l0_filename
);
14015 if (dictionary_files
!= NULL
)
14017 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14019 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14021 char *l1_filename
= dictionary_files
[d
];
14023 struct stat l1_stat
;
14025 if (stat (l1_filename
, &l1_stat
) == -1)
14027 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14032 if (S_ISREG (l1_stat
.st_mode
))
14034 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14038 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14043 local_free (dictionary_files
);
14049 log_error ("ERROR: No usable dictionary file found.");
14054 else if (wordlist_mode
== WL_MODE_STDIN
)
14059 else if (attack_mode
== ATTACK_MODE_COMBI
)
14063 char *dictfile1
= myargv
[optind
+ 1 + 0];
14064 char *dictfile2
= myargv
[optind
+ 1 + 1];
14066 // find the bigger dictionary and use as base
14071 struct stat tmp_stat
;
14073 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14075 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14080 if (stat (dictfile1
, &tmp_stat
) == -1)
14082 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14089 if (S_ISDIR (tmp_stat
.st_mode
))
14091 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14098 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14100 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14107 if (stat (dictfile2
, &tmp_stat
) == -1)
14109 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14117 if (S_ISDIR (tmp_stat
.st_mode
))
14119 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14127 data
.combs_cnt
= 1;
14131 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14133 data
.quiet
= quiet
;
14135 if (words1_cnt
== 0)
14137 log_error ("ERROR: %s: empty file", dictfile1
);
14145 data
.combs_cnt
= 1;
14149 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14151 data
.quiet
= quiet
;
14153 if (words2_cnt
== 0)
14155 log_error ("ERROR: %s: empty file", dictfile2
);
14166 data
.dictfile
= dictfile1
;
14167 data
.dictfile2
= dictfile2
;
14169 if (words1_cnt
>= words2_cnt
)
14171 data
.combs_cnt
= words2_cnt
;
14172 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14174 dictfiles
= &data
.dictfile
;
14180 data
.combs_cnt
= words1_cnt
;
14181 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14183 dictfiles
= &data
.dictfile2
;
14187 // we also have to switch wordlist related rules!
14189 char *tmpc
= data
.rule_buf_l
;
14191 data
.rule_buf_l
= data
.rule_buf_r
;
14192 data
.rule_buf_r
= tmpc
;
14194 int tmpi
= data
.rule_len_l
;
14196 data
.rule_len_l
= data
.rule_len_r
;
14197 data
.rule_len_r
= tmpi
;
14200 else if (attack_mode
== ATTACK_MODE_BF
)
14206 if (benchmark
== 0)
14208 mask
= myargv
[optind
+ 1];
14210 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14212 if ((optind
+ 2) <= myargc
)
14214 struct stat file_stat
;
14216 if (stat (mask
, &file_stat
) == -1)
14220 masks
[maskcnt
- 1] = mystrdup (mask
);
14224 int wls_left
= myargc
- (optind
+ 1);
14226 uint masks_avail
= INCR_MASKS
;
14228 for (int i
= 0; i
< wls_left
; i
++)
14232 mask
= myargv
[optind
+ 1 + i
];
14234 if (stat (mask
, &file_stat
) == -1)
14236 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14242 uint is_file
= S_ISREG (file_stat
.st_mode
);
14248 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14250 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14255 char line_buf
[BUFSIZ
];
14257 while (!feof (mask_fp
))
14259 memset (line_buf
, 0, BUFSIZ
);
14261 int line_len
= fgetl (mask_fp
, line_buf
);
14263 if (line_len
== 0) continue;
14265 if (line_buf
[0] == '#') continue;
14267 if (masks_avail
== maskcnt
)
14269 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14271 masks_avail
+= INCR_MASKS
;
14274 masks
[maskcnt
] = mystrdup (line_buf
);
14283 log_error ("ERROR: %s: unsupported file-type", mask
);
14289 mask_from_file
= 1;
14294 custom_charset_1
= (char *) "?l?d?u";
14295 custom_charset_2
= (char *) "?l?d";
14296 custom_charset_3
= (char *) "?l?d*!$@_";
14298 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14299 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14300 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14302 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14304 wordlist_mode
= WL_MODE_MASK
;
14306 data
.wordlist_mode
= wordlist_mode
;
14316 * generate full masks and charsets
14319 masks
= (char **) mymalloc (sizeof (char *));
14323 case 1731: pw_min
= 5;
14325 mask
= mystrdup ("?b?b?b?b?b");
14327 case 12500: pw_min
= 5;
14329 mask
= mystrdup ("?b?b?b?b?b");
14331 default: pw_min
= 7;
14333 mask
= mystrdup ("?b?b?b?b?b?b?b");
14339 masks
[maskcnt
- 1] = mystrdup (mask
);
14341 wordlist_mode
= WL_MODE_MASK
;
14343 data
.wordlist_mode
= wordlist_mode
;
14348 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14352 if (increment_min
> pw_min
) pw_min
= increment_min
;
14354 if (increment_max
< pw_max
) pw_max
= increment_max
;
14357 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14359 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14363 char *mask
= myargv
[myargc
- 1];
14367 masks
= (char **) mymalloc (1 * sizeof (char *));
14371 struct stat file_stat
;
14373 if (stat (mask
, &file_stat
) == -1)
14377 masks
[maskcnt
- 1] = mystrdup (mask
);
14381 uint is_file
= S_ISREG (file_stat
.st_mode
);
14387 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14389 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14394 char line_buf
[BUFSIZ
];
14396 uint masks_avail
= 1;
14398 while (!feof (mask_fp
))
14400 memset (line_buf
, 0, BUFSIZ
);
14402 int line_len
= fgetl (mask_fp
, line_buf
);
14404 if (line_len
== 0) continue;
14406 if (line_buf
[0] == '#') continue;
14408 if (masks_avail
== maskcnt
)
14410 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14412 masks_avail
+= INCR_MASKS
;
14415 masks
[maskcnt
] = mystrdup (line_buf
);
14422 mask_from_file
= 1;
14428 masks
[maskcnt
- 1] = mystrdup (mask
);
14434 int wls_left
= myargc
- (optind
+ 2);
14436 for (int i
= 0; i
< wls_left
; i
++)
14438 char *filename
= myargv
[optind
+ 1 + i
];
14440 struct stat file_stat
;
14442 if (stat (filename
, &file_stat
) == -1)
14444 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14449 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14453 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14457 dictfiles
[dictcnt
- 1] = filename
;
14461 // do not allow --keyspace w/ a directory
14465 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14470 char **dictionary_files
= NULL
;
14472 dictionary_files
= scan_directory (filename
);
14474 if (dictionary_files
!= NULL
)
14476 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14478 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14480 char *l1_filename
= dictionary_files
[d
];
14482 struct stat l1_stat
;
14484 if (stat (l1_filename
, &l1_stat
) == -1)
14486 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14491 if (S_ISREG (l1_stat
.st_mode
))
14493 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14497 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14502 local_free (dictionary_files
);
14508 log_error ("ERROR: No usable dictionary file found.");
14517 uint mask_min
= increment_min
; // we can't reject smaller masks here
14518 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14520 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14522 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14524 if (cur_mask
== NULL
) break;
14526 masks
[maskcnt
] = cur_mask
;
14530 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14534 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14536 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14540 char *mask
= myargv
[optind
+ 1 + 0];
14544 masks
= (char **) mymalloc (1 * sizeof (char *));
14548 struct stat file_stat
;
14550 if (stat (mask
, &file_stat
) == -1)
14554 masks
[maskcnt
- 1] = mystrdup (mask
);
14558 uint is_file
= S_ISREG (file_stat
.st_mode
);
14564 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14566 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14571 char line_buf
[BUFSIZ
];
14573 uint masks_avail
= 1;
14575 while (!feof (mask_fp
))
14577 memset (line_buf
, 0, BUFSIZ
);
14579 int line_len
= fgetl (mask_fp
, line_buf
);
14581 if (line_len
== 0) continue;
14583 if (line_buf
[0] == '#') continue;
14585 if (masks_avail
== maskcnt
)
14587 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14589 masks_avail
+= INCR_MASKS
;
14592 masks
[maskcnt
] = mystrdup (line_buf
);
14599 mask_from_file
= 1;
14605 masks
[maskcnt
- 1] = mystrdup (mask
);
14611 int wls_left
= myargc
- (optind
+ 2);
14613 for (int i
= 0; i
< wls_left
; i
++)
14615 char *filename
= myargv
[optind
+ 2 + i
];
14617 struct stat file_stat
;
14619 if (stat (filename
, &file_stat
) == -1)
14621 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14626 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14630 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14634 dictfiles
[dictcnt
- 1] = filename
;
14638 // do not allow --keyspace w/ a directory
14642 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14647 char **dictionary_files
= NULL
;
14649 dictionary_files
= scan_directory (filename
);
14651 if (dictionary_files
!= NULL
)
14653 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14655 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14657 char *l1_filename
= dictionary_files
[d
];
14659 struct stat l1_stat
;
14661 if (stat (l1_filename
, &l1_stat
) == -1)
14663 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14668 if (S_ISREG (l1_stat
.st_mode
))
14670 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14674 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14679 local_free (dictionary_files
);
14685 log_error ("ERROR: No usable dictionary file found.");
14694 uint mask_min
= increment_min
; // we can't reject smaller masks here
14695 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14697 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14699 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14701 if (cur_mask
== NULL
) break;
14703 masks
[maskcnt
] = cur_mask
;
14707 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14712 data
.pw_min
= pw_min
;
14713 data
.pw_max
= pw_max
;
14719 if (weak_hash_threshold
>= salts_cnt
)
14721 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14723 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14725 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14729 // Display hack, guarantee that there is at least one \r before real start
14731 if (data
.quiet
== 0) log_info_nn ("");
14734 * status and monitor threads
14737 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14739 hc_thread_t i_thread
= 0;
14741 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14743 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14746 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14748 uint ni_threads_cnt
= 0;
14750 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14752 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14762 if (outfile_check_timer
!= 0)
14764 if (data
.outfile_check_directory
!= NULL
)
14766 if ((hash_mode
!= 5200) &&
14767 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14768 (hash_mode
!= 9000))
14770 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14776 outfile_check_timer
= 0;
14781 outfile_check_timer
= 0;
14787 * Inform the user if we got some hashes remove because of the pot file remove feature
14790 if (data
.quiet
== 0)
14792 if (potfile_remove_cracks
> 0)
14794 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14795 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14799 data
.outfile_check_timer
= outfile_check_timer
;
14805 char **induction_dictionaries
= NULL
;
14807 int induction_dictionaries_cnt
= 0;
14809 hcstat_table_t
*root_table_buf
= NULL
;
14810 hcstat_table_t
*markov_table_buf
= NULL
;
14812 uint initial_restore_done
= 0;
14814 data
.maskcnt
= maskcnt
;
14816 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14818 if (data
.devices_status
== STATUS_CRACKED
) break;
14820 data
.devices_status
= STATUS_INIT
;
14822 if (maskpos
> rd
->maskpos
)
14827 rd
->maskpos
= maskpos
;
14828 data
.maskpos
= maskpos
;
14830 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14832 char *mask
= masks
[maskpos
];
14834 if (mask_from_file
== 1)
14836 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14841 uint mask_offset
= 0;
14843 uint separator_cnt
;
14845 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14847 str_ptr
= strstr (mask
+ mask_offset
, ",");
14849 if (str_ptr
== NULL
) break;
14851 str_pos
= str_ptr
- mask
;
14853 // escaped separator, i.e. "\,"
14857 if (mask
[str_pos
- 1] == '\\')
14861 mask_offset
= str_pos
+ 1;
14867 // reset the offset
14871 mask
[str_pos
] = '\0';
14873 switch (separator_cnt
)
14876 mp_reset_usr (mp_usr
, 0);
14878 custom_charset_1
= mask
;
14879 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14883 mp_reset_usr (mp_usr
, 1);
14885 custom_charset_2
= mask
;
14886 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14890 mp_reset_usr (mp_usr
, 2);
14892 custom_charset_3
= mask
;
14893 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14897 mp_reset_usr (mp_usr
, 3);
14899 custom_charset_4
= mask
;
14900 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
14904 mask
= mask
+ str_pos
+ 1;
14908 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
14912 local_free (css_buf
);
14913 local_free (data
.root_css_buf
);
14914 local_free (data
.markov_css_buf
);
14916 local_free (masks
[maskpos
- 1]);
14919 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
14922 data
.css_cnt
= css_cnt
;
14923 data
.css_buf
= css_buf
;
14925 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
14927 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
14929 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
14931 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
14932 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
14934 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
14936 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
14938 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
14939 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
14941 data
.root_css_buf
= root_css_buf
;
14942 data
.markov_css_buf
= markov_css_buf
;
14944 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
14946 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
14948 local_free (root_table_buf
);
14949 local_free (markov_table_buf
);
14953 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
14955 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
14957 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
14958 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
14959 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
14961 device_param
->kernel_params_mp_buf64
[3] = 0;
14962 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
14963 device_param
->kernel_params_mp_buf32
[5] = 0;
14964 device_param
->kernel_params_mp_buf32
[6] = 0;
14965 device_param
->kernel_params_mp_buf32
[7] = 0;
14967 if (attack_mode
== ATTACK_MODE_HYBRID1
)
14969 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
14970 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
14971 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
14972 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
14974 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14976 device_param
->kernel_params_mp_buf32
[5] = 0;
14977 device_param
->kernel_params_mp_buf32
[6] = 0;
14978 device_param
->kernel_params_mp_buf32
[7] = 0;
14981 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
14982 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
14983 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
14985 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
);
14986 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
);
14989 else if (attack_mode
== ATTACK_MODE_BF
)
14991 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
14995 for (uint i
= 0; i
< dictcnt
; i
++)
14997 local_free (dictfiles
[i
]);
15000 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
15002 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
15004 if (l1_filename
== NULL
) break;
15008 dictfiles
[dictcnt
- 1] = l1_filename
;
15015 dictfiles
[dictcnt
- 1] = mask
;
15020 log_error ("ERROR: Mask is too small");
15027 free (induction_dictionaries
);
15029 // induction_dictionaries_cnt = 0; // implied
15031 if (attack_mode
!= ATTACK_MODE_BF
)
15035 induction_dictionaries
= scan_directory (induction_directory
);
15037 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15041 if (induction_dictionaries_cnt
)
15043 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15047 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15051 if ((maskcnt
> 1) || (dictcnt
> 1))
15053 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15059 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15061 char *subid
= logfile_generate_subid ();
15063 data
.subid
= subid
;
15065 logfile_sub_msg ("START");
15067 data
.devices_status
= STATUS_INIT
;
15069 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15070 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15071 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15073 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15077 data
.cpt_start
= time (NULL
);
15079 data
.cpt_total
= 0;
15081 if (data
.restore
== 0)
15083 rd
->words_cur
= skip
;
15090 data
.ms_paused
= 0;
15092 data
.words_cur
= rd
->words_cur
;
15094 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15096 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15098 device_param
->speed_pos
= 0;
15100 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15101 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15102 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15104 device_param
->gpu_power
= device_param
->gpu_power_user
;
15105 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15107 device_param
->outerloop_pos
= 0;
15108 device_param
->outerloop_left
= 0;
15109 device_param
->innerloop_pos
= 0;
15110 device_param
->innerloop_left
= 0;
15112 // some more resets:
15114 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15116 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15118 device_param
->pw_cnt
= 0;
15119 device_param
->pws_cnt
= 0;
15121 device_param
->words_off
= 0;
15122 device_param
->words_done
= 0;
15125 data
.gpu_blocks_div
= 0;
15127 // figure out some workload
15129 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15131 if (data
.wordlist_mode
== WL_MODE_FILE
)
15133 char *dictfile
= NULL
;
15135 if (induction_dictionaries_cnt
)
15137 dictfile
= induction_dictionaries
[0];
15141 dictfile
= dictfiles
[dictpos
];
15144 data
.dictfile
= dictfile
;
15146 logfile_sub_string (dictfile
);
15148 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15150 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15153 FILE *fd2
= fopen (dictfile
, "rb");
15157 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15162 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15166 if (data
.words_cnt
== 0)
15168 if (data
.devices_status
== STATUS_CRACKED
) break;
15169 if (data
.devices_status
== STATUS_ABORTED
) break;
15177 else if (attack_mode
== ATTACK_MODE_COMBI
)
15179 char *dictfile
= data
.dictfile
;
15180 char *dictfile2
= data
.dictfile2
;
15182 logfile_sub_string (dictfile
);
15183 logfile_sub_string (dictfile2
);
15185 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15187 FILE *fd2
= fopen (dictfile
, "rb");
15191 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15196 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15200 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15202 FILE *fd2
= fopen (dictfile2
, "rb");
15206 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15211 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15216 if (data
.words_cnt
== 0)
15218 if (data
.devices_status
== STATUS_CRACKED
) break;
15219 if (data
.devices_status
== STATUS_ABORTED
) break;
15226 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15228 char *dictfile
= NULL
;
15230 if (induction_dictionaries_cnt
)
15232 dictfile
= induction_dictionaries
[0];
15236 dictfile
= dictfiles
[dictpos
];
15239 data
.dictfile
= dictfile
;
15241 char *mask
= data
.mask
;
15243 logfile_sub_string (dictfile
);
15244 logfile_sub_string (mask
);
15246 FILE *fd2
= fopen (dictfile
, "rb");
15250 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15255 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15259 if (data
.words_cnt
== 0)
15261 if (data
.devices_status
== STATUS_CRACKED
) break;
15262 if (data
.devices_status
== STATUS_ABORTED
) break;
15269 else if (attack_mode
== ATTACK_MODE_BF
)
15271 local_free (css_buf
);
15272 local_free (data
.root_css_buf
);
15273 local_free (data
.markov_css_buf
);
15275 char *mask
= dictfiles
[dictpos
];
15277 logfile_sub_string (mask
);
15281 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15283 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15285 uint css_cnt_unicode
= css_cnt
* 2;
15287 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15289 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15291 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15293 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15294 css_buf_unicode
[j
+ 1].cs_len
= 1;
15299 css_buf
= css_buf_unicode
;
15300 css_cnt
= css_cnt_unicode
;
15303 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15305 uint mask_min
= pw_min
;
15306 uint mask_max
= pw_max
;
15308 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15314 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15316 if (css_cnt
< mask_min
)
15318 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15321 if (css_cnt
> mask_max
)
15323 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15326 // skip to next mask
15330 rd
->dictpos
= dictpos
;
15332 logfile_sub_msg ("STOP");
15337 uint save_css_cnt
= css_cnt
;
15339 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15341 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15343 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15344 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15346 uint css_cnt_salt
= css_cnt
+ salt_len
;
15348 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15350 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15352 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15354 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15355 css_buf_salt
[j
].cs_len
= 1;
15360 css_buf
= css_buf_salt
;
15361 css_cnt
= css_cnt_salt
;
15366 data
.css_cnt
= css_cnt
;
15367 data
.css_buf
= css_buf
;
15369 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15371 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15373 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15375 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15377 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15378 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15380 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15382 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15384 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15385 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15387 data
.root_css_buf
= root_css_buf
;
15388 data
.markov_css_buf
= markov_css_buf
;
15390 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15392 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15394 local_free (root_table_buf
);
15395 local_free (markov_table_buf
);
15399 uint css_cnt_l
= css_cnt
;
15402 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15404 if (save_css_cnt
< 6)
15408 else if (save_css_cnt
== 6)
15414 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15416 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15427 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15442 /* unfinished code?
15443 int sum = css_buf[css_cnt_r - 1].cs_len;
15445 for (uint i = 1; i < 4 && i < css_cnt; i++)
15447 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15451 sum *= css_buf[css_cnt_r - 1].cs_len;
15456 css_cnt_l
-= css_cnt_r
;
15458 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15460 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15462 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15464 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15465 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15466 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15468 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15469 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15470 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15471 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15472 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15473 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15475 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15476 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15477 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15478 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15480 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15481 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15482 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15484 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15485 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15486 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15487 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15488 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15490 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
]);
15491 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
]);
15492 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
]);
15494 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
]);
15495 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
]);
15496 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
]);
15498 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
);
15499 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
);
15503 uint64_t words_base
= data
.words_cnt
;
15505 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15507 if (data
.gpu_rules_cnt
)
15509 words_base
/= data
.gpu_rules_cnt
;
15512 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15514 if (data
.combs_cnt
)
15516 words_base
/= data
.combs_cnt
;
15519 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15523 words_base
/= data
.bfs_cnt
;
15527 data
.words_base
= words_base
;
15531 log_info ("%llu", (unsigned long long int) words_base
);
15536 if (data
.words_cur
> data
.words_base
)
15538 log_error ("ERROR: restore value greater keyspace");
15543 if (data
.words_cur
)
15545 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15547 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15549 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15552 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15554 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15556 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15559 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15561 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15563 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15569 * Inform user about possible slow speeds
15572 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15574 if (data
.words_base
< gpu_blocks_all
)
15579 log_info ("ATTENTION!");
15580 log_info (" The wordlist or mask you are using is too small.");
15581 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15582 log_info (" The cracking speed will drop.");
15583 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15590 * Update loopback file
15599 uint random_num
= get_random_num (0, 9999);
15601 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15603 data
.loopback_file
= loopback_file
;
15607 * Update dictionary statistic
15612 dictstat_fp
= fopen (dictstat
, "wb");
15616 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15618 fclose (dictstat_fp
);
15622 data
.devices_status
= STATUS_RUNNING
;
15624 if (initial_restore_done
== 0)
15626 if (data
.restore_disable
== 0) cycle_restore ();
15628 initial_restore_done
= 1;
15631 hc_timer_set (&data
.timer_running
);
15633 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15635 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15637 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15638 if (quiet
== 0) fflush (stdout
);
15641 else if (wordlist_mode
== WL_MODE_STDIN
)
15643 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15644 if (data
.quiet
== 0) log_info ("");
15647 time_t runtime_start
;
15649 time (&runtime_start
);
15651 data
.runtime_start
= runtime_start
;
15654 * create cracker threads
15657 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15659 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15661 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15663 device_param
->device_id
= device_id
;
15665 if (wordlist_mode
== WL_MODE_STDIN
)
15667 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15671 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15675 // wait for crack threads to exit
15677 hc_thread_wait (devices_cnt
, c_threads
);
15679 local_free (c_threads
);
15685 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15687 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15689 if (data
.devices_status
== STATUS_CRACKED
) break;
15690 if (data
.devices_status
== STATUS_ABORTED
) break;
15692 if (data
.devices_status
== STATUS_BYPASS
)
15694 data
.devices_status
= STATUS_RUNNING
;
15697 if (induction_dictionaries_cnt
)
15699 unlink (induction_dictionaries
[0]);
15702 free (induction_dictionaries
);
15704 if (attack_mode
!= ATTACK_MODE_BF
)
15706 induction_dictionaries
= scan_directory (induction_directory
);
15708 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15711 if (benchmark
== 0)
15713 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15715 if (quiet
== 0) clear_prompt ();
15717 if (quiet
== 0) log_info ("");
15725 if (quiet
== 0) status_display ();
15728 if (quiet
== 0) log_info ("");
15732 if (attack_mode
== ATTACK_MODE_BF
)
15736 rd
->dictpos
= dictpos
;
15740 if (induction_dictionaries_cnt
)
15742 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15748 rd
->dictpos
= dictpos
;
15752 time_t runtime_stop
;
15754 time (&runtime_stop
);
15756 data
.runtime_stop
= runtime_stop
;
15758 logfile_sub_uint (runtime_start
);
15759 logfile_sub_uint (runtime_stop
);
15761 logfile_sub_msg ("STOP");
15763 global_free (subid
);
15766 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15768 if (data
.devices_status
== STATUS_CRACKED
) break;
15769 if (data
.devices_status
== STATUS_ABORTED
) break;
15770 if (data
.devices_status
== STATUS_QUIT
) break;
15772 if (data
.devices_status
== STATUS_BYPASS
)
15774 data
.devices_status
= STATUS_RUNNING
;
15778 // 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
15780 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15782 if (data
.wordlist_mode
== WL_MODE_FILE
)
15784 if (data
.dictfile
== NULL
)
15786 if (dictfiles
!= NULL
)
15788 data
.dictfile
= dictfiles
[0];
15790 hc_timer_set (&data
.timer_running
);
15795 // NOTE: combi is okay because it is already set beforehand
15796 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15798 if (data
.dictfile
== NULL
)
15800 if (dictfiles
!= NULL
)
15802 hc_timer_set (&data
.timer_running
);
15804 data
.dictfile
= dictfiles
[0];
15808 else if (attack_mode
== ATTACK_MODE_BF
)
15810 if (data
.mask
== NULL
)
15812 hc_timer_set (&data
.timer_running
);
15814 data
.mask
= masks
[0];
15818 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15820 data
.devices_status
= STATUS_EXHAUSTED
;
15823 // if cracked / aborted remove last induction dictionary
15825 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15827 struct stat induct_stat
;
15829 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15831 unlink (induction_dictionaries
[file_pos
]);
15835 // wait for non-interactive threads
15837 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15839 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15842 local_free (ni_threads
);
15844 // wait for interactive threads
15846 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15848 hc_thread_wait (1, &i_thread
);
15851 // we dont need restore file anymore
15852 if (data
.restore_disable
== 0)
15854 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15856 unlink (eff_restore_file
);
15857 unlink (new_restore_file
);
15865 // finally save left hashes
15867 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15876 if (benchmark
== 1)
15878 status_benchmark ();
15884 if (quiet
== 0) clear_prompt ();
15886 if (quiet
== 0) log_info ("");
15894 if (quiet
== 0) status_display ();
15897 if (quiet
== 0) log_info ("");
15900 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15902 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15904 local_free (device_param
->result
);
15906 local_free (device_param
->pw_caches
);
15908 local_free (device_param
->combs_buf
);
15910 local_free (device_param
->hooks_buf
);
15912 local_free (device_param
->device_name
);
15914 local_free (device_param
->device_version
);
15916 local_free (device_param
->driver_version
);
15918 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
15919 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
15920 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
15921 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
15922 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
15923 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
15924 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
15925 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
15926 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
15927 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
15928 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
15929 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
15930 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
15931 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
15932 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
15933 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
15934 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
15935 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
15936 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
15937 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
15938 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
15939 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
15940 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
15941 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
15942 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
15943 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
15944 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
15945 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
15947 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
15948 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
15949 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
15950 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
15951 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
15952 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
15953 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
15954 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
15956 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
15957 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
15958 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
15959 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
15962 // reset default fan speed
15964 if (gpu_temp_disable
== 0)
15966 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
15968 hc_thread_mutex_lock (mux_adl
);
15970 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
15972 if (data
.hm_device
[i
].fan_supported
== 1)
15974 int fanspeed
= temp_retain_fanspeed_value
[i
];
15976 if (fanspeed
== -1) continue;
15978 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
15980 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
15984 hc_thread_mutex_unlock (mux_adl
);
15988 // reset power tuning
15990 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
15992 hc_thread_mutex_lock (mux_adl
);
15994 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
15996 if (data
.hm_device
[i
].od_version
== 6)
15998 // check powertune capabilities first, if not available then skip device
16000 int powertune_supported
= 0;
16002 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
16004 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
16009 if (powertune_supported
!= 0)
16011 // powercontrol settings
16013 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
16015 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16022 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
16024 performance_state
->iNumberOfPerformanceLevels
= 2;
16026 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
16027 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
16028 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
16029 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
16031 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
16033 log_info ("ERROR: Failed to restore ADL performance state");
16038 local_free (performance_state
);
16043 hc_thread_mutex_unlock (mux_adl
);
16046 if (gpu_temp_disable
== 0)
16048 if (vendor_id
== VENDOR_ID_NV
)
16051 hc_NVML_nvmlShutdown ();
16059 if (vendor_id
== VENDOR_ID_AMD
)
16061 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
16063 hm_close_amd (data
.hm_dll
);
16069 local_free (masks
);
16071 local_free (dictstat_base
);
16073 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16075 pot_t
*pot_ptr
= &pot
[pot_pos
];
16077 hash_t
*hash
= &pot_ptr
->hash
;
16079 local_free (hash
->digest
);
16083 local_free (hash
->salt
);
16089 local_free (all_gpu_rules_cnt
);
16090 local_free (all_gpu_rules_buf
);
16092 local_free (wl_data
->buf
);
16093 local_free (wl_data
);
16095 local_free (bitmap_s1_a
);
16096 local_free (bitmap_s1_b
);
16097 local_free (bitmap_s1_c
);
16098 local_free (bitmap_s1_d
);
16099 local_free (bitmap_s2_a
);
16100 local_free (bitmap_s2_b
);
16101 local_free (bitmap_s2_c
);
16102 local_free (bitmap_s2_d
);
16104 local_free (temp_retain_fanspeed_value
);
16105 local_free (od_clock_mem_status
);
16106 local_free (od_power_control_status
);
16108 global_free (devices_param
);
16110 global_free (gpu_rules_buf
);
16112 global_free (root_css_buf
);
16113 global_free (markov_css_buf
);
16115 global_free (digests_buf
);
16116 global_free (digests_shown
);
16117 global_free (digests_shown_tmp
);
16119 global_free (salts_buf
);
16120 global_free (salts_shown
);
16122 global_free (esalts_buf
);
16124 global_free (words_progress_done
);
16125 global_free (words_progress_rejected
);
16126 global_free (words_progress_restored
);
16128 if (pot_fp
) fclose (pot_fp
);
16130 if (data
.devices_status
== STATUS_QUIT
) break;
16133 // destroy others mutex
16135 hc_thread_mutex_delete (mux_dispatcher
);
16136 hc_thread_mutex_delete (mux_counter
);
16137 hc_thread_mutex_delete (mux_display
);
16138 hc_thread_mutex_delete (mux_adl
);
16142 local_free (eff_restore_file
);
16143 local_free (new_restore_file
);
16149 local_free (loopback_file
);
16151 if (loopback
== 1) unlink (loopback_file
);
16153 // induction directory
16155 if (induction_dir
== NULL
)
16157 if (attack_mode
!= ATTACK_MODE_BF
)
16159 if (rmdir (induction_directory
) == -1)
16161 if (errno
== ENOENT
)
16163 // good, we can ignore
16165 else if (errno
== ENOTEMPTY
)
16167 // good, we can ignore
16171 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16177 local_free (induction_directory
);
16181 // outfile-check directory
16183 if (outfile_check_dir
== NULL
)
16185 if (rmdir (outfile_check_directory
) == -1)
16187 if (errno
== ENOENT
)
16189 // good, we can ignore
16191 else if (errno
== ENOTEMPTY
)
16193 // good, we can ignore
16197 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16203 local_free (outfile_check_directory
);
16210 logfile_top_uint (proc_start
);
16211 logfile_top_uint (proc_stop
);
16213 logfile_top_msg ("STOP");
16215 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16216 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16218 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16219 if (data
.devices_status
== STATUS_QUIT
) return 2;
16220 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16221 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16222 if (data
.devices_status
== STATUS_CRACKED
) return 0;