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