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