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"
36 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
37 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
41 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
42 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
45 __device__ __constant__ gpu_rule_t c_rules[1024];
47 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)
53 const u32 lid = threadIdx.x;
59 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
61 if (gid >= gid_max) return;
65 pw_buf0[0] = pws[gid].i[ 0];
66 pw_buf0[1] = pws[gid].i[ 1];
67 pw_buf0[2] = pws[gid].i[ 2];
68 pw_buf0[3] = pws[gid].i[ 3];
70 const u32 pw_len = pws[gid].pw_len;
78 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
83 const u32 salt_len = (salt_bufs[salt_pos].salt_len < 4) ? salt_bufs[salt_pos].salt_len : 4;
89 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
119 const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
127 s0[0] = salt_buf0[0];
128 s0[1] = salt_buf0[1];
129 s0[2] = salt_buf0[2];
130 s0[3] = salt_buf0[3];
153 switch_buffer_by_offset (s0, s1, s2, s3, out_len);
160 const u32 pw_salt_len = out_len + salt_len;
162 truncate_block (w0, pw_salt_len);
174 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
175 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
176 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
177 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
178 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
179 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
180 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
181 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
182 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
183 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
184 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
185 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
186 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
187 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
188 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
189 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
191 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
192 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
193 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
194 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
195 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
196 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
197 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
198 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
199 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
200 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
201 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
202 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
203 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
204 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
205 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
206 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
208 MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
209 MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
210 MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
211 MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
212 MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
213 MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
214 MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
215 MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
216 MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
217 MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
218 MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
219 MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
220 MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
221 MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
222 MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
223 MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
225 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
226 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
227 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
228 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
229 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
230 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
231 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
232 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
233 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
234 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
235 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
236 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
237 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
238 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
239 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
240 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
252 #include VECT_COMPARE_M
256 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)
260 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)
264 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)
270 const u32 lid = threadIdx.x;
276 const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
278 if (gid >= gid_max) return;
282 pw_buf0[0] = pws[gid].i[ 0];
283 pw_buf0[1] = pws[gid].i[ 1];
284 pw_buf0[2] = pws[gid].i[ 2];
285 pw_buf0[3] = pws[gid].i[ 3];
287 const u32 pw_len = pws[gid].pw_len;
295 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[0];
300 const u32 salt_len = (salt_bufs[salt_pos].salt_len < 4) ? salt_bufs[salt_pos].salt_len : 4;
306 const u32 search[4] =
308 digests_buf[digests_offset].digest_buf[DGST_R0],
309 digests_buf[digests_offset].digest_buf[DGST_R1],
310 digests_buf[digests_offset].digest_buf[DGST_R2],
311 digests_buf[digests_offset].digest_buf[DGST_R3]
318 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
348 const u32 out_len = apply_rules (c_rules[il_pos].cmds, w0, w1, pw_len);
356 s0[0] = salt_buf0[0];
357 s0[1] = salt_buf0[1];
358 s0[2] = salt_buf0[2];
359 s0[3] = salt_buf0[3];
382 switch_buffer_by_offset (s0, s1, s2, s3, out_len);
389 const u32 pw_salt_len = out_len + salt_len;
391 truncate_block (w0, pw_salt_len);
403 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
404 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
405 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
406 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
407 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
408 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
409 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
410 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
411 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
412 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
413 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
414 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
415 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
416 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
417 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
418 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
420 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
421 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
422 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
423 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
424 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
425 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
426 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
427 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
428 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
429 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
430 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
431 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
432 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
433 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
434 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
435 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
437 MD5_STEP (MD5_H1, a, b, c, d, w1[1], MD5C20, MD5S20);
438 MD5_STEP (MD5_H2, d, a, b, c, w2[0], MD5C21, MD5S21);
439 MD5_STEP (MD5_H1, c, d, a, b, w2[3], MD5C22, MD5S22);
440 MD5_STEP (MD5_H2, b, c, d, a, w3[2], MD5C23, MD5S23);
441 MD5_STEP (MD5_H1, a, b, c, d, w0[1], MD5C24, MD5S20);
442 MD5_STEP (MD5_H2, d, a, b, c, w1[0], MD5C25, MD5S21);
443 MD5_STEP (MD5_H1, c, d, a, b, w1[3], MD5C26, MD5S22);
444 MD5_STEP (MD5_H2, b, c, d, a, w2[2], MD5C27, MD5S23);
445 MD5_STEP (MD5_H1, a, b, c, d, w3[1], MD5C28, MD5S20);
446 MD5_STEP (MD5_H2, d, a, b, c, w0[0], MD5C29, MD5S21);
447 MD5_STEP (MD5_H1, c, d, a, b, w0[3], MD5C2a, MD5S22);
448 MD5_STEP (MD5_H2, b, c, d, a, w1[2], MD5C2b, MD5S23);
449 MD5_STEP (MD5_H1, a, b, c, d, w2[1], MD5C2c, MD5S20);
450 MD5_STEP (MD5_H2, d, a, b, c, w3[0], MD5C2d, MD5S21);
451 MD5_STEP (MD5_H1, c, d, a, b, w3[3], MD5C2e, MD5S22);
452 MD5_STEP (MD5_H2, b, c, d, a, w0[2], MD5C2f, MD5S23);
454 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
455 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
456 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
457 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
458 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
459 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
460 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
461 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
462 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
463 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
464 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
465 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
466 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
468 bool q_cond = ((a & 0x00ffffff) != search[0]);
470 if (q_cond) continue;
472 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
473 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
474 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
486 #include VECT_COMPARE_S
490 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)
494 extern "C" __global__ void __launch_bounds__ (256, 1) m02410_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)