2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
37 #define GETCHAR(a,p) (((a)[(p) / 4] >> (((p) & 3) * 8)) & 0xff)
38 #define PUTCHAR(a,p,c) ((a)[(p) / 4] = (((a)[(p) / 4] & ~(0xff << (((p) & 3) * 8))) | ((c) << (((p) & 3) * 8))))
40 #define SETSHIFTEDINT(a,n,v) \
42 const u32 s = ((n) & 3) * 8; \
43 const u64 x = (u64) (v) << s; \
44 (a)[((n)/4)+0] &= ~(0xff << ((n & 3) * 8)); \
45 (a)[((n)/4)+0] |= x; \
46 (a)[((n)/4)+1] = x >> 32; \
49 __constant u32 sapb_trans_tbl[256] =
51 // first value hack for 0 byte as part of an optimization
52 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
53 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
54 0x3f, 0x40, 0x41, 0x50, 0x43, 0x44, 0x45, 0x4b, 0x47, 0x48, 0x4d, 0x4e, 0x54, 0x51, 0x53, 0x46,
55 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x56, 0x55, 0x5c, 0x49, 0x5d, 0x4a,
56 0x42, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
57 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x58, 0x5b, 0x59, 0xff, 0x52,
58 0x4c, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
59 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x57, 0x5e, 0x5a, 0x4f, 0xff,
60 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
61 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
62 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
63 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
64 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
65 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
66 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
67 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
70 __constant u32 bcodeArray[48] =
72 0x14, 0x77, 0xf3, 0xd4, 0xbb, 0x71, 0x23, 0xd0, 0x03, 0xff, 0x47, 0x93, 0x55, 0xaa, 0x66, 0x91,
73 0xf2, 0x88, 0x6b, 0x99, 0xbf, 0xcb, 0x32, 0x1a, 0x19, 0xd9, 0xa7, 0x82, 0x22, 0x49, 0xa2, 0x51,
74 0xe2, 0xb7, 0x33, 0x71, 0x8b, 0x9f, 0x5d, 0x01, 0x44, 0x70, 0xae, 0x11, 0xef, 0x28, 0xf0, 0x0d
77 static u32x sapb_trans (const u32x in)
82 out |= (sapb_trans_tbl[(in >> 0) & 0xff]) << 0;
83 out |= (sapb_trans_tbl[(in >> 8) & 0xff]) << 8;
84 out |= (sapb_trans_tbl[(in >> 16) & 0xff]) << 16;
85 out |= (sapb_trans_tbl[(in >> 24) & 0xff]) << 24;
91 static u32x walld0rf_magic (const u32x w0[4], const u32 pw_len, const u32x salt_buf0[4], const u32 salt_len, const u32x a, const u32x b, const u32x c, const u32x d, u32x t[16])
110 u32 sum20 = ((a >> 24) & 3)
118 const u32 w[2] = { w0[0], w0[1] };
120 const u32 s[3] = { salt_buf0[0], salt_buf0[1], salt_buf0[2] };
122 u32 saved_key[4] = { a, b, c, d };
128 // we can assume this because the password must be at least 3
129 // and the username must be at least 1 so we can save the if ()
135 t0 |= bcodeArray[47] << 0;
136 t0 |= (w[0] & 0xff) << 8;
137 t0 |= (s[0] & 0xff) << 16;
138 t0 |= bcodeArray[ 1] << 24;
146 t0 |= (w[0] & 0xff) << 0;
147 t0 |= (s[0] & 0xff) << 8;
148 t0 |= bcodeArray[ 0] << 16;
157 // because the following code can increase i2 by a maximum of 5,
158 // there is an overflow potential of 4 before it comes to the next test for i2 >= sum20
159 // we need to truncate in that case
161 while ((i1 < pw_len) && (i3 < salt_len))
167 if (GETCHAR (saved_key, 15 - i1) & 1)
169 x0 |= bcodeArray[48 - 1 - i1] << 0; i2++;
170 x0 |= GETCHAR (w, i1) << 8; i2++; i1++;
171 x0 |= GETCHAR (s, i3) << 16; i2++; i3++;
172 x0 |= bcodeArray[i2 - i1 - i3] << 24; i2++; i2++;
176 x0 |= GETCHAR (w, i1) << 0; i2++; i1++;
177 x0 |= GETCHAR (s, i3) << 8; i2++; i3++;
178 x0 |= bcodeArray[i2 - i1 - i3] << 16; i2++; i2++;
181 SETSHIFTEDINT (t, i2_sav, x0);
189 while ((i1 < pw_len) || (i3 < salt_len))
191 if (i1 < pw_len) // max 8
193 if (GETCHAR (saved_key, 15 - i1) & 1)
195 PUTCHAR (t, i2, bcodeArray[48 - 1 - i1]);
200 PUTCHAR (t, i2, GETCHAR (w, i1));
207 PUTCHAR (t, i2, GETCHAR (s, i3));
213 PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
226 PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
235 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_m04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
241 const u32 lid = get_local_id (0);
247 const u32 gid = get_global_id (0);
249 if (gid >= gid_max) return;
253 wordl0[0] = pws[gid].i[ 0];
254 wordl0[1] = pws[gid].i[ 1];
279 const u32 pw_l_len = pws[gid].pw_len;
281 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
283 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
292 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
293 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
294 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
297 const u32 salt_len = salt_bufs[salt_pos].salt_len;
299 salt_buf0[0] = sapb_trans (salt_buf0[0]);
300 salt_buf0[1] = sapb_trans (salt_buf0[1]);
301 salt_buf0[2] = sapb_trans (salt_buf0[2]);
311 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
313 const u32 pw_r_len = combs_buf[il_pos].pw_len;
315 const u32 pw_len = pw_l_len + pw_r_len;
319 wordr0[0] = combs_buf[il_pos].i[0];
320 wordr0[1] = combs_buf[il_pos].i[1];
345 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
347 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
352 w0[0] = sapb_trans (wordl0[0] | wordr0[0]);
353 w0[1] = sapb_trans (wordl0[1] | wordr0[1]);
363 s0[0] = salt_buf0[0];
364 s0[1] = salt_buf0[1];
365 s0[2] = salt_buf0[2];
389 switch_buffer_by_offset (s0, s1, s2, s3, pw_len);
391 const u32 pw_salt_len = pw_len + salt_len;
395 t[ 0] = s0[0] | w0[0];
396 t[ 1] = s0[1] | w0[1];
409 t[14] = pw_salt_len * 8;
412 PUTCHAR (t, pw_salt_len, 0x80);
423 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
424 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
425 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
426 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
427 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
428 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
429 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
430 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
431 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
432 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
433 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
434 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
435 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
436 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
437 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
438 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
440 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
441 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
442 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
443 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
444 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
445 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
446 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
447 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
448 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
449 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
450 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
451 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
452 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
453 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
454 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
455 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
457 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
458 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
459 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
460 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
461 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
462 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
463 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
464 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
465 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
466 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
467 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
468 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
469 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
470 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
471 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
472 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
474 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
475 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
476 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
477 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
478 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
479 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
480 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
481 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
482 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
483 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
484 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
485 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
486 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
487 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
488 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
489 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
496 const u32x sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
498 SETSHIFTEDINT (t, sum20, 0x80);
507 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
508 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
509 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
510 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
511 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
512 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
513 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
514 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
515 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
516 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
517 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
518 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
519 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
520 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
521 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
522 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
524 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
525 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
526 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
527 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
528 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
529 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
530 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
531 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
532 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
533 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
534 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
535 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
536 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
537 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
538 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
539 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
541 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
542 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
543 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
544 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
545 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
546 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
547 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
548 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
549 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
550 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
551 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
552 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
553 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
554 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
555 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
556 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
558 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
559 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
560 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
561 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
562 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
563 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
564 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
565 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
566 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
567 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
568 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
569 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
570 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
571 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
572 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
573 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
588 #include VECT_COMPARE_M
592 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_m08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
596 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_m16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
600 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_s04 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
606 const u32 lid = get_local_id (0);
612 const u32 gid = get_global_id (0);
614 if (gid >= gid_max) return;
618 wordl0[0] = pws[gid].i[ 0];
619 wordl0[1] = pws[gid].i[ 1];
644 const u32 pw_l_len = pws[gid].pw_len;
646 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
648 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
657 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
658 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
659 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
662 const u32 salt_len = salt_bufs[salt_pos].salt_len;
664 salt_buf0[0] = sapb_trans (salt_buf0[0]);
665 salt_buf0[1] = sapb_trans (salt_buf0[1]);
666 salt_buf0[2] = sapb_trans (salt_buf0[2]);
672 const u32 search[4] =
674 digests_buf[digests_offset].digest_buf[DGST_R0],
675 digests_buf[digests_offset].digest_buf[DGST_R1],
676 digests_buf[digests_offset].digest_buf[DGST_R2],
677 digests_buf[digests_offset].digest_buf[DGST_R3]
684 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
686 const u32 pw_r_len = combs_buf[il_pos].pw_len;
688 const u32 pw_len = pw_l_len + pw_r_len;
692 wordr0[0] = combs_buf[il_pos].i[0];
693 wordr0[1] = combs_buf[il_pos].i[1];
718 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
720 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
725 w0[0] = sapb_trans (wordl0[0] | wordr0[0]);
726 w0[1] = sapb_trans (wordl0[1] | wordr0[1]);
736 s0[0] = salt_buf0[0];
737 s0[1] = salt_buf0[1];
738 s0[2] = salt_buf0[2];
762 switch_buffer_by_offset (s0, s1, s2, s3, pw_len);
764 const u32 pw_salt_len = pw_len + salt_len;
768 t[ 0] = s0[0] | w0[0];
769 t[ 1] = s0[1] | w0[1];
782 t[14] = pw_salt_len * 8;
785 PUTCHAR (t, pw_salt_len, 0x80);
796 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
797 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
798 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
799 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
800 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
801 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
802 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
803 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
804 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
805 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
806 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
807 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
808 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
809 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
810 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
811 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
813 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
814 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
815 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
816 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
817 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
818 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
819 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
820 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
821 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
822 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
823 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
824 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
825 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
826 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
827 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
828 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
830 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
831 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
832 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
833 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
834 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
835 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
836 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
837 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
838 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
839 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
840 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
841 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
842 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
843 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
844 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
845 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
847 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
848 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
849 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
850 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
851 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
852 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
853 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
854 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
855 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
856 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
857 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
858 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
859 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
860 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
861 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
862 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
869 const u32x sum20 = walld0rf_magic (w0, pw_len, salt_buf0, salt_len, a, b, c, d, t);
871 SETSHIFTEDINT (t, sum20, 0x80);
880 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
881 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
882 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
883 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
884 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
885 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
886 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
887 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
888 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
889 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
890 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
891 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
892 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
893 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
894 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
895 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
897 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
898 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
899 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
900 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
901 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
902 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
903 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
904 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
905 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
906 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
907 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
908 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
909 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
910 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
911 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
912 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
914 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
915 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
916 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
917 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
918 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
919 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
920 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
921 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
922 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
923 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
924 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
925 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
926 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
927 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
928 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
929 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
931 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
932 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
933 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
934 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
935 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
936 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
937 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
938 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
939 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
940 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
941 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
942 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
943 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
944 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
945 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
946 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
961 #include VECT_COMPARE_S
965 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_s08 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
969 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m07700_s16 (__global pw_t *pws, __global gpu_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)