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