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