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