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