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