Initial commit
[hashcat.git] / nv / m03800_a1.cu
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #ifdef  VLIW1
12 #define VECT_SIZE1
13 #endif
14
15 #ifdef  VLIW2
16 #define VECT_SIZE4
17 #endif
18
19 #define DGST_R0 0
20 #define DGST_R1 3
21 #define DGST_R2 2
22 #define DGST_R3 1
23
24 #include "include/kernel_functions.c"
25 #include "types_nv.c"
26 #include "common_nv.c"
27
28 #ifdef  VECT_SIZE1
29 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
30 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
31 #endif
32
33 #ifdef  VECT_SIZE2
34 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
35 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
36 #endif
37
38 #ifdef  VECT_SIZE4
39 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
40 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
41 #endif
42
43 __device__ __constant__ comb_t c_combs[1024];
44
45 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
46 {
47   /**
48    * modifier
49    */
50
51   const u32 lid = threadIdx.x;
52
53   /**
54    * base
55    */
56
57   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
58
59   if (gid >= gid_max) return;
60
61   u32x wordl0[4];
62
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];
67
68   u32x wordl1[4];
69
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];
74
75   u32x wordl2[4];
76
77   wordl2[0] = 0;
78   wordl2[1] = 0;
79   wordl2[2] = 0;
80   wordl2[3] = 0;
81
82   u32x wordl3[4];
83
84   wordl3[0] = 0;
85   wordl3[1] = 0;
86   wordl3[2] = 0;
87   wordl3[3] = 0;
88
89   const u32 pw_l_len = pws[gid].pw_len;
90
91   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
92   {
93     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
94   }
95
96   /**
97    * salt
98    */
99
100   u32 salt_buf0[4];
101
102   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
103   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
104   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
105   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
106
107   u32 salt_buf1[4];
108
109   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
110   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
111   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
112   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
113
114   u32 salt_buf2[4];
115
116   salt_buf2[0] = 0;
117   salt_buf2[1] = 0;
118   salt_buf2[2] = 0;
119   salt_buf2[3] = 0;
120
121   u32 salt_buf3[4];
122
123   salt_buf3[0] = 0;
124   salt_buf3[1] = 0;
125   salt_buf3[2] = 0;
126   salt_buf3[3] = 0;
127
128   const u32 salt_len = salt_bufs[salt_pos].salt_len;
129
130   /**
131    * loop
132    */
133
134   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
135   {
136     const u32 pw_r_len = c_combs[il_pos].pw_len;
137
138     const u32 pw_len = pw_l_len + pw_r_len;
139
140     u32 wordr0[4];
141
142     wordr0[0] = c_combs[il_pos].i[0];
143     wordr0[1] = c_combs[il_pos].i[1];
144     wordr0[2] = c_combs[il_pos].i[2];
145     wordr0[3] = c_combs[il_pos].i[3];
146
147     u32 wordr1[4];
148
149     wordr1[0] = c_combs[il_pos].i[4];
150     wordr1[1] = c_combs[il_pos].i[5];
151     wordr1[2] = c_combs[il_pos].i[6];
152     wordr1[3] = c_combs[il_pos].i[7];
153
154     u32 wordr2[4];
155
156     wordr2[0] = 0;
157     wordr2[1] = 0;
158     wordr2[2] = 0;
159     wordr2[3] = 0;
160
161     u32 wordr3[4];
162
163     wordr3[0] = 0;
164     wordr3[1] = 0;
165     wordr3[2] = 0;
166     wordr3[3] = 0;
167
168     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
169     {
170       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
171     }
172
173     u32x w0[4];
174
175     w0[0] = wordl0[0] | wordr0[0];
176     w0[1] = wordl0[1] | wordr0[1];
177     w0[2] = wordl0[2] | wordr0[2];
178     w0[3] = wordl0[3] | wordr0[3];
179
180     u32x w1[4];
181
182     w1[0] = wordl1[0] | wordr1[0];
183     w1[1] = wordl1[1] | wordr1[1];
184     w1[2] = wordl1[2] | wordr1[2];
185     w1[3] = wordl1[3] | wordr1[3];
186
187     u32x w2[4];
188
189     w2[0] = wordl2[0] | wordr2[0];
190     w2[1] = wordl2[1] | wordr2[1];
191     w2[2] = wordl2[2] | wordr2[2];
192     w2[3] = wordl2[3] | wordr2[3];
193
194     u32x w3[4];
195
196     w3[0] = wordl3[0] | wordr3[0];
197     w3[1] = wordl3[1] | wordr3[1];
198     w3[2] = 0;
199     w3[3] = 0;
200
201     /**
202      * prepend salt
203      */
204
205     u32x w0_t[4];
206
207     w0_t[0] = w0[0];
208     w0_t[1] = w0[1];
209     w0_t[2] = w0[2];
210     w0_t[3] = w0[3];
211
212     u32x w1_t[4];
213
214     w1_t[0] = w1[0];
215     w1_t[1] = w1[1];
216     w1_t[2] = w1[2];
217     w1_t[3] = w1[3];
218
219     u32x w2_t[4];
220
221     w2_t[0] = w2[0];
222     w2_t[1] = w2[1];
223     w2_t[2] = w2[2];
224     w2_t[3] = w2[3];
225
226     u32x w3_t[4];
227
228     w3_t[0] = w3[0];
229     w3_t[1] = w3[1];
230     w3_t[2] = w3[2];
231     w3_t[3] = w3[3];
232
233     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
234
235     w0_t[0] |= salt_buf0[0];
236     w0_t[1] |= salt_buf0[1];
237     w0_t[2] |= salt_buf0[2];
238     w0_t[3] |= salt_buf0[3];
239     w1_t[0] |= salt_buf1[0];
240     w1_t[1] |= salt_buf1[1];
241     w1_t[2] |= salt_buf1[2];
242     w1_t[3] |= salt_buf1[3];
243     w2_t[0] |= salt_buf2[0];
244     w2_t[1] |= salt_buf2[1];
245     w2_t[2] |= salt_buf2[2];
246     w2_t[3] |= salt_buf2[3];
247     w3_t[0] |= salt_buf3[0];
248     w3_t[1] |= salt_buf3[1];
249     w3_t[2] |= salt_buf3[2];
250     w3_t[3] |= salt_buf3[3];
251
252     /**
253      * append salt
254      */
255
256     u32 s0[4];
257
258     s0[0] = salt_buf0[0];
259     s0[1] = salt_buf0[1];
260     s0[2] = salt_buf0[2];
261     s0[3] = salt_buf0[3];
262
263     u32 s1[4];
264
265     s1[0] = salt_buf1[0];
266     s1[1] = salt_buf1[1];
267     s1[2] = salt_buf1[2];
268     s1[3] = salt_buf1[3];
269
270     u32 s2[4];
271
272     s2[0] = 0;
273     s2[1] = 0;
274     s2[2] = 0;
275     s2[3] = 0;
276
277     u32 s3[4];
278
279     s3[0] = 0;
280     s3[1] = 0;
281     s3[2] = 0;
282     s3[3] = 0;
283
284     switch_buffer_by_offset (s0, s1, s2, s3, salt_len + pw_len);
285
286     w0_t[0] |= s0[0];
287     w0_t[1] |= s0[1];
288     w0_t[2] |= s0[2];
289     w0_t[3] |= s0[3];
290     w1_t[0] |= s1[0];
291     w1_t[1] |= s1[1];
292     w1_t[2] |= s1[2];
293     w1_t[3] |= s1[3];
294     w2_t[0] |= s2[0];
295     w2_t[1] |= s2[1];
296     w2_t[2] |= s2[2];
297     w2_t[3] |= s2[3];
298     w3_t[0] |= s3[0];
299     w3_t[1] |= s3[1];
300     w3_t[2] |= s3[2];
301     w3_t[3] |= s3[3];
302
303     const u32 pw_salt_len = salt_len + pw_len + salt_len;
304
305     append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
306
307     w3_t[2] = pw_salt_len * 8;
308
309     /**
310      * md5
311      */
312
313     u32x a = MD5M_A;
314     u32x b = MD5M_B;
315     u32x c = MD5M_C;
316     u32x d = MD5M_D;
317
318     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
319     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
320     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
321     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
322     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
323     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
324     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
325     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
326     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
327     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
328     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
329     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
330     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
331     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
332     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
333     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
334
335     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
336     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
337     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
338     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
339     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
340     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
341     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
342     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
343     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
344     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
345     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
346     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
347     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
348     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
349     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
350     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
351
352     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
353     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
354     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
355     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
356     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
357     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
358     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
359     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
360     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
361     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
362     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
363     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
364     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
365     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
366     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
367     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
368
369     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
370     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
371     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
372     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
373     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
374     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
375     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
376     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
377     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
378     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
379     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
380     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
381     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
382
383     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
384     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
385     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
386
387     const u32x r0 = a;
388     const u32x r1 = d;
389     const u32x r2 = c;
390     const u32x r3 = b;
391
392     #include VECT_COMPARE_M
393   }
394 }
395
396 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
397 {
398 }
399
400 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
401 {
402 }
403
404 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
405 {
406   /**
407    * modifier
408    */
409
410   const u32 lid = threadIdx.x;
411
412   /**
413    * base
414    */
415
416   const u32 gid = (blockIdx.x * blockDim.x) + threadIdx.x;
417
418   if (gid >= gid_max) return;
419
420   u32x wordl0[4];
421
422   wordl0[0] = pws[gid].i[ 0];
423   wordl0[1] = pws[gid].i[ 1];
424   wordl0[2] = pws[gid].i[ 2];
425   wordl0[3] = pws[gid].i[ 3];
426
427   u32x wordl1[4];
428
429   wordl1[0] = pws[gid].i[ 4];
430   wordl1[1] = pws[gid].i[ 5];
431   wordl1[2] = pws[gid].i[ 6];
432   wordl1[3] = pws[gid].i[ 7];
433
434   u32x wordl2[4];
435
436   wordl2[0] = 0;
437   wordl2[1] = 0;
438   wordl2[2] = 0;
439   wordl2[3] = 0;
440
441   u32x wordl3[4];
442
443   wordl3[0] = 0;
444   wordl3[1] = 0;
445   wordl3[2] = 0;
446   wordl3[3] = 0;
447
448   const u32 pw_l_len = pws[gid].pw_len;
449
450   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
451   {
452     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, c_combs[0].pw_len);
453   }
454
455   /**
456    * salt
457    */
458
459   u32 salt_buf0[4];
460
461   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
462   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
463   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
464   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
465
466   u32 salt_buf1[4];
467
468   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
469   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
470   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
471   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
472
473   u32 salt_buf2[4];
474
475   salt_buf2[0] = 0;
476   salt_buf2[1] = 0;
477   salt_buf2[2] = 0;
478   salt_buf2[3] = 0;
479
480   u32 salt_buf3[4];
481
482   salt_buf3[0] = 0;
483   salt_buf3[1] = 0;
484   salt_buf3[2] = 0;
485   salt_buf3[3] = 0;
486
487   const u32 salt_len = salt_bufs[salt_pos].salt_len;
488
489   /**
490    * digest
491    */
492
493   const u32 search[4] =
494   {
495     digests_buf[digests_offset].digest_buf[DGST_R0],
496     digests_buf[digests_offset].digest_buf[DGST_R1],
497     digests_buf[digests_offset].digest_buf[DGST_R2],
498     digests_buf[digests_offset].digest_buf[DGST_R3]
499   };
500
501   /**
502    * loop
503    */
504
505   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
506   {
507     const u32 pw_r_len = c_combs[il_pos].pw_len;
508
509     const u32 pw_len = pw_l_len + pw_r_len;
510
511     u32 wordr0[4];
512
513     wordr0[0] = c_combs[il_pos].i[0];
514     wordr0[1] = c_combs[il_pos].i[1];
515     wordr0[2] = c_combs[il_pos].i[2];
516     wordr0[3] = c_combs[il_pos].i[3];
517
518     u32 wordr1[4];
519
520     wordr1[0] = c_combs[il_pos].i[4];
521     wordr1[1] = c_combs[il_pos].i[5];
522     wordr1[2] = c_combs[il_pos].i[6];
523     wordr1[3] = c_combs[il_pos].i[7];
524
525     u32 wordr2[4];
526
527     wordr2[0] = 0;
528     wordr2[1] = 0;
529     wordr2[2] = 0;
530     wordr2[3] = 0;
531
532     u32 wordr3[4];
533
534     wordr3[0] = 0;
535     wordr3[1] = 0;
536     wordr3[2] = 0;
537     wordr3[3] = 0;
538
539     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
540     {
541       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
542     }
543
544     u32x w0[4];
545
546     w0[0] = wordl0[0] | wordr0[0];
547     w0[1] = wordl0[1] | wordr0[1];
548     w0[2] = wordl0[2] | wordr0[2];
549     w0[3] = wordl0[3] | wordr0[3];
550
551     u32x w1[4];
552
553     w1[0] = wordl1[0] | wordr1[0];
554     w1[1] = wordl1[1] | wordr1[1];
555     w1[2] = wordl1[2] | wordr1[2];
556     w1[3] = wordl1[3] | wordr1[3];
557
558     u32x w2[4];
559
560     w2[0] = wordl2[0] | wordr2[0];
561     w2[1] = wordl2[1] | wordr2[1];
562     w2[2] = wordl2[2] | wordr2[2];
563     w2[3] = wordl2[3] | wordr2[3];
564
565     u32x w3[4];
566
567     w3[0] = wordl3[0] | wordr3[0];
568     w3[1] = wordl3[1] | wordr3[1];
569     w3[2] = 0;
570     w3[3] = 0;
571
572     /**
573      * prepend salt
574      */
575
576     u32x w0_t[4];
577
578     w0_t[0] = w0[0];
579     w0_t[1] = w0[1];
580     w0_t[2] = w0[2];
581     w0_t[3] = w0[3];
582
583     u32x w1_t[4];
584
585     w1_t[0] = w1[0];
586     w1_t[1] = w1[1];
587     w1_t[2] = w1[2];
588     w1_t[3] = w1[3];
589
590     u32x w2_t[4];
591
592     w2_t[0] = w2[0];
593     w2_t[1] = w2[1];
594     w2_t[2] = w2[2];
595     w2_t[3] = w2[3];
596
597     u32x w3_t[4];
598
599     w3_t[0] = w3[0];
600     w3_t[1] = w3[1];
601     w3_t[2] = w3[2];
602     w3_t[3] = w3[3];
603
604     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
605
606     w0_t[0] |= salt_buf0[0];
607     w0_t[1] |= salt_buf0[1];
608     w0_t[2] |= salt_buf0[2];
609     w0_t[3] |= salt_buf0[3];
610     w1_t[0] |= salt_buf1[0];
611     w1_t[1] |= salt_buf1[1];
612     w1_t[2] |= salt_buf1[2];
613     w1_t[3] |= salt_buf1[3];
614     w2_t[0] |= salt_buf2[0];
615     w2_t[1] |= salt_buf2[1];
616     w2_t[2] |= salt_buf2[2];
617     w2_t[3] |= salt_buf2[3];
618     w3_t[0] |= salt_buf3[0];
619     w3_t[1] |= salt_buf3[1];
620     w3_t[2] |= salt_buf3[2];
621     w3_t[3] |= salt_buf3[3];
622
623     /**
624      * append salt
625      */
626
627     u32 s0[4];
628
629     s0[0] = salt_buf0[0];
630     s0[1] = salt_buf0[1];
631     s0[2] = salt_buf0[2];
632     s0[3] = salt_buf0[3];
633
634     u32 s1[4];
635
636     s1[0] = salt_buf1[0];
637     s1[1] = salt_buf1[1];
638     s1[2] = salt_buf1[2];
639     s1[3] = salt_buf1[3];
640
641     u32 s2[4];
642
643     s2[0] = 0;
644     s2[1] = 0;
645     s2[2] = 0;
646     s2[3] = 0;
647
648     u32 s3[4];
649
650     s3[0] = 0;
651     s3[1] = 0;
652     s3[2] = 0;
653     s3[3] = 0;
654
655     switch_buffer_by_offset (s0, s1, s2, s3, salt_len + pw_len);
656
657     w0_t[0] |= s0[0];
658     w0_t[1] |= s0[1];
659     w0_t[2] |= s0[2];
660     w0_t[3] |= s0[3];
661     w1_t[0] |= s1[0];
662     w1_t[1] |= s1[1];
663     w1_t[2] |= s1[2];
664     w1_t[3] |= s1[3];
665     w2_t[0] |= s2[0];
666     w2_t[1] |= s2[1];
667     w2_t[2] |= s2[2];
668     w2_t[3] |= s2[3];
669     w3_t[0] |= s3[0];
670     w3_t[1] |= s3[1];
671     w3_t[2] |= s3[2];
672     w3_t[3] |= s3[3];
673
674     const u32 pw_salt_len = salt_len + pw_len + salt_len;
675
676     append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
677
678     w3_t[2] = pw_salt_len * 8;
679
680     /**
681      * md5
682      */
683
684     u32x a = MD5M_A;
685     u32x b = MD5M_B;
686     u32x c = MD5M_C;
687     u32x d = MD5M_D;
688
689     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
690     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
691     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
692     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
693     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
694     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
695     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
696     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
697     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
698     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
699     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
700     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
701     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
702     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
703     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
704     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
705
706     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
707     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
708     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
709     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
710     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
711     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
712     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
713     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
714     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
715     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
716     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
717     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
718     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
719     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
720     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
721     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
722
723     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
724     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
725     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
726     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
727     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
728     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
729     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
730     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
731     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
732     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
733     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
734     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
735     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
736     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
737     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
738     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
739
740     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
741     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
742     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
743     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
744     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
745     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
746     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
747     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
748     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
749     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
750     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
751     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
752     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
753     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
754     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
755     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
756
757     const u32x r0 = a;
758     const u32x r1 = d;
759     const u32x r2 = c;
760     const u32x r3 = b;
761
762     #include VECT_COMPARE_S
763   }
764 }
765
766 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
767 {
768 }
769
770 extern "C" __global__ void __launch_bounds__ (256, 1) m03800_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)
771 {
772 }