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