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