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