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"
29 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
30 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
34 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
35 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
39 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
40 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
43 __device__ __constant__ comb_t c_combs[1024];
45 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
51 const u32 lid = threadIdx.x;
57 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
59 if (gid >= gid_max) return;
63 wordl0[0] = pws[gid].i[ 0];
64 wordl0[1] = pws[gid].i[ 1];
65 wordl0[2] = pws[gid].i[ 2];
66 wordl0[3] = pws[gid].i[ 3];
70 wordl1[0] = pws[gid].i[ 4];
71 wordl1[1] = pws[gid].i[ 5];
72 wordl1[2] = pws[gid].i[ 6];
73 wordl1[3] = pws[gid].i[ 7];
89 const u32 pw_l_len = pws[gid].pw_len;
91 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
93 append_0x80_2 (wordl0, wordl1, pw_l_len);
95 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
102 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
104 const u32 pw_r_len = c_combs[il_pos].pw_len;
106 const u32 pw_len = pw_l_len + pw_r_len;
110 wordr0[0] = c_combs[il_pos].i[0];
111 wordr0[1] = c_combs[il_pos].i[1];
112 wordr0[2] = c_combs[il_pos].i[2];
113 wordr0[3] = c_combs[il_pos].i[3];
117 wordr1[0] = c_combs[il_pos].i[4];
118 wordr1[1] = c_combs[il_pos].i[5];
119 wordr1[2] = c_combs[il_pos].i[6];
120 wordr1[3] = c_combs[il_pos].i[7];
136 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
138 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
143 w0[0] = wordl0[0] | wordr0[0];
144 w0[1] = wordl0[1] | wordr0[1];
145 w0[2] = wordl0[2] | wordr0[2];
146 w0[3] = wordl0[3] | wordr0[3];
150 w1[0] = wordl1[0] | wordr1[0];
151 w1[1] = wordl1[1] | wordr1[1];
152 w1[2] = wordl1[2] | wordr1[2];
153 w1[3] = wordl1[3] | wordr1[3];
174 make_unicode (w0, w0_t, w1_t);
175 make_unicode (w1, w2_t, w3_t);
177 w3_t[2] = pw_len * 8 * 2;
186 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
187 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
188 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
189 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
190 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
191 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
192 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
193 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
194 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
195 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
196 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
197 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
198 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
199 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
200 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
201 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
203 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
204 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
205 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
206 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
207 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
208 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
209 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
210 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
211 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
212 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
213 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
214 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
215 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
216 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
217 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
218 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
220 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
221 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
222 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
223 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
224 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
225 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
226 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
227 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
228 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
229 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
230 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
231 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
232 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
233 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
234 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
235 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
242 #include VECT_COMPARE_M
246 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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)
250 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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)
254 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
260 const u32 lid = threadIdx.x;
266 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
268 if (gid >= gid_max) return;
272 wordl0[0] = pws[gid].i[ 0];
273 wordl0[1] = pws[gid].i[ 1];
274 wordl0[2] = pws[gid].i[ 2];
275 wordl0[3] = pws[gid].i[ 3];
279 wordl1[0] = pws[gid].i[ 4];
280 wordl1[1] = pws[gid].i[ 5];
281 wordl1[2] = pws[gid].i[ 6];
282 wordl1[3] = pws[gid].i[ 7];
298 const u32 pw_l_len = pws[gid].pw_len;
300 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
302 append_0x80_2 (wordl0, wordl1, pw_l_len);
304 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
311 const u32 search[4] =
313 digests_buf[digests_offset].digest_buf[DGST_R0],
314 digests_buf[digests_offset].digest_buf[DGST_R1],
315 digests_buf[digests_offset].digest_buf[DGST_R2],
316 digests_buf[digests_offset].digest_buf[DGST_R3]
323 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
325 const u32 pw_r_len = c_combs[il_pos].pw_len;
327 const u32 pw_len = pw_l_len + pw_r_len;
331 wordr0[0] = c_combs[il_pos].i[0];
332 wordr0[1] = c_combs[il_pos].i[1];
333 wordr0[2] = c_combs[il_pos].i[2];
334 wordr0[3] = c_combs[il_pos].i[3];
338 wordr1[0] = c_combs[il_pos].i[4];
339 wordr1[1] = c_combs[il_pos].i[5];
340 wordr1[2] = c_combs[il_pos].i[6];
341 wordr1[3] = c_combs[il_pos].i[7];
357 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
359 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
364 w0[0] = wordl0[0] | wordr0[0];
365 w0[1] = wordl0[1] | wordr0[1];
366 w0[2] = wordl0[2] | wordr0[2];
367 w0[3] = wordl0[3] | wordr0[3];
371 w1[0] = wordl1[0] | wordr1[0];
372 w1[1] = wordl1[1] | wordr1[1];
373 w1[2] = wordl1[2] | wordr1[2];
374 w1[3] = wordl1[3] | wordr1[3];
395 make_unicode (w0, w0_t, w1_t);
396 make_unicode (w1, w2_t, w3_t);
398 w3_t[2] = pw_len * 8 * 2;
407 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
408 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
409 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
410 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
411 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
412 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
413 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
414 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
415 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
416 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
417 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
418 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
419 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
420 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
421 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
422 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
424 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
425 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
426 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
427 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
428 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
429 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
430 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
431 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
432 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
433 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
434 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
435 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
436 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
437 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
438 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
439 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
441 MD4_STEP (MD4_H1, a, b, c, d, w0_t[0], MD4C02, MD4S20);
442 MD4_STEP (MD4_H2, d, a, b, c, w2_t[0], MD4C02, MD4S21);
443 MD4_STEP (MD4_H1, c, d, a, b, w1_t[0], MD4C02, MD4S22);
444 MD4_STEP (MD4_H2, b, c, d, a, w3_t[0], MD4C02, MD4S23);
445 MD4_STEP (MD4_H1, a, b, c, d, w0_t[2], MD4C02, MD4S20);
446 MD4_STEP (MD4_H2, d, a, b, c, w2_t[2], MD4C02, MD4S21);
447 MD4_STEP (MD4_H1, c, d, a, b, w1_t[2], MD4C02, MD4S22);
448 MD4_STEP (MD4_H2, b, c, d, a, w3_t[2], MD4C02, MD4S23);
449 MD4_STEP (MD4_H1, a, b, c, d, w0_t[1], MD4C02, MD4S20);
450 MD4_STEP (MD4_H2, d, a, b, c, w2_t[1], MD4C02, MD4S21);
451 MD4_STEP (MD4_H1, c, d, a, b, w1_t[1], MD4C02, MD4S22);
452 MD4_STEP (MD4_H2, b, c, d, a, w3_t[1], MD4C02, MD4S23);
453 MD4_STEP (MD4_H1, a, b, c, d, w0_t[3], MD4C02, MD4S20);
454 MD4_STEP (MD4_H2, d, a, b, c, w2_t[3], MD4C02, MD4S21);
455 MD4_STEP (MD4_H1, c, d, a, b, w1_t[3], MD4C02, MD4S22);
456 MD4_STEP (MD4_H2, b, c, d, a, w3_t[3], MD4C02, MD4S23);
463 #include VECT_COMPARE_S
467 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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)
471 extern "C" __global__ void __launch_bounds__ (256, 1) m01000_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)