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