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