2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include <rp_gpu_on_cpu.h>
11 const char *PROGNAME
= "oclHashcat";
12 const char *VERSION_TXT
= "2.01";
13 const uint VERSION_BIN
= 201;
14 const uint RESTORE_MIN
= 201;
16 #define INCR_RULES 10000
17 #define INCR_SALTS 100000
18 #define INCR_MASKS 1000
24 #define MARKOV_THRESHOLD 0
25 #define MARKOV_DISABLE 0
26 #define MARKOV_CLASSIC 0
28 #define BENCHMARK_MODE 1
30 #define RESTORE_TIMER 60
31 #define RESTORE_DISABLE 0
33 #define STATUS_TIMER 10
34 #define STATUS_AUTOMAT 0
36 #define WEAK_HASH_THRESHOLD 100
41 #define REMOVE_TIMER 60
45 #define POTFILE_DISABLE 0
48 #define RP_GEN_FUNC_MIN 1
49 #define RP_GEN_FUNC_MAX 4
51 #define RULE_BUF_L ":"
52 #define RULE_BUF_R ":"
57 #define HEX_WORDLIST 0
58 #define OUTFILE_FORMAT 3
59 #define OUTFILE_AUTOHEX 1
60 #define OUTFILE_CHECK_TIMER 5
63 #define SEGMENT_SIZE 32
65 #define INCREMENT_MIN 1
66 #define INCREMENT_MAX PW_MAX
70 #define GPU_TEMP_DISABLE 0
71 #define GPU_TEMP_ABORT 90
72 #define GPU_TEMP_RETAIN 80
73 #define WORKLOAD_PROFILE 2
76 #define GPU_RULES 1024
77 #define GPU_COMBS 1024
79 #define GPU_THREADS 64
80 #define POWERTUNE_ENABLE 0
81 #define LOGFILE_DISABLE 0
84 #define WL_MODE_STDIN 1
85 #define WL_MODE_FILE 2
86 #define WL_MODE_MASK 3
88 #define HL_MODE_FILE 4
91 #define HLFMT_HASHCAT 0
92 #define HLFMT_PWDUMP 1
93 #define HLFMT_PASSWD 2
94 #define HLFMT_SHADOW 3
97 #define HLFMT_NETNTLM1 7
98 #define HLFMT_NETNTLM2 8
99 #define HLFMT_NSLDAP 9
100 #define HLFMT_NSLDAPS 10
101 #define HLFMTS_CNT 11
103 #define ATTACK_MODE_STRAIGHT 0
104 #define ATTACK_MODE_COMBI 1
105 #define ATTACK_MODE_TOGGLE 2
106 #define ATTACK_MODE_BF 3
107 #define ATTACK_MODE_PERM 4
108 #define ATTACK_MODE_TABLE 5
109 #define ATTACK_MODE_HYBRID1 6
110 #define ATTACK_MODE_HYBRID2 7
111 #define ATTACK_MODE_NONE 100
113 #define ATTACK_KERN_STRAIGHT 0
114 #define ATTACK_KERN_COMBI 1
115 #define ATTACK_KERN_BF 3
116 #define ATTACK_KERN_NONE 100
118 #define ATTACK_EXEC_ON_CPU 10
119 #define ATTACK_EXEC_ON_GPU 11
121 #define COMBINATOR_MODE_BASE_LEFT 10001
122 #define COMBINATOR_MODE_BASE_RIGHT 10002
124 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
125 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
127 #define MAX_CUT_TRIES 4
129 #define MAX_DICTSTAT 10000
131 #define NUM_DEFAULT_BENCHMARK_ALGORITHMS 128
133 #define global_free(attr) \
135 myfree ((void *) data.attr); \
140 #define local_free(attr) \
142 myfree ((void *) attr); \
147 static uint default_benchmark_algorithms
[NUM_DEFAULT_BENCHMARK_ALGORITHMS
] =
283 static void (*get_next_word_func
) (char *, uint32_t, uint32_t *, uint32_t *);
289 static unsigned int full01
= 0x01010101;
290 static unsigned int full80
= 0x80808080;
292 int SUPPRESS_OUTPUT
= 0;
294 hc_thread_mutex_t mux_adl
;
295 hc_thread_mutex_t mux_counter
;
296 hc_thread_mutex_t mux_dispatcher
;
297 hc_thread_mutex_t mux_display
;
299 hc_global_data_t data
;
301 const char *PROMPT
= "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => ";
303 const char *USAGE_MINI
[] =
305 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
307 "Try --help for more help.",
311 const char *USAGE_BIG
[] =
313 "%s, advanced password recovery",
315 "Usage: %s [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...",
323 " -m, --hash-type=NUM Hash-type, see references below",
324 " -a, --attack-mode=NUM Attack-mode, see references below",
325 " -V, --version Print version",
326 " -h, --help Print help",
327 " --quiet Suppress output",
331 " -b, --benchmark Run benchmark",
332 " --benchmark-mode=NUM Benchmark-mode, see references below",
336 " --hex-charset Assume charset is given in hex",
337 " --hex-salt Assume salt is given in hex",
338 " --hex-wordlist Assume words in wordlist is given in hex",
339 " --force Ignore warnings",
340 " --status Enable automatic update of the status-screen",
341 " --status-timer=NUM Seconds between status-screen update",
342 " --status-automat Display the status view in a machine readable format",
343 " --loopback Add new plains to induct directory",
344 " --weak-hash-threshold=NUM Threshold when to stop checking for weak hashes, default is 100 salts",
348 " --markov-hcstat=FILE Specify hcstat file to use, default is hashcat.hcstat",
349 " --markov-disable Disables markov-chains, emulates classic brute-force",
350 " --markov-classic Enables classic markov-chains, no per-position enhancement",
351 " -t, --markov-threshold=NUM Threshold when to stop accepting new markov-chains",
355 " --runtime=NUM Abort session after NUM seconds of runtime",
356 " --session=STR Define specific session name",
357 " --restore Restore session from --session",
358 " --restore-disable Do not write restore file",
362 " -o, --outfile=FILE Define outfile for recovered hash",
363 " --outfile-format=NUM Define outfile-format for recovered hash, see references below",
364 " --outfile-autohex-disable Disable the use of $HEX[] in output plains",
365 " --outfile-check-timer=NUM Seconds between outfile checks",
366 " -p, --separator=CHAR Separator char for hashlists and outfile",
367 " --show Show cracked passwords only",
368 " --left Show un-cracked passwords only",
369 " --username Enable ignoring of usernames in hashfile (recommended: also use --show)",
370 " --remove Enable remove of hash once it is cracked",
371 " --remove-timer=NUM Update input hash file each NUM seconds",
372 " --potfile-disable Do not write potfile",
373 " --debug-mode=NUM Defines the debug mode (hybrid only by using rules), see references below",
374 " --debug-file=FILE Output file for debugging rules (see also --debug-mode)",
375 " --induction-dir=FOLDER Specify induction directory to use, default is $session.induct",
376 " --outfile-check-dir=FOLDER Specify the outfile directory which should be monitored, default is $session.outfiles",
377 " --logfile-disable Disable the logfile",
378 " --truecrypt-keyfiles=FILE Keyfiles used, seperate with comma",
382 " -c, --segment-size=NUM Size in MB to cache from the wordfile",
383 " --bitmap-min=NUM Minimum number of bits allowed for bitmaps",
384 " --bitmap-max=NUM Maximum number of bits allowed for bitmaps",
385 " --cpu-affinity=STR Locks to CPU devices, seperate with comma",
386 " -d, --gpu-devices=STR Devices to use, separate with comma",
387 " -w, --workload-profile=NUM Enable a specific workload profile, see references below",
388 " -n, --gpu-accel=NUM Workload tuning: 1, 8, 40, 80, 160",
389 " -u, --gpu-loops=NUM Workload fine-tuning: 8 - 1024",
390 " --gpu-temp-disable Disable temperature and fanspeed readings and triggers",
391 " --gpu-temp-abort=NUM Abort session if GPU temperature reaches NUM degrees celsius",
392 " --gpu-temp-retain=NUM Try to retain GPU temperature at NUM degrees celsius (AMD only)",
393 " --powertune-enable Enable automatic power tuning option (AMD OverDrive 6 only)",
394 " --scrypt-tmto=NUM Manually override automatically calculated TMTO value for scrypt",
398 " -s, --skip=NUM Skip number of words",
399 " -l, --limit=NUM Limit number of words",
400 " --keyspace Show keyspace base:mod values and quit",
404 " -j, --rule-left=RULE Single rule applied to each word from left dict",
405 " -k, --rule-right=RULE Single rule applied to each word from right dict",
406 " -r, --rules-file=FILE Rules-file, multi use: -r 1.rule -r 2.rule",
407 " -g, --generate-rules=NUM Generate NUM random rules",
408 " --generate-rules-func-min=NUM Force NUM functions per random rule min",
409 " --generate-rules-func-max=NUM Force NUM functions per random rule max",
410 " --generate-rules-seed=NUM Force RNG seed to NUM",
412 "* Custom charsets:",
414 " -1, --custom-charset1=CS User-defined charsets",
415 " -2, --custom-charset2=CS Example:",
416 " -3, --custom-charset3=CS --custom-charset1=?dabcdef : sets charset ?1 to 0123456789abcdef",
417 " -4, --custom-charset4=CS -2 mycharset.hcchr : sets charset ?2 to chars contained in file",
421 " -i, --increment Enable increment mode",
422 " --increment-min=NUM Start incrementing at NUM",
423 " --increment-max=NUM Stop incrementing at NUM",
429 "* Workload Profile:",
431 " 1 = Reduced performance profile (low latency desktop)",
432 " 2 = Default performance profile",
433 " 3 = Tuned performance profile (high latency desktop)",
435 "* Benchmark Settings:",
437 " 0 = Manual Tuning",
438 " 1 = Performance Tuning, default",
440 "* Outfile Formats:",
444 " 3 = hash[:salt]:plain",
446 " 5 = hash[:salt]:hex_plain",
447 " 6 = plain:hex_plain",
448 " 7 = hash[:salt]:plain:hex_plain",
450 " 9 = hash[:salt]:crackpos",
451 " 10 = plain:crackpos",
452 " 11 = hash[:salt]:plain:crackpos",
453 " 12 = hex_plain:crackpos",
454 " 13 = hash[:salt]:hex_plain:crackpos",
455 " 14 = plain:hex_plain:crackpos",
456 " 15 = hash[:salt]:plain:hex_plain:crackpos",
458 "* Debug mode output formats (for hybrid mode only, by using rules):",
460 " 1 = save finding rule",
461 " 2 = save original word",
462 " 3 = save original word and finding rule",
463 " 4 = save original word, finding rule and modified plain",
465 "* Built-in charsets:",
467 " ?l = abcdefghijklmnopqrstuvwxyz",
468 " ?u = ABCDEFGHIJKLMNOPQRSTUVWXYZ",
470 " ?s = !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
479 " 6 = Hybrid dict + mask",
480 " 7 = Hybrid mask + dict",
484 "[[ Roll-your-own: Raw Hashes ]]",
493 " 5000 = SHA-3(Keccak)",
497 " 6900 = GOST R 34.11-94",
498 " 11700 = GOST R 34.11-2012 (Streebog) 256-bit",
499 " 11800 = GOST R 34.11-2012 (Streebog) 512-bit",
501 "[[ Roll-your-own: Iterated and / or Salted Hashes ]]",
503 " 10 = md5($pass.$salt)",
504 " 20 = md5($salt.$pass)",
505 " 30 = md5(unicode($pass).$salt)",
506 " 40 = md5($salt.unicode($pass))",
507 " 3800 = md5($salt.$pass.$salt)",
508 " 3710 = md5($salt.md5($pass))",
509 " 2600 = md5(md5($pass)",
510 " 4300 = md5(strtoupper(md5($pass)))",
511 " 4400 = md5(sha1($pass))",
512 " 110 = sha1($pass.$salt)",
513 " 120 = sha1($salt.$pass)",
514 " 130 = sha1(unicode($pass).$salt)",
515 " 140 = sha1($salt.unicode($pass))",
516 " 4500 = sha1(sha1($pass)",
517 " 4700 = sha1(md5($pass))",
518 " 4900 = sha1($salt.$pass.$salt)",
519 " 1410 = sha256($pass.$salt)",
520 " 1420 = sha256($salt.$pass)",
521 " 1430 = sha256(unicode($pass).$salt)",
522 " 1440 = sha256($salt.unicode($pass))",
523 " 1710 = sha512($pass.$salt)",
524 " 1720 = sha512($salt.$pass)",
525 " 1730 = sha512(unicode($pass).$salt)",
526 " 1740 = sha512($salt.unicode($pass))",
528 "[[ Roll-your-own: Authenticated Hashes ]]",
530 " 50 = HMAC-MD5 (key = $pass)",
531 " 60 = HMAC-MD5 (key = $salt)",
532 " 150 = HMAC-SHA1 (key = $pass)",
533 " 160 = HMAC-SHA1 (key = $salt)",
534 " 1450 = HMAC-SHA256 (key = $pass)",
535 " 1460 = HMAC-SHA256 (key = $salt)",
536 " 1750 = HMAC-SHA512 (key = $pass)",
537 " 1760 = HMAC-SHA512 (key = $salt)",
543 " 11900 = PBKDF2-HMAC-MD5",
544 " 12000 = PBKDF2-HMAC-SHA1",
545 " 10900 = PBKDF2-HMAC-SHA256",
546 " 12100 = PBKDF2-HMAC-SHA512",
548 "[[ Network protocols, Challenge-Response ]]",
552 " 4800 = iSCSI CHAP authentication, MD5(Chap)",
553 " 5300 = IKE-PSK MD5",
554 " 5400 = IKE-PSK SHA1",
556 " 5500 = NetNTLMv1 + ESS",
558 " 7300 = IPMI2 RAKP HMAC-SHA1",
559 " 7500 = Kerberos 5 AS-REQ Pre-Auth etype 23",
560 " 8300 = DNSSEC (NSEC3)",
562 " 11100 = PostgreSQL Challenge-Response Authentication (MD5)",
563 " 11200 = MySQL Challenge-Response Authentication (SHA1)",
564 " 11400 = SIP digest authentication (MD5)",
566 "[[ Forums, CMS, E-Commerce, Frameworks, Middleware, Wiki, Management ]]",
568 " 121 = SMF (Simple Machines Forum)",
570 " 2611 = vBulletin < v3.8.5",
571 " 2711 = vBulletin > v3.8.5",
573 " 2811 = IPB (Invison Power Board)",
574 " 8400 = WBB3 (Woltlab Burning Board)",
575 " 11 = Joomla < 2.5.18",
576 " 400 = Joomla > 2.5.18",
582 " 11000 = PrestaShop",
583 " 124 = Django (SHA-1)",
584 " 10000 = Django (PBKDF2-SHA256)",
585 " 3711 = Mediawiki B type",
588 "[[ Database Server ]]",
591 " 131 = MSSQL(2000)",
592 " 132 = MSSQL(2005)",
593 " 1731 = MSSQL(2012)",
594 " 1731 = MSSQL(2014)",
596 " 300 = MySQL4.1/MySQL5",
597 " 3100 = Oracle H: Type (Oracle 7+)",
598 " 112 = Oracle S: Type (Oracle 11+)",
599 " 12300 = Oracle T: Type (Oracle 12+)",
600 " 8000 = Sybase ASE",
602 "[[ HTTP, SMTP, LDAP Server]]",
604 " 141 = EPiServer 6.x < v4",
605 " 1441 = EPiServer 6.x > v4",
606 " 1600 = Apache $apr1$",
607 " 12600 = ColdFusion 10+",
608 " 1421 = hMailServer",
609 " 101 = nsldap, SHA-1(Base64), Netscape LDAP SHA",
610 " 111 = nsldaps, SSHA-1(Base64), Netscape LDAP SSHA",
611 " 1711 = SSHA-512(Base64), LDAP {SSHA512}",
617 "[[ Operating-Systems ]]",
621 " 1100 = Domain Cached Credentials (DCC), MS Cache",
622 " 2100 = Domain Cached Credentials 2 (DCC2), MS Cache 2",
623 " 12800 = MS-AzureSync PBKDF2-HMAC-SHA256",
624 " 1500 = descrypt, DES(Unix), Traditional DES",
625 " 12400 = BSDiCrypt, Extended DES",
626 " 500 = md5crypt $1$, MD5(Unix)",
627 " 3200 = bcrypt $2*$, Blowfish(Unix)",
628 " 7400 = sha256crypt $5$, SHA256(Unix)",
629 " 1800 = sha512crypt $6$, SHA512(Unix)",
636 " 7100 = OSX v10.10",
637 " 6300 = AIX {smd5}",
638 " 6700 = AIX {ssha1}",
639 " 6400 = AIX {ssha256}",
640 " 6500 = AIX {ssha512}",
643 " 500 = Cisco-IOS $1$",
644 " 5700 = Cisco-IOS $4$",
645 " 9200 = Cisco-IOS $8$",
646 " 9300 = Cisco-IOS $9$",
647 " 22 = Juniper Netscreen/SSG (ScreenOS)",
648 " 501 = Juniper IVE",
649 " 5800 = Android PIN",
650 " 8100 = Citrix Netscaler",
655 "[[ Enterprise Application Software (EAS) ]]",
657 " 7700 = SAP CODVN B (BCODE)",
658 " 7800 = SAP CODVN F/G (PASSCODE)",
659 " 10300 = SAP CODVN H (PWDSALTEDHASH) iSSHA-1",
660 " 8600 = Lotus Notes/Domino 5",
661 " 8700 = Lotus Notes/Domino 6",
662 " 9100 = Lotus Notes/Domino 8",
670 "[[ Full-Disk encryptions (FDE) ]]",
672 " 62XY = TrueCrypt 5.0+",
673 " X = 1 = PBKDF2-HMAC-RipeMD160",
674 " X = 2 = PBKDF2-HMAC-SHA512",
675 " X = 3 = PBKDF2-HMAC-Whirlpool",
676 " X = 4 = PBKDF2-HMAC-RipeMD160 + boot-mode",
677 " Y = 1 = XTS 512 bit (Ciphers: AES or Serpent or Twofish)",
678 " Y = 2 = XTS 1024 bit (Ciphers: AES or Serpent or Twofish or AES-Twofish or Serpent-AES or Twofish-Serpent)",
679 " Y = 3 = XTS 1536 bit (Ciphers: All)",
680 " 8800 = Android FDE < v4.3",
685 " 9700 = MS Office <= 2003 MD5 + RC4, oldoffice$0, oldoffice$1",
686 " 9710 = MS Office <= 2003 MD5 + RC4, collider-mode #1",
687 " 9720 = MS Office <= 2003 MD5 + RC4, collider-mode #2",
688 " 9800 = MS Office <= 2003 SHA1 + RC4, oldoffice$3, oldoffice$4",
689 " 9810 = MS Office <= 2003 SHA1 + RC4, collider-mode #1",
690 " 9820 = MS Office <= 2003 SHA1 + RC4, collider-mode #2",
691 " 9400 = MS Office 2007",
692 " 9500 = MS Office 2010",
693 " 9600 = MS Office 2013",
694 " 10400 = PDF 1.1 - 1.3 (Acrobat 2 - 4)",
695 " 10410 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #1",
696 " 10420 = PDF 1.1 - 1.3 (Acrobat 2 - 4) + collider-mode #2",
697 " 10500 = PDF 1.4 - 1.6 (Acrobat 5 - 8)",
698 " 10600 = PDF 1.7 Level 3 (Acrobat 9)",
699 " 10700 = PDF 1.7 Level 8 (Acrobat 10 - 11)",
701 "[[ Password Managers ]]",
703 " 9000 = Password Safe v2",
704 " 5200 = Password Safe v3",
706 " 6600 = 1Password, agilekeychain",
707 " 8200 = 1Password, cloudkeychain",
708 " 11300 = Bitcoin/Litecoin wallet.dat",
709 " 12700 = Blockchain, My Wallet",
715 * oclHashcat specific functions
718 void status_display_automat ()
722 fprintf (out
, "STATUS\t%u\t", data
.devices_status
);
728 fprintf (out
, "SPEED\t");
730 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
732 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
734 uint64_t speed_cnt
= 0;
737 for (int i
= 0; i
< SPEED_CACHE
; i
++)
741 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
743 if (rec_ms
> SPEED_MAXAGE
) continue;
745 speed_cnt
+= device_param
->speed_cnt
[i
];
746 speed_ms
+= device_param
->speed_ms
[i
];
749 speed_cnt
/= SPEED_CACHE
;
750 speed_ms
/= SPEED_CACHE
;
752 fprintf (out
, "%llu\t%f\t", (unsigned long long int) speed_cnt
, speed_ms
);
759 uint64_t words_cur
= get_lowest_words_done ();
761 fprintf (out
, "CURKU\t%llu\t", (unsigned long long int) words_cur
);
767 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
769 if (salts_left
== 0) salts_left
= 1;
771 uint64_t progress_total
= data
.words_cnt
* salts_left
;
773 uint64_t all_done
= 0;
774 uint64_t all_rejected
= 0;
775 uint64_t all_restored
= 0;
777 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
781 // otherwise the final cracked status shows 0/XXX progress
783 if (data
.salts_shown
[salt_pos
] == 1) continue;
786 all_done
+= data
.words_progress_done
[salt_pos
];
787 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
788 all_restored
+= data
.words_progress_restored
[salt_pos
];
791 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
792 uint64_t progress_end
= progress_total
;
794 uint64_t progress_skip
= 0;
798 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
800 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
801 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
802 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
807 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
809 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
810 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
811 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
814 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
815 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
817 fprintf (out
, "PROGRESS\t%llu\t%llu\t", (unsigned long long int) progress_cur_relative_skip
, (unsigned long long int) progress_end_relative_skip
);
823 fprintf (out
, "RECHASH\t%u\t%u\t", data
.digests_done
, data
.digests_cnt
);
824 fprintf (out
, "RECSALT\t%u\t%u\t", data
.salts_done
, data
.salts_cnt
);
830 if (data
.gpu_temp_disable
== 0)
832 fprintf (out
, "TEMP\t");
834 hc_thread_mutex_lock (mux_adl
);
836 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
838 int temp
= hm_get_temperature_with_device_id (i
);
840 fprintf (out
, "%d\t", temp
);
843 hc_thread_mutex_unlock (mux_adl
);
858 void status_display ()
860 if (data
.devices_status
== STATUS_INIT
) return;
861 if (data
.devices_status
== STATUS_STARTING
) return;
862 if (data
.devices_status
== STATUS_BYPASS
) return;
864 if (data
.status_automat
== 1)
866 status_display_automat ();
875 log_info ("Session.Name...: %s", data
.session
);
877 char *status_type
= strstatus (data
.devices_status
);
879 uint hash_mode
= data
.hash_mode
;
881 char *hash_type
= strhashtype (hash_mode
); // not a bug
883 log_info ("Status.........: %s", status_type
);
889 if (data
.rp_files_cnt
)
893 for (i
= 0, tmp_len
= 0; i
< data
.rp_files_cnt
- 1 && tmp_len
< sizeof (tmp_buf
); i
++)
895 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s), ", data
.rp_files
[i
]);
898 snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "File (%s)", data
.rp_files
[i
]);
900 log_info ("Rules.Type.....: %s", tmp_buf
);
907 log_info ("Rules.Type.....: Generated (%u)", data
.rp_gen
);
909 if (data
.rp_gen_seed
)
911 log_info ("Rules.Seed.....: %u", data
.rp_gen_seed
);
919 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
921 if (data
.wordlist_mode
== WL_MODE_FILE
)
923 if (data
.dictfile
!= NULL
) log_info ("Input.Mode.....: File (%s)", data
.dictfile
);
925 else if (data
.wordlist_mode
== WL_MODE_STDIN
)
927 log_info ("Input.Mode.....: Pipe");
930 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
932 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
933 if (data
.dictfile2
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile2
);
935 else if (data
.attack_mode
== ATTACK_MODE_BF
)
937 char *mask
= data
.mask
;
941 uint mask_len
= data
.css_cnt
;
943 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, "Mask (%s)", mask
);
947 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
949 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
951 mask_len
-= data
.salts_buf
[0].salt_len
;
955 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
) mask_len
/= 2;
957 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " [%i]", mask_len
);
960 if (data
.maskcnt
> 1)
962 float mask_percentage
= (float) data
.maskpos
/ (float) data
.maskcnt
;
964 tmp_len
+= snprintf (tmp_buf
+ tmp_len
, sizeof (tmp_buf
) - tmp_len
, " (%.02f%%)", mask_percentage
* 100);
967 log_info ("Input.Mode.....: %s", tmp_buf
);
972 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
974 if (data
.dictfile
!= NULL
) log_info ("Input.Left.....: File (%s)", data
.dictfile
);
975 if (data
.mask
!= NULL
) log_info ("Input.Right....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
977 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
979 if (data
.mask
!= NULL
) log_info ("Input.Left.....: Mask (%s) [%i]", data
.mask
, data
.css_cnt
);
980 if (data
.dictfile
!= NULL
) log_info ("Input.Right....: File (%s)", data
.dictfile
);
983 if (data
.digests_cnt
== 1)
985 if (data
.hash_mode
== 2500)
987 wpa_t
*wpa
= (wpa_t
*) data
.esalts_buf
;
991 char *pke_ptr
= (char *) pke
;
993 for (uint i
= 0; i
< 25; i
++)
995 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
1001 memcpy (mac1
, pke_ptr
+ 23, 6);
1002 memcpy (mac2
, pke_ptr
+ 29, 6);
1004 log_info ("Hash.Target....: %s (%02x:%02x:%02x:%02x:%02x:%02x <-> %02x:%02x:%02x:%02x:%02x:%02x)",
1005 (char *) data
.salts_buf
[0].salt_buf
,
1019 else if (data
.hash_mode
== 5200)
1021 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1023 else if (data
.hash_mode
== 9000)
1025 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1027 else if ((data
.hash_mode
>= 6200) && (data
.hash_mode
<= 6299))
1029 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1035 ascii_digest (out_buf
, 0, 0);
1038 if (strlen (out_buf
) > 40)
1046 log_info ("Hash.Target....: %s", out_buf
);
1051 if (data
.hash_mode
== 3000)
1053 char out_buf1
[4096];
1054 char out_buf2
[4096];
1056 ascii_digest (out_buf1
, 0, 0);
1057 ascii_digest (out_buf2
, 0, 1);
1059 log_info ("Hash.Target....: %s, %s", out_buf1
, out_buf2
);
1063 log_info ("Hash.Target....: File (%s)", data
.hashfile
);
1067 log_info ("Hash.Type......: %s", hash_type
);
1073 uint64_t speed_cnt
[DEVICES_MAX
];
1074 float speed_ms
[DEVICES_MAX
];
1076 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1078 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1080 // we need to clear values (set to 0) because in case the gpu does
1081 // not get new candidates it idles around but speed display would
1082 // show it as working.
1083 // if we instantly set it to 0 after reading it happens that the
1084 // speed can be shown as zero if the users refreshs to fast.
1085 // therefore, we add a timestamp when a stat was recorded and if its
1086 // to old we will not use it
1088 speed_cnt
[device_id
] = 0;
1089 speed_ms
[device_id
] = 0;
1091 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1095 hc_timer_get (device_param
->speed_rec
[i
], rec_ms
);
1097 if (rec_ms
> SPEED_MAXAGE
) continue;
1099 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1100 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1103 speed_cnt
[device_id
] /= SPEED_CACHE
;
1104 speed_ms
[device_id
] /= SPEED_CACHE
;
1107 float hashes_all_ms
= 0;
1109 float hashes_dev_ms
[DEVICES_MAX
];
1111 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1113 hashes_dev_ms
[device_id
] = 0;
1115 if (speed_ms
[device_id
])
1117 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1119 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1127 float ms_running
= 0;
1129 hc_timer_get (data
.timer_running
, ms_running
);
1131 float ms_paused
= data
.ms_paused
;
1133 if (data
.devices_status
== STATUS_PAUSED
)
1135 float ms_paused_tmp
= 0;
1137 hc_timer_get (data
.timer_paused
, ms_paused_tmp
);
1139 ms_paused
+= ms_paused_tmp
;
1144 __time64_t sec_run
= ms_running
/ 1000;
1148 time_t sec_run
= ms_running
/ 1000;
1154 char display_run
[32];
1162 tmp
= _gmtime64 (&sec_run
);
1166 tmp
= gmtime (&sec_run
);
1172 memcpy (&tm_run
, tmp
, sizeof (struct tm
));
1174 format_timer_display (&tm_run
, display_run
, sizeof (tm_run
));
1176 char *start
= ctime (&data
.proc_start
);
1178 size_t start_len
= strlen (start
);
1180 if (start
[start_len
- 1] == '\n') start
[start_len
- 1] = 0;
1181 if (start
[start_len
- 2] == '\r') start
[start_len
- 2] = 0;
1183 log_info ("Time.Started...: %s (%s)", start
, display_run
);
1188 log_info ("Time.Started...: 0 secs");
1195 uint salts_left
= data
.salts_cnt
- data
.salts_done
;
1197 if (salts_left
== 0) salts_left
= 1;
1199 uint64_t progress_total
= data
.words_cnt
* salts_left
;
1201 uint64_t all_done
= 0;
1202 uint64_t all_rejected
= 0;
1203 uint64_t all_restored
= 0;
1205 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
1209 // otherwise the final cracked status shows 0/XXX progress
1211 if (data
.salts_shown
[salt_pos
] == 1) continue;
1214 all_done
+= data
.words_progress_done
[salt_pos
];
1215 all_rejected
+= data
.words_progress_rejected
[salt_pos
];
1216 all_restored
+= data
.words_progress_restored
[salt_pos
];
1219 uint64_t progress_cur
= all_restored
+ all_done
+ all_rejected
;
1220 uint64_t progress_end
= progress_total
;
1222 uint64_t progress_skip
= 0;
1226 progress_skip
= MIN (data
.skip
, data
.words_base
) * salts_left
;
1228 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_skip
*= data
.gpu_rules_cnt
;
1229 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_skip
*= data
.combs_cnt
;
1230 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_skip
*= data
.bfs_cnt
;
1235 progress_end
= MIN (data
.limit
, data
.words_base
) * salts_left
;
1237 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) progress_end
*= data
.gpu_rules_cnt
;
1238 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) progress_end
*= data
.combs_cnt
;
1239 else if (data
.attack_kern
== ATTACK_KERN_BF
) progress_end
*= data
.bfs_cnt
;
1242 uint64_t progress_cur_relative_skip
= progress_cur
- progress_skip
;
1243 uint64_t progress_end_relative_skip
= progress_end
- progress_skip
;
1245 float speed_ms_real
= ms_running
- ms_paused
;
1246 uint64_t speed_plains_real
= all_done
;
1248 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1250 if (data
.devices_status
!= STATUS_CRACKED
)
1252 uint64_t words_per_ms
= 0;
1254 if (speed_plains_real
&& speed_ms_real
)
1256 words_per_ms
= speed_plains_real
/ speed_ms_real
;
1260 __time64_t sec_etc
= 0;
1267 uint64_t progress_left_relative_skip
= progress_end_relative_skip
- progress_cur_relative_skip
;
1269 uint64_t ms_left
= progress_left_relative_skip
/ words_per_ms
;
1271 sec_etc
= ms_left
/ 1000;
1276 log_info ("Time.Estimated.: 0 secs");
1278 else if ((uint64_t) sec_etc
> ETC_MAX
)
1280 log_info ("Time.Estimated.: > 10 Years");
1284 char display_etc
[32];
1292 tmp
= _gmtime64 (&sec_etc
);
1296 tmp
= gmtime (&sec_etc
);
1302 memcpy (&tm_etc
, tmp
, sizeof (tm_etc
));
1304 format_timer_display (&tm_etc
, display_etc
, sizeof (display_etc
));
1312 char *etc
= ctime (&now
);
1314 size_t etc_len
= strlen (etc
);
1316 if (etc
[etc_len
- 1] == '\n') etc
[etc_len
- 1] = 0;
1317 if (etc
[etc_len
- 2] == '\r') etc
[etc_len
- 2] = 0;
1319 log_info ("Time.Estimated.: %s (%s)", etc
, display_etc
);
1325 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1327 char display_dev_cur
[16];
1329 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1331 strncpy (display_dev_cur
, "0.00", 4);
1333 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1335 log_info ("Speed.GPU.#%d...: %9sH/s", device_id
+ 1, display_dev_cur
);
1338 char display_all_cur
[16];
1340 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1342 strncpy (display_all_cur
, "0.00", 4);
1344 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1346 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*...: %9sH/s", display_all_cur
);
1348 const float digests_percent
= (float) data
.digests_done
/ data
.digests_cnt
;
1349 const float salts_percent
= (float) data
.salts_done
/ data
.salts_cnt
;
1351 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);
1355 if (data
.digests_cnt
> 100)
1357 time_t now
= time (NULL
);
1359 int cpt_cur_min
= 0;
1360 int cpt_cur_hour
= 0;
1361 int cpt_cur_day
= 0;
1363 for (int i
= 0; i
< CPT_BUF
; i
++)
1365 const uint cracked
= data
.cpt_buf
[i
].cracked
;
1366 const time_t timestamp
= data
.cpt_buf
[i
].timestamp
;
1368 if ((timestamp
+ 60) > now
)
1370 cpt_cur_min
+= cracked
;
1373 if ((timestamp
+ 3600) > now
)
1375 cpt_cur_hour
+= cracked
;
1378 if ((timestamp
+ 86400) > now
)
1380 cpt_cur_day
+= cracked
;
1384 float cpt_avg_min
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 60);
1385 float cpt_avg_hour
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 3600);
1386 float cpt_avg_day
= (float) data
.cpt_total
/ ((speed_ms_real
/ 1000) / 86400);
1388 if ((data
.cpt_start
+ 86400) < now
)
1390 log_info ("Recovered/Time.: CUR:%llu,%llu,%llu AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1398 else if ((data
.cpt_start
+ 3600) < now
)
1400 log_info ("Recovered/Time.: CUR:%llu,%llu,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1407 else if ((data
.cpt_start
+ 60) < now
)
1409 log_info ("Recovered/Time.: CUR:%llu,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1417 log_info ("Recovered/Time.: CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)",
1426 uint64_t restore_point
= get_lowest_words_done ();
1428 uint64_t restore_total
= data
.words_base
;
1430 float percent_restore
= 0;
1432 if (restore_total
!= 0) percent_restore
= (float) restore_point
/ (float) restore_total
;
1434 if (progress_end_relative_skip
)
1436 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1438 float percent_finished
= (float) progress_cur_relative_skip
/ (float) progress_end_relative_skip
;
1439 float percent_rejected
= 0.0;
1443 percent_rejected
= (float) (all_rejected
) / (float) progress_cur
;
1446 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);
1447 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (unsigned long long int) all_rejected
, (unsigned long long int) progress_cur_relative_skip
, percent_rejected
* 100);
1449 if (data
.restore_disable
== 0)
1451 if (percent_finished
!= 1)
1453 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (unsigned long long int) restore_point
, (unsigned long long int) restore_total
, percent_restore
* 100);
1460 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
1462 log_info ("Progress.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1463 log_info ("Rejected.......: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1465 if (data
.restore_disable
== 0)
1467 log_info ("Restore.Point..: %llu/%llu (%.02f%%)", (uint64_t) 0, (uint64_t) 0, (float) 100);
1472 log_info ("Progress.......: %llu", (unsigned long long int) progress_cur_relative_skip
);
1473 log_info ("Rejected.......: %llu", (unsigned long long int) all_rejected
);
1475 // --restore not allowed if stdin is used -- really? why?
1477 //if (data.restore_disable == 0)
1479 // log_info ("Restore.Point..: %llu", (unsigned long long int) restore_point);
1484 if (data
.gpu_temp_disable
== 0)
1486 hc_thread_mutex_lock (mux_adl
);
1488 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
1490 if (data
.hm_device
[i
].fan_supported
== 1)
1492 const int temperature
= hm_get_temperature_with_device_id (i
);
1493 const int utilization
= hm_get_utilization_with_device_id (i
);
1494 const int fanspeed
= hm_get_fanspeed_with_device_id (i
);
1496 if (data
.vendor_id
== VENDOR_ID_AMD
)
1498 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1501 if (data
.vendor_id
== VENDOR_ID_NV
)
1504 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2d%% Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1506 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, %2drpm Fan", i
+ 1, utilization
, temperature
, fanspeed
);
1512 const int temperature
= hm_get_temperature_with_device_id (i
);
1513 const int utilization
= hm_get_utilization_with_device_id (i
);
1515 log_info ("HWMon.GPU.#%d...: %2d%% Util, %2dc Temp, N/A Fan", i
+ 1, utilization
, temperature
);
1519 hc_thread_mutex_unlock (mux_adl
);
1523 static void status_benchmark ()
1525 if (data
.devices_status
== STATUS_INIT
) return;
1526 if (data
.devices_status
== STATUS_STARTING
) return;
1528 if (data
.words_cnt
== 0) return;
1530 uint64_t speed_cnt
[DEVICES_MAX
];
1531 float speed_ms
[DEVICES_MAX
];
1535 for (device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1537 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
1539 speed_cnt
[device_id
] = 0;
1540 speed_ms
[device_id
] = 0;
1542 for (int i
= 0; i
< SPEED_CACHE
; i
++)
1544 speed_cnt
[device_id
] += device_param
->speed_cnt
[i
];
1545 speed_ms
[device_id
] += device_param
->speed_ms
[i
];
1548 speed_cnt
[device_id
] /= SPEED_CACHE
;
1549 speed_ms
[device_id
] /= SPEED_CACHE
;
1552 float hashes_all_ms
= 0;
1554 float hashes_dev_ms
[DEVICES_MAX
];
1556 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1558 hashes_dev_ms
[device_id
] = 0;
1560 if (speed_ms
[device_id
])
1562 hashes_dev_ms
[device_id
] = speed_cnt
[device_id
] / speed_ms
[device_id
];
1564 hashes_all_ms
+= hashes_dev_ms
[device_id
];
1568 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
1570 char display_dev_cur
[16];
1572 memset (display_dev_cur
, 0, sizeof (display_dev_cur
));
1574 strncpy (display_dev_cur
, "0.00", 4);
1576 format_speed_display (hashes_dev_ms
[device_id
] * 1000, display_dev_cur
, sizeof (display_dev_cur
));
1578 log_info ("Speed.GPU.#%d.: %9sH/s", device_id
+ 1, display_dev_cur
);
1581 char display_all_cur
[16];
1583 memset (display_all_cur
, 0, sizeof (display_all_cur
));
1585 strncpy (display_all_cur
, "0.00", 4);
1587 format_speed_display (hashes_all_ms
* 1000, display_all_cur
, sizeof (display_all_cur
));
1589 if (data
.devices_cnt
> 1) log_info ("Speed.GPU.#*.: %9sH/s", display_all_cur
);
1593 * oclHashcat -only- functions
1596 static void generate_source_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *source_file
)
1598 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1600 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1601 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a0.cl", install_dir
, (int) kern_type
);
1602 else if (attack_kern
== ATTACK_KERN_COMBI
)
1603 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a1.cl", install_dir
, (int) kern_type
);
1604 else if (attack_kern
== ATTACK_KERN_BF
)
1605 snprintf (source_file
, 255, "%s/OpenCL/m%05d_a3.cl", install_dir
, (int) kern_type
);
1608 snprintf (source_file
, 255, "%s/OpenCL/m%05d.cl", install_dir
, (int) kern_type
);
1611 static void generate_cached_kernel_filename (const uint attack_exec
, const uint attack_kern
, const uint kern_type
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1613 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
1615 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
1616 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a0.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1617 else if (attack_kern
== ATTACK_KERN_COMBI
)
1618 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a1.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1619 else if (attack_kern
== ATTACK_KERN_BF
)
1620 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d_a3.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1624 snprintf (cached_file
, 255, "%s/kernels/%d/m%05d.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, (int) kern_type
, device_name
, device_version
, driver_version
, COMPTIME
);
1628 static void generate_source_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *install_dir
, char *source_file
)
1630 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1632 snprintf (source_file
, 255, "%s/OpenCL/markov_be.cl", install_dir
);
1636 snprintf (source_file
, 255, "%s/OpenCL/markov_le.cl", install_dir
);
1640 static void generate_cached_kernel_mp_filename (const uint opti_type
, const uint opts_type
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1642 if ((opti_type
& OPTI_TYPE_BRUTE_FORCE
) && (opts_type
& OPTS_TYPE_PT_GENERATE_BE
))
1644 snprintf (cached_file
, 255, "%s/kernels/%d/markov_be.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, device_name
, device_version
, driver_version
, COMPTIME
);
1648 snprintf (cached_file
, 255, "%s/kernels/%d/markov_le.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, device_name
, device_version
, driver_version
, COMPTIME
);
1652 static void generate_source_kernel_amp_filename (const uint attack_kern
, char *install_dir
, char *source_file
)
1654 snprintf (source_file
, 255, "%s/OpenCL/amp_a%d.cl", install_dir
, attack_kern
);
1657 static void generate_cached_kernel_amp_filename (const uint attack_kern
, char *install_dir
, char *device_name
, char *device_version
, char *driver_version
, int vendor_id
, char *cached_file
)
1659 snprintf (cached_file
, 255, "%s/kernels/%d/amp_a%d.%s_%s_%s_%d.kernel", install_dir
, vendor_id
, attack_kern
, device_name
, device_version
, driver_version
, COMPTIME
);
1662 static uint
convert_from_hex (char *line_buf
, const uint line_len
)
1664 if (line_len
& 1) return (line_len
); // not in hex
1666 if (data
.hex_wordlist
== 1)
1671 for (i
= 0, j
= 0; j
< line_len
; i
+= 1, j
+= 2)
1673 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1676 memset (line_buf
+ i
, 0, line_len
- i
);
1680 else if (line_len
>= 6) // $HEX[] = 6
1682 if (line_buf
[0] != '$') return (line_len
);
1683 if (line_buf
[1] != 'H') return (line_len
);
1684 if (line_buf
[2] != 'E') return (line_len
);
1685 if (line_buf
[3] != 'X') return (line_len
);
1686 if (line_buf
[4] != '[') return (line_len
);
1687 if (line_buf
[line_len
- 1] != ']') return (line_len
);
1692 for (i
= 0, j
= 5; j
< line_len
- 1; i
+= 1, j
+= 2)
1694 line_buf
[i
] = hex_to_char (&line_buf
[j
]);
1697 memset (line_buf
+ i
, 0, line_len
- i
);
1705 static uint
count_lines (FILE *fd
)
1709 char *buf
= (char *) mymalloc (BUFSIZ
);
1711 size_t nread_tmp
= 0;
1717 size_t nread
= fread (buf
, sizeof (char), BUFSIZ
, fd
);
1720 if (nread
< 1) continue;
1726 if (*ptr
++ == '\n') cnt
++;
1731 // special case (if last line did not contain a newline char ... at the very end of the file)
1741 if (*ptr
!= '\n') // needed ? different on windows systems?
1753 static void clear_prompt ()
1755 fputc ('\r', stdout
);
1757 for (size_t i
= 0; i
< strlen (PROMPT
); i
++)
1759 fputc (' ', stdout
);
1762 fputc ('\r', stdout
);
1767 static void gidd_to_pw_t (hc_device_param_t
*device_param
, const uint64_t gidd
, pw_t
*pw
)
1769 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_pws_buf
, CL_TRUE
, gidd
* sizeof (pw_t
), sizeof (pw_t
), pw
, 0, NULL
, NULL
);
1772 static void check_hash (hc_device_param_t
*device_param
, const uint salt_pos
, const uint digest_pos
)
1774 char *outfile
= data
.outfile
;
1775 uint quiet
= data
.quiet
;
1776 FILE *pot_fp
= data
.pot_fp
;
1777 uint loopback
= data
.loopback
;
1778 uint debug_mode
= data
.debug_mode
;
1779 char *debug_file
= data
.debug_file
;
1781 char debug_rule_buf
[BLOCK_SIZE
];
1782 int debug_rule_len
= 0; // -1 error
1783 uint debug_plain_len
= 0;
1785 unsigned char debug_plain_ptr
[BLOCK_SIZE
];
1789 char out_buf
[4096]; memset (out_buf
, 0, sizeof (out_buf
));
1791 ascii_digest (out_buf
, salt_pos
, digest_pos
);
1793 uint idx
= data
.salts_buf
[salt_pos
].digests_offset
+ digest_pos
;
1799 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_plain_bufs
, CL_TRUE
, idx
* sizeof (plain_t
), sizeof (plain_t
), &plain
, 0, NULL
, NULL
);
1801 uint gidvid
= plain
.gidvid
;
1802 uint il_pos
= plain
.il_pos
;
1804 uint64_t crackpos
= device_param
->words_off
;
1808 unsigned char *plain_ptr
= (unsigned char *) plain_buf
;
1809 unsigned int plain_len
= 0;
1811 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
1813 uint64_t gidd
= gidvid
;
1818 gidd_to_pw_t (device_param
, gidd
, &pw
);
1820 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1822 plain_buf
[i
] = pw
.hi1
[0][j
];
1825 plain_len
= pw
.pw_len
;
1827 const uint off
= device_param
->innerloop_pos
+ il_pos
;
1834 if ((debug_mode
== 1) || (debug_mode
== 3) || (debug_mode
== 4))
1836 memset (debug_rule_buf
, 0, sizeof (debug_rule_buf
));
1838 debug_rule_len
= gpu_rule_to_cpu_rule (debug_rule_buf
, &data
.gpu_rules_buf
[off
]);
1842 if ((debug_mode
== 2) || (debug_mode
== 3) || (debug_mode
== 4))
1844 memset (debug_plain_ptr
, 0, sizeof (debug_plain_ptr
));
1846 memcpy (debug_plain_ptr
, plain_ptr
, plain_len
);
1848 debug_plain_len
= plain_len
;
1852 plain_len
= apply_rules (data
.gpu_rules_buf
[off
].cmds
, &plain_buf
[0], &plain_buf
[4], plain_len
);
1855 crackpos
*= data
.gpu_rules_cnt
;
1856 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1858 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1860 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
1862 uint64_t gidd
= gidvid
;
1867 gidd_to_pw_t (device_param
, gidd
, &pw
);
1869 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1871 plain_buf
[i
] = pw
.hi1
[0][j
];
1874 plain_len
= pw
.pw_len
;
1876 char *comb_buf
= (char *) device_param
->combs_buf
[il_pos
].i
;
1877 uint comb_len
= device_param
->combs_buf
[il_pos
].pw_len
;
1879 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
1881 memcpy (plain_ptr
+ plain_len
, comb_buf
, comb_len
);
1885 memmove (plain_ptr
+ comb_len
, plain_ptr
, plain_len
);
1887 memcpy (plain_ptr
, comb_buf
, comb_len
);
1890 plain_len
+= comb_len
;
1893 crackpos
*= data
.combs_cnt
;
1894 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1896 if (data
.pw_max
!= PW_DICTMAX1
)
1898 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1901 else if (data
.attack_mode
== ATTACK_MODE_BF
)
1903 uint64_t l_off
= device_param
->kernel_params_mp_l_buf64
[3] + gidvid
;
1904 uint64_t r_off
= device_param
->kernel_params_mp_r_buf64
[3] + il_pos
;
1906 uint l_start
= device_param
->kernel_params_mp_l_buf32
[5];
1907 uint r_start
= device_param
->kernel_params_mp_r_buf32
[5];
1909 uint l_stop
= device_param
->kernel_params_mp_l_buf32
[4];
1910 uint r_stop
= device_param
->kernel_params_mp_r_buf32
[4];
1912 sp_exec (l_off
, (char *) plain_ptr
+ l_start
, data
.root_css_buf
, data
.markov_css_buf
, l_start
, l_start
+ l_stop
);
1913 sp_exec (r_off
, (char *) plain_ptr
+ r_start
, data
.root_css_buf
, data
.markov_css_buf
, r_start
, r_start
+ r_stop
);
1915 plain_len
= data
.css_cnt
;
1918 crackpos
*= data
.bfs_cnt
;
1919 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1921 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
1923 uint64_t gidd
= gidvid
;
1928 gidd_to_pw_t (device_param
, gidd
, &pw
);
1930 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1932 plain_buf
[i
] = pw
.hi1
[0][j
];
1935 plain_len
= pw
.pw_len
;
1937 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1940 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1942 sp_exec (off
, (char *) plain_ptr
+ plain_len
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1944 plain_len
+= start
+ stop
;
1947 crackpos
*= data
.combs_cnt
;
1948 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1950 if (data
.pw_max
!= PW_DICTMAX1
)
1952 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1955 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
1957 uint64_t gidd
= gidvid
;
1962 gidd_to_pw_t (device_param
, gidd
, &pw
);
1964 for (int i
= 0, j
= gidm
; i
< 16; i
++, j
++)
1966 plain_buf
[i
] = pw
.hi1
[0][j
];
1969 plain_len
= pw
.pw_len
;
1971 uint64_t off
= device_param
->kernel_params_mp_buf64
[3] + il_pos
;
1974 uint stop
= device_param
->kernel_params_mp_buf32
[4];
1976 memmove (plain_ptr
+ stop
, plain_ptr
, plain_len
);
1978 sp_exec (off
, (char *) plain_ptr
, data
.root_css_buf
, data
.markov_css_buf
, start
, start
+ stop
);
1980 plain_len
+= start
+ stop
;
1983 crackpos
*= data
.combs_cnt
;
1984 crackpos
+= device_param
->innerloop_pos
+ il_pos
;
1986 if (data
.pw_max
!= PW_DICTMAX1
)
1988 if (plain_len
> data
.pw_max
) plain_len
= data
.pw_max
;
1992 if (data
.opti_type
& OPTI_TYPE_BRUTE_FORCE
) // lots of optimizations can happen here
1994 if (data
.opti_type
& OPTI_TYPE_SINGLE_HASH
)
1996 if (data
.opti_type
& OPTI_TYPE_APPENDED_SALT
)
1998 plain_len
= plain_len
- data
.salts_buf
[0].salt_len
;
2002 if (data
.opts_type
& OPTS_TYPE_PT_UNICODE
)
2004 for (uint i
= 0, j
= 0; i
< plain_len
; i
+= 2, j
+= 1)
2006 plain_ptr
[j
] = plain_ptr
[i
];
2009 plain_len
= plain_len
/ 2;
2013 // if enabled, update also the potfile
2017 fprintf (pot_fp
, "%s:", out_buf
);
2019 format_plain (pot_fp
, plain_ptr
, plain_len
, 1);
2021 fputc ('\n', pot_fp
);
2028 FILE *out_fp
= NULL
;
2030 if (outfile
!= NULL
)
2032 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
2034 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
2043 if (quiet
== 0) clear_prompt ();
2046 format_output (out_fp
, out_buf
, plain_ptr
, plain_len
, crackpos
, NULL
, 0);
2048 if (outfile
!= NULL
)
2050 if (out_fp
!= stdout
)
2057 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
2059 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.status
!= 1))
2061 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
2062 if (quiet
== 0) fflush (stdout
);
2071 char *loopback_file
= data
.loopback_file
;
2075 if ((fb_fp
= fopen (loopback_file
, "ab")) != NULL
)
2077 format_plain (fb_fp
, plain_ptr
, plain_len
, 1);
2079 fputc ('\n', fb_fp
);
2085 // (rule) debug mode
2087 // the next check implies that:
2088 // - (data.attack_mode == ATTACK_MODE_STRAIGHT)
2091 if ((debug_plain_len
> 0) || (debug_rule_len
> 0))
2093 if (debug_rule_len
< 0) debug_rule_len
= 0;
2095 if ((quiet
== 0) && (debug_file
== NULL
)) clear_prompt ();
2097 format_debug (debug_file
, debug_mode
, debug_plain_ptr
, debug_plain_len
, plain_ptr
, plain_len
, debug_rule_buf
, debug_rule_len
);
2099 if ((quiet
== 0) && (debug_file
== NULL
))
2101 fprintf (stdout
, "%s", PROMPT
);
2107 static void check_cracked (hc_device_param_t
*device_param
, const uint salt_pos
)
2109 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2113 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2115 for (uint i
= 0; i
< GPU_THREADS
; i
++) if (device_param
->result
[i
] == 1) found
= 1;
2119 // display hack (for weak hashes etc, it could be that there is still something to clear on the current line)
2123 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
);
2125 uint cpt_cracked
= 0;
2127 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2129 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2131 if (data
.digests_shown_tmp
[idx
] == 0) continue;
2133 if (data
.digests_shown
[idx
] == 1) continue;
2135 if ((data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
) == 0)
2137 data
.digests_shown
[idx
] = 1;
2139 data
.digests_done
++;
2143 salt_buf
->digests_done
++;
2145 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
2147 data
.salts_shown
[salt_pos
] = 1;
2153 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
2155 check_hash (device_param
, salt_pos
, digest_pos
);
2158 if (cpt_cracked
> 0)
2160 data
.cpt_buf
[data
.cpt_pos
].timestamp
= time (NULL
);
2161 data
.cpt_buf
[data
.cpt_pos
].cracked
= cpt_cracked
;
2165 data
.cpt_total
+= cpt_cracked
;
2167 if (data
.cpt_pos
== CPT_BUF
) data
.cpt_pos
= 0;
2170 if (data
.opts_type
& OPTS_TYPE_PT_NEVERCRACK
)
2172 // we need to reset cracked state on the gpu
2173 // otherwise host thinks again and again the hash was cracked
2174 // and returns invalid password each time
2176 memset (data
.digests_shown_tmp
, 0, salt_buf
->digests_cnt
* sizeof (uint
));
2178 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
);
2181 memset (device_param
->result
, 0, device_param
->size_results
);
2183 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_result
, CL_TRUE
, 0, device_param
->size_results
, device_param
->result
, 0, NULL
, NULL
);
2187 static void save_hash ()
2189 char *hashfile
= data
.hashfile
;
2191 char new_hashfile
[256];
2192 char old_hashfile
[256];
2194 memset (new_hashfile
, 0, sizeof (new_hashfile
));
2195 memset (old_hashfile
, 0, sizeof (old_hashfile
));
2197 snprintf (new_hashfile
, 255, "%s.new", hashfile
);
2198 snprintf (old_hashfile
, 255, "%s.old", hashfile
);
2200 unlink (new_hashfile
);
2202 char separator
= data
.separator
;
2204 FILE *fp
= fopen (new_hashfile
, "wb");
2208 log_error ("ERROR: %s: %s", new_hashfile
, strerror (errno
));
2213 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2215 if (data
.salts_shown
[salt_pos
] == 1) continue;
2217 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2219 for (uint digest_pos
= 0; digest_pos
< salt_buf
->digests_cnt
; digest_pos
++)
2221 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
2223 if (data
.digests_shown
[idx
] == 1) continue;
2225 if (data
.hash_mode
!= 2500)
2229 memset (out_buf
, 0, sizeof (out_buf
));
2231 if (data
.username
== 1)
2233 user_t
*user
= data
.hash_info
[idx
]->user
;
2237 for (i
= 0; i
< user
->user_len
; i
++) fputc (user
->user_name
[i
], fp
);
2239 fputc (separator
, fp
);
2242 ascii_digest (out_buf
, salt_pos
, digest_pos
);
2244 fputs (out_buf
, fp
);
2252 to_hccap_t (&hccap
, salt_pos
, digest_pos
);
2254 fwrite (&hccap
, sizeof (hccap_t
), 1, fp
);
2263 unlink (old_hashfile
);
2265 if (rename (hashfile
, old_hashfile
) != 0)
2267 log_error ("ERROR: Rename file '%s' to '%s': %s", hashfile
, old_hashfile
, strerror (errno
));
2274 if (rename (new_hashfile
, hashfile
) != 0)
2276 log_error ("ERROR: Rename file '%s' to '%s': %s", new_hashfile
, hashfile
, strerror (errno
));
2281 unlink (old_hashfile
);
2284 static float find_gpu_blocks_div (const uint64_t total_left
, const uint gpu_blocks_all
)
2286 // function called only in case gpu_blocks_all > words_left)
2288 float gpu_blocks_div
= (float) (total_left
) / gpu_blocks_all
;
2290 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2292 uint32_t gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2294 while (gpu_blocks_new
< total_left
)
2296 gpu_blocks_div
+= gpu_blocks_div
/ 100;
2298 gpu_blocks_new
= (uint32_t) (gpu_blocks_all
* gpu_blocks_div
);
2301 if (data
.quiet
== 0)
2307 log_info ("INFO: approaching final keyspace, workload adjusted");
2311 fprintf (stdout
, "%s", PROMPT
);
2316 if ((gpu_blocks_all
* gpu_blocks_div
) < 8) return 1;
2318 return gpu_blocks_div
;
2321 static void run_kernel (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2323 uint num_elements
= num
;
2325 device_param
->kernel_params_buf32
[30] = data
.combs_mode
;
2326 device_param
->kernel_params_buf32
[31] = num
;
2328 uint gpu_threads
= device_param
->gpu_threads
;
2330 while (num_elements
% gpu_threads
) num_elements
++;
2332 cl_kernel kernel
= NULL
;
2336 case KERN_RUN_1
: kernel
= device_param
->kernel1
; break;
2337 case KERN_RUN_12
: kernel
= device_param
->kernel12
; break;
2338 case KERN_RUN_2
: kernel
= device_param
->kernel2
; break;
2339 case KERN_RUN_23
: kernel
= device_param
->kernel23
; break;
2340 case KERN_RUN_3
: kernel
= device_param
->kernel3
; break;
2343 hc_clSetKernelArg (kernel
, 21, sizeof (cl_uint
), device_param
->kernel_params
[21]);
2344 hc_clSetKernelArg (kernel
, 22, sizeof (cl_uint
), device_param
->kernel_params
[22]);
2345 hc_clSetKernelArg (kernel
, 23, sizeof (cl_uint
), device_param
->kernel_params
[23]);
2346 hc_clSetKernelArg (kernel
, 24, sizeof (cl_uint
), device_param
->kernel_params
[24]);
2347 hc_clSetKernelArg (kernel
, 25, sizeof (cl_uint
), device_param
->kernel_params
[25]);
2348 hc_clSetKernelArg (kernel
, 26, sizeof (cl_uint
), device_param
->kernel_params
[26]);
2349 hc_clSetKernelArg (kernel
, 27, sizeof (cl_uint
), device_param
->kernel_params
[27]);
2350 hc_clSetKernelArg (kernel
, 28, sizeof (cl_uint
), device_param
->kernel_params
[28]);
2351 hc_clSetKernelArg (kernel
, 29, sizeof (cl_uint
), device_param
->kernel_params
[29]);
2352 hc_clSetKernelArg (kernel
, 30, sizeof (cl_uint
), device_param
->kernel_params
[30]);
2353 hc_clSetKernelArg (kernel
, 31, sizeof (cl_uint
), device_param
->kernel_params
[31]);
2355 if ((data
.opts_type
& OPTS_TYPE_PT_BITSLICE
) && (data
.attack_mode
== ATTACK_MODE_BF
))
2357 const size_t global_work_size
[3] = { num_elements
, 32, 1 };
2358 const size_t local_work_size
[3] = { gpu_threads
/ 32, 32, 1 };
2360 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 2, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2364 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2365 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2367 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2370 hc_clFlush (device_param
->command_queue
);
2372 hc_clFinish (device_param
->command_queue
);
2375 static void run_kernel_mp (const uint kern_run
, hc_device_param_t
*device_param
, const uint num
)
2377 uint num_elements
= num
;
2381 case KERN_RUN_MP
: device_param
->kernel_params_mp_buf32
[8] = num
; break;
2382 case KERN_RUN_MP_R
: device_param
->kernel_params_mp_r_buf32
[8] = num
; break;
2383 case KERN_RUN_MP_L
: device_param
->kernel_params_mp_l_buf32
[9] = num
; break;
2386 // causes problems with special threads like in bcrypt
2387 // const uint gpu_threads = device_param->gpu_threads;
2389 const uint gpu_threads
= GPU_THREADS
;
2391 while (num_elements
% gpu_threads
) num_elements
++;
2393 cl_kernel kernel
= NULL
;
2397 case KERN_RUN_MP
: kernel
= device_param
->kernel_mp
; break;
2398 case KERN_RUN_MP_R
: kernel
= device_param
->kernel_mp_r
; break;
2399 case KERN_RUN_MP_L
: kernel
= device_param
->kernel_mp_l
; break;
2404 case KERN_RUN_MP
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp
[3]);
2405 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp
[4]);
2406 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp
[5]);
2407 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp
[6]);
2408 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp
[7]);
2409 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp
[8]);
2411 case KERN_RUN_MP_R
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_r
[3]);
2412 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[4]);
2413 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[5]);
2414 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[6]);
2415 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[7]);
2416 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_r
[8]);
2418 case KERN_RUN_MP_L
: hc_clSetKernelArg (kernel
, 3, sizeof (cl_ulong
), device_param
->kernel_params_mp_l
[3]);
2419 hc_clSetKernelArg (kernel
, 4, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[4]);
2420 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[5]);
2421 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[6]);
2422 hc_clSetKernelArg (kernel
, 7, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[7]);
2423 hc_clSetKernelArg (kernel
, 8, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[8]);
2424 hc_clSetKernelArg (kernel
, 9, sizeof (cl_uint
), device_param
->kernel_params_mp_l
[9]);
2428 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2429 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2431 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2433 hc_clFlush (device_param
->command_queue
);
2435 hc_clFinish (device_param
->command_queue
);
2438 static void run_kernel_tb (hc_device_param_t
*device_param
, const uint num
)
2440 uint num_elements
= num
;
2442 uint gpu_threads
= device_param
->gpu_threads
;
2444 while (num_elements
% gpu_threads
) num_elements
++;
2446 cl_kernel kernel
= device_param
->kernel_tb
;
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_tm (hc_device_param_t
*device_param
)
2460 const uint num_elements
= 1024; // fixed
2462 const uint gpu_threads
= 32;
2464 cl_kernel kernel
= device_param
->kernel_tm
;
2466 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2467 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2469 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2471 hc_clFlush (device_param
->command_queue
);
2473 hc_clFinish (device_param
->command_queue
);
2476 static void run_kernel_amp (hc_device_param_t
*device_param
, const uint num
)
2478 uint num_elements
= num
;
2480 device_param
->kernel_params_amp_buf32
[5] = data
.combs_mode
;
2481 device_param
->kernel_params_amp_buf32
[6] = num_elements
;
2483 // causes problems with special threads like in bcrypt
2484 // const uint gpu_threads = device_param->gpu_threads;
2486 const uint gpu_threads
= GPU_THREADS
;
2488 while (num_elements
% gpu_threads
) num_elements
++;
2490 cl_kernel kernel
= device_param
->kernel_amp
;
2492 hc_clSetKernelArg (kernel
, 5, sizeof (cl_uint
), device_param
->kernel_params_amp
[5]);
2493 hc_clSetKernelArg (kernel
, 6, sizeof (cl_uint
), device_param
->kernel_params_amp
[6]);
2495 const size_t global_work_size
[3] = { num_elements
, 1, 1 };
2496 const size_t local_work_size
[3] = { gpu_threads
, 1, 1 };
2498 hc_clEnqueueNDRangeKernel (device_param
->command_queue
, kernel
, 1, NULL
, global_work_size
, local_work_size
, 0, NULL
, NULL
);
2500 hc_clFlush (device_param
->command_queue
);
2502 hc_clFinish (device_param
->command_queue
);
2505 static void run_kernel_bzero (hc_device_param_t
*device_param
, cl_mem buf
, const uint size
)
2507 if (data
.vendor_id
== VENDOR_ID_AMD
)
2509 const cl_uchar zero
= 0;
2511 hc_clEnqueueFillBuffer (device_param
->command_queue
, buf
, &zero
, sizeof (cl_uchar
), 0, size
, 0, NULL
, NULL
);
2514 if (data
.vendor_id
== VENDOR_ID_NV
)
2516 // NOTE: clEnqueueFillBuffer () always fails with -59
2517 // IOW, it's not supported by Nvidia ForceWare <= 352.21,
2518 // How's that possible, OpenCL 1.2 support is advertised??
2519 // We need to workaround...
2521 #define FILLSZ 0x100000
2523 char *tmp
= (char *) mymalloc (FILLSZ
);
2525 memset (tmp
, 0, FILLSZ
);
2527 for (uint i
= 0; i
< size
; i
+= FILLSZ
)
2529 const int left
= size
- i
;
2531 const int fillsz
= MIN (FILLSZ
, left
);
2533 hc_clEnqueueWriteBuffer (device_param
->command_queue
, buf
, CL_TRUE
, i
, fillsz
, tmp
, 0, NULL
, NULL
);
2540 static int run_rule_engine (const int rule_len
, const char *rule_buf
)
2546 else if (rule_len
== 1)
2548 if (rule_buf
[0] == RULE_OP_MANGLE_NOOP
) return 0;
2554 static void run_copy (hc_device_param_t
*device_param
, const uint pws_cnt
)
2556 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2558 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
);
2560 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2562 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
);
2564 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2566 const uint64_t off
= device_param
->words_off
;
2568 device_param
->kernel_params_mp_l_buf64
[3] = off
;
2570 run_kernel_mp (KERN_RUN_MP_L
, device_param
, pws_cnt
);
2574 static void run_cracker (hc_device_param_t
*device_param
, const uint pw_cnt
, const uint pws_cnt
)
2576 const uint gpu_loops
= data
.gpu_loops
;
2580 uint speed_pos
= device_param
->speed_pos
;
2583 if (device_param
->timer_speed
.tv_sec
== 0)
2585 hc_timer_set (&device_param
->timer_speed
);
2590 if (device_param
->timer_speed
.QuadPart
== 0)
2592 hc_timer_set (&device_param
->timer_speed
);
2596 // find higest password length, this is for optimization stuff
2598 uint highest_pw_len
= 0;
2600 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
2603 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
2606 else if (data
.attack_kern
== ATTACK_KERN_BF
)
2608 highest_pw_len
= device_param
->kernel_params_mp_l_buf32
[4]
2609 + device_param
->kernel_params_mp_l_buf32
[5];
2612 // bitslice optimization stuff
2614 if (data
.attack_mode
== ATTACK_MODE_BF
)
2616 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2618 run_kernel_tb (device_param
, pws_cnt
);
2624 uint innerloop_step
= 0;
2625 uint innerloop_cnt
= 0;
2627 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
) innerloop_step
= gpu_loops
;
2628 else innerloop_step
= 1;
2630 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
) innerloop_cnt
= data
.gpu_rules_cnt
;
2631 else if (data
.attack_kern
== ATTACK_KERN_COMBI
) innerloop_cnt
= data
.combs_cnt
;
2632 else if (data
.attack_kern
== ATTACK_KERN_BF
) innerloop_cnt
= data
.bfs_cnt
;
2634 // loop start: most outer loop = salt iteration, then innerloops (if multi)
2636 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
2638 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2640 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2642 if (data
.devices_status
== STATUS_CRACKED
) break;
2643 if (data
.devices_status
== STATUS_ABORTED
) break;
2644 if (data
.devices_status
== STATUS_QUIT
) break;
2645 if (data
.devices_status
== STATUS_BYPASS
) break;
2647 if (data
.salts_shown
[salt_pos
] == 1) continue;
2649 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
2651 device_param
->kernel_params_buf32
[24] = salt_pos
;
2652 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
2653 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
2655 FILE *combs_fp
= device_param
->combs_fp
;
2657 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2664 for (uint innerloop_pos
= 0; innerloop_pos
< innerloop_cnt
; innerloop_pos
+= innerloop_step
)
2666 while (data
.devices_status
== STATUS_PAUSED
) hc_sleep (1);
2668 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2670 if (data
.devices_status
== STATUS_CRACKED
) break;
2671 if (data
.devices_status
== STATUS_ABORTED
) break;
2672 if (data
.devices_status
== STATUS_QUIT
) break;
2673 if (data
.devices_status
== STATUS_BYPASS
) break;
2675 uint innerloop_left
= innerloop_cnt
- innerloop_pos
;
2677 if (innerloop_left
> innerloop_step
) innerloop_left
= innerloop_step
;
2679 device_param
->innerloop_pos
= innerloop_pos
;
2680 device_param
->innerloop_left
= innerloop_left
;
2682 device_param
->kernel_params_buf32
[27] = innerloop_left
;
2684 if (innerloop_left
== 0) continue;
2686 // initialize amplifiers
2688 if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2690 char line_buf
[BUFSIZ
];
2694 while (i
< innerloop_left
)
2696 if (feof (combs_fp
)) break;
2698 int line_len
= fgetl (combs_fp
, line_buf
);
2700 if (line_len
>= PW_MAX1
) continue;
2702 line_len
= convert_from_hex (line_buf
, line_len
);
2704 char *line_buf_new
= line_buf
;
2706 if (run_rule_engine (data
.rule_len_r
, data
.rule_buf_r
))
2708 char rule_buf_out
[BLOCK_SIZE
];
2710 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
2712 int rule_len_out
= _old_apply_rule (data
.rule_buf_r
, data
.rule_len_r
, line_buf
, line_len
, rule_buf_out
);
2714 if (rule_len_out
< 0)
2716 data
.words_progress_rejected
[salt_pos
] += pw_cnt
;
2721 line_len
= rule_len_out
;
2723 line_buf_new
= rule_buf_out
;
2726 line_len
= MIN (line_len
, PW_DICTMAX
);
2728 char *ptr
= (char *) device_param
->combs_buf
[i
].i
;
2730 memcpy (ptr
, line_buf_new
, line_len
);
2732 memset (ptr
+ line_len
, 0, PW_DICTMAX1
- line_len
);
2734 if (data
.opts_type
& OPTS_TYPE_PT_UPPER
)
2736 uppercase (ptr
, line_len
);
2739 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
2741 if (data
.opts_type
& OPTS_TYPE_PT_ADD80
)
2743 ptr
[line_len
] = 0x80;
2746 if (data
.opts_type
& OPTS_TYPE_PT_ADD01
)
2748 ptr
[line_len
] = 0x01;
2752 device_param
->combs_buf
[i
].pw_len
= line_len
;
2757 for (uint j
= i
; j
< innerloop_left
; j
++)
2759 device_param
->combs_buf
[j
].i
[0] = 0;
2760 device_param
->combs_buf
[j
].i
[1] = 0;
2761 device_param
->combs_buf
[j
].i
[2] = 0;
2762 device_param
->combs_buf
[j
].i
[3] = 0;
2763 device_param
->combs_buf
[j
].i
[4] = 0;
2764 device_param
->combs_buf
[j
].i
[5] = 0;
2765 device_param
->combs_buf
[j
].i
[6] = 0;
2766 device_param
->combs_buf
[j
].i
[7] = 0;
2768 device_param
->combs_buf
[j
].pw_len
= 0;
2773 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2775 uint64_t off
= innerloop_pos
;
2777 device_param
->kernel_params_mp_r_buf64
[3] = off
;
2779 run_kernel_mp (KERN_RUN_MP_R
, device_param
, innerloop_left
);
2781 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2783 uint64_t off
= innerloop_pos
;
2785 device_param
->kernel_params_mp_buf64
[3] = off
;
2787 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2789 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2791 uint64_t off
= innerloop_pos
;
2793 device_param
->kernel_params_mp_buf64
[3] = off
;
2795 run_kernel_mp (KERN_RUN_MP
, device_param
, innerloop_left
);
2800 if (data
.attack_mode
== ATTACK_MODE_STRAIGHT
)
2802 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
);
2804 else if (data
.attack_mode
== ATTACK_MODE_COMBI
)
2806 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
);
2808 else if (data
.attack_mode
== ATTACK_MODE_BF
)
2810 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
);
2812 else if (data
.attack_mode
== ATTACK_MODE_HYBRID1
)
2814 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
);
2816 else if (data
.attack_mode
== ATTACK_MODE_HYBRID2
)
2818 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
);
2821 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
2823 if (data
.attack_mode
== ATTACK_MODE_BF
)
2825 if (data
.opts_type
& OPTS_TYPE_PT_BITSLICE
)
2827 const uint size_tm
= 32 * sizeof (bs_word_t
);
2829 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
2831 run_kernel_tm (device_param
);
2833 hc_clEnqueueCopyBuffer (device_param
->command_queue
, device_param
->d_tm_c
, device_param
->d_bfs_c
, 0, 0, size_tm
, 0, NULL
, NULL
);
2837 if (highest_pw_len
< 16)
2839 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2841 else if (highest_pw_len
< 32)
2843 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2847 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2852 run_kernel_amp (device_param
, pws_cnt
);
2854 run_kernel (KERN_RUN_1
, device_param
, pws_cnt
);
2856 if (data
.opts_type
& OPTS_TYPE_HOOK12
)
2858 run_kernel (KERN_RUN_12
, device_param
, pws_cnt
);
2861 uint iter
= salt_buf
->salt_iter
;
2863 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
2865 uint loop_left
= iter
- loop_pos
;
2867 loop_left
= MIN (loop_left
, gpu_loops
);
2869 device_param
->kernel_params_buf32
[25] = loop_pos
;
2870 device_param
->kernel_params_buf32
[26] = loop_left
;
2872 run_kernel (KERN_RUN_2
, device_param
, pws_cnt
);
2874 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2876 if (data
.devices_status
== STATUS_CRACKED
) break;
2877 if (data
.devices_status
== STATUS_ABORTED
) break;
2878 if (data
.devices_status
== STATUS_QUIT
) break;
2881 if (data
.opts_type
& OPTS_TYPE_HOOK23
)
2883 run_kernel (KERN_RUN_23
, device_param
, pws_cnt
);
2885 hc_clEnqueueReadBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2887 // do something with data
2889 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_hooks
, CL_TRUE
, 0, device_param
->size_hooks
, device_param
->hooks_buf
, 0, NULL
, NULL
);
2892 run_kernel (KERN_RUN_3
, device_param
, pws_cnt
);
2895 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
2897 if (data
.devices_status
== STATUS_CRACKED
) break;
2898 if (data
.devices_status
== STATUS_ABORTED
) break;
2899 if (data
.devices_status
== STATUS_QUIT
) break;
2905 hc_thread_mutex_lock (mux_display
);
2907 check_cracked (device_param
, salt_pos
);
2909 hc_thread_mutex_unlock (mux_display
);
2915 uint64_t perf_sum_all
= (uint64_t) pw_cnt
* (uint64_t) innerloop_left
;
2917 hc_thread_mutex_lock (mux_counter
);
2919 data
.words_progress_done
[salt_pos
] += perf_sum_all
;
2921 hc_thread_mutex_unlock (mux_counter
);
2929 hc_timer_get (device_param
->timer_speed
, speed_ms
);
2931 hc_timer_set (&device_param
->timer_speed
);
2933 hc_thread_mutex_lock (mux_display
);
2935 device_param
->speed_cnt
[speed_pos
] = perf_sum_all
;
2937 device_param
->speed_ms
[speed_pos
] = speed_ms
;
2939 device_param
->speed_rec
[speed_pos
] = device_param
->timer_speed
;
2941 hc_thread_mutex_unlock (mux_display
);
2945 if (speed_pos
== SPEED_CACHE
)
2952 device_param
->speed_pos
= speed_pos
;
2955 static void load_segment (wl_data_t
*wl_data
, FILE *fd
)
2957 // NOTE: use (never changing) ->incr here instead of ->avail otherwise the buffer gets bigger and bigger
2961 wl_data
->cnt
= fread (wl_data
->buf
, 1, wl_data
->incr
- 1000, fd
);
2963 wl_data
->buf
[wl_data
->cnt
] = 0;
2965 if (wl_data
->cnt
== 0) return;
2967 if (wl_data
->buf
[wl_data
->cnt
- 1] == '\n') return;
2971 if (wl_data
->cnt
== wl_data
->avail
)
2973 wl_data
->buf
= (char *) myrealloc (wl_data
->buf
, wl_data
->avail
, wl_data
->incr
);
2975 wl_data
->avail
+= wl_data
->incr
;
2978 const int c
= fgetc (fd
);
2980 if (c
== EOF
) break;
2982 wl_data
->buf
[wl_data
->cnt
] = (char) c
;
2986 if (c
== '\n') break;
2989 // ensure stream ends with a newline
2991 if (wl_data
->buf
[wl_data
->cnt
- 1] != '\n')
2995 wl_data
->buf
[wl_data
->cnt
- 1] = '\n';
3001 static void get_next_word_lm (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3005 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3007 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3017 if (*ptr
!= '\n') continue;
3021 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3032 static void get_next_word_uc (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3036 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3038 if (*ptr
>= 'a' && *ptr
<= 'z') *ptr
-= 0x20;
3040 if (*ptr
!= '\n') continue;
3044 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3055 static void get_next_word_std (char *buf
, uint32_t sz
, uint32_t *len
, uint32_t *off
)
3059 for (uint32_t i
= 0; i
< sz
; i
++, ptr
++)
3061 if (*ptr
!= '\n') continue;
3065 if ((i
> 0) && (buf
[i
- 1] == '\r')) i
--;
3076 static void get_next_word (wl_data_t
*wl_data
, FILE *fd
, char **out_buf
, uint
*out_len
)
3078 while (wl_data
->pos
< wl_data
->cnt
)
3083 char *ptr
= wl_data
->buf
+ wl_data
->pos
;
3085 get_next_word_func (ptr
, wl_data
->cnt
- wl_data
->pos
, &len
, &off
);
3087 wl_data
->pos
+= off
;
3089 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3091 char rule_buf_out
[BLOCK_SIZE
];
3093 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3095 int rule_len_out
= -1;
3097 if (len
< BLOCK_SIZE
)
3099 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, ptr
, len
, rule_buf_out
);
3102 if (rule_len_out
< 0)
3107 if (rule_len_out
> PW_MAX
)
3128 fprintf (stderr
, "bug!!\n");
3133 load_segment (wl_data
, fd
);
3135 get_next_word (wl_data
, fd
, out_buf
, out_len
);
3139 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, size_t *dictstat_nmemb
)
3143 static uint64_t count_words (wl_data_t
*wl_data
, FILE *fd
, char *dictfile
, dictstat_t
*dictstat_base
, uint
*dictstat_nmemb
)
3153 fstat (fileno (fd
), &d
.stat
);
3157 _fstat64 (fileno (fd
), &d
.stat
);
3161 d
.stat
.st_nlink
= 0;
3165 d
.stat
.st_atime
= 0;
3168 d
.stat
.st_blksize
= 0;
3169 d
.stat
.st_blocks
= 0;
3172 if (d
.stat
.st_size
== 0) return 0;
3174 dictstat_t
*d_cache
= (dictstat_t
*) lfind (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3176 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
) == 0)
3180 uint64_t cnt
= d_cache
->cnt
;
3182 uint64_t keyspace
= cnt
;
3184 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3186 keyspace
*= data
.gpu_rules_cnt
;
3188 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3190 keyspace
*= data
.combs_cnt
;
3193 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
);
3194 if (data
.quiet
== 0) log_info ("");
3196 hc_signal (sigHandler_default
);
3211 load_segment (wl_data
, fd
);
3213 comp
+= wl_data
->cnt
;
3217 while (i
< wl_data
->cnt
)
3222 get_next_word_func (wl_data
->buf
+ i
, wl_data
->cnt
- i
, &len
, &off
);
3224 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3226 char rule_buf_out
[BLOCK_SIZE
];
3228 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3230 int rule_len_out
= -1;
3232 if (len
< BLOCK_SIZE
)
3234 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, wl_data
->buf
+ i
, len
, rule_buf_out
);
3237 if (rule_len_out
< 0)
3249 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
3251 cnt
+= data
.gpu_rules_cnt
;
3253 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
3255 cnt
+= data
.combs_cnt
;
3268 if ((now
- prev
) == 0) continue;
3270 float percent
= (float) comp
/ (float) d
.stat
.st_size
;
3272 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
);
3277 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
);
3278 if (data
.quiet
== 0) log_info ("");
3280 lsearch (&d
, dictstat_base
, dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
3282 hc_signal (sigHandler_default
);
3287 static void pw_transpose_to_hi1 (const pw_t
*p1
, pw_t
*p2
)
3289 memcpy (p2
->hi1
, p1
->hi1
, 64 * sizeof (uint
));
3292 static uint
pw_add_to_hc1 (hc_device_param_t
*device_param
, const uint8_t *pw_buf
, const uint pw_len
)
3294 if (data
.devices_status
== STATUS_BYPASS
) return 0;
3296 pw_cache_t
*pw_cache
= device_param
->pw_caches
+ pw_len
;
3298 uint cache_cnt
= pw_cache
->cnt
;
3300 uint8_t *pw_hc1
= pw_cache
->pw_buf
.hc1
[cache_cnt
];
3302 memcpy (pw_hc1
, pw_buf
, pw_len
);
3304 memset (pw_hc1
+ pw_len
, 0, 256 - pw_len
);
3306 uint pws_cnt
= device_param
->pws_cnt
;
3310 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
3312 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
3314 pw
->pw_len
= pw_len
;
3318 device_param
->pws_cnt
= pws_cnt
;
3319 device_param
->pw_cnt
= pws_cnt
* 1;
3323 pw_cache
->cnt
= cache_cnt
;
3328 static void *thread_monitor (void *p
)
3330 uint runtime_check
= 0;
3331 uint remove_check
= 0;
3332 uint status_check
= 0;
3333 uint hwmon_check
= 0;
3334 uint restore_check
= 0;
3336 uint restore_left
= data
.restore_timer
;
3337 uint remove_left
= data
.remove_timer
;
3338 uint status_left
= data
.status_timer
;
3340 // these variables are mainly used for fan control (AMD only)
3342 int *fan_speed_chgd
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3344 // temperature controller "loopback" values
3346 int *temp_diff_old
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3347 int *temp_diff_sum
= (int *) mycalloc (data
.devices_cnt
, sizeof (int));
3349 int temp_threshold
= 1; // degrees celcius
3351 int fan_speed_min
= 15; // in percentage
3352 int fan_speed_max
= 100;
3354 time_t last_temp_check_time
;
3356 uint sleep_time
= 1;
3363 if (data
.restore_timer
)
3368 if ((data
.remove
== 1) && (data
.hashlist_mode
== HL_MODE_FILE
))
3373 if (data
.status
== 1)
3378 if (data
.gpu_temp_disable
== 0)
3380 time (&last_temp_check_time
);
3385 if ((runtime_check
== 0) && (remove_check
== 0) && (status_check
== 0) && (hwmon_check
== 0) && (restore_check
== 0))
3390 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3392 hc_sleep (sleep_time
);
3394 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3396 if (hwmon_check
== 1)
3398 hc_thread_mutex_lock (mux_adl
);
3400 time_t temp_check_time
;
3402 time (&temp_check_time
);
3404 uint Ta
= temp_check_time
- last_temp_check_time
; // set Ta = sleep_time; is not good enough (see --remove etc)
3406 if (Ta
== 0) Ta
= 1;
3408 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
3410 const int temperature
= hm_get_temperature_with_device_id (i
);
3412 if (temperature
> (int) data
.gpu_temp_abort
)
3414 log_error ("ERROR: Temperature limit on GPU %d reached, aborting...", i
+ 1);
3416 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3421 const int gpu_temp_retain
= data
.gpu_temp_retain
;
3423 if (gpu_temp_retain
) // VENDOR_ID_AMD implied
3425 if (data
.hm_device
[i
].fan_supported
== 1)
3427 int temp_cur
= temperature
;
3429 int temp_diff_new
= gpu_temp_retain
- temp_cur
;
3431 temp_diff_sum
[i
] = temp_diff_sum
[i
] + temp_diff_new
;
3433 // calculate Ta value (time difference in seconds between the last check and this check)
3435 last_temp_check_time
= temp_check_time
;
3441 // PID controller (3-term controller: proportional - Kp, integral - Ki, derivative - Kd)
3443 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
);
3445 if (abs (fan_diff_required
) >= temp_threshold
)
3447 const int fan_speed_cur
= hm_get_fanspeed_with_device_id (i
);
3449 int fan_speed_level
= fan_speed_cur
;
3451 if (fan_speed_chgd
[i
] == 0) fan_speed_level
= temp_cur
;
3453 int fan_speed_new
= fan_speed_level
- fan_diff_required
;
3455 if (fan_speed_new
> fan_speed_max
) fan_speed_new
= fan_speed_max
;
3456 if (fan_speed_new
< fan_speed_min
) fan_speed_new
= fan_speed_min
;
3458 if (fan_speed_new
!= fan_speed_cur
)
3460 int freely_change_fan_speed
= (fan_speed_chgd
[i
] == 1);
3461 int fan_speed_must_change
= (fan_speed_new
> fan_speed_cur
);
3463 if ((freely_change_fan_speed
== 1) || (fan_speed_must_change
== 1))
3465 hm_set_fanspeed_with_device_id_amd (i
, fan_speed_new
);
3467 fan_speed_chgd
[i
] = 1;
3470 temp_diff_old
[i
] = temp_diff_new
;
3477 hc_thread_mutex_unlock (mux_adl
);
3480 if (restore_check
== 1)
3484 if (restore_left
== 0)
3486 if (data
.restore_disable
== 0) cycle_restore ();
3488 restore_left
= data
.restore_timer
;
3492 if ((runtime_check
== 1) && (data
.runtime_start
> 0))
3496 time (&runtime_cur
);
3498 int runtime_left
= data
.runtime_start
+ data
.runtime
- runtime_cur
;
3500 if (runtime_left
<= 0)
3502 if (data
.benchmark
== 0)
3504 if (data
.quiet
== 0) log_info ("\nNOTE: Runtime limit reached, aborting...\n");
3507 if (data
.devices_status
!= STATUS_QUIT
) myabort ();
3511 if (remove_check
== 1)
3515 if (remove_left
== 0)
3517 if (data
.digests_saved
!= data
.digests_done
)
3519 data
.digests_saved
= data
.digests_done
;
3524 remove_left
= data
.remove_timer
;
3528 if (status_check
== 1)
3532 if (status_left
== 0)
3534 hc_thread_mutex_lock (mux_display
);
3536 if (data
.quiet
== 0) clear_prompt ();
3538 if (data
.quiet
== 0) log_info ("");
3542 if (data
.quiet
== 0) log_info ("");
3544 hc_thread_mutex_unlock (mux_display
);
3546 status_left
= data
.status_timer
;
3551 myfree (fan_speed_chgd
);
3553 myfree (temp_diff_old
);
3554 myfree (temp_diff_sum
);
3561 static void *thread_outfile_remove (void *p
)
3563 // some hash-dependent constants
3564 char *outfile_dir
= data
.outfile_check_directory
;
3565 uint dgst_size
= data
.dgst_size
;
3566 uint isSalted
= data
.isSalted
;
3567 uint esalt_size
= data
.esalt_size
;
3568 uint hash_mode
= data
.hash_mode
;
3570 uint outfile_check_timer
= data
.outfile_check_timer
;
3572 char separator
= data
.separator
;
3574 // some hash-dependent functions
3575 int (*sort_by_digest
) (const void *, const void *) = data
.sort_by_digest
;
3576 int (*parse_func
) (char *, uint
, hash_t
*) = data
.parse_func
;
3581 memset (&hash_buf
, 0, sizeof (hash_buf
));
3583 hash_buf
.digest
= mymalloc (dgst_size
);
3585 if (isSalted
) hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
3587 if (esalt_size
) hash_buf
.esalt
= (void *) mymalloc (esalt_size
);
3589 uint digest_buf
[64];
3591 outfile_data_t
*out_info
= NULL
;
3593 char **out_files
= NULL
;
3595 time_t folder_mtime
= 0;
3599 uint check_left
= outfile_check_timer
; // or 1 if we want to check it at startup
3601 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3605 if (data
.devices_status
!= STATUS_RUNNING
) continue;
3609 if (check_left
== 0)
3611 struct stat outfile_check_stat
;
3613 if (stat (outfile_dir
, &outfile_check_stat
) == 0)
3615 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
3619 if (outfile_check_stat
.st_mtime
> folder_mtime
)
3621 char **out_files_new
= scan_directory (outfile_dir
);
3623 int out_cnt_new
= count_dictionaries (out_files_new
);
3625 outfile_data_t
*out_info_new
= NULL
;
3627 if (out_cnt_new
> 0)
3629 out_info_new
= (outfile_data_t
*) mycalloc (out_cnt_new
, sizeof (outfile_data_t
));
3631 for (int i
= 0; i
< out_cnt_new
; i
++)
3633 out_info_new
[i
].file_name
= out_files_new
[i
];
3635 // check if there are files that we have seen/checked before (and not changed)
3637 for (int j
= 0; j
< out_cnt
; j
++)
3639 if (strcmp (out_info
[j
].file_name
, out_info_new
[i
].file_name
) == 0)
3641 struct stat outfile_stat
;
3643 if (stat (out_info_new
[i
].file_name
, &outfile_stat
) == 0)
3645 if (outfile_stat
.st_ctime
== out_info
[j
].ctime
)
3647 out_info_new
[i
].ctime
= out_info
[j
].ctime
;
3648 out_info_new
[i
].seek
= out_info
[j
].seek
;
3656 local_free (out_info
);
3657 local_free (out_files
);
3659 out_files
= out_files_new
;
3660 out_cnt
= out_cnt_new
;
3661 out_info
= out_info_new
;
3663 folder_mtime
= outfile_check_stat
.st_mtime
;
3666 for (int j
= 0; j
< out_cnt
; j
++)
3668 FILE *fp
= fopen (out_info
[j
].file_name
, "rb");
3672 //hc_thread_mutex_lock (mux_display);
3675 struct stat outfile_stat
;
3677 fstat (fileno (fp
), &outfile_stat
);
3681 struct stat64 outfile_stat
;
3683 _fstat64 (fileno (fp
), &outfile_stat
);
3686 if (outfile_stat
.st_ctime
> out_info
[j
].ctime
)
3688 out_info
[j
].ctime
= outfile_stat
.st_ctime
;
3689 out_info
[j
].seek
= 0;
3692 fseek (fp
, out_info
[j
].seek
, SEEK_SET
);
3696 char line_buf
[BUFSIZ
];
3698 memset (line_buf
, 0, BUFSIZ
);
3700 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
3702 if (ptr
== NULL
) break;
3704 int line_len
= strlen (line_buf
);
3706 if (line_len
<= 0) continue;
3708 int iter
= MAX_CUT_TRIES
;
3710 for (uint i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
3712 if (line_buf
[i
] != separator
) continue;
3714 int parser_status
= PARSER_OK
;
3716 if ((hash_mode
!= 2500) && (hash_mode
!= 6800))
3718 parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
3723 if (parser_status
== PARSER_OK
)
3725 for (uint salt_pos
= 0; (found
== 0) && (salt_pos
< data
.salts_cnt
); salt_pos
++)
3727 if (data
.salts_shown
[salt_pos
] == 1) continue;
3729 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
3731 for (uint digest_pos
= 0; (found
== 0) && (digest_pos
< salt_buf
->digests_cnt
); digest_pos
++)
3733 uint idx
= salt_buf
->digests_offset
+ digest_pos
;
3735 if (data
.digests_shown
[idx
] == 1) continue;
3739 if (hash_mode
== 6800)
3741 if (i
== salt_buf
->salt_len
)
3743 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3746 else if (hash_mode
== 2500)
3748 // BSSID : MAC1 : MAC2 (:plain)
3749 if (i
== (salt_buf
->salt_len
+ 1 + 12 + 1 + 12))
3751 cracked
= (memcmp (line_buf
, salt_buf
->salt_buf
, salt_buf
->salt_len
) == 0);
3753 if (!cracked
) continue;
3755 // now compare MAC1 and MAC2 too, since we have this additional info
3756 char *mac1_pos
= line_buf
+ salt_buf
->salt_len
+ 1;
3757 char *mac2_pos
= mac1_pos
+ 12 + 1;
3759 wpa_t
*wpas
= (wpa_t
*) data
.esalts_buf
;
3760 wpa_t
*wpa
= &wpas
[salt_pos
];
3764 char *pke_ptr
= (char *) pke
;
3766 for (uint i
= 0; i
< 25; i
++)
3768 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
3771 unsigned char mac1
[6];
3772 unsigned char mac2
[6];
3774 memcpy (mac1
, pke_ptr
+ 23, 6);
3775 memcpy (mac2
, pke_ptr
+ 29, 6);
3777 // compare hex string(s) vs binary MAC address(es)
3779 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3781 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
3789 if (!cracked
) continue;
3791 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
3793 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
3803 char *digests_buf_ptr
= (char *) data
.digests_buf
;
3805 memcpy (digest_buf
, digests_buf_ptr
+ (data
.salts_buf
[salt_pos
].digests_offset
* dgst_size
) + (digest_pos
* dgst_size
), dgst_size
);
3807 cracked
= (sort_by_digest (digest_buf
, hash_buf
.digest
) == 0);
3814 data
.digests_shown
[idx
] = 1;
3816 data
.digests_done
++;
3818 salt_buf
->digests_done
++;
3820 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
3822 data
.salts_shown
[salt_pos
] = 1;
3826 if (data
.salts_done
== data
.salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
3831 if (data
.devices_status
== STATUS_CRACKED
) break;
3837 if (data
.devices_status
== STATUS_CRACKED
) break;
3842 if (data
.devices_status
== STATUS_CRACKED
) break;
3845 out_info
[j
].seek
= ftell (fp
);
3847 //hc_thread_mutex_unlock (mux_display);
3855 check_left
= outfile_check_timer
;
3859 if (esalt_size
) local_free (hash_buf
.esalt
);
3861 if (isSalted
) local_free (hash_buf
.salt
);
3863 local_free (hash_buf
.digest
);
3865 local_free (out_info
);
3867 local_free (out_files
);
3874 static uint
get_work (hc_device_param_t
*device_param
, const uint64_t max
)
3876 hc_thread_mutex_lock (mux_dispatcher
);
3878 const uint64_t words_cur
= data
.words_cur
;
3879 const uint64_t words_base
= (data
.limit
== 0) ? data
.words_base
: data
.limit
;
3881 device_param
->words_off
= words_cur
;
3883 const uint64_t words_left
= words_base
- words_cur
;
3885 if (data
.gpu_blocks_all
> words_left
)
3887 if (data
.gpu_blocks_div
== 0)
3889 data
.gpu_blocks_div
= find_gpu_blocks_div (words_left
, data
.gpu_blocks_all
);
3893 if (data
.gpu_blocks_div
)
3895 if (device_param
->gpu_blocks
== device_param
->gpu_blocks_user
)
3897 const uint32_t gpu_blocks_new
= (float) device_param
->gpu_blocks
* data
.gpu_blocks_div
;
3898 const uint32_t gpu_power_new
= gpu_blocks_new
;
3900 if (gpu_blocks_new
< device_param
->gpu_blocks
)
3902 device_param
->gpu_blocks
= gpu_blocks_new
;
3903 device_param
->gpu_power
= gpu_power_new
;
3908 const uint gpu_blocks
= device_param
->gpu_blocks
;
3910 uint work
= MIN (words_left
, gpu_blocks
);
3912 work
= MIN (work
, max
);
3914 data
.words_cur
+= work
;
3916 hc_thread_mutex_unlock (mux_dispatcher
);
3921 static void *thread_calc_stdin (void *p
)
3923 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
3925 const uint attack_kern
= data
.attack_kern
;
3927 const uint gpu_blocks
= device_param
->gpu_blocks
;
3929 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
3931 hc_thread_mutex_lock (mux_dispatcher
);
3933 if (feof (stdin
) != 0)
3935 hc_thread_mutex_unlock (mux_dispatcher
);
3942 while (words_cur
< gpu_blocks
)
3946 char *line_buf
= fgets (buf
, sizeof (buf
), stdin
);
3948 if (line_buf
== NULL
) break;
3950 uint line_len
= in_superchop (line_buf
);
3952 line_len
= convert_from_hex (line_buf
, line_len
);
3954 // post-process rule engine
3956 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
3958 char rule_buf_out
[BLOCK_SIZE
];
3960 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
3962 int rule_len_out
= -1;
3964 if (line_len
< BLOCK_SIZE
)
3966 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
3969 if (rule_len_out
< 0) continue;
3971 line_buf
= rule_buf_out
;
3972 line_len
= rule_len_out
;
3975 if (line_len
> PW_MAX
)
3980 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
3982 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
3984 hc_thread_mutex_lock (mux_counter
);
3986 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
3988 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
3991 hc_thread_mutex_unlock (mux_counter
);
3996 else if (attack_kern
== ATTACK_KERN_COMBI
)
3998 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
3999 // since we still need to combine the plains
4001 if (line_len
> data
.pw_max
)
4003 hc_thread_mutex_lock (mux_counter
);
4005 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4007 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4010 hc_thread_mutex_unlock (mux_counter
);
4016 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4020 if (data
.devices_status
== STATUS_CRACKED
) break;
4021 if (data
.devices_status
== STATUS_ABORTED
) break;
4022 if (data
.devices_status
== STATUS_QUIT
) break;
4023 if (data
.devices_status
== STATUS_BYPASS
) break;
4026 hc_thread_mutex_unlock (mux_dispatcher
);
4028 if (data
.devices_status
== STATUS_CRACKED
) break;
4029 if (data
.devices_status
== STATUS_ABORTED
) break;
4030 if (data
.devices_status
== STATUS_QUIT
) break;
4031 if (data
.devices_status
== STATUS_BYPASS
) break;
4033 // we need 2 flushing because we have two independant caches and it can occur
4034 // that one buffer is already at threshold plus for that length also exists
4035 // more data in the 2nd buffer so it would overflow
4040 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4042 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4044 const uint pw_cache_cnt
= pw_cache
->cnt
;
4046 if (pw_cache_cnt
== 0) continue;
4050 uint pws_cnt
= device_param
->pws_cnt
;
4052 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4054 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4056 pw
->pw_len
= pw_len
;
4058 uint pw_cnt
= device_param
->pw_cnt
;
4060 pw_cnt
+= pw_cache_cnt
;
4062 device_param
->pw_cnt
= pw_cnt
;
4066 device_param
->pws_cnt
= pws_cnt
;
4068 if (pws_cnt
== device_param
->gpu_power_user
) break;
4071 const uint pw_cnt
= device_param
->pw_cnt
;
4072 const uint pws_cnt
= device_param
->pws_cnt
;
4076 run_copy (device_param
, pws_cnt
);
4078 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4080 device_param
->pw_cnt
= 0;
4081 device_param
->pws_cnt
= 0;
4088 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4090 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4092 const uint pw_cache_cnt
= pw_cache
->cnt
;
4094 if (pw_cache_cnt
== 0) continue;
4098 uint pws_cnt
= device_param
->pws_cnt
;
4100 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4102 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4104 pw
->pw_len
= pw_len
;
4106 uint pw_cnt
= device_param
->pw_cnt
;
4108 pw_cnt
+= pw_cache_cnt
;
4110 device_param
->pw_cnt
= pw_cnt
;
4114 device_param
->pws_cnt
= pws_cnt
;
4117 const uint pw_cnt
= device_param
->pw_cnt
;
4118 const uint pws_cnt
= device_param
->pws_cnt
;
4122 run_copy (device_param
, pws_cnt
);
4124 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4126 device_param
->pw_cnt
= 0;
4127 device_param
->pws_cnt
= 0;
4135 static void *thread_calc (void *p
)
4137 hc_device_param_t
*device_param
= (hc_device_param_t
*) p
;
4139 const uint attack_mode
= data
.attack_mode
;
4140 const uint attack_kern
= data
.attack_kern
;
4142 if (attack_mode
== ATTACK_MODE_BF
)
4144 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4146 const uint work
= get_work (device_param
, -1);
4148 if (work
== 0) break;
4150 const uint64_t words_off
= device_param
->words_off
;
4151 const uint64_t words_fin
= words_off
+ work
;
4153 const uint pw_cnt
= work
;
4154 const uint pws_cnt
= work
;
4156 device_param
->pw_cnt
= pw_cnt
;
4157 device_param
->pws_cnt
= pws_cnt
;
4161 run_copy (device_param
, pws_cnt
);
4163 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4165 device_param
->pw_cnt
= 0;
4166 device_param
->pws_cnt
= 0;
4169 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4171 if (data
.devices_status
== STATUS_CRACKED
) break;
4172 if (data
.devices_status
== STATUS_ABORTED
) break;
4173 if (data
.devices_status
== STATUS_QUIT
) break;
4174 if (data
.devices_status
== STATUS_BYPASS
) break;
4176 device_param
->words_done
= words_fin
;
4181 const uint segment_size
= data
.segment_size
;
4183 char *dictfile
= data
.dictfile
;
4185 if (attack_mode
== ATTACK_MODE_COMBI
)
4187 if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4189 dictfile
= data
.dictfile2
;
4193 FILE *fd
= fopen (dictfile
, "rb");
4197 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
4202 if (attack_mode
== ATTACK_MODE_COMBI
)
4204 const uint combs_mode
= data
.combs_mode
;
4206 if (combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
4208 const char *dictfilec
= data
.dictfile2
;
4210 FILE *combs_fp
= fopen (dictfilec
, "rb");
4212 if (combs_fp
== NULL
)
4214 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4221 device_param
->combs_fp
= combs_fp
;
4223 else if (combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
4225 const char *dictfilec
= data
.dictfile
;
4227 FILE *combs_fp
= fopen (dictfilec
, "rb");
4229 if (combs_fp
== NULL
)
4231 log_error ("ERROR: %s: %s", dictfilec
, strerror (errno
));
4238 device_param
->combs_fp
= combs_fp
;
4242 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
4244 wl_data
->buf
= (char *) mymalloc (segment_size
);
4245 wl_data
->avail
= segment_size
;
4246 wl_data
->incr
= segment_size
;
4250 uint64_t words_cur
= 0;
4252 while ((data
.devices_status
!= STATUS_EXHAUSTED
) && (data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
4254 uint64_t words_off
= 0;
4255 uint64_t words_fin
= 0;
4261 const uint work
= get_work (device_param
, max
);
4263 if (work
== 0) break;
4265 words_off
= device_param
->words_off
;
4266 words_fin
= words_off
+ work
;
4271 for ( ; words_cur
< words_off
; words_cur
++) get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4275 for ( ; words_cur
< words_fin
; words_cur
++)
4277 get_next_word (wl_data
, fd
, &line_buf
, &line_len
);
4279 line_len
= convert_from_hex (line_buf
, line_len
);
4281 // post-process rule engine
4283 if (run_rule_engine (data
.rule_len_l
, data
.rule_buf_l
))
4285 char rule_buf_out
[BLOCK_SIZE
];
4287 memset (rule_buf_out
, 0, sizeof (rule_buf_out
));
4289 int rule_len_out
= -1;
4291 if (line_len
< BLOCK_SIZE
)
4293 rule_len_out
= _old_apply_rule (data
.rule_buf_l
, data
.rule_len_l
, line_buf
, line_len
, rule_buf_out
);
4296 if (rule_len_out
< 0) continue;
4298 line_buf
= rule_buf_out
;
4299 line_len
= rule_len_out
;
4302 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
4304 if ((line_len
< data
.pw_min
) || (line_len
> data
.pw_max
))
4308 hc_thread_mutex_lock (mux_counter
);
4310 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4312 data
.words_progress_rejected
[salt_pos
] += data
.gpu_rules_cnt
;
4315 hc_thread_mutex_unlock (mux_counter
);
4320 else if (attack_kern
== ATTACK_KERN_COMBI
)
4322 // do not check if minimum restriction is satisfied (line_len >= data.pw_min) here
4323 // since we still need to combine the plains
4325 if (line_len
> data
.pw_max
)
4329 hc_thread_mutex_lock (mux_counter
);
4331 for (uint salt_pos
= 0; salt_pos
< data
.salts_cnt
; salt_pos
++)
4333 data
.words_progress_rejected
[salt_pos
] += data
.combs_cnt
;
4336 hc_thread_mutex_unlock (mux_counter
);
4342 device_param
->pw_add (device_param
, (uint8_t *) line_buf
, line_len
);
4344 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4346 if (data
.devices_status
== STATUS_CRACKED
) break;
4347 if (data
.devices_status
== STATUS_ABORTED
) break;
4348 if (data
.devices_status
== STATUS_QUIT
) break;
4349 if (data
.devices_status
== STATUS_BYPASS
) break;
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;
4360 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4362 if (data
.devices_status
== STATUS_CRACKED
) break;
4363 if (data
.devices_status
== STATUS_ABORTED
) break;
4364 if (data
.devices_status
== STATUS_QUIT
) break;
4365 if (data
.devices_status
== STATUS_BYPASS
) break;
4367 // we need 2 flushing because we have two independant caches and it can occur
4368 // that one buffer is already at threshold plus for that length also exists
4369 // more data in the 2nd buffer so it would overflow
4376 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4378 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4380 const uint pw_cache_cnt
= pw_cache
->cnt
;
4382 if (pw_cache_cnt
== 0) continue;
4386 uint pws_cnt
= device_param
->pws_cnt
;
4388 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4390 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4392 pw
->pw_len
= pw_len
;
4394 uint pw_cnt
= device_param
->pw_cnt
;
4396 pw_cnt
+= pw_cache_cnt
;
4398 device_param
->pw_cnt
= pw_cnt
;
4402 device_param
->pws_cnt
= pws_cnt
;
4404 if (pws_cnt
== device_param
->gpu_power_user
) break;
4407 const uint pw_cnt
= device_param
->pw_cnt
;
4408 const uint pws_cnt
= device_param
->pws_cnt
;
4412 run_copy (device_param
, pws_cnt
);
4414 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4416 device_param
->pw_cnt
= 0;
4417 device_param
->pws_cnt
= 0;
4420 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4422 if (data
.devices_status
== STATUS_CRACKED
) break;
4423 if (data
.devices_status
== STATUS_ABORTED
) break;
4424 if (data
.devices_status
== STATUS_QUIT
) break;
4425 if (data
.devices_status
== STATUS_BYPASS
) break;
4433 for (int pw_len
= 0; pw_len
< PW_MAX1
; pw_len
++)
4435 pw_cache_t
*pw_cache
= &device_param
->pw_caches
[pw_len
];
4437 const uint pw_cache_cnt
= pw_cache
->cnt
;
4439 if (pw_cache_cnt
== 0) continue;
4443 uint pws_cnt
= device_param
->pws_cnt
;
4445 pw_t
*pw
= device_param
->pws_buf
+ pws_cnt
;
4447 device_param
->pw_transpose (&pw_cache
->pw_buf
, pw
);
4449 pw
->pw_len
= pw_len
;
4451 uint pw_cnt
= device_param
->pw_cnt
;
4453 pw_cnt
+= pw_cache_cnt
;
4455 device_param
->pw_cnt
= pw_cnt
;
4459 device_param
->pws_cnt
= pws_cnt
;
4462 const uint pw_cnt
= device_param
->pw_cnt
;
4463 const uint pws_cnt
= device_param
->pws_cnt
;
4467 run_copy (device_param
, pws_cnt
);
4469 run_cracker (device_param
, pw_cnt
, pws_cnt
);
4471 device_param
->pw_cnt
= 0;
4472 device_param
->pws_cnt
= 0;
4475 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
4477 if (data
.devices_status
== STATUS_CRACKED
) break;
4478 if (data
.devices_status
== STATUS_ABORTED
) break;
4479 if (data
.devices_status
== STATUS_QUIT
) break;
4480 if (data
.devices_status
== STATUS_BYPASS
) break;
4483 if (words_fin
== 0) break;
4485 device_param
->words_done
= words_fin
;
4488 if (attack_mode
== ATTACK_MODE_COMBI
)
4490 fclose (device_param
->combs_fp
);
4493 free (wl_data
->buf
);
4502 static void weak_hash_check (hc_device_param_t
*device_param
, const uint salt_pos
, const uint gpu_loops
)
4504 salt_t
*salt_buf
= &data
.salts_buf
[salt_pos
];
4506 device_param
->kernel_params_buf32
[24] = salt_pos
;
4507 device_param
->kernel_params_buf32
[27] = 1;
4508 device_param
->kernel_params_buf32
[28] = salt_buf
->digests_cnt
;
4509 device_param
->kernel_params_buf32
[29] = salt_buf
->digests_offset
;
4510 device_param
->kernel_params_buf32
[30] = 0;
4511 device_param
->kernel_params_buf32
[31] = 1;
4513 char *dictfile_old
= data
.dictfile
;
4514 char *dictfile2_old
= data
.dictfile2
;
4515 char *mask_old
= data
.mask
;
4517 const char *weak_hash_check
= "weak-hash-check";
4519 data
.dictfile
= (char *) weak_hash_check
;
4520 data
.dictfile2
= (char *) weak_hash_check
;
4521 data
.mask
= (char *) weak_hash_check
;
4527 if (data
.attack_exec
== ATTACK_EXEC_ON_GPU
)
4529 run_kernel (KERN_RUN_1
, device_param
, 1);
4533 run_kernel (KERN_RUN_1
, device_param
, 1);
4535 const uint iter
= salt_buf
->salt_iter
;
4537 for (uint loop_pos
= 0; loop_pos
< iter
; loop_pos
+= gpu_loops
)
4539 uint loop_left
= iter
- loop_pos
;
4541 loop_left
= MIN (loop_left
, gpu_loops
);
4543 device_param
->kernel_params_buf32
[25] = loop_pos
;
4544 device_param
->kernel_params_buf32
[26] = loop_left
;
4546 run_kernel (KERN_RUN_2
, device_param
, 1);
4549 run_kernel (KERN_RUN_3
, device_param
, 1);
4556 check_cracked (device_param
, salt_pos
);
4562 device_param
->kernel_params_buf32
[24] = 0;
4563 device_param
->kernel_params_buf32
[25] = 0;
4564 device_param
->kernel_params_buf32
[26] = 0;
4565 device_param
->kernel_params_buf32
[27] = 0;
4566 device_param
->kernel_params_buf32
[28] = 0;
4567 device_param
->kernel_params_buf32
[29] = 0;
4568 device_param
->kernel_params_buf32
[30] = 0;
4569 device_param
->kernel_params_buf32
[31] = 0;
4571 data
.dictfile
= dictfile_old
;
4572 data
.dictfile2
= dictfile2_old
;
4573 data
.mask
= mask_old
;
4578 static void hlfmt_hash_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4580 if (data
.username
== 0)
4582 *hashbuf_pos
= line_buf
;
4583 *hashbuf_len
= line_len
;
4587 char *pos
= line_buf
;
4590 for (int i
= 0; i
< line_len
; i
++, pos
++, len
--)
4592 if (line_buf
[i
] == data
.separator
)
4607 static void hlfmt_user_hashcat (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4614 for (int i
= 0; i
< line_len
; i
++)
4616 if (line_buf
[i
] == data
.separator
)
4625 if (pos
== NULL
) pos
= line_buf
+ i
;
4637 static int hlfmt_detect_pwdump (char line_buf
[BUFSIZ
], int line_len
)
4644 for (int i
= 0; i
< line_len
; i
++)
4646 if (line_buf
[i
] == ':')
4653 if (sep_cnt
== 2) sep2_len
++;
4654 if (sep_cnt
== 3) sep3_len
++;
4657 if ((sep_cnt
== 6) && ((sep2_len
== 32) || (sep3_len
== 32))) return 1;
4662 static void hlfmt_hash_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4669 for (int i
= 0; i
< line_len
; i
++)
4671 if (line_buf
[i
] == ':')
4678 if (data
.hash_mode
== 1000)
4682 if (pos
== NULL
) pos
= line_buf
+ i
;
4687 else if (data
.hash_mode
== 3000)
4691 if (pos
== NULL
) pos
= line_buf
+ i
;
4702 static void hlfmt_user_pwdump (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4709 for (int i
= 0; i
< line_len
; i
++)
4711 if (line_buf
[i
] == ':')
4720 if (pos
== NULL
) pos
= line_buf
+ i
;
4732 static int hlfmt_detect_passwd (char line_buf
[BUFSIZ
], int line_len
)
4736 char sep5_first
= 0;
4737 char sep6_first
= 0;
4739 for (int i
= 0; i
< line_len
; i
++)
4741 if (line_buf
[i
] == ':')
4748 if (sep_cnt
== 5) if (sep5_first
== 0) sep5_first
= line_buf
[i
];
4749 if (sep_cnt
== 6) if (sep6_first
== 0) sep6_first
= line_buf
[i
];
4752 if ((sep_cnt
== 6) && ((sep5_first
== '/') || (sep6_first
== '/'))) return 1;
4757 static void hlfmt_hash_passwd (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4764 for (int i
= 0; i
< line_len
; i
++)
4766 if (line_buf
[i
] == ':')
4775 if (pos
== NULL
) pos
= line_buf
+ i
;
4785 static void hlfmt_user_passwd (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4792 for (int i
= 0; i
< line_len
; i
++)
4794 if (line_buf
[i
] == ':')
4803 if (pos
== NULL
) pos
= line_buf
+ i
;
4815 static int hlfmt_detect_shadow (char line_buf
[BUFSIZ
], int line_len
)
4819 for (int i
= 0; i
< line_len
; i
++)
4821 if (line_buf
[i
] == ':') sep_cnt
++;
4824 if (sep_cnt
== 8) return 1;
4829 static void hlfmt_hash_shadow (char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4831 hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
);
4834 static void hlfmt_user_shadow (char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4836 hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
);
4841 static void hlfmt_hash (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **hashbuf_pos
, int *hashbuf_len
)
4843 switch (hashfile_format
)
4845 case HLFMT_HASHCAT
: hlfmt_hash_hashcat (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4846 case HLFMT_PWDUMP
: hlfmt_hash_pwdump (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4847 case HLFMT_PASSWD
: hlfmt_hash_passwd (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4848 case HLFMT_SHADOW
: hlfmt_hash_shadow (line_buf
, line_len
, hashbuf_pos
, hashbuf_len
); break;
4852 static void hlfmt_user (uint hashfile_format
, char line_buf
[BUFSIZ
], int line_len
, char **userbuf_pos
, int *userbuf_len
)
4854 switch (hashfile_format
)
4856 case HLFMT_HASHCAT
: hlfmt_user_hashcat (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4857 case HLFMT_PWDUMP
: hlfmt_user_pwdump (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4858 case HLFMT_PASSWD
: hlfmt_user_passwd (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4859 case HLFMT_SHADOW
: hlfmt_user_shadow (line_buf
, line_len
, userbuf_pos
, userbuf_len
); break;
4863 static uint
hlfmt_detect (FILE *fp
, uint max_check
)
4865 // Exception: those formats are wrongly detected as HLFMT_SHADOW, prevent it
4867 if (data
.hash_mode
== 5300) return HLFMT_HASHCAT
;
4868 if (data
.hash_mode
== 5400) return HLFMT_HASHCAT
;
4870 uint
*formats_cnt
= (uint
*) mycalloc (HLFMTS_CNT
, sizeof (uint
));
4876 char line_buf
[BUFSIZ
];
4878 int line_len
= fgetl (fp
, line_buf
);
4880 if (line_len
== 0) continue;
4882 if (hlfmt_detect_pwdump (line_buf
, line_len
)) formats_cnt
[HLFMT_PWDUMP
]++;
4883 if (hlfmt_detect_passwd (line_buf
, line_len
)) formats_cnt
[HLFMT_PASSWD
]++;
4884 if (hlfmt_detect_shadow (line_buf
, line_len
)) formats_cnt
[HLFMT_SHADOW
]++;
4886 if (num_check
== max_check
) break;
4891 uint hashlist_format
= HLFMT_HASHCAT
;
4893 for (int i
= 1; i
< HLFMTS_CNT
; i
++)
4895 if (formats_cnt
[i
- 1] >= formats_cnt
[i
]) continue;
4897 hashlist_format
= i
;
4902 return hashlist_format
;
4906 * some further helper function
4909 // wrapper around mymalloc for ADL
4911 void *__stdcall
ADL_Main_Memory_Alloc (const int iSize
)
4913 return mymalloc (iSize
);
4916 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
)
4918 uint64_t collisions
= 0;
4920 const uint dgst_pos0
= data
.dgst_pos0
;
4921 const uint dgst_pos1
= data
.dgst_pos1
;
4922 const uint dgst_pos2
= data
.dgst_pos2
;
4923 const uint dgst_pos3
= data
.dgst_pos3
;
4925 memset (bitmap_a
, 0, bitmap_size
);
4926 memset (bitmap_b
, 0, bitmap_size
);
4927 memset (bitmap_c
, 0, bitmap_size
);
4928 memset (bitmap_d
, 0, bitmap_size
);
4930 for (uint i
= 0; i
< digests_cnt
; i
++)
4932 uint
*digest_ptr
= (uint
*) digests_buf_ptr
;
4934 digests_buf_ptr
+= dgst_size
;
4936 const uint val0
= 1 << (digest_ptr
[dgst_pos0
] & 0x1f);
4937 const uint val1
= 1 << (digest_ptr
[dgst_pos1
] & 0x1f);
4938 const uint val2
= 1 << (digest_ptr
[dgst_pos2
] & 0x1f);
4939 const uint val3
= 1 << (digest_ptr
[dgst_pos3
] & 0x1f);
4941 const uint idx0
= (digest_ptr
[dgst_pos0
] >> dgst_shifts
) & bitmap_mask
;
4942 const uint idx1
= (digest_ptr
[dgst_pos1
] >> dgst_shifts
) & bitmap_mask
;
4943 const uint idx2
= (digest_ptr
[dgst_pos2
] >> dgst_shifts
) & bitmap_mask
;
4944 const uint idx3
= (digest_ptr
[dgst_pos3
] >> dgst_shifts
) & bitmap_mask
;
4946 if (bitmap_a
[idx0
] & val0
) collisions
++;
4947 if (bitmap_b
[idx1
] & val1
) collisions
++;
4948 if (bitmap_c
[idx2
] & val2
) collisions
++;
4949 if (bitmap_d
[idx3
] & val3
) collisions
++;
4951 bitmap_a
[idx0
] |= val0
;
4952 bitmap_b
[idx1
] |= val1
;
4953 bitmap_c
[idx2
] |= val2
;
4954 bitmap_d
[idx3
] |= val3
;
4956 if (collisions
>= collisions_max
) return 0x7fffffff;
4966 int main (int argc
, char **argv
)
4969 * To help users a bit
4972 char *compute
= getenv ("COMPUTE");
4978 snprintf (display
, sizeof (display
) - 1, "DISPLAY=%s", compute
);
4984 if (getenv ("DISPLAY") == NULL
)
4985 putenv ((char *) "DISPLAY=:0");
4989 if (getenv ("GPU_MAX_ALLOC_PERCENT") == NULL)
4990 putenv ((char *) "GPU_MAX_ALLOC_PERCENT=100");
4992 if (getenv ("GPU_USE_SYNC_OBJECTS") == NULL)
4993 putenv ((char *) "GPU_USE_SYNC_OBJECTS=1");
5000 memset (&data
, 0, sizeof (hc_global_data_t
));
5006 data
.proc_start
= proc_start
;
5009 char **myargv
= argv
;
5011 hc_thread_mutex_init (mux_dispatcher
);
5012 hc_thread_mutex_init (mux_counter
);
5013 hc_thread_mutex_init (mux_display
);
5014 hc_thread_mutex_init (mux_adl
);
5017 * commandline parameters
5021 uint version
= VERSION
;
5023 uint benchmark
= BENCHMARK
;
5024 uint benchmark_mode
= BENCHMARK_MODE
;
5027 uint username
= USERNAME
;
5028 uint remove
= REMOVE
;
5029 uint remove_timer
= REMOVE_TIMER
;
5030 uint64_t skip
= SKIP
;
5031 uint64_t limit
= LIMIT
;
5032 uint keyspace
= KEYSPACE
;
5033 uint potfile_disable
= POTFILE_DISABLE
;
5034 uint debug_mode
= DEBUG_MODE
;
5035 char *debug_file
= NULL
;
5036 char *induction_dir
= NULL
;
5037 char *outfile_check_dir
= NULL
;
5039 uint runtime
= RUNTIME
;
5040 uint hash_mode
= HASH_MODE
;
5041 uint attack_mode
= ATTACK_MODE
;
5042 uint markov_disable
= MARKOV_DISABLE
;
5043 uint markov_classic
= MARKOV_CLASSIC
;
5044 uint markov_threshold
= MARKOV_THRESHOLD
;
5045 char *markov_hcstat
= NULL
;
5046 char *outfile
= NULL
;
5047 uint outfile_format
= OUTFILE_FORMAT
;
5048 uint outfile_autohex
= OUTFILE_AUTOHEX
;
5049 uint outfile_check_timer
= OUTFILE_CHECK_TIMER
;
5050 uint restore
= RESTORE
;
5051 uint restore_timer
= RESTORE_TIMER
;
5052 uint restore_disable
= RESTORE_DISABLE
;
5053 uint status
= STATUS
;
5054 uint status_timer
= STATUS_TIMER
;
5055 uint status_automat
= STATUS_AUTOMAT
;
5056 uint loopback
= LOOPBACK
;
5057 uint weak_hash_threshold
= WEAK_HASH_THRESHOLD
;
5058 char *session
= NULL
;
5059 uint hex_charset
= HEX_CHARSET
;
5060 uint hex_salt
= HEX_SALT
;
5061 uint hex_wordlist
= HEX_WORDLIST
;
5062 uint rp_gen
= RP_GEN
;
5063 uint rp_gen_func_min
= RP_GEN_FUNC_MIN
;
5064 uint rp_gen_func_max
= RP_GEN_FUNC_MAX
;
5065 uint rp_gen_seed
= RP_GEN_SEED
;
5066 char *rule_buf_l
= (char *) RULE_BUF_L
;
5067 char *rule_buf_r
= (char *) RULE_BUF_R
;
5068 uint increment
= INCREMENT
;
5069 uint increment_min
= INCREMENT_MIN
;
5070 uint increment_max
= INCREMENT_MAX
;
5071 char *cpu_affinity
= NULL
;
5072 char *gpu_devices
= NULL
;
5073 char *truecrypt_keyfiles
= NULL
;
5074 uint workload_profile
= WORKLOAD_PROFILE
;
5075 uint gpu_accel
= GPU_ACCEL
;
5076 uint gpu_loops
= GPU_LOOPS
;
5077 uint gpu_temp_disable
= GPU_TEMP_DISABLE
;
5078 uint gpu_temp_abort
= GPU_TEMP_ABORT
;
5079 uint gpu_temp_retain
= GPU_TEMP_RETAIN
;
5080 uint powertune_enable
= POWERTUNE_ENABLE
;
5081 uint logfile_disable
= LOGFILE_DISABLE
;
5082 uint segment_size
= SEGMENT_SIZE
;
5083 uint scrypt_tmto
= SCRYPT_TMTO
;
5084 char separator
= SEPARATOR
;
5085 uint bitmap_min
= BITMAP_MIN
;
5086 uint bitmap_max
= BITMAP_MAX
;
5087 char *custom_charset_1
= NULL
;
5088 char *custom_charset_2
= NULL
;
5089 char *custom_charset_3
= NULL
;
5090 char *custom_charset_4
= NULL
;
5092 #define IDX_HELP 'h'
5093 #define IDX_VERSION 'V'
5094 #define IDX_VERSION_LOWER 'v'
5095 #define IDX_QUIET 0xff02
5096 #define IDX_SHOW 0xff03
5097 #define IDX_LEFT 0xff04
5098 #define IDX_REMOVE 0xff05
5099 #define IDX_REMOVE_TIMER 0xff37
5100 #define IDX_SKIP 's'
5101 #define IDX_LIMIT 'l'
5102 #define IDX_KEYSPACE 0xff35
5103 #define IDX_POTFILE_DISABLE 0xff06
5104 #define IDX_DEBUG_MODE 0xff43
5105 #define IDX_DEBUG_FILE 0xff44
5106 #define IDX_INDUCTION_DIR 0xff46
5107 #define IDX_OUTFILE_CHECK_DIR 0xff47
5108 #define IDX_USERNAME 0xff07
5109 #define IDX_FORCE 0xff08
5110 #define IDX_RUNTIME 0xff09
5111 #define IDX_BENCHMARK 'b'
5112 #define IDX_BENCHMARK_MODE 0xff32
5113 #define IDX_HASH_MODE 'm'
5114 #define IDX_ATTACK_MODE 'a'
5115 #define IDX_RP_FILE 'r'
5116 #define IDX_RP_GEN 'g'
5117 #define IDX_RP_GEN_FUNC_MIN 0xff10
5118 #define IDX_RP_GEN_FUNC_MAX 0xff11
5119 #define IDX_RP_GEN_SEED 0xff34
5120 #define IDX_RULE_BUF_L 'j'
5121 #define IDX_RULE_BUF_R 'k'
5122 #define IDX_INCREMENT 'i'
5123 #define IDX_INCREMENT_MIN 0xff12
5124 #define IDX_INCREMENT_MAX 0xff13
5125 #define IDX_OUTFILE 'o'
5126 #define IDX_OUTFILE_FORMAT 0xff14
5127 #define IDX_OUTFILE_AUTOHEX_DISABLE 0xff39
5128 #define IDX_OUTFILE_CHECK_TIMER 0xff45
5129 #define IDX_RESTORE 0xff15
5130 #define IDX_RESTORE_DISABLE 0xff27
5131 #define IDX_STATUS 0xff17
5132 #define IDX_STATUS_TIMER 0xff18
5133 #define IDX_STATUS_AUTOMAT 0xff50
5134 #define IDX_LOOPBACK 0xff38
5135 #define IDX_WEAK_HASH_THRESHOLD 0xff42
5136 #define IDX_SESSION 0xff19
5137 #define IDX_HEX_CHARSET 0xff20
5138 #define IDX_HEX_SALT 0xff21
5139 #define IDX_HEX_WORDLIST 0xff40
5140 #define IDX_MARKOV_DISABLE 0xff22
5141 #define IDX_MARKOV_CLASSIC 0xff23
5142 #define IDX_MARKOV_THRESHOLD 't'
5143 #define IDX_MARKOV_HCSTAT 0xff24
5144 #define IDX_CPU_AFFINITY 0xff25
5145 #define IDX_GPU_DEVICES 'd'
5146 #define IDX_WORKLOAD_PROFILE 'w'
5147 #define IDX_GPU_ACCEL 'n'
5148 #define IDX_GPU_LOOPS 'u'
5149 #define IDX_GPU_TEMP_DISABLE 0xff29
5150 #define IDX_GPU_TEMP_ABORT 0xff30
5151 #define IDX_GPU_TEMP_RETAIN 0xff31
5152 #define IDX_POWERTUNE_ENABLE 0xff41
5153 #define IDX_LOGFILE_DISABLE 0xff51
5154 #define IDX_TRUECRYPT_KEYFILES 0xff52
5155 #define IDX_SCRYPT_TMTO 0xff61
5156 #define IDX_SEGMENT_SIZE 'c'
5157 #define IDX_SEPARATOR 'p'
5158 #define IDX_BITMAP_MIN 0xff70
5159 #define IDX_BITMAP_MAX 0xff71
5160 #define IDX_CUSTOM_CHARSET_1 '1'
5161 #define IDX_CUSTOM_CHARSET_2 '2'
5162 #define IDX_CUSTOM_CHARSET_3 '3'
5163 #define IDX_CUSTOM_CHARSET_4 '4'
5165 char short_options
[] = "hVvm:a:r:j:k:g:o:t:d:n:u:c:p:s:l:1:2:3:4:ibw:";
5167 struct option long_options
[] =
5169 {"help", no_argument
, 0, IDX_HELP
},
5170 {"version", no_argument
, 0, IDX_VERSION
},
5171 {"quiet", no_argument
, 0, IDX_QUIET
},
5172 {"show", no_argument
, 0, IDX_SHOW
},
5173 {"left", no_argument
, 0, IDX_LEFT
},
5174 {"username", no_argument
, 0, IDX_USERNAME
},
5175 {"remove", no_argument
, 0, IDX_REMOVE
},
5176 {"remove-timer", required_argument
, 0, IDX_REMOVE_TIMER
},
5177 {"skip", required_argument
, 0, IDX_SKIP
},
5178 {"limit", required_argument
, 0, IDX_LIMIT
},
5179 {"keyspace", no_argument
, 0, IDX_KEYSPACE
},
5180 {"potfile-disable", no_argument
, 0, IDX_POTFILE_DISABLE
},
5181 {"debug-mode", required_argument
, 0, IDX_DEBUG_MODE
},
5182 {"debug-file", required_argument
, 0, IDX_DEBUG_FILE
},
5183 {"induction-dir", required_argument
, 0, IDX_INDUCTION_DIR
},
5184 {"outfile-check-dir", required_argument
, 0, IDX_OUTFILE_CHECK_DIR
},
5185 {"force", no_argument
, 0, IDX_FORCE
},
5186 {"benchmark", no_argument
, 0, IDX_BENCHMARK
},
5187 {"benchmark-mode", required_argument
, 0, IDX_BENCHMARK_MODE
},
5188 {"restore", no_argument
, 0, IDX_RESTORE
},
5189 {"restore-disable", no_argument
, 0, IDX_RESTORE_DISABLE
},
5190 {"status", no_argument
, 0, IDX_STATUS
},
5191 {"status-timer", required_argument
, 0, IDX_STATUS_TIMER
},
5192 {"status-automat", no_argument
, 0, IDX_STATUS_AUTOMAT
},
5193 {"loopback", no_argument
, 0, IDX_LOOPBACK
},
5194 {"weak-hash-threshold",
5195 required_argument
, 0, IDX_WEAK_HASH_THRESHOLD
},
5196 {"session", required_argument
, 0, IDX_SESSION
},
5197 {"runtime", required_argument
, 0, IDX_RUNTIME
},
5198 {"generate-rules", required_argument
, 0, IDX_RP_GEN
},
5199 {"generate-rules-func-min",
5200 required_argument
, 0, IDX_RP_GEN_FUNC_MIN
},
5201 {"generate-rules-func-max",
5202 required_argument
, 0, IDX_RP_GEN_FUNC_MAX
},
5203 {"generate-rules-seed",
5204 required_argument
, 0, IDX_RP_GEN_SEED
},
5205 {"rule-left", required_argument
, 0, IDX_RULE_BUF_L
},
5206 {"rule-right", required_argument
, 0, IDX_RULE_BUF_R
},
5207 {"hash-type", required_argument
, 0, IDX_HASH_MODE
},
5208 {"attack-mode", required_argument
, 0, IDX_ATTACK_MODE
},
5209 {"rules-file", required_argument
, 0, IDX_RP_FILE
},
5210 {"outfile", required_argument
, 0, IDX_OUTFILE
},
5211 {"outfile-format", required_argument
, 0, IDX_OUTFILE_FORMAT
},
5212 {"outfile-autohex-disable",
5213 no_argument
, 0, IDX_OUTFILE_AUTOHEX_DISABLE
},
5214 {"outfile-check-timer",
5215 required_argument
, 0, IDX_OUTFILE_CHECK_TIMER
},
5216 {"hex-charset", no_argument
, 0, IDX_HEX_CHARSET
},
5217 {"hex-salt", no_argument
, 0, IDX_HEX_SALT
},
5218 {"hex-wordlist", no_argument
, 0, IDX_HEX_WORDLIST
},
5219 {"markov-disable", no_argument
, 0, IDX_MARKOV_DISABLE
},
5220 {"markov-classic", no_argument
, 0, IDX_MARKOV_CLASSIC
},
5221 {"markov-threshold", required_argument
, 0, IDX_MARKOV_THRESHOLD
},
5222 {"markov-hcstat", required_argument
, 0, IDX_MARKOV_HCSTAT
},
5223 {"cpu-affinity", required_argument
, 0, IDX_CPU_AFFINITY
},
5224 {"gpu-devices", required_argument
, 0, IDX_GPU_DEVICES
},
5225 {"workload-profile", required_argument
, 0, IDX_WORKLOAD_PROFILE
},
5226 {"gpu-accel", required_argument
, 0, IDX_GPU_ACCEL
},
5227 {"gpu-loops", required_argument
, 0, IDX_GPU_LOOPS
},
5228 {"gpu-temp-disable", no_argument
, 0, IDX_GPU_TEMP_DISABLE
},
5229 {"gpu-temp-abort", required_argument
, 0, IDX_GPU_TEMP_ABORT
},
5230 {"gpu-temp-retain", required_argument
, 0, IDX_GPU_TEMP_RETAIN
},
5231 {"powertune-enable", no_argument
, 0, IDX_POWERTUNE_ENABLE
},
5232 {"logfile-disable", no_argument
, 0, IDX_LOGFILE_DISABLE
},
5233 {"truecrypt-keyfiles", required_argument
, 0, IDX_TRUECRYPT_KEYFILES
},
5234 {"segment-size", required_argument
, 0, IDX_SEGMENT_SIZE
},
5235 {"scrypt-tmto", required_argument
, 0, IDX_SCRYPT_TMTO
},
5237 {"seperator", required_argument
, 0, IDX_SEPARATOR
},
5238 {"separator", required_argument
, 0, IDX_SEPARATOR
},
5239 {"bitmap-min", required_argument
, 0, IDX_BITMAP_MIN
},
5240 {"bitmap-max", required_argument
, 0, IDX_BITMAP_MAX
},
5241 {"increment", no_argument
, 0, IDX_INCREMENT
},
5242 {"increment-min", required_argument
, 0, IDX_INCREMENT_MIN
},
5243 {"increment-max", required_argument
, 0, IDX_INCREMENT_MAX
},
5244 {"custom-charset1", required_argument
, 0, IDX_CUSTOM_CHARSET_1
},
5245 {"custom-charset2", required_argument
, 0, IDX_CUSTOM_CHARSET_2
},
5246 {"custom-charset3", required_argument
, 0, IDX_CUSTOM_CHARSET_3
},
5247 {"custom-charset4", required_argument
, 0, IDX_CUSTOM_CHARSET_4
},
5252 uint rp_files_cnt
= 0;
5254 char **rp_files
= (char **) mycalloc (argc
, sizeof (char *));
5263 while (((c
= getopt_long (argc
, argv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5267 case IDX_HELP
: usage
= 1; break;
5269 case IDX_VERSION_LOWER
: version
= 1; break;
5270 case IDX_RESTORE
: restore
= 1; break;
5271 case IDX_SESSION
: session
= optarg
; break;
5272 case IDX_SHOW
: show
= 1; break;
5273 case IDX_LEFT
: left
= 1; break;
5274 case '?': return (-1);
5280 log_error ("ERROR: Invalid argument specified");
5291 log_info (VERSION_TXT
);
5298 usage_big_print (PROGNAME
);
5307 if (session
== NULL
) session
= (char *) PROGNAME
;
5309 size_t session_size
= strlen (session
) + 32;
5311 data
.session
= session
;
5313 char *eff_restore_file
= (char *) mymalloc (session_size
);
5314 char *new_restore_file
= (char *) mymalloc (session_size
);
5316 snprintf (eff_restore_file
, session_size
- 1, "%s.restore", session
);
5317 snprintf (new_restore_file
, session_size
- 1, "%s.restore.new", session
);
5319 data
.eff_restore_file
= eff_restore_file
;
5320 data
.new_restore_file
= new_restore_file
;
5322 if (((show
== 1) || (left
== 1)) && (restore
== 1))
5324 if (show
== 1) log_error ("ERROR: Mixing --restore parameter and --show is not supported");
5325 else log_error ("ERROR: Mixing --restore parameter and --left is not supported");
5330 // this allows the user to use --show and --left while cracking (i.e. while another instance of oclHashcat is running)
5331 if ((show
== 1) || (left
== 1))
5333 restore_disable
= 1;
5338 data
.restore_disable
= restore_disable
;
5340 restore_data_t
*rd
= init_restore (argc
, argv
);
5350 read_restore (eff_restore_file
, rd
);
5352 if (rd
->version_bin
< RESTORE_MIN
)
5354 log_error ("ERROR: Incompatible restore-file version");
5363 rd
->pid
= getpid ();
5365 rd
->pid
= GetCurrentProcessId ();
5369 uint hash_mode_chgd
= 0;
5370 uint runtime_chgd
= 0;
5371 uint gpu_loops_chgd
= 0;
5372 uint gpu_accel_chgd
= 0;
5373 uint attack_mode_chgd
= 0;
5374 uint outfile_format_chgd
= 0;
5375 uint rp_gen_seed_chgd
= 0;
5376 uint remove_timer_chgd
= 0;
5377 uint increment_min_chgd
= 0;
5378 uint increment_max_chgd
= 0;
5379 uint gpu_temp_abort_chgd
= 0;
5380 uint gpu_temp_retain_chgd
= 0;
5386 while (((c
= getopt_long (myargc
, myargv
, short_options
, long_options
, &option_index
)) != -1) && optopt
== 0)
5390 //case IDX_HELP: usage = 1; break;
5391 //case IDX_VERSION: version = 1; break;
5392 //case IDX_RESTORE: restore = 1; break;
5393 case IDX_QUIET
: quiet
= 1; break;
5394 //case IDX_SHOW: show = 1; break;
5395 case IDX_SHOW
: break;
5396 //case IDX_LEFT: left = 1; break;
5397 case IDX_LEFT
: break;
5398 case IDX_USERNAME
: username
= 1; break;
5399 case IDX_REMOVE
: remove
= 1; break;
5400 case IDX_REMOVE_TIMER
: remove_timer
= atoi (optarg
);
5401 remove_timer_chgd
= 1; break;
5402 case IDX_POTFILE_DISABLE
: potfile_disable
= 1; break;
5403 case IDX_DEBUG_MODE
: debug_mode
= atoi (optarg
); break;
5404 case IDX_DEBUG_FILE
: debug_file
= optarg
; break;
5405 case IDX_INDUCTION_DIR
: induction_dir
= optarg
; break;
5406 case IDX_OUTFILE_CHECK_DIR
: outfile_check_dir
= optarg
; break;
5407 case IDX_FORCE
: force
= 1; break;
5408 case IDX_SKIP
: skip
= atoll (optarg
); break;
5409 case IDX_LIMIT
: limit
= atoll (optarg
); break;
5410 case IDX_KEYSPACE
: keyspace
= 1; break;
5411 case IDX_BENCHMARK
: benchmark
= 1; break;
5412 case IDX_BENCHMARK_MODE
: benchmark_mode
= atoi (optarg
); break;
5413 case IDX_RESTORE
: break;
5414 case IDX_RESTORE_DISABLE
: restore_disable
= 1; break;
5415 case IDX_STATUS
: status
= 1; break;
5416 case IDX_STATUS_TIMER
: status_timer
= atoi (optarg
); break;
5417 case IDX_STATUS_AUTOMAT
: status_automat
= 1; break;
5418 case IDX_LOOPBACK
: loopback
= 1; break;
5419 case IDX_WEAK_HASH_THRESHOLD
:
5420 weak_hash_threshold
= atoi (optarg
); break;
5421 //case IDX_SESSION: session = optarg; break;
5422 case IDX_SESSION
: break;
5423 case IDX_HASH_MODE
: hash_mode
= atoi (optarg
);
5424 hash_mode_chgd
= 1; break;
5425 case IDX_RUNTIME
: runtime
= atoi (optarg
);
5426 runtime_chgd
= 1; break;
5427 case IDX_ATTACK_MODE
: attack_mode
= atoi (optarg
);
5428 attack_mode_chgd
= 1; break;
5429 case IDX_RP_FILE
: rp_files
[rp_files_cnt
++] = optarg
; break;
5430 case IDX_RP_GEN
: rp_gen
= atoi (optarg
); break;
5431 case IDX_RP_GEN_FUNC_MIN
: rp_gen_func_min
= atoi (optarg
); break;
5432 case IDX_RP_GEN_FUNC_MAX
: rp_gen_func_max
= atoi (optarg
); break;
5433 case IDX_RP_GEN_SEED
: rp_gen_seed
= atoi (optarg
);
5434 rp_gen_seed_chgd
= 1; break;
5435 case IDX_RULE_BUF_L
: rule_buf_l
= optarg
; break;
5436 case IDX_RULE_BUF_R
: rule_buf_r
= optarg
; break;
5437 case IDX_MARKOV_DISABLE
: markov_disable
= 1; break;
5438 case IDX_MARKOV_CLASSIC
: markov_classic
= 1; break;
5439 case IDX_MARKOV_THRESHOLD
: markov_threshold
= atoi (optarg
); break;
5440 case IDX_MARKOV_HCSTAT
: markov_hcstat
= optarg
; break;
5441 case IDX_OUTFILE
: outfile
= optarg
; break;
5442 case IDX_OUTFILE_FORMAT
: outfile_format
= atoi (optarg
);
5443 outfile_format_chgd
= 1; break;
5444 case IDX_OUTFILE_AUTOHEX_DISABLE
:
5445 outfile_autohex
= 0; break;
5446 case IDX_OUTFILE_CHECK_TIMER
:
5447 outfile_check_timer
= atoi (optarg
); break;
5448 case IDX_HEX_CHARSET
: hex_charset
= 1; break;
5449 case IDX_HEX_SALT
: hex_salt
= 1; break;
5450 case IDX_HEX_WORDLIST
: hex_wordlist
= 1; break;
5451 case IDX_CPU_AFFINITY
: cpu_affinity
= optarg
; break;
5452 case IDX_GPU_DEVICES
: gpu_devices
= optarg
; break;
5453 case IDX_WORKLOAD_PROFILE
: workload_profile
= atoi (optarg
); break;
5454 case IDX_GPU_ACCEL
: gpu_accel
= atoi (optarg
);
5455 gpu_accel_chgd
= 1; break;
5456 case IDX_GPU_LOOPS
: gpu_loops
= atoi (optarg
);
5457 gpu_loops_chgd
= 1; break;
5458 case IDX_GPU_TEMP_DISABLE
: gpu_temp_disable
= 1; break;
5459 case IDX_GPU_TEMP_ABORT
: gpu_temp_abort_chgd
= 1;
5460 gpu_temp_abort
= atoi (optarg
); break;
5461 case IDX_GPU_TEMP_RETAIN
: gpu_temp_retain_chgd
= 1;
5462 gpu_temp_retain
= atoi (optarg
); break;
5463 case IDX_POWERTUNE_ENABLE
: powertune_enable
= 1; break;
5464 case IDX_LOGFILE_DISABLE
: logfile_disable
= 1; break;
5465 case IDX_TRUECRYPT_KEYFILES
: truecrypt_keyfiles
= optarg
; break;
5466 case IDX_SEGMENT_SIZE
: segment_size
= atoi (optarg
); break;
5467 case IDX_SCRYPT_TMTO
: scrypt_tmto
= atoi (optarg
); break;
5468 case IDX_SEPARATOR
: separator
= optarg
[0]; break;
5469 case IDX_BITMAP_MIN
: bitmap_min
= atoi (optarg
); break;
5470 case IDX_BITMAP_MAX
: bitmap_max
= atoi (optarg
); break;
5471 case IDX_INCREMENT
: increment
= 1; break;
5472 case IDX_INCREMENT_MIN
: increment_min
= atoi (optarg
);
5473 increment_min_chgd
= 1; break;
5474 case IDX_INCREMENT_MAX
: increment_max
= atoi (optarg
);
5475 increment_max_chgd
= 1; break;
5476 case IDX_CUSTOM_CHARSET_1
: custom_charset_1
= optarg
; break;
5477 case IDX_CUSTOM_CHARSET_2
: custom_charset_2
= optarg
; break;
5478 case IDX_CUSTOM_CHARSET_3
: custom_charset_3
= optarg
; break;
5479 case IDX_CUSTOM_CHARSET_4
: custom_charset_4
= optarg
; break;
5482 log_error ("ERROR: Invalid argument specified");
5489 log_error ("ERROR: Invalid argument specified");
5495 * Inform user things getting started,
5496 * - this is giving us a visual header before preparations start, so we do not need to clear them afterwards
5497 * - we do not need to check algorithm_pos
5504 log_info ("%s v%.2f starting in benchmark-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5508 else if (restore
== 1)
5510 log_info ("%s v%.2f starting in restore-mode...", PROGNAME
, (float) VERSION_BIN
/ 100);
5516 log_info ("%s v%.2f starting...", PROGNAME
, (float) VERSION_BIN
/ 100);
5526 if (attack_mode
> 7)
5528 log_error ("ERROR: Invalid attack-mode specified");
5533 if (runtime_chgd
&& runtime
== 0) // just added to remove compiler warnings for runtime_chgd
5535 log_error ("ERROR: Invalid runtime specified");
5540 if (hash_mode_chgd
&& hash_mode
> 12800) // just added to remove compiler warnings for hash_mode_chgd
5542 log_error ("ERROR: Invalid hash-type specified");
5547 // renamed hash modes
5561 log_error ("Old -m specified, use -m %d instead", n
);
5569 if ((hash_mode
== 2500) || (hash_mode
== 5200) || ((hash_mode
>= 6200) && (hash_mode
<= 6299)))
5571 log_error ("ERROR: Mixing support for user names and hashes of type %s is not supported", strhashtype (hash_mode
));
5577 if (outfile_format
> 16)
5579 log_error ("ERROR: Invalid outfile-format specified");
5586 if (outfile_format_chgd
== 1)
5588 if (outfile_format
> 1)
5590 log_error ("ERROR: Mixing outfile-format > 1 is not allowed together with left parameter");
5597 outfile_format
= OUTFILE_FMT_HASH
;
5603 if (outfile_format_chgd
== 1)
5605 if ((outfile_format
> 7) && (outfile_format
< 16))
5607 log_error ("ERROR: Mixing outfile-format > 7 is not allowed together with show parameter");
5614 if (increment_min
< INCREMENT_MIN
)
5616 log_error ("ERROR: Invalid increment-min specified");
5621 if (increment_max
> INCREMENT_MAX
)
5623 log_error ("ERROR: Invalid increment-max specified");
5628 if (increment_min
> increment_max
)
5630 log_error ("ERROR: Invalid increment-min specified");
5635 if ((increment
== 1) && (attack_mode
== ATTACK_MODE_STRAIGHT
))
5637 log_error ("ERROR: increment is not allowed in attack-mode 0");
5642 if ((increment
== 0) && (increment_min_chgd
== 1))
5644 log_error ("ERROR: increment-min is only supported together with increment switch");
5649 if ((increment
== 0) && (increment_max_chgd
== 1))
5651 log_error ("ERROR: increment-max is only supported together with increment switch");
5656 if (rp_files_cnt
&& rp_gen
)
5658 log_error ("ERROR: Use of both rules-file and rules-generate is not supported");
5663 if (rp_files_cnt
|| rp_gen
)
5665 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5667 log_error ("ERROR: Use of rules-file or rules-generate only allowed in attack-mode 0");
5673 if (rp_gen_func_min
> rp_gen_func_max
)
5675 log_error ("ERROR: Invalid rp-gen-func-min specified");
5680 if (gpu_accel_chgd
== 1)
5682 if (workload_profile
!= WORKLOAD_PROFILE
)
5684 log_error ("ERROR: gpu-accel parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5691 log_error ("ERROR: Invalid gpu-accel specified");
5696 if (gpu_accel
> 800)
5698 log_error ("ERROR: Invalid gpu-accel specified");
5704 if (gpu_loops_chgd
== 1)
5706 if (workload_profile
!= WORKLOAD_PROFILE
)
5708 log_error ("ERROR: gpu-loops parameter can only be set when workload-profile %i is used", WORKLOAD_PROFILE
);
5715 log_error ("ERROR: Invalid gpu-loops specified");
5720 if (gpu_loops
> 1024)
5722 log_error ("ERROR: Invalid gpu-loops specified");
5730 if (workload_profile
!= WORKLOAD_PROFILE
)
5732 log_error ("ERROR: Using the workload-profile in benchmark mode is not allowed");
5738 if ((workload_profile
< 1) || (workload_profile
> 3))
5740 log_error ("ERROR: workload-profile %i not available", workload_profile
);
5745 if (show
== 1 || left
== 1)
5747 attack_mode
= ATTACK_MODE_NONE
;
5751 log_error ("ERROR: Mixing remove parameter not allowed with show parameter or left parameter");
5756 if (potfile_disable
== 1)
5758 log_error ("ERROR: Mixing potfile-disable parameter not allowed with show parameter or left parameter");
5764 uint attack_kern
= ATTACK_KERN_NONE
;
5766 switch (attack_mode
)
5768 case ATTACK_MODE_STRAIGHT
: attack_kern
= ATTACK_KERN_STRAIGHT
; break;
5769 case ATTACK_MODE_COMBI
: attack_kern
= ATTACK_KERN_COMBI
; break;
5770 case ATTACK_MODE_BF
: attack_kern
= ATTACK_KERN_BF
; break;
5771 case ATTACK_MODE_HYBRID1
: attack_kern
= ATTACK_KERN_COMBI
; break;
5772 case ATTACK_MODE_HYBRID2
: attack_kern
= ATTACK_KERN_COMBI
; break;
5779 int num_additional_params
= 1;
5781 if (attack_kern
== ATTACK_KERN_COMBI
)
5783 num_additional_params
= 2;
5786 int keyspace_wordlist_specified
= myargc
- optind
- num_additional_params
;
5788 if (keyspace_wordlist_specified
== 0) optind
--;
5791 if (attack_kern
== ATTACK_KERN_NONE
)
5793 if ((optind
+ 1) != myargc
)
5795 usage_mini_print (myargv
[0]);
5800 else if (attack_kern
== ATTACK_KERN_STRAIGHT
)
5802 if ((optind
+ 1) > myargc
)
5804 usage_mini_print (myargv
[0]);
5809 else if (attack_kern
== ATTACK_KERN_COMBI
)
5811 if ((optind
+ 3) != myargc
)
5813 usage_mini_print (myargv
[0]);
5818 else if (attack_kern
== ATTACK_KERN_BF
)
5820 if ((optind
+ 1) > myargc
)
5822 usage_mini_print (myargv
[0]);
5829 usage_mini_print (myargv
[0]);
5836 if (myargv
[optind
] != 0)
5838 log_error ("ERROR: Invalid argument for benchmark mode specified");
5843 if (attack_mode_chgd
== 1)
5845 if (attack_mode
!= ATTACK_MODE_BF
)
5847 log_error ("ERROR: Only attack-mode 3 allowed in benchmark mode");
5853 if (benchmark_mode
== 0)
5857 else if (benchmark_mode
== 1)
5859 if (gpu_accel_chgd
== 1 || gpu_loops_chgd
== 1)
5861 log_error ("ERROR: Benchmark-mode 1 does not allow gpu-accel or gpu-loops changed");
5868 log_error ("ERROR: Benchmark-mode must be 0 or 1");
5874 if (skip
!= 0 && limit
!= 0)
5883 log_error ("ERROR: Mixing show parameter not supported with keyspace parameter");
5889 log_error ("ERROR: Mixing left parameter not supported wiht keyspace parameter");
5894 potfile_disable
= 1;
5896 restore_disable
= 1;
5900 weak_hash_threshold
= 0;
5905 if (remove_timer_chgd
== 1)
5909 log_error ("ERROR: Parameter remove-timer require parameter remove enabled");
5914 if (remove_timer
< 1)
5916 log_error ("ERROR: Parameter remove-timer must have a value greater than or equal to 1");
5924 if (attack_mode
== ATTACK_MODE_BF
)
5926 log_error ("ERROR: Parameter loopback not allowed in attack-mode 3");
5930 else if (attack_mode
== ATTACK_MODE_STRAIGHT
)
5932 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5934 log_error ("ERROR: Parameter loopback not allowed without rules-file or rules-generate");
5943 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
5945 log_error ("ERROR: Parameter debug-mode option is only available with attack-mode 0");
5950 if ((rp_files_cnt
== 0) && (rp_gen
== 0))
5952 log_error ("ERROR: Parameter debug-mode not allowed without rules-file or rules-generate");
5960 log_error ("ERROR: Invalid debug-mode specified");
5965 if (debug_file
!= NULL
)
5969 log_error ("ERROR: Parameter debug-file requires parameter debug-mode to be set");
5975 if (induction_dir
!= NULL
)
5977 if (attack_mode
== ATTACK_MODE_BF
)
5979 log_error ("ERROR: Parameter induction-dir not allowed with brute-force attacks");
5986 * induction directory
5989 char *induction_directory
= NULL
;
5991 if (attack_mode
!= ATTACK_MODE_BF
)
5993 if (induction_dir
== NULL
)
5995 induction_directory
= (char *) mymalloc (session_size
);
5997 snprintf (induction_directory
, session_size
- 1, "%s.%s", session
, INDUCT_DIR
);
5999 // create induction folder if it does not already exist
6003 if (rmdir (induction_directory
) == -1)
6005 if (errno
== ENOENT
)
6007 // good, we can ignore
6009 else if (errno
== ENOTEMPTY
)
6011 char *induction_directory_mv
= (char *) mymalloc (session_size
);
6013 snprintf (induction_directory_mv
, session_size
- 1, "%s.induct.%d", session
, (int) proc_start
);
6015 if (rename (induction_directory
, induction_directory_mv
) != 0)
6017 log_error ("ERROR: Rename directory %s to %s: %s", induction_directory
, induction_directory_mv
, strerror (errno
));
6024 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6031 #define mkdir(name,mode) mkdir (name)
6034 if (mkdir (induction_directory
, 0700) == -1)
6036 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
6044 induction_directory
= induction_dir
;
6048 data
.induction_directory
= induction_directory
;
6054 size_t loopback_size
= session_size
+ strlen (LOOPBACK_FILE
) + 12;
6056 char *loopback_file
= (char *) mymalloc (loopback_size
);
6059 * outfile-check directory
6062 char *outfile_check_directory
= NULL
;
6064 if (outfile_check_dir
== NULL
)
6066 outfile_check_directory
= (char *) mymalloc (session_size
);
6068 snprintf (outfile_check_directory
, session_size
- 1, "%s.%s", session
, OUTFILES_DIR
);
6072 outfile_check_directory
= outfile_check_dir
;
6075 data
.outfile_check_directory
= outfile_check_directory
;
6079 struct stat outfile_check_stat
;
6081 if (stat (outfile_check_directory
, &outfile_check_stat
) == 0)
6083 uint is_dir
= S_ISDIR (outfile_check_stat
.st_mode
);
6087 log_error ("ERROR: Directory specified in outfile-check '%s' is not a valid directory", outfile_check_directory
);
6092 else if (outfile_check_dir
== NULL
)
6095 #define mkdir(name,mode) mkdir (name)
6098 if (mkdir (outfile_check_directory
, 0700) == -1)
6100 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
6108 * special other stuff
6111 if (hash_mode
== 9710)
6114 outfile_format_chgd
= 1;
6117 if (hash_mode
== 9810)
6120 outfile_format_chgd
= 1;
6123 if (hash_mode
== 10410)
6126 outfile_format_chgd
= 1;
6133 data
.hash_mode
= hash_mode
;
6134 data
.restore
= restore
;
6135 data
.restore_timer
= restore_timer
;
6136 data
.restore_disable
= restore_disable
;
6137 data
.status
= status
;
6138 data
.status_timer
= status_timer
;
6139 data
.status_automat
= status_automat
;
6140 data
.loopback
= loopback
;
6141 data
.runtime
= runtime
;
6142 data
.remove
= remove
;
6143 data
.remove_timer
= remove_timer
;
6144 data
.debug_mode
= debug_mode
;
6145 data
.debug_file
= debug_file
;
6146 data
.username
= username
;
6148 data
.outfile
= outfile
;
6149 data
.outfile_format
= outfile_format
;
6150 data
.outfile_autohex
= outfile_autohex
;
6151 data
.hex_charset
= hex_charset
;
6152 data
.hex_salt
= hex_salt
;
6153 data
.hex_wordlist
= hex_wordlist
;
6154 data
.separator
= separator
;
6155 data
.rp_files
= rp_files
;
6156 data
.rp_files_cnt
= rp_files_cnt
;
6157 data
.rp_gen
= rp_gen
;
6158 data
.rp_gen_seed
= rp_gen_seed
;
6160 data
.benchmark
= benchmark
;
6163 data
.powertune_enable
= powertune_enable
;
6164 data
.logfile_disable
= logfile_disable
;
6165 data
.truecrypt_keyfiles
= truecrypt_keyfiles
;
6166 data
.scrypt_tmto
= scrypt_tmto
;
6169 * folders, as discussed on https://github.com/hashcat/oclHashcat/issues/20
6174 char *resolved_path
= realpath (myargv
[0], NULL
);
6176 char *install_dir
= get_install_dir (resolved_path
);
6177 char *profile_dir
= NULL
;
6178 char *session_dir
= NULL
;
6180 if (strcmp (install_dir
, INSTALL_FOLDER
) == 0)
6182 struct passwd
*pw
= getpwuid (getuid ());
6184 const char *homedir
= pw
->pw_dir
;
6186 profile_dir
= get_profile_dir (homedir
);
6187 session_dir
= get_session_dir (profile_dir
, session
);
6191 profile_dir
= install_dir
;
6192 session_dir
= install_dir
;
6195 myfree (resolved_path
);
6199 char *install_dir
= get_install_dir (myargv
[0]);
6200 char *profile_dir
= install_dir
;
6201 char *session_dir
= install_dir
;
6205 data
.install_dir
= install_dir
;
6206 data
.profile_dir
= profile_dir
;
6207 data
.session_dir
= session_dir
;
6215 set_cpu_affinity (cpu_affinity
);
6218 if (rp_gen_seed_chgd
== 0)
6224 srand (rp_gen_seed
);
6231 if (logfile_disable
== 0)
6233 size_t logfile_size
= strlen (session
) + 32;
6235 char *logfile
= (char *) mymalloc (logfile_size
);
6237 snprintf (logfile
, logfile_size
- 1, "%s.log", session
);
6239 data
.logfile
= logfile
;
6241 char *topid
= logfile_generate_topid ();
6246 // logfile_append() checks for logfile_disable internally to make it easier from here
6248 #define logfile_top_msg(msg) logfile_append ("%s\t%s", data.topid, (msg));
6249 #define logfile_sub_msg(msg) logfile_append ("%s\t%s\t%s", data.topid, data.subid, (msg));
6250 #define logfile_top_var_uint64(var,val) logfile_append ("%s\t%s\t%llu", data.topid, (var), (val));
6251 #define logfile_sub_var_uint64(var,val) logfile_append ("%s\t%s\t%s\t%llu", data.topid, data.subid, (var), (val));
6252 #define logfile_top_var_uint(var,val) logfile_append ("%s\t%s\t%u", data.topid, (var), (val));
6253 #define logfile_sub_var_uint(var,val) logfile_append ("%s\t%s\t%s\t%u", data.topid, data.subid, (var), (val));
6254 #define logfile_top_var_char(var,val) logfile_append ("%s\t%s\t%c", data.topid, (var), (val));
6255 #define logfile_sub_var_char(var,val) logfile_append ("%s\t%s\t%s\t%c", data.topid, data.subid, (var), (val));
6256 #define logfile_top_var_string(var,val) if ((val) != NULL) logfile_append ("%s\t%s\t%s", data.topid, (var), (val));
6257 #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));
6259 #define logfile_top_uint64(var) logfile_top_var_uint64 (#var, (var));
6260 #define logfile_sub_uint64(var) logfile_sub_var_uint64 (#var, (var));
6261 #define logfile_top_uint(var) logfile_top_var_uint (#var, (var));
6262 #define logfile_sub_uint(var) logfile_sub_var_uint (#var, (var));
6263 #define logfile_top_char(var) logfile_top_var_char (#var, (var));
6264 #define logfile_sub_char(var) logfile_sub_var_char (#var, (var));
6265 #define logfile_top_string(var) logfile_top_var_string (#var, (var));
6266 #define logfile_sub_string(var) logfile_sub_var_string (#var, (var));
6268 logfile_top_msg ("START");
6270 logfile_top_uint (attack_mode
);
6271 logfile_top_uint (attack_kern
);
6272 logfile_top_uint (benchmark
);
6273 logfile_top_uint (benchmark_mode
);
6274 logfile_top_uint (bitmap_min
);
6275 logfile_top_uint (bitmap_max
);
6276 logfile_top_uint (debug_mode
);
6277 logfile_top_uint (force
);
6278 logfile_top_uint (gpu_accel
);
6279 logfile_top_uint (gpu_loops
);
6280 logfile_top_uint (gpu_temp_abort
);
6281 logfile_top_uint (gpu_temp_disable
);
6282 logfile_top_uint (gpu_temp_retain
);
6283 logfile_top_uint (hash_mode
);
6284 logfile_top_uint (hex_charset
);
6285 logfile_top_uint (hex_salt
);
6286 logfile_top_uint (hex_wordlist
);
6287 logfile_top_uint (increment
);
6288 logfile_top_uint (increment_max
);
6289 logfile_top_uint (increment_min
);
6290 logfile_top_uint (keyspace
);
6291 logfile_top_uint (left
);
6292 logfile_top_uint (logfile_disable
);
6293 logfile_top_uint (loopback
);
6294 logfile_top_uint (markov_classic
);
6295 logfile_top_uint (markov_disable
);
6296 logfile_top_uint (markov_threshold
);
6297 logfile_top_uint (outfile_autohex
);
6298 logfile_top_uint (outfile_check_timer
);
6299 logfile_top_uint (outfile_format
);
6300 logfile_top_uint (potfile_disable
);
6301 logfile_top_uint (powertune_enable
);
6302 logfile_top_uint (scrypt_tmto
);
6303 logfile_top_uint (quiet
);
6304 logfile_top_uint (remove
);
6305 logfile_top_uint (remove_timer
);
6306 logfile_top_uint (restore
);
6307 logfile_top_uint (restore_disable
);
6308 logfile_top_uint (restore_timer
);
6309 logfile_top_uint (rp_gen
);
6310 logfile_top_uint (rp_gen_func_max
);
6311 logfile_top_uint (rp_gen_func_min
);
6312 logfile_top_uint (rp_gen_seed
);
6313 logfile_top_uint (runtime
);
6314 logfile_top_uint (segment_size
);
6315 logfile_top_uint (show
);
6316 logfile_top_uint (status
);
6317 logfile_top_uint (status_automat
);
6318 logfile_top_uint (status_timer
);
6319 logfile_top_uint (usage
);
6320 logfile_top_uint (username
);
6321 logfile_top_uint (version
);
6322 logfile_top_uint (weak_hash_threshold
);
6323 logfile_top_uint (workload_profile
);
6324 logfile_top_uint64 (limit
);
6325 logfile_top_uint64 (skip
);
6326 logfile_top_char (separator
);
6327 logfile_top_string (cpu_affinity
);
6328 logfile_top_string (custom_charset_1
);
6329 logfile_top_string (custom_charset_2
);
6330 logfile_top_string (custom_charset_3
);
6331 logfile_top_string (custom_charset_4
);
6332 logfile_top_string (debug_file
);
6333 logfile_top_string (gpu_devices
);
6334 logfile_top_string (induction_dir
);
6335 logfile_top_string (markov_hcstat
);
6336 logfile_top_string (outfile
);
6337 logfile_top_string (outfile_check_dir
);
6338 logfile_top_string (rule_buf_l
);
6339 logfile_top_string (rule_buf_r
);
6340 logfile_top_string (session
);
6341 logfile_top_string (truecrypt_keyfiles
);
6347 uint gpu_devicemask
= devices_to_devicemask (gpu_devices
);
6356 * disable useless stuff for benchmark
6361 restore_disable
= 1;
6362 potfile_disable
= 1;
6363 weak_hash_threshold
= 0;
6365 data
.restore_timer
= restore_timer
;
6366 data
.status_timer
= status_timer
;
6367 data
.restore_disable
= restore_disable
;
6369 if (benchmark_mode
== 1)
6375 * force attack mode to be bruteforce
6378 attack_mode
= ATTACK_MODE_BF
;
6379 attack_kern
= ATTACK_KERN_BF
;
6381 if (runtime_chgd
== 0)
6385 if (benchmark_mode
== 1) runtime
= 17;
6387 data
.runtime
= runtime
;
6397 uint attack_exec
= 0;
6401 uint esalt_size
= 0;
6403 uint dgst_pos0
= -1;
6404 uint dgst_pos1
= -1;
6405 uint dgst_pos2
= -1;
6406 uint dgst_pos3
= -1;
6408 int (*parse_func
) (char *, uint
, hash_t
*);
6409 int (*sort_by_digest
) (const void *, const void *);
6411 uint algorithm_pos
= 0;
6412 uint algorithm_max
= 1;
6414 uint
*algorithms
= default_benchmark_algorithms
;
6416 if (benchmark
== 1 && hash_mode_chgd
== 0) algorithm_max
= NUM_DEFAULT_BENCHMARK_ALGORITHMS
;
6418 for (algorithm_pos
= 0; algorithm_pos
< algorithm_max
; algorithm_pos
++)
6421 * We need to reset 'rd' in benchmark mode otherwise when the user hits 'bypass'
6422 * the following algos are skipped entirely
6425 if (algorithm_pos
> 0)
6429 rd
= init_restore (argc
, argv
);
6435 * update hash_mode in case of multihash benchmark
6440 if (hash_mode_chgd
== 0)
6442 hash_mode
= algorithms
[algorithm_pos
];
6444 data
.hash_mode
= hash_mode
;
6454 case 0: hash_type
= HASH_TYPE_MD5
;
6455 salt_type
= SALT_TYPE_NONE
;
6456 attack_exec
= ATTACK_EXEC_ON_GPU
;
6457 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6458 | OPTS_TYPE_PT_ADD80
6459 | OPTS_TYPE_PT_ADDBITS14
;
6460 kern_type
= KERN_TYPE_MD5
;
6461 dgst_size
= DGST_SIZE_4_4
;
6462 parse_func
= md5_parse_hash
;
6463 sort_by_digest
= sort_by_digest_4_4
;
6464 opti_type
= OPTI_TYPE_ZERO_BYTE
6465 | OPTI_TYPE_PRECOMPUTE_INIT
6466 | OPTI_TYPE_PRECOMPUTE_MERKLE
6467 | OPTI_TYPE_MEET_IN_MIDDLE
6468 | OPTI_TYPE_EARLY_SKIP
6469 | OPTI_TYPE_NOT_ITERATED
6470 | OPTI_TYPE_NOT_SALTED
6471 | OPTI_TYPE_RAW_HASH
;
6478 case 10: hash_type
= HASH_TYPE_MD5
;
6479 salt_type
= SALT_TYPE_INTERN
;
6480 attack_exec
= ATTACK_EXEC_ON_GPU
;
6481 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6482 | OPTS_TYPE_ST_ADD80
6483 | OPTS_TYPE_ST_ADDBITS14
;
6484 kern_type
= KERN_TYPE_MD5_PWSLT
;
6485 dgst_size
= DGST_SIZE_4_4
;
6486 parse_func
= md5s_parse_hash
;
6487 sort_by_digest
= sort_by_digest_4_4
;
6488 opti_type
= OPTI_TYPE_ZERO_BYTE
6489 | OPTI_TYPE_PRECOMPUTE_INIT
6490 | OPTI_TYPE_PRECOMPUTE_MERKLE
6491 | OPTI_TYPE_MEET_IN_MIDDLE
6492 | OPTI_TYPE_EARLY_SKIP
6493 | OPTI_TYPE_NOT_ITERATED
6494 | OPTI_TYPE_APPENDED_SALT
6495 | OPTI_TYPE_RAW_HASH
;
6502 case 11: hash_type
= HASH_TYPE_MD5
;
6503 salt_type
= SALT_TYPE_INTERN
;
6504 attack_exec
= ATTACK_EXEC_ON_GPU
;
6505 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6506 | OPTS_TYPE_ST_ADD80
6507 | OPTS_TYPE_ST_ADDBITS14
;
6508 kern_type
= KERN_TYPE_MD5_PWSLT
;
6509 dgst_size
= DGST_SIZE_4_4
;
6510 parse_func
= joomla_parse_hash
;
6511 sort_by_digest
= sort_by_digest_4_4
;
6512 opti_type
= OPTI_TYPE_ZERO_BYTE
6513 | OPTI_TYPE_PRECOMPUTE_INIT
6514 | OPTI_TYPE_PRECOMPUTE_MERKLE
6515 | OPTI_TYPE_MEET_IN_MIDDLE
6516 | OPTI_TYPE_EARLY_SKIP
6517 | OPTI_TYPE_NOT_ITERATED
6518 | OPTI_TYPE_APPENDED_SALT
6519 | OPTI_TYPE_RAW_HASH
;
6526 case 12: hash_type
= HASH_TYPE_MD5
;
6527 salt_type
= SALT_TYPE_INTERN
;
6528 attack_exec
= ATTACK_EXEC_ON_GPU
;
6529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6530 | OPTS_TYPE_ST_ADD80
6531 | OPTS_TYPE_ST_ADDBITS14
;
6532 kern_type
= KERN_TYPE_MD5_PWSLT
;
6533 dgst_size
= DGST_SIZE_4_4
;
6534 parse_func
= postgresql_parse_hash
;
6535 sort_by_digest
= sort_by_digest_4_4
;
6536 opti_type
= OPTI_TYPE_ZERO_BYTE
6537 | OPTI_TYPE_PRECOMPUTE_INIT
6538 | OPTI_TYPE_PRECOMPUTE_MERKLE
6539 | OPTI_TYPE_MEET_IN_MIDDLE
6540 | OPTI_TYPE_EARLY_SKIP
6541 | OPTI_TYPE_NOT_ITERATED
6542 | OPTI_TYPE_APPENDED_SALT
6543 | OPTI_TYPE_RAW_HASH
;
6550 case 20: hash_type
= HASH_TYPE_MD5
;
6551 salt_type
= SALT_TYPE_INTERN
;
6552 attack_exec
= ATTACK_EXEC_ON_GPU
;
6553 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6554 | OPTS_TYPE_PT_ADD80
6555 | OPTS_TYPE_PT_ADDBITS14
;
6556 kern_type
= KERN_TYPE_MD5_SLTPW
;
6557 dgst_size
= DGST_SIZE_4_4
;
6558 parse_func
= md5s_parse_hash
;
6559 sort_by_digest
= sort_by_digest_4_4
;
6560 opti_type
= OPTI_TYPE_ZERO_BYTE
6561 | OPTI_TYPE_PRECOMPUTE_INIT
6562 | OPTI_TYPE_PRECOMPUTE_MERKLE
6563 | OPTI_TYPE_EARLY_SKIP
6564 | OPTI_TYPE_NOT_ITERATED
6565 | OPTI_TYPE_PREPENDED_SALT
6566 | OPTI_TYPE_RAW_HASH
;
6573 case 21: hash_type
= HASH_TYPE_MD5
;
6574 salt_type
= SALT_TYPE_INTERN
;
6575 attack_exec
= ATTACK_EXEC_ON_GPU
;
6576 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6577 | OPTS_TYPE_PT_ADD80
6578 | OPTS_TYPE_PT_ADDBITS14
;
6579 kern_type
= KERN_TYPE_MD5_SLTPW
;
6580 dgst_size
= DGST_SIZE_4_4
;
6581 parse_func
= osc_parse_hash
;
6582 sort_by_digest
= sort_by_digest_4_4
;
6583 opti_type
= OPTI_TYPE_ZERO_BYTE
6584 | OPTI_TYPE_PRECOMPUTE_INIT
6585 | OPTI_TYPE_PRECOMPUTE_MERKLE
6586 | OPTI_TYPE_EARLY_SKIP
6587 | OPTI_TYPE_NOT_ITERATED
6588 | OPTI_TYPE_PREPENDED_SALT
6589 | OPTI_TYPE_RAW_HASH
;
6596 case 22: hash_type
= HASH_TYPE_MD5
;
6597 salt_type
= SALT_TYPE_EMBEDDED
;
6598 attack_exec
= ATTACK_EXEC_ON_GPU
;
6599 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6600 | OPTS_TYPE_PT_ADD80
6601 | OPTS_TYPE_PT_ADDBITS14
;
6602 kern_type
= KERN_TYPE_MD5_SLTPW
;
6603 dgst_size
= DGST_SIZE_4_4
;
6604 parse_func
= netscreen_parse_hash
;
6605 sort_by_digest
= sort_by_digest_4_4
;
6606 opti_type
= OPTI_TYPE_ZERO_BYTE
6607 | OPTI_TYPE_PRECOMPUTE_INIT
6608 | OPTI_TYPE_PRECOMPUTE_MERKLE
6609 | OPTI_TYPE_EARLY_SKIP
6610 | OPTI_TYPE_NOT_ITERATED
6611 | OPTI_TYPE_PREPENDED_SALT
6612 | OPTI_TYPE_RAW_HASH
;
6619 case 23: hash_type
= HASH_TYPE_MD5
;
6620 salt_type
= SALT_TYPE_EMBEDDED
;
6621 attack_exec
= ATTACK_EXEC_ON_GPU
;
6622 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6623 | OPTS_TYPE_PT_ADD80
6624 | OPTS_TYPE_PT_ADDBITS14
;
6625 kern_type
= KERN_TYPE_MD5_SLTPW
;
6626 dgst_size
= DGST_SIZE_4_4
;
6627 parse_func
= skype_parse_hash
;
6628 sort_by_digest
= sort_by_digest_4_4
;
6629 opti_type
= OPTI_TYPE_ZERO_BYTE
6630 | OPTI_TYPE_PRECOMPUTE_INIT
6631 | OPTI_TYPE_PRECOMPUTE_MERKLE
6632 | OPTI_TYPE_EARLY_SKIP
6633 | OPTI_TYPE_NOT_ITERATED
6634 | OPTI_TYPE_PREPENDED_SALT
6635 | OPTI_TYPE_RAW_HASH
;
6642 case 30: hash_type
= HASH_TYPE_MD5
;
6643 salt_type
= SALT_TYPE_INTERN
;
6644 attack_exec
= ATTACK_EXEC_ON_GPU
;
6645 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6646 | OPTS_TYPE_PT_UNICODE
6647 | OPTS_TYPE_ST_ADD80
6648 | OPTS_TYPE_ST_ADDBITS14
;
6649 kern_type
= KERN_TYPE_MD5_PWUSLT
;
6650 dgst_size
= DGST_SIZE_4_4
;
6651 parse_func
= md5s_parse_hash
;
6652 sort_by_digest
= sort_by_digest_4_4
;
6653 opti_type
= OPTI_TYPE_ZERO_BYTE
6654 | OPTI_TYPE_PRECOMPUTE_INIT
6655 | OPTI_TYPE_PRECOMPUTE_MERKLE
6656 | OPTI_TYPE_MEET_IN_MIDDLE
6657 | OPTI_TYPE_EARLY_SKIP
6658 | OPTI_TYPE_NOT_ITERATED
6659 | OPTI_TYPE_APPENDED_SALT
6660 | OPTI_TYPE_RAW_HASH
;
6667 case 40: hash_type
= HASH_TYPE_MD5
;
6668 salt_type
= SALT_TYPE_INTERN
;
6669 attack_exec
= ATTACK_EXEC_ON_GPU
;
6670 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6671 | OPTS_TYPE_PT_ADD80
6672 | OPTS_TYPE_PT_ADDBITS14
6673 | OPTS_TYPE_PT_UNICODE
;
6674 kern_type
= KERN_TYPE_MD5_SLTPWU
;
6675 dgst_size
= DGST_SIZE_4_4
;
6676 parse_func
= md5s_parse_hash
;
6677 sort_by_digest
= sort_by_digest_4_4
;
6678 opti_type
= OPTI_TYPE_ZERO_BYTE
6679 | OPTI_TYPE_PRECOMPUTE_INIT
6680 | OPTI_TYPE_PRECOMPUTE_MERKLE
6681 | OPTI_TYPE_EARLY_SKIP
6682 | OPTI_TYPE_NOT_ITERATED
6683 | OPTI_TYPE_PREPENDED_SALT
6684 | OPTI_TYPE_RAW_HASH
;
6691 case 50: hash_type
= HASH_TYPE_MD5
;
6692 salt_type
= SALT_TYPE_INTERN
;
6693 attack_exec
= ATTACK_EXEC_ON_GPU
;
6694 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6695 | OPTS_TYPE_ST_ADD80
6696 | OPTS_TYPE_ST_ADDBITS14
;
6697 kern_type
= KERN_TYPE_HMACMD5_PW
;
6698 dgst_size
= DGST_SIZE_4_4
;
6699 parse_func
= hmacmd5_parse_hash
;
6700 sort_by_digest
= sort_by_digest_4_4
;
6701 opti_type
= OPTI_TYPE_ZERO_BYTE
6702 | OPTI_TYPE_NOT_ITERATED
;
6709 case 60: hash_type
= HASH_TYPE_MD5
;
6710 salt_type
= SALT_TYPE_INTERN
;
6711 attack_exec
= ATTACK_EXEC_ON_GPU
;
6712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
6713 | OPTS_TYPE_PT_ADD80
6714 | OPTS_TYPE_PT_ADDBITS14
;
6715 kern_type
= KERN_TYPE_HMACMD5_SLT
;
6716 dgst_size
= DGST_SIZE_4_4
;
6717 parse_func
= hmacmd5_parse_hash
;
6718 sort_by_digest
= sort_by_digest_4_4
;
6719 opti_type
= OPTI_TYPE_ZERO_BYTE
6720 | OPTI_TYPE_NOT_ITERATED
;
6727 case 100: hash_type
= HASH_TYPE_SHA1
;
6728 salt_type
= SALT_TYPE_NONE
;
6729 attack_exec
= ATTACK_EXEC_ON_GPU
;
6730 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6731 | OPTS_TYPE_PT_ADD80
6732 | OPTS_TYPE_PT_ADDBITS15
;
6733 kern_type
= KERN_TYPE_SHA1
;
6734 dgst_size
= DGST_SIZE_4_5
;
6735 parse_func
= sha1_parse_hash
;
6736 sort_by_digest
= sort_by_digest_4_5
;
6737 opti_type
= OPTI_TYPE_ZERO_BYTE
6738 | OPTI_TYPE_PRECOMPUTE_INIT
6739 | OPTI_TYPE_PRECOMPUTE_MERKLE
6740 | OPTI_TYPE_EARLY_SKIP
6741 | OPTI_TYPE_NOT_ITERATED
6742 | OPTI_TYPE_NOT_SALTED
6743 | OPTI_TYPE_RAW_HASH
;
6750 case 101: hash_type
= HASH_TYPE_SHA1
;
6751 salt_type
= SALT_TYPE_NONE
;
6752 attack_exec
= ATTACK_EXEC_ON_GPU
;
6753 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6754 | OPTS_TYPE_PT_ADD80
6755 | OPTS_TYPE_PT_ADDBITS15
;
6756 kern_type
= KERN_TYPE_SHA1
;
6757 dgst_size
= DGST_SIZE_4_5
;
6758 parse_func
= sha1b64_parse_hash
;
6759 sort_by_digest
= sort_by_digest_4_5
;
6760 opti_type
= OPTI_TYPE_ZERO_BYTE
6761 | OPTI_TYPE_PRECOMPUTE_INIT
6762 | OPTI_TYPE_PRECOMPUTE_MERKLE
6763 | OPTI_TYPE_EARLY_SKIP
6764 | OPTI_TYPE_NOT_ITERATED
6765 | OPTI_TYPE_NOT_SALTED
6766 | OPTI_TYPE_RAW_HASH
;
6773 case 110: hash_type
= HASH_TYPE_SHA1
;
6774 salt_type
= SALT_TYPE_INTERN
;
6775 attack_exec
= ATTACK_EXEC_ON_GPU
;
6776 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6777 | OPTS_TYPE_ST_ADD80
6778 | OPTS_TYPE_ST_ADDBITS15
;
6779 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6780 dgst_size
= DGST_SIZE_4_5
;
6781 parse_func
= sha1s_parse_hash
;
6782 sort_by_digest
= sort_by_digest_4_5
;
6783 opti_type
= OPTI_TYPE_ZERO_BYTE
6784 | OPTI_TYPE_PRECOMPUTE_INIT
6785 | OPTI_TYPE_PRECOMPUTE_MERKLE
6786 | OPTI_TYPE_EARLY_SKIP
6787 | OPTI_TYPE_NOT_ITERATED
6788 | OPTI_TYPE_APPENDED_SALT
6789 | OPTI_TYPE_RAW_HASH
;
6796 case 111: hash_type
= HASH_TYPE_SHA1
;
6797 salt_type
= SALT_TYPE_EMBEDDED
;
6798 attack_exec
= ATTACK_EXEC_ON_GPU
;
6799 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6800 | OPTS_TYPE_ST_ADD80
6801 | OPTS_TYPE_ST_ADDBITS15
;
6802 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6803 dgst_size
= DGST_SIZE_4_5
;
6804 parse_func
= sha1b64s_parse_hash
;
6805 sort_by_digest
= sort_by_digest_4_5
;
6806 opti_type
= OPTI_TYPE_ZERO_BYTE
6807 | OPTI_TYPE_PRECOMPUTE_INIT
6808 | OPTI_TYPE_PRECOMPUTE_MERKLE
6809 | OPTI_TYPE_EARLY_SKIP
6810 | OPTI_TYPE_NOT_ITERATED
6811 | OPTI_TYPE_APPENDED_SALT
6812 | OPTI_TYPE_RAW_HASH
;
6819 case 112: hash_type
= HASH_TYPE_SHA1
;
6820 salt_type
= SALT_TYPE_INTERN
;
6821 attack_exec
= ATTACK_EXEC_ON_GPU
;
6822 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6823 | OPTS_TYPE_ST_ADD80
6824 | OPTS_TYPE_ST_ADDBITS15
6826 kern_type
= KERN_TYPE_SHA1_PWSLT
;
6827 dgst_size
= DGST_SIZE_4_5
;
6828 parse_func
= oracles_parse_hash
;
6829 sort_by_digest
= sort_by_digest_4_5
;
6830 opti_type
= OPTI_TYPE_ZERO_BYTE
6831 | OPTI_TYPE_PRECOMPUTE_INIT
6832 | OPTI_TYPE_PRECOMPUTE_MERKLE
6833 | OPTI_TYPE_EARLY_SKIP
6834 | OPTI_TYPE_NOT_ITERATED
6835 | OPTI_TYPE_APPENDED_SALT
6836 | OPTI_TYPE_RAW_HASH
;
6843 case 120: hash_type
= HASH_TYPE_SHA1
;
6844 salt_type
= SALT_TYPE_INTERN
;
6845 attack_exec
= ATTACK_EXEC_ON_GPU
;
6846 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6847 | OPTS_TYPE_PT_ADD80
6848 | OPTS_TYPE_PT_ADDBITS15
;
6849 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6850 dgst_size
= DGST_SIZE_4_5
;
6851 parse_func
= sha1s_parse_hash
;
6852 sort_by_digest
= sort_by_digest_4_5
;
6853 opti_type
= OPTI_TYPE_ZERO_BYTE
6854 | OPTI_TYPE_PRECOMPUTE_INIT
6855 | OPTI_TYPE_PRECOMPUTE_MERKLE
6856 | OPTI_TYPE_EARLY_SKIP
6857 | OPTI_TYPE_NOT_ITERATED
6858 | OPTI_TYPE_PREPENDED_SALT
6859 | OPTI_TYPE_RAW_HASH
;
6866 case 121: hash_type
= HASH_TYPE_SHA1
;
6867 salt_type
= SALT_TYPE_INTERN
;
6868 attack_exec
= ATTACK_EXEC_ON_GPU
;
6869 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6870 | OPTS_TYPE_PT_ADD80
6871 | OPTS_TYPE_PT_ADDBITS15
6872 | OPTS_TYPE_ST_LOWER
;
6873 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6874 dgst_size
= DGST_SIZE_4_5
;
6875 parse_func
= smf_parse_hash
;
6876 sort_by_digest
= sort_by_digest_4_5
;
6877 opti_type
= OPTI_TYPE_ZERO_BYTE
6878 | OPTI_TYPE_PRECOMPUTE_INIT
6879 | OPTI_TYPE_PRECOMPUTE_MERKLE
6880 | OPTI_TYPE_EARLY_SKIP
6881 | OPTI_TYPE_NOT_ITERATED
6882 | OPTI_TYPE_PREPENDED_SALT
6883 | OPTI_TYPE_RAW_HASH
;
6890 case 122: hash_type
= HASH_TYPE_SHA1
;
6891 salt_type
= SALT_TYPE_EMBEDDED
;
6892 attack_exec
= ATTACK_EXEC_ON_GPU
;
6893 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6894 | OPTS_TYPE_PT_ADD80
6895 | OPTS_TYPE_PT_ADDBITS15
6897 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6898 dgst_size
= DGST_SIZE_4_5
;
6899 parse_func
= osx1_parse_hash
;
6900 sort_by_digest
= sort_by_digest_4_5
;
6901 opti_type
= OPTI_TYPE_ZERO_BYTE
6902 | OPTI_TYPE_PRECOMPUTE_INIT
6903 | OPTI_TYPE_PRECOMPUTE_MERKLE
6904 | OPTI_TYPE_EARLY_SKIP
6905 | OPTI_TYPE_NOT_ITERATED
6906 | OPTI_TYPE_PREPENDED_SALT
6907 | OPTI_TYPE_RAW_HASH
;
6914 case 124: hash_type
= HASH_TYPE_SHA1
;
6915 salt_type
= SALT_TYPE_EMBEDDED
;
6916 attack_exec
= ATTACK_EXEC_ON_GPU
;
6917 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6918 | OPTS_TYPE_PT_ADD80
6919 | OPTS_TYPE_PT_ADDBITS15
;
6920 kern_type
= KERN_TYPE_SHA1_SLTPW
;
6921 dgst_size
= DGST_SIZE_4_5
;
6922 parse_func
= djangosha1_parse_hash
;
6923 sort_by_digest
= sort_by_digest_4_5
;
6924 opti_type
= OPTI_TYPE_ZERO_BYTE
6925 | OPTI_TYPE_PRECOMPUTE_INIT
6926 | OPTI_TYPE_PRECOMPUTE_MERKLE
6927 | OPTI_TYPE_EARLY_SKIP
6928 | OPTI_TYPE_NOT_ITERATED
6929 | OPTI_TYPE_PREPENDED_SALT
6930 | OPTI_TYPE_RAW_HASH
;
6937 case 130: hash_type
= HASH_TYPE_SHA1
;
6938 salt_type
= SALT_TYPE_INTERN
;
6939 attack_exec
= ATTACK_EXEC_ON_GPU
;
6940 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6941 | OPTS_TYPE_PT_UNICODE
6942 | OPTS_TYPE_ST_ADD80
6943 | OPTS_TYPE_ST_ADDBITS15
;
6944 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6945 dgst_size
= DGST_SIZE_4_5
;
6946 parse_func
= sha1s_parse_hash
;
6947 sort_by_digest
= sort_by_digest_4_5
;
6948 opti_type
= OPTI_TYPE_ZERO_BYTE
6949 | OPTI_TYPE_PRECOMPUTE_INIT
6950 | OPTI_TYPE_PRECOMPUTE_MERKLE
6951 | OPTI_TYPE_EARLY_SKIP
6952 | OPTI_TYPE_NOT_ITERATED
6953 | OPTI_TYPE_APPENDED_SALT
6954 | OPTI_TYPE_RAW_HASH
;
6961 case 131: hash_type
= HASH_TYPE_SHA1
;
6962 salt_type
= SALT_TYPE_EMBEDDED
;
6963 attack_exec
= ATTACK_EXEC_ON_GPU
;
6964 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6965 | OPTS_TYPE_PT_UNICODE
6966 | OPTS_TYPE_PT_UPPER
6967 | OPTS_TYPE_ST_ADD80
6968 | OPTS_TYPE_ST_ADDBITS15
6970 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6971 dgst_size
= DGST_SIZE_4_5
;
6972 parse_func
= mssql2000_parse_hash
;
6973 sort_by_digest
= sort_by_digest_4_5
;
6974 opti_type
= OPTI_TYPE_ZERO_BYTE
6975 | OPTI_TYPE_PRECOMPUTE_INIT
6976 | OPTI_TYPE_PRECOMPUTE_MERKLE
6977 | OPTI_TYPE_EARLY_SKIP
6978 | OPTI_TYPE_NOT_ITERATED
6979 | OPTI_TYPE_APPENDED_SALT
6980 | OPTI_TYPE_RAW_HASH
;
6987 case 132: hash_type
= HASH_TYPE_SHA1
;
6988 salt_type
= SALT_TYPE_EMBEDDED
;
6989 attack_exec
= ATTACK_EXEC_ON_GPU
;
6990 opts_type
= OPTS_TYPE_PT_GENERATE_BE
6991 | OPTS_TYPE_PT_UNICODE
6992 | OPTS_TYPE_ST_ADD80
6993 | OPTS_TYPE_ST_ADDBITS15
6995 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
6996 dgst_size
= DGST_SIZE_4_5
;
6997 parse_func
= mssql2005_parse_hash
;
6998 sort_by_digest
= sort_by_digest_4_5
;
6999 opti_type
= OPTI_TYPE_ZERO_BYTE
7000 | OPTI_TYPE_PRECOMPUTE_INIT
7001 | OPTI_TYPE_PRECOMPUTE_MERKLE
7002 | OPTI_TYPE_EARLY_SKIP
7003 | OPTI_TYPE_NOT_ITERATED
7004 | OPTI_TYPE_APPENDED_SALT
7005 | OPTI_TYPE_RAW_HASH
;
7012 case 133: hash_type
= HASH_TYPE_SHA1
;
7013 salt_type
= SALT_TYPE_EMBEDDED
;
7014 attack_exec
= ATTACK_EXEC_ON_GPU
;
7015 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7016 | OPTS_TYPE_PT_UNICODE
7017 | OPTS_TYPE_ST_ADD80
7018 | OPTS_TYPE_ST_ADDBITS15
;
7019 kern_type
= KERN_TYPE_SHA1_PWUSLT
;
7020 dgst_size
= DGST_SIZE_4_5
;
7021 parse_func
= peoplesoft_parse_hash
;
7022 sort_by_digest
= sort_by_digest_4_5
;
7023 opti_type
= OPTI_TYPE_ZERO_BYTE
7024 | OPTI_TYPE_PRECOMPUTE_INIT
7025 | OPTI_TYPE_PRECOMPUTE_MERKLE
7026 | OPTI_TYPE_EARLY_SKIP
7027 | OPTI_TYPE_NOT_ITERATED
7028 | OPTI_TYPE_APPENDED_SALT
7029 | OPTI_TYPE_RAW_HASH
;
7036 case 140: hash_type
= HASH_TYPE_SHA1
;
7037 salt_type
= SALT_TYPE_INTERN
;
7038 attack_exec
= ATTACK_EXEC_ON_GPU
;
7039 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7040 | OPTS_TYPE_PT_ADD80
7041 | OPTS_TYPE_PT_ADDBITS15
7042 | OPTS_TYPE_PT_UNICODE
;
7043 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7044 dgst_size
= DGST_SIZE_4_5
;
7045 parse_func
= sha1s_parse_hash
;
7046 sort_by_digest
= sort_by_digest_4_5
;
7047 opti_type
= OPTI_TYPE_ZERO_BYTE
7048 | OPTI_TYPE_PRECOMPUTE_INIT
7049 | OPTI_TYPE_PRECOMPUTE_MERKLE
7050 | OPTI_TYPE_EARLY_SKIP
7051 | OPTI_TYPE_NOT_ITERATED
7052 | OPTI_TYPE_PREPENDED_SALT
7053 | OPTI_TYPE_RAW_HASH
;
7060 case 141: hash_type
= HASH_TYPE_SHA1
;
7061 salt_type
= SALT_TYPE_EMBEDDED
;
7062 attack_exec
= ATTACK_EXEC_ON_GPU
;
7063 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7064 | OPTS_TYPE_PT_ADD80
7065 | OPTS_TYPE_PT_ADDBITS15
7066 | OPTS_TYPE_PT_UNICODE
7067 | OPTS_TYPE_ST_BASE64
;
7068 kern_type
= KERN_TYPE_SHA1_SLTPWU
;
7069 dgst_size
= DGST_SIZE_4_5
;
7070 parse_func
= episerver_parse_hash
;
7071 sort_by_digest
= sort_by_digest_4_5
;
7072 opti_type
= OPTI_TYPE_ZERO_BYTE
7073 | OPTI_TYPE_PRECOMPUTE_INIT
7074 | OPTI_TYPE_PRECOMPUTE_MERKLE
7075 | OPTI_TYPE_EARLY_SKIP
7076 | OPTI_TYPE_NOT_ITERATED
7077 | OPTI_TYPE_PREPENDED_SALT
7078 | OPTI_TYPE_RAW_HASH
;
7085 case 150: hash_type
= HASH_TYPE_SHA1
;
7086 salt_type
= SALT_TYPE_INTERN
;
7087 attack_exec
= ATTACK_EXEC_ON_GPU
;
7088 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7089 | OPTS_TYPE_ST_ADD80
7090 | OPTS_TYPE_ST_ADDBITS15
;
7091 kern_type
= KERN_TYPE_HMACSHA1_PW
;
7092 dgst_size
= DGST_SIZE_4_5
;
7093 parse_func
= hmacsha1_parse_hash
;
7094 sort_by_digest
= sort_by_digest_4_5
;
7095 opti_type
= OPTI_TYPE_ZERO_BYTE
7096 | OPTI_TYPE_NOT_ITERATED
;
7103 case 160: hash_type
= HASH_TYPE_SHA1
;
7104 salt_type
= SALT_TYPE_INTERN
;
7105 attack_exec
= ATTACK_EXEC_ON_GPU
;
7106 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7107 | OPTS_TYPE_PT_ADD80
7108 | OPTS_TYPE_PT_ADDBITS15
;
7109 kern_type
= KERN_TYPE_HMACSHA1_SLT
;
7110 dgst_size
= DGST_SIZE_4_5
;
7111 parse_func
= hmacsha1_parse_hash
;
7112 sort_by_digest
= sort_by_digest_4_5
;
7113 opti_type
= OPTI_TYPE_ZERO_BYTE
7114 | OPTI_TYPE_NOT_ITERATED
;
7121 case 190: hash_type
= HASH_TYPE_SHA1
;
7122 salt_type
= SALT_TYPE_NONE
;
7123 attack_exec
= ATTACK_EXEC_ON_GPU
;
7124 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7125 | OPTS_TYPE_PT_ADD80
7126 | OPTS_TYPE_PT_ADDBITS15
;
7127 kern_type
= KERN_TYPE_SHA1_LINKEDIN
;
7128 dgst_size
= DGST_SIZE_4_5
;
7129 parse_func
= sha1linkedin_parse_hash
;
7130 sort_by_digest
= sort_by_digest_4_5
;
7131 opti_type
= OPTI_TYPE_ZERO_BYTE
7132 | OPTI_TYPE_PRECOMPUTE_INIT
7133 | OPTI_TYPE_EARLY_SKIP
7134 | OPTI_TYPE_NOT_ITERATED
7135 | OPTI_TYPE_NOT_SALTED
;
7142 case 200: hash_type
= HASH_TYPE_MYSQL
;
7143 salt_type
= SALT_TYPE_NONE
;
7144 attack_exec
= ATTACK_EXEC_ON_GPU
;
7146 kern_type
= KERN_TYPE_MYSQL
;
7147 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7148 parse_func
= mysql323_parse_hash
;
7149 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7150 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7157 case 300: hash_type
= HASH_TYPE_SHA1
;
7158 salt_type
= SALT_TYPE_NONE
;
7159 attack_exec
= ATTACK_EXEC_ON_GPU
;
7160 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7161 | OPTS_TYPE_PT_ADD80
7162 | OPTS_TYPE_PT_ADDBITS15
;
7163 kern_type
= KERN_TYPE_MYSQL41
;
7164 dgst_size
= DGST_SIZE_4_5
;
7165 parse_func
= sha1_parse_hash
;
7166 sort_by_digest
= sort_by_digest_4_5
;
7167 opti_type
= OPTI_TYPE_ZERO_BYTE
7168 | OPTI_TYPE_PRECOMPUTE_INIT
7169 | OPTI_TYPE_PRECOMPUTE_MERKLE
7170 | OPTI_TYPE_EARLY_SKIP
7171 | OPTI_TYPE_NOT_ITERATED
7172 | OPTI_TYPE_NOT_SALTED
;
7179 case 400: hash_type
= HASH_TYPE_MD5
;
7180 salt_type
= SALT_TYPE_EMBEDDED
;
7181 attack_exec
= ATTACK_EXEC_ON_CPU
;
7182 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7183 kern_type
= KERN_TYPE_PHPASS
;
7184 dgst_size
= DGST_SIZE_4_4
;
7185 parse_func
= phpass_parse_hash
;
7186 sort_by_digest
= sort_by_digest_4_4
;
7187 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7194 case 500: hash_type
= HASH_TYPE_MD5
;
7195 salt_type
= SALT_TYPE_EMBEDDED
;
7196 attack_exec
= ATTACK_EXEC_ON_CPU
;
7197 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7198 kern_type
= KERN_TYPE_MD5CRYPT
;
7199 dgst_size
= DGST_SIZE_4_4
;
7200 parse_func
= md5crypt_parse_hash
;
7201 sort_by_digest
= sort_by_digest_4_4
;
7202 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7209 case 501: hash_type
= HASH_TYPE_MD5
;
7210 salt_type
= SALT_TYPE_EMBEDDED
;
7211 attack_exec
= ATTACK_EXEC_ON_CPU
;
7212 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7213 | OPTS_TYPE_HASH_COPY
;
7214 kern_type
= KERN_TYPE_MD5CRYPT
;
7215 dgst_size
= DGST_SIZE_4_4
;
7216 parse_func
= juniper_parse_hash
;
7217 sort_by_digest
= sort_by_digest_4_4
;
7218 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7225 case 900: hash_type
= HASH_TYPE_MD4
;
7226 salt_type
= SALT_TYPE_NONE
;
7227 attack_exec
= ATTACK_EXEC_ON_GPU
;
7228 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7229 | OPTS_TYPE_PT_ADD80
7230 | OPTS_TYPE_PT_ADDBITS14
;
7231 kern_type
= KERN_TYPE_MD4
;
7232 dgst_size
= DGST_SIZE_4_4
;
7233 parse_func
= md4_parse_hash
;
7234 sort_by_digest
= sort_by_digest_4_4
;
7235 opti_type
= OPTI_TYPE_ZERO_BYTE
7236 | OPTI_TYPE_PRECOMPUTE_INIT
7237 | OPTI_TYPE_PRECOMPUTE_MERKLE
7238 | OPTI_TYPE_MEET_IN_MIDDLE
7239 | OPTI_TYPE_EARLY_SKIP
7240 | OPTI_TYPE_NOT_ITERATED
7241 | OPTI_TYPE_NOT_SALTED
7242 | OPTI_TYPE_RAW_HASH
;
7249 case 1000: hash_type
= HASH_TYPE_MD4
;
7250 salt_type
= SALT_TYPE_NONE
;
7251 attack_exec
= ATTACK_EXEC_ON_GPU
;
7252 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7253 | OPTS_TYPE_PT_ADD80
7254 | OPTS_TYPE_PT_ADDBITS14
7255 | OPTS_TYPE_PT_UNICODE
;
7256 kern_type
= KERN_TYPE_MD4_PWU
;
7257 dgst_size
= DGST_SIZE_4_4
;
7258 parse_func
= md4_parse_hash
;
7259 sort_by_digest
= sort_by_digest_4_4
;
7260 opti_type
= OPTI_TYPE_ZERO_BYTE
7261 | OPTI_TYPE_PRECOMPUTE_INIT
7262 | OPTI_TYPE_PRECOMPUTE_MERKLE
7263 | OPTI_TYPE_MEET_IN_MIDDLE
7264 | OPTI_TYPE_EARLY_SKIP
7265 | OPTI_TYPE_NOT_ITERATED
7266 | OPTI_TYPE_NOT_SALTED
7267 | OPTI_TYPE_RAW_HASH
;
7274 case 1100: hash_type
= HASH_TYPE_MD4
;
7275 salt_type
= SALT_TYPE_INTERN
;
7276 attack_exec
= ATTACK_EXEC_ON_GPU
;
7277 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7278 | OPTS_TYPE_PT_ADD80
7279 | OPTS_TYPE_PT_ADDBITS14
7280 | OPTS_TYPE_PT_UNICODE
7281 | OPTS_TYPE_ST_ADD80
7282 | OPTS_TYPE_ST_UNICODE
7283 | OPTS_TYPE_ST_LOWER
;
7284 kern_type
= KERN_TYPE_MD44_PWUSLT
;
7285 dgst_size
= DGST_SIZE_4_4
;
7286 parse_func
= dcc_parse_hash
;
7287 sort_by_digest
= sort_by_digest_4_4
;
7288 opti_type
= OPTI_TYPE_ZERO_BYTE
7289 | OPTI_TYPE_PRECOMPUTE_INIT
7290 | OPTI_TYPE_PRECOMPUTE_MERKLE
7291 | OPTI_TYPE_EARLY_SKIP
7292 | OPTI_TYPE_NOT_ITERATED
;
7299 case 1400: hash_type
= HASH_TYPE_SHA256
;
7300 salt_type
= SALT_TYPE_NONE
;
7301 attack_exec
= ATTACK_EXEC_ON_GPU
;
7302 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7303 | OPTS_TYPE_PT_ADD80
7304 | OPTS_TYPE_PT_ADDBITS15
;
7305 kern_type
= KERN_TYPE_SHA256
;
7306 dgst_size
= DGST_SIZE_4_8
;
7307 parse_func
= sha256_parse_hash
;
7308 sort_by_digest
= sort_by_digest_4_8
;
7309 opti_type
= OPTI_TYPE_ZERO_BYTE
7310 | OPTI_TYPE_PRECOMPUTE_INIT
7311 | OPTI_TYPE_PRECOMPUTE_MERKLE
7312 | OPTI_TYPE_EARLY_SKIP
7313 | OPTI_TYPE_NOT_ITERATED
7314 | OPTI_TYPE_NOT_SALTED
7315 | OPTI_TYPE_RAW_HASH
;
7322 case 1410: hash_type
= HASH_TYPE_SHA256
;
7323 salt_type
= SALT_TYPE_INTERN
;
7324 attack_exec
= ATTACK_EXEC_ON_GPU
;
7325 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7326 | OPTS_TYPE_ST_ADD80
7327 | OPTS_TYPE_ST_ADDBITS15
;
7328 kern_type
= KERN_TYPE_SHA256_PWSLT
;
7329 dgst_size
= DGST_SIZE_4_8
;
7330 parse_func
= sha256s_parse_hash
;
7331 sort_by_digest
= sort_by_digest_4_8
;
7332 opti_type
= OPTI_TYPE_ZERO_BYTE
7333 | OPTI_TYPE_PRECOMPUTE_INIT
7334 | OPTI_TYPE_PRECOMPUTE_MERKLE
7335 | OPTI_TYPE_EARLY_SKIP
7336 | OPTI_TYPE_NOT_ITERATED
7337 | OPTI_TYPE_APPENDED_SALT
7338 | OPTI_TYPE_RAW_HASH
;
7345 case 1420: hash_type
= HASH_TYPE_SHA256
;
7346 salt_type
= SALT_TYPE_INTERN
;
7347 attack_exec
= ATTACK_EXEC_ON_GPU
;
7348 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7349 | OPTS_TYPE_PT_ADD80
7350 | OPTS_TYPE_PT_ADDBITS15
;
7351 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7352 dgst_size
= DGST_SIZE_4_8
;
7353 parse_func
= sha256s_parse_hash
;
7354 sort_by_digest
= sort_by_digest_4_8
;
7355 opti_type
= OPTI_TYPE_ZERO_BYTE
7356 | OPTI_TYPE_PRECOMPUTE_INIT
7357 | OPTI_TYPE_PRECOMPUTE_MERKLE
7358 | OPTI_TYPE_EARLY_SKIP
7359 | OPTI_TYPE_NOT_ITERATED
7360 | OPTI_TYPE_PREPENDED_SALT
7361 | OPTI_TYPE_RAW_HASH
;
7368 case 1421: hash_type
= HASH_TYPE_SHA256
;
7369 salt_type
= SALT_TYPE_EMBEDDED
;
7370 attack_exec
= ATTACK_EXEC_ON_GPU
;
7371 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7372 | OPTS_TYPE_PT_ADD80
7373 | OPTS_TYPE_PT_ADDBITS15
;
7374 kern_type
= KERN_TYPE_SHA256_SLTPW
;
7375 dgst_size
= DGST_SIZE_4_8
;
7376 parse_func
= hmailserver_parse_hash
;
7377 sort_by_digest
= sort_by_digest_4_8
;
7378 opti_type
= OPTI_TYPE_ZERO_BYTE
7379 | OPTI_TYPE_PRECOMPUTE_INIT
7380 | OPTI_TYPE_PRECOMPUTE_MERKLE
7381 | OPTI_TYPE_EARLY_SKIP
7382 | OPTI_TYPE_NOT_ITERATED
7383 | OPTI_TYPE_PREPENDED_SALT
7384 | OPTI_TYPE_RAW_HASH
;
7391 case 1430: hash_type
= HASH_TYPE_SHA256
;
7392 salt_type
= SALT_TYPE_INTERN
;
7393 attack_exec
= ATTACK_EXEC_ON_GPU
;
7394 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7395 | OPTS_TYPE_PT_UNICODE
7396 | OPTS_TYPE_ST_ADD80
7397 | OPTS_TYPE_ST_ADDBITS15
;
7398 kern_type
= KERN_TYPE_SHA256_PWUSLT
;
7399 dgst_size
= DGST_SIZE_4_8
;
7400 parse_func
= sha256s_parse_hash
;
7401 sort_by_digest
= sort_by_digest_4_8
;
7402 opti_type
= OPTI_TYPE_ZERO_BYTE
7403 | OPTI_TYPE_PRECOMPUTE_INIT
7404 | OPTI_TYPE_PRECOMPUTE_MERKLE
7405 | OPTI_TYPE_EARLY_SKIP
7406 | OPTI_TYPE_NOT_ITERATED
7407 | OPTI_TYPE_APPENDED_SALT
7408 | OPTI_TYPE_RAW_HASH
;
7415 case 1440: hash_type
= HASH_TYPE_SHA256
;
7416 salt_type
= SALT_TYPE_INTERN
;
7417 attack_exec
= ATTACK_EXEC_ON_GPU
;
7418 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7419 | OPTS_TYPE_PT_ADD80
7420 | OPTS_TYPE_PT_ADDBITS15
7421 | OPTS_TYPE_PT_UNICODE
;
7422 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7423 dgst_size
= DGST_SIZE_4_8
;
7424 parse_func
= sha256s_parse_hash
;
7425 sort_by_digest
= sort_by_digest_4_8
;
7426 opti_type
= OPTI_TYPE_ZERO_BYTE
7427 | OPTI_TYPE_PRECOMPUTE_INIT
7428 | OPTI_TYPE_PRECOMPUTE_MERKLE
7429 | OPTI_TYPE_EARLY_SKIP
7430 | OPTI_TYPE_NOT_ITERATED
7431 | OPTI_TYPE_PREPENDED_SALT
7432 | OPTI_TYPE_RAW_HASH
;
7439 case 1441: hash_type
= HASH_TYPE_SHA256
;
7440 salt_type
= SALT_TYPE_EMBEDDED
;
7441 attack_exec
= ATTACK_EXEC_ON_GPU
;
7442 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7443 | OPTS_TYPE_PT_ADD80
7444 | OPTS_TYPE_PT_ADDBITS15
7445 | OPTS_TYPE_PT_UNICODE
7446 | OPTS_TYPE_ST_BASE64
;
7447 kern_type
= KERN_TYPE_SHA256_SLTPWU
;
7448 dgst_size
= DGST_SIZE_4_8
;
7449 parse_func
= episerver4_parse_hash
;
7450 sort_by_digest
= sort_by_digest_4_8
;
7451 opti_type
= OPTI_TYPE_ZERO_BYTE
7452 | OPTI_TYPE_PRECOMPUTE_INIT
7453 | OPTI_TYPE_PRECOMPUTE_MERKLE
7454 | OPTI_TYPE_EARLY_SKIP
7455 | OPTI_TYPE_NOT_ITERATED
7456 | OPTI_TYPE_PREPENDED_SALT
7457 | OPTI_TYPE_RAW_HASH
;
7464 case 1450: hash_type
= HASH_TYPE_SHA256
;
7465 salt_type
= SALT_TYPE_INTERN
;
7466 attack_exec
= ATTACK_EXEC_ON_GPU
;
7467 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7468 | OPTS_TYPE_ST_ADD80
;
7469 kern_type
= KERN_TYPE_HMACSHA256_PW
;
7470 dgst_size
= DGST_SIZE_4_8
;
7471 parse_func
= hmacsha256_parse_hash
;
7472 sort_by_digest
= sort_by_digest_4_8
;
7473 opti_type
= OPTI_TYPE_ZERO_BYTE
7474 | OPTI_TYPE_NOT_ITERATED
;
7481 case 1460: hash_type
= HASH_TYPE_SHA256
;
7482 salt_type
= SALT_TYPE_INTERN
;
7483 attack_exec
= ATTACK_EXEC_ON_GPU
;
7484 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7485 | OPTS_TYPE_PT_ADD80
7486 | OPTS_TYPE_PT_ADDBITS15
;
7487 kern_type
= KERN_TYPE_HMACSHA256_SLT
;
7488 dgst_size
= DGST_SIZE_4_8
;
7489 parse_func
= hmacsha256_parse_hash
;
7490 sort_by_digest
= sort_by_digest_4_8
;
7491 opti_type
= OPTI_TYPE_ZERO_BYTE
7492 | OPTI_TYPE_NOT_ITERATED
;
7499 case 1500: hash_type
= HASH_TYPE_DESCRYPT
;
7500 salt_type
= SALT_TYPE_EMBEDDED
;
7501 attack_exec
= ATTACK_EXEC_ON_GPU
;
7502 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7503 | OPTS_TYPE_PT_BITSLICE
;
7504 kern_type
= KERN_TYPE_DESCRYPT
;
7505 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7506 parse_func
= descrypt_parse_hash
;
7507 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7508 opti_type
= OPTI_TYPE_ZERO_BYTE
7509 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7516 case 1600: hash_type
= HASH_TYPE_MD5
;
7517 salt_type
= SALT_TYPE_EMBEDDED
;
7518 attack_exec
= ATTACK_EXEC_ON_CPU
;
7519 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7520 kern_type
= KERN_TYPE_APR1CRYPT
;
7521 dgst_size
= DGST_SIZE_4_4
;
7522 parse_func
= md5apr1_parse_hash
;
7523 sort_by_digest
= sort_by_digest_4_4
;
7524 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7531 case 1700: hash_type
= HASH_TYPE_SHA512
;
7532 salt_type
= SALT_TYPE_NONE
;
7533 attack_exec
= ATTACK_EXEC_ON_GPU
;
7534 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7535 | OPTS_TYPE_PT_ADD80
7536 | OPTS_TYPE_PT_ADDBITS15
;
7537 kern_type
= KERN_TYPE_SHA512
;
7538 dgst_size
= DGST_SIZE_8_8
;
7539 parse_func
= sha512_parse_hash
;
7540 sort_by_digest
= sort_by_digest_8_8
;
7541 opti_type
= OPTI_TYPE_ZERO_BYTE
7542 | OPTI_TYPE_PRECOMPUTE_INIT
7543 | OPTI_TYPE_PRECOMPUTE_MERKLE
7544 | OPTI_TYPE_EARLY_SKIP
7545 | OPTI_TYPE_NOT_ITERATED
7546 | OPTI_TYPE_NOT_SALTED
7547 | OPTI_TYPE_RAW_HASH
;
7554 case 1710: hash_type
= HASH_TYPE_SHA512
;
7555 salt_type
= SALT_TYPE_INTERN
;
7556 attack_exec
= ATTACK_EXEC_ON_GPU
;
7557 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7558 | OPTS_TYPE_ST_ADD80
7559 | OPTS_TYPE_ST_ADDBITS15
;
7560 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7561 dgst_size
= DGST_SIZE_8_8
;
7562 parse_func
= sha512s_parse_hash
;
7563 sort_by_digest
= sort_by_digest_8_8
;
7564 opti_type
= OPTI_TYPE_ZERO_BYTE
7565 | OPTI_TYPE_PRECOMPUTE_INIT
7566 | OPTI_TYPE_PRECOMPUTE_MERKLE
7567 | OPTI_TYPE_EARLY_SKIP
7568 | OPTI_TYPE_NOT_ITERATED
7569 | OPTI_TYPE_APPENDED_SALT
7570 | OPTI_TYPE_RAW_HASH
;
7577 case 1711: hash_type
= HASH_TYPE_SHA512
;
7578 salt_type
= SALT_TYPE_EMBEDDED
;
7579 attack_exec
= ATTACK_EXEC_ON_GPU
;
7580 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7581 | OPTS_TYPE_ST_ADD80
7582 | OPTS_TYPE_ST_ADDBITS15
;
7583 kern_type
= KERN_TYPE_SHA512_PWSLT
;
7584 dgst_size
= DGST_SIZE_8_8
;
7585 parse_func
= sha512b64s_parse_hash
;
7586 sort_by_digest
= sort_by_digest_8_8
;
7587 opti_type
= OPTI_TYPE_ZERO_BYTE
7588 | OPTI_TYPE_PRECOMPUTE_INIT
7589 | OPTI_TYPE_PRECOMPUTE_MERKLE
7590 | OPTI_TYPE_EARLY_SKIP
7591 | OPTI_TYPE_NOT_ITERATED
7592 | OPTI_TYPE_APPENDED_SALT
7593 | OPTI_TYPE_RAW_HASH
;
7600 case 1720: hash_type
= HASH_TYPE_SHA512
;
7601 salt_type
= SALT_TYPE_INTERN
;
7602 attack_exec
= ATTACK_EXEC_ON_GPU
;
7603 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7604 | OPTS_TYPE_PT_ADD80
7605 | OPTS_TYPE_PT_ADDBITS15
;
7606 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7607 dgst_size
= DGST_SIZE_8_8
;
7608 parse_func
= sha512s_parse_hash
;
7609 sort_by_digest
= sort_by_digest_8_8
;
7610 opti_type
= OPTI_TYPE_ZERO_BYTE
7611 | OPTI_TYPE_PRECOMPUTE_INIT
7612 | OPTI_TYPE_PRECOMPUTE_MERKLE
7613 | OPTI_TYPE_EARLY_SKIP
7614 | OPTI_TYPE_NOT_ITERATED
7615 | OPTI_TYPE_PREPENDED_SALT
7616 | OPTI_TYPE_RAW_HASH
;
7623 case 1722: hash_type
= HASH_TYPE_SHA512
;
7624 salt_type
= SALT_TYPE_EMBEDDED
;
7625 attack_exec
= ATTACK_EXEC_ON_GPU
;
7626 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7627 | OPTS_TYPE_PT_ADD80
7628 | OPTS_TYPE_PT_ADDBITS15
7630 kern_type
= KERN_TYPE_SHA512_SLTPW
;
7631 dgst_size
= DGST_SIZE_8_8
;
7632 parse_func
= osx512_parse_hash
;
7633 sort_by_digest
= sort_by_digest_8_8
;
7634 opti_type
= OPTI_TYPE_ZERO_BYTE
7635 | OPTI_TYPE_PRECOMPUTE_INIT
7636 | OPTI_TYPE_PRECOMPUTE_MERKLE
7637 | OPTI_TYPE_EARLY_SKIP
7638 | OPTI_TYPE_NOT_ITERATED
7639 | OPTI_TYPE_PREPENDED_SALT
7640 | OPTI_TYPE_RAW_HASH
;
7647 case 1730: hash_type
= HASH_TYPE_SHA512
;
7648 salt_type
= SALT_TYPE_INTERN
;
7649 attack_exec
= ATTACK_EXEC_ON_GPU
;
7650 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7651 | OPTS_TYPE_PT_UNICODE
7652 | OPTS_TYPE_ST_ADD80
7653 | OPTS_TYPE_ST_ADDBITS15
;
7654 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7655 dgst_size
= DGST_SIZE_8_8
;
7656 parse_func
= sha512s_parse_hash
;
7657 sort_by_digest
= sort_by_digest_8_8
;
7658 opti_type
= OPTI_TYPE_ZERO_BYTE
7659 | OPTI_TYPE_PRECOMPUTE_INIT
7660 | OPTI_TYPE_PRECOMPUTE_MERKLE
7661 | OPTI_TYPE_EARLY_SKIP
7662 | OPTI_TYPE_NOT_ITERATED
7663 | OPTI_TYPE_APPENDED_SALT
7664 | OPTI_TYPE_RAW_HASH
;
7671 case 1731: hash_type
= HASH_TYPE_SHA512
;
7672 salt_type
= SALT_TYPE_EMBEDDED
;
7673 attack_exec
= ATTACK_EXEC_ON_GPU
;
7674 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7675 | OPTS_TYPE_PT_UNICODE
7676 | OPTS_TYPE_ST_ADD80
7677 | OPTS_TYPE_ST_ADDBITS15
7679 kern_type
= KERN_TYPE_SHA512_PWSLTU
;
7680 dgst_size
= DGST_SIZE_8_8
;
7681 parse_func
= mssql2012_parse_hash
;
7682 sort_by_digest
= sort_by_digest_8_8
;
7683 opti_type
= OPTI_TYPE_ZERO_BYTE
7684 | OPTI_TYPE_PRECOMPUTE_INIT
7685 | OPTI_TYPE_PRECOMPUTE_MERKLE
7686 | OPTI_TYPE_EARLY_SKIP
7687 | OPTI_TYPE_NOT_ITERATED
7688 | OPTI_TYPE_APPENDED_SALT
7689 | OPTI_TYPE_RAW_HASH
;
7696 case 1740: hash_type
= HASH_TYPE_SHA512
;
7697 salt_type
= SALT_TYPE_INTERN
;
7698 attack_exec
= ATTACK_EXEC_ON_GPU
;
7699 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7700 | OPTS_TYPE_PT_ADD80
7701 | OPTS_TYPE_PT_ADDBITS15
7702 | OPTS_TYPE_PT_UNICODE
;
7703 kern_type
= KERN_TYPE_SHA512_SLTPWU
;
7704 dgst_size
= DGST_SIZE_8_8
;
7705 parse_func
= sha512s_parse_hash
;
7706 sort_by_digest
= sort_by_digest_8_8
;
7707 opti_type
= OPTI_TYPE_ZERO_BYTE
7708 | OPTI_TYPE_PRECOMPUTE_INIT
7709 | OPTI_TYPE_PRECOMPUTE_MERKLE
7710 | OPTI_TYPE_EARLY_SKIP
7711 | OPTI_TYPE_NOT_ITERATED
7712 | OPTI_TYPE_PREPENDED_SALT
7713 | OPTI_TYPE_RAW_HASH
;
7720 case 1750: hash_type
= HASH_TYPE_SHA512
;
7721 salt_type
= SALT_TYPE_INTERN
;
7722 attack_exec
= ATTACK_EXEC_ON_GPU
;
7723 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7724 | OPTS_TYPE_ST_ADD80
;
7725 kern_type
= KERN_TYPE_HMACSHA512_PW
;
7726 dgst_size
= DGST_SIZE_8_8
;
7727 parse_func
= hmacsha512_parse_hash
;
7728 sort_by_digest
= sort_by_digest_8_8
;
7729 opti_type
= OPTI_TYPE_ZERO_BYTE
7730 | OPTI_TYPE_NOT_ITERATED
;
7737 case 1760: hash_type
= HASH_TYPE_SHA512
;
7738 salt_type
= SALT_TYPE_INTERN
;
7739 attack_exec
= ATTACK_EXEC_ON_GPU
;
7740 opts_type
= OPTS_TYPE_PT_GENERATE_BE
7741 | OPTS_TYPE_PT_ADD80
7742 | OPTS_TYPE_PT_ADDBITS15
;
7743 kern_type
= KERN_TYPE_HMACSHA512_SLT
;
7744 dgst_size
= DGST_SIZE_8_8
;
7745 parse_func
= hmacsha512_parse_hash
;
7746 sort_by_digest
= sort_by_digest_8_8
;
7747 opti_type
= OPTI_TYPE_ZERO_BYTE
7748 | OPTI_TYPE_NOT_ITERATED
;
7755 case 1800: hash_type
= HASH_TYPE_SHA512
;
7756 salt_type
= SALT_TYPE_EMBEDDED
;
7757 attack_exec
= ATTACK_EXEC_ON_CPU
;
7758 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7759 kern_type
= KERN_TYPE_SHA512CRYPT
;
7760 dgst_size
= DGST_SIZE_8_8
;
7761 parse_func
= sha512crypt_parse_hash
;
7762 sort_by_digest
= sort_by_digest_8_8
;
7763 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7770 case 2100: hash_type
= HASH_TYPE_DCC2
;
7771 salt_type
= SALT_TYPE_EMBEDDED
;
7772 attack_exec
= ATTACK_EXEC_ON_CPU
;
7773 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
7774 | OPTS_TYPE_ST_LOWER
7775 | OPTS_TYPE_ST_UNICODE
;
7776 kern_type
= KERN_TYPE_DCC2
;
7777 dgst_size
= DGST_SIZE_4_4
;
7778 parse_func
= dcc2_parse_hash
;
7779 sort_by_digest
= sort_by_digest_4_4
;
7780 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7787 case 2400: hash_type
= HASH_TYPE_MD5
;
7788 salt_type
= SALT_TYPE_NONE
;
7789 attack_exec
= ATTACK_EXEC_ON_GPU
;
7790 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7791 kern_type
= KERN_TYPE_MD5PIX
;
7792 dgst_size
= DGST_SIZE_4_4
;
7793 parse_func
= md5pix_parse_hash
;
7794 sort_by_digest
= sort_by_digest_4_4
;
7795 opti_type
= OPTI_TYPE_ZERO_BYTE
7796 | OPTI_TYPE_PRECOMPUTE_INIT
7797 | OPTI_TYPE_PRECOMPUTE_MERKLE
7798 | OPTI_TYPE_EARLY_SKIP
7799 | OPTI_TYPE_NOT_ITERATED
7800 | OPTI_TYPE_NOT_SALTED
;
7807 case 2410: hash_type
= HASH_TYPE_MD5
;
7808 salt_type
= SALT_TYPE_INTERN
;
7809 attack_exec
= ATTACK_EXEC_ON_GPU
;
7810 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
7811 kern_type
= KERN_TYPE_MD5ASA
;
7812 dgst_size
= DGST_SIZE_4_4
;
7813 parse_func
= md5asa_parse_hash
;
7814 sort_by_digest
= sort_by_digest_4_4
;
7815 opti_type
= OPTI_TYPE_ZERO_BYTE
7816 | OPTI_TYPE_PRECOMPUTE_INIT
7817 | OPTI_TYPE_PRECOMPUTE_MERKLE
7818 | OPTI_TYPE_EARLY_SKIP
7819 | OPTI_TYPE_NOT_ITERATED
;
7826 case 2500: hash_type
= HASH_TYPE_WPA
;
7827 salt_type
= SALT_TYPE_EMBEDDED
;
7828 attack_exec
= ATTACK_EXEC_ON_CPU
;
7829 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
7830 kern_type
= KERN_TYPE_WPA
;
7831 dgst_size
= DGST_SIZE_4_4
;
7832 parse_func
= wpa_parse_hash
;
7833 sort_by_digest
= sort_by_digest_4_4
;
7834 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7841 case 2600: hash_type
= HASH_TYPE_MD5
;
7842 salt_type
= SALT_TYPE_VIRTUAL
;
7843 attack_exec
= ATTACK_EXEC_ON_GPU
;
7844 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7845 | OPTS_TYPE_PT_ADD80
7846 | OPTS_TYPE_PT_ADDBITS14
7847 | OPTS_TYPE_ST_ADD80
;
7848 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7849 dgst_size
= DGST_SIZE_4_4
;
7850 parse_func
= md5md5_parse_hash
;
7851 sort_by_digest
= sort_by_digest_4_4
;
7852 opti_type
= OPTI_TYPE_ZERO_BYTE
7853 | OPTI_TYPE_PRECOMPUTE_INIT
7854 | OPTI_TYPE_PRECOMPUTE_MERKLE
7855 | OPTI_TYPE_EARLY_SKIP
;
7862 case 2611: hash_type
= HASH_TYPE_MD5
;
7863 salt_type
= SALT_TYPE_INTERN
;
7864 attack_exec
= ATTACK_EXEC_ON_GPU
;
7865 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7866 | OPTS_TYPE_PT_ADD80
7867 | OPTS_TYPE_PT_ADDBITS14
7868 | OPTS_TYPE_ST_ADD80
;
7869 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7870 dgst_size
= DGST_SIZE_4_4
;
7871 parse_func
= vb3_parse_hash
;
7872 sort_by_digest
= sort_by_digest_4_4
;
7873 opti_type
= OPTI_TYPE_ZERO_BYTE
7874 | OPTI_TYPE_PRECOMPUTE_INIT
7875 | OPTI_TYPE_PRECOMPUTE_MERKLE
7876 | OPTI_TYPE_EARLY_SKIP
;
7883 case 2612: hash_type
= HASH_TYPE_MD5
;
7884 salt_type
= SALT_TYPE_EMBEDDED
;
7885 attack_exec
= ATTACK_EXEC_ON_GPU
;
7886 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7887 | OPTS_TYPE_PT_ADD80
7888 | OPTS_TYPE_PT_ADDBITS14
7889 | OPTS_TYPE_ST_ADD80
7891 kern_type
= KERN_TYPE_MD55_PWSLT1
;
7892 dgst_size
= DGST_SIZE_4_4
;
7893 parse_func
= phps_parse_hash
;
7894 sort_by_digest
= sort_by_digest_4_4
;
7895 opti_type
= OPTI_TYPE_ZERO_BYTE
7896 | OPTI_TYPE_PRECOMPUTE_INIT
7897 | OPTI_TYPE_PRECOMPUTE_MERKLE
7898 | OPTI_TYPE_EARLY_SKIP
;
7905 case 2711: hash_type
= HASH_TYPE_MD5
;
7906 salt_type
= SALT_TYPE_INTERN
;
7907 attack_exec
= ATTACK_EXEC_ON_GPU
;
7908 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7909 | OPTS_TYPE_PT_ADD80
7910 | OPTS_TYPE_PT_ADDBITS14
7911 | OPTS_TYPE_ST_ADD80
;
7912 kern_type
= KERN_TYPE_MD55_PWSLT2
;
7913 dgst_size
= DGST_SIZE_4_4
;
7914 parse_func
= vb30_parse_hash
;
7915 sort_by_digest
= sort_by_digest_4_4
;
7916 opti_type
= OPTI_TYPE_ZERO_BYTE
7917 | OPTI_TYPE_PRECOMPUTE_INIT
7918 | OPTI_TYPE_EARLY_SKIP
;
7925 case 2811: hash_type
= HASH_TYPE_MD5
;
7926 salt_type
= SALT_TYPE_INTERN
;
7927 attack_exec
= ATTACK_EXEC_ON_GPU
;
7928 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7929 | OPTS_TYPE_PT_ADD80
7930 | OPTS_TYPE_PT_ADDBITS14
;
7931 kern_type
= KERN_TYPE_MD55_SLTPW
;
7932 dgst_size
= DGST_SIZE_4_4
;
7933 parse_func
= ipb2_parse_hash
;
7934 sort_by_digest
= sort_by_digest_4_4
;
7935 opti_type
= OPTI_TYPE_ZERO_BYTE
7936 | OPTI_TYPE_PRECOMPUTE_INIT
7937 | OPTI_TYPE_EARLY_SKIP
;
7944 case 3000: hash_type
= HASH_TYPE_LM
;
7945 salt_type
= SALT_TYPE_NONE
;
7946 attack_exec
= ATTACK_EXEC_ON_GPU
;
7947 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7948 | OPTS_TYPE_PT_UPPER
7949 | OPTS_TYPE_PT_BITSLICE
;
7950 kern_type
= KERN_TYPE_LM
;
7951 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7952 parse_func
= lm_parse_hash
;
7953 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7954 opti_type
= OPTI_TYPE_ZERO_BYTE
7955 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
7962 case 3100: hash_type
= HASH_TYPE_ORACLEH
;
7963 salt_type
= SALT_TYPE_INTERN
;
7964 attack_exec
= ATTACK_EXEC_ON_GPU
;
7965 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7966 | OPTS_TYPE_PT_UPPER
7967 | OPTS_TYPE_ST_UPPER
;
7968 kern_type
= KERN_TYPE_ORACLEH
;
7969 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
7970 parse_func
= oracleh_parse_hash
;
7971 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
7972 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7979 case 3200: hash_type
= HASH_TYPE_BCRYPT
;
7980 salt_type
= SALT_TYPE_EMBEDDED
;
7981 attack_exec
= ATTACK_EXEC_ON_CPU
;
7982 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7983 | OPTS_TYPE_ST_GENERATE_LE
;
7984 kern_type
= KERN_TYPE_BCRYPT
;
7985 dgst_size
= DGST_SIZE_4_6
;
7986 parse_func
= bcrypt_parse_hash
;
7987 sort_by_digest
= sort_by_digest_4_6
;
7988 opti_type
= OPTI_TYPE_ZERO_BYTE
;
7995 case 3710: hash_type
= HASH_TYPE_MD5
;
7996 salt_type
= SALT_TYPE_INTERN
;
7997 attack_exec
= ATTACK_EXEC_ON_GPU
;
7998 opts_type
= OPTS_TYPE_PT_GENERATE_LE
7999 | OPTS_TYPE_PT_ADD80
8000 | OPTS_TYPE_PT_ADDBITS14
;
8001 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8002 dgst_size
= DGST_SIZE_4_4
;
8003 parse_func
= md5s_parse_hash
;
8004 sort_by_digest
= sort_by_digest_4_4
;
8005 opti_type
= OPTI_TYPE_ZERO_BYTE
8006 | OPTI_TYPE_PRECOMPUTE_INIT
8007 | OPTI_TYPE_PRECOMPUTE_MERKLE
8008 | OPTI_TYPE_EARLY_SKIP
;
8015 case 3711: hash_type
= HASH_TYPE_MD5
;
8016 salt_type
= SALT_TYPE_EMBEDDED
;
8017 attack_exec
= ATTACK_EXEC_ON_GPU
;
8018 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8019 | OPTS_TYPE_PT_ADD80
8020 | OPTS_TYPE_PT_ADDBITS14
;
8021 kern_type
= KERN_TYPE_MD5_SLT_MD5_PW
;
8022 dgst_size
= DGST_SIZE_4_4
;
8023 parse_func
= mediawiki_b_parse_hash
;
8024 sort_by_digest
= sort_by_digest_4_4
;
8025 opti_type
= OPTI_TYPE_ZERO_BYTE
8026 | OPTI_TYPE_PRECOMPUTE_INIT
8027 | OPTI_TYPE_PRECOMPUTE_MERKLE
8028 | OPTI_TYPE_EARLY_SKIP
;
8035 case 3800: hash_type
= HASH_TYPE_MD5
;
8036 salt_type
= SALT_TYPE_INTERN
;
8037 attack_exec
= ATTACK_EXEC_ON_GPU
;
8038 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8039 | OPTS_TYPE_ST_ADDBITS14
;
8040 kern_type
= KERN_TYPE_MD5_SLT_PW_SLT
;
8041 dgst_size
= DGST_SIZE_4_4
;
8042 parse_func
= md5s_parse_hash
;
8043 sort_by_digest
= sort_by_digest_4_4
;
8044 opti_type
= OPTI_TYPE_ZERO_BYTE
8045 | OPTI_TYPE_PRECOMPUTE_INIT
8046 | OPTI_TYPE_PRECOMPUTE_MERKLE
8047 | OPTI_TYPE_EARLY_SKIP
8048 | OPTI_TYPE_NOT_ITERATED
8049 | OPTI_TYPE_RAW_HASH
;
8056 case 4300: hash_type
= HASH_TYPE_MD5
;
8057 salt_type
= SALT_TYPE_VIRTUAL
;
8058 attack_exec
= ATTACK_EXEC_ON_GPU
;
8059 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8060 | OPTS_TYPE_PT_ADD80
8061 | OPTS_TYPE_PT_ADDBITS14
8062 | OPTS_TYPE_ST_ADD80
;
8063 kern_type
= KERN_TYPE_MD5U5_PWSLT1
;
8064 dgst_size
= DGST_SIZE_4_4
;
8065 parse_func
= md5md5_parse_hash
;
8066 sort_by_digest
= sort_by_digest_4_4
;
8067 opti_type
= OPTI_TYPE_ZERO_BYTE
8068 | OPTI_TYPE_PRECOMPUTE_INIT
8069 | OPTI_TYPE_PRECOMPUTE_MERKLE
8070 | OPTI_TYPE_EARLY_SKIP
;
8078 case 4400: hash_type
= HASH_TYPE_MD5
;
8079 salt_type
= SALT_TYPE_NONE
;
8080 attack_exec
= ATTACK_EXEC_ON_GPU
;
8081 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8082 | OPTS_TYPE_PT_ADD80
8083 | OPTS_TYPE_PT_ADDBITS15
;
8084 kern_type
= KERN_TYPE_MD5_SHA1
;
8085 dgst_size
= DGST_SIZE_4_4
;
8086 parse_func
= md5_parse_hash
;
8087 sort_by_digest
= sort_by_digest_4_4
;
8088 opti_type
= OPTI_TYPE_ZERO_BYTE
8089 | OPTI_TYPE_PRECOMPUTE_INIT
8090 | OPTI_TYPE_PRECOMPUTE_MERKLE
8091 | OPTI_TYPE_EARLY_SKIP
8092 | OPTI_TYPE_NOT_ITERATED
8093 | OPTI_TYPE_NOT_SALTED
8094 | OPTI_TYPE_RAW_HASH
;
8101 case 4500: hash_type
= HASH_TYPE_SHA1
;
8102 salt_type
= SALT_TYPE_NONE
;
8103 attack_exec
= ATTACK_EXEC_ON_GPU
;
8104 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8105 | OPTS_TYPE_PT_ADD80
8106 | OPTS_TYPE_PT_ADDBITS15
;
8107 kern_type
= KERN_TYPE_SHA11
;
8108 dgst_size
= DGST_SIZE_4_5
;
8109 parse_func
= sha1_parse_hash
;
8110 sort_by_digest
= sort_by_digest_4_5
;
8111 opti_type
= OPTI_TYPE_ZERO_BYTE
8112 | OPTI_TYPE_PRECOMPUTE_INIT
8113 | OPTI_TYPE_PRECOMPUTE_MERKLE
8114 | OPTI_TYPE_EARLY_SKIP
8115 | OPTI_TYPE_NOT_SALTED
;
8122 case 4700: hash_type
= HASH_TYPE_SHA1
;
8123 salt_type
= SALT_TYPE_NONE
;
8124 attack_exec
= ATTACK_EXEC_ON_GPU
;
8125 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8126 | OPTS_TYPE_PT_ADD80
8127 | OPTS_TYPE_PT_ADDBITS14
;
8128 kern_type
= KERN_TYPE_SHA1_MD5
;
8129 dgst_size
= DGST_SIZE_4_5
;
8130 parse_func
= sha1_parse_hash
;
8131 sort_by_digest
= sort_by_digest_4_5
;
8132 opti_type
= OPTI_TYPE_ZERO_BYTE
8133 | OPTI_TYPE_PRECOMPUTE_INIT
8134 | OPTI_TYPE_PRECOMPUTE_MERKLE
8135 | OPTI_TYPE_EARLY_SKIP
8136 | OPTI_TYPE_NOT_ITERATED
8137 | OPTI_TYPE_NOT_SALTED
8138 | OPTI_TYPE_RAW_HASH
;
8145 case 4800: hash_type
= HASH_TYPE_MD5
;
8146 salt_type
= SALT_TYPE_EMBEDDED
;
8147 attack_exec
= ATTACK_EXEC_ON_GPU
;
8148 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8149 | OPTS_TYPE_PT_ADDBITS14
;
8150 kern_type
= KERN_TYPE_MD5_CHAP
;
8151 dgst_size
= DGST_SIZE_4_4
;
8152 parse_func
= chap_parse_hash
;
8153 sort_by_digest
= sort_by_digest_4_4
;
8154 opti_type
= OPTI_TYPE_ZERO_BYTE
8155 | OPTI_TYPE_PRECOMPUTE_INIT
8156 | OPTI_TYPE_PRECOMPUTE_MERKLE
8157 | OPTI_TYPE_MEET_IN_MIDDLE
8158 | OPTI_TYPE_EARLY_SKIP
8159 | OPTI_TYPE_NOT_ITERATED
8160 | OPTI_TYPE_RAW_HASH
;
8167 case 4900: hash_type
= HASH_TYPE_SHA1
;
8168 salt_type
= SALT_TYPE_INTERN
;
8169 attack_exec
= ATTACK_EXEC_ON_GPU
;
8170 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8171 kern_type
= KERN_TYPE_SHA1_SLT_PW_SLT
;
8172 dgst_size
= DGST_SIZE_4_5
;
8173 parse_func
= sha1s_parse_hash
;
8174 sort_by_digest
= sort_by_digest_4_5
;
8175 opti_type
= OPTI_TYPE_ZERO_BYTE
8176 | OPTI_TYPE_PRECOMPUTE_INIT
8177 | OPTI_TYPE_PRECOMPUTE_MERKLE
8178 | OPTI_TYPE_EARLY_SKIP
;
8185 case 5000: hash_type
= HASH_TYPE_KECCAK
;
8186 salt_type
= SALT_TYPE_EMBEDDED
;
8187 attack_exec
= ATTACK_EXEC_ON_GPU
;
8188 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8189 | OPTS_TYPE_PT_ADD01
;
8190 kern_type
= KERN_TYPE_KECCAK
;
8191 dgst_size
= DGST_SIZE_8_25
;
8192 parse_func
= keccak_parse_hash
;
8193 sort_by_digest
= sort_by_digest_8_25
;
8194 opti_type
= OPTI_TYPE_ZERO_BYTE
8195 | OPTI_TYPE_RAW_HASH
;
8202 case 5100: hash_type
= HASH_TYPE_MD5H
;
8203 salt_type
= SALT_TYPE_NONE
;
8204 attack_exec
= ATTACK_EXEC_ON_GPU
;
8205 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8206 | OPTS_TYPE_PT_ADD80
8207 | OPTS_TYPE_PT_ADDBITS14
;
8208 kern_type
= KERN_TYPE_MD5H
;
8209 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8210 parse_func
= md5half_parse_hash
;
8211 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8212 opti_type
= OPTI_TYPE_ZERO_BYTE
8213 | OPTI_TYPE_RAW_HASH
;
8220 case 5200: hash_type
= HASH_TYPE_SHA256
;
8221 salt_type
= SALT_TYPE_EMBEDDED
;
8222 attack_exec
= ATTACK_EXEC_ON_CPU
;
8223 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8224 kern_type
= KERN_TYPE_PSAFE3
;
8225 dgst_size
= DGST_SIZE_4_8
;
8226 parse_func
= psafe3_parse_hash
;
8227 sort_by_digest
= sort_by_digest_4_8
;
8228 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8235 case 5300: hash_type
= HASH_TYPE_MD5
;
8236 salt_type
= SALT_TYPE_EMBEDDED
;
8237 attack_exec
= ATTACK_EXEC_ON_GPU
;
8238 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8239 | OPTS_TYPE_ST_ADD80
;
8240 kern_type
= KERN_TYPE_IKEPSK_MD5
;
8241 dgst_size
= DGST_SIZE_4_4
;
8242 parse_func
= ikepsk_md5_parse_hash
;
8243 sort_by_digest
= sort_by_digest_4_4
;
8244 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8251 case 5400: hash_type
= HASH_TYPE_SHA1
;
8252 salt_type
= SALT_TYPE_EMBEDDED
;
8253 attack_exec
= ATTACK_EXEC_ON_GPU
;
8254 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8255 | OPTS_TYPE_ST_ADD80
;
8256 kern_type
= KERN_TYPE_IKEPSK_SHA1
;
8257 dgst_size
= DGST_SIZE_4_5
;
8258 parse_func
= ikepsk_sha1_parse_hash
;
8259 sort_by_digest
= sort_by_digest_4_5
;
8260 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8267 case 5500: hash_type
= HASH_TYPE_NETNTLM
;
8268 salt_type
= SALT_TYPE_EMBEDDED
;
8269 attack_exec
= ATTACK_EXEC_ON_GPU
;
8270 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8271 | OPTS_TYPE_PT_ADD80
8272 | OPTS_TYPE_PT_ADDBITS14
8273 | OPTS_TYPE_PT_UNICODE
8275 kern_type
= KERN_TYPE_NETNTLMv1
;
8276 dgst_size
= DGST_SIZE_4_4
;
8277 parse_func
= netntlmv1_parse_hash
;
8278 sort_by_digest
= sort_by_digest_4_4
;
8279 opti_type
= OPTI_TYPE_ZERO_BYTE
8280 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8287 case 5600: hash_type
= HASH_TYPE_MD5
;
8288 salt_type
= SALT_TYPE_EMBEDDED
;
8289 attack_exec
= ATTACK_EXEC_ON_GPU
;
8290 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8291 | OPTS_TYPE_PT_ADD80
8292 | OPTS_TYPE_PT_ADDBITS14
8293 | OPTS_TYPE_PT_UNICODE
;
8294 kern_type
= KERN_TYPE_NETNTLMv2
;
8295 dgst_size
= DGST_SIZE_4_4
;
8296 parse_func
= netntlmv2_parse_hash
;
8297 sort_by_digest
= sort_by_digest_4_4
;
8298 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8305 case 5700: hash_type
= HASH_TYPE_SHA256
;
8306 salt_type
= SALT_TYPE_NONE
;
8307 attack_exec
= ATTACK_EXEC_ON_GPU
;
8308 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8309 | OPTS_TYPE_PT_ADD80
8310 | OPTS_TYPE_PT_ADDBITS15
;
8311 kern_type
= KERN_TYPE_SHA256
;
8312 dgst_size
= DGST_SIZE_4_8
;
8313 parse_func
= cisco4_parse_hash
;
8314 sort_by_digest
= sort_by_digest_4_8
;
8315 opti_type
= OPTI_TYPE_ZERO_BYTE
8316 | OPTI_TYPE_PRECOMPUTE_INIT
8317 | OPTI_TYPE_PRECOMPUTE_MERKLE
8318 | OPTI_TYPE_EARLY_SKIP
8319 | OPTI_TYPE_NOT_ITERATED
8320 | OPTI_TYPE_NOT_SALTED
8321 | OPTI_TYPE_RAW_HASH
;
8328 case 5800: hash_type
= HASH_TYPE_SHA1
;
8329 salt_type
= SALT_TYPE_INTERN
;
8330 attack_exec
= ATTACK_EXEC_ON_CPU
;
8331 opts_type
= OPTS_TYPE_PT_GENERATE_LE
// should be OPTS_TYPE_PT_GENERATE_BE
8332 | OPTS_TYPE_ST_ADD80
;
8333 kern_type
= KERN_TYPE_ANDROIDPIN
;
8334 dgst_size
= DGST_SIZE_4_5
;
8335 parse_func
= androidpin_parse_hash
;
8336 sort_by_digest
= sort_by_digest_4_5
;
8337 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8344 case 6000: hash_type
= HASH_TYPE_RIPEMD160
;
8345 salt_type
= SALT_TYPE_NONE
;
8346 attack_exec
= ATTACK_EXEC_ON_GPU
;
8347 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8348 | OPTS_TYPE_PT_ADD80
;
8349 kern_type
= KERN_TYPE_RIPEMD160
;
8350 dgst_size
= DGST_SIZE_4_5
;
8351 parse_func
= ripemd160_parse_hash
;
8352 sort_by_digest
= sort_by_digest_4_5
;
8353 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8360 case 6100: hash_type
= HASH_TYPE_WHIRLPOOL
;
8361 salt_type
= SALT_TYPE_NONE
;
8362 attack_exec
= ATTACK_EXEC_ON_GPU
;
8363 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8364 | OPTS_TYPE_PT_ADD80
;
8365 kern_type
= KERN_TYPE_WHIRLPOOL
;
8366 dgst_size
= DGST_SIZE_4_16
;
8367 parse_func
= whirlpool_parse_hash
;
8368 sort_by_digest
= sort_by_digest_4_16
;
8369 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8376 case 6211: hash_type
= HASH_TYPE_RIPEMD160
;
8377 salt_type
= SALT_TYPE_EMBEDDED
;
8378 attack_exec
= ATTACK_EXEC_ON_CPU
;
8379 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8380 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8381 dgst_size
= DGST_SIZE_4_5
;
8382 parse_func
= truecrypt_parse_hash_2k
;
8383 sort_by_digest
= sort_by_digest_4_5
;
8384 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8391 case 6212: hash_type
= HASH_TYPE_RIPEMD160
;
8392 salt_type
= SALT_TYPE_EMBEDDED
;
8393 attack_exec
= ATTACK_EXEC_ON_CPU
;
8394 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8395 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8396 dgst_size
= DGST_SIZE_4_5
;
8397 parse_func
= truecrypt_parse_hash_2k
;
8398 sort_by_digest
= sort_by_digest_4_5
;
8399 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8406 case 6213: hash_type
= HASH_TYPE_RIPEMD160
;
8407 salt_type
= SALT_TYPE_EMBEDDED
;
8408 attack_exec
= ATTACK_EXEC_ON_CPU
;
8409 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8410 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8411 dgst_size
= DGST_SIZE_4_5
;
8412 parse_func
= truecrypt_parse_hash_2k
;
8413 sort_by_digest
= sort_by_digest_4_5
;
8414 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8421 case 6221: hash_type
= HASH_TYPE_SHA512
;
8422 salt_type
= SALT_TYPE_EMBEDDED
;
8423 attack_exec
= ATTACK_EXEC_ON_CPU
;
8424 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8425 kern_type
= KERN_TYPE_TCSHA512_XTS512
;
8426 dgst_size
= DGST_SIZE_8_8
;
8427 parse_func
= truecrypt_parse_hash_1k
;
8428 sort_by_digest
= sort_by_digest_8_8
;
8429 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8436 case 6222: hash_type
= HASH_TYPE_SHA512
;
8437 salt_type
= SALT_TYPE_EMBEDDED
;
8438 attack_exec
= ATTACK_EXEC_ON_CPU
;
8439 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8440 kern_type
= KERN_TYPE_TCSHA512_XTS1024
;
8441 dgst_size
= DGST_SIZE_8_8
;
8442 parse_func
= truecrypt_parse_hash_1k
;
8443 sort_by_digest
= sort_by_digest_8_8
;
8444 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8451 case 6223: hash_type
= HASH_TYPE_SHA512
;
8452 salt_type
= SALT_TYPE_EMBEDDED
;
8453 attack_exec
= ATTACK_EXEC_ON_CPU
;
8454 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8455 kern_type
= KERN_TYPE_TCSHA512_XTS1536
;
8456 dgst_size
= DGST_SIZE_8_8
;
8457 parse_func
= truecrypt_parse_hash_1k
;
8458 sort_by_digest
= sort_by_digest_8_8
;
8459 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8466 case 6231: hash_type
= HASH_TYPE_WHIRLPOOL
;
8467 salt_type
= SALT_TYPE_EMBEDDED
;
8468 attack_exec
= ATTACK_EXEC_ON_CPU
;
8469 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8470 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS512
;
8471 dgst_size
= DGST_SIZE_4_8
;
8472 parse_func
= truecrypt_parse_hash_1k
;
8473 sort_by_digest
= sort_by_digest_4_8
;
8474 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8481 case 6232: hash_type
= HASH_TYPE_WHIRLPOOL
;
8482 salt_type
= SALT_TYPE_EMBEDDED
;
8483 attack_exec
= ATTACK_EXEC_ON_CPU
;
8484 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8485 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1024
;
8486 dgst_size
= DGST_SIZE_4_8
;
8487 parse_func
= truecrypt_parse_hash_1k
;
8488 sort_by_digest
= sort_by_digest_4_8
;
8489 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8496 case 6233: hash_type
= HASH_TYPE_WHIRLPOOL
;
8497 salt_type
= SALT_TYPE_EMBEDDED
;
8498 attack_exec
= ATTACK_EXEC_ON_CPU
;
8499 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8500 kern_type
= KERN_TYPE_TCWHIRLPOOL_XTS1536
;
8501 dgst_size
= DGST_SIZE_4_8
;
8502 parse_func
= truecrypt_parse_hash_1k
;
8503 sort_by_digest
= sort_by_digest_4_8
;
8504 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8511 case 6241: hash_type
= HASH_TYPE_RIPEMD160
;
8512 salt_type
= SALT_TYPE_EMBEDDED
;
8513 attack_exec
= ATTACK_EXEC_ON_CPU
;
8514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8515 kern_type
= KERN_TYPE_TCRIPEMD160_XTS512
;
8516 dgst_size
= DGST_SIZE_4_5
;
8517 parse_func
= truecrypt_parse_hash_1k
;
8518 sort_by_digest
= sort_by_digest_4_5
;
8519 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8526 case 6242: hash_type
= HASH_TYPE_RIPEMD160
;
8527 salt_type
= SALT_TYPE_EMBEDDED
;
8528 attack_exec
= ATTACK_EXEC_ON_CPU
;
8529 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8530 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1024
;
8531 dgst_size
= DGST_SIZE_4_5
;
8532 parse_func
= truecrypt_parse_hash_1k
;
8533 sort_by_digest
= sort_by_digest_4_5
;
8534 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8541 case 6243: hash_type
= HASH_TYPE_RIPEMD160
;
8542 salt_type
= SALT_TYPE_EMBEDDED
;
8543 attack_exec
= ATTACK_EXEC_ON_CPU
;
8544 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8545 kern_type
= KERN_TYPE_TCRIPEMD160_XTS1536
;
8546 dgst_size
= DGST_SIZE_4_5
;
8547 parse_func
= truecrypt_parse_hash_1k
;
8548 sort_by_digest
= sort_by_digest_4_5
;
8549 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8556 case 6300: hash_type
= HASH_TYPE_MD5
;
8557 salt_type
= SALT_TYPE_EMBEDDED
;
8558 attack_exec
= ATTACK_EXEC_ON_CPU
;
8559 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8560 kern_type
= KERN_TYPE_MD5AIX
;
8561 dgst_size
= DGST_SIZE_4_4
;
8562 parse_func
= md5aix_parse_hash
;
8563 sort_by_digest
= sort_by_digest_4_4
;
8564 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8571 case 6400: hash_type
= HASH_TYPE_SHA256
;
8572 salt_type
= SALT_TYPE_EMBEDDED
;
8573 attack_exec
= ATTACK_EXEC_ON_CPU
;
8574 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8575 kern_type
= KERN_TYPE_SHA256AIX
;
8576 dgst_size
= DGST_SIZE_4_8
;
8577 parse_func
= sha256aix_parse_hash
;
8578 sort_by_digest
= sort_by_digest_4_8
;
8579 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8586 case 6500: hash_type
= HASH_TYPE_SHA512
;
8587 salt_type
= SALT_TYPE_EMBEDDED
;
8588 attack_exec
= ATTACK_EXEC_ON_CPU
;
8589 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8590 kern_type
= KERN_TYPE_SHA512AIX
;
8591 dgst_size
= DGST_SIZE_8_8
;
8592 parse_func
= sha512aix_parse_hash
;
8593 sort_by_digest
= sort_by_digest_8_8
;
8594 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8601 case 6600: hash_type
= HASH_TYPE_AES
;
8602 salt_type
= SALT_TYPE_EMBEDDED
;
8603 attack_exec
= ATTACK_EXEC_ON_CPU
;
8604 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8605 kern_type
= KERN_TYPE_AGILEKEY
;
8606 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
8607 parse_func
= agilekey_parse_hash
;
8608 sort_by_digest
= sort_by_digest_4_5
;
8609 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8616 case 6700: hash_type
= HASH_TYPE_SHA1
;
8617 salt_type
= SALT_TYPE_EMBEDDED
;
8618 attack_exec
= ATTACK_EXEC_ON_CPU
;
8619 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8620 kern_type
= KERN_TYPE_SHA1AIX
;
8621 dgst_size
= DGST_SIZE_4_5
;
8622 parse_func
= sha1aix_parse_hash
;
8623 sort_by_digest
= sort_by_digest_4_5
;
8624 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8631 case 6800: hash_type
= HASH_TYPE_AES
;
8632 salt_type
= SALT_TYPE_EMBEDDED
;
8633 attack_exec
= ATTACK_EXEC_ON_CPU
;
8634 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8635 kern_type
= KERN_TYPE_LASTPASS
;
8636 dgst_size
= DGST_SIZE_4_8
; // because kernel uses _SHA256_
8637 parse_func
= lastpass_parse_hash
;
8638 sort_by_digest
= sort_by_digest_4_8
;
8639 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8646 case 6900: hash_type
= HASH_TYPE_GOST
;
8647 salt_type
= SALT_TYPE_NONE
;
8648 attack_exec
= ATTACK_EXEC_ON_GPU
;
8649 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8650 kern_type
= KERN_TYPE_GOST
;
8651 dgst_size
= DGST_SIZE_4_8
;
8652 parse_func
= gost_parse_hash
;
8653 sort_by_digest
= sort_by_digest_4_8
;
8654 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8661 case 7100: hash_type
= HASH_TYPE_SHA512
;
8662 salt_type
= SALT_TYPE_EMBEDDED
;
8663 attack_exec
= ATTACK_EXEC_ON_CPU
;
8664 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8665 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8666 dgst_size
= DGST_SIZE_8_16
;
8667 parse_func
= sha512osx_parse_hash
;
8668 sort_by_digest
= sort_by_digest_8_16
;
8669 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8676 case 7200: hash_type
= HASH_TYPE_SHA512
;
8677 salt_type
= SALT_TYPE_EMBEDDED
;
8678 attack_exec
= ATTACK_EXEC_ON_CPU
;
8679 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8680 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
8681 dgst_size
= DGST_SIZE_8_16
;
8682 parse_func
= sha512grub_parse_hash
;
8683 sort_by_digest
= sort_by_digest_8_16
;
8684 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8691 case 7300: hash_type
= HASH_TYPE_SHA1
;
8692 salt_type
= SALT_TYPE_EMBEDDED
;
8693 attack_exec
= ATTACK_EXEC_ON_GPU
;
8694 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8695 | OPTS_TYPE_ST_ADD80
8696 | OPTS_TYPE_ST_ADDBITS15
;
8697 kern_type
= KERN_TYPE_RAKP
;
8698 dgst_size
= DGST_SIZE_4_5
;
8699 parse_func
= rakp_parse_hash
;
8700 sort_by_digest
= sort_by_digest_4_5
;
8701 opti_type
= OPTI_TYPE_ZERO_BYTE
8702 | OPTI_TYPE_NOT_ITERATED
;
8709 case 7400: hash_type
= HASH_TYPE_SHA256
;
8710 salt_type
= SALT_TYPE_EMBEDDED
;
8711 attack_exec
= ATTACK_EXEC_ON_CPU
;
8712 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8713 kern_type
= KERN_TYPE_SHA256CRYPT
;
8714 dgst_size
= DGST_SIZE_4_8
;
8715 parse_func
= sha256crypt_parse_hash
;
8716 sort_by_digest
= sort_by_digest_4_8
;
8717 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8724 case 7500: hash_type
= HASH_TYPE_KRB5PA
;
8725 salt_type
= SALT_TYPE_EMBEDDED
;
8726 attack_exec
= ATTACK_EXEC_ON_GPU
;
8727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8728 kern_type
= KERN_TYPE_KRB5PA
;
8729 dgst_size
= DGST_SIZE_4_4
;
8730 parse_func
= krb5pa_parse_hash
;
8731 sort_by_digest
= sort_by_digest_4_4
;
8732 opti_type
= OPTI_TYPE_ZERO_BYTE
8733 | OPTI_TYPE_NOT_ITERATED
;
8740 case 7600: hash_type
= HASH_TYPE_SHA1
;
8741 salt_type
= SALT_TYPE_INTERN
;
8742 attack_exec
= ATTACK_EXEC_ON_GPU
;
8743 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8744 | OPTS_TYPE_PT_ADD80
8745 | OPTS_TYPE_PT_ADDBITS15
;
8746 kern_type
= KERN_TYPE_SHA1_SLT_SHA1_PW
;
8747 dgst_size
= DGST_SIZE_4_5
;
8748 parse_func
= redmine_parse_hash
;
8749 sort_by_digest
= sort_by_digest_4_5
;
8750 opti_type
= OPTI_TYPE_ZERO_BYTE
8751 | OPTI_TYPE_PRECOMPUTE_INIT
8752 | OPTI_TYPE_EARLY_SKIP
8753 | OPTI_TYPE_NOT_ITERATED
8754 | OPTI_TYPE_PREPENDED_SALT
;
8761 case 7700: hash_type
= HASH_TYPE_SAPB
;
8762 salt_type
= SALT_TYPE_EMBEDDED
;
8763 attack_exec
= ATTACK_EXEC_ON_GPU
;
8764 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8765 | OPTS_TYPE_PT_UPPER
8766 | OPTS_TYPE_ST_UPPER
;
8767 kern_type
= KERN_TYPE_SAPB
;
8768 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8769 parse_func
= sapb_parse_hash
;
8770 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8771 opti_type
= OPTI_TYPE_ZERO_BYTE
8772 | OPTI_TYPE_PRECOMPUTE_INIT
8773 | OPTI_TYPE_NOT_ITERATED
;
8780 case 7800: hash_type
= HASH_TYPE_SAPG
;
8781 salt_type
= SALT_TYPE_EMBEDDED
;
8782 attack_exec
= ATTACK_EXEC_ON_GPU
;
8783 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8784 | OPTS_TYPE_ST_ADD80
8785 | OPTS_TYPE_ST_UPPER
;
8786 kern_type
= KERN_TYPE_SAPG
;
8787 dgst_size
= DGST_SIZE_4_5
;
8788 parse_func
= sapg_parse_hash
;
8789 sort_by_digest
= sort_by_digest_4_5
;
8790 opti_type
= OPTI_TYPE_ZERO_BYTE
8791 | OPTI_TYPE_PRECOMPUTE_INIT
8792 | OPTI_TYPE_NOT_ITERATED
;
8799 case 7900: hash_type
= HASH_TYPE_SHA512
;
8800 salt_type
= SALT_TYPE_EMBEDDED
;
8801 attack_exec
= ATTACK_EXEC_ON_CPU
;
8802 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8803 kern_type
= KERN_TYPE_DRUPAL7
;
8804 dgst_size
= DGST_SIZE_8_8
;
8805 parse_func
= drupal7_parse_hash
;
8806 sort_by_digest
= sort_by_digest_8_8
;
8807 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8814 case 8000: hash_type
= HASH_TYPE_SHA256
;
8815 salt_type
= SALT_TYPE_EMBEDDED
;
8816 attack_exec
= ATTACK_EXEC_ON_GPU
;
8817 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8818 | OPTS_TYPE_PT_UNICODE
8819 | OPTS_TYPE_ST_ADD80
8821 kern_type
= KERN_TYPE_SYBASEASE
;
8822 dgst_size
= DGST_SIZE_4_8
;
8823 parse_func
= sybasease_parse_hash
;
8824 sort_by_digest
= sort_by_digest_4_8
;
8825 opti_type
= OPTI_TYPE_ZERO_BYTE
8826 | OPTI_TYPE_PRECOMPUTE_INIT
8827 | OPTI_TYPE_EARLY_SKIP
8828 | OPTI_TYPE_NOT_ITERATED
8829 | OPTI_TYPE_RAW_HASH
;
8836 case 8100: hash_type
= HASH_TYPE_SHA1
;
8837 salt_type
= SALT_TYPE_EMBEDDED
;
8838 attack_exec
= ATTACK_EXEC_ON_GPU
;
8839 opts_type
= OPTS_TYPE_PT_GENERATE_BE
;
8840 kern_type
= KERN_TYPE_NETSCALER
;
8841 dgst_size
= DGST_SIZE_4_5
;
8842 parse_func
= netscaler_parse_hash
;
8843 sort_by_digest
= sort_by_digest_4_5
;
8844 opti_type
= OPTI_TYPE_ZERO_BYTE
8845 | OPTI_TYPE_PRECOMPUTE_INIT
8846 | OPTI_TYPE_PRECOMPUTE_MERKLE
8847 | OPTI_TYPE_EARLY_SKIP
8848 | OPTI_TYPE_NOT_ITERATED
8849 | OPTI_TYPE_PREPENDED_SALT
8850 | OPTI_TYPE_RAW_HASH
;
8857 case 8200: hash_type
= HASH_TYPE_SHA256
;
8858 salt_type
= SALT_TYPE_EMBEDDED
;
8859 attack_exec
= ATTACK_EXEC_ON_CPU
;
8860 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
8861 kern_type
= KERN_TYPE_CLOUDKEY
;
8862 dgst_size
= DGST_SIZE_4_8
;
8863 parse_func
= cloudkey_parse_hash
;
8864 sort_by_digest
= sort_by_digest_4_8
;
8865 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8872 case 8300: hash_type
= HASH_TYPE_SHA1
;
8873 salt_type
= SALT_TYPE_EMBEDDED
;
8874 attack_exec
= ATTACK_EXEC_ON_GPU
;
8875 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8877 | OPTS_TYPE_ST_ADD80
;
8878 kern_type
= KERN_TYPE_NSEC3
;
8879 dgst_size
= DGST_SIZE_4_5
;
8880 parse_func
= nsec3_parse_hash
;
8881 sort_by_digest
= sort_by_digest_4_5
;
8882 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8889 case 8400: hash_type
= HASH_TYPE_SHA1
;
8890 salt_type
= SALT_TYPE_INTERN
;
8891 attack_exec
= ATTACK_EXEC_ON_GPU
;
8892 opts_type
= OPTS_TYPE_PT_GENERATE_BE
8893 | OPTS_TYPE_PT_ADD80
8894 | OPTS_TYPE_PT_ADDBITS15
;
8895 kern_type
= KERN_TYPE_WBB3
;
8896 dgst_size
= DGST_SIZE_4_5
;
8897 parse_func
= wbb3_parse_hash
;
8898 sort_by_digest
= sort_by_digest_4_5
;
8899 opti_type
= OPTI_TYPE_ZERO_BYTE
8900 | OPTI_TYPE_PRECOMPUTE_INIT
8901 | OPTI_TYPE_NOT_ITERATED
;
8908 case 8500: hash_type
= HASH_TYPE_DESRACF
;
8909 salt_type
= SALT_TYPE_EMBEDDED
;
8910 attack_exec
= ATTACK_EXEC_ON_GPU
;
8911 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8912 | OPTS_TYPE_ST_UPPER
;
8913 kern_type
= KERN_TYPE_RACF
;
8914 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
8915 parse_func
= racf_parse_hash
;
8916 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
8917 opti_type
= OPTI_TYPE_ZERO_BYTE
8918 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
8925 case 8600: hash_type
= HASH_TYPE_LOTUS5
;
8926 salt_type
= SALT_TYPE_NONE
;
8927 attack_exec
= ATTACK_EXEC_ON_GPU
;
8928 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8929 kern_type
= KERN_TYPE_LOTUS5
;
8930 dgst_size
= DGST_SIZE_4_4
;
8931 parse_func
= lotus5_parse_hash
;
8932 sort_by_digest
= sort_by_digest_4_4
;
8933 opti_type
= OPTI_TYPE_EARLY_SKIP
8934 | OPTI_TYPE_NOT_ITERATED
8935 | OPTI_TYPE_NOT_SALTED
8936 | OPTI_TYPE_RAW_HASH
;
8943 case 8700: hash_type
= HASH_TYPE_LOTUS6
;
8944 salt_type
= SALT_TYPE_EMBEDDED
;
8945 attack_exec
= ATTACK_EXEC_ON_GPU
;
8946 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8947 kern_type
= KERN_TYPE_LOTUS6
;
8948 dgst_size
= DGST_SIZE_4_4
;
8949 parse_func
= lotus6_parse_hash
;
8950 sort_by_digest
= sort_by_digest_4_4
;
8951 opti_type
= OPTI_TYPE_EARLY_SKIP
8952 | OPTI_TYPE_NOT_ITERATED
8953 | OPTI_TYPE_RAW_HASH
;
8960 case 8800: hash_type
= HASH_TYPE_ANDROIDFDE
;
8961 salt_type
= SALT_TYPE_EMBEDDED
;
8962 attack_exec
= ATTACK_EXEC_ON_CPU
;
8963 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8964 kern_type
= KERN_TYPE_ANDROIDFDE
;
8965 dgst_size
= DGST_SIZE_4_4
;
8966 parse_func
= androidfde_parse_hash
;
8967 sort_by_digest
= sort_by_digest_4_4
;
8968 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8975 case 8900: hash_type
= HASH_TYPE_SCRYPT
;
8976 salt_type
= SALT_TYPE_EMBEDDED
;
8977 attack_exec
= ATTACK_EXEC_ON_CPU
;
8978 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
8979 kern_type
= KERN_TYPE_SCRYPT
;
8980 dgst_size
= DGST_SIZE_4_8
;
8981 parse_func
= scrypt_parse_hash
;
8982 sort_by_digest
= sort_by_digest_4_8
;
8983 opti_type
= OPTI_TYPE_ZERO_BYTE
;
8990 case 9000: hash_type
= HASH_TYPE_SHA1
;
8991 salt_type
= SALT_TYPE_EMBEDDED
;
8992 attack_exec
= ATTACK_EXEC_ON_CPU
;
8993 opts_type
= OPTS_TYPE_PT_GENERATE_LE
8994 | OPTS_TYPE_ST_GENERATE_LE
;
8995 kern_type
= KERN_TYPE_PSAFE2
;
8996 dgst_size
= DGST_SIZE_4_5
;
8997 parse_func
= psafe2_parse_hash
;
8998 sort_by_digest
= sort_by_digest_4_5
;
8999 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9006 case 9100: hash_type
= HASH_TYPE_LOTUS8
;
9007 salt_type
= SALT_TYPE_EMBEDDED
;
9008 attack_exec
= ATTACK_EXEC_ON_CPU
;
9009 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9010 kern_type
= KERN_TYPE_LOTUS8
;
9011 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9012 parse_func
= lotus8_parse_hash
;
9013 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9014 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9021 case 9200: hash_type
= HASH_TYPE_SHA256
;
9022 salt_type
= SALT_TYPE_EMBEDDED
;
9023 attack_exec
= ATTACK_EXEC_ON_CPU
;
9024 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9025 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9026 dgst_size
= DGST_SIZE_4_32
;
9027 parse_func
= cisco8_parse_hash
;
9028 sort_by_digest
= sort_by_digest_4_32
;
9029 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9036 case 9300: hash_type
= HASH_TYPE_SCRYPT
;
9037 salt_type
= SALT_TYPE_EMBEDDED
;
9038 attack_exec
= ATTACK_EXEC_ON_CPU
;
9039 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9040 kern_type
= KERN_TYPE_SCRYPT
;
9041 dgst_size
= DGST_SIZE_4_8
;
9042 parse_func
= cisco9_parse_hash
;
9043 sort_by_digest
= sort_by_digest_4_8
;
9044 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9051 case 9400: hash_type
= HASH_TYPE_OFFICE2007
;
9052 salt_type
= SALT_TYPE_EMBEDDED
;
9053 attack_exec
= ATTACK_EXEC_ON_CPU
;
9054 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9055 kern_type
= KERN_TYPE_OFFICE2007
;
9056 dgst_size
= DGST_SIZE_4_4
;
9057 parse_func
= office2007_parse_hash
;
9058 sort_by_digest
= sort_by_digest_4_4
;
9059 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9066 case 9500: hash_type
= HASH_TYPE_OFFICE2010
;
9067 salt_type
= SALT_TYPE_EMBEDDED
;
9068 attack_exec
= ATTACK_EXEC_ON_CPU
;
9069 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9070 kern_type
= KERN_TYPE_OFFICE2010
;
9071 dgst_size
= DGST_SIZE_4_4
;
9072 parse_func
= office2010_parse_hash
;
9073 sort_by_digest
= sort_by_digest_4_4
;
9074 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9081 case 9600: hash_type
= HASH_TYPE_OFFICE2013
;
9082 salt_type
= SALT_TYPE_EMBEDDED
;
9083 attack_exec
= ATTACK_EXEC_ON_CPU
;
9084 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9085 kern_type
= KERN_TYPE_OFFICE2013
;
9086 dgst_size
= DGST_SIZE_4_4
;
9087 parse_func
= office2013_parse_hash
;
9088 sort_by_digest
= sort_by_digest_4_4
;
9089 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9096 case 9700: hash_type
= HASH_TYPE_OLDOFFICE01
;
9097 salt_type
= SALT_TYPE_EMBEDDED
;
9098 attack_exec
= ATTACK_EXEC_ON_GPU
;
9099 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9100 | OPTS_TYPE_PT_ADD80
9101 | OPTS_TYPE_PT_UNICODE
;
9102 kern_type
= KERN_TYPE_OLDOFFICE01
;
9103 dgst_size
= DGST_SIZE_4_4
;
9104 parse_func
= oldoffice01_parse_hash
;
9105 sort_by_digest
= sort_by_digest_4_4
;
9106 opti_type
= OPTI_TYPE_ZERO_BYTE
9107 | OPTI_TYPE_PRECOMPUTE_INIT
9108 | OPTI_TYPE_NOT_ITERATED
;
9115 case 9710: hash_type
= HASH_TYPE_OLDOFFICE01
;
9116 salt_type
= SALT_TYPE_EMBEDDED
;
9117 attack_exec
= ATTACK_EXEC_ON_GPU
;
9118 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9119 | OPTS_TYPE_PT_ADD80
;
9120 kern_type
= KERN_TYPE_OLDOFFICE01CM1
;
9121 dgst_size
= DGST_SIZE_4_4
;
9122 parse_func
= oldoffice01cm1_parse_hash
;
9123 sort_by_digest
= sort_by_digest_4_4
;
9124 opti_type
= OPTI_TYPE_ZERO_BYTE
9125 | OPTI_TYPE_PRECOMPUTE_INIT
9126 | OPTI_TYPE_NOT_ITERATED
;
9133 case 9720: hash_type
= HASH_TYPE_OLDOFFICE01
;
9134 salt_type
= SALT_TYPE_EMBEDDED
;
9135 attack_exec
= ATTACK_EXEC_ON_GPU
;
9136 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9137 | OPTS_TYPE_PT_ADD80
9138 | OPTS_TYPE_PT_UNICODE
9139 | OPTS_TYPE_PT_NEVERCRACK
;
9140 kern_type
= KERN_TYPE_OLDOFFICE01CM2
;
9141 dgst_size
= DGST_SIZE_4_4
;
9142 parse_func
= oldoffice01cm2_parse_hash
;
9143 sort_by_digest
= sort_by_digest_4_4
;
9144 opti_type
= OPTI_TYPE_ZERO_BYTE
9145 | OPTI_TYPE_PRECOMPUTE_INIT
9146 | OPTI_TYPE_NOT_ITERATED
;
9153 case 9800: hash_type
= HASH_TYPE_OLDOFFICE34
;
9154 salt_type
= SALT_TYPE_EMBEDDED
;
9155 attack_exec
= ATTACK_EXEC_ON_GPU
;
9156 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9157 | OPTS_TYPE_PT_ADD80
9158 | OPTS_TYPE_PT_UNICODE
;
9159 kern_type
= KERN_TYPE_OLDOFFICE34
;
9160 dgst_size
= DGST_SIZE_4_4
;
9161 parse_func
= oldoffice34_parse_hash
;
9162 sort_by_digest
= sort_by_digest_4_4
;
9163 opti_type
= OPTI_TYPE_ZERO_BYTE
9164 | OPTI_TYPE_PRECOMPUTE_INIT
9165 | OPTI_TYPE_NOT_ITERATED
;
9172 case 9810: hash_type
= HASH_TYPE_OLDOFFICE34
;
9173 salt_type
= SALT_TYPE_EMBEDDED
;
9174 attack_exec
= ATTACK_EXEC_ON_GPU
;
9175 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9176 kern_type
= KERN_TYPE_OLDOFFICE34CM1
;
9177 dgst_size
= DGST_SIZE_4_4
;
9178 parse_func
= oldoffice34cm1_parse_hash
;
9179 sort_by_digest
= sort_by_digest_4_4
;
9180 opti_type
= OPTI_TYPE_ZERO_BYTE
9181 | OPTI_TYPE_PRECOMPUTE_INIT
9182 | OPTI_TYPE_NOT_ITERATED
;
9189 case 9820: hash_type
= HASH_TYPE_OLDOFFICE34
;
9190 salt_type
= SALT_TYPE_EMBEDDED
;
9191 attack_exec
= ATTACK_EXEC_ON_GPU
;
9192 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9193 | OPTS_TYPE_PT_ADD80
9194 | OPTS_TYPE_PT_UNICODE
9195 | OPTS_TYPE_PT_NEVERCRACK
;
9196 kern_type
= KERN_TYPE_OLDOFFICE34CM2
;
9197 dgst_size
= DGST_SIZE_4_4
;
9198 parse_func
= oldoffice34cm2_parse_hash
;
9199 sort_by_digest
= sort_by_digest_4_4
;
9200 opti_type
= OPTI_TYPE_ZERO_BYTE
9201 | OPTI_TYPE_PRECOMPUTE_INIT
9202 | OPTI_TYPE_NOT_ITERATED
;
9209 case 9900: hash_type
= HASH_TYPE_MD5
;
9210 salt_type
= SALT_TYPE_NONE
;
9211 attack_exec
= ATTACK_EXEC_ON_GPU
;
9212 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9213 kern_type
= KERN_TYPE_RADMIN2
;
9214 dgst_size
= DGST_SIZE_4_4
;
9215 parse_func
= radmin2_parse_hash
;
9216 sort_by_digest
= sort_by_digest_4_4
;
9217 opti_type
= OPTI_TYPE_ZERO_BYTE
9218 | OPTI_TYPE_PRECOMPUTE_INIT
9219 | OPTI_TYPE_EARLY_SKIP
9220 | OPTI_TYPE_NOT_ITERATED
9221 | OPTI_TYPE_NOT_SALTED
;
9228 case 10000: hash_type
= HASH_TYPE_SHA256
;
9229 salt_type
= SALT_TYPE_EMBEDDED
;
9230 attack_exec
= ATTACK_EXEC_ON_CPU
;
9231 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9232 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9233 dgst_size
= DGST_SIZE_4_32
;
9234 parse_func
= djangopbkdf2_parse_hash
;
9235 sort_by_digest
= sort_by_digest_4_32
;
9236 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9243 case 10100: hash_type
= HASH_TYPE_SIPHASH
;
9244 salt_type
= SALT_TYPE_EMBEDDED
;
9245 attack_exec
= ATTACK_EXEC_ON_GPU
;
9246 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9247 kern_type
= KERN_TYPE_SIPHASH
;
9248 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9249 parse_func
= siphash_parse_hash
;
9250 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9251 opti_type
= OPTI_TYPE_ZERO_BYTE
9252 | OPTI_TYPE_NOT_ITERATED
9253 | OPTI_TYPE_RAW_HASH
;
9260 case 10200: hash_type
= HASH_TYPE_MD5
;
9261 salt_type
= SALT_TYPE_EMBEDDED
;
9262 attack_exec
= ATTACK_EXEC_ON_GPU
;
9263 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9264 | OPTS_TYPE_ST_ADD80
9265 | OPTS_TYPE_ST_ADDBITS14
;
9266 kern_type
= KERN_TYPE_HMACMD5_PW
;
9267 dgst_size
= DGST_SIZE_4_4
;
9268 parse_func
= crammd5_parse_hash
;
9269 sort_by_digest
= sort_by_digest_4_4
;
9270 opti_type
= OPTI_TYPE_ZERO_BYTE
9271 | OPTI_TYPE_NOT_ITERATED
;
9278 case 10300: hash_type
= HASH_TYPE_SHA1
;
9279 salt_type
= SALT_TYPE_EMBEDDED
;
9280 attack_exec
= ATTACK_EXEC_ON_CPU
;
9281 opts_type
= OPTS_TYPE_PT_GENERATE_LE
; // should be OPTS_TYPE_PT_GENERATE_BE
9282 kern_type
= KERN_TYPE_SAPH_SHA1
;
9283 dgst_size
= DGST_SIZE_4_5
;
9284 parse_func
= saph_sha1_parse_hash
;
9285 sort_by_digest
= sort_by_digest_4_5
;
9286 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9293 case 10400: hash_type
= HASH_TYPE_PDFU16
;
9294 salt_type
= SALT_TYPE_EMBEDDED
;
9295 attack_exec
= ATTACK_EXEC_ON_GPU
;
9296 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9297 kern_type
= KERN_TYPE_PDF11
;
9298 dgst_size
= DGST_SIZE_4_4
;
9299 parse_func
= pdf11_parse_hash
;
9300 sort_by_digest
= sort_by_digest_4_4
;
9301 opti_type
= OPTI_TYPE_ZERO_BYTE
9302 | OPTI_TYPE_NOT_ITERATED
;
9309 case 10410: hash_type
= HASH_TYPE_PDFU16
;
9310 salt_type
= SALT_TYPE_EMBEDDED
;
9311 attack_exec
= ATTACK_EXEC_ON_GPU
;
9312 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9313 kern_type
= KERN_TYPE_PDF11CM1
;
9314 dgst_size
= DGST_SIZE_4_4
;
9315 parse_func
= pdf11cm1_parse_hash
;
9316 sort_by_digest
= sort_by_digest_4_4
;
9317 opti_type
= OPTI_TYPE_ZERO_BYTE
9318 | OPTI_TYPE_NOT_ITERATED
;
9325 case 10420: hash_type
= HASH_TYPE_PDFU16
;
9326 salt_type
= SALT_TYPE_EMBEDDED
;
9327 attack_exec
= ATTACK_EXEC_ON_GPU
;
9328 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9329 kern_type
= KERN_TYPE_PDF11CM2
;
9330 dgst_size
= DGST_SIZE_4_4
;
9331 parse_func
= pdf11cm2_parse_hash
;
9332 sort_by_digest
= sort_by_digest_4_4
;
9333 opti_type
= OPTI_TYPE_ZERO_BYTE
9334 | OPTI_TYPE_NOT_ITERATED
;
9341 case 10500: hash_type
= HASH_TYPE_PDFU16
;
9342 salt_type
= SALT_TYPE_EMBEDDED
;
9343 attack_exec
= ATTACK_EXEC_ON_CPU
;
9344 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9345 kern_type
= KERN_TYPE_PDF14
;
9346 dgst_size
= DGST_SIZE_4_4
;
9347 parse_func
= pdf14_parse_hash
;
9348 sort_by_digest
= sort_by_digest_4_4
;
9349 opti_type
= OPTI_TYPE_ZERO_BYTE
9350 | OPTI_TYPE_NOT_ITERATED
;
9357 case 10600: hash_type
= HASH_TYPE_SHA256
;
9358 salt_type
= SALT_TYPE_EMBEDDED
;
9359 attack_exec
= ATTACK_EXEC_ON_GPU
;
9360 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9361 | OPTS_TYPE_ST_ADD80
9362 | OPTS_TYPE_ST_ADDBITS15
9363 | OPTS_TYPE_HASH_COPY
;
9364 kern_type
= KERN_TYPE_SHA256_PWSLT
;
9365 dgst_size
= DGST_SIZE_4_8
;
9366 parse_func
= pdf17l3_parse_hash
;
9367 sort_by_digest
= sort_by_digest_4_8
;
9368 opti_type
= OPTI_TYPE_ZERO_BYTE
9369 | OPTI_TYPE_PRECOMPUTE_INIT
9370 | OPTI_TYPE_PRECOMPUTE_MERKLE
9371 | OPTI_TYPE_EARLY_SKIP
9372 | OPTI_TYPE_NOT_ITERATED
9373 | OPTI_TYPE_APPENDED_SALT
9374 | OPTI_TYPE_RAW_HASH
;
9381 case 10700: hash_type
= HASH_TYPE_PDFU32
;
9382 salt_type
= SALT_TYPE_EMBEDDED
;
9383 attack_exec
= ATTACK_EXEC_ON_CPU
;
9384 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9385 | OPTS_TYPE_HASH_COPY
;
9386 kern_type
= KERN_TYPE_PDF17L8
;
9387 dgst_size
= DGST_SIZE_4_8
;
9388 parse_func
= pdf17l8_parse_hash
;
9389 sort_by_digest
= sort_by_digest_4_8
;
9390 opti_type
= OPTI_TYPE_ZERO_BYTE
9391 | OPTI_TYPE_NOT_ITERATED
;
9398 case 10800: hash_type
= HASH_TYPE_SHA384
;
9399 salt_type
= SALT_TYPE_NONE
;
9400 attack_exec
= ATTACK_EXEC_ON_GPU
;
9401 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9402 | OPTS_TYPE_PT_ADD80
9403 | OPTS_TYPE_PT_ADDBITS15
;
9404 kern_type
= KERN_TYPE_SHA384
;
9405 dgst_size
= DGST_SIZE_8_8
;
9406 parse_func
= sha384_parse_hash
;
9407 sort_by_digest
= sort_by_digest_8_8
;
9408 opti_type
= OPTI_TYPE_ZERO_BYTE
9409 | OPTI_TYPE_PRECOMPUTE_INIT
9410 | OPTI_TYPE_PRECOMPUTE_MERKLE
9411 | OPTI_TYPE_EARLY_SKIP
9412 | OPTI_TYPE_NOT_ITERATED
9413 | OPTI_TYPE_NOT_SALTED
9414 | OPTI_TYPE_RAW_HASH
;
9421 case 10900: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9422 salt_type
= SALT_TYPE_EMBEDDED
;
9423 attack_exec
= ATTACK_EXEC_ON_CPU
;
9424 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9425 | OPTS_TYPE_ST_BASE64
9426 | OPTS_TYPE_HASH_COPY
;
9427 kern_type
= KERN_TYPE_PBKDF2_SHA256
;
9428 dgst_size
= DGST_SIZE_4_32
;
9429 parse_func
= pbkdf2_sha256_parse_hash
;
9430 sort_by_digest
= sort_by_digest_4_32
;
9431 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9438 case 11000: hash_type
= HASH_TYPE_MD5
;
9439 salt_type
= SALT_TYPE_INTERN
;
9440 attack_exec
= ATTACK_EXEC_ON_GPU
;
9441 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9442 | OPTS_TYPE_PT_ADD80
;
9443 kern_type
= KERN_TYPE_PRESTASHOP
;
9444 dgst_size
= DGST_SIZE_4_4
;
9445 parse_func
= prestashop_parse_hash
;
9446 sort_by_digest
= sort_by_digest_4_4
;
9447 opti_type
= OPTI_TYPE_ZERO_BYTE
9448 | OPTI_TYPE_PRECOMPUTE_INIT
9449 | OPTI_TYPE_NOT_ITERATED
9450 | OPTI_TYPE_PREPENDED_SALT
;
9457 case 11100: hash_type
= HASH_TYPE_MD5
;
9458 salt_type
= SALT_TYPE_EMBEDDED
;
9459 attack_exec
= ATTACK_EXEC_ON_GPU
;
9460 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9461 | OPTS_TYPE_ST_ADD80
;
9462 kern_type
= KERN_TYPE_POSTGRESQL_AUTH
;
9463 dgst_size
= DGST_SIZE_4_4
;
9464 parse_func
= postgresql_auth_parse_hash
;
9465 sort_by_digest
= sort_by_digest_4_4
;
9466 opti_type
= OPTI_TYPE_ZERO_BYTE
9467 | OPTI_TYPE_PRECOMPUTE_INIT
9468 | OPTI_TYPE_PRECOMPUTE_MERKLE
9469 | OPTI_TYPE_EARLY_SKIP
;
9476 case 11200: hash_type
= HASH_TYPE_SHA1
;
9477 salt_type
= SALT_TYPE_EMBEDDED
;
9478 attack_exec
= ATTACK_EXEC_ON_GPU
;
9479 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9480 | OPTS_TYPE_PT_ADD80
9482 kern_type
= KERN_TYPE_MYSQL_AUTH
;
9483 dgst_size
= DGST_SIZE_4_5
;
9484 parse_func
= mysql_auth_parse_hash
;
9485 sort_by_digest
= sort_by_digest_4_5
;
9486 opti_type
= OPTI_TYPE_ZERO_BYTE
9487 | OPTI_TYPE_EARLY_SKIP
;
9494 case 11300: hash_type
= HASH_TYPE_BITCOIN_WALLET
;
9495 salt_type
= SALT_TYPE_EMBEDDED
;
9496 attack_exec
= ATTACK_EXEC_ON_CPU
;
9497 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9499 | OPTS_TYPE_ST_ADD80
;
9500 kern_type
= KERN_TYPE_BITCOIN_WALLET
;
9501 dgst_size
= DGST_SIZE_4_4
;
9502 parse_func
= bitcoin_wallet_parse_hash
;
9503 sort_by_digest
= sort_by_digest_4_4
;
9504 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9511 case 11400: hash_type
= HASH_TYPE_MD5
;
9512 salt_type
= SALT_TYPE_EMBEDDED
;
9513 attack_exec
= ATTACK_EXEC_ON_GPU
;
9514 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9515 | OPTS_TYPE_PT_ADD80
9516 | OPTS_TYPE_HASH_COPY
;
9517 kern_type
= KERN_TYPE_SIP_AUTH
;
9518 dgst_size
= DGST_SIZE_4_4
;
9519 parse_func
= sip_auth_parse_hash
;
9520 sort_by_digest
= sort_by_digest_4_4
;
9521 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9528 case 11500: hash_type
= HASH_TYPE_CRC32
;
9529 salt_type
= SALT_TYPE_INTERN
;
9530 attack_exec
= ATTACK_EXEC_ON_GPU
;
9531 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9532 | OPTS_TYPE_ST_GENERATE_LE
9534 kern_type
= KERN_TYPE_CRC32
;
9535 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9536 parse_func
= crc32_parse_hash
;
9537 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9538 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9545 case 11600: hash_type
= HASH_TYPE_AES
;
9546 salt_type
= SALT_TYPE_EMBEDDED
;
9547 attack_exec
= ATTACK_EXEC_ON_CPU
;
9548 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9549 | OPTS_TYPE_PT_NEVERCRACK
;
9550 kern_type
= KERN_TYPE_SEVEN_ZIP
;
9551 dgst_size
= DGST_SIZE_4_4
; // originally DGST_SIZE_4_2
9552 parse_func
= seven_zip_parse_hash
;
9553 sort_by_digest
= sort_by_digest_4_4
; // originally sort_by_digest_4_2
9554 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9561 case 11700: hash_type
= HASH_TYPE_GOST_2012SBOG_256
;
9562 salt_type
= SALT_TYPE_NONE
;
9563 attack_exec
= ATTACK_EXEC_ON_GPU
;
9564 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9565 | OPTS_TYPE_PT_ADD01
;
9566 kern_type
= KERN_TYPE_GOST_2012SBOG_256
;
9567 dgst_size
= DGST_SIZE_4_8
;
9568 parse_func
= gost2012sbog_256_parse_hash
;
9569 sort_by_digest
= sort_by_digest_4_8
;
9570 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9577 case 11800: hash_type
= HASH_TYPE_GOST_2012SBOG_512
;
9578 salt_type
= SALT_TYPE_NONE
;
9579 attack_exec
= ATTACK_EXEC_ON_GPU
;
9580 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9581 | OPTS_TYPE_PT_ADD01
;
9582 kern_type
= KERN_TYPE_GOST_2012SBOG_512
;
9583 dgst_size
= DGST_SIZE_4_16
;
9584 parse_func
= gost2012sbog_512_parse_hash
;
9585 sort_by_digest
= sort_by_digest_4_16
;
9586 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9593 case 11900: hash_type
= HASH_TYPE_PBKDF2_MD5
;
9594 salt_type
= SALT_TYPE_EMBEDDED
;
9595 attack_exec
= ATTACK_EXEC_ON_CPU
;
9596 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9597 | OPTS_TYPE_ST_BASE64
9598 | OPTS_TYPE_HASH_COPY
;
9599 kern_type
= KERN_TYPE_PBKDF2_MD5
;
9600 dgst_size
= DGST_SIZE_4_32
;
9601 parse_func
= pbkdf2_md5_parse_hash
;
9602 sort_by_digest
= sort_by_digest_4_32
;
9603 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9610 case 12000: hash_type
= HASH_TYPE_PBKDF2_SHA1
;
9611 salt_type
= SALT_TYPE_EMBEDDED
;
9612 attack_exec
= ATTACK_EXEC_ON_CPU
;
9613 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9614 | OPTS_TYPE_ST_BASE64
9615 | OPTS_TYPE_HASH_COPY
;
9616 kern_type
= KERN_TYPE_PBKDF2_SHA1
;
9617 dgst_size
= DGST_SIZE_4_32
;
9618 parse_func
= pbkdf2_sha1_parse_hash
;
9619 sort_by_digest
= sort_by_digest_4_32
;
9620 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9627 case 12100: hash_type
= HASH_TYPE_PBKDF2_SHA512
;
9628 salt_type
= SALT_TYPE_EMBEDDED
;
9629 attack_exec
= ATTACK_EXEC_ON_CPU
;
9630 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9631 | OPTS_TYPE_ST_BASE64
9632 | OPTS_TYPE_HASH_COPY
;
9633 kern_type
= KERN_TYPE_PBKDF2_SHA512
;
9634 dgst_size
= DGST_SIZE_8_16
;
9635 parse_func
= pbkdf2_sha512_parse_hash
;
9636 sort_by_digest
= sort_by_digest_8_16
;
9637 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9644 case 12200: hash_type
= HASH_TYPE_ECRYPTFS
;
9645 salt_type
= SALT_TYPE_EMBEDDED
;
9646 attack_exec
= ATTACK_EXEC_ON_CPU
;
9647 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9648 kern_type
= KERN_TYPE_ECRYPTFS
;
9649 dgst_size
= DGST_SIZE_8_8
;
9650 parse_func
= ecryptfs_parse_hash
;
9651 sort_by_digest
= sort_by_digest_8_8
;
9652 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9659 case 12300: hash_type
= HASH_TYPE_ORACLET
;
9660 salt_type
= SALT_TYPE_EMBEDDED
;
9661 attack_exec
= ATTACK_EXEC_ON_CPU
;
9662 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9663 kern_type
= KERN_TYPE_ORACLET
;
9664 dgst_size
= DGST_SIZE_8_16
;
9665 parse_func
= oraclet_parse_hash
;
9666 sort_by_digest
= sort_by_digest_8_16
;
9667 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9674 case 12400: hash_type
= HASH_TYPE_BSDICRYPT
;
9675 salt_type
= SALT_TYPE_EMBEDDED
;
9676 attack_exec
= ATTACK_EXEC_ON_CPU
;
9677 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9678 kern_type
= KERN_TYPE_BSDICRYPT
;
9679 dgst_size
= DGST_SIZE_4_4
;
9680 parse_func
= bsdicrypt_parse_hash
;
9681 sort_by_digest
= sort_by_digest_4_4
;
9682 opti_type
= OPTI_TYPE_ZERO_BYTE
9683 | OPTI_TYPE_PRECOMPUTE_PERMUT
;
9690 case 12500: hash_type
= HASH_TYPE_RAR3HP
;
9691 salt_type
= SALT_TYPE_EMBEDDED
;
9692 attack_exec
= ATTACK_EXEC_ON_CPU
;
9693 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9694 kern_type
= KERN_TYPE_RAR3
;
9695 dgst_size
= DGST_SIZE_4_4
;
9696 parse_func
= rar3hp_parse_hash
;
9697 sort_by_digest
= sort_by_digest_4_4
;
9698 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9705 case 12600: hash_type
= HASH_TYPE_SHA256
;
9706 salt_type
= SALT_TYPE_INTERN
;
9707 attack_exec
= ATTACK_EXEC_ON_GPU
;
9708 opts_type
= OPTS_TYPE_PT_GENERATE_BE
9709 | OPTS_TYPE_PT_ADD80
;
9710 kern_type
= KERN_TYPE_CF10
;
9711 dgst_size
= DGST_SIZE_4_8
;
9712 parse_func
= cf10_parse_hash
;
9713 sort_by_digest
= sort_by_digest_4_8
;
9714 opti_type
= OPTI_TYPE_ZERO_BYTE
9715 | OPTI_TYPE_PRECOMPUTE_INIT
9716 | OPTI_TYPE_EARLY_SKIP
9717 | OPTI_TYPE_NOT_ITERATED
;
9724 case 12700: hash_type
= HASH_TYPE_AES
;
9725 salt_type
= SALT_TYPE_EMBEDDED
;
9726 attack_exec
= ATTACK_EXEC_ON_CPU
;
9727 opts_type
= OPTS_TYPE_PT_GENERATE_LE
9728 | OPTS_TYPE_HASH_COPY
;
9729 kern_type
= KERN_TYPE_MYWALLET
;
9730 dgst_size
= DGST_SIZE_4_5
; // because kernel uses _SHA1_
9731 parse_func
= mywallet_parse_hash
;
9732 sort_by_digest
= sort_by_digest_4_5
;
9733 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9740 case 12800: hash_type
= HASH_TYPE_PBKDF2_SHA256
;
9741 salt_type
= SALT_TYPE_EMBEDDED
;
9742 attack_exec
= ATTACK_EXEC_ON_CPU
;
9743 opts_type
= OPTS_TYPE_PT_GENERATE_LE
;
9744 kern_type
= KERN_TYPE_MS_DRSR
;
9745 dgst_size
= DGST_SIZE_4_8
;
9746 parse_func
= ms_drsr_parse_hash
;
9747 sort_by_digest
= sort_by_digest_4_8
;
9748 opti_type
= OPTI_TYPE_ZERO_BYTE
;
9755 default: usage_mini_print (PROGNAME
); return (-1);
9762 data
.parse_func
= parse_func
;
9770 if (salt_type
== SALT_TYPE_INTERN
)
9772 opts_type
|= OPTS_TYPE_ST_HEX
;
9776 log_error ("ERROR: Parameter hex-salt not valid for hash-type %u", hash_mode
);
9782 uint isSalted
= ((salt_type
== SALT_TYPE_INTERN
)
9783 | (salt_type
== SALT_TYPE_EXTERN
)
9784 | (salt_type
== SALT_TYPE_EMBEDDED
)
9785 | (salt_type
== SALT_TYPE_VIRTUAL
));
9787 sort_by_digest
= sort_by_digest_p0p1
; // overruled by 64 bit digest
9789 data
.hash_type
= hash_type
;
9790 data
.attack_mode
= attack_mode
;
9791 data
.attack_kern
= attack_kern
;
9792 data
.attack_exec
= attack_exec
;
9793 data
.kern_type
= kern_type
;
9794 data
.opts_type
= opts_type
;
9795 data
.dgst_size
= dgst_size
;
9796 data
.salt_type
= salt_type
;
9797 data
.isSalted
= isSalted
;
9798 data
.sort_by_digest
= sort_by_digest
;
9799 data
.dgst_pos0
= dgst_pos0
;
9800 data
.dgst_pos1
= dgst_pos1
;
9801 data
.dgst_pos2
= dgst_pos2
;
9802 data
.dgst_pos3
= dgst_pos3
;
9808 case 2500: esalt_size
= sizeof (wpa_t
); break;
9809 case 5300: esalt_size
= sizeof (ikepsk_t
); break;
9810 case 5400: esalt_size
= sizeof (ikepsk_t
); break;
9811 case 5500: esalt_size
= sizeof (netntlm_t
); break;
9812 case 5600: esalt_size
= sizeof (netntlm_t
); break;
9824 case 6243: esalt_size
= sizeof (tc_t
); break;
9825 case 6600: esalt_size
= sizeof (agilekey_t
); break;
9826 case 7100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9827 case 7200: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9828 case 7300: esalt_size
= sizeof (rakp_t
); break;
9829 case 7500: esalt_size
= sizeof (krb5pa_t
); break;
9830 case 8200: esalt_size
= sizeof (cloudkey_t
); break;
9831 case 8800: esalt_size
= sizeof (androidfde_t
); break;
9832 case 9200: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9833 case 9400: esalt_size
= sizeof (office2007_t
); break;
9834 case 9500: esalt_size
= sizeof (office2010_t
); break;
9835 case 9600: esalt_size
= sizeof (office2013_t
); break;
9836 case 9700: esalt_size
= sizeof (oldoffice01_t
); break;
9837 case 9710: esalt_size
= sizeof (oldoffice01_t
); break;
9838 case 9720: esalt_size
= sizeof (oldoffice01_t
); break;
9839 case 9800: esalt_size
= sizeof (oldoffice34_t
); break;
9840 case 9810: esalt_size
= sizeof (oldoffice34_t
); break;
9841 case 9820: esalt_size
= sizeof (oldoffice34_t
); break;
9842 case 10000: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9843 case 10200: esalt_size
= sizeof (cram_md5_t
); break;
9844 case 10400: esalt_size
= sizeof (pdf_t
); break;
9845 case 10410: esalt_size
= sizeof (pdf_t
); break;
9846 case 10420: esalt_size
= sizeof (pdf_t
); break;
9847 case 10500: esalt_size
= sizeof (pdf_t
); break;
9848 case 10600: esalt_size
= sizeof (pdf_t
); break;
9849 case 10700: esalt_size
= sizeof (pdf_t
); break;
9850 case 10900: esalt_size
= sizeof (pbkdf2_sha256_t
); break;
9851 case 11300: esalt_size
= sizeof (bitcoin_wallet_t
); break;
9852 case 11400: esalt_size
= sizeof (sip_t
); break;
9853 case 11600: esalt_size
= sizeof (seven_zip_t
); break;
9854 case 11900: esalt_size
= sizeof (pbkdf2_md5_t
); break;
9855 case 12000: esalt_size
= sizeof (pbkdf2_sha1_t
); break;
9856 case 12100: esalt_size
= sizeof (pbkdf2_sha512_t
); break;
9859 data
.esalt_size
= esalt_size
;
9862 * choose dictionary parser
9865 if (hash_type
== HASH_TYPE_LM
)
9867 get_next_word_func
= get_next_word_lm
;
9869 else if (opts_type
& OPTS_TYPE_PT_UPPER
)
9871 get_next_word_func
= get_next_word_uc
;
9875 get_next_word_func
= get_next_word_std
;
9882 dictstat_t
*dictstat_base
= (dictstat_t
*) mycalloc (MAX_DICTSTAT
, sizeof (dictstat_t
));
9885 size_t dictstat_nmemb
= 0;
9889 uint dictstat_nmemb
= 0;
9894 FILE *dictstat_fp
= NULL
;
9898 memset (dictstat
, 0, sizeof (dictstat
));
9900 snprintf (dictstat
, sizeof (dictstat
) - 1, "%s/%s.dictstat", install_dir
, PROGNAME
);
9902 dictstat_fp
= fopen (dictstat
, "rb");
9907 struct stat tmpstat
;
9909 fstat (fileno (dictstat_fp
), &tmpstat
);
9913 struct stat64 tmpstat
;
9915 _fstat64 (fileno (dictstat_fp
), &tmpstat
);
9918 if (tmpstat
.st_mtime
< COMPTIME
)
9920 /* with v0.15 the format changed so we have to ensure user is using a good version
9921 since there is no version-header in the dictstat file */
9923 fclose (dictstat_fp
);
9929 while (!feof (dictstat_fp
))
9933 if (fread (&d
, sizeof (dictstat_t
), 1, dictstat_fp
) == 0) continue;
9935 lsearch (&d
, dictstat_base
, &dictstat_nmemb
, sizeof (dictstat_t
), sort_by_dictstat
);
9937 if (dictstat_nmemb
== (MAX_DICTSTAT
- 1000))
9939 log_error ("ERROR: There are too many entries in the %s database. You have to remove/rename it.", dictstat
);
9945 fclose (dictstat_fp
);
9956 memset (potfile
, 0, sizeof (potfile
));
9958 snprintf (potfile
, sizeof (potfile
) - 1, "%s.pot", session
);
9962 FILE *out_fp
= NULL
;
9963 FILE *pot_fp
= NULL
;
9965 if (show
== 1 || left
== 1)
9967 pot_fp
= fopen (potfile
, "rb");
9971 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
9976 if (outfile
!= NULL
)
9978 if ((out_fp
= fopen (outfile
, "ab")) == NULL
)
9980 log_error ("ERROR: %s: %s", outfile
, strerror (errno
));
9994 if (potfile_disable
== 0)
9996 pot_fp
= fopen (potfile
, "ab");
10000 log_error ("ERROR: %s: %s", potfile
, strerror (errno
));
10005 data
.pot_fp
= pot_fp
;
10012 uint pot_avail
= 0;
10014 if (show
== 1 || left
== 1)
10016 SUPPRESS_OUTPUT
= 1;
10018 pot_avail
= count_lines (pot_fp
);
10022 pot
= (pot_t
*) mycalloc (pot_avail
, sizeof (pot_t
));
10024 uint pot_hashes_avail
= 0;
10028 while (!feof (pot_fp
))
10032 char line_buf
[BUFSIZ
];
10034 int line_len
= fgetl (pot_fp
, line_buf
);
10036 if (line_len
== 0) continue;
10038 char *plain_buf
= line_buf
+ line_len
;
10040 pot_t
*pot_ptr
= &pot
[pot_cnt
];
10042 hash_t
*hashes_buf
= &pot_ptr
->hash
;
10044 // we do not initialize all hashes_buf->digest etc at the beginning, since many lines may not be
10045 // valid lines of this specific hash type (otherwise it would be more waste of memory than gain)
10047 if (pot_cnt
== pot_hashes_avail
)
10051 for (pos
= 0; pos
< INCR_POT
; pos
++)
10053 if ((pot_cnt
+ pos
) >= pot_avail
) break;
10055 pot_t
*tmp_pot
= &pot
[pot_cnt
+ pos
];
10057 hash_t
*tmp_hash
= &tmp_pot
->hash
;
10059 tmp_hash
->digest
= mymalloc (dgst_size
);
10063 tmp_hash
->salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
10068 tmp_hash
->esalt
= mymalloc (esalt_size
);
10071 pot_hashes_avail
++;
10079 int iter
= MAX_CUT_TRIES
;
10083 for (int i
= line_len
- 1; i
; i
--, plain_len
++, plain_buf
--, line_len
--)
10085 if (line_buf
[i
] == ':')
10093 if (data
.hash_mode
!= 2500)
10095 parser_status
= parse_func (line_buf
, line_len
, hashes_buf
);
10099 int max_salt_size
= sizeof (hashes_buf
->salt
->salt_buf
);
10101 if (line_len
> max_salt_size
)
10103 parser_status
= PARSER_GLOBAL_LENGTH
;
10107 memset (&hashes_buf
->salt
->salt_buf
, 0, max_salt_size
);
10109 memcpy (&hashes_buf
->salt
->salt_buf
, line_buf
, line_len
);
10111 hashes_buf
->salt
->salt_len
= line_len
;
10113 parser_status
= PARSER_OK
;
10117 // if NOT parsed without error, we add the ":" to the plain
10119 if (parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
)
10125 } while ((parser_status
== PARSER_GLOBAL_LENGTH
|| parser_status
== PARSER_HASH_LENGTH
|| parser_status
== PARSER_SALT_LENGTH
) && --iter
);
10127 if (parser_status
< PARSER_GLOBAL_ZERO
)
10129 // log_info ("WARNING: Potfile '%s' in line %u (%s): %s", potfile, line_num, line_buf, strparser (parser_status));
10134 memcpy (pot_ptr
->plain_buf
, plain_buf
, plain_len
);
10136 pot_ptr
->plain_len
= plain_len
;
10143 SUPPRESS_OUTPUT
= 0;
10145 qsort (pot
, pot_cnt
, sizeof (pot_t
), sort_by_pot
);
10149 * gpu accel and loops auto adjustment
10152 if (gpu_accel_chgd
== 0) gpu_accel
= set_gpu_accel (hash_mode
);
10153 if (gpu_loops_chgd
== 0) gpu_loops
= set_gpu_loops (hash_mode
);
10155 if (workload_profile
== 1)
10160 if (gpu_loops
== 0) gpu_loops
= 8;
10161 if (gpu_accel
== 0) gpu_accel
= 2;
10163 else if (workload_profile
== 3)
10168 if (gpu_loops
> 1024) gpu_loops
= 1024;
10169 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
10172 // those hashes *must* run at a specific gpu_loops count because of some optimization inside the kernel
10174 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
10179 if (hash_mode
== 12500)
10181 gpu_loops
= ROUNDS_RAR3
/ 16;
10184 data
.gpu_accel
= gpu_accel
;
10185 data
.gpu_loops
= gpu_loops
;
10191 uint pw_min
= PW_MIN
;
10192 uint pw_max
= PW_MAX
;
10196 case 400: if (pw_max
> 40) pw_max
= 40;
10198 case 500: if (pw_max
> 16) pw_max
= 16;
10200 case 1500: if (pw_max
> 8) pw_max
= 8;
10202 case 1600: if (pw_max
> 16) pw_max
= 16;
10204 case 1800: if (pw_max
> 16) pw_max
= 16;
10206 case 2100: if (pw_max
> 16) pw_max
= 16;
10208 case 2500: if (pw_min
< 8) pw_min
= 8;
10210 case 3000: if (pw_max
> 7) pw_max
= 7;
10212 case 5200: if (pw_max
> 24) pw_max
= 24;
10214 case 5800: if (pw_max
> 16) pw_max
= 16;
10216 case 6300: if (pw_max
> 16) pw_max
= 16;
10218 case 7400: if (pw_max
> 16) pw_max
= 16;
10220 case 7900: if (pw_max
> 48) pw_max
= 48;
10222 case 8500: if (pw_max
> 8) pw_max
= 8;
10224 case 8600: if (pw_max
> 16) pw_max
= 16;
10226 case 9710: pw_min
= 5;
10229 case 9810: pw_min
= 5;
10232 case 10410: pw_min
= 5;
10235 case 10300: if (pw_max
< 3) pw_min
= 3;
10236 if (pw_max
> 40) pw_max
= 40;
10238 case 10500: if (pw_max
< 3) pw_min
= 3;
10239 if (pw_max
> 40) pw_max
= 40;
10241 case 10700: if (pw_max
> 16) pw_max
= 16;
10243 case 11300: if (pw_max
> 40) pw_max
= 40;
10245 case 12500: if (pw_max
> 20) pw_max
= 20;
10247 case 12800: if (pw_max
> 24) pw_max
= 24;
10251 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
10253 switch (attack_kern
)
10255 case ATTACK_KERN_STRAIGHT
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10257 case ATTACK_KERN_COMBI
: if (pw_max
> PW_DICTMAX
) pw_max
= PW_DICTMAX1
;
10263 * charsets : keep them together for more easy maintainnce
10269 memset (mp_sys
, 0, sizeof (mp_sys
));
10270 memset (mp_usr
, 0, sizeof (mp_usr
));
10272 mp_setup_sys (mp_sys
);
10274 if (custom_charset_1
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
10275 if (custom_charset_2
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
10276 if (custom_charset_3
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
10277 if (custom_charset_4
) mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
10280 * load hashes, part I: find input mode, count hashes
10283 uint hashlist_mode
= 0;
10284 uint hashlist_format
= HLFMT_HASHCAT
;
10286 uint hashes_avail
= 0;
10288 if (benchmark
== 0)
10292 hashlist_mode
= (stat (myargv
[optind
], &f
) == 0) ? HL_MODE_FILE
: HL_MODE_ARG
;
10294 if ((hash_mode
== 2500) ||
10295 (hash_mode
== 5200) ||
10296 ((hash_mode
>= 6200) && (hash_mode
<= 6299)) ||
10297 (hash_mode
== 9000))
10299 hashlist_mode
= HL_MODE_ARG
;
10301 char *hashfile
= myargv
[optind
];
10303 data
.hashfile
= hashfile
;
10305 logfile_top_var_string ("target", hashfile
);
10308 if (hashlist_mode
== HL_MODE_ARG
)
10310 if (hash_mode
== 2500)
10314 if (stat (data
.hashfile
, &st
) == -1)
10316 log_error ("ERROR: %s: %s", data
.hashfile
, strerror (errno
));
10321 hashes_avail
= st
.st_size
/ sizeof (hccap_t
);
10328 else if (hashlist_mode
== HL_MODE_FILE
)
10330 char *hashfile
= myargv
[optind
];
10332 data
.hashfile
= hashfile
;
10334 logfile_top_var_string ("target", hashfile
);
10338 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10340 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10345 if (data
.quiet
== 0) log_info_nn ("Counting lines in %s", hashfile
);
10347 hashes_avail
= count_lines (fp
);
10351 if (hashes_avail
== 0)
10353 log_error ("ERROR: hashfile is empty or corrupt");
10360 hashlist_format
= hlfmt_detect (fp
, 100); // 100 = max numbers to "scan". could be hashes_avail, too
10362 if ((remove
== 1) && (hashlist_format
!= HLFMT_HASHCAT
))
10364 log_error ("ERROR: remove not supported in native hashfile-format mode");
10376 hashlist_mode
= HL_MODE_ARG
;
10381 if (hash_mode
== 3000) hashes_avail
*= 2;
10383 data
.hashlist_mode
= hashlist_mode
;
10384 data
.hashlist_format
= hashlist_format
;
10386 logfile_top_uint (hashlist_mode
);
10387 logfile_top_uint (hashlist_format
);
10390 * load hashes, part II: allocate required memory, set pointers
10393 hash_t
*hashes_buf
= NULL
;
10394 void *digests_buf
= NULL
;
10395 salt_t
*salts_buf
= NULL
;
10396 void *esalts_buf
= NULL
;
10398 hashes_buf
= (hash_t
*) mycalloc (hashes_avail
, sizeof (hash_t
));
10400 digests_buf
= (void *) mycalloc (hashes_avail
, dgst_size
);
10402 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
10406 for (hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10408 hashinfo_t
*hash_info
= (hashinfo_t
*) mymalloc (sizeof (hashinfo_t
));
10410 hashes_buf
[hash_pos
].hash_info
= hash_info
;
10412 if (username
&& (remove
|| show
|| left
))
10414 hash_info
->user
= (user_t
*) mymalloc (sizeof (user_t
));
10419 hash_info
->orighash
= (char *) mymalloc (256);
10426 salts_buf
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
10430 esalts_buf
= (void *) mycalloc (hashes_avail
, esalt_size
);
10435 salts_buf
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
10438 for (uint hash_pos
= 0; hash_pos
< hashes_avail
; hash_pos
++)
10440 hashes_buf
[hash_pos
].digest
= ((char *) digests_buf
) + (hash_pos
* dgst_size
);
10444 hashes_buf
[hash_pos
].salt
= &salts_buf
[hash_pos
];
10448 hashes_buf
[hash_pos
].esalt
= ((char *) esalts_buf
) + (hash_pos
* esalt_size
);
10453 hashes_buf
[hash_pos
].salt
= &salts_buf
[0];
10458 * load hashes, part III: parse hashes or generate them if benchmark
10461 uint hashes_cnt
= 0;
10463 if (benchmark
== 0)
10467 // useless to read hash file for keyspace, cheat a little bit w/ optind
10469 else if (hashes_avail
== 0)
10472 else if (hashlist_mode
== HL_MODE_ARG
)
10474 char *input_buf
= myargv
[optind
];
10476 uint input_len
= strlen (input_buf
);
10478 logfile_top_var_string ("target", input_buf
);
10480 char *hash_buf
= NULL
;
10483 hlfmt_hash (hashlist_format
, input_buf
, input_len
, &hash_buf
, &hash_len
);
10487 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10489 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10491 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10496 memset (hashes_buf
[0].salt
, 0, sizeof (salt_t
));
10499 int parser_status
= PARSER_OK
;
10501 if (hash_mode
== 2500)
10505 log_error ("ERROR: hccap file not specified");
10510 hashlist_mode
= HL_MODE_FILE
;
10512 data
.hashlist_mode
= hashlist_mode
;
10514 FILE *fp
= fopen (hash_buf
, "rb");
10518 log_error ("ERROR: %s: %s", hash_buf
, strerror (errno
));
10523 if (hashes_avail
< 1)
10525 log_error ("ERROR: hccap file is empty or corrupt");
10532 uint hccap_size
= sizeof (hccap_t
);
10534 char in
[hccap_size
];
10538 int n
= fread (&in
, hccap_size
, 1, fp
);
10542 if (hashes_cnt
< 1) parser_status
= PARSER_HCCAP_FILE_SIZE
;
10547 parser_status
= parse_func (in
, hccap_size
, &hashes_buf
[hashes_cnt
]);
10549 if (parser_status
!= PARSER_OK
)
10551 log_info ("WARNING: Hash '%s': %s", hash_buf
, strparser (parser_status
));
10556 // hack: append MAC1 and MAC2 s.t. in --show and --left the line matches with the .pot file format (i.e. ESSID:MAC1:MAC2)
10558 if ((show
== 1) || (left
== 1))
10560 salt_t
*tmp_salt
= hashes_buf
[hashes_cnt
].salt
;
10562 char *salt_ptr
= (char *) tmp_salt
->salt_buf
;
10564 int cur_pos
= tmp_salt
->salt_len
;
10565 int rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10567 wpa_t
*wpa
= (wpa_t
*) hashes_buf
[hashes_cnt
].esalt
;
10569 unsigned char *pke_ptr
= (unsigned char *) wpa
->pke
;
10571 // do the appending task
10573 snprintf (salt_ptr
+ cur_pos
,
10575 ":%02x%02x%02x%02x%02x%02x:%02x%02x%02x%02x%02x%02x",
10576 pke_ptr
[20], pke_ptr
[27], pke_ptr
[26], pke_ptr
[25], pke_ptr
[24], pke_ptr
[31], // MAC1
10577 pke_ptr
[30], pke_ptr
[29], pke_ptr
[28], pke_ptr
[35], pke_ptr
[34], pke_ptr
[33]); // MAC2
10580 // memset () the remaining part of the salt
10582 cur_pos
= tmp_salt
->salt_len
+ 1 + 12 + 1 + 12;
10583 rem_len
= sizeof (hashes_buf
[hashes_cnt
].salt
->salt_buf
) - cur_pos
;
10585 if (rem_len
> 0) memset (salt_ptr
+ cur_pos
, 0, rem_len
);
10587 tmp_salt
->salt_len
+= 1 + 12 + 1 + 12;
10590 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
);
10591 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
);
10598 else if (hash_mode
== 3000)
10600 if (hash_len
== 32)
10602 parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10604 hash_t
*lm_hash_left
= NULL
;
10606 if (parser_status
== PARSER_OK
)
10608 lm_hash_left
= &hashes_buf
[hashes_cnt
];
10614 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10618 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10620 hash_t
*lm_hash_right
= NULL
;
10622 if (parser_status
== PARSER_OK
)
10624 lm_hash_right
= &hashes_buf
[hashes_cnt
];
10630 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10635 if ((lm_hash_left
!= NULL
) && (lm_hash_right
!= NULL
))
10637 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
);
10638 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
);
10643 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10645 if (parser_status
== PARSER_OK
)
10647 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10648 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10651 if (parser_status
== PARSER_OK
)
10657 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10663 parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10665 if (parser_status
== PARSER_OK
)
10667 if (show
== 1) handle_show_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10668 if (left
== 1) handle_left_request (pot
, pot_cnt
, input_buf
, input_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10671 if (parser_status
== PARSER_OK
)
10677 log_info ("WARNING: Hash '%s': %s", input_buf
, strparser (parser_status
));
10682 else if (hashlist_mode
== HL_MODE_FILE
)
10684 char *hashfile
= data
.hashfile
;
10688 if ((fp
= fopen (hashfile
, "rb")) == NULL
)
10690 log_error ("ERROR: %s: %s", hashfile
, strerror (errno
));
10701 char line_buf
[BUFSIZ
];
10703 int line_len
= fgetl (fp
, line_buf
);
10705 if (line_len
== 0) continue;
10707 char *hash_buf
= NULL
;
10710 hlfmt_hash (hashlist_format
, line_buf
, line_len
, &hash_buf
, &hash_len
);
10714 char *user_buf
= NULL
;
10717 hlfmt_user (hashlist_format
, line_buf
, line_len
, &user_buf
, &user_len
);
10719 if (remove
|| show
)
10721 user_t
**user
= &hashes_buf
[hashes_cnt
].hash_info
->user
;
10723 *user
= (user_t
*) malloc (sizeof (user_t
));
10725 user_t
*user_ptr
= *user
;
10727 if (user_buf
!= NULL
)
10729 user_ptr
->user_name
= mystrdup (user_buf
);
10733 user_ptr
->user_name
= mystrdup ("");
10736 user_ptr
->user_len
= user_len
;
10740 if (opts_type
& OPTS_TYPE_HASH_COPY
)
10742 hashinfo_t
*hash_info_tmp
= hashes_buf
[hashes_cnt
].hash_info
;
10744 hash_info_tmp
->orighash
= mystrdup (hash_buf
);
10749 memset (hashes_buf
[hashes_cnt
].salt
, 0, sizeof (salt_t
));
10752 if (hash_mode
== 3000)
10754 if (hash_len
== 32)
10756 int parser_status
= parse_func (hash_buf
, 16, &hashes_buf
[hashes_cnt
]);
10758 if (parser_status
< PARSER_GLOBAL_ZERO
)
10760 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10765 hash_t
*lm_hash_left
= &hashes_buf
[hashes_cnt
];
10769 parser_status
= parse_func (hash_buf
+ 16, 16, &hashes_buf
[hashes_cnt
]);
10771 if (parser_status
< PARSER_GLOBAL_ZERO
)
10773 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10778 hash_t
*lm_hash_right
= &hashes_buf
[hashes_cnt
];
10780 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);
10786 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
);
10787 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
);
10791 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10793 if (parser_status
< PARSER_GLOBAL_ZERO
)
10795 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10800 if (data
.quiet
== 0) if ((hashes_cnt
% 0x20000) == 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_cnt
, hashes_avail
, ((float) hashes_cnt
/ hashes_avail
) * 100);
10802 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10803 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10810 int parser_status
= parse_func (hash_buf
, hash_len
, &hashes_buf
[hashes_cnt
]);
10812 if (parser_status
< PARSER_GLOBAL_ZERO
)
10814 log_info ("WARNING: Hashfile '%s' in line %u (%s): %s", data
.hashfile
, line_num
, line_buf
, strparser (parser_status
));
10819 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);
10821 if (show
== 1) handle_show_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10822 if (left
== 1) handle_left_request (pot
, pot_cnt
, line_buf
, line_len
, &hashes_buf
[hashes_cnt
], sort_by_pot
, out_fp
);
10830 if (data
.quiet
== 0) log_info_nn ("Parsed Hashes: %u/%u (%0.2f%%)", hashes_avail
, hashes_avail
, 100.00);
10832 if ((out_fp
!= NULL
) && (out_fp
!= stdout
)) fclose (out_fp
);
10839 hashes_buf
[0].salt
->salt_len
= 8;
10841 // special salt handling
10845 case 1500: hashes_buf
[0].salt
->salt_len
= 2;
10847 case 1731: hashes_buf
[0].salt
->salt_len
= 4;
10849 case 2410: hashes_buf
[0].salt
->salt_len
= 4;
10851 case 2500: memcpy (hashes_buf
[0].salt
->salt_buf
, "hashcat.net", 11);
10853 case 3100: hashes_buf
[0].salt
->salt_len
= 1;
10855 case 5000: hashes_buf
[0].salt
->keccak_mdlen
= 32;
10857 case 5800: hashes_buf
[0].salt
->salt_len
= 16;
10859 case 6800: hashes_buf
[0].salt
->salt_len
= 32;
10861 case 8400: hashes_buf
[0].salt
->salt_len
= 40;
10863 case 8800: hashes_buf
[0].salt
->salt_len
= 16;
10865 case 8900: hashes_buf
[0].salt
->salt_len
= 16;
10866 hashes_buf
[0].salt
->scrypt_N
= 1024;
10867 hashes_buf
[0].salt
->scrypt_r
= 1;
10868 hashes_buf
[0].salt
->scrypt_p
= 1;
10870 case 9100: hashes_buf
[0].salt
->salt_len
= 16;
10872 case 9300: hashes_buf
[0].salt
->salt_len
= 14;
10873 hashes_buf
[0].salt
->scrypt_N
= 16384;
10874 hashes_buf
[0].salt
->scrypt_r
= 1;
10875 hashes_buf
[0].salt
->scrypt_p
= 1;
10877 case 9400: hashes_buf
[0].salt
->salt_len
= 16;
10879 case 9500: hashes_buf
[0].salt
->salt_len
= 16;
10881 case 9600: hashes_buf
[0].salt
->salt_len
= 16;
10883 case 9700: hashes_buf
[0].salt
->salt_len
= 16;
10885 case 9710: hashes_buf
[0].salt
->salt_len
= 16;
10887 case 9720: hashes_buf
[0].salt
->salt_len
= 16;
10889 case 9800: hashes_buf
[0].salt
->salt_len
= 16;
10891 case 9810: hashes_buf
[0].salt
->salt_len
= 16;
10893 case 9820: hashes_buf
[0].salt
->salt_len
= 16;
10895 case 10300: hashes_buf
[0].salt
->salt_len
= 12;
10897 case 11500: hashes_buf
[0].salt
->salt_len
= 4;
10899 case 11600: hashes_buf
[0].salt
->salt_len
= 4;
10901 case 12400: hashes_buf
[0].salt
->salt_len
= 4;
10903 case 12500: hashes_buf
[0].salt
->salt_len
= 8;
10905 case 12600: hashes_buf
[0].salt
->salt_len
= 64;
10909 // special esalt handling
10913 case 2500: ((wpa_t
*) hashes_buf
[0].esalt
)->eapol_size
= 128;
10915 case 5300: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10916 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10918 case 5400: ((ikepsk_t
*) hashes_buf
[0].esalt
)->nr_len
= 1;
10919 ((ikepsk_t
*) hashes_buf
[0].esalt
)->msg_len
= 1;
10921 case 5500: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10922 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10923 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10924 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10926 case 5600: ((netntlm_t
*) hashes_buf
[0].esalt
)->user_len
= 1;
10927 ((netntlm_t
*) hashes_buf
[0].esalt
)->domain_len
= 1;
10928 ((netntlm_t
*) hashes_buf
[0].esalt
)->srvchall_len
= 1;
10929 ((netntlm_t
*) hashes_buf
[0].esalt
)->clichall_len
= 1;
10931 case 7300: ((rakp_t
*) hashes_buf
[0].esalt
)->salt_len
= 32;
10933 case 10400: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10934 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10935 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10937 case 10410: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10938 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10939 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10941 case 10420: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10942 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10943 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10945 case 10500: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10946 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 32;
10947 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 32;
10949 case 10600: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10950 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10951 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10953 case 10700: ((pdf_t
*) hashes_buf
[0].esalt
)->id_len
= 16;
10954 ((pdf_t
*) hashes_buf
[0].esalt
)->o_len
= 127;
10955 ((pdf_t
*) hashes_buf
[0].esalt
)->u_len
= 127;
10957 case 11600: ((seven_zip_t
*) hashes_buf
[0].esalt
)->iv_len
= 16;
10958 ((seven_zip_t
*) hashes_buf
[0].esalt
)->data_len
= 112;
10959 ((seven_zip_t
*) hashes_buf
[0].esalt
)->unpack_size
= 112;
10968 case 5200: data
.hashfile
= mystrdup ("hashcat.psafe3");
10970 case 5300: data
.hashfile
= mystrdup ("hashcat.ikemd5");
10972 case 5400: data
.hashfile
= mystrdup ("hashcat.ikesha1");
10985 case 6243: data
.hashfile
= mystrdup ("hashcat.tc");
10987 case 6600: data
.hashfile
= mystrdup ("hashcat.agilekey");
10989 case 8200: data
.hashfile
= mystrdup ("hashcat.cloudkey");
10991 case 9000: data
.hashfile
= mystrdup ("hashcat.psafe2");
10995 // set default iterations
10999 case 400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PHPASS
;
11001 case 500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11003 case 501: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11005 case 1600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11007 case 1800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512CRYPT
;
11009 case 2100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DCC2
;
11011 case 2500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_WPA2
;
11013 case 3200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BCRYPT
;
11015 case 5200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE3
;
11017 case 5800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDPIN
- 1;
11021 case 6213: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_2K
;
11025 case 6223: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11029 case 6233: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11033 case 6243: hashes_buf
[0].salt
->salt_iter
= ROUNDS_TRUECRYPT_1K
;
11035 case 6300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MD5CRYPT
;
11037 case 6400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256AIX
;
11039 case 6500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512AIX
;
11041 case 6700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA1AIX
;
11043 case 6600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_AGILEKEY
;
11045 case 6800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LASTPASS
;
11047 case 7100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA512OSX
;
11049 case 7200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_GRUB
;
11051 case 7400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SHA256CRYPT
;
11053 case 7900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DRUPAL7
;
11055 case 8200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CLOUDKEY
;
11057 case 8300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_NSEC3
;
11059 case 8800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ANDROIDFDE
;
11061 case 8900: hashes_buf
[0].salt
->salt_iter
= 1;
11063 case 9000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PSAFE2
;
11065 case 9100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_LOTUS8
;
11067 case 9200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_CISCO8
;
11069 case 9300: hashes_buf
[0].salt
->salt_iter
= 1;
11071 case 9400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2007
;
11073 case 9500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2010
;
11075 case 9600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_OFFICE2013
;
11077 case 10000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_DJANGOPBKDF2
;
11079 case 10300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SAPH_SHA1
- 1;
11081 case 10500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF14
;
11083 case 10700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PDF17L8
;
11085 case 10900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA256
- 1;
11087 case 11300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BITCOIN_WALLET
- 1;
11089 case 11600: hashes_buf
[0].salt
->salt_iter
= ROUNDS_SEVEN_ZIP
;
11091 case 11900: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_MD5
- 1;
11093 case 12000: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA1
- 1;
11095 case 12100: hashes_buf
[0].salt
->salt_iter
= ROUNDS_PBKDF2_SHA512
- 1;
11097 case 12200: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ECRYPTFS
- 1;
11099 case 12300: hashes_buf
[0].salt
->salt_iter
= ROUNDS_ORACLET
- 1;
11101 case 12400: hashes_buf
[0].salt
->salt_iter
= ROUNDS_BSDICRYPT
- 1;
11103 case 12500: hashes_buf
[0].salt
->salt_iter
= ROUNDS_RAR3
;
11105 case 12700: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MYWALLET
;
11107 case 12800: hashes_buf
[0].salt
->salt_iter
= ROUNDS_MS_DRSR
- 1;
11111 // set special tuning for benchmark-mode 1
11113 if (benchmark_mode
== 1)
11120 case 400: gpu_loops
= ROUNDS_PHPASS
;
11123 case 500: gpu_loops
= ROUNDS_MD5CRYPT
;
11126 case 501: gpu_loops
= ROUNDS_MD5CRYPT
;
11129 case 1600: gpu_loops
= ROUNDS_MD5CRYPT
;
11132 case 1800: gpu_loops
= ROUNDS_SHA512CRYPT
;
11135 case 2100: gpu_loops
= ROUNDS_DCC2
;
11138 case 2500: gpu_loops
= ROUNDS_WPA2
;
11141 case 3200: gpu_loops
= ROUNDS_BCRYPT
;
11144 case 5200: gpu_loops
= ROUNDS_PSAFE3
;
11147 case 5800: gpu_loops
= ROUNDS_ANDROIDPIN
;
11150 case 6211: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11153 case 6212: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11156 case 6213: gpu_loops
= ROUNDS_TRUECRYPT_2K
;
11159 case 6221: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11162 case 6222: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11165 case 6223: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11168 case 6231: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11171 case 6232: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11174 case 6233: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11177 case 6241: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11180 case 6242: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11183 case 6243: gpu_loops
= ROUNDS_TRUECRYPT_1K
;
11186 case 6300: gpu_loops
= ROUNDS_MD5CRYPT
;
11189 case 6700: gpu_loops
= ROUNDS_SHA1AIX
;
11192 case 6400: gpu_loops
= ROUNDS_SHA256AIX
;
11195 case 6500: gpu_loops
= ROUNDS_SHA512AIX
;
11198 case 6600: gpu_loops
= ROUNDS_AGILEKEY
;
11201 case 6800: gpu_loops
= ROUNDS_LASTPASS
;
11204 case 7100: gpu_loops
= ROUNDS_SHA512OSX
;
11207 case 7200: gpu_loops
= ROUNDS_GRUB
;
11210 case 7400: gpu_loops
= ROUNDS_SHA256CRYPT
;
11213 case 7900: gpu_loops
= ROUNDS_DRUPAL7
;
11216 case 8200: gpu_loops
= ROUNDS_CLOUDKEY
;
11219 case 8800: gpu_loops
= ROUNDS_ANDROIDFDE
;
11222 case 8900: gpu_loops
= 1;
11225 case 9000: gpu_loops
= ROUNDS_PSAFE2
;
11228 case 9100: gpu_loops
= ROUNDS_LOTUS8
;
11231 case 9200: gpu_loops
= ROUNDS_CISCO8
;
11234 case 9300: gpu_loops
= 1;
11237 case 9400: gpu_loops
= ROUNDS_OFFICE2007
;
11240 case 9500: gpu_loops
= ROUNDS_OFFICE2010
;
11243 case 9600: gpu_loops
= ROUNDS_OFFICE2013
;
11246 case 10000: gpu_loops
= ROUNDS_DJANGOPBKDF2
;
11249 case 10300: gpu_loops
= ROUNDS_SAPH_SHA1
;
11252 case 10500: gpu_loops
= ROUNDS_PDF14
;
11255 case 10700: gpu_loops
= ROUNDS_PDF17L8
;
11258 case 10900: gpu_loops
= ROUNDS_PBKDF2_SHA256
;
11261 case 11300: gpu_loops
= ROUNDS_BITCOIN_WALLET
;
11264 case 11600: gpu_loops
= ROUNDS_SEVEN_ZIP
;
11267 case 11900: gpu_loops
= ROUNDS_PBKDF2_MD5
;
11270 case 12000: gpu_loops
= ROUNDS_PBKDF2_SHA1
;
11273 case 12100: gpu_loops
= ROUNDS_PBKDF2_SHA512
;
11276 case 12200: gpu_loops
= ROUNDS_ECRYPTFS
;
11279 case 12300: gpu_loops
= ROUNDS_ORACLET
;
11282 case 12500: gpu_loops
= ROUNDS_RAR3
;
11285 case 12700: gpu_loops
= ROUNDS_MYWALLET
;
11288 case 12800: gpu_loops
= ROUNDS_MS_DRSR
;
11293 // some algorithm collide too fast, make that impossible
11297 case 11500: ((uint
*) digests_buf
)[1] = 1;
11301 if (gpu_loops
> 1024) gpu_loops
= 1024;
11302 if (gpu_accel
> 256) gpu_accel
= 256; // causes memory problems otherwise
11305 if ((opts_type
& OPTS_TYPE_PT_BITSLICE
) && (attack_mode
== ATTACK_MODE_BF
))
11310 if (hash_mode
== 12500)
11312 gpu_loops
= ROUNDS_RAR3
/ 16;
11315 data
.gpu_accel
= gpu_accel
;
11316 data
.gpu_loops
= gpu_loops
;
11321 if (show
== 1 || left
== 1)
11323 for (uint i
= 0; i
< pot_cnt
; i
++)
11325 pot_t
*pot_ptr
= &pot
[i
];
11327 hash_t
*hashes_buf
= &pot_ptr
->hash
;
11329 local_free (hashes_buf
->digest
);
11333 local_free (hashes_buf
->salt
);
11339 if (data
.quiet
== 0) log_info_nn ("");
11346 if (hashes_cnt
== 0)
11348 log_error ("ERROR: No hashes loaded");
11355 * Sanity check for hashfile vs outfile (should not point to the same physical file)
11358 if (data
.outfile
!= NULL
)
11360 if (data
.hashfile
!= NULL
)
11363 struct stat tmpstat_outfile
;
11364 struct stat tmpstat_hashfile
;
11368 struct stat64 tmpstat_outfile
;
11369 struct stat64 tmpstat_hashfile
;
11372 FILE *tmp_outfile_fp
= fopen (data
.outfile
, "r");
11374 if (tmp_outfile_fp
)
11377 fstat (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11381 _fstat64 (fileno (tmp_outfile_fp
), &tmpstat_outfile
);
11384 fclose (tmp_outfile_fp
);
11387 FILE *tmp_hashfile_fp
= fopen (data
.hashfile
, "r");
11389 if (tmp_hashfile_fp
)
11392 fstat (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11396 _fstat64 (fileno (tmp_hashfile_fp
), &tmpstat_hashfile
);
11399 fclose (tmp_hashfile_fp
);
11402 if (tmp_outfile_fp
&& tmp_outfile_fp
)
11404 tmpstat_outfile
.st_mode
= 0;
11405 tmpstat_outfile
.st_nlink
= 0;
11406 tmpstat_outfile
.st_uid
= 0;
11407 tmpstat_outfile
.st_gid
= 0;
11408 tmpstat_outfile
.st_rdev
= 0;
11409 tmpstat_outfile
.st_atime
= 0;
11411 tmpstat_hashfile
.st_mode
= 0;
11412 tmpstat_hashfile
.st_nlink
= 0;
11413 tmpstat_hashfile
.st_uid
= 0;
11414 tmpstat_hashfile
.st_gid
= 0;
11415 tmpstat_hashfile
.st_rdev
= 0;
11416 tmpstat_hashfile
.st_atime
= 0;
11419 tmpstat_outfile
.st_blksize
= 0;
11420 tmpstat_outfile
.st_blocks
= 0;
11422 tmpstat_hashfile
.st_blksize
= 0;
11423 tmpstat_hashfile
.st_blocks
= 0;
11427 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat
)) == 0)
11429 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11436 if (memcmp (&tmpstat_outfile
, &tmpstat_hashfile
, sizeof (struct stat64
)) == 0)
11438 log_error ("ERROR: Hashfile and Outfile are not allowed to point to the same file");
11448 * Remove duplicates
11451 if (data
.quiet
== 0) log_info_nn ("Removing duplicate hashes...");
11455 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11459 qsort (hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11462 uint hashes_cnt_orig
= hashes_cnt
;
11466 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt_orig
; hashes_pos
++)
11470 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) == 0)
11472 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11477 if (sort_by_digest (hashes_buf
[hashes_pos
].digest
, hashes_buf
[hashes_pos
- 1].digest
) == 0) continue;
11480 if (hashes_pos
> hashes_cnt
)
11482 memcpy (&hashes_buf
[hashes_cnt
], &hashes_buf
[hashes_pos
], sizeof (hash_t
));
11492 uint potfile_remove_cracks
= 0;
11494 if (potfile_disable
== 0)
11498 hash_buf
.digest
= mymalloc (dgst_size
);
11499 hash_buf
.salt
= NULL
;
11500 hash_buf
.esalt
= NULL
;
11501 hash_buf
.hash_info
= NULL
;
11502 hash_buf
.cracked
= 0;
11506 hash_buf
.salt
= (salt_t
*) mymalloc (sizeof (salt_t
));
11511 hash_buf
.esalt
= mymalloc (esalt_size
);
11514 if (quiet
== 0) log_info_nn ("Comparing hashes with potfile entries...");
11516 // no solution for these special hash types (for instane because they use hashfile in output etc)
11517 if ((hash_mode
!= 5200) &&
11518 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
11519 (hash_mode
!= 9000))
11521 FILE *fp
= fopen (potfile
, "rb");
11527 char line_buf
[BUFSIZ
];
11529 memset (line_buf
, 0, BUFSIZ
);
11531 char *ptr
= fgets (line_buf
, BUFSIZ
- 1, fp
);
11533 if (ptr
== NULL
) break;
11535 int line_len
= strlen (line_buf
);
11537 if (line_len
== 0) continue;
11539 int iter
= MAX_CUT_TRIES
;
11541 for (int i
= line_len
- 1; i
&& iter
; i
--, line_len
--)
11543 if (line_buf
[i
] != ':') continue;
11547 memset (hash_buf
.salt
, 0, sizeof (salt_t
));
11550 hash_t
*found
= NULL
;
11552 if (hash_mode
== 6800)
11554 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11556 // manipulate salt_buf
11557 memcpy (hash_buf
.salt
->salt_buf
, line_buf
, i
);
11559 hash_buf
.salt
->salt_len
= i
;
11561 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt
);
11564 else if (hash_mode
== 2500)
11566 if (i
< 48) // 48 = 12 * uint in salt_buf[]
11568 // here we have in line_buf: ESSID:MAC1:MAC2 (without the plain)
11569 // manipulate salt_buf
11571 // to be safe work with a copy (because of line_len loop, i etc)
11573 char line_buf_cpy
[BUFSIZ
];
11574 memset (line_buf_cpy
, 0, BUFSIZ
);
11576 memset (line_buf_cpy
, 0, sizeof (line_buf_cpy
));
11578 memcpy (line_buf_cpy
, line_buf
, i
);
11580 char *mac2_pos
= strrchr (line_buf_cpy
, ':');
11582 if (mac2_pos
== NULL
) continue;
11587 if (strlen (mac2_pos
) != 12) continue;
11589 char *mac1_pos
= strrchr (line_buf_cpy
, ':');
11591 if (mac1_pos
== NULL
) continue;
11596 if (strlen (mac1_pos
) != 12) continue;
11598 uint essid_length
= mac1_pos
- line_buf_cpy
- 1;
11600 // here we need the ESSID
11601 memcpy (hash_buf
.salt
->salt_buf
, line_buf_cpy
, essid_length
);
11603 hash_buf
.salt
->salt_len
= essid_length
;
11605 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_t_salt_hccap
);
11609 wpa_t
*wpa
= (wpa_t
*) found
->esalt
;
11613 char *pke_ptr
= (char *) pke
;
11615 for (uint i
= 0; i
< 25; i
++)
11617 pke
[i
] = byte_swap_32 (wpa
->pke
[i
]);
11620 unsigned char mac1
[6];
11621 unsigned char mac2
[6];
11623 memcpy (mac1
, pke_ptr
+ 23, 6);
11624 memcpy (mac2
, pke_ptr
+ 29, 6);
11626 // compare hex string(s) vs binary MAC address(es)
11628 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11630 if (mac1
[i
] != (unsigned char) hex_to_char (&mac1_pos
[j
]))
11638 if (!found
) continue;
11640 for (uint i
= 0, j
= 0; i
< 6; i
++, j
+= 2)
11642 if (mac2
[i
] != (unsigned char) hex_to_char (&mac2_pos
[j
]))
11653 int parser_status
= parse_func (line_buf
, line_len
- 1, &hash_buf
);
11655 if (parser_status
== PARSER_OK
)
11659 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash
);
11663 found
= (hash_t
*) bsearch (&hash_buf
, hashes_buf
, hashes_cnt
, sizeof (hash_t
), sort_by_hash_no_salt
);
11668 if (found
== NULL
) continue;
11670 if (!found
->cracked
) potfile_remove_cracks
++;
11672 found
->cracked
= 1;
11686 local_free (hash_buf
.esalt
);
11691 local_free (hash_buf
.salt
);
11694 local_free (hash_buf
.digest
);
11698 * Now generate all the buffers required for later
11701 void *digests_buf_new
= (void *) mycalloc (hashes_avail
, dgst_size
);
11703 salt_t
*salts_buf_new
= NULL
;
11704 void *esalts_buf_new
= NULL
;
11708 salts_buf_new
= (salt_t
*) mycalloc (hashes_avail
, sizeof (salt_t
));
11712 esalts_buf_new
= (void *) mycalloc (hashes_avail
, esalt_size
);
11717 salts_buf_new
= (salt_t
*) mycalloc (1, sizeof (salt_t
));
11720 if (data
.quiet
== 0) log_info_nn ("Structuring salts for cracking task...");
11722 uint digests_cnt
= hashes_cnt
;
11723 uint digests_done
= 0;
11725 uint size_digests
= digests_cnt
* dgst_size
;
11726 uint size_shown
= digests_cnt
* sizeof (uint
);
11728 uint
*digests_shown
= (uint
*) mymalloc (size_shown
);
11729 uint
*digests_shown_tmp
= (uint
*) mymalloc (size_shown
);
11731 uint salts_cnt
= 0;
11732 uint salts_done
= 0;
11734 hashinfo_t
**hash_info
= NULL
;
11736 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11738 hash_info
= (hashinfo_t
**) mymalloc (hashes_cnt
* sizeof (hashinfo_t
*));
11740 if (username
&& (remove
|| show
))
11744 for (user_pos
= 0; user_pos
< hashes_cnt
; user_pos
++)
11746 hash_info
[user_pos
] = (hashinfo_t
*) mycalloc (hashes_cnt
, sizeof (hashinfo_t
));
11748 hash_info
[user_pos
]->user
= (user_t
*) mymalloc (sizeof (user_t
));
11753 uint
*salts_shown
= (uint
*) mymalloc (size_shown
);
11758 // copied from inner loop
11760 salt_buf
= &salts_buf_new
[salts_cnt
];
11762 memcpy (salt_buf
, hashes_buf
[0].salt
, sizeof (salt_t
));
11766 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[0].esalt
, esalt_size
);
11769 salt_buf
->digests_cnt
= 0;
11770 salt_buf
->digests_done
= 0;
11771 salt_buf
->digests_offset
= 0;
11776 if (hashes_buf
[0].cracked
== 1)
11778 digests_shown
[0] = 1;
11782 salt_buf
->digests_done
++;
11785 salt_buf
->digests_cnt
++;
11787 memcpy (((char *) digests_buf_new
) + (0 * dgst_size
), hashes_buf
[0].digest
, dgst_size
);
11789 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11791 hash_info
[0] = hashes_buf
[0].hash_info
;
11794 // copy from inner loop
11796 for (uint hashes_pos
= 1; hashes_pos
< hashes_cnt
; hashes_pos
++)
11800 if (sort_by_salt (hashes_buf
[hashes_pos
].salt
, hashes_buf
[hashes_pos
- 1].salt
) != 0)
11802 salt_buf
= &salts_buf_new
[salts_cnt
];
11804 memcpy (salt_buf
, hashes_buf
[hashes_pos
].salt
, sizeof (salt_t
));
11808 memcpy (((char *) esalts_buf_new
) + (salts_cnt
* esalt_size
), hashes_buf
[hashes_pos
].esalt
, esalt_size
);
11811 salt_buf
->digests_cnt
= 0;
11812 salt_buf
->digests_done
= 0;
11813 salt_buf
->digests_offset
= hashes_pos
;
11819 if (hashes_buf
[hashes_pos
].cracked
== 1)
11821 digests_shown
[hashes_pos
] = 1;
11825 salt_buf
->digests_done
++;
11828 salt_buf
->digests_cnt
++;
11830 memcpy (((char *) digests_buf_new
) + (hashes_pos
* dgst_size
), hashes_buf
[hashes_pos
].digest
, dgst_size
);
11832 if ((username
&& (remove
|| show
)) || (opts_type
& OPTS_TYPE_HASH_COPY
))
11834 hash_info
[hashes_pos
] = hashes_buf
[hashes_pos
].hash_info
;
11838 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
11840 salt_t
*salt_buf
= &salts_buf_new
[salt_pos
];
11842 if (salt_buf
->digests_done
== salt_buf
->digests_cnt
)
11844 salts_shown
[salt_pos
] = 1;
11849 if (salts_done
== salts_cnt
) data
.devices_status
= STATUS_CRACKED
;
11852 local_free (digests_buf
);
11853 local_free (salts_buf
);
11854 local_free (esalts_buf
);
11856 digests_buf
= digests_buf_new
;
11857 salts_buf
= salts_buf_new
;
11858 esalts_buf
= esalts_buf_new
;
11860 local_free (hashes_buf
);
11863 * special modification not set from parser
11868 case 6211: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11869 case 6212: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11870 case 6213: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11871 case 6221: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11872 case 6222: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11873 case 6223: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11874 case 6231: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11875 case 6232: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11876 case 6233: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11877 case 6241: salts_buf
->truecrypt_mdlen
= 1 * 512; break;
11878 case 6242: salts_buf
->truecrypt_mdlen
= 2 * 512; break;
11879 case 6243: salts_buf
->truecrypt_mdlen
= 3 * 512; break;
11882 if (truecrypt_keyfiles
)
11884 uint
*keyfile_buf
= ((tc_t
*) esalts_buf
)->keyfile_buf
;
11886 char *keyfiles
= strdup (truecrypt_keyfiles
);
11888 char *keyfile
= strtok (keyfiles
, ",");
11892 truecrypt_crc32 (keyfile
, (unsigned char *) keyfile_buf
);
11894 } while ((keyfile
= strtok (NULL
, ",")) != NULL
);
11899 data
.digests_cnt
= digests_cnt
;
11900 data
.digests_done
= digests_done
;
11901 data
.digests_buf
= digests_buf
;
11902 data
.digests_shown
= digests_shown
;
11903 data
.digests_shown_tmp
= digests_shown_tmp
;
11905 data
.salts_cnt
= salts_cnt
;
11906 data
.salts_done
= salts_done
;
11907 data
.salts_buf
= salts_buf
;
11908 data
.salts_shown
= salts_shown
;
11910 data
.esalts_buf
= esalts_buf
;
11911 data
.hash_info
= hash_info
;
11914 * Automatic Optimizers
11917 if (salts_cnt
== 1)
11918 opti_type
|= OPTI_TYPE_SINGLE_SALT
;
11920 if (digests_cnt
== 1)
11921 opti_type
|= OPTI_TYPE_SINGLE_HASH
;
11923 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
11924 opti_type
|= OPTI_TYPE_NOT_ITERATED
;
11926 if (attack_mode
== ATTACK_MODE_BF
)
11927 opti_type
|= OPTI_TYPE_BRUTE_FORCE
;
11929 data
.opti_type
= opti_type
;
11931 if (opti_type
& OPTI_TYPE_BRUTE_FORCE
)
11933 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
11935 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
11937 if (opts_type
& OPTS_TYPE_ST_ADD80
)
11939 opts_type
&= ~OPTS_TYPE_ST_ADD80
;
11940 opts_type
|= OPTS_TYPE_PT_ADD80
;
11943 if (opts_type
& OPTS_TYPE_ST_ADDBITS14
)
11945 opts_type
&= ~OPTS_TYPE_ST_ADDBITS14
;
11946 opts_type
|= OPTS_TYPE_PT_ADDBITS14
;
11949 if (opts_type
& OPTS_TYPE_ST_ADDBITS15
)
11951 opts_type
&= ~OPTS_TYPE_ST_ADDBITS15
;
11952 opts_type
|= OPTS_TYPE_PT_ADDBITS15
;
11959 * Some algorithm, like descrypt, can benefit from JIT compilation
11962 uint force_jit_compilation
= 0;
11964 if (hash_mode
== 8900)
11966 force_jit_compilation
= 8900;
11968 else if (hash_mode
== 9300)
11970 force_jit_compilation
= 8900;
11972 else if (hash_mode
== 1500 && attack_mode
== ATTACK_MODE_BF
&& data
.salts_cnt
== 1)
11974 force_jit_compilation
= 1500;
11978 * generate bitmap tables
11981 const uint bitmap_shift1
= 5;
11982 const uint bitmap_shift2
= 13;
11984 if (bitmap_max
< bitmap_min
) bitmap_max
= bitmap_min
;
11986 uint
*bitmap_s1_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11987 uint
*bitmap_s1_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11988 uint
*bitmap_s1_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11989 uint
*bitmap_s1_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11990 uint
*bitmap_s2_a
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11991 uint
*bitmap_s2_b
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11992 uint
*bitmap_s2_c
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
11993 uint
*bitmap_s2_d
= (uint
*) mymalloc ((1 << bitmap_max
) * sizeof (uint
));
12000 for (bitmap_bits
= bitmap_min
; bitmap_bits
< bitmap_max
; bitmap_bits
++)
12002 if (data
.quiet
== 0) log_info_nn ("Generating bitmap tables with %u bits...", bitmap_bits
);
12004 bitmap_nums
= 1 << bitmap_bits
;
12006 bitmap_mask
= bitmap_nums
- 1;
12008 bitmap_size
= bitmap_nums
* sizeof (uint
);
12010 if ((hashes_cnt
& bitmap_mask
) == hashes_cnt
) break;
12012 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;
12013 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;
12018 bitmap_nums
= 1 << bitmap_bits
;
12020 bitmap_mask
= bitmap_nums
- 1;
12022 bitmap_size
= bitmap_nums
* sizeof (uint
);
12024 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);
12025 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);
12028 * prepare quick rule
12031 data
.rule_buf_l
= rule_buf_l
;
12032 data
.rule_buf_r
= rule_buf_r
;
12034 int rule_len_l
= (int) strlen (rule_buf_l
);
12035 int rule_len_r
= (int) strlen (rule_buf_r
);
12037 data
.rule_len_l
= rule_len_l
;
12038 data
.rule_len_r
= rule_len_r
;
12044 uint
*all_gpu_rules_cnt
= NULL
;
12046 gpu_rule_t
**all_gpu_rules_buf
= NULL
;
12050 all_gpu_rules_cnt
= (uint
*) mycalloc (rp_files_cnt
, sizeof (uint
));
12052 all_gpu_rules_buf
= (gpu_rule_t
**) mycalloc (rp_files_cnt
, sizeof (gpu_rule_t
*));
12055 char rule_buf
[BUFSIZ
];
12059 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12061 uint gpu_rules_avail
= 0;
12063 uint gpu_rules_cnt
= 0;
12065 gpu_rule_t
*gpu_rules_buf
= NULL
;
12067 char *rp_file
= rp_files
[i
];
12069 char in
[BLOCK_SIZE
];
12070 char out
[BLOCK_SIZE
];
12074 uint rule_line
= 0;
12076 if ((fp
= fopen (rp_file
, "rb")) == NULL
)
12078 log_error ("ERROR: %s: %s", rp_file
, strerror (errno
));
12085 memset (rule_buf
, 0, BUFSIZ
);
12087 rule_len
= fgetl (fp
, rule_buf
);
12091 if (rule_len
== 0) continue;
12093 if (rule_buf
[0] == '#') continue;
12095 if (gpu_rules_avail
== gpu_rules_cnt
)
12097 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12099 gpu_rules_avail
+= INCR_RULES
;
12102 memset (in
, 0, BLOCK_SIZE
);
12103 memset (out
, 0, BLOCK_SIZE
);
12105 int result
= _old_apply_rule (rule_buf
, rule_len
, in
, 1, out
);
12109 log_info ("WARNING: Skipping invalid or unsupported rule in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12114 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1)
12116 log_info ("WARNING: Cannot convert rule for use on GPU in file %s in line %u: %s", rp_file
, rule_line
, rule_buf
);
12118 memset (&gpu_rules_buf
[gpu_rules_cnt
], 0, sizeof (gpu_rule_t
)); // needs to be cleared otherwise we could have some remaining data
12124 if (rulefind (&gpu_rules_buf[gpu_rules_cnt], gpu_rules_buf, gpu_rules_cnt, sizeof (gpu_rule_t), sort_by_gpu_rule))
12126 log_info ("Duplicate rule for use on GPU in file %s in line %u: %s", rp_file, rule_line, rule_buf);
12137 all_gpu_rules_cnt
[i
] = gpu_rules_cnt
;
12139 all_gpu_rules_buf
[i
] = gpu_rules_buf
;
12143 * merge rules or automatic rule generator
12146 uint gpu_rules_cnt
= 0;
12148 gpu_rule_t
*gpu_rules_buf
= NULL
;
12150 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12156 uint
*repeats
= (uint
*) mycalloc (rp_files_cnt
+ 1, sizeof (uint
));
12158 repeats
[0] = gpu_rules_cnt
;
12160 for (uint i
= 0; i
< rp_files_cnt
; i
++)
12162 gpu_rules_cnt
*= all_gpu_rules_cnt
[i
];
12164 repeats
[i
+ 1] = gpu_rules_cnt
;
12167 gpu_rules_buf
= (gpu_rule_t
*) mycalloc (gpu_rules_cnt
, sizeof (gpu_rule_t
));
12169 memset (gpu_rules_buf
, 0, gpu_rules_cnt
* sizeof (gpu_rule_t
));
12171 for (uint i
= 0; i
< gpu_rules_cnt
; i
++)
12175 gpu_rule_t
*out
= &gpu_rules_buf
[i
];
12177 for (uint j
= 0; j
< rp_files_cnt
; j
++)
12179 uint in_off
= (i
/ repeats
[j
]) % all_gpu_rules_cnt
[j
];
12182 gpu_rule_t
*in
= &all_gpu_rules_buf
[j
][in_off
];
12184 for (in_pos
= 0; in
->cmds
[in_pos
]; in_pos
++, out_pos
++)
12186 if (out_pos
== RULES_MAX
- 1)
12188 // log_info ("WARNING: Truncating chaining of rule %d and rule %d as maximum number of function calls per rule exceeded", i, in_off);
12193 out
->cmds
[out_pos
] = in
->cmds
[in_pos
];
12198 local_free (repeats
);
12202 uint gpu_rules_avail
= 0;
12204 while (gpu_rules_cnt
< rp_gen
)
12206 if (gpu_rules_avail
== gpu_rules_cnt
)
12208 gpu_rules_buf
= (gpu_rule_t
*) myrealloc (gpu_rules_buf
, gpu_rules_avail
* sizeof (gpu_rule_t
), INCR_RULES
* sizeof (gpu_rule_t
));
12210 gpu_rules_avail
+= INCR_RULES
;
12213 memset (rule_buf
, 0, BLOCK_SIZE
);
12215 rule_len
= (int) generate_random_rule (rule_buf
, rp_gen_func_min
, rp_gen_func_max
);
12217 if (cpu_rule_to_gpu_rule (rule_buf
, rule_len
, &gpu_rules_buf
[gpu_rules_cnt
]) == -1) continue;
12225 * generate NOP rules
12228 if (gpu_rules_cnt
== 0)
12230 gpu_rules_buf
= (gpu_rule_t
*) mymalloc (sizeof (gpu_rule_t
));
12232 gpu_rules_buf
[gpu_rules_cnt
].cmds
[0] = RULE_OP_MANGLE_NOOP
;
12237 data
.gpu_rules_cnt
= gpu_rules_cnt
;
12238 data
.gpu_rules_buf
= gpu_rules_buf
;
12244 cl_platform_id CL_platforms
[CL_PLATFORMS_MAX
];
12246 uint CL_platforms_cnt
= 0;
12248 hc_clGetPlatformIDs (CL_PLATFORMS_MAX
, CL_platforms
, &CL_platforms_cnt
);
12250 if (CL_platforms_cnt
== 0)
12252 log_error ("ERROR: No OpenCL compatible platform found");
12257 if (CL_platforms_cnt
> 1)
12259 log_error ("ERROR: Too many OpenCL compatible platforms found");
12264 cl_platform_id CL_platform
= CL_platforms
[0];
12266 char CL_platform_vendor
[INFOSZ
];
12268 memset (CL_platform_vendor
, 0, sizeof (CL_platform_vendor
));
12270 hc_clGetPlatformInfo (CL_platform
, CL_PLATFORM_VENDOR
, sizeof (CL_platform_vendor
), CL_platform_vendor
, NULL
);
12274 if (strcmp (CL_platform_vendor
, CL_VENDOR_AMD
) == 0)
12276 vendor_id
= VENDOR_ID_AMD
;
12278 else if (strcmp (CL_platform_vendor
, CL_VENDOR_NV
) == 0)
12280 vendor_id
= VENDOR_ID_NV
;
12282 // make sure that we do not directly control the fan for NVidia
12284 gpu_temp_retain
= 0;
12285 data
.gpu_temp_retain
= gpu_temp_retain
;
12289 vendor_id
= VENDOR_ID_UNKNOWN
;
12292 if (vendor_id
== VENDOR_ID_UNKNOWN
)
12294 log_error ("Warning: unknown OpenCL vendor '%s' detected", CL_platform_vendor
);
12296 gpu_temp_disable
= 1;
12299 data
.vendor_id
= vendor_id
;
12305 cl_device_id devices_all
[DEVICES_MAX
];
12306 cl_device_id devices
[DEVICES_MAX
];
12308 uint devices_all_cnt
= 0;
12310 hc_clGetDeviceIDs (CL_platform
, CL_DEVICE_TYPE_GPU
, DEVICES_MAX
, devices_all
, (uint
*) &devices_all_cnt
);
12312 int hm_adapters_all
= devices_all_cnt
;
12314 hm_attrs_t hm_adapter_all
[DEVICES_MAX
];
12316 memset (hm_adapter_all
, 0, sizeof (hm_adapter_all
));
12318 if (gpu_temp_disable
== 0)
12320 if (vendor_id
== VENDOR_ID_NV
)
12323 HM_LIB hm_dll
= hm_init ();
12325 data
.hm_dll
= hm_dll
;
12327 if (hc_NVML_nvmlInit (hm_dll
) == NVML_SUCCESS
)
12329 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12331 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12335 for (int i
= 0; i
< tmp_in
; i
++)
12337 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12340 hm_adapters_all
= tmp_out
;
12342 for (int i
= 0; i
< tmp_out
; i
++)
12344 unsigned int speed
;
12346 if (hc_NVML_nvmlDeviceGetFanSpeed (hm_dll
, 1, hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVML_ERROR_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12352 if (NvAPI_Initialize () == NVAPI_OK
)
12354 HM_ADAPTER_NV nvGPUHandle
[DEVICES_MAX
];
12356 int tmp_in
= hm_get_adapter_index_nv (nvGPUHandle
);
12360 for (int i
= 0; i
< tmp_in
; i
++)
12362 hm_adapter_all
[tmp_out
++].adapter_index
.nv
= nvGPUHandle
[i
];
12365 hm_adapters_all
= tmp_out
;
12367 for (int i
= 0; i
< tmp_out
; i
++)
12371 if (NvAPI_GPU_GetTachReading (hm_adapter_all
[i
].adapter_index
.nv
, &speed
) != NVAPI_NOT_SUPPORTED
) hm_adapter_all
[i
].fan_supported
= 1;
12377 if (vendor_id
== VENDOR_ID_AMD
)
12379 HM_LIB hm_dll
= hm_init ();
12381 data
.hm_dll
= hm_dll
;
12383 if (hc_ADL_Main_Control_Create (hm_dll
, ADL_Main_Memory_Alloc
, 0) == ADL_OK
)
12385 // total number of adapters
12387 int hm_adapters_num
;
12389 if (get_adapters_num_amd (hm_dll
, &hm_adapters_num
) != 0) return (-1);
12393 LPAdapterInfo lpAdapterInfo
= hm_get_adapter_info_amd (hm_dll
, hm_adapters_num
);
12395 if (lpAdapterInfo
== NULL
) return (-1);
12397 // get a list (of ids of) valid/usable adapters
12399 int num_adl_adapters
= 0;
12401 uint32_t *valid_adl_device_list
= hm_get_list_valid_adl_adapters (hm_adapters_num
, &num_adl_adapters
, lpAdapterInfo
);
12403 if (num_adl_adapters
> 0)
12405 hc_thread_mutex_lock (mux_adl
);
12407 // hm_get_opencl_busid_devid (hm_adapter_all, devices_all_cnt, devices_all);
12409 hm_get_adapter_index_amd (hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12411 hm_get_overdrive_version (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12412 hm_check_fanspeed_control (hm_dll
, hm_adapter_all
, valid_adl_device_list
, num_adl_adapters
, lpAdapterInfo
);
12414 hc_thread_mutex_unlock (mux_adl
);
12417 hm_adapters_all
= num_adl_adapters
;
12419 myfree (valid_adl_device_list
);
12420 myfree (lpAdapterInfo
);
12425 if (hm_adapters_all
== 0)
12427 gpu_temp_disable
= 1;
12430 if (gpu_temp_disable
== 1)
12432 gpu_temp_abort
= 0;
12433 gpu_temp_retain
= 0;
12437 * enable custom signal handler(s)
12440 if (benchmark
== 0)
12442 hc_signal (sigHandler_default
);
12446 hc_signal (sigHandler_benchmark
);
12450 * devices mask and properties
12453 uint devices_cnt
= 0;
12455 for (uint device_all_id
= 0; device_all_id
< devices_all_cnt
; device_all_id
++)
12457 if (gpu_devicemask
)
12459 uint device_all_id_mask
= 1 << device_all_id
;
12461 if ((device_all_id_mask
& gpu_devicemask
) != device_all_id_mask
)
12463 if (quiet
== 0 && algorithm_pos
== 0) log_info ("Device #%d: skipped by user", device_all_id_mask
+ 1);
12469 const uint device_id
= devices_cnt
;
12471 devices
[device_id
] = devices_all
[device_all_id
];
12473 memcpy (&data
.hm_device
[device_id
], &hm_adapter_all
[device_all_id
], sizeof (hm_attrs_t
));
12475 char device_name
[INFOSZ
];
12477 memset (device_name
, 0, sizeof (device_name
));
12479 cl_ulong global_mem_size
;
12480 cl_uint max_clock_frequency
;
12481 cl_uint max_compute_units
;
12483 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_NAME
, sizeof (device_name
), &device_name
, NULL
);
12484 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_GLOBAL_MEM_SIZE
, sizeof (global_mem_size
), &global_mem_size
, NULL
);
12485 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_CLOCK_FREQUENCY
, sizeof (max_clock_frequency
), &max_clock_frequency
, NULL
);
12486 hc_clGetDeviceInfo (devices
[device_id
], CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12488 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12490 log_info ("Device #%u: %s, %luMB, %dMhz, %uMCU",
12493 (unsigned int) (global_mem_size
/ 1024 / 1024),
12494 (unsigned int) (max_clock_frequency
),
12495 (unsigned int) max_compute_units
);
12501 if (devices_cnt
== 0)
12503 log_error ("ERROR: No devices left that matches your specification.");
12508 data
.devices_cnt
= devices_cnt
;
12510 if ((benchmark
== 1 || quiet
== 0) && (algorithm_pos
== 0))
12519 // gpu temp sanity check
12521 if ((gpu_temp_abort
!= 0) && (gpu_temp_retain
!= 0))
12523 if (gpu_temp_abort
< gpu_temp_retain
)
12525 log_error ("ERROR: invalid values for gpu-temp-abort. Parameter gpu-temp-abort is less than gpu-temp-retain.");
12531 data
.gpu_temp_disable
= gpu_temp_disable
;
12532 data
.gpu_temp_abort
= gpu_temp_abort
;
12533 data
.gpu_temp_retain
= gpu_temp_retain
;
12535 if (data
.quiet
== 0)
12537 log_info ("Hashes: %u hashes; %u unique digests, %u unique salts", hashes_cnt_orig
, digests_cnt
, salts_cnt
);
12539 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
);
12541 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
12543 log_info ("Rules: %u", gpu_rules_cnt
);
12548 log_info ("Applicable Optimizers:");
12550 for (uint i
= 0; i
< 32; i
++)
12552 const uint opti_bit
= 1 << i
;
12554 if (opti_type
& opti_bit
) log_info ("* %s", stroptitype (opti_bit
));
12559 * Watchdog and Temperature balance
12562 if (gpu_temp_abort
== 0)
12564 log_info ("Watchdog: Temperature abort trigger disabled");
12568 log_info ("Watchdog: Temperature abort trigger set to %uc", gpu_temp_abort
);
12571 if (gpu_temp_retain
== 0)
12573 log_info ("Watchdog: Temperature retain trigger disabled");
12577 log_info ("Watchdog: Temperature retain trigger set to %uc", gpu_temp_retain
);
12585 int *temp_retain_fanspeed_value
= (int *) mycalloc (devices_cnt
, sizeof (int));
12587 ADLOD6MemClockState
*od_clock_mem_status
= (ADLOD6MemClockState
*) mycalloc (devices_cnt
, sizeof (ADLOD6MemClockState
));
12589 int *od_power_control_status
= (int *) mycalloc (devices_cnt
, sizeof (int));
12591 hc_device_param_t
*devices_param
= (hc_device_param_t
*) mycalloc (devices_cnt
, sizeof (hc_device_param_t
));
12593 data
.devices_param
= devices_param
;
12595 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12597 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12599 cl_device_id device
= devices
[device_id
];
12601 device_param
->device
= device
;
12603 cl_uint max_compute_units
= 0;
12605 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_COMPUTE_UNITS
, sizeof (max_compute_units
), &max_compute_units
, NULL
);
12607 device_param
->gpu_processors
= max_compute_units
;
12609 cl_ulong max_mem_alloc_size
= 0;
12611 hc_clGetDeviceInfo (device
, CL_DEVICE_MAX_MEM_ALLOC_SIZE
, sizeof (max_mem_alloc_size
), &max_mem_alloc_size
, NULL
);
12613 device_param
->gpu_maxmem_alloc
= max_mem_alloc_size
;
12615 char tmp
[INFOSZ
], t1
[64];
12617 memset (tmp
, 0, sizeof (tmp
));
12619 hc_clGetDeviceInfo (device
, CL_DEVICE_NAME
, sizeof (tmp
), &tmp
, NULL
);
12621 device_param
->device_name
= mystrdup (tmp
);
12623 memset (tmp
, 0, sizeof (tmp
));
12625 hc_clGetDeviceInfo (device
, CL_DEVICE_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12627 memset (t1
, 0, sizeof (t1
));
12629 sscanf (tmp
, "%*16s %*16s %*16s (%[^)]16s)", t1
);
12631 device_param
->device_version
= mystrdup (t1
);
12633 memset (tmp
, 0, sizeof (tmp
));
12635 hc_clGetDeviceInfo (device
, CL_DRIVER_VERSION
, sizeof (tmp
), &tmp
, NULL
);
12637 device_param
->driver_version
= mystrdup (tmp
);
12639 if (vendor_id
== VENDOR_ID_AMD
)
12641 cl_uint gpu_processor_cores
= 0;
12643 #define CL_DEVICE_WAVEFRONT_WIDTH_AMD 0x4043
12645 hc_clGetDeviceInfo (device
, CL_DEVICE_WAVEFRONT_WIDTH_AMD
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12647 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12650 if (vendor_id
== VENDOR_ID_NV
)
12652 cl_uint kernel_exec_timeout
= 0;
12654 #define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
12656 hc_clGetDeviceInfo (device
, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
, sizeof (kernel_exec_timeout
), &kernel_exec_timeout
, NULL
);
12658 device_param
->kernel_exec_timeout
= kernel_exec_timeout
;
12660 cl_uint gpu_processor_cores
= 0;
12662 #define CL_DEVICE_WARP_SIZE_NV 0x4003
12664 hc_clGetDeviceInfo (device
, CL_DEVICE_WARP_SIZE_NV
, sizeof (gpu_processor_cores
), &gpu_processor_cores
, NULL
);
12666 device_param
->gpu_processor_cores
= gpu_processor_cores
;
12668 cl_uint sm_minor
= 0;
12669 cl_uint sm_major
= 0;
12671 #define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
12672 #define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
12674 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
, sizeof (sm_minor
), &sm_minor
, NULL
);
12675 hc_clGetDeviceInfo (device
, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
, sizeof (sm_major
), &sm_major
, NULL
);
12677 device_param
->sm_minor
= sm_minor
;
12678 device_param
->sm_major
= sm_major
;
12682 * common driver check
12685 if (vendor_id
== VENDOR_ID_NV
)
12687 if (device_param
->kernel_exec_timeout
!= 0)
12689 if (data
.quiet
== 0) log_info ("Device #%u: WARNING! Kernel exec timeout is not disabled, it might cause you errors of code 702", device_id
+ 1);
12692 if (data
.quiet
== 0) log_info (" You can disable it with a regpatch, see here: http://hashcat.net/wiki/doku.php?id=timeout_patch");
12697 if (vendor_id
== VENDOR_ID_AMD
)
12699 int catalyst_check
= (force
== 1) ? 0 : 1;
12701 int catalyst_warn
= 0;
12703 int catalyst_broken
= 0;
12705 if (catalyst_check
== 1)
12709 // v14.9 and higher
12710 if ((atoi (device_param
->device_version
) >= 1573)
12711 && (atoi (device_param
->driver_version
) >= 1573))
12716 catalyst_check
= 0;
12719 if (catalyst_broken
== 1)
12722 log_error ("ATTENTION! The installed GPU driver in your system is known to be broken!");
12723 log_error ("It will pass over cracked hashes and does not report them as cracked");
12724 log_error ("You are STRONGLY encouraged not to use it");
12725 log_error ("You can use --force to override this but do not post error reports if you do so");
12730 if (catalyst_warn
== 1)
12733 log_error ("ATTENTION! Unsupported or incorrect installed GPU driver detected!");
12734 log_error ("You are STRONGLY encouraged to use the official supported GPU driver for good reasons");
12735 log_error ("See oclHashcat's homepage for official supported GPU drivers");
12737 log_error ("Also see: http://hashcat.net/wiki/doku.php?id=upgrading_amd_drivers_how_to");
12739 log_error ("You can use --force to override this but do not post error reports if you do so");
12748 * with AMD r9 295x cards it seems that we need to set the powertune value just AFTER the ocl init stuff
12749 * otherwise after hc_clCreateContext () etc, powertune value was set back to "normal" and cards unfortunately
12750 * were not working @ full speed (setting hc_ADL_Overdrive_PowerControl_Set () here seems to fix the problem)
12751 * Driver / ADL bug?
12754 if (vendor_id
== VENDOR_ID_AMD
)
12756 if (powertune_enable
== 1)
12758 hc_thread_mutex_lock (mux_adl
);
12760 for (uint i
= 0; i
< devices_cnt
; i
++)
12762 if (data
.hm_device
[i
].od_version
== 6)
12764 // set powertune value only
12766 int powertune_supported
= 0;
12770 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
12772 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
12777 if (powertune_supported
!= 0)
12780 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
12782 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune
)) != ADL_OK
)
12784 log_error ("ERROR: Failed to get current ADL PowerControl settings");
12789 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
12791 log_error ("ERROR: Failed to set new ADL PowerControl values");
12799 hc_thread_mutex_unlock (mux_adl
);
12803 uint gpu_blocks_all
= 0;
12805 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
12811 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
12814 * device properties
12817 char *device_name
= device_param
->device_name
;
12818 char *device_version
= device_param
->device_version
;
12819 char *driver_version
= device_param
->driver_version
;
12821 uint gpu_processors
= device_param
->gpu_processors
;
12823 uint gpu_processor_cores
= device_param
->gpu_processor_cores
;
12826 * create context for each device
12829 device_param
->context
= hc_clCreateContext (NULL
, 1, &device_param
->device
, NULL
, NULL
);
12832 * create command-queue
12835 // not support with NV
12836 // device_param->command_queue = hc_clCreateCommandQueueWithProperties (device_param->context, device_param->device, NULL);
12838 device_param
->command_queue
= hc_clCreateCommandQueue (device_param
->context
, device_param
->device
, 0);
12841 * create input buffers on device
12844 uint gpu_threads
= GPU_THREADS
;
12847 if (hash_mode
== 3200) gpu_threads
= 8;
12848 if (hash_mode
== 9000) gpu_threads
= 8;
12850 uint gpu_power
= gpu_processors
* gpu_threads
* gpu_accel
;
12851 uint gpu_blocks
= gpu_power
;
12853 device_param
->gpu_threads
= gpu_threads
;
12854 device_param
->gpu_power_user
= gpu_power
;
12855 device_param
->gpu_blocks_user
= gpu_blocks
;
12857 gpu_blocks_all
+= gpu_blocks
;
12859 uint size_pws
= gpu_power
* sizeof (pw_t
);
12861 uint size_tmps
= 4;
12865 case 400: size_tmps
= gpu_blocks
* sizeof (phpass_tmp_t
); break;
12866 case 500: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12867 case 501: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12868 case 1600: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12869 case 1800: size_tmps
= gpu_blocks
* sizeof (sha512crypt_tmp_t
); break;
12870 case 2100: size_tmps
= gpu_blocks
* sizeof (dcc2_tmp_t
); break;
12871 case 2500: size_tmps
= gpu_blocks
* sizeof (wpa_tmp_t
); break;
12872 case 3200: size_tmps
= gpu_blocks
* sizeof (bcrypt_tmp_t
); break;
12873 case 5200: size_tmps
= gpu_blocks
* sizeof (pwsafe3_tmp_t
); break;
12874 case 5800: size_tmps
= gpu_blocks
* sizeof (androidpin_tmp_t
); break;
12877 case 6213: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12880 case 6223: size_tmps
= gpu_blocks
* sizeof (tc64_tmp_t
); break;
12883 case 6233: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12886 case 6243: size_tmps
= gpu_blocks
* sizeof (tc_tmp_t
); break;
12887 case 6300: size_tmps
= gpu_blocks
* sizeof (md5crypt_tmp_t
); break;
12888 case 6400: size_tmps
= gpu_blocks
* sizeof (sha256aix_tmp_t
); break;
12889 case 6500: size_tmps
= gpu_blocks
* sizeof (sha512aix_tmp_t
); break;
12890 case 6600: size_tmps
= gpu_blocks
* sizeof (agilekey_tmp_t
); break;
12891 case 6700: size_tmps
= gpu_blocks
* sizeof (sha1aix_tmp_t
); break;
12892 case 6800: size_tmps
= gpu_blocks
* sizeof (lastpass_tmp_t
); break;
12893 case 7100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12894 case 7200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12895 case 7400: size_tmps
= gpu_blocks
* sizeof (sha256crypt_tmp_t
); break;
12896 case 7900: size_tmps
= gpu_blocks
* sizeof (drupal7_tmp_t
); break;
12897 case 8200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12898 case 8800: size_tmps
= gpu_blocks
* sizeof (androidfde_tmp_t
); break;
12899 case 8900: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12900 case 9000: size_tmps
= gpu_blocks
* sizeof (pwsafe2_tmp_t
); break;
12901 case 9100: size_tmps
= gpu_blocks
* sizeof (lotus8_tmp_t
); break;
12902 case 9200: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12903 case 9300: size_tmps
= gpu_blocks
* sizeof (scrypt_tmp_t
); break;
12904 case 9400: size_tmps
= gpu_blocks
* sizeof (office2007_tmp_t
); break;
12905 case 9500: size_tmps
= gpu_blocks
* sizeof (office2010_tmp_t
); break;
12906 case 9600: size_tmps
= gpu_blocks
* sizeof (office2013_tmp_t
); break;
12907 case 10000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12908 case 10200: size_tmps
= gpu_blocks
* sizeof (cram_md5_t
); break;
12909 case 10300: size_tmps
= gpu_blocks
* sizeof (saph_sha1_tmp_t
); break;
12910 case 10500: size_tmps
= gpu_blocks
* sizeof (pdf14_tmp_t
); break;
12911 case 10700: size_tmps
= gpu_blocks
* sizeof (pdf17l8_tmp_t
); break;
12912 case 10900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12913 case 11300: size_tmps
= gpu_blocks
* sizeof (bitcoin_wallet_tmp_t
); break;
12914 case 11600: size_tmps
= gpu_blocks
* sizeof (seven_zip_tmp_t
); break;
12915 case 11900: size_tmps
= gpu_blocks
* sizeof (pbkdf2_md5_tmp_t
); break;
12916 case 12000: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha1_tmp_t
); break;
12917 case 12100: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha512_tmp_t
); break;
12918 case 12200: size_tmps
= gpu_blocks
* sizeof (ecryptfs_tmp_t
); break;
12919 case 12300: size_tmps
= gpu_blocks
* sizeof (oraclet_tmp_t
); break;
12920 case 12400: size_tmps
= gpu_blocks
* sizeof (bsdicrypt_tmp_t
); break;
12921 case 12500: size_tmps
= gpu_blocks
* sizeof (rar3_tmp_t
); break;
12922 case 12700: size_tmps
= gpu_blocks
* sizeof (mywallet_tmp_t
); break;
12923 case 12800: size_tmps
= gpu_blocks
* sizeof (pbkdf2_sha256_tmp_t
); break;
12926 uint size_hooks
= 4;
12928 if ((opts_type
& OPTS_TYPE_HOOK12
) || (opts_type
& OPTS_TYPE_HOOK23
))
12930 // insert correct hook size
12933 // we can optimize some stuff here...
12935 device_param
->size_pws
= size_pws
;
12936 device_param
->size_tmps
= size_tmps
;
12937 device_param
->size_hooks
= size_hooks
;
12939 uint size_root_css
= SP_PW_MAX
* sizeof (cs_t
);
12940 uint size_markov_css
= SP_PW_MAX
* CHARSIZ
* sizeof (cs_t
);
12942 device_param
->size_root_css
= size_root_css
;
12943 device_param
->size_markov_css
= size_markov_css
;
12945 uint size_results
= GPU_THREADS
* sizeof (uint
);
12947 device_param
->size_results
= size_results
;
12949 uint size_rules
= gpu_rules_cnt
* sizeof (gpu_rule_t
);
12950 uint size_rules_c
= GPU_RULES
* sizeof (gpu_rule_t
);
12951 uint size_plains
= digests_cnt
* sizeof (plain_t
);
12952 uint size_salts
= salts_cnt
* sizeof (salt_t
);
12953 uint size_esalts
= salts_cnt
* esalt_size
;
12955 device_param
->size_plains
= size_plains
;
12956 device_param
->size_digests
= size_digests
;
12957 device_param
->size_shown
= size_shown
;
12958 device_param
->size_salts
= size_salts
;
12960 uint size_combs
= GPU_COMBS
* sizeof (comb_t
);
12961 uint size_bfs
= GPU_BFS
* sizeof (bf_t
);
12962 uint size_tm
= 32 * sizeof (bs_word_t
);
12964 uint64_t size_scryptV
= 1;
12966 if ((hash_mode
== 8900) || (hash_mode
== 9300))
12968 uint tmto_start
= 2;
12969 uint tmto_stop
= 1024;
12973 tmto_start
= 1 << scrypt_tmto
;
12974 tmto_stop
= tmto_start
+ 1;
12977 for (uint tmto
= tmto_start
; tmto
< tmto_stop
; tmto
<<= 1)
12979 // todo -- make sure all salts get the new tmto value
12981 size_scryptV
= (128 * data
.salts_buf
[0].scrypt_r
) * data
.salts_buf
[0].scrypt_N
;
12983 size_scryptV
/= tmto
;
12985 size_scryptV
*= gpu_processors
* gpu_processor_cores
* gpu_threads
;
12987 if (size_scryptV
> device_param
->gpu_maxmem_alloc
) continue;
12989 for (uint salts_pos
= 0; salts_pos
< data
.salts_cnt
; salts_pos
++)
12991 data
.salts_buf
[salts_pos
].scrypt_tmto
= tmto
;
12992 data
.salts_buf
[salts_pos
].scrypt_phy
= gpu_processors
* gpu_processor_cores
* gpu_threads
;
12998 if (data
.salts_buf
[0].scrypt_tmto
== 0)
13000 log_error ("ERROR: can't allocate enough GPU memory");
13005 if (quiet
== 0) log_info ("");
13006 if (quiet
== 0) log_info ("SCRYPT tmto optimizer value set to: %u\n", data
.salts_buf
[0].scrypt_tmto
);
13010 * default building options
13013 char build_opts
[1024];
13015 // we don't have sm_* on AMD but it doesn't matter
13017 sprintf (build_opts
, "-I. -IOpenCL/ -DVENDOR_ID=%d -DCUDA_ARCH=%d", vendor_id
, (device_param
->sm_major
* 100) + device_param
->sm_minor
);
13025 * kernel source filename
13028 char source_file
[256];
13030 memset (source_file
, 0, sizeof (source_file
));
13032 generate_source_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, source_file
);
13036 if (stat (source_file
, &sst
) == -1)
13038 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13044 * kernel cached filename
13047 char cached_file
[256];
13049 memset (cached_file
, 0, sizeof (cached_file
));
13051 generate_cached_kernel_filename (attack_exec
, attack_kern
, kern_type
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13057 if (stat (cached_file
, &cst
) == -1)
13063 * kernel compile or load
13066 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13068 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13070 if (force_jit_compilation
== 0)
13074 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13076 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13078 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13080 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13082 size_t binary_size
;
13084 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13086 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13088 clGetProgramInfo (device_param
->program
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13090 writeProgramBin (cached_file
, binary
, binary_size
);
13092 local_free (binary
);
13096 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13098 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13100 device_param
->program
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13102 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13107 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, source_file
, sst
.st_size
);
13109 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13111 device_param
->program
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13113 if (force_jit_compilation
== 1500)
13115 sprintf (build_opts
, "%s -DDESCRYPT_SALT=%d", build_opts
, data
.salts_buf
[0].salt_buf
[0]);
13117 else if (force_jit_compilation
== 8900)
13119 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
);
13122 hc_clBuildProgram (device_param
->program
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13125 local_free (kernel_lengths
);
13126 local_free (kernel_sources
[0]);
13127 local_free (kernel_sources
);
13129 // this is mostly for debug
13131 size_t ret_val_size
= 0;
13133 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13135 if (ret_val_size
> 2)
13137 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13139 memset (build_log
, 0, ret_val_size
+ 1);
13141 clGetProgramBuildInfo (device_param
->program
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13145 myfree (build_log
);
13150 * word generator kernel
13153 if (attack_mode
!= ATTACK_MODE_STRAIGHT
)
13156 * kernel mp source filename
13159 char source_file
[256];
13161 memset (source_file
, 0, sizeof (source_file
));
13163 generate_source_kernel_mp_filename (opti_type
, opts_type
, install_dir
, source_file
);
13167 if (stat (source_file
, &sst
) == -1)
13169 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13175 * kernel mp cached filename
13178 char cached_file
[256];
13180 memset (cached_file
, 0, sizeof (cached_file
));
13182 generate_cached_kernel_mp_filename (opti_type
, opts_type
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13188 if (stat (cached_file
, &cst
) == -1)
13194 * kernel compile or load
13197 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13199 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13203 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13205 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13207 device_param
->program_mp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13209 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13211 size_t binary_size
;
13213 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13215 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13217 clGetProgramInfo (device_param
->program_mp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13219 writeProgramBin (cached_file
, binary
, binary_size
);
13221 local_free (binary
);
13225 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13227 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13229 device_param
->program_mp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13231 hc_clBuildProgram (device_param
->program_mp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13234 local_free (kernel_lengths
);
13235 local_free (kernel_sources
[0]);
13236 local_free (kernel_sources
);
13238 // this is mostly for debug
13240 size_t ret_val_size
= 0;
13242 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13244 if (ret_val_size
> 2)
13246 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13248 memset (build_log
, 0, ret_val_size
+ 1);
13250 clGetProgramBuildInfo (device_param
->program_mp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13254 myfree (build_log
);
13262 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13269 * kernel amp source filename
13272 char source_file
[256];
13274 memset (source_file
, 0, sizeof (source_file
));
13276 generate_source_kernel_amp_filename (attack_kern
, install_dir
, source_file
);
13280 if (stat (source_file
, &sst
) == -1)
13282 log_error ("ERROR: %s: %s", source_file
, strerror (errno
));
13288 * kernel amp cached filename
13291 char cached_file
[256];
13293 memset (cached_file
, 0, sizeof (cached_file
));
13295 generate_cached_kernel_amp_filename (attack_kern
, install_dir
, device_name
, device_version
, driver_version
, vendor_id
, cached_file
);
13301 if (stat (cached_file
, &cst
) == -1)
13307 * kernel compile or load
13310 size_t *kernel_lengths
= (size_t *) mymalloc (sizeof (size_t));
13312 const unsigned char **kernel_sources
= (const unsigned char **) mymalloc (sizeof (unsigned char *));
13316 if (quiet
== 0) log_info ("Device #%u: Kernel %s not found in cache! Building may take a while...", device_id
+ 1, cached_file
);
13318 load_kernel (source_file
, 1, kernel_lengths
, kernel_sources
);
13320 device_param
->program_amp
= hc_clCreateProgramWithSource (device_param
->context
, 1, (const char **) kernel_sources
, NULL
);
13322 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13324 size_t binary_size
;
13326 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARY_SIZES
, sizeof (size_t), &binary_size
, NULL
);
13328 unsigned char *binary
= (unsigned char *) mymalloc (binary_size
);
13330 clGetProgramInfo (device_param
->program_amp
, CL_PROGRAM_BINARIES
, sizeof (binary
), &binary
, NULL
);
13332 writeProgramBin (cached_file
, binary
, binary_size
);
13334 local_free (binary
);
13338 if (quiet
== 0) log_info ("Device #%u: Kernel %s (%ld bytes)", device_id
+ 1, cached_file
, cst
.st_size
);
13340 load_kernel (cached_file
, 1, kernel_lengths
, kernel_sources
);
13342 device_param
->program_amp
= hc_clCreateProgramWithBinary (device_param
->context
, 1, &device_param
->device
, kernel_lengths
, (const unsigned char **) kernel_sources
, NULL
);
13344 hc_clBuildProgram (device_param
->program_amp
, 1, &device_param
->device
, build_opts
, NULL
, NULL
);
13347 local_free (kernel_lengths
);
13348 local_free (kernel_sources
[0]);
13349 local_free (kernel_sources
);
13351 // this is mostly for debug
13353 size_t ret_val_size
= 0;
13355 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, 0, NULL
, &ret_val_size
);
13357 if (ret_val_size
> 2)
13359 char *build_log
= (char *) mymalloc (ret_val_size
+ 1);
13361 memset (build_log
, 0, ret_val_size
+ 1);
13363 clGetProgramBuildInfo (device_param
->program_amp
, device_param
->device
, CL_PROGRAM_BUILD_LOG
, ret_val_size
, build_log
, NULL
);
13367 myfree (build_log
);
13375 device_param
->d_pws_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13376 device_param
->d_pws_amp_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_pws
, NULL
);
13377 device_param
->d_tmps
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_tmps
, NULL
);
13378 device_param
->d_hooks
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_hooks
, NULL
);
13379 device_param
->d_bitmap_s1_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13380 device_param
->d_bitmap_s1_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13381 device_param
->d_bitmap_s1_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13382 device_param
->d_bitmap_s1_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13383 device_param
->d_bitmap_s2_a
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13384 device_param
->d_bitmap_s2_b
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13385 device_param
->d_bitmap_s2_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13386 device_param
->d_bitmap_s2_d
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, bitmap_size
, NULL
);
13387 device_param
->d_plain_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_plains
, NULL
);
13388 device_param
->d_digests_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_digests
, NULL
);
13389 device_param
->d_digests_shown
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_shown
, NULL
);
13390 device_param
->d_salt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_salts
, NULL
);
13391 device_param
->d_result
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_results
, NULL
);
13392 device_param
->d_scryptV_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_WRITE
, size_scryptV
, NULL
);
13394 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_a
, 0, NULL
, NULL
);
13395 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_b
, 0, NULL
, NULL
);
13396 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_c
, 0, NULL
, NULL
);
13397 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s1_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s1_d
, 0, NULL
, NULL
);
13398 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_a
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_a
, 0, NULL
, NULL
);
13399 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_b
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_b
, 0, NULL
, NULL
);
13400 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_c
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_c
, 0, NULL
, NULL
);
13401 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_bitmap_s2_d
, CL_TRUE
, 0, bitmap_size
, bitmap_s2_d
, 0, NULL
, NULL
);
13402 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_buf
, CL_TRUE
, 0, size_digests
, data
.digests_buf
, 0, NULL
, NULL
);
13403 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_digests_shown
, CL_TRUE
, 0, size_shown
, data
.digests_shown
, 0, NULL
, NULL
);
13404 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_salt_bufs
, CL_TRUE
, 0, size_salts
, data
.salts_buf
, 0, NULL
, NULL
);
13406 run_kernel_bzero (device_param
, device_param
->d_pws_buf
, size_pws
);
13407 run_kernel_bzero (device_param
, device_param
->d_pws_amp_buf
, size_pws
);
13408 run_kernel_bzero (device_param
, device_param
->d_tmps
, size_tmps
);
13409 run_kernel_bzero (device_param
, device_param
->d_hooks
, size_hooks
);
13410 run_kernel_bzero (device_param
, device_param
->d_plain_bufs
, size_plains
);
13411 run_kernel_bzero (device_param
, device_param
->d_result
, size_results
);
13417 if (attack_kern
== ATTACK_KERN_STRAIGHT
)
13419 device_param
->d_rules
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules
, NULL
);
13420 device_param
->d_rules_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_rules_c
, NULL
);
13422 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_rules
, CL_TRUE
, 0, size_rules
, gpu_rules_buf
, 0, NULL
, NULL
);
13424 run_kernel_bzero (device_param
, device_param
->d_rules_c
, size_rules_c
);
13426 else if (attack_kern
== ATTACK_KERN_COMBI
)
13428 device_param
->d_combs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13429 device_param
->d_combs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_combs
, NULL
);
13430 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13431 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13433 run_kernel_bzero (device_param
, device_param
->d_combs
, size_combs
);
13434 run_kernel_bzero (device_param
, device_param
->d_combs_c
, size_combs
);
13435 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13436 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13438 else if (attack_kern
== ATTACK_KERN_BF
)
13440 device_param
->d_bfs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13441 device_param
->d_bfs_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_bfs
, NULL
);
13442 device_param
->d_tm_c
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_tm
, NULL
);
13443 device_param
->d_root_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_root_css
, NULL
);
13444 device_param
->d_markov_css_buf
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_markov_css
, NULL
);
13446 run_kernel_bzero (device_param
, device_param
->d_bfs
, size_bfs
);
13447 run_kernel_bzero (device_param
, device_param
->d_bfs_c
, size_bfs
);
13448 run_kernel_bzero (device_param
, device_param
->d_tm_c
, size_tm
);
13449 run_kernel_bzero (device_param
, device_param
->d_root_css_buf
, size_root_css
);
13450 run_kernel_bzero (device_param
, device_param
->d_markov_css_buf
, size_markov_css
);
13455 device_param
->d_esalt_bufs
= hc_clCreateBuffer (device_param
->context
, CL_MEM_READ_ONLY
, size_esalts
, NULL
);
13457 hc_clEnqueueWriteBuffer (device_param
->command_queue
, device_param
->d_esalt_bufs
, CL_TRUE
, 0, size_esalts
, data
.esalts_buf
, 0, NULL
, NULL
);
13464 uint
*result
= (uint
*) mymalloc (size_results
);
13466 memset (result
, 0, size_results
);
13468 device_param
->result
= result
;
13470 pw_t
*pws_buf
= (pw_t
*) mymalloc (size_pws
);
13472 memset (pws_buf
, 0, size_pws
);
13474 device_param
->pws_buf
= pws_buf
;
13476 pw_cache_t
*pw_caches
= (pw_cache_t
*) mycalloc (64, sizeof (pw_cache_t
));
13478 for (int i
= 0; i
< 64; i
++)
13480 pw_caches
[i
].pw_buf
.pw_len
= i
;
13481 pw_caches
[i
].cnt
= 0;
13484 device_param
->pw_caches
= pw_caches
;
13486 comb_t
*combs_buf
= (comb_t
*) mycalloc (GPU_COMBS
, sizeof (comb_t
));
13488 device_param
->combs_buf
= combs_buf
;
13490 void *hooks_buf
= mymalloc (size_hooks
);
13492 device_param
->hooks_buf
= hooks_buf
;
13494 device_param
->pw_transpose
= pw_transpose_to_hi1
;
13495 device_param
->pw_add
= pw_add_to_hc1
;
13501 device_param
->kernel_params_buf32
[21] = bitmap_mask
;
13502 device_param
->kernel_params_buf32
[22] = bitmap_shift1
;
13503 device_param
->kernel_params_buf32
[23] = bitmap_shift2
;
13504 device_param
->kernel_params_buf32
[24] = 0; // salt_pos
13505 device_param
->kernel_params_buf32
[25] = 0; // loop_pos
13506 device_param
->kernel_params_buf32
[26] = 0; // loop_cnt
13507 device_param
->kernel_params_buf32
[27] = 0; // gpu_rules_cnt
13508 device_param
->kernel_params_buf32
[28] = 0; // digests_cnt
13509 device_param
->kernel_params_buf32
[29] = 0; // digests_offset
13510 device_param
->kernel_params_buf32
[30] = 0; // combs_mode
13511 device_param
->kernel_params_buf32
[31] = 0; // gid_max
13513 device_param
->kernel_params
[ 0] = (attack_exec
== ATTACK_EXEC_ON_GPU
)
13514 ? &device_param
->d_pws_buf
13515 : &device_param
->d_pws_amp_buf
;
13516 device_param
->kernel_params
[ 1] = &device_param
->d_rules_c
;
13517 device_param
->kernel_params
[ 2] = &device_param
->d_combs_c
;
13518 device_param
->kernel_params
[ 3] = &device_param
->d_bfs_c
;
13519 device_param
->kernel_params
[ 4] = &device_param
->d_tmps
;
13520 device_param
->kernel_params
[ 5] = &device_param
->d_hooks
;
13521 device_param
->kernel_params
[ 6] = &device_param
->d_bitmap_s1_a
;
13522 device_param
->kernel_params
[ 7] = &device_param
->d_bitmap_s1_b
;
13523 device_param
->kernel_params
[ 8] = &device_param
->d_bitmap_s1_c
;
13524 device_param
->kernel_params
[ 9] = &device_param
->d_bitmap_s1_d
;
13525 device_param
->kernel_params
[10] = &device_param
->d_bitmap_s2_a
;
13526 device_param
->kernel_params
[11] = &device_param
->d_bitmap_s2_b
;
13527 device_param
->kernel_params
[12] = &device_param
->d_bitmap_s2_c
;
13528 device_param
->kernel_params
[13] = &device_param
->d_bitmap_s2_d
;
13529 device_param
->kernel_params
[14] = &device_param
->d_plain_bufs
;
13530 device_param
->kernel_params
[15] = &device_param
->d_digests_buf
;
13531 device_param
->kernel_params
[16] = &device_param
->d_digests_shown
;
13532 device_param
->kernel_params
[17] = &device_param
->d_salt_bufs
;
13533 device_param
->kernel_params
[18] = &device_param
->d_esalt_bufs
;
13534 device_param
->kernel_params
[19] = &device_param
->d_result
;
13535 device_param
->kernel_params
[20] = &device_param
->d_scryptV_buf
;
13536 device_param
->kernel_params
[21] = &device_param
->kernel_params_buf32
[21];
13537 device_param
->kernel_params
[22] = &device_param
->kernel_params_buf32
[22];
13538 device_param
->kernel_params
[23] = &device_param
->kernel_params_buf32
[23];
13539 device_param
->kernel_params
[24] = &device_param
->kernel_params_buf32
[24];
13540 device_param
->kernel_params
[25] = &device_param
->kernel_params_buf32
[25];
13541 device_param
->kernel_params
[26] = &device_param
->kernel_params_buf32
[26];
13542 device_param
->kernel_params
[27] = &device_param
->kernel_params_buf32
[27];
13543 device_param
->kernel_params
[28] = &device_param
->kernel_params_buf32
[28];
13544 device_param
->kernel_params
[29] = &device_param
->kernel_params_buf32
[29];
13545 device_param
->kernel_params
[30] = &device_param
->kernel_params_buf32
[30];
13546 device_param
->kernel_params
[31] = &device_param
->kernel_params_buf32
[31];
13548 device_param
->kernel_params_mp_buf64
[3] = 0;
13549 device_param
->kernel_params_mp_buf32
[4] = 0;
13550 device_param
->kernel_params_mp_buf32
[5] = 0;
13551 device_param
->kernel_params_mp_buf32
[6] = 0;
13552 device_param
->kernel_params_mp_buf32
[7] = 0;
13553 device_param
->kernel_params_mp_buf32
[8] = 0;
13555 device_param
->kernel_params_mp
[0] = NULL
;
13556 device_param
->kernel_params_mp
[1] = NULL
;
13557 device_param
->kernel_params_mp
[2] = NULL
;
13558 device_param
->kernel_params_mp
[3] = &device_param
->kernel_params_mp_buf64
[3];
13559 device_param
->kernel_params_mp
[4] = &device_param
->kernel_params_mp_buf32
[4];
13560 device_param
->kernel_params_mp
[5] = &device_param
->kernel_params_mp_buf32
[5];
13561 device_param
->kernel_params_mp
[6] = &device_param
->kernel_params_mp_buf32
[6];
13562 device_param
->kernel_params_mp
[7] = &device_param
->kernel_params_mp_buf32
[7];
13563 device_param
->kernel_params_mp
[8] = &device_param
->kernel_params_mp_buf32
[8];
13565 device_param
->kernel_params_mp_l_buf64
[3] = 0;
13566 device_param
->kernel_params_mp_l_buf32
[4] = 0;
13567 device_param
->kernel_params_mp_l_buf32
[5] = 0;
13568 device_param
->kernel_params_mp_l_buf32
[6] = 0;
13569 device_param
->kernel_params_mp_l_buf32
[7] = 0;
13570 device_param
->kernel_params_mp_l_buf32
[8] = 0;
13571 device_param
->kernel_params_mp_l_buf32
[9] = 0;
13573 device_param
->kernel_params_mp_l
[0] = NULL
;
13574 device_param
->kernel_params_mp_l
[1] = NULL
;
13575 device_param
->kernel_params_mp_l
[2] = NULL
;
13576 device_param
->kernel_params_mp_l
[3] = &device_param
->kernel_params_mp_l_buf64
[3];
13577 device_param
->kernel_params_mp_l
[4] = &device_param
->kernel_params_mp_l_buf32
[4];
13578 device_param
->kernel_params_mp_l
[5] = &device_param
->kernel_params_mp_l_buf32
[5];
13579 device_param
->kernel_params_mp_l
[6] = &device_param
->kernel_params_mp_l_buf32
[6];
13580 device_param
->kernel_params_mp_l
[7] = &device_param
->kernel_params_mp_l_buf32
[7];
13581 device_param
->kernel_params_mp_l
[8] = &device_param
->kernel_params_mp_l_buf32
[8];
13582 device_param
->kernel_params_mp_l
[9] = &device_param
->kernel_params_mp_l_buf32
[9];
13584 device_param
->kernel_params_mp_r_buf64
[3] = 0;
13585 device_param
->kernel_params_mp_r_buf32
[4] = 0;
13586 device_param
->kernel_params_mp_r_buf32
[5] = 0;
13587 device_param
->kernel_params_mp_r_buf32
[6] = 0;
13588 device_param
->kernel_params_mp_r_buf32
[7] = 0;
13589 device_param
->kernel_params_mp_r_buf32
[8] = 0;
13591 device_param
->kernel_params_mp_r
[0] = NULL
;
13592 device_param
->kernel_params_mp_r
[1] = NULL
;
13593 device_param
->kernel_params_mp_r
[2] = NULL
;
13594 device_param
->kernel_params_mp_r
[3] = &device_param
->kernel_params_mp_r_buf64
[3];
13595 device_param
->kernel_params_mp_r
[4] = &device_param
->kernel_params_mp_r_buf32
[4];
13596 device_param
->kernel_params_mp_r
[5] = &device_param
->kernel_params_mp_r_buf32
[5];
13597 device_param
->kernel_params_mp_r
[6] = &device_param
->kernel_params_mp_r_buf32
[6];
13598 device_param
->kernel_params_mp_r
[7] = &device_param
->kernel_params_mp_r_buf32
[7];
13599 device_param
->kernel_params_mp_r
[8] = &device_param
->kernel_params_mp_r_buf32
[8];
13601 device_param
->kernel_params_amp_buf32
[5] = 0; // combs_mode
13602 device_param
->kernel_params_amp_buf32
[6] = 0; // gid_max
13604 device_param
->kernel_params_amp
[0] = &device_param
->d_pws_buf
;
13605 device_param
->kernel_params_amp
[1] = &device_param
->d_pws_amp_buf
;
13606 device_param
->kernel_params_amp
[2] = &device_param
->d_rules_c
;
13607 device_param
->kernel_params_amp
[3] = &device_param
->d_combs_c
;
13608 device_param
->kernel_params_amp
[4] = &device_param
->d_bfs_c
;
13609 device_param
->kernel_params_amp
[5] = &device_param
->kernel_params_amp_buf32
[5];
13610 device_param
->kernel_params_amp
[6] = &device_param
->kernel_params_amp_buf32
[6];
13612 device_param
->kernel_params_tb
[0] = &device_param
->d_pws_buf
;
13614 device_param
->kernel_params_tm
[0] = &device_param
->d_bfs_c
;
13615 device_param
->kernel_params_tm
[1] = &device_param
->d_tm_c
;
13621 char kernel_name
[64];
13623 memset (kernel_name
, 0, sizeof (kernel_name
));
13625 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13627 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
13629 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 4);
13631 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13633 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 8);
13635 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13637 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_s%02d", kern_type
, 16);
13639 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13643 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 4);
13645 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13647 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 8);
13649 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13651 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_m%02d", kern_type
, 16);
13653 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13656 if (data
.attack_mode
== ATTACK_MODE_BF
)
13658 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13660 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tb", kern_type
);
13662 device_param
->kernel_tb
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13664 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_tm", kern_type
);
13666 device_param
->kernel_tm
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13672 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_init", kern_type
);
13674 device_param
->kernel1
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13676 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_loop", kern_type
);
13678 device_param
->kernel2
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13680 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_comp", kern_type
);
13682 device_param
->kernel3
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13684 if (opts_type
& OPTS_TYPE_HOOK12
)
13686 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook12", kern_type
);
13688 device_param
->kernel12
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13691 if (opts_type
& OPTS_TYPE_HOOK23
)
13693 snprintf (kernel_name
, sizeof (kernel_name
) - 1, "m%05d_hook23", kern_type
);
13695 device_param
->kernel23
= hc_clCreateKernel (device_param
->program
, kernel_name
);
13699 for (uint i
= 0; i
<= 20; i
++)
13701 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13702 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13703 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13705 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13706 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_mem
), device_param
->kernel_params
[i
]);
13709 for (uint i
= 21; i
<= 31; i
++)
13711 hc_clSetKernelArg (device_param
->kernel1
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13712 hc_clSetKernelArg (device_param
->kernel2
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13713 hc_clSetKernelArg (device_param
->kernel3
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13715 if (opts_type
& OPTS_TYPE_HOOK12
) hc_clSetKernelArg (device_param
->kernel12
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13716 if (opts_type
& OPTS_TYPE_HOOK23
) hc_clSetKernelArg (device_param
->kernel23
, i
, sizeof (cl_uint
), device_param
->kernel_params
[i
]);
13719 if (attack_mode
== ATTACK_MODE_BF
)
13721 device_param
->kernel_mp_l
= hc_clCreateKernel (device_param
->program_mp
, "l_markov");
13722 device_param
->kernel_mp_r
= hc_clCreateKernel (device_param
->program_mp
, "r_markov");
13724 if (opts_type
& OPTS_TYPE_PT_BITSLICE
)
13726 hc_clSetKernelArg (device_param
->kernel_tb
, 0, sizeof (cl_mem
), device_param
->kernel_params_tb
[0]);
13728 hc_clSetKernelArg (device_param
->kernel_tm
, 0, sizeof (cl_mem
), device_param
->kernel_params_tm
[0]);
13729 hc_clSetKernelArg (device_param
->kernel_tm
, 1, sizeof (cl_mem
), device_param
->kernel_params_tm
[1]);
13732 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
13734 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13736 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
13738 device_param
->kernel_mp
= hc_clCreateKernel (device_param
->program_mp
, "C_markov");
13741 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13747 device_param
->kernel_amp
= hc_clCreateKernel (device_param
->program_amp
, "amp");
13750 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
13756 for (uint i
= 0; i
< 5; i
++)
13758 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_mem
), device_param
->kernel_params_amp
[i
]);
13761 for (uint i
= 5; i
< 7; i
++)
13763 hc_clSetKernelArg (device_param
->kernel_amp
, i
, sizeof (cl_uint
), device_param
->kernel_params_amp
[i
]);
13768 * Store initial fanspeed if gpu_temp_retain is enabled
13771 int gpu_temp_retain_set
= 0;
13773 if (gpu_temp_disable
== 0)
13775 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD implied
13777 hc_thread_mutex_lock (mux_adl
);
13779 if (data
.hm_device
[device_id
].fan_supported
== 1)
13781 if (gpu_temp_retain_chgd
== 0)
13784 uint default_temp
= 0;
13786 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
);
13788 if (ADL_rc
== ADL_OK
)
13790 #define GPU_TEMP_RETAIN_ABORT_DIFF 15
13792 const uint gpu_temp_retain_target
= default_temp
- GPU_TEMP_RETAIN_ABORT_DIFF
;
13794 // special case with multi gpu setups: always use minimum retain
13796 if (gpu_temp_retain_set
== 0)
13798 gpu_temp_retain
= gpu_temp_retain_target
;
13799 gpu_temp_retain_set
= 1;
13803 gpu_temp_retain
= MIN (gpu_temp_retain
, gpu_temp_retain_target
);
13806 if (gpu_temp_abort_chgd
== 0) gpu_temp_abort
= gpu_temp_retain
+ GPU_TEMP_RETAIN_ABORT_DIFF
;
13810 const int fan_speed
= hm_get_fanspeed_with_device_id (device_id
);
13812 temp_retain_fanspeed_value
[device_id
] = fan_speed
;
13814 if (fan_speed
== -1)
13816 log_info ("WARNING: Failed to get current fan speed settings for gpu number: %i:", device_id
+ 1);
13818 temp_retain_fanspeed_value
[device_id
] = 0;
13822 hc_thread_mutex_unlock (mux_adl
);
13827 * Store original powercontrol/clocks settings, set overdrive 6 performance tuning settings
13830 if (powertune_enable
== 1) // VENDOR_ID_AMD implied
13832 hc_thread_mutex_lock (mux_adl
);
13834 if (data
.hm_device
[device_id
].od_version
== 6)
13838 // check powertune capabilities first, if not available then skip device
13840 int powertune_supported
= 0;
13842 if ((ADL_rc
= hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
13844 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
13849 if (powertune_supported
!= 0)
13851 // powercontrol settings
13853 ADLOD6PowerControlInfo powertune
= {0, 0, 0, 0, 0};
13855 if ((ADL_rc
= hc_ADL_Overdrive_PowerControlInfo_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &powertune
)) == ADL_OK
)
13857 ADL_rc
= hc_ADL_Overdrive_PowerControl_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &od_power_control_status
[device_id
]);
13860 if (ADL_rc
!= ADL_OK
)
13862 log_error ("ERROR: Failed to get current ADL PowerControl settings");
13867 if ((ADL_rc
= hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, powertune
.iMaxValue
)) != ADL_OK
)
13869 log_error ("ERROR: Failed to set new ADL PowerControl values");
13876 memset (&od_clock_mem_status
[device_id
], 0, sizeof (ADLOD6MemClockState
));
13878 od_clock_mem_status
[device_id
].state
.iNumberOfPerformanceLevels
= 2;
13880 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
)
13882 log_error ("ERROR: Failed to get ADL memory and engine clock frequency");
13887 // Query capabilities only to see if profiles were not "damaged", if so output a warning but do accept the users profile settings
13889 ADLOD6Capabilities caps
= {0, 0, 0, {0, 0, 0}, {0, 0, 0}, 0, 0};
13891 if ((ADL_rc
= hc_ADL_Overdrive_Capabilities_Get (data
.hm_dll
, data
.hm_device
[device_id
].adapter_index
.amd
, &caps
)) != ADL_OK
)
13893 log_error ("ERROR: Failed to get ADL device capabilities");
13898 int engine_clock_max
= caps
.sEngineClockRange
.iMax
* 0.6666;
13899 int memory_clock_max
= caps
.sMemoryClockRange
.iMax
* 0.6250;
13901 int warning_trigger_engine
= (int) (0.25 * (float) engine_clock_max
);
13902 int warning_trigger_memory
= (int) (0.25 * (float) memory_clock_max
);
13904 int engine_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iEngineClock
;
13905 int memory_clock_profile_max
= od_clock_mem_status
[device_id
].state
.aLevels
[1].iMemoryClock
;
13907 // warning if profile has to low max values
13909 if ((engine_clock_max
- engine_clock_profile_max
) > warning_trigger_engine
)
13911 log_info ("WARN: the custom profile seems to have too low maximum engine clock values. You therefore may not reach full performance");
13914 if ((memory_clock_max
- memory_clock_profile_max
) > warning_trigger_memory
)
13916 log_info ("WARN: the custom profile seems to have too low maximum memory clock values. You therefore may not reach full performance");
13919 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
13921 performance_state
->iNumberOfPerformanceLevels
= 2;
13923 performance_state
->aLevels
[0].iEngineClock
= engine_clock_profile_max
;
13924 performance_state
->aLevels
[1].iEngineClock
= engine_clock_profile_max
;
13925 performance_state
->aLevels
[0].iMemoryClock
= memory_clock_profile_max
;
13926 performance_state
->aLevels
[1].iMemoryClock
= memory_clock_profile_max
;
13928 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
)
13930 log_info ("ERROR: Failed to set ADL performance state");
13935 local_free (performance_state
);
13939 hc_thread_mutex_unlock (mux_adl
);
13943 data
.gpu_blocks_all
= gpu_blocks_all
;
13945 if (data
.quiet
== 0) log_info ("");
13948 * Inform user which algorithm is checked and at which workload setting
13951 if (benchmark
== 1)
13955 data
.quiet
= quiet
;
13957 char *hash_type
= strhashtype (data
.hash_mode
); // not a bug
13959 log_info ("Hashtype: %s", hash_type
);
13960 log_info ("Workload: %u loops, %u accel", gpu_loops
, gpu_accel
);
13965 * keep track of the progress
13968 data
.words_progress_done
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13969 data
.words_progress_rejected
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13970 data
.words_progress_restored
= (uint64_t *) mycalloc (data
.salts_cnt
, sizeof (uint64_t));
13977 if (_setmode (_fileno (stdin
), _O_BINARY
) == -1)
13979 log_error ("ERROR: %s: %s", "stdin", strerror (errno
));
13984 if (_setmode (_fileno (stdout
), _O_BINARY
) == -1)
13986 log_error ("ERROR: %s: %s", "stdout", strerror (errno
));
13991 if (_setmode (_fileno (stderr
), _O_BINARY
) == -1)
13993 log_error ("ERROR: %s: %s", "stderr", strerror (errno
));
14003 segment_size
*= (1024 * 1024);
14005 data
.segment_size
= segment_size
;
14007 wl_data_t
*wl_data
= (wl_data_t
*) mymalloc (sizeof (wl_data_t
));
14009 wl_data
->buf
= (char *) mymalloc (segment_size
);
14010 wl_data
->avail
= segment_size
;
14011 wl_data
->incr
= segment_size
;
14015 uint wordlist_mode
= ((optind
+ 1) < myargc
) ? WL_MODE_FILE
: WL_MODE_STDIN
;
14017 data
.wordlist_mode
= wordlist_mode
;
14019 cs_t
*css_buf
= NULL
;
14023 char **masks
= NULL
;
14024 char **dictfiles
= NULL
;
14026 uint mask_from_file
= 0;
14028 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
14030 if (wordlist_mode
== WL_MODE_FILE
)
14032 int wls_left
= myargc
- (optind
+ 1);
14034 for (int i
= 0; i
< wls_left
; i
++)
14036 char *l0_filename
= myargv
[optind
+ 1 + i
];
14038 struct stat l0_stat
;
14040 if (stat (l0_filename
, &l0_stat
) == -1)
14042 log_error ("ERROR: %s: %s", l0_filename
, strerror (errno
));
14047 uint is_dir
= S_ISDIR (l0_stat
.st_mode
);
14051 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14055 dictfiles
[dictcnt
- 1] = l0_filename
;
14059 // do not allow --keyspace w/ a directory
14063 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14068 char **dictionary_files
= NULL
;
14070 dictionary_files
= scan_directory (l0_filename
);
14072 if (dictionary_files
!= NULL
)
14074 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14076 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14078 char *l1_filename
= dictionary_files
[d
];
14080 struct stat l1_stat
;
14082 if (stat (l1_filename
, &l1_stat
) == -1)
14084 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14089 if (S_ISREG (l1_stat
.st_mode
))
14091 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14095 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14100 local_free (dictionary_files
);
14106 log_error ("ERROR: No usable dictionary file found.");
14111 else if (wordlist_mode
== WL_MODE_STDIN
)
14116 else if (attack_mode
== ATTACK_MODE_COMBI
)
14120 char *dictfile1
= myargv
[optind
+ 1 + 0];
14121 char *dictfile2
= myargv
[optind
+ 1 + 1];
14123 // find the bigger dictionary and use as base
14128 struct stat tmp_stat
;
14130 if ((fp1
= fopen (dictfile1
, "rb")) == NULL
)
14132 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14137 if (stat (dictfile1
, &tmp_stat
) == -1)
14139 log_error ("ERROR: %s: %s", dictfile1
, strerror (errno
));
14146 if (S_ISDIR (tmp_stat
.st_mode
))
14148 log_error ("ERROR: %s must be a regular file", dictfile1
, strerror (errno
));
14155 if ((fp2
= fopen (dictfile2
, "rb")) == NULL
)
14157 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14164 if (stat (dictfile2
, &tmp_stat
) == -1)
14166 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
14174 if (S_ISDIR (tmp_stat
.st_mode
))
14176 log_error ("ERROR: %s must be a regular file", dictfile2
, strerror (errno
));
14184 data
.combs_cnt
= 1;
14188 const uint64_t words1_cnt
= count_words (wl_data
, fp1
, dictfile1
, dictstat_base
, &dictstat_nmemb
);
14190 data
.quiet
= quiet
;
14192 if (words1_cnt
== 0)
14194 log_error ("ERROR: %s: empty file", dictfile1
);
14202 data
.combs_cnt
= 1;
14206 const uint64_t words2_cnt
= count_words (wl_data
, fp2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
14208 data
.quiet
= quiet
;
14210 if (words2_cnt
== 0)
14212 log_error ("ERROR: %s: empty file", dictfile2
);
14223 data
.dictfile
= dictfile1
;
14224 data
.dictfile2
= dictfile2
;
14226 if (words1_cnt
>= words2_cnt
)
14228 data
.combs_cnt
= words2_cnt
;
14229 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14231 dictfiles
= &data
.dictfile
;
14237 data
.combs_cnt
= words1_cnt
;
14238 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14240 dictfiles
= &data
.dictfile2
;
14244 // we also have to switch wordlist related rules!
14246 char *tmpc
= data
.rule_buf_l
;
14248 data
.rule_buf_l
= data
.rule_buf_r
;
14249 data
.rule_buf_r
= tmpc
;
14251 int tmpi
= data
.rule_len_l
;
14253 data
.rule_len_l
= data
.rule_len_r
;
14254 data
.rule_len_r
= tmpi
;
14257 else if (attack_mode
== ATTACK_MODE_BF
)
14263 if (benchmark
== 0)
14265 mask
= myargv
[optind
+ 1];
14267 masks
= (char **) mymalloc (INCR_MASKS
* sizeof (char *));
14269 if ((optind
+ 2) <= myargc
)
14271 struct stat file_stat
;
14273 if (stat (mask
, &file_stat
) == -1)
14277 masks
[maskcnt
- 1] = mystrdup (mask
);
14281 int wls_left
= myargc
- (optind
+ 1);
14283 uint masks_avail
= INCR_MASKS
;
14285 for (int i
= 0; i
< wls_left
; i
++)
14289 mask
= myargv
[optind
+ 1 + i
];
14291 if (stat (mask
, &file_stat
) == -1)
14293 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14299 uint is_file
= S_ISREG (file_stat
.st_mode
);
14305 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14307 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14312 char line_buf
[BUFSIZ
];
14314 while (!feof (mask_fp
))
14316 memset (line_buf
, 0, BUFSIZ
);
14318 int line_len
= fgetl (mask_fp
, line_buf
);
14320 if (line_len
== 0) continue;
14322 if (line_buf
[0] == '#') continue;
14324 if (masks_avail
== maskcnt
)
14326 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14328 masks_avail
+= INCR_MASKS
;
14331 masks
[maskcnt
] = mystrdup (line_buf
);
14340 log_error ("ERROR: %s: unsupported file-type", mask
);
14346 mask_from_file
= 1;
14351 custom_charset_1
= (char *) "?l?d?u";
14352 custom_charset_2
= (char *) "?l?d";
14353 custom_charset_3
= (char *) "?l?d*!$@_";
14355 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14356 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14357 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14359 masks
[maskcnt
] = mystrdup ("?1?2?2?2?2?2?2?3?3?3?3?d?d?d?d");
14361 wordlist_mode
= WL_MODE_MASK
;
14363 data
.wordlist_mode
= wordlist_mode
;
14373 * generate full masks and charsets
14376 masks
= (char **) mymalloc (sizeof (char *));
14380 case 1731: pw_min
= 5;
14382 mask
= mystrdup ("?b?b?b?b?b");
14384 case 12500: pw_min
= 5;
14386 mask
= mystrdup ("?b?b?b?b?b");
14388 default: pw_min
= 7;
14390 mask
= mystrdup ("?b?b?b?b?b?b?b");
14396 masks
[maskcnt
- 1] = mystrdup (mask
);
14398 wordlist_mode
= WL_MODE_MASK
;
14400 data
.wordlist_mode
= wordlist_mode
;
14405 dictfiles
= (char **) mycalloc (pw_max
, sizeof (char *));
14409 if (increment_min
> pw_min
) pw_min
= increment_min
;
14411 if (increment_max
< pw_max
) pw_max
= increment_max
;
14414 else if (attack_mode
== ATTACK_MODE_HYBRID1
)
14416 data
.combs_mode
= COMBINATOR_MODE_BASE_LEFT
;
14420 char *mask
= myargv
[myargc
- 1];
14424 masks
= (char **) mymalloc (1 * sizeof (char *));
14428 struct stat file_stat
;
14430 if (stat (mask
, &file_stat
) == -1)
14434 masks
[maskcnt
- 1] = mystrdup (mask
);
14438 uint is_file
= S_ISREG (file_stat
.st_mode
);
14444 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14446 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14451 char line_buf
[BUFSIZ
];
14453 uint masks_avail
= 1;
14455 while (!feof (mask_fp
))
14457 memset (line_buf
, 0, BUFSIZ
);
14459 int line_len
= fgetl (mask_fp
, line_buf
);
14461 if (line_len
== 0) continue;
14463 if (line_buf
[0] == '#') continue;
14465 if (masks_avail
== maskcnt
)
14467 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14469 masks_avail
+= INCR_MASKS
;
14472 masks
[maskcnt
] = mystrdup (line_buf
);
14479 mask_from_file
= 1;
14485 masks
[maskcnt
- 1] = mystrdup (mask
);
14491 int wls_left
= myargc
- (optind
+ 2);
14493 for (int i
= 0; i
< wls_left
; i
++)
14495 char *filename
= myargv
[optind
+ 1 + i
];
14497 struct stat file_stat
;
14499 if (stat (filename
, &file_stat
) == -1)
14501 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14506 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14510 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14514 dictfiles
[dictcnt
- 1] = filename
;
14518 // do not allow --keyspace w/ a directory
14522 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14527 char **dictionary_files
= NULL
;
14529 dictionary_files
= scan_directory (filename
);
14531 if (dictionary_files
!= NULL
)
14533 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14535 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14537 char *l1_filename
= dictionary_files
[d
];
14539 struct stat l1_stat
;
14541 if (stat (l1_filename
, &l1_stat
) == -1)
14543 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14548 if (S_ISREG (l1_stat
.st_mode
))
14550 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14554 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14559 local_free (dictionary_files
);
14565 log_error ("ERROR: No usable dictionary file found.");
14574 uint mask_min
= increment_min
; // we can't reject smaller masks here
14575 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14577 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14579 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14581 if (cur_mask
== NULL
) break;
14583 masks
[maskcnt
] = cur_mask
;
14587 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14591 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
14593 data
.combs_mode
= COMBINATOR_MODE_BASE_RIGHT
;
14597 char *mask
= myargv
[optind
+ 1 + 0];
14601 masks
= (char **) mymalloc (1 * sizeof (char *));
14605 struct stat file_stat
;
14607 if (stat (mask
, &file_stat
) == -1)
14611 masks
[maskcnt
- 1] = mystrdup (mask
);
14615 uint is_file
= S_ISREG (file_stat
.st_mode
);
14621 if ((mask_fp
= fopen (mask
, "r")) == NULL
)
14623 log_error ("ERROR: %s: %s", mask
, strerror (errno
));
14628 char line_buf
[BUFSIZ
];
14630 uint masks_avail
= 1;
14632 while (!feof (mask_fp
))
14634 memset (line_buf
, 0, BUFSIZ
);
14636 int line_len
= fgetl (mask_fp
, line_buf
);
14638 if (line_len
== 0) continue;
14640 if (line_buf
[0] == '#') continue;
14642 if (masks_avail
== maskcnt
)
14644 masks
= (char **) myrealloc (masks
, masks_avail
* sizeof (char *), INCR_MASKS
* sizeof (char *));
14646 masks_avail
+= INCR_MASKS
;
14649 masks
[maskcnt
] = mystrdup (line_buf
);
14656 mask_from_file
= 1;
14662 masks
[maskcnt
- 1] = mystrdup (mask
);
14668 int wls_left
= myargc
- (optind
+ 2);
14670 for (int i
= 0; i
< wls_left
; i
++)
14672 char *filename
= myargv
[optind
+ 2 + i
];
14674 struct stat file_stat
;
14676 if (stat (filename
, &file_stat
) == -1)
14678 log_error ("ERROR: %s: %s", filename
, strerror (errno
));
14683 uint is_dir
= S_ISDIR (file_stat
.st_mode
);
14687 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14691 dictfiles
[dictcnt
- 1] = filename
;
14695 // do not allow --keyspace w/ a directory
14699 log_error ("ERROR: keyspace parameter is not allowed together with a directory");
14704 char **dictionary_files
= NULL
;
14706 dictionary_files
= scan_directory (filename
);
14708 if (dictionary_files
!= NULL
)
14710 qsort (dictionary_files
, count_dictionaries (dictionary_files
), sizeof (char *), sort_by_stringptr
);
14712 for (int d
= 0; dictionary_files
[d
] != NULL
; d
++)
14714 char *l1_filename
= dictionary_files
[d
];
14716 struct stat l1_stat
;
14718 if (stat (l1_filename
, &l1_stat
) == -1)
14720 log_error ("ERROR: %s: %s", l1_filename
, strerror (errno
));
14725 if (S_ISREG (l1_stat
.st_mode
))
14727 dictfiles
= (char **) myrealloc (dictfiles
, dictcnt
* sizeof (char *), sizeof (char *));
14731 dictfiles
[dictcnt
- 1] = strdup (l1_filename
);
14736 local_free (dictionary_files
);
14742 log_error ("ERROR: No usable dictionary file found.");
14751 uint mask_min
= increment_min
; // we can't reject smaller masks here
14752 uint mask_max
= (increment_max
< pw_max
) ? increment_max
: pw_max
;
14754 for (uint mask_cur
= mask_min
; mask_cur
<= mask_max
; mask_cur
++)
14756 char *cur_mask
= mp_get_truncated_mask (mask
, strlen (mask
), mask_cur
);
14758 if (cur_mask
== NULL
) break;
14760 masks
[maskcnt
] = cur_mask
;
14764 masks
= (char **) myrealloc (masks
, maskcnt
* sizeof (char *), sizeof (char *));
14769 data
.pw_min
= pw_min
;
14770 data
.pw_max
= pw_max
;
14776 if (weak_hash_threshold
>= salts_cnt
)
14778 if (data
.quiet
== 0) log_info_nn ("Checking for weak hashes...");
14780 for (uint salt_pos
= 0; salt_pos
< salts_cnt
; salt_pos
++)
14782 weak_hash_check (&data
.devices_param
[0], salt_pos
, gpu_loops
);
14786 // Display hack, guarantee that there is at least one \r before real start
14788 if (data
.quiet
== 0) log_info_nn ("");
14791 * status and monitor threads
14794 if (data
.devices_status
!= STATUS_CRACKED
) data
.devices_status
= STATUS_STARTING
;
14796 hc_thread_t i_thread
= 0;
14798 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
14800 hc_thread_create (i_thread
, thread_keypress
, &benchmark
);
14803 if (wordlist_mode
== WL_MODE_STDIN
) data
.status
= 1;
14805 uint ni_threads_cnt
= 0;
14807 hc_thread_t
*ni_threads
= (hc_thread_t
*) mycalloc (10, sizeof (hc_thread_t
));
14809 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_monitor
, NULL
);
14819 if (outfile_check_timer
!= 0)
14821 if (data
.outfile_check_directory
!= NULL
)
14823 if ((hash_mode
!= 5200) &&
14824 !((hash_mode
>= 6200) && (hash_mode
<= 6299)) &&
14825 (hash_mode
!= 9000))
14827 hc_thread_create (ni_threads
[ni_threads_cnt
], thread_outfile_remove
, NULL
);
14833 outfile_check_timer
= 0;
14838 outfile_check_timer
= 0;
14844 * Inform the user if we got some hashes remove because of the pot file remove feature
14847 if (data
.quiet
== 0)
14849 if (potfile_remove_cracks
> 0)
14851 if (potfile_remove_cracks
== 1) log_info ("INFO: removed 1 hash found in pot file\n");
14852 else log_info ("INFO: removed %u hashes found in pot file\n", potfile_remove_cracks
);
14856 data
.outfile_check_timer
= outfile_check_timer
;
14862 char **induction_dictionaries
= NULL
;
14864 int induction_dictionaries_cnt
= 0;
14866 hcstat_table_t
*root_table_buf
= NULL
;
14867 hcstat_table_t
*markov_table_buf
= NULL
;
14869 uint initial_restore_done
= 0;
14871 data
.maskcnt
= maskcnt
;
14873 for (uint maskpos
= rd
->maskpos
; maskpos
< maskcnt
; maskpos
++)
14875 if (data
.devices_status
== STATUS_CRACKED
) break;
14877 data
.devices_status
= STATUS_INIT
;
14879 if (maskpos
> rd
->maskpos
)
14884 rd
->maskpos
= maskpos
;
14885 data
.maskpos
= maskpos
;
14887 if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
|| attack_mode
== ATTACK_MODE_BF
)
14889 char *mask
= masks
[maskpos
];
14891 if (mask_from_file
== 1)
14893 if (mask
[0] == '\\' && mask
[1] == '#') mask
++; // escaped comment sign (sharp) "\#"
14898 uint mask_offset
= 0;
14900 uint separator_cnt
;
14902 for (separator_cnt
= 0; separator_cnt
< 4; separator_cnt
++)
14904 str_ptr
= strstr (mask
+ mask_offset
, ",");
14906 if (str_ptr
== NULL
) break;
14908 str_pos
= str_ptr
- mask
;
14910 // escaped separator, i.e. "\,"
14914 if (mask
[str_pos
- 1] == '\\')
14918 mask_offset
= str_pos
+ 1;
14924 // reset the offset
14928 mask
[str_pos
] = '\0';
14930 switch (separator_cnt
)
14933 mp_reset_usr (mp_usr
, 0);
14935 custom_charset_1
= mask
;
14936 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_1
, 0);
14940 mp_reset_usr (mp_usr
, 1);
14942 custom_charset_2
= mask
;
14943 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_2
, 1);
14947 mp_reset_usr (mp_usr
, 2);
14949 custom_charset_3
= mask
;
14950 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_3
, 2);
14954 mp_reset_usr (mp_usr
, 3);
14956 custom_charset_4
= mask
;
14957 mp_setup_usr (mp_sys
, mp_usr
, custom_charset_4
, 3);
14961 mask
= mask
+ str_pos
+ 1;
14965 if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
14969 local_free (css_buf
);
14970 local_free (data
.root_css_buf
);
14971 local_free (data
.markov_css_buf
);
14973 local_free (masks
[maskpos
- 1]);
14976 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
14979 data
.css_cnt
= css_cnt
;
14980 data
.css_buf
= css_buf
;
14982 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
14984 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
14986 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
14988 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
14989 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
14991 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
14993 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
14995 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
14996 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
14998 data
.root_css_buf
= root_css_buf
;
14999 data
.markov_css_buf
= markov_css_buf
;
15001 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15003 data
.combs_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15005 local_free (root_table_buf
);
15006 local_free (markov_table_buf
);
15010 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15012 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15014 device_param
->kernel_params_mp
[0] = &device_param
->d_combs
;
15015 device_param
->kernel_params_mp
[1] = &device_param
->d_root_css_buf
;
15016 device_param
->kernel_params_mp
[2] = &device_param
->d_markov_css_buf
;
15018 device_param
->kernel_params_mp_buf64
[3] = 0;
15019 device_param
->kernel_params_mp_buf32
[4] = css_cnt
;
15020 device_param
->kernel_params_mp_buf32
[5] = 0;
15021 device_param
->kernel_params_mp_buf32
[6] = 0;
15022 device_param
->kernel_params_mp_buf32
[7] = 0;
15024 if (attack_mode
== ATTACK_MODE_HYBRID1
)
15026 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_buf32
[5] = full01
;
15027 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_buf32
[5] = full80
;
15028 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_buf32
[6] = 1;
15029 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_buf32
[7] = 1;
15031 else if (attack_mode
== ATTACK_MODE_HYBRID2
)
15033 device_param
->kernel_params_mp_buf32
[5] = 0;
15034 device_param
->kernel_params_mp_buf32
[6] = 0;
15035 device_param
->kernel_params_mp_buf32
[7] = 0;
15038 for (uint i
= 0; i
< 3; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_mem
), (void *) device_param
->kernel_params_mp
[i
]);
15039 for (uint i
= 3; i
< 4; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_ulong
), (void *) device_param
->kernel_params_mp
[i
]);
15040 for (uint i
= 4; i
< 8; i
++) hc_clSetKernelArg (device_param
->kernel_mp
, i
, sizeof (cl_uint
), (void *) device_param
->kernel_params_mp
[i
]);
15042 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
);
15043 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
);
15046 else if (attack_mode
== ATTACK_MODE_BF
)
15048 dictcnt
= 0; // number of "sub-masks", i.e. when using incremental mode
15052 for (uint i
= 0; i
< dictcnt
; i
++)
15054 local_free (dictfiles
[i
]);
15057 for (uint pw_len
= MAX (1, pw_min
); pw_len
<= pw_max
; pw_len
++)
15059 char *l1_filename
= mp_get_truncated_mask (mask
, strlen (mask
), pw_len
);
15061 if (l1_filename
== NULL
) break;
15065 dictfiles
[dictcnt
- 1] = l1_filename
;
15072 dictfiles
[dictcnt
- 1] = mask
;
15077 log_error ("ERROR: Mask is too small");
15084 free (induction_dictionaries
);
15086 // induction_dictionaries_cnt = 0; // implied
15088 if (attack_mode
!= ATTACK_MODE_BF
)
15092 induction_dictionaries
= scan_directory (induction_directory
);
15094 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15098 if (induction_dictionaries_cnt
)
15100 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15104 * prevent the user from using --keyspace together w/ maskfile and or dictfile
15108 if ((maskcnt
> 1) || (dictcnt
> 1))
15110 log_error ("ERROR: --keyspace is not supported with --increment or mask files");
15116 for (uint dictpos
= rd
->dictpos
; dictpos
< dictcnt
; )
15118 char *subid
= logfile_generate_subid ();
15120 data
.subid
= subid
;
15122 logfile_sub_msg ("START");
15124 data
.devices_status
= STATUS_INIT
;
15126 memset (data
.words_progress_done
, 0, data
.salts_cnt
* sizeof (uint64_t));
15127 memset (data
.words_progress_rejected
, 0, data
.salts_cnt
* sizeof (uint64_t));
15128 memset (data
.words_progress_restored
, 0, data
.salts_cnt
* sizeof (uint64_t));
15130 memset (data
.cpt_buf
, 0, CPT_BUF
* sizeof (cpt_t
));
15134 data
.cpt_start
= time (NULL
);
15136 data
.cpt_total
= 0;
15138 if (data
.restore
== 0)
15140 rd
->words_cur
= skip
;
15147 data
.ms_paused
= 0;
15149 data
.words_cur
= rd
->words_cur
;
15151 for (uint device_id
= 0; device_id
< data
.devices_cnt
; device_id
++)
15153 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15155 device_param
->speed_pos
= 0;
15157 memset (device_param
->speed_cnt
, 0, SPEED_CACHE
* sizeof (uint64_t));
15158 memset (device_param
->speed_ms
, 0, SPEED_CACHE
* sizeof (float));
15159 memset (device_param
->speed_rec
, 0, SPEED_CACHE
* sizeof (hc_timer_t
));
15161 device_param
->gpu_power
= device_param
->gpu_power_user
;
15162 device_param
->gpu_blocks
= device_param
->gpu_blocks_user
;
15164 device_param
->outerloop_pos
= 0;
15165 device_param
->outerloop_left
= 0;
15166 device_param
->innerloop_pos
= 0;
15167 device_param
->innerloop_left
= 0;
15169 // some more resets:
15171 memset (device_param
->pw_caches
, 0, 64 * sizeof (pw_cache_t
));
15173 memset (device_param
->pws_buf
, 0, device_param
->size_pws
);
15175 device_param
->pw_cnt
= 0;
15176 device_param
->pws_cnt
= 0;
15178 device_param
->words_off
= 0;
15179 device_param
->words_done
= 0;
15182 data
.gpu_blocks_div
= 0;
15184 // figure out some workload
15186 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15188 if (data
.wordlist_mode
== WL_MODE_FILE
)
15190 char *dictfile
= NULL
;
15192 if (induction_dictionaries_cnt
)
15194 dictfile
= induction_dictionaries
[0];
15198 dictfile
= dictfiles
[dictpos
];
15201 data
.dictfile
= dictfile
;
15203 logfile_sub_string (dictfile
);
15205 for (uint i
= 0; i
< rp_files_cnt
; i
++)
15207 logfile_sub_var_string ("rulefile", rp_files
[i
]);
15210 FILE *fd2
= fopen (dictfile
, "rb");
15214 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15219 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15223 if (data
.words_cnt
== 0)
15225 if (data
.devices_status
== STATUS_CRACKED
) break;
15226 if (data
.devices_status
== STATUS_ABORTED
) break;
15234 else if (attack_mode
== ATTACK_MODE_COMBI
)
15236 char *dictfile
= data
.dictfile
;
15237 char *dictfile2
= data
.dictfile2
;
15239 logfile_sub_string (dictfile
);
15240 logfile_sub_string (dictfile2
);
15242 if (data
.combs_mode
== COMBINATOR_MODE_BASE_LEFT
)
15244 FILE *fd2
= fopen (dictfile
, "rb");
15248 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15253 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15257 else if (data
.combs_mode
== COMBINATOR_MODE_BASE_RIGHT
)
15259 FILE *fd2
= fopen (dictfile2
, "rb");
15263 log_error ("ERROR: %s: %s", dictfile2
, strerror (errno
));
15268 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile2
, dictstat_base
, &dictstat_nmemb
);
15273 if (data
.words_cnt
== 0)
15275 if (data
.devices_status
== STATUS_CRACKED
) break;
15276 if (data
.devices_status
== STATUS_ABORTED
) break;
15283 else if ((attack_mode
== ATTACK_MODE_HYBRID1
) || (attack_mode
== ATTACK_MODE_HYBRID2
))
15285 char *dictfile
= NULL
;
15287 if (induction_dictionaries_cnt
)
15289 dictfile
= induction_dictionaries
[0];
15293 dictfile
= dictfiles
[dictpos
];
15296 data
.dictfile
= dictfile
;
15298 char *mask
= data
.mask
;
15300 logfile_sub_string (dictfile
);
15301 logfile_sub_string (mask
);
15303 FILE *fd2
= fopen (dictfile
, "rb");
15307 log_error ("ERROR: %s: %s", dictfile
, strerror (errno
));
15312 data
.words_cnt
= count_words (wl_data
, fd2
, dictfile
, dictstat_base
, &dictstat_nmemb
);
15316 if (data
.words_cnt
== 0)
15318 if (data
.devices_status
== STATUS_CRACKED
) break;
15319 if (data
.devices_status
== STATUS_ABORTED
) break;
15326 else if (attack_mode
== ATTACK_MODE_BF
)
15328 local_free (css_buf
);
15329 local_free (data
.root_css_buf
);
15330 local_free (data
.markov_css_buf
);
15332 char *mask
= dictfiles
[dictpos
];
15334 logfile_sub_string (mask
);
15338 css_buf
= mp_gen_css (mask
, strlen (mask
), mp_sys
, mp_usr
, &css_cnt
);
15340 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15342 uint css_cnt_unicode
= css_cnt
* 2;
15344 cs_t
*css_buf_unicode
= (cs_t
*) mycalloc (css_cnt_unicode
, sizeof (cs_t
));
15346 for (uint i
= 0, j
= 0; i
< css_cnt
; i
+= 1, j
+= 2)
15348 memcpy (&css_buf_unicode
[j
+ 0], &css_buf
[i
], sizeof (cs_t
));
15350 css_buf_unicode
[j
+ 1].cs_buf
[0] = 0;
15351 css_buf_unicode
[j
+ 1].cs_len
= 1;
15356 css_buf
= css_buf_unicode
;
15357 css_cnt
= css_cnt_unicode
;
15360 // check if mask is not too large or too small for pw_min/pw_max (*2 if unicode)
15362 uint mask_min
= pw_min
;
15363 uint mask_max
= pw_max
;
15365 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15371 if ((css_cnt
< mask_min
) || (css_cnt
> mask_max
))
15373 if (css_cnt
< mask_min
)
15375 log_info ("WARNING: skipping mask '%s' because it is smaller than the minimum password length", mask
);
15378 if (css_cnt
> mask_max
)
15380 log_info ("WARNING: skipping mask '%s' because it is larger than the maximum password length", mask
);
15383 // skip to next mask
15387 rd
->dictpos
= dictpos
;
15389 logfile_sub_msg ("STOP");
15394 uint save_css_cnt
= css_cnt
;
15396 if (opti_type
& OPTI_TYPE_SINGLE_HASH
)
15398 if (opti_type
& OPTI_TYPE_APPENDED_SALT
)
15400 uint salt_len
= (uint
) data
.salts_buf
[0].salt_len
;
15401 char *salt_buf
= (char *) data
.salts_buf
[0].salt_buf
;
15403 uint css_cnt_salt
= css_cnt
+ salt_len
;
15405 cs_t
*css_buf_salt
= (cs_t
*) mycalloc (css_cnt_salt
, sizeof (cs_t
));
15407 memcpy (css_buf_salt
, css_buf
, css_cnt
* sizeof (cs_t
));
15409 for (uint i
= 0, j
= css_cnt
; i
< salt_len
; i
++, j
++)
15411 css_buf_salt
[j
].cs_buf
[0] = salt_buf
[i
];
15412 css_buf_salt
[j
].cs_len
= 1;
15417 css_buf
= css_buf_salt
;
15418 css_cnt
= css_cnt_salt
;
15423 data
.css_cnt
= css_cnt
;
15424 data
.css_buf
= css_buf
;
15426 if (maskpos
> 0 && dictpos
== 0) free (masks
[maskpos
- 1]);
15428 uint uniq_tbls
[SP_PW_MAX
][CHARSIZ
];
15430 memset (uniq_tbls
, 0, sizeof (uniq_tbls
));
15432 mp_css_to_uniq_tbl (css_cnt
, css_buf
, uniq_tbls
);
15434 if (root_table_buf
== NULL
) root_table_buf
= (hcstat_table_t
*) mycalloc (SP_ROOT_CNT
, sizeof (hcstat_table_t
));
15435 if (markov_table_buf
== NULL
) markov_table_buf
= (hcstat_table_t
*) mycalloc (SP_MARKOV_CNT
, sizeof (hcstat_table_t
));
15437 sp_setup_tbl (install_dir
, markov_hcstat
, markov_disable
, markov_classic
, root_table_buf
, markov_table_buf
);
15439 markov_threshold
= (markov_threshold
!= 0) ? markov_threshold
: CHARSIZ
;
15441 cs_t
*root_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
, sizeof (cs_t
));
15442 cs_t
*markov_css_buf
= (cs_t
*) mycalloc (SP_PW_MAX
* CHARSIZ
, sizeof (cs_t
));
15444 data
.root_css_buf
= root_css_buf
;
15445 data
.markov_css_buf
= markov_css_buf
;
15447 sp_tbl_to_css (root_table_buf
, markov_table_buf
, root_css_buf
, markov_css_buf
, markov_threshold
, uniq_tbls
);
15449 data
.words_cnt
= sp_get_sum (0, css_cnt
, root_css_buf
);
15451 local_free (root_table_buf
);
15452 local_free (markov_table_buf
);
15456 uint css_cnt_l
= css_cnt
;
15459 if (attack_exec
== ATTACK_EXEC_ON_GPU
)
15461 if (save_css_cnt
< 6)
15465 else if (save_css_cnt
== 6)
15471 if (opts_type
& OPTS_TYPE_PT_UNICODE
)
15473 if (save_css_cnt
== 8 || save_css_cnt
== 10)
15484 if ((css_buf
[0].cs_len
* css_buf
[1].cs_len
* css_buf
[2].cs_len
) > 256)
15499 /* unfinished code?
15500 int sum = css_buf[css_cnt_r - 1].cs_len;
15502 for (uint i = 1; i < 4 && i < css_cnt; i++)
15504 if (sum > 1) break; // we really don't need alot of amplifier them for slow hashes
15508 sum *= css_buf[css_cnt_r - 1].cs_len;
15513 css_cnt_l
-= css_cnt_r
;
15515 data
.bfs_cnt
= sp_get_sum (0, css_cnt_r
, root_css_buf
);
15517 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15519 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15521 device_param
->kernel_params_mp_l
[0] = &device_param
->d_pws_buf
;
15522 device_param
->kernel_params_mp_l
[1] = &device_param
->d_root_css_buf
;
15523 device_param
->kernel_params_mp_l
[2] = &device_param
->d_markov_css_buf
;
15525 device_param
->kernel_params_mp_l_buf64
[3] = 0;
15526 device_param
->kernel_params_mp_l_buf32
[4] = css_cnt_l
;
15527 device_param
->kernel_params_mp_l_buf32
[5] = css_cnt_r
;
15528 device_param
->kernel_params_mp_l_buf32
[6] = 0;
15529 device_param
->kernel_params_mp_l_buf32
[7] = 0;
15530 device_param
->kernel_params_mp_l_buf32
[8] = 0;
15532 if (opts_type
& OPTS_TYPE_PT_ADD01
) device_param
->kernel_params_mp_l_buf32
[6] = full01
;
15533 if (opts_type
& OPTS_TYPE_PT_ADD80
) device_param
->kernel_params_mp_l_buf32
[6] = full80
;
15534 if (opts_type
& OPTS_TYPE_PT_ADDBITS14
) device_param
->kernel_params_mp_l_buf32
[7] = 1;
15535 if (opts_type
& OPTS_TYPE_PT_ADDBITS15
) device_param
->kernel_params_mp_l_buf32
[8] = 1;
15537 device_param
->kernel_params_mp_r
[0] = &device_param
->d_bfs
;
15538 device_param
->kernel_params_mp_r
[1] = &device_param
->d_root_css_buf
;
15539 device_param
->kernel_params_mp_r
[2] = &device_param
->d_markov_css_buf
;
15541 device_param
->kernel_params_mp_r_buf64
[3] = 0;
15542 device_param
->kernel_params_mp_r_buf32
[4] = css_cnt_r
;
15543 device_param
->kernel_params_mp_r_buf32
[5] = 0;
15544 device_param
->kernel_params_mp_r_buf32
[6] = 0;
15545 device_param
->kernel_params_mp_r_buf32
[7] = 0;
15547 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
]);
15548 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
]);
15549 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
]);
15551 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
]);
15552 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
]);
15553 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
]);
15555 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
);
15556 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
);
15560 uint64_t words_base
= data
.words_cnt
;
15562 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15564 if (data
.gpu_rules_cnt
)
15566 words_base
/= data
.gpu_rules_cnt
;
15569 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15571 if (data
.combs_cnt
)
15573 words_base
/= data
.combs_cnt
;
15576 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15580 words_base
/= data
.bfs_cnt
;
15584 data
.words_base
= words_base
;
15588 log_info ("%llu", (unsigned long long int) words_base
);
15593 if (data
.words_cur
> data
.words_base
)
15595 log_error ("ERROR: restore value greater keyspace");
15600 if (data
.words_cur
)
15602 if (data
.attack_kern
== ATTACK_KERN_STRAIGHT
)
15604 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15606 data
.words_progress_restored
[i
] = data
.words_cur
* data
.gpu_rules_cnt
;
15609 else if (data
.attack_kern
== ATTACK_KERN_COMBI
)
15611 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15613 data
.words_progress_restored
[i
] = data
.words_cur
* data
.combs_cnt
;
15616 else if (data
.attack_kern
== ATTACK_KERN_BF
)
15618 for (uint i
= 0; i
< data
.salts_cnt
; i
++)
15620 data
.words_progress_restored
[i
] = data
.words_cur
* data
.bfs_cnt
;
15626 * Inform user about possible slow speeds
15629 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15631 if (data
.words_base
< gpu_blocks_all
)
15636 log_info ("ATTENTION!");
15637 log_info (" The wordlist or mask you are using is too small.");
15638 log_info (" Therefore, oclHashcat is unable to utilize the full parallelization power of your GPU(s).");
15639 log_info (" The cracking speed will drop.");
15640 log_info (" Workaround: https://hashcat.net/wiki/doku.php?id=frequently_asked_questions#how_to_create_more_work_for_full_speed");
15647 * Update loopback file
15656 uint random_num
= get_random_num (0, 9999);
15658 snprintf (loopback_file
, loopback_size
- 1, "%s/%s.%d_%i", induction_directory
, LOOPBACK_FILE
, (int) now
, random_num
);
15660 data
.loopback_file
= loopback_file
;
15664 * Update dictionary statistic
15669 dictstat_fp
= fopen (dictstat
, "wb");
15673 fwrite (dictstat_base
, sizeof (dictstat_t
), dictstat_nmemb
, dictstat_fp
);
15675 fclose (dictstat_fp
);
15679 data
.devices_status
= STATUS_RUNNING
;
15681 if (initial_restore_done
== 0)
15683 if (data
.restore_disable
== 0) cycle_restore ();
15685 initial_restore_done
= 1;
15688 hc_timer_set (&data
.timer_running
);
15690 if ((wordlist_mode
== WL_MODE_FILE
) || (wordlist_mode
== WL_MODE_MASK
))
15692 if ((quiet
== 0) && (status
== 0) && (benchmark
== 0))
15694 if (quiet
== 0) fprintf (stdout
, "%s", PROMPT
);
15695 if (quiet
== 0) fflush (stdout
);
15698 else if (wordlist_mode
== WL_MODE_STDIN
)
15700 if (data
.quiet
== 0) log_info ("Starting attack in stdin mode...");
15701 if (data
.quiet
== 0) log_info ("");
15704 time_t runtime_start
;
15706 time (&runtime_start
);
15708 data
.runtime_start
= runtime_start
;
15711 * create cracker threads
15714 hc_thread_t
*c_threads
= (hc_thread_t
*) mycalloc (devices_cnt
, sizeof (hc_thread_t
));
15716 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15718 hc_device_param_t
*device_param
= &devices_param
[device_id
];
15720 device_param
->device_id
= device_id
;
15722 if (wordlist_mode
== WL_MODE_STDIN
)
15724 hc_thread_create (c_threads
[device_id
], thread_calc_stdin
, device_param
);
15728 hc_thread_create (c_threads
[device_id
], thread_calc
, device_param
);
15732 // wait for crack threads to exit
15734 hc_thread_wait (devices_cnt
, c_threads
);
15736 local_free (c_threads
);
15742 logfile_sub_var_uint ("status-after-work", data
.devices_status
);
15744 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15746 if (data
.devices_status
== STATUS_CRACKED
) break;
15747 if (data
.devices_status
== STATUS_ABORTED
) break;
15749 if (data
.devices_status
== STATUS_BYPASS
)
15751 data
.devices_status
= STATUS_RUNNING
;
15754 if (induction_dictionaries_cnt
)
15756 unlink (induction_dictionaries
[0]);
15759 free (induction_dictionaries
);
15761 if (attack_mode
!= ATTACK_MODE_BF
)
15763 induction_dictionaries
= scan_directory (induction_directory
);
15765 induction_dictionaries_cnt
= count_dictionaries (induction_dictionaries
);
15768 if (benchmark
== 0)
15770 if (((dictpos
+ 1) < dictcnt
) || ((maskpos
+ 1) < maskcnt
) || induction_dictionaries_cnt
)
15772 if (quiet
== 0) clear_prompt ();
15774 if (quiet
== 0) log_info ("");
15782 if (quiet
== 0) status_display ();
15785 if (quiet
== 0) log_info ("");
15789 if (attack_mode
== ATTACK_MODE_BF
)
15793 rd
->dictpos
= dictpos
;
15797 if (induction_dictionaries_cnt
)
15799 qsort (induction_dictionaries
, induction_dictionaries_cnt
, sizeof (char *), sort_by_mtime
);
15805 rd
->dictpos
= dictpos
;
15809 time_t runtime_stop
;
15811 time (&runtime_stop
);
15813 data
.runtime_stop
= runtime_stop
;
15815 logfile_sub_uint (runtime_start
);
15816 logfile_sub_uint (runtime_stop
);
15818 logfile_sub_msg ("STOP");
15820 global_free (subid
);
15823 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) check_checkpoint ();
15825 if (data
.devices_status
== STATUS_CRACKED
) break;
15826 if (data
.devices_status
== STATUS_ABORTED
) break;
15827 if (data
.devices_status
== STATUS_QUIT
) break;
15829 if (data
.devices_status
== STATUS_BYPASS
)
15831 data
.devices_status
= STATUS_RUNNING
;
15835 // 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
15837 if (attack_mode
== ATTACK_MODE_STRAIGHT
)
15839 if (data
.wordlist_mode
== WL_MODE_FILE
)
15841 if (data
.dictfile
== NULL
)
15843 if (dictfiles
!= NULL
)
15845 data
.dictfile
= dictfiles
[0];
15847 hc_timer_set (&data
.timer_running
);
15852 // NOTE: combi is okay because it is already set beforehand
15853 else if (attack_mode
== ATTACK_MODE_HYBRID1
|| attack_mode
== ATTACK_MODE_HYBRID2
)
15855 if (data
.dictfile
== NULL
)
15857 if (dictfiles
!= NULL
)
15859 hc_timer_set (&data
.timer_running
);
15861 data
.dictfile
= dictfiles
[0];
15865 else if (attack_mode
== ATTACK_MODE_BF
)
15867 if (data
.mask
== NULL
)
15869 hc_timer_set (&data
.timer_running
);
15871 data
.mask
= masks
[0];
15875 if ((data
.devices_status
!= STATUS_CRACKED
) && (data
.devices_status
!= STATUS_ABORTED
) && (data
.devices_status
!= STATUS_QUIT
))
15877 data
.devices_status
= STATUS_EXHAUSTED
;
15880 // if cracked / aborted remove last induction dictionary
15882 for (int file_pos
= 0; file_pos
< induction_dictionaries_cnt
; file_pos
++)
15884 struct stat induct_stat
;
15886 if (stat (induction_dictionaries
[file_pos
], &induct_stat
) == 0)
15888 unlink (induction_dictionaries
[file_pos
]);
15892 // wait for non-interactive threads
15894 for (uint thread_idx
= 0; thread_idx
< ni_threads_cnt
; thread_idx
++)
15896 hc_thread_wait (1, &ni_threads
[thread_idx
]);
15899 local_free (ni_threads
);
15901 // wait for interactive threads
15903 if ((data
.wordlist_mode
== WL_MODE_FILE
) || (data
.wordlist_mode
== WL_MODE_MASK
))
15905 hc_thread_wait (1, &i_thread
);
15908 // we dont need restore file anymore
15909 if (data
.restore_disable
== 0)
15911 if ((data
.devices_status
== STATUS_EXHAUSTED
) || (data
.devices_status
== STATUS_CRACKED
))
15913 unlink (eff_restore_file
);
15914 unlink (new_restore_file
);
15922 // finally save left hashes
15924 if ((hashlist_mode
== HL_MODE_FILE
) && (remove
== 1) && (data
.digests_saved
!= data
.digests_done
))
15933 if (benchmark
== 1)
15935 status_benchmark ();
15941 if (quiet
== 0) clear_prompt ();
15943 if (quiet
== 0) log_info ("");
15951 if (quiet
== 0) status_display ();
15954 if (quiet
== 0) log_info ("");
15957 for (uint device_id
= 0; device_id
< devices_cnt
; device_id
++)
15959 hc_device_param_t
*device_param
= &data
.devices_param
[device_id
];
15961 local_free (device_param
->result
);
15963 local_free (device_param
->pw_caches
);
15965 local_free (device_param
->combs_buf
);
15967 local_free (device_param
->hooks_buf
);
15969 local_free (device_param
->device_name
);
15971 local_free (device_param
->device_version
);
15973 local_free (device_param
->driver_version
);
15975 if (device_param
->pws_buf
) myfree (device_param
->pws_buf
);
15976 if (device_param
->d_pws_buf
) hc_clReleaseMemObject (device_param
->d_pws_buf
);
15977 if (device_param
->d_pws_amp_buf
) hc_clReleaseMemObject (device_param
->d_pws_amp_buf
);
15978 if (device_param
->d_rules
) hc_clReleaseMemObject (device_param
->d_rules
);
15979 if (device_param
->d_rules_c
) hc_clReleaseMemObject (device_param
->d_rules_c
);
15980 if (device_param
->d_combs
) hc_clReleaseMemObject (device_param
->d_combs
);
15981 if (device_param
->d_combs_c
) hc_clReleaseMemObject (device_param
->d_combs_c
);
15982 if (device_param
->d_bfs
) hc_clReleaseMemObject (device_param
->d_bfs
);
15983 if (device_param
->d_bfs_c
) hc_clReleaseMemObject (device_param
->d_bfs_c
);
15984 if (device_param
->d_bitmap_s1_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_a
);
15985 if (device_param
->d_bitmap_s1_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_b
);
15986 if (device_param
->d_bitmap_s1_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_c
);
15987 if (device_param
->d_bitmap_s1_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s1_d
);
15988 if (device_param
->d_bitmap_s2_a
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_a
);
15989 if (device_param
->d_bitmap_s2_b
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_b
);
15990 if (device_param
->d_bitmap_s2_c
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_c
);
15991 if (device_param
->d_bitmap_s2_d
) hc_clReleaseMemObject (device_param
->d_bitmap_s2_d
);
15992 if (device_param
->d_plain_bufs
) hc_clReleaseMemObject (device_param
->d_plain_bufs
);
15993 if (device_param
->d_digests_buf
) hc_clReleaseMemObject (device_param
->d_digests_buf
);
15994 if (device_param
->d_digests_shown
) hc_clReleaseMemObject (device_param
->d_digests_shown
);
15995 if (device_param
->d_salt_bufs
) hc_clReleaseMemObject (device_param
->d_salt_bufs
);
15996 if (device_param
->d_esalt_bufs
) hc_clReleaseMemObject (device_param
->d_esalt_bufs
);
15997 if (device_param
->d_tmps
) hc_clReleaseMemObject (device_param
->d_tmps
);
15998 if (device_param
->d_hooks
) hc_clReleaseMemObject (device_param
->d_hooks
);
15999 if (device_param
->d_result
) hc_clReleaseMemObject (device_param
->d_result
);
16000 if (device_param
->d_scryptV_buf
) hc_clReleaseMemObject (device_param
->d_scryptV_buf
);
16001 if (device_param
->d_root_css_buf
) hc_clReleaseMemObject (device_param
->d_root_css_buf
);
16002 if (device_param
->d_markov_css_buf
) hc_clReleaseMemObject (device_param
->d_markov_css_buf
);
16003 if (device_param
->d_tm_c
) hc_clReleaseMemObject (device_param
->d_tm_c
);
16005 if (device_param
->kernel1
) hc_clReleaseKernel (device_param
->kernel1
);
16006 if (device_param
->kernel12
) hc_clReleaseKernel (device_param
->kernel12
);
16007 if (device_param
->kernel2
) hc_clReleaseKernel (device_param
->kernel2
);
16008 if (device_param
->kernel23
) hc_clReleaseKernel (device_param
->kernel23
);
16009 if (device_param
->kernel3
) hc_clReleaseKernel (device_param
->kernel3
);
16010 if (device_param
->kernel_mp
) hc_clReleaseKernel (device_param
->kernel_mp
);
16011 if (device_param
->kernel_mp_l
) hc_clReleaseKernel (device_param
->kernel_mp_l
);
16012 if (device_param
->kernel_mp_r
) hc_clReleaseKernel (device_param
->kernel_mp_r
);
16013 if (device_param
->kernel_tb
) hc_clReleaseKernel (device_param
->kernel_tb
);
16014 if (device_param
->kernel_tm
) hc_clReleaseKernel (device_param
->kernel_tm
);
16015 if (device_param
->kernel_amp
) hc_clReleaseKernel (device_param
->kernel_amp
);
16017 if (device_param
->program
) hc_clReleaseProgram (device_param
->program
);
16018 if (device_param
->program_mp
) hc_clReleaseProgram (device_param
->program_mp
);
16019 if (device_param
->program_amp
) hc_clReleaseProgram (device_param
->program_amp
);
16020 if (device_param
->command_queue
) hc_clReleaseCommandQueue (device_param
->command_queue
);
16021 if (device_param
->context
) hc_clReleaseContext (device_param
->context
);
16024 // reset default fan speed
16026 if (gpu_temp_disable
== 0)
16028 if (gpu_temp_retain
!= 0) // VENDOR_ID_AMD is implied here
16030 hc_thread_mutex_lock (mux_adl
);
16032 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16034 if (data
.hm_device
[i
].fan_supported
== 1)
16036 int fanspeed
= temp_retain_fanspeed_value
[i
];
16038 if (fanspeed
== -1) continue;
16040 int rc
= hm_set_fanspeed_with_device_id_amd (i
, fanspeed
);
16042 if (rc
== -1) log_info ("WARNING: Failed to restore default fan speed for gpu number: %i:", i
);
16046 hc_thread_mutex_unlock (mux_adl
);
16050 // reset power tuning
16052 if (powertune_enable
== 1) // VENDOR_ID_AMD is implied here
16054 hc_thread_mutex_lock (mux_adl
);
16056 for (uint i
= 0; i
< data
.devices_cnt
; i
++)
16058 if (data
.hm_device
[i
].od_version
== 6)
16060 // check powertune capabilities first, if not available then skip device
16062 int powertune_supported
= 0;
16064 if ((hc_ADL_Overdrive6_PowerControl_Caps (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, &powertune_supported
)) != ADL_OK
)
16066 log_error ("ERROR: Failed to get ADL PowerControl Capabilities");
16071 if (powertune_supported
!= 0)
16073 // powercontrol settings
16075 if ((hc_ADL_Overdrive_PowerControl_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, od_power_control_status
[i
])) != ADL_OK
)
16077 log_info ("ERROR: Failed to restore the ADL PowerControl values");
16084 ADLOD6StateInfo
*performance_state
= (ADLOD6StateInfo
*) mycalloc (1, sizeof (ADLOD6StateInfo
) + sizeof (ADLOD6PerformanceLevel
));
16086 performance_state
->iNumberOfPerformanceLevels
= 2;
16088 performance_state
->aLevels
[0].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iEngineClock
;
16089 performance_state
->aLevels
[1].iEngineClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iEngineClock
;
16090 performance_state
->aLevels
[0].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[0].iMemoryClock
;
16091 performance_state
->aLevels
[1].iMemoryClock
= od_clock_mem_status
[i
].state
.aLevels
[1].iMemoryClock
;
16093 if ((hc_ADL_Overdrive_State_Set (data
.hm_dll
, data
.hm_device
[i
].adapter_index
.amd
, ADL_OD6_SETSTATE_PERFORMANCE
, performance_state
)) != ADL_OK
)
16095 log_info ("ERROR: Failed to restore ADL performance state");
16100 local_free (performance_state
);
16105 hc_thread_mutex_unlock (mux_adl
);
16108 if (gpu_temp_disable
== 0)
16110 if (vendor_id
== VENDOR_ID_NV
)
16113 hc_NVML_nvmlShutdown (data
.hm_dll
);
16121 if (vendor_id
== VENDOR_ID_AMD
)
16123 hc_ADL_Main_Control_Destroy (data
.hm_dll
);
16125 hm_close (data
.hm_dll
);
16129 if (vendor_id
== VENDOR_ID_NV
)
16131 hm_close (data
.hm_dll
);
16138 local_free (masks
);
16140 local_free (dictstat_base
);
16142 for (uint pot_pos
= 0; pot_pos
< pot_cnt
; pot_pos
++)
16144 pot_t
*pot_ptr
= &pot
[pot_pos
];
16146 hash_t
*hash
= &pot_ptr
->hash
;
16148 local_free (hash
->digest
);
16152 local_free (hash
->salt
);
16158 local_free (all_gpu_rules_cnt
);
16159 local_free (all_gpu_rules_buf
);
16161 local_free (wl_data
->buf
);
16162 local_free (wl_data
);
16164 local_free (bitmap_s1_a
);
16165 local_free (bitmap_s1_b
);
16166 local_free (bitmap_s1_c
);
16167 local_free (bitmap_s1_d
);
16168 local_free (bitmap_s2_a
);
16169 local_free (bitmap_s2_b
);
16170 local_free (bitmap_s2_c
);
16171 local_free (bitmap_s2_d
);
16173 local_free (temp_retain_fanspeed_value
);
16174 local_free (od_clock_mem_status
);
16175 local_free (od_power_control_status
);
16177 global_free (devices_param
);
16179 global_free (gpu_rules_buf
);
16181 global_free (root_css_buf
);
16182 global_free (markov_css_buf
);
16184 global_free (digests_buf
);
16185 global_free (digests_shown
);
16186 global_free (digests_shown_tmp
);
16188 global_free (salts_buf
);
16189 global_free (salts_shown
);
16191 global_free (esalts_buf
);
16193 global_free (words_progress_done
);
16194 global_free (words_progress_rejected
);
16195 global_free (words_progress_restored
);
16197 if (pot_fp
) fclose (pot_fp
);
16199 if (data
.devices_status
== STATUS_QUIT
) break;
16202 // destroy others mutex
16204 hc_thread_mutex_delete (mux_dispatcher
);
16205 hc_thread_mutex_delete (mux_counter
);
16206 hc_thread_mutex_delete (mux_display
);
16207 hc_thread_mutex_delete (mux_adl
);
16211 local_free (eff_restore_file
);
16212 local_free (new_restore_file
);
16218 local_free (loopback_file
);
16220 if (loopback
== 1) unlink (loopback_file
);
16222 // induction directory
16224 if (induction_dir
== NULL
)
16226 if (attack_mode
!= ATTACK_MODE_BF
)
16228 if (rmdir (induction_directory
) == -1)
16230 if (errno
== ENOENT
)
16232 // good, we can ignore
16234 else if (errno
== ENOTEMPTY
)
16236 // good, we can ignore
16240 log_error ("ERROR: %s: %s", induction_directory
, strerror (errno
));
16246 local_free (induction_directory
);
16250 // outfile-check directory
16252 if (outfile_check_dir
== NULL
)
16254 if (rmdir (outfile_check_directory
) == -1)
16256 if (errno
== ENOENT
)
16258 // good, we can ignore
16260 else if (errno
== ENOTEMPTY
)
16262 // good, we can ignore
16266 log_error ("ERROR: %s: %s", outfile_check_directory
, strerror (errno
));
16272 local_free (outfile_check_directory
);
16279 logfile_top_uint (proc_start
);
16280 logfile_top_uint (proc_stop
);
16282 logfile_top_msg ("STOP");
16284 if (quiet
== 0) log_info_nn ("Started: %s", ctime (&proc_start
));
16285 if (quiet
== 0) log_info_nn ("Stopped: %s", ctime (&proc_stop
));
16287 if (data
.devices_status
== STATUS_ABORTED
) return 2;
16288 if (data
.devices_status
== STATUS_QUIT
) return 2;
16289 if (data
.devices_status
== STATUS_STOP_AT_CHECKPOINT
) return 2;
16290 if (data
.devices_status
== STATUS_EXHAUSTED
) return 1;
16291 if (data
.devices_status
== STATUS_CRACKED
) return 0;