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