3ccd31ebe3722a836dfc8b2c8bf3c49f5aa3389a
[hashcat.git] / OpenCL / m04800_a1.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
24 {
25   /**
26    * modifier
27    */
28
29   const u32 lid = get_local_id (0);
30
31   /**
32    * base
33    */
34
35   const u32 gid = get_global_id (0);
36
37   if (gid >= gid_max) return;
38
39   u32 wordl0[4];
40
41   wordl0[0] = pws[gid].i[ 0];
42   wordl0[1] = pws[gid].i[ 1];
43   wordl0[2] = pws[gid].i[ 2];
44   wordl0[3] = pws[gid].i[ 3];
45
46   u32 wordl1[4];
47
48   wordl1[0] = pws[gid].i[ 4];
49   wordl1[1] = pws[gid].i[ 5];
50   wordl1[2] = pws[gid].i[ 6];
51   wordl1[3] = pws[gid].i[ 7];
52
53   u32 wordl2[4];
54
55   wordl2[0] = 0;
56   wordl2[1] = 0;
57   wordl2[2] = 0;
58   wordl2[3] = 0;
59
60   u32 wordl3[4];
61
62   wordl3[0] = 0;
63   wordl3[1] = 0;
64   wordl3[2] = 0;
65   wordl3[3] = 0;
66
67   const u32 pw_l_len = pws[gid].pw_len;
68
69   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
70   {
71     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
72   }
73
74   /**
75    * salt
76    */
77
78   u32 salt_buf[5];
79
80   salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
81   salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
82   salt_buf[2] = salt_bufs[salt_pos].salt_buf[2];
83   salt_buf[3] = salt_bufs[salt_pos].salt_buf[3];
84   salt_buf[4] = salt_bufs[salt_pos].salt_buf[4];
85
86   const u32 salt_len = salt_bufs[salt_pos].salt_len;
87
88   /**
89    * loop
90    */
91
92   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
93   {
94     const u32 pw_r_len = combs_buf[il_pos].pw_len;
95
96     const u32 pw_len = pw_l_len + pw_r_len;
97
98     u32 wordr0[4];
99
100     wordr0[0] = combs_buf[il_pos].i[0];
101     wordr0[1] = combs_buf[il_pos].i[1];
102     wordr0[2] = combs_buf[il_pos].i[2];
103     wordr0[3] = combs_buf[il_pos].i[3];
104
105     u32 wordr1[4];
106
107     wordr1[0] = combs_buf[il_pos].i[4];
108     wordr1[1] = combs_buf[il_pos].i[5];
109     wordr1[2] = combs_buf[il_pos].i[6];
110     wordr1[3] = combs_buf[il_pos].i[7];
111
112     u32 wordr2[4];
113
114     wordr2[0] = 0;
115     wordr2[1] = 0;
116     wordr2[2] = 0;
117     wordr2[3] = 0;
118
119     u32 wordr3[4];
120
121     wordr3[0] = 0;
122     wordr3[1] = 0;
123     wordr3[2] = 0;
124     wordr3[3] = 0;
125
126     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
127     {
128       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
129     }
130
131     u32 w0[4];
132
133     w0[0] = wordl0[0] | wordr0[0];
134     w0[1] = wordl0[1] | wordr0[1];
135     w0[2] = wordl0[2] | wordr0[2];
136     w0[3] = wordl0[3] | wordr0[3];
137
138     u32 w1[4];
139
140     w1[0] = wordl1[0] | wordr1[0];
141     w1[1] = wordl1[1] | wordr1[1];
142     w1[2] = wordl1[2] | wordr1[2];
143     w1[3] = wordl1[3] | wordr1[3];
144
145     u32 w2[4];
146
147     w2[0] = wordl2[0] | wordr2[0];
148     w2[1] = wordl2[1] | wordr2[1];
149     w2[2] = wordl2[2] | wordr2[2];
150     w2[3] = wordl2[3] | wordr2[3];
151
152     u32 w3[4];
153
154     w3[0] = wordl3[0] | wordr3[0];
155     w3[1] = wordl3[1] | wordr3[1];
156     w3[2] = wordl3[2] | wordr3[2];
157     w3[3] = wordl3[3] | wordr3[3];
158
159     /*
160      * add id byte
161      */
162
163     switch_buffer_by_offset (w0, w1, w2, w3, 1);
164
165     w0[0] |= salt_buf[4];
166
167     /**
168      * append salt
169      */
170
171     u32 s0[4];
172
173     s0[0] = salt_buf[0];
174     s0[1] = salt_buf[1];
175     s0[2] = salt_buf[2];
176     s0[3] = salt_buf[3];
177
178     u32 s1[4];
179
180     s1[0] = 0x80;
181     s1[1] = 0;
182     s1[2] = 0;
183     s1[3] = 0;
184
185     u32 s2[4];
186
187     s2[0] = 0;
188     s2[1] = 0;
189     s2[2] = 0;
190     s2[3] = 0;
191
192     u32 s3[4];
193
194     s3[0] = 0;
195     s3[1] = 0;
196     s3[2] = 0;
197     s3[3] = 0;
198
199     switch_buffer_by_offset (s0, s1, s2, s3, 1 + pw_len);
200
201     const u32 pw_salt_len = pw_len + salt_len;
202
203     w0[0] |= s0[0];
204     w0[1] |= s0[1];
205     w0[2] |= s0[2];
206     w0[3] |= s0[3];
207     w1[0] |= s1[0];
208     w1[1] |= s1[1];
209     w1[2] |= s1[2];
210     w1[3] |= s1[3];
211     w2[0] |= s2[0];
212     w2[1] |= s2[1];
213     w2[2] |= s2[2];
214     w2[3] |= s2[3];
215     w3[0] |= s3[0];
216     w3[1] |= s3[1];
217     w3[2]  = pw_salt_len * 8;
218     w3[3]  = 0;
219
220     /**
221      * md5
222      */
223
224     u32 a = MD5M_A;
225     u32 b = MD5M_B;
226     u32 c = MD5M_C;
227     u32 d = MD5M_D;
228
229     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
230     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
231     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
232     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
233     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
234     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
235     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
236     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
237     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
238     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
239     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
240     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
241     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
242     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
243     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
244     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
245
246     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
247     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
248     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
249     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
250     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
251     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
252     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
253     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
254     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
255     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
256     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
257     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
258     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
259     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
260     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
261     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
262
263     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
264     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
265     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
266     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
267     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
268     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
269     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
270     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
271     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
272     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
273     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
274     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
275     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
276     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
277     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
278     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
279
280     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
281     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
282     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
283     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
284     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
285     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
286     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
287     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
288     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
289     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
290     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
291     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
292     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
293     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
294     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
295     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
296
297     const u32 r0 = a;
298     const u32 r1 = d;
299     const u32 r2 = c;
300     const u32 r3 = b;
301
302     #include COMPARE_M
303   }
304 }
305
306 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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)
307 {
308 }
309
310 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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)
311 {
312 }
313
314 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
315 {
316   /**
317    * modifier
318    */
319
320   const u32 lid = get_local_id (0);
321
322   /**
323    * base
324    */
325
326   const u32 gid = get_global_id (0);
327
328   if (gid >= gid_max) return;
329
330   u32 wordl0[4];
331
332   wordl0[0] = pws[gid].i[ 0];
333   wordl0[1] = pws[gid].i[ 1];
334   wordl0[2] = pws[gid].i[ 2];
335   wordl0[3] = pws[gid].i[ 3];
336
337   u32 wordl1[4];
338
339   wordl1[0] = pws[gid].i[ 4];
340   wordl1[1] = pws[gid].i[ 5];
341   wordl1[2] = pws[gid].i[ 6];
342   wordl1[3] = pws[gid].i[ 7];
343
344   u32 wordl2[4];
345
346   wordl2[0] = 0;
347   wordl2[1] = 0;
348   wordl2[2] = 0;
349   wordl2[3] = 0;
350
351   u32 wordl3[4];
352
353   wordl3[0] = 0;
354   wordl3[1] = 0;
355   wordl3[2] = 0;
356   wordl3[3] = 0;
357
358   const u32 pw_l_len = pws[gid].pw_len;
359
360   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
361   {
362     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
363   }
364
365   /**
366    * salt
367    */
368
369   u32 salt_buf[5];
370
371   salt_buf[0] = salt_bufs[salt_pos].salt_buf[0];
372   salt_buf[1] = salt_bufs[salt_pos].salt_buf[1];
373   salt_buf[2] = salt_bufs[salt_pos].salt_buf[2];
374   salt_buf[3] = salt_bufs[salt_pos].salt_buf[3];
375   salt_buf[4] = salt_bufs[salt_pos].salt_buf[4];
376
377   const u32 salt_len = salt_bufs[salt_pos].salt_len;
378
379   /**
380    * digest
381    */
382
383   const u32 search[4] =
384   {
385     digests_buf[digests_offset].digest_buf[DGST_R0],
386     digests_buf[digests_offset].digest_buf[DGST_R1],
387     digests_buf[digests_offset].digest_buf[DGST_R2],
388     digests_buf[digests_offset].digest_buf[DGST_R3]
389   };
390
391   /**
392    * loop
393    */
394
395   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
396   {
397     const u32 pw_r_len = combs_buf[il_pos].pw_len;
398
399     const u32 pw_len = pw_l_len + pw_r_len;
400
401     u32 wordr0[4];
402
403     wordr0[0] = combs_buf[il_pos].i[0];
404     wordr0[1] = combs_buf[il_pos].i[1];
405     wordr0[2] = combs_buf[il_pos].i[2];
406     wordr0[3] = combs_buf[il_pos].i[3];
407
408     u32 wordr1[4];
409
410     wordr1[0] = combs_buf[il_pos].i[4];
411     wordr1[1] = combs_buf[il_pos].i[5];
412     wordr1[2] = combs_buf[il_pos].i[6];
413     wordr1[3] = combs_buf[il_pos].i[7];
414
415     u32 wordr2[4];
416
417     wordr2[0] = 0;
418     wordr2[1] = 0;
419     wordr2[2] = 0;
420     wordr2[3] = 0;
421
422     u32 wordr3[4];
423
424     wordr3[0] = 0;
425     wordr3[1] = 0;
426     wordr3[2] = 0;
427     wordr3[3] = 0;
428
429     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
430     {
431       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
432     }
433
434     u32 w0[4];
435
436     w0[0] = wordl0[0] | wordr0[0];
437     w0[1] = wordl0[1] | wordr0[1];
438     w0[2] = wordl0[2] | wordr0[2];
439     w0[3] = wordl0[3] | wordr0[3];
440
441     u32 w1[4];
442
443     w1[0] = wordl1[0] | wordr1[0];
444     w1[1] = wordl1[1] | wordr1[1];
445     w1[2] = wordl1[2] | wordr1[2];
446     w1[3] = wordl1[3] | wordr1[3];
447
448     u32 w2[4];
449
450     w2[0] = wordl2[0] | wordr2[0];
451     w2[1] = wordl2[1] | wordr2[1];
452     w2[2] = wordl2[2] | wordr2[2];
453     w2[3] = wordl2[3] | wordr2[3];
454
455     u32 w3[4];
456
457     w3[0] = wordl3[0] | wordr3[0];
458     w3[1] = wordl3[1] | wordr3[1];
459     w3[2] = wordl3[2] | wordr3[2];
460     w3[3] = wordl3[3] | wordr3[3];
461
462     /*
463      * add id byte
464      */
465
466     switch_buffer_by_offset (w0, w1, w2, w3, 1);
467
468     w0[0] |= salt_buf[4];
469
470     /**
471      * append salt
472      */
473
474     u32 s0[4];
475
476     s0[0] = salt_buf[0];
477     s0[1] = salt_buf[1];
478     s0[2] = salt_buf[2];
479     s0[3] = salt_buf[3];
480
481     u32 s1[4];
482
483     s1[0] = 0x80;
484     s1[1] = 0;
485     s1[2] = 0;
486     s1[3] = 0;
487
488     u32 s2[4];
489
490     s2[0] = 0;
491     s2[1] = 0;
492     s2[2] = 0;
493     s2[3] = 0;
494
495     u32 s3[4];
496
497     s3[0] = 0;
498     s3[1] = 0;
499     s3[2] = 0;
500     s3[3] = 0;
501
502     switch_buffer_by_offset (s0, s1, s2, s3, 1 + pw_len);
503
504     const u32 pw_salt_len = pw_len + salt_len;
505
506     w0[0] |= s0[0];
507     w0[1] |= s0[1];
508     w0[2] |= s0[2];
509     w0[3] |= s0[3];
510     w1[0] |= s1[0];
511     w1[1] |= s1[1];
512     w1[2] |= s1[2];
513     w1[3] |= s1[3];
514     w2[0] |= s2[0];
515     w2[1] |= s2[1];
516     w2[2] |= s2[2];
517     w2[3] |= s2[3];
518     w3[0] |= s3[0];
519     w3[1] |= s3[1];
520     w3[2]  = pw_salt_len * 8;
521     w3[3]  = 0;
522
523     /**
524      * md5
525      */
526
527     u32 a = MD5M_A;
528     u32 b = MD5M_B;
529     u32 c = MD5M_C;
530     u32 d = MD5M_D;
531
532     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
533     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
534     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
535     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
536     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
537     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
538     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
539     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
540     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
541     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
542     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
543     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
544     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
545     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
546     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
547     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
548
549     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
550     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
551     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
552     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
553     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
554     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
555     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
556     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
557     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
558     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
559     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
560     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
561     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
562     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
563     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
564     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
565
566     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
567     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
568     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
569     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
570     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
571     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
572     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
573     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
574     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
575     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
576     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
577     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
578     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
579     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
580     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
581     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
582
583     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
584     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
585     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
586     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
587     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
588     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
589     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
590     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
591     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
592     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
593     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
594     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
595     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
596
597     bool q_cond = allx (search[0] != a);
598
599     if (q_cond) continue;
600
601     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
602     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
603     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
604
605     const u32 r0 = a;
606     const u32 r1 = d;
607     const u32 r2 = c;
608     const u32 r3 = b;
609
610     #include COMPARE_S
611   }
612 }
613
614 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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)
615 {
616 }
617
618 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04800_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)
619 {
620 }