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