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