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