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