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