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