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