Fixed two major problems
[hashcat.git] / OpenCL / m02710_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 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 il_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[0];
76   s[1] = salt_bufs[salt_pos].salt_buf[1];
77   s[2] = salt_bufs[salt_pos].salt_buf[2];
78   s[3] = salt_bufs[salt_pos].salt_buf[3];
79   s[4] = salt_bufs[salt_pos].salt_buf[4];
80   s[5] = salt_bufs[salt_pos].salt_buf[5];
81   s[6] = salt_bufs[salt_pos].salt_buf[6];
82   s[7] = salt_bufs[salt_pos].salt_buf[7];
83
84   const u32 salt_len = salt_bufs[salt_pos].salt_len;
85
86   const u32 r_14 = (32 + salt_len) * 8;
87
88   /**
89    * bin2asc table
90    */
91
92   __local u32 l_bin2asc[256];
93
94   for (u32 i = lid; i < 256; i += lsz)
95   {
96     const u32 i0 = (i >> 0) & 15;
97     const u32 i1 = (i >> 4) & 15;
98
99     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
100                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
101   }
102
103   barrier (CLK_LOCAL_MEM_FENCE);
104
105   if (gid >= gid_max) return;
106
107   /**
108    * loop
109    */
110
111   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
112   {
113     u32x w0[4] = { 0 };
114     u32x w1[4] = { 0 };
115     u32x w2[4] = { 0 };
116     u32x w3[4] = { 0 };
117
118     const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
119
120     append_0x80_2x4_VV (w0, w1, out_len);
121
122     w3[2] = out_len * 8;
123
124     u32x a = MD5M_A;
125     u32x b = MD5M_B;
126     u32x c = MD5M_C;
127     u32x d = MD5M_D;
128
129     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
130     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
131     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
132     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
133     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
134     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
135     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
136     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
137     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
138     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
139     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
140     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
141     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
142     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
143     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
144     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
145
146     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
147     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
148     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
149     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
150     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
151     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
152     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
153     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
154     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
155     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
156     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
157     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
158     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
159     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
160     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
161     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
162
163     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
164     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
165     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
166     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
167     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
168     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
169     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
170     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
171     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
172     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
173     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
174     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
175     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
176     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
177     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
178     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
179
180     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
181     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
182     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
183     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
184     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
185     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
186     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
187     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
188     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
189     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
190     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
191     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
192     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
193     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
194     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
195     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
196
197     a += MD5M_A;
198     b += MD5M_B;
199     c += MD5M_C;
200     d += MD5M_D;
201
202     w0[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
203           | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
204     w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
205           | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
206     w0[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
207           | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
208     w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
209           | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
210     w1[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
211           | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
212     w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
213           | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
214     w1[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
215           | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
216     w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
217           | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
218
219     w2[0] = s[0];
220     w2[1] = s[1];
221     w2[2] = s[2];
222     w2[3] = s[3];
223
224     w3[0] = s[4];
225     w3[1] = s[5];
226     w3[2] = s[6];
227     w3[3] = s[7];
228
229     a = MD5M_A;
230     b = MD5M_B;
231     c = MD5M_C;
232     d = MD5M_D;
233
234     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
235     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
236     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
237     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
238     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
239     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
240     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
241     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
242     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
243     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
244     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
245     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
246     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
247     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
248     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
249     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
250
251     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
252     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
253     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
254     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
255     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
256     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
257     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
258     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
259     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
260     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
261     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
262     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
263     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
264     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
265     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
266     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
267
268     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
269     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
270     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
271     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
272     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
273     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
274     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
275     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
276     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
277     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
278     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
279     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
280     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
281     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
282     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
283     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
284
285     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
286     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
287     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
288     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
289     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
290     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
291     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
292     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
293     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
294     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
295     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
296     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
297     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
298     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
299     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
300     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
301
302     const u32x r_a = a + MD5M_A;
303     const u32x r_b = b + MD5M_B;
304     const u32x r_c = c + MD5M_C;
305     const u32x r_d = d + MD5M_D;
306
307     a = r_a;
308     b = r_b;
309     c = r_c;
310     d = r_d;
311
312     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C00, MD5S00);
313     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C01, MD5S01);
314     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C02, MD5S02);
315     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C03, MD5S03);
316     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C04, MD5S00);
317     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C05, MD5S01);
318     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C06, MD5S02);
319     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C07, MD5S03);
320     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C08, MD5S00);
321     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C09, MD5S01);
322     MD5_STEP0(MD5_Fo, c, d, a, b,       MD5C0a, MD5S02);
323     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0b, MD5S03);
324     MD5_STEP0(MD5_Fo, a, b, c, d,       MD5C0c, MD5S00);
325     MD5_STEP0(MD5_Fo, d, a, b, c,       MD5C0d, MD5S01);
326     MD5_STEP (MD5_Fo, c, d, a, b, r_14, MD5C0e, MD5S02);
327     MD5_STEP0(MD5_Fo, b, c, d, a,       MD5C0f, MD5S03);
328
329     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C10, MD5S10);
330     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C11, MD5S11);
331     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C12, MD5S12);
332     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C13, MD5S13);
333     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C14, MD5S10);
334     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C15, MD5S11);
335     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C16, MD5S12);
336     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C17, MD5S13);
337     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C18, MD5S10);
338     MD5_STEP (MD5_Go, d, a, b, c, r_14, MD5C19, MD5S11);
339     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1a, MD5S12);
340     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1b, MD5S13);
341     MD5_STEP0(MD5_Go, a, b, c, d,       MD5C1c, MD5S10);
342     MD5_STEP0(MD5_Go, d, a, b, c,       MD5C1d, MD5S11);
343     MD5_STEP0(MD5_Go, c, d, a, b,       MD5C1e, MD5S12);
344     MD5_STEP0(MD5_Go, b, c, d, a,       MD5C1f, MD5S13);
345
346     MD5_STEP0(MD5_H , a, b, c, d,       MD5C20, MD5S20);
347     MD5_STEP0(MD5_H , d, a, b, c,       MD5C21, MD5S21);
348     MD5_STEP0(MD5_H , c, d, a, b,       MD5C22, MD5S22);
349     MD5_STEP (MD5_H , b, c, d, a, r_14, MD5C23, MD5S23);
350     MD5_STEP0(MD5_H , a, b, c, d,       MD5C24, MD5S20);
351     MD5_STEP0(MD5_H , d, a, b, c,       MD5C25, MD5S21);
352     MD5_STEP0(MD5_H , c, d, a, b,       MD5C26, MD5S22);
353     MD5_STEP0(MD5_H , b, c, d, a,       MD5C27, MD5S23);
354     MD5_STEP0(MD5_H , a, b, c, d,       MD5C28, MD5S20);
355     MD5_STEP0(MD5_H , d, a, b, c,       MD5C29, MD5S21);
356     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2a, MD5S22);
357     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2b, MD5S23);
358     MD5_STEP0(MD5_H , a, b, c, d,       MD5C2c, MD5S20);
359     MD5_STEP0(MD5_H , d, a, b, c,       MD5C2d, MD5S21);
360     MD5_STEP0(MD5_H , c, d, a, b,       MD5C2e, MD5S22);
361     MD5_STEP0(MD5_H , b, c, d, a,       MD5C2f, MD5S23);
362
363     MD5_STEP0(MD5_I , a, b, c, d,       MD5C30, MD5S30);
364     MD5_STEP0(MD5_I , d, a, b, c,       MD5C31, MD5S31);
365     MD5_STEP (MD5_I , c, d, a, b, r_14, MD5C32, MD5S32);
366     MD5_STEP0(MD5_I , b, c, d, a,       MD5C33, MD5S33);
367     MD5_STEP0(MD5_I , a, b, c, d,       MD5C34, MD5S30);
368     MD5_STEP0(MD5_I , d, a, b, c,       MD5C35, MD5S31);
369     MD5_STEP0(MD5_I , c, d, a, b,       MD5C36, MD5S32);
370     MD5_STEP0(MD5_I , b, c, d, a,       MD5C37, MD5S33);
371     MD5_STEP0(MD5_I , a, b, c, d,       MD5C38, MD5S30);
372     MD5_STEP0(MD5_I , d, a, b, c,       MD5C39, MD5S31);
373     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3a, MD5S32);
374     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3b, MD5S33);
375     MD5_STEP0(MD5_I , a, b, c, d,       MD5C3c, MD5S30);
376     MD5_STEP0(MD5_I , d, a, b, c,       MD5C3d, MD5S31);
377     MD5_STEP0(MD5_I , c, d, a, b,       MD5C3e, MD5S32);
378     MD5_STEP0(MD5_I , b, c, d, a,       MD5C3f, MD5S33);
379
380     a += r_a;
381     b += r_b;
382     c += r_c;
383     d += r_d;
384
385     COMPARE_M_SIMD (a, d, c, b);
386   }
387 }
388
389 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
390 {
391 }
392
393 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
394 {
395 }
396
397 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
398 {
399   /**
400    * modifier
401    */
402
403   const u32 gid = get_global_id (0);
404   const u32 lid = get_local_id (0);
405   const u32 lsz = get_local_size (0);
406
407   /**
408    * base
409    */
410
411   u32 pw_buf0[4];
412
413   pw_buf0[0] = pws[gid].i[ 0];
414   pw_buf0[1] = pws[gid].i[ 1];
415   pw_buf0[2] = pws[gid].i[ 2];
416   pw_buf0[3] = pws[gid].i[ 3];
417
418   u32 pw_buf1[4];
419
420   pw_buf1[0] = pws[gid].i[ 4];
421   pw_buf1[1] = pws[gid].i[ 5];
422   pw_buf1[2] = pws[gid].i[ 6];
423   pw_buf1[3] = pws[gid].i[ 7];
424
425   const u32 pw_len = pws[gid].pw_len;
426
427   /**
428    * salt
429    */
430
431   u32 s[8];
432
433   s[0] = salt_bufs[salt_pos].salt_buf[0];
434   s[1] = salt_bufs[salt_pos].salt_buf[1];
435   s[2] = salt_bufs[salt_pos].salt_buf[2];
436   s[3] = salt_bufs[salt_pos].salt_buf[3];
437   s[4] = salt_bufs[salt_pos].salt_buf[4];
438   s[5] = salt_bufs[salt_pos].salt_buf[5];
439   s[6] = salt_bufs[salt_pos].salt_buf[6];
440   s[7] = salt_bufs[salt_pos].salt_buf[7];
441
442   u32 salt_len = salt_bufs[salt_pos].salt_len;
443
444   const u32 r_14 = (32 + salt_len) * 8;
445
446   /**
447    * digest
448    */
449
450   const u32 search[4] =
451   {
452     digests_buf[digests_offset].digest_buf[DGST_R0],
453     digests_buf[digests_offset].digest_buf[DGST_R1],
454     digests_buf[digests_offset].digest_buf[DGST_R2],
455     digests_buf[digests_offset].digest_buf[DGST_R3]
456   };
457
458   /**
459    * bin2asc table
460    */
461
462   __local u32 l_bin2asc[256];
463
464   for (u32 i = lid; i < 256; i += lsz)
465   {
466     const u32 i0 = (i >> 0) & 15;
467     const u32 i1 = (i >> 4) & 15;
468
469     l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
470                  | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
471   }
472
473   barrier (CLK_LOCAL_MEM_FENCE);
474
475   if (gid >= gid_max) return;
476
477   /**
478    * loop
479    */
480
481   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
482   {
483     u32x w0[4] = { 0 };
484     u32x w1[4] = { 0 };
485     u32x w2[4] = { 0 };
486     u32x w3[4] = { 0 };
487
488     const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
489
490     append_0x80_2x4_VV (w0, w1, out_len);
491
492     w3[2] = out_len * 8;
493
494     u32x a = MD5M_A;
495     u32x b = MD5M_B;
496     u32x c = MD5M_C;
497     u32x d = MD5M_D;
498
499     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
500     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
501     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
502     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
503     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
504     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
505     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
506     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
507     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
508     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
509     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
510     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
511     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
512     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
513     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
514     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
515
516     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
517     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
518     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
519     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
520     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
521     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
522     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
523     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
524     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
525     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
526     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
527     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
528     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
529     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
530     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
531     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
532
533     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
534     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
535     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
536     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
537     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
538     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
539     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
540     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
541     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
542     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
543     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
544     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
545     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
546     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
547     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
548     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
549
550     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
551     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
552     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
553     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
554     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
555     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
556     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
557     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
558     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
559     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
560     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
561     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
562     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
563     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
564     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
565     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
566
567     a += MD5M_A;
568     b += MD5M_B;
569     c += MD5M_C;
570     d += MD5M_D;
571
572     w0[0] = uint_to_hex_lower8 ((a >>  0) & 255) <<  0
573           | uint_to_hex_lower8 ((a >>  8) & 255) << 16;
574     w0[1] = uint_to_hex_lower8 ((a >> 16) & 255) <<  0
575           | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
576     w0[2] = uint_to_hex_lower8 ((b >>  0) & 255) <<  0
577           | uint_to_hex_lower8 ((b >>  8) & 255) << 16;
578     w0[3] = uint_to_hex_lower8 ((b >> 16) & 255) <<  0
579           | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
580     w1[0] = uint_to_hex_lower8 ((c >>  0) & 255) <<  0
581           | uint_to_hex_lower8 ((c >>  8) & 255) << 16;
582     w1[1] = uint_to_hex_lower8 ((c >> 16) & 255) <<  0
583           | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
584     w1[2] = uint_to_hex_lower8 ((d >>  0) & 255) <<  0
585           | uint_to_hex_lower8 ((d >>  8) & 255) << 16;
586     w1[3] = uint_to_hex_lower8 ((d >> 16) & 255) <<  0
587           | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
588
589     w2[0] = s[0];
590     w2[1] = s[1];
591     w2[2] = s[2];
592     w2[3] = s[3];
593
594     w3[0] = s[4];
595     w3[1] = s[5];
596     w3[2] = s[6];
597     w3[3] = s[7];
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[0], MD5C00, MD5S00);
605     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
606     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
607     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
608     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
609     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
610     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
611     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
612     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
613     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
614     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
615     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
616     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
617     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
618     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
619     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
620
621     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
622     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
623     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
624     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
625     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
626     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
627     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
628     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
629     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
630     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
631     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
632     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
633     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
634     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
635     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
636     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
637
638     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
639     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
640     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
641     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
642     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
643     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
644     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
645     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
646     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
647     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
648     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
649     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
650     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
651     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
652     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
653     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
654
655     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
656     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
657     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
658     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
659     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
660     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
661     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
662     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
663     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
664     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
665     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
666     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
667     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
668     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
669     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
670     MD5_STEP (MD5_I , b, c, d, a, w2[1], 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_STEP0(MD5_Fo, a, b, c, d,       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_STEP0(MD5_Go, b, c, d, a,       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_STEP0(MD5_H , d, a, b, c,       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_STEP0(MD5_I , a, b, c, d,       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 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
760 {
761 }
762
763 __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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
764 {
765 }