2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
24 #include "include/kernel_functions.c"
26 #include "common_nv.c"
27 #include "include/rp_gpu.h"
31 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
32 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
35 #define GETCHAR(a,p) (((a)[(p) / 4] >> (((p) & 3) * 8)) & 0xff)
36 #define PUTCHAR(a,p,c) ((a)[(p) / 4] = (((a)[(p) / 4] & ~(0xff << (((p) & 3) * 8))) | ((c) << (((p) & 3) * 8))))
38 __device__ __constant__ u32 sapb_trans_tbl[256] =
40 // first value hack for 0 byte as part of an optimization
41 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
42 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
43 0x3f, 0x40, 0x41, 0x50, 0x43, 0x44, 0x45, 0x4b, 0x47, 0x48, 0x4d, 0x4e, 0x54, 0x51, 0x53, 0x46,
44 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x56, 0x55, 0x5c, 0x49, 0x5d, 0x4a,
45 0x42, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
46 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x58, 0x5b, 0x59, 0xff, 0x52,
47 0x4c, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
48 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x57, 0x5e, 0x5a, 0x4f, 0xff,
49 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
50 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
51 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
52 0xff, 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 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
55 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
56 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
59 __device__ __constant__ u32 bcodeArray[48] =
61 0x14, 0x77, 0xf3, 0xd4, 0xbb, 0x71, 0x23, 0xd0, 0x03, 0xff, 0x47, 0x93, 0x55, 0xaa, 0x66, 0x91,
62 0xf2, 0x88, 0x6b, 0x99, 0xbf, 0xcb, 0x32, 0x1a, 0x19, 0xd9, 0xa7, 0x82, 0x22, 0x49, 0xa2, 0x51,
63 0xe2, 0xb7, 0x33, 0x71, 0x8b, 0x9f, 0x5d, 0x01, 0x44, 0x70, 0xae, 0x11, 0xef, 0x28, 0xf0, 0x0d
66 __device__ static u32x sapb_trans (const u32x in)
71 out |= (sapb_trans_tbl[(in >> 0) & 0xff]) << 0;
72 out |= (sapb_trans_tbl[(in >> 8) & 0xff]) << 8;
73 out |= (sapb_trans_tbl[(in >> 16) & 0xff]) << 16;
74 out |= (sapb_trans_tbl[(in >> 24) & 0xff]) << 24;
80 __device__ 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])
99 u32 sum20 = ((a >> 24) & 3)
107 const u32 w[2] = { w0[0], w0[1] };
109 const u32 s[3] = { salt_buf0[0], salt_buf0[1], salt_buf0[2] };
111 u32 saved_key[4] = { a, b, c, d };
117 // we can assume this because the password must be at least 3
118 // and the username must be at least 1 so we can save the if ()
124 t0 |= bcodeArray[47] << 0;
125 t0 |= (w[0] & 0xff) << 8;
126 t0 |= (s[0] & 0xff) << 16;
127 t0 |= bcodeArray[ 1] << 24;
135 t0 |= (w[0] & 0xff) << 0;
136 t0 |= (s[0] & 0xff) << 8;
137 t0 |= bcodeArray[ 0] << 16;
146 // because the following code can increase i2 by a maximum of 5,
147 // there is an overflow potential of 4 before it comes to the next test for i2 >= sum20
148 // we need to truncate in that case
150 while ((i1 < pw_len) && (i3 < salt_len))
152 if (GETCHAR (saved_key, 15 - i1) & 1)
154 PUTCHAR (t, i2, bcodeArray[48 - 1 - i1]);
159 PUTCHAR (t, i2, GETCHAR (w, i1));
164 PUTCHAR (t, i2, GETCHAR (s, i3));
169 PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
176 PUTCHAR (t, sum20 + 0, 0x80);
177 PUTCHAR (t, sum20 + 1, 0);
178 PUTCHAR (t, sum20 + 2, 0);
179 PUTCHAR (t, sum20 + 3, 0);
185 while ((i1 < pw_len) || (i3 < salt_len))
187 if (i1 < pw_len) // max 8
189 if (GETCHAR (saved_key, 15 - i1) & 1)
191 PUTCHAR (t, i2, bcodeArray[48 - 1 - i1]);
196 PUTCHAR (t, i2, GETCHAR (w, i1));
201 else if (i3 < salt_len) // max 12
203 PUTCHAR (t, i2, GETCHAR (s, i3));
209 PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
216 PUTCHAR (t, sum20 + 0, 0x80);
217 PUTCHAR (t, sum20 + 1, 0);
218 PUTCHAR (t, sum20 + 2, 0);
219 PUTCHAR (t, sum20 + 3, 0);
227 PUTCHAR (t, i2, bcodeArray[i2 - i1 - i3]);
233 PUTCHAR (t, sum20 + 0, 0x80);
234 PUTCHAR (t, sum20 + 1, 0);
235 PUTCHAR (t, sum20 + 2, 0);
236 PUTCHAR (t, sum20 + 3, 0);
241 __device__ __constant__ gpu_rule_t c_rules[1024];
243 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_m04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
249 const u32 lid = threadIdx.x;
255 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
257 if (gid >= gid_max) return;
261 pw_buf0[0] = pws[gid].i[ 0];
262 pw_buf0[1] = pws[gid].i[ 1];
266 const u32 pw_len = pws[gid].pw_len;
274 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
275 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
276 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
279 const u32 salt_len = salt_bufs[salt_pos].salt_len;
281 salt_buf0[0] = sapb_trans (salt_buf0[0]);
282 salt_buf0[1] = sapb_trans (salt_buf0[1]);
283 salt_buf0[2] = sapb_trans (salt_buf0[2]);
289 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
319 const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
321 if (out_len > 8) continue; // otherwise it overflows in waldorf function
323 w0[0] = sapb_trans (w0[0]);
324 w0[1] = sapb_trans (w0[1]);
332 s0[0] = salt_buf0[0];
333 s0[1] = salt_buf0[1];
334 s0[2] = salt_buf0[2];
358 switch_buffer_by_offset (s0, s1, s2, s3, out_len);
360 const u32 pw_salt_len = out_len + salt_len;
364 t[ 0] = s0[0] | w0[0];
365 t[ 1] = s0[1] | w0[1];
378 t[14] = pw_salt_len * 8;
381 append_0x80_4 (&t[0], &t[4], &t[8], &t[12], pw_salt_len);
392 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
393 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
394 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
395 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
396 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
397 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
398 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
399 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
400 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
401 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
402 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
403 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
404 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
405 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
406 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
407 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
409 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
410 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
411 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
412 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
413 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
414 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
415 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
416 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
417 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
418 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
419 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
420 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
421 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
422 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
423 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
424 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
426 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
427 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
428 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
429 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
430 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
431 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
432 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
433 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
434 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
435 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
436 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
437 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
438 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
439 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
440 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
441 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
443 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
444 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
445 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
446 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
447 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
448 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
449 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
450 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
451 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
452 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
453 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
454 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
455 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
456 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
457 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
458 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
465 const u32x sum20 = walld0rf_magic (w0, out_len, salt_buf0, salt_len, a, b, c, d, t);
474 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
475 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
476 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
477 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
478 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
479 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
480 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
481 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
482 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
483 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
484 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
485 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
486 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
487 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
488 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
489 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
491 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
492 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
493 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
494 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
495 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
496 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
497 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
498 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
499 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
500 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
501 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
502 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
503 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
504 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
505 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
506 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
508 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
509 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
510 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
511 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
512 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
513 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
514 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
515 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
516 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
517 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
518 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
519 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
520 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
521 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
522 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
523 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
525 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
526 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
527 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
528 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
529 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
530 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
531 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
532 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
533 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
534 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
535 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
536 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
537 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
538 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
539 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
540 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
555 #include VECT_COMPARE_M
559 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_m08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
563 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_m16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
567 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_s04 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
573 const u32 lid = threadIdx.x;
579 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
581 if (gid >= gid_max) return;
585 pw_buf0[0] = pws[gid].i[ 0];
586 pw_buf0[1] = pws[gid].i[ 1];
590 const u32 pw_len = pws[gid].pw_len;
598 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
599 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[1];
600 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[2];
603 const u32 salt_len = salt_bufs[salt_pos].salt_len;
605 salt_buf0[0] = sapb_trans (salt_buf0[0]);
606 salt_buf0[1] = sapb_trans (salt_buf0[1]);
607 salt_buf0[2] = sapb_trans (salt_buf0[2]);
613 const u32 search[4] =
615 digests_buf[digests_offset].digest_buf[DGST_R0],
616 digests_buf[digests_offset].digest_buf[DGST_R1],
617 digests_buf[digests_offset].digest_buf[DGST_R2],
618 digests_buf[digests_offset].digest_buf[DGST_R3]
625 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
655 const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
657 if (out_len > 8) continue; // otherwise it overflows in waldorf function
659 w0[0] = sapb_trans (w0[0]);
660 w0[1] = sapb_trans (w0[1]);
668 s0[0] = salt_buf0[0];
669 s0[1] = salt_buf0[1];
670 s0[2] = salt_buf0[2];
694 switch_buffer_by_offset (s0, s1, s2, s3, out_len);
696 const u32 pw_salt_len = out_len + salt_len;
700 t[ 0] = s0[0] | w0[0];
701 t[ 1] = s0[1] | w0[1];
714 t[14] = pw_salt_len * 8;
717 append_0x80_4 (&t[0], &t[4], &t[8], &t[12], pw_salt_len);
728 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
729 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
730 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
731 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
732 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
733 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
734 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
735 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
736 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
737 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
738 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
739 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
740 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
741 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
742 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
743 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
745 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
746 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
747 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
748 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
749 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
750 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
751 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
752 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
753 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
754 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
755 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
756 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
757 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
758 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
759 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
760 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
762 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
763 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
764 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
765 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
766 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
767 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
768 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
769 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
770 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
771 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
772 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
773 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
774 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
775 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
776 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
777 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
779 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
780 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
781 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
782 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
783 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
784 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
785 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
786 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
787 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
788 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
789 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
790 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
791 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
792 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
793 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
794 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
801 const u32x sum20 = walld0rf_magic (w0, out_len, salt_buf0, salt_len, a, b, c, d, t);
810 MD5_STEP (MD5_Fo, a, b, c, d, t[ 0], MD5C00, MD5S00);
811 MD5_STEP (MD5_Fo, d, a, b, c, t[ 1], MD5C01, MD5S01);
812 MD5_STEP (MD5_Fo, c, d, a, b, t[ 2], MD5C02, MD5S02);
813 MD5_STEP (MD5_Fo, b, c, d, a, t[ 3], MD5C03, MD5S03);
814 MD5_STEP (MD5_Fo, a, b, c, d, t[ 4], MD5C04, MD5S00);
815 MD5_STEP (MD5_Fo, d, a, b, c, t[ 5], MD5C05, MD5S01);
816 MD5_STEP (MD5_Fo, c, d, a, b, t[ 6], MD5C06, MD5S02);
817 MD5_STEP (MD5_Fo, b, c, d, a, t[ 7], MD5C07, MD5S03);
818 MD5_STEP (MD5_Fo, a, b, c, d, t[ 8], MD5C08, MD5S00);
819 MD5_STEP (MD5_Fo, d, a, b, c, t[ 9], MD5C09, MD5S01);
820 MD5_STEP (MD5_Fo, c, d, a, b, t[10], MD5C0a, MD5S02);
821 MD5_STEP (MD5_Fo, b, c, d, a, t[11], MD5C0b, MD5S03);
822 MD5_STEP (MD5_Fo, a, b, c, d, t[12], MD5C0c, MD5S00);
823 MD5_STEP (MD5_Fo, d, a, b, c, t[13], MD5C0d, MD5S01);
824 MD5_STEP (MD5_Fo, c, d, a, b, t[14], MD5C0e, MD5S02);
825 MD5_STEP (MD5_Fo, b, c, d, a, t[15], MD5C0f, MD5S03);
827 MD5_STEP (MD5_Go, a, b, c, d, t[ 1], MD5C10, MD5S10);
828 MD5_STEP (MD5_Go, d, a, b, c, t[ 6], MD5C11, MD5S11);
829 MD5_STEP (MD5_Go, c, d, a, b, t[11], MD5C12, MD5S12);
830 MD5_STEP (MD5_Go, b, c, d, a, t[ 0], MD5C13, MD5S13);
831 MD5_STEP (MD5_Go, a, b, c, d, t[ 5], MD5C14, MD5S10);
832 MD5_STEP (MD5_Go, d, a, b, c, t[10], MD5C15, MD5S11);
833 MD5_STEP (MD5_Go, c, d, a, b, t[15], MD5C16, MD5S12);
834 MD5_STEP (MD5_Go, b, c, d, a, t[ 4], MD5C17, MD5S13);
835 MD5_STEP (MD5_Go, a, b, c, d, t[ 9], MD5C18, MD5S10);
836 MD5_STEP (MD5_Go, d, a, b, c, t[14], MD5C19, MD5S11);
837 MD5_STEP (MD5_Go, c, d, a, b, t[ 3], MD5C1a, MD5S12);
838 MD5_STEP (MD5_Go, b, c, d, a, t[ 8], MD5C1b, MD5S13);
839 MD5_STEP (MD5_Go, a, b, c, d, t[13], MD5C1c, MD5S10);
840 MD5_STEP (MD5_Go, d, a, b, c, t[ 2], MD5C1d, MD5S11);
841 MD5_STEP (MD5_Go, c, d, a, b, t[ 7], MD5C1e, MD5S12);
842 MD5_STEP (MD5_Go, b, c, d, a, t[12], MD5C1f, MD5S13);
844 MD5_STEP (MD5_H , a, b, c, d, t[ 5], MD5C20, MD5S20);
845 MD5_STEP (MD5_H , d, a, b, c, t[ 8], MD5C21, MD5S21);
846 MD5_STEP (MD5_H , c, d, a, b, t[11], MD5C22, MD5S22);
847 MD5_STEP (MD5_H , b, c, d, a, t[14], MD5C23, MD5S23);
848 MD5_STEP (MD5_H , a, b, c, d, t[ 1], MD5C24, MD5S20);
849 MD5_STEP (MD5_H , d, a, b, c, t[ 4], MD5C25, MD5S21);
850 MD5_STEP (MD5_H , c, d, a, b, t[ 7], MD5C26, MD5S22);
851 MD5_STEP (MD5_H , b, c, d, a, t[10], MD5C27, MD5S23);
852 MD5_STEP (MD5_H , a, b, c, d, t[13], MD5C28, MD5S20);
853 MD5_STEP (MD5_H , d, a, b, c, t[ 0], MD5C29, MD5S21);
854 MD5_STEP (MD5_H , c, d, a, b, t[ 3], MD5C2a, MD5S22);
855 MD5_STEP (MD5_H , b, c, d, a, t[ 6], MD5C2b, MD5S23);
856 MD5_STEP (MD5_H , a, b, c, d, t[ 9], MD5C2c, MD5S20);
857 MD5_STEP (MD5_H , d, a, b, c, t[12], MD5C2d, MD5S21);
858 MD5_STEP (MD5_H , c, d, a, b, t[15], MD5C2e, MD5S22);
859 MD5_STEP (MD5_H , b, c, d, a, t[ 2], MD5C2f, MD5S23);
861 MD5_STEP (MD5_I , a, b, c, d, t[ 0], MD5C30, MD5S30);
862 MD5_STEP (MD5_I , d, a, b, c, t[ 7], MD5C31, MD5S31);
863 MD5_STEP (MD5_I , c, d, a, b, t[14], MD5C32, MD5S32);
864 MD5_STEP (MD5_I , b, c, d, a, t[ 5], MD5C33, MD5S33);
865 MD5_STEP (MD5_I , a, b, c, d, t[12], MD5C34, MD5S30);
866 MD5_STEP (MD5_I , d, a, b, c, t[ 3], MD5C35, MD5S31);
867 MD5_STEP (MD5_I , c, d, a, b, t[10], MD5C36, MD5S32);
868 MD5_STEP (MD5_I , b, c, d, a, t[ 1], MD5C37, MD5S33);
869 MD5_STEP (MD5_I , a, b, c, d, t[ 8], MD5C38, MD5S30);
870 MD5_STEP (MD5_I , d, a, b, c, t[15], MD5C39, MD5S31);
871 MD5_STEP (MD5_I , c, d, a, b, t[ 6], MD5C3a, MD5S32);
872 MD5_STEP (MD5_I , b, c, d, a, t[13], MD5C3b, MD5S33);
873 MD5_STEP (MD5_I , a, b, c, d, t[ 4], MD5C3c, MD5S30);
874 MD5_STEP (MD5_I , d, a, b, c, t[11], MD5C3d, MD5S31);
875 MD5_STEP (MD5_I , c, d, a, b, t[ 2], MD5C3e, MD5S32);
876 MD5_STEP (MD5_I , b, c, d, a, t[ 9], MD5C3f, MD5S33);
891 #include VECT_COMPARE_S
895 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_s08 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
899 extern "C" __global__ void __launch_bounds__ (256, 1) m07700_s16 (const pw_t *pws, const gpu_rule_t *rules_buf, const comb_t *combs_buf, const bf_t *bfs_buf, const void *tmps, void *hooks, const u32 *bitmaps_buf_s1_a, const u32 *bitmaps_buf_s1_b, const u32 *bitmaps_buf_s1_c, const u32 *bitmaps_buf_s1_d, const u32 *bitmaps_buf_s2_a, const u32 *bitmaps_buf_s2_b, const u32 *bitmaps_buf_s2_c, const u32 *bitmaps_buf_s2_d, plain_t *plains_buf, const digest_t *digests_buf, u32 *hashes_shown, const salt_t *salt_bufs, const void *esalt_bufs, u32 *d_return_buf, 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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)