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