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