Initial commit
[hashcat.git] / amd / m00020_a3.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
32 #ifdef  VECT_SIZE1
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
35 #endif
36
37 #ifdef  VECT_SIZE2
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
40 #endif
41
42 #ifdef  VECT_SIZE4
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
45 #endif
46
47 static void m00020m (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
48 {
49   /**
50    * modifier
51    */
52
53   const u32 gid = get_global_id (0);
54   const u32 lid = get_local_id (0);
55
56   /**
57    * salt
58    */
59
60   u32 salt_buf0[4];
61
62   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
63   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
64   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
65   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
66
67   u32 salt_buf1[4];
68
69   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
70   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
71   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
72   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
73
74   u32 salt_buf2[4];
75
76   salt_buf2[0] = 0;
77   salt_buf2[1] = 0;
78   salt_buf2[2] = 0;
79   salt_buf2[3] = 0;
80
81   u32 salt_buf3[4];
82
83   salt_buf3[0] = 0;
84   salt_buf3[1] = 0;
85   salt_buf3[2] = 0;
86   salt_buf3[3] = 0;
87
88   const u32 salt_len = salt_bufs[salt_pos].salt_len;
89
90   const u32 pw_salt_len = pw_len + salt_len;
91
92   /**
93    * loop
94    */
95
96   u32x w0l = w0[0];
97
98   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
99   {
100     const u32 w0r = bfs_buf[il_pos].i;
101
102     w0[0] = w0l | w0r;
103
104     /**
105      * prepend salt
106      */
107
108     u32x w0_t[4];
109     u32x w1_t[4];
110     u32x w2_t[4];
111     u32x w3_t[4];
112
113     w0_t[0] = w0[0];
114     w0_t[1] = w0[1];
115     w0_t[2] = w0[2];
116     w0_t[3] = w0[3];
117     w1_t[0] = w1[0];
118     w1_t[1] = w1[1];
119     w1_t[2] = w1[2];
120     w1_t[3] = w1[3];
121     w2_t[0] = w2[0];
122     w2_t[1] = w2[1];
123     w2_t[2] = w2[2];
124     w2_t[3] = w2[3];
125     w3_t[0] = w3[0];
126     w3_t[1] = w3[1];
127     w3_t[2] = w3[2];
128     w3_t[3] = w3[3];
129
130     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
131
132     w3_t[2] = pw_salt_len * 8;
133
134     w0_t[0] |= salt_buf0[0];
135     w0_t[1] |= salt_buf0[1];
136     w0_t[2] |= salt_buf0[2];
137     w0_t[3] |= salt_buf0[3];
138     w1_t[0] |= salt_buf1[0];
139     w1_t[1] |= salt_buf1[1];
140     w1_t[2] |= salt_buf1[2];
141     w1_t[3] |= salt_buf1[3];
142     w2_t[0] |= salt_buf2[0];
143     w2_t[1] |= salt_buf2[1];
144     w2_t[2] |= salt_buf2[2];
145     w2_t[3] |= salt_buf2[3];
146     w3_t[0] |= salt_buf3[0];
147     w3_t[1] |= salt_buf3[1];
148     w3_t[2] |= salt_buf3[2];
149     w3_t[3] |= salt_buf3[3];
150
151     /**
152      * md5
153      */
154
155     u32x tmp2;
156
157     u32x a = MD5M_A;
158     u32x b = MD5M_B;
159     u32x c = MD5M_C;
160     u32x d = MD5M_D;
161
162     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
163     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
164     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
165     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
166     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
167     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
168     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
169     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
170     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
171     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
172     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
173     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
174     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
175     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
176     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
177     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
178
179     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
180     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
181     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
182     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
183     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
184     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
185     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
186     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
187     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
188     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
189     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
190     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
191     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
192     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
193     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
194     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
195
196     MD5_STEP (MD5_H1, a, b, c, d, w1_t[1], MD5C20, MD5S20);
197     MD5_STEP (MD5_H2, d, a, b, c, w2_t[0], MD5C21, MD5S21);
198     MD5_STEP (MD5_H1, c, d, a, b, w2_t[3], MD5C22, MD5S22);
199     MD5_STEP (MD5_H2, b, c, d, a, w3_t[2], MD5C23, MD5S23);
200     MD5_STEP (MD5_H1, a, b, c, d, w0_t[1], MD5C24, MD5S20);
201     MD5_STEP (MD5_H2, d, a, b, c, w1_t[0], MD5C25, MD5S21);
202     MD5_STEP (MD5_H1, c, d, a, b, w1_t[3], MD5C26, MD5S22);
203     MD5_STEP (MD5_H2, b, c, d, a, w2_t[2], MD5C27, MD5S23);
204     MD5_STEP (MD5_H1, a, b, c, d, w3_t[1], MD5C28, MD5S20);
205     MD5_STEP (MD5_H2, d, a, b, c, w0_t[0], MD5C29, MD5S21);
206     MD5_STEP (MD5_H1, c, d, a, b, w0_t[3], MD5C2a, MD5S22);
207     MD5_STEP (MD5_H2, b, c, d, a, w1_t[2], MD5C2b, MD5S23);
208     MD5_STEP (MD5_H1, a, b, c, d, w2_t[1], MD5C2c, MD5S20);
209     MD5_STEP (MD5_H2, d, a, b, c, w3_t[0], MD5C2d, MD5S21);
210     MD5_STEP (MD5_H1, c, d, a, b, w3_t[3], MD5C2e, MD5S22);
211     MD5_STEP (MD5_H2, b, c, d, a, w0_t[2], MD5C2f, MD5S23);
212
213     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
214     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
215     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
216     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
217     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
218     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
219     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
220     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
221     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
222     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
223     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
224     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
225     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
226     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
227     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
228     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
229
230
231     const u32x r0 = a;
232     const u32x r1 = d;
233     const u32x r2 = c;
234     const u32x r3 = b;
235
236     #include VECT_COMPARE_M
237   }
238 }
239
240 static void m00020s (u32x w0[4], u32x w1[4], u32x w2[4], u32x w3[4], const u32 pw_len, __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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset)
241 {
242   /**
243    * modifier
244    */
245
246   const u32 gid = get_global_id (0);
247   const u32 lid = get_local_id (0);
248
249   /**
250    * digest
251    */
252
253   const u32 search[4] =
254   {
255     digests_buf[digests_offset].digest_buf[DGST_R0],
256     digests_buf[digests_offset].digest_buf[DGST_R1],
257     digests_buf[digests_offset].digest_buf[DGST_R2],
258     digests_buf[digests_offset].digest_buf[DGST_R3]
259   };
260
261   /**
262    * salt
263    */
264
265   u32 salt_buf0[4];
266
267   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
268   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
269   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
270   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
271
272   u32 salt_buf1[4];
273
274   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
275   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
276   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
277   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
278
279   u32 salt_buf2[4];
280
281   salt_buf2[0] = 0;
282   salt_buf2[1] = 0;
283   salt_buf2[2] = 0;
284   salt_buf2[3] = 0;
285
286   u32 salt_buf3[4];
287
288   salt_buf3[0] = 0;
289   salt_buf3[1] = 0;
290   salt_buf3[2] = 0;
291   salt_buf3[3] = 0;
292
293   const u32 salt_len = salt_bufs[salt_pos].salt_len;
294
295   const u32 pw_salt_len = pw_len + salt_len;
296
297   /**
298    * loop
299    */
300
301   u32x w0l = w0[0];
302
303   for (u32 il_pos = 0; il_pos < bfs_cnt; il_pos++)
304   {
305     const u32 w0r = bfs_buf[il_pos].i;
306
307     w0[0] = w0l | w0r;
308
309     /**
310      * prepend salt
311      */
312
313     u32x w0_t[4];
314     u32x w1_t[4];
315     u32x w2_t[4];
316     u32x w3_t[4];
317
318     w0_t[0] = w0[0];
319     w0_t[1] = w0[1];
320     w0_t[2] = w0[2];
321     w0_t[3] = w0[3];
322     w1_t[0] = w1[0];
323     w1_t[1] = w1[1];
324     w1_t[2] = w1[2];
325     w1_t[3] = w1[3];
326     w2_t[0] = w2[0];
327     w2_t[1] = w2[1];
328     w2_t[2] = w2[2];
329     w2_t[3] = w2[3];
330     w3_t[0] = w3[0];
331     w3_t[1] = w3[1];
332     w3_t[2] = w3[2];
333     w3_t[3] = w3[3];
334
335     switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
336
337     w3_t[2] = pw_salt_len * 8;
338
339     w0_t[0] |= salt_buf0[0];
340     w0_t[1] |= salt_buf0[1];
341     w0_t[2] |= salt_buf0[2];
342     w0_t[3] |= salt_buf0[3];
343     w1_t[0] |= salt_buf1[0];
344     w1_t[1] |= salt_buf1[1];
345     w1_t[2] |= salt_buf1[2];
346     w1_t[3] |= salt_buf1[3];
347     w2_t[0] |= salt_buf2[0];
348     w2_t[1] |= salt_buf2[1];
349     w2_t[2] |= salt_buf2[2];
350     w2_t[3] |= salt_buf2[3];
351     w3_t[0] |= salt_buf3[0];
352     w3_t[1] |= salt_buf3[1];
353     w3_t[2] |= salt_buf3[2];
354     w3_t[3] |= salt_buf3[3];
355
356     /**
357      * md5
358      */
359
360     u32x tmp2;
361
362     u32x a = MD5M_A;
363     u32x b = MD5M_B;
364     u32x c = MD5M_C;
365     u32x d = MD5M_D;
366
367     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
368     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
369     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
370     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
371     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
372     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
373     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
374     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
375     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
376     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
377     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
378     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
379     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
380     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
381     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
382     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
383
384     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
385     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
386     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
387     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
388     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
389     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
390     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
391     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
392     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
393     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
394     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
395     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
396     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
397     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
398     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
399     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
400
401     MD5_STEP (MD5_H1, a, b, c, d, w1_t[1], MD5C20, MD5S20);
402     MD5_STEP (MD5_H2, d, a, b, c, w2_t[0], MD5C21, MD5S21);
403     MD5_STEP (MD5_H1, c, d, a, b, w2_t[3], MD5C22, MD5S22);
404     MD5_STEP (MD5_H2, b, c, d, a, w3_t[2], MD5C23, MD5S23);
405     MD5_STEP (MD5_H1, a, b, c, d, w0_t[1], MD5C24, MD5S20);
406     MD5_STEP (MD5_H2, d, a, b, c, w1_t[0], MD5C25, MD5S21);
407     MD5_STEP (MD5_H1, c, d, a, b, w1_t[3], MD5C26, MD5S22);
408     MD5_STEP (MD5_H2, b, c, d, a, w2_t[2], MD5C27, MD5S23);
409     MD5_STEP (MD5_H1, a, b, c, d, w3_t[1], MD5C28, MD5S20);
410     MD5_STEP (MD5_H2, d, a, b, c, w0_t[0], MD5C29, MD5S21);
411     MD5_STEP (MD5_H1, c, d, a, b, w0_t[3], MD5C2a, MD5S22);
412     MD5_STEP (MD5_H2, b, c, d, a, w1_t[2], MD5C2b, MD5S23);
413     MD5_STEP (MD5_H1, a, b, c, d, w2_t[1], MD5C2c, MD5S20);
414     MD5_STEP (MD5_H2, d, a, b, c, w3_t[0], MD5C2d, MD5S21);
415     MD5_STEP (MD5_H1, c, d, a, b, w3_t[3], MD5C2e, MD5S22);
416     MD5_STEP (MD5_H2, b, c, d, a, w0_t[2], MD5C2f, MD5S23);
417
418     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
419     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
420     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
421     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
422     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
423     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
424     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
425     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
426     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
427     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
428     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
429     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
430     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
431
432     bool q_cond = allx (search[0] != a);
433
434     if (q_cond) continue;
435
436     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
437     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
438     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
439
440
441     const u32x r0 = a;
442     const u32x r1 = d;
443     const u32x r2 = c;
444     const u32x r3 = b;
445
446     #include VECT_COMPARE_S
447   }
448 }
449
450 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
451 {
452   /**
453    * base
454    */
455
456   const u32 gid = get_global_id (0);
457
458   if (gid >= gid_max) return;
459
460   u32x w0[4];
461
462   w0[0] = pws[gid].i[ 0];
463   w0[1] = pws[gid].i[ 1];
464   w0[2] = pws[gid].i[ 2];
465   w0[3] = pws[gid].i[ 3];
466
467   u32x w1[4];
468
469   w1[0] = 0;
470   w1[1] = 0;
471   w1[2] = 0;
472   w1[3] = 0;
473
474   u32x w2[4];
475
476   w2[0] = 0;
477   w2[1] = 0;
478   w2[2] = 0;
479   w2[3] = 0;
480
481   u32x w3[4];
482
483   w3[0] = 0;
484   w3[1] = 0;
485   w3[2] = 0;
486   w3[3] = 0;
487
488   const u32 pw_len = pws[gid].pw_len;
489
490   /**
491    * main
492    */
493
494   m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
495 }
496
497 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
498 {
499   /**
500    * base
501    */
502
503   const u32 gid = get_global_id (0);
504
505   if (gid >= gid_max) return;
506
507   u32x w0[4];
508
509   w0[0] = pws[gid].i[ 0];
510   w0[1] = pws[gid].i[ 1];
511   w0[2] = pws[gid].i[ 2];
512   w0[3] = pws[gid].i[ 3];
513
514   u32x w1[4];
515
516   w1[0] = pws[gid].i[ 4];
517   w1[1] = pws[gid].i[ 5];
518   w1[2] = pws[gid].i[ 6];
519   w1[3] = pws[gid].i[ 7];
520
521   u32x w2[4];
522
523   w2[0] = 0;
524   w2[1] = 0;
525   w2[2] = 0;
526   w2[3] = 0;
527
528   u32x w3[4];
529
530   w3[0] = 0;
531   w3[1] = 0;
532   w3[2] = 0;
533   w3[3] = 0;
534
535   const u32 pw_len = pws[gid].pw_len;
536
537   /**
538    * main
539    */
540
541   m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
542 }
543
544 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
545 {
546   /**
547    * base
548    */
549
550   const u32 gid = get_global_id (0);
551
552   if (gid >= gid_max) return;
553
554   u32x w0[4];
555
556   w0[0] = pws[gid].i[ 0];
557   w0[1] = pws[gid].i[ 1];
558   w0[2] = pws[gid].i[ 2];
559   w0[3] = pws[gid].i[ 3];
560
561   u32x w1[4];
562
563   w1[0] = pws[gid].i[ 4];
564   w1[1] = pws[gid].i[ 5];
565   w1[2] = pws[gid].i[ 6];
566   w1[3] = pws[gid].i[ 7];
567
568   u32x w2[4];
569
570   w2[0] = pws[gid].i[ 8];
571   w2[1] = pws[gid].i[ 9];
572   w2[2] = pws[gid].i[10];
573   w2[3] = pws[gid].i[11];
574
575   u32x w3[4];
576
577   w3[0] = pws[gid].i[12];
578   w3[1] = pws[gid].i[13];
579   w3[2] = 0;
580   w3[3] = 0;
581
582   const u32 pw_len = pws[gid].pw_len;
583
584   /**
585    * main
586    */
587
588   m00020m (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
589 }
590
591 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
592 {
593   /**
594    * base
595    */
596
597   const u32 gid = get_global_id (0);
598
599   if (gid >= gid_max) return;
600
601   u32x w0[4];
602
603   w0[0] = pws[gid].i[ 0];
604   w0[1] = pws[gid].i[ 1];
605   w0[2] = pws[gid].i[ 2];
606   w0[3] = pws[gid].i[ 3];
607
608   u32x w1[4];
609
610   w1[0] = 0;
611   w1[1] = 0;
612   w1[2] = 0;
613   w1[3] = 0;
614
615   u32x w2[4];
616
617   w2[0] = 0;
618   w2[1] = 0;
619   w2[2] = 0;
620   w2[3] = 0;
621
622   u32x w3[4];
623
624   w3[0] = 0;
625   w3[1] = 0;
626   w3[2] = 0;
627   w3[3] = 0;
628
629   const u32 pw_len = pws[gid].pw_len;
630
631   /**
632    * main
633    */
634
635   m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
636 }
637
638 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
639 {
640   /**
641    * base
642    */
643
644   const u32 gid = get_global_id (0);
645
646   if (gid >= gid_max) return;
647
648   u32x w0[4];
649
650   w0[0] = pws[gid].i[ 0];
651   w0[1] = pws[gid].i[ 1];
652   w0[2] = pws[gid].i[ 2];
653   w0[3] = pws[gid].i[ 3];
654
655   u32x w1[4];
656
657   w1[0] = pws[gid].i[ 4];
658   w1[1] = pws[gid].i[ 5];
659   w1[2] = pws[gid].i[ 6];
660   w1[3] = pws[gid].i[ 7];
661
662   u32x w2[4];
663
664   w2[0] = 0;
665   w2[1] = 0;
666   w2[2] = 0;
667   w2[3] = 0;
668
669   u32x w3[4];
670
671   w3[0] = 0;
672   w3[1] = 0;
673   w3[2] = 0;
674   w3[3] = 0;
675
676   const u32 pw_len = pws[gid].pw_len;
677
678   /**
679    * main
680    */
681
682   m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
683 }
684
685 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m00020_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 bfs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
686 {
687   /**
688    * base
689    */
690
691   const u32 gid = get_global_id (0);
692
693   if (gid >= gid_max) return;
694
695   u32x w0[4];
696
697   w0[0] = pws[gid].i[ 0];
698   w0[1] = pws[gid].i[ 1];
699   w0[2] = pws[gid].i[ 2];
700   w0[3] = pws[gid].i[ 3];
701
702   u32x w1[4];
703
704   w1[0] = pws[gid].i[ 4];
705   w1[1] = pws[gid].i[ 5];
706   w1[2] = pws[gid].i[ 6];
707   w1[3] = pws[gid].i[ 7];
708
709   u32x w2[4];
710
711   w2[0] = pws[gid].i[ 8];
712   w2[1] = pws[gid].i[ 9];
713   w2[2] = pws[gid].i[10];
714   w2[3] = pws[gid].i[11];
715
716   u32x w3[4];
717
718   w3[0] = pws[gid].i[12];
719   w3[1] = pws[gid].i[13];
720   w3[2] = 0;
721   w3[3] = 0;
722
723   const u32 pw_len = pws[gid].pw_len;
724
725   /**
726    * main
727    */
728
729   m00020s (w0, w1, w2, w3, pw_len, pws, rules_buf, combs_buf, bfs_buf, tmps, hooks, bitmaps_buf_s1_a, bitmaps_buf_s1_b, bitmaps_buf_s1_c, bitmaps_buf_s1_d, bitmaps_buf_s2_a, bitmaps_buf_s2_b, bitmaps_buf_s2_c, bitmaps_buf_s2_d, plains_buf, digests_buf, hashes_shown, salt_bufs, esalt_bufs, d_return_buf, d_scryptV_buf, bitmap_mask, bitmap_shift1, bitmap_shift2, salt_pos, loop_pos, loop_cnt, bfs_cnt, digests_cnt, digests_offset);
730 }