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