937bd30db4329ec20c13ff7d09c0341e027fe58e
[hashcat.git] / OpenCL / m02400_a3.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #define NEW_SIMD_CODE
9
10 #include "inc_hash_constants.h"
11 #include "inc_vendor.cl"
12
13 #define DGST_R0 0
14 #define DGST_R1 3
15 #define DGST_R2 2
16 #define DGST_R3 1
17
18 #include "inc_hash_functions.cl"
19 #include "inc_types.cl"
20 #include "inc_common.cl"
21 #include "inc_simd.cl"
22
23 void m02400m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_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    * algorithm specific
34    */
35
36   w[ 4] = 0x80;
37   w[ 5] = 0;
38   w[ 6] = 0;
39   w[ 7] = 0;
40   w[ 8] = 0;
41   w[ 9] = 0;
42   w[10] = 0;
43   w[11] = 0;
44   w[12] = 0;
45   w[13] = 0;
46   w[14] = 16 * 8;
47   w[15] = 0;
48
49   /**
50    * base
51    */
52
53   const u32 F_w0c00 =    0  + MD5C00;
54   const u32 F_w1c01 = w[ 1] + MD5C01;
55   const u32 F_w2c02 = w[ 2] + MD5C02;
56   const u32 F_w3c03 = w[ 3] + MD5C03;
57   const u32 F_w4c04 = w[ 4] + MD5C04;
58   const u32 F_w5c05 = w[ 5] + MD5C05;
59   const u32 F_w6c06 = w[ 6] + MD5C06;
60   const u32 F_w7c07 = w[ 7] + MD5C07;
61   const u32 F_w8c08 = w[ 8] + MD5C08;
62   const u32 F_w9c09 = w[ 9] + MD5C09;
63   const u32 F_wac0a = w[10] + MD5C0a;
64   const u32 F_wbc0b = w[11] + MD5C0b;
65   const u32 F_wcc0c = w[12] + MD5C0c;
66   const u32 F_wdc0d = w[13] + MD5C0d;
67   const u32 F_wec0e = w[14] + MD5C0e;
68   const u32 F_wfc0f = w[15] + MD5C0f;
69
70   const u32 G_w1c10 = w[ 1] + MD5C10;
71   const u32 G_w6c11 = w[ 6] + MD5C11;
72   const u32 G_wbc12 = w[11] + MD5C12;
73   const u32 G_w0c13 =    0  + MD5C13;
74   const u32 G_w5c14 = w[ 5] + MD5C14;
75   const u32 G_wac15 = w[10] + MD5C15;
76   const u32 G_wfc16 = w[15] + MD5C16;
77   const u32 G_w4c17 = w[ 4] + MD5C17;
78   const u32 G_w9c18 = w[ 9] + MD5C18;
79   const u32 G_wec19 = w[14] + MD5C19;
80   const u32 G_w3c1a = w[ 3] + MD5C1a;
81   const u32 G_w8c1b = w[ 8] + MD5C1b;
82   const u32 G_wdc1c = w[13] + MD5C1c;
83   const u32 G_w2c1d = w[ 2] + MD5C1d;
84   const u32 G_w7c1e = w[ 7] + MD5C1e;
85   const u32 G_wcc1f = w[12] + MD5C1f;
86
87   const u32 H_w5c20 = w[ 5] + MD5C20;
88   const u32 H_w8c21 = w[ 8] + MD5C21;
89   const u32 H_wbc22 = w[11] + MD5C22;
90   const u32 H_wec23 = w[14] + MD5C23;
91   const u32 H_w1c24 = w[ 1] + MD5C24;
92   const u32 H_w4c25 = w[ 4] + MD5C25;
93   const u32 H_w7c26 = w[ 7] + MD5C26;
94   const u32 H_wac27 = w[10] + MD5C27;
95   const u32 H_wdc28 = w[13] + MD5C28;
96   const u32 H_w0c29 =    0  + MD5C29;
97   const u32 H_w3c2a = w[ 3] + MD5C2a;
98   const u32 H_w6c2b = w[ 6] + MD5C2b;
99   const u32 H_w9c2c = w[ 9] + MD5C2c;
100   const u32 H_wcc2d = w[12] + MD5C2d;
101   const u32 H_wfc2e = w[15] + MD5C2e;
102   const u32 H_w2c2f = w[ 2] + MD5C2f;
103
104   const u32 I_w0c30 =    0  + MD5C30;
105   const u32 I_w7c31 = w[ 7] + MD5C31;
106   const u32 I_wec32 = w[14] + MD5C32;
107   const u32 I_w5c33 = w[ 5] + MD5C33;
108   const u32 I_wcc34 = w[12] + MD5C34;
109   const u32 I_w3c35 = w[ 3] + MD5C35;
110   const u32 I_wac36 = w[10] + MD5C36;
111   const u32 I_w1c37 = w[ 1] + MD5C37;
112   const u32 I_w8c38 = w[ 8] + MD5C38;
113   const u32 I_wfc39 = w[15] + MD5C39;
114   const u32 I_w6c3a = w[ 6] + MD5C3a;
115   const u32 I_wdc3b = w[13] + MD5C3b;
116   const u32 I_w4c3c = w[ 4] + MD5C3c;
117   const u32 I_wbc3d = w[11] + MD5C3d;
118   const u32 I_w2c3e = w[ 2] + MD5C3e;
119   const u32 I_w9c3f = w[ 9] + MD5C3f;
120
121   /**
122    * loop
123    */
124
125   u32 w0l = w[0];
126
127   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
128   {
129     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
130
131     const u32x w0 = w0l | w0r;
132
133     u32x a = MD5M_A;
134     u32x b = MD5M_B;
135     u32x c = MD5M_C;
136     u32x d = MD5M_D;
137
138     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
139     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
140     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
141     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
142     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
143     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
144     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
145     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
146     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
147     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
148     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
149     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
150     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
151     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
152     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
153     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
154
155     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
156     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
157     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
158     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
159     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
160     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
161     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
162     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
163     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
164     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
165     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
166     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
167     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
168     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
169     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
170     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
171
172     MD5_STEP0(MD5_H , a, b, c, d,     H_w5c20, MD5S20);
173     MD5_STEP0(MD5_H , d, a, b, c,     H_w8c21, MD5S21);
174     MD5_STEP0(MD5_H , c, d, a, b,     H_wbc22, MD5S22);
175     MD5_STEP0(MD5_H , b, c, d, a,     H_wec23, MD5S23);
176     MD5_STEP0(MD5_H , a, b, c, d,     H_w1c24, MD5S20);
177     MD5_STEP0(MD5_H , d, a, b, c,     H_w4c25, MD5S21);
178     MD5_STEP0(MD5_H , c, d, a, b,     H_w7c26, MD5S22);
179     MD5_STEP0(MD5_H , b, c, d, a,     H_wac27, MD5S23);
180     MD5_STEP0(MD5_H , a, b, c, d,     H_wdc28, MD5S20);
181     MD5_STEP (MD5_H , d, a, b, c, w0, H_w0c29, MD5S21);
182     MD5_STEP0(MD5_H , c, d, a, b,     H_w3c2a, MD5S22);
183     MD5_STEP0(MD5_H , b, c, d, a,     H_w6c2b, MD5S23);
184     MD5_STEP0(MD5_H , a, b, c, d,     H_w9c2c, MD5S20);
185     MD5_STEP0(MD5_H , d, a, b, c,     H_wcc2d, MD5S21);
186     MD5_STEP0(MD5_H , c, d, a, b,     H_wfc2e, MD5S22);
187     MD5_STEP0(MD5_H , b, c, d, a,     H_w2c2f, MD5S23);
188
189     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
190     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
191     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
192     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
193     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
194     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
195     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
196     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
197     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
198     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
199     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
200     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
201     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
202     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
203     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
204     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
205
206     a &= 0x00ffffff;
207     d &= 0x00ffffff;
208     c &= 0x00ffffff;
209     b &= 0x00ffffff;
210
211     COMPARE_M_SIMD (a, d, c, b);
212   }
213 }
214
215 void m02400s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset)
216 {
217   /**
218    * modifier
219    */
220
221   const u32 gid = get_global_id (0);
222   const u32 lid = get_local_id (0);
223
224   /**
225    * algorithm specific
226    */
227
228   w[ 4] = 0x80;
229   w[ 5] = 0;
230   w[ 6] = 0;
231   w[ 7] = 0;
232   w[ 8] = 0;
233   w[ 9] = 0;
234   w[10] = 0;
235   w[11] = 0;
236   w[12] = 0;
237   w[13] = 0;
238   w[14] = 16 * 8;
239   w[15] = 0;
240
241   /**
242    * base
243    */
244
245   const u32 F_w0c00 =    0  + MD5C00;
246   const u32 F_w1c01 = w[ 1] + MD5C01;
247   const u32 F_w2c02 = w[ 2] + MD5C02;
248   const u32 F_w3c03 = w[ 3] + MD5C03;
249   const u32 F_w4c04 = w[ 4] + MD5C04;
250   const u32 F_w5c05 = w[ 5] + MD5C05;
251   const u32 F_w6c06 = w[ 6] + MD5C06;
252   const u32 F_w7c07 = w[ 7] + MD5C07;
253   const u32 F_w8c08 = w[ 8] + MD5C08;
254   const u32 F_w9c09 = w[ 9] + MD5C09;
255   const u32 F_wac0a = w[10] + MD5C0a;
256   const u32 F_wbc0b = w[11] + MD5C0b;
257   const u32 F_wcc0c = w[12] + MD5C0c;
258   const u32 F_wdc0d = w[13] + MD5C0d;
259   const u32 F_wec0e = w[14] + MD5C0e;
260   const u32 F_wfc0f = w[15] + MD5C0f;
261
262   const u32 G_w1c10 = w[ 1] + MD5C10;
263   const u32 G_w6c11 = w[ 6] + MD5C11;
264   const u32 G_wbc12 = w[11] + MD5C12;
265   const u32 G_w0c13 =    0  + MD5C13;
266   const u32 G_w5c14 = w[ 5] + MD5C14;
267   const u32 G_wac15 = w[10] + MD5C15;
268   const u32 G_wfc16 = w[15] + MD5C16;
269   const u32 G_w4c17 = w[ 4] + MD5C17;
270   const u32 G_w9c18 = w[ 9] + MD5C18;
271   const u32 G_wec19 = w[14] + MD5C19;
272   const u32 G_w3c1a = w[ 3] + MD5C1a;
273   const u32 G_w8c1b = w[ 8] + MD5C1b;
274   const u32 G_wdc1c = w[13] + MD5C1c;
275   const u32 G_w2c1d = w[ 2] + MD5C1d;
276   const u32 G_w7c1e = w[ 7] + MD5C1e;
277   const u32 G_wcc1f = w[12] + MD5C1f;
278
279   const u32 H_w5c20 = w[ 5] + MD5C20;
280   const u32 H_w8c21 = w[ 8] + MD5C21;
281   const u32 H_wbc22 = w[11] + MD5C22;
282   const u32 H_wec23 = w[14] + MD5C23;
283   const u32 H_w1c24 = w[ 1] + MD5C24;
284   const u32 H_w4c25 = w[ 4] + MD5C25;
285   const u32 H_w7c26 = w[ 7] + MD5C26;
286   const u32 H_wac27 = w[10] + MD5C27;
287   const u32 H_wdc28 = w[13] + MD5C28;
288   const u32 H_w0c29 =    0  + MD5C29;
289   const u32 H_w3c2a = w[ 3] + MD5C2a;
290   const u32 H_w6c2b = w[ 6] + MD5C2b;
291   const u32 H_w9c2c = w[ 9] + MD5C2c;
292   const u32 H_wcc2d = w[12] + MD5C2d;
293   const u32 H_wfc2e = w[15] + MD5C2e;
294   const u32 H_w2c2f = w[ 2] + MD5C2f;
295
296   const u32 I_w0c30 =    0  + MD5C30;
297   const u32 I_w7c31 = w[ 7] + MD5C31;
298   const u32 I_wec32 = w[14] + MD5C32;
299   const u32 I_w5c33 = w[ 5] + MD5C33;
300   const u32 I_wcc34 = w[12] + MD5C34;
301   const u32 I_w3c35 = w[ 3] + MD5C35;
302   const u32 I_wac36 = w[10] + MD5C36;
303   const u32 I_w1c37 = w[ 1] + MD5C37;
304   const u32 I_w8c38 = w[ 8] + MD5C38;
305   const u32 I_wfc39 = w[15] + MD5C39;
306   const u32 I_w6c3a = w[ 6] + MD5C3a;
307   const u32 I_wdc3b = w[13] + MD5C3b;
308   const u32 I_w4c3c = w[ 4] + MD5C3c;
309   const u32 I_wbc3d = w[11] + MD5C3d;
310   const u32 I_w2c3e = w[ 2] + MD5C3e;
311   const u32 I_w9c3f = w[ 9] + MD5C3f;
312
313   /**
314    * digest
315    */
316
317   const u32 search[4] =
318   {
319     digests_buf[digests_offset].digest_buf[DGST_R0],
320     digests_buf[digests_offset].digest_buf[DGST_R1],
321     digests_buf[digests_offset].digest_buf[DGST_R2],
322     digests_buf[digests_offset].digest_buf[DGST_R3]
323   };
324
325   /**
326    * loop
327    */
328
329   u32 w0l = w[0];
330
331   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
332   {
333     const u32x w0r = words_buf_r[il_pos / VECT_SIZE];
334
335     const u32x w0 = w0l | w0r;
336
337     u32x a = MD5M_A;
338     u32x b = MD5M_B;
339     u32x c = MD5M_C;
340     u32x d = MD5M_D;
341
342     MD5_STEP (MD5_Fo, a, b, c, d, w0, F_w0c00, MD5S00);
343     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w1c01, MD5S01);
344     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w2c02, MD5S02);
345     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w3c03, MD5S03);
346     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w4c04, MD5S00);
347     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w5c05, MD5S01);
348     MD5_STEP0(MD5_Fo, c, d, a, b,     F_w6c06, MD5S02);
349     MD5_STEP0(MD5_Fo, b, c, d, a,     F_w7c07, MD5S03);
350     MD5_STEP0(MD5_Fo, a, b, c, d,     F_w8c08, MD5S00);
351     MD5_STEP0(MD5_Fo, d, a, b, c,     F_w9c09, MD5S01);
352     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wac0a, MD5S02);
353     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wbc0b, MD5S03);
354     MD5_STEP0(MD5_Fo, a, b, c, d,     F_wcc0c, MD5S00);
355     MD5_STEP0(MD5_Fo, d, a, b, c,     F_wdc0d, MD5S01);
356     MD5_STEP0(MD5_Fo, c, d, a, b,     F_wec0e, MD5S02);
357     MD5_STEP0(MD5_Fo, b, c, d, a,     F_wfc0f, MD5S03);
358
359     MD5_STEP0(MD5_Go, a, b, c, d,     G_w1c10, MD5S10);
360     MD5_STEP0(MD5_Go, d, a, b, c,     G_w6c11, MD5S11);
361     MD5_STEP0(MD5_Go, c, d, a, b,     G_wbc12, MD5S12);
362     MD5_STEP (MD5_Go, b, c, d, a, w0, G_w0c13, MD5S13);
363     MD5_STEP0(MD5_Go, a, b, c, d,     G_w5c14, MD5S10);
364     MD5_STEP0(MD5_Go, d, a, b, c,     G_wac15, MD5S11);
365     MD5_STEP0(MD5_Go, c, d, a, b,     G_wfc16, MD5S12);
366     MD5_STEP0(MD5_Go, b, c, d, a,     G_w4c17, MD5S13);
367     MD5_STEP0(MD5_Go, a, b, c, d,     G_w9c18, MD5S10);
368     MD5_STEP0(MD5_Go, d, a, b, c,     G_wec19, MD5S11);
369     MD5_STEP0(MD5_Go, c, d, a, b,     G_w3c1a, MD5S12);
370     MD5_STEP0(MD5_Go, b, c, d, a,     G_w8c1b, MD5S13);
371     MD5_STEP0(MD5_Go, a, b, c, d,     G_wdc1c, MD5S10);
372     MD5_STEP0(MD5_Go, d, a, b, c,     G_w2c1d, MD5S11);
373     MD5_STEP0(MD5_Go, c, d, a, b,     G_w7c1e, MD5S12);
374     MD5_STEP0(MD5_Go, b, c, d, a,     G_wcc1f, MD5S13);
375
376     MD5_STEP0(MD5_H , a, b, c, d,     H_w5c20, MD5S20);
377     MD5_STEP0(MD5_H , d, a, b, c,     H_w8c21, MD5S21);
378     MD5_STEP0(MD5_H , c, d, a, b,     H_wbc22, MD5S22);
379     MD5_STEP0(MD5_H , b, c, d, a,     H_wec23, MD5S23);
380     MD5_STEP0(MD5_H , a, b, c, d,     H_w1c24, MD5S20);
381     MD5_STEP0(MD5_H , d, a, b, c,     H_w4c25, MD5S21);
382     MD5_STEP0(MD5_H , c, d, a, b,     H_w7c26, MD5S22);
383     MD5_STEP0(MD5_H , b, c, d, a,     H_wac27, MD5S23);
384     MD5_STEP0(MD5_H , a, b, c, d,     H_wdc28, MD5S20);
385     MD5_STEP (MD5_H , d, a, b, c, w0, H_w0c29, MD5S21);
386     MD5_STEP0(MD5_H , c, d, a, b,     H_w3c2a, MD5S22);
387     MD5_STEP0(MD5_H , b, c, d, a,     H_w6c2b, MD5S23);
388     MD5_STEP0(MD5_H , a, b, c, d,     H_w9c2c, MD5S20);
389     MD5_STEP0(MD5_H , d, a, b, c,     H_wcc2d, MD5S21);
390     MD5_STEP0(MD5_H , c, d, a, b,     H_wfc2e, MD5S22);
391     MD5_STEP0(MD5_H , b, c, d, a,     H_w2c2f, MD5S23);
392
393     MD5_STEP (MD5_I , a, b, c, d, w0, I_w0c30, MD5S30);
394     MD5_STEP0(MD5_I , d, a, b, c,     I_w7c31, MD5S31);
395     MD5_STEP0(MD5_I , c, d, a, b,     I_wec32, MD5S32);
396     MD5_STEP0(MD5_I , b, c, d, a,     I_w5c33, MD5S33);
397     MD5_STEP0(MD5_I , a, b, c, d,     I_wcc34, MD5S30);
398     MD5_STEP0(MD5_I , d, a, b, c,     I_w3c35, MD5S31);
399     MD5_STEP0(MD5_I , c, d, a, b,     I_wac36, MD5S32);
400     MD5_STEP0(MD5_I , b, c, d, a,     I_w1c37, MD5S33);
401     MD5_STEP0(MD5_I , a, b, c, d,     I_w8c38, MD5S30);
402     MD5_STEP0(MD5_I , d, a, b, c,     I_wfc39, MD5S31);
403     MD5_STEP0(MD5_I , c, d, a, b,     I_w6c3a, MD5S32);
404     MD5_STEP0(MD5_I , b, c, d, a,     I_wdc3b, MD5S33);
405     MD5_STEP0(MD5_I , a, b, c, d,     I_w4c3c, MD5S30);
406
407     if (MATCHES_NONE_VS ((a & 0x00ffffff), search[0])) continue;
408
409     MD5_STEP0(MD5_I , d, a, b, c,     I_wbc3d, MD5S31);
410     MD5_STEP0(MD5_I , c, d, a, b,     I_w2c3e, MD5S32);
411     MD5_STEP0(MD5_I , b, c, d, a,     I_w9c3f, MD5S33);
412
413     a &= 0x00ffffff;
414     d &= 0x00ffffff;
415     c &= 0x00ffffff;
416     b &= 0x00ffffff;
417
418     COMPARE_S_SIMD (a, d, c, b);
419   }
420 }
421
422 __kernel void m02400_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
423 {
424   /**
425    * base
426    */
427
428   const u32 gid = get_global_id (0);
429
430   if (gid >= gid_max) return;
431
432   u32 w[16];
433
434   w[ 0] = pws[gid].i[ 0];
435   w[ 1] = pws[gid].i[ 1];
436   w[ 2] = pws[gid].i[ 2];
437   w[ 3] = pws[gid].i[ 3];
438   w[ 4] = 0;
439   w[ 5] = 0;
440   w[ 6] = 0;
441   w[ 7] = 0;
442   w[ 8] = 0;
443   w[ 9] = 0;
444   w[10] = 0;
445   w[11] = 0;
446   w[12] = 0;
447   w[13] = 0;
448   w[14] = 0;
449   w[15] = 0;
450
451   const u32 pw_len = pws[gid].pw_len;
452
453   /**
454    * main
455    */
456
457   m02400m (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, il_cnt, digests_cnt, digests_offset);
458 }
459
460 __kernel void m02400_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
461 {
462 }
463
464 __kernel void m02400_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
465 {
466 }
467
468 __kernel void m02400_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
469 {
470   /**
471    * base
472    */
473
474   const u32 gid = get_global_id (0);
475
476   if (gid >= gid_max) return;
477
478   u32 w[16];
479
480   w[ 0] = pws[gid].i[ 0];
481   w[ 1] = pws[gid].i[ 1];
482   w[ 2] = pws[gid].i[ 2];
483   w[ 3] = pws[gid].i[ 3];
484   w[ 4] = 0;
485   w[ 5] = 0;
486   w[ 6] = 0;
487   w[ 7] = 0;
488   w[ 8] = 0;
489   w[ 9] = 0;
490   w[10] = 0;
491   w[11] = 0;
492   w[12] = 0;
493   w[13] = 0;
494   w[14] = 0;
495   w[15] = 0;
496
497   const u32 pw_len = pws[gid].pw_len;
498
499   /**
500    * main
501    */
502
503   m02400s (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, il_cnt, digests_cnt, digests_offset);
504 }
505
506 __kernel void m02400_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
507 {
508 }
509
510 __kernel void m02400_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __constant 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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
511 {
512 }