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