Fix m 60 a 0 by making modified variable non-const
[hashcat.git] / OpenCL / m02410_a1.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_vendor.cl"
11 #include "inc_hash_constants.h"
12 #include "inc_hash_functions.cl"
13 #include "inc_types.cl"
14 #include "inc_common.cl"
15 #include "inc_simd.cl"
16
17 __kernel void m02410_m04 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
18 {
19   /**
20    * modifier
21    */
22
23   const u32 lid = get_local_id (0);
24
25   /**
26    * base
27    */
28
29   const u32 gid = get_global_id (0);
30
31   if (gid >= gid_max) return;
32
33   u32 pw_buf0[4];
34   u32 pw_buf1[4];
35
36   pw_buf0[0] = pws[gid].i[0];
37   pw_buf0[1] = pws[gid].i[1];
38   pw_buf0[2] = pws[gid].i[2];
39   pw_buf0[3] = pws[gid].i[3];
40   pw_buf1[0] = pws[gid].i[4];
41   pw_buf1[1] = pws[gid].i[5];
42   pw_buf1[2] = pws[gid].i[6];
43   pw_buf1[3] = pws[gid].i[7];
44
45   const u32 pw_l_len = pws[gid].pw_len;
46
47   /**
48    * salt
49    */
50
51   u32 salt_buf0[4];
52   u32 salt_buf1[4];
53   u32 salt_buf2[4];
54   u32 salt_buf3[4];
55
56   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
57   salt_buf0[1] = 0;
58   salt_buf0[2] = 0;
59   salt_buf0[3] = 0;
60   salt_buf1[0] = 0;
61   salt_buf1[1] = 0;
62   salt_buf1[2] = 0;
63   salt_buf1[3] = 0;
64   salt_buf2[0] = 0;
65   salt_buf2[1] = 0;
66   salt_buf2[2] = 0;
67   salt_buf2[3] = 0;
68   salt_buf3[0] = 0;
69   salt_buf3[1] = 0;
70   salt_buf3[2] = 0;
71   salt_buf3[3] = 0;
72
73   /**
74    * loop
75    */
76
77   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
78   {
79     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
80
81     const u32x pw_len = pw_l_len + pw_r_len;
82
83     /**
84      * concat password candidate
85      */
86
87     u32x wordl0[4] = { 0 };
88     u32x wordl1[4] = { 0 };
89     u32x wordl2[4] = { 0 };
90     u32x wordl3[4] = { 0 };
91
92     wordl0[0] = pw_buf0[0];
93     wordl0[1] = pw_buf0[1];
94     wordl0[2] = pw_buf0[2];
95     wordl0[3] = pw_buf0[3];
96     wordl1[0] = pw_buf1[0];
97     wordl1[1] = pw_buf1[1];
98     wordl1[2] = pw_buf1[2];
99     wordl1[3] = pw_buf1[3];
100
101     u32x wordr0[4] = { 0 };
102     u32x wordr1[4] = { 0 };
103     u32x wordr2[4] = { 0 };
104     u32x wordr3[4] = { 0 };
105
106     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
107     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
108     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
109     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
110     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
111     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
112     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
113     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
114
115     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
116     {
117       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
118     }
119     else
120     {
121       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
122     }
123
124     u32x w0[4];
125     u32x w1[4];
126     u32x w2[4];
127     u32x w3[4];
128
129     w0[0] = wordl0[0] | wordr0[0];
130     w0[1] = wordl0[1] | wordr0[1];
131     w0[2] = wordl0[2] | wordr0[2];
132     w0[3] = wordl0[3] | wordr0[3];
133     w1[0] = wordl1[0] | wordr1[0];
134     w1[1] = wordl1[1] | wordr1[1];
135     w1[2] = wordl1[2] | wordr1[2];
136     w1[3] = wordl1[3] | wordr1[3];
137     w2[0] = wordl2[0] | wordr2[0];
138     w2[1] = wordl2[1] | wordr2[1];
139     w2[2] = wordl2[2] | wordr2[2];
140     w2[3] = wordl2[3] | wordr2[3];
141     w3[0] = wordl3[0] | wordr3[0];
142     w3[1] = wordl3[1] | wordr3[1];
143     w3[2] = wordl3[2] | wordr3[2];
144     w3[3] = wordl3[3] | wordr3[3];
145
146     /**
147      * append salt
148      */
149
150     u32x s0[4];
151     u32x s1[4];
152     u32x s2[4];
153     u32x s3[4];
154
155     s0[0] = salt_buf0[0];
156     s0[1] = salt_buf0[1];
157     s0[2] = salt_buf0[2];
158     s0[3] = salt_buf0[3];
159     s1[0] = salt_buf1[0];
160     s1[1] = salt_buf1[1];
161     s1[2] = salt_buf1[2];
162     s1[3] = salt_buf1[3];
163     s2[0] = salt_buf2[0];
164     s2[1] = salt_buf2[1];
165     s2[2] = salt_buf2[2];
166     s2[3] = salt_buf2[3];
167     s3[0] = salt_buf3[0];
168     s3[1] = salt_buf3[1];
169     s3[2] = salt_buf3[2];
170     s3[3] = salt_buf3[3];
171
172     switch_buffer_by_offset_le_VV (s0, s1, s2, s3, pw_len);
173
174     w0[0] |= s0[0];
175     w0[1] |= s0[1];
176     w0[2] |= s0[2];
177     w0[3] |= s0[3];
178     w1[0] |= s1[0];
179     w1[1] |= s1[1];
180     w1[2] |= s1[2];
181     w1[3] |= s1[3];
182     w2[0] |= s2[0];
183     w2[1] |= s2[1];
184     w2[2] |= s2[2];
185     w2[3] |= s2[3];
186     w3[0] |= s3[0];
187     w3[1] |= s3[1];
188     w3[2] |= s3[2];
189     w3[3] |= s3[3];
190
191     /**
192      * md5
193      */
194
195     w1[0] = 0x80;
196     w1[1] = 0;
197     w1[2] = 0;
198     w1[3] = 0;
199     w2[0] = 0;
200     w2[1] = 0;
201     w2[2] = 0;
202     w2[3] = 0;
203     w3[0] = 0;
204     w3[1] = 0;
205     w3[2] = 16 * 8;
206     w3[3] = 0;
207
208     u32x a = MD5M_A;
209     u32x b = MD5M_B;
210     u32x c = MD5M_C;
211     u32x d = MD5M_D;
212
213     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
214     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
215     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
216     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
217     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
218     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
219     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
220     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
221     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
222     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
223     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
224     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
225     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
226     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
227     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
228     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
229
230     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
231     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
232     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
233     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
234     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
235     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
236     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
237     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
238     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
239     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
240     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
241     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
242     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
243     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
244     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
245     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
246
247     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
248     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
249     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
250     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
251     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
252     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
253     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
254     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
255     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
256     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
257     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
258     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
259     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
260     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
261     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
262     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
263
264     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
265     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
266     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
267     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
268     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
269     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
270     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
271     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
272     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
273     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
274     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
275     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
276     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
277     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
278     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
279     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
280
281     a &= 0x00ffffff;
282     d &= 0x00ffffff;
283     c &= 0x00ffffff;
284     b &= 0x00ffffff;
285
286     COMPARE_M_SIMD (a, d, c, b);
287   }
288 }
289
290 __kernel void m02410_m08 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
291 {
292 }
293
294 __kernel void m02410_m16 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
295 {
296 }
297
298 __kernel void m02410_s04 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
299 {
300   /**
301    * modifier
302    */
303
304   const u32 lid = get_local_id (0);
305
306   /**
307    * base
308    */
309
310   const u32 gid = get_global_id (0);
311
312   if (gid >= gid_max) return;
313
314   u32 pw_buf0[4];
315   u32 pw_buf1[4];
316
317   pw_buf0[0] = pws[gid].i[0];
318   pw_buf0[1] = pws[gid].i[1];
319   pw_buf0[2] = pws[gid].i[2];
320   pw_buf0[3] = pws[gid].i[3];
321   pw_buf1[0] = pws[gid].i[4];
322   pw_buf1[1] = pws[gid].i[5];
323   pw_buf1[2] = pws[gid].i[6];
324   pw_buf1[3] = pws[gid].i[7];
325
326   const u32 pw_l_len = pws[gid].pw_len;
327
328   /**
329    * salt
330    */
331
332   u32 salt_buf0[4];
333   u32 salt_buf1[4];
334   u32 salt_buf2[4];
335   u32 salt_buf3[4];
336
337   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
338   salt_buf0[1] = 0;
339   salt_buf0[2] = 0;
340   salt_buf0[3] = 0;
341   salt_buf1[0] = 0;
342   salt_buf1[1] = 0;
343   salt_buf1[2] = 0;
344   salt_buf1[3] = 0;
345   salt_buf2[0] = 0;
346   salt_buf2[1] = 0;
347   salt_buf2[2] = 0;
348   salt_buf2[3] = 0;
349   salt_buf3[0] = 0;
350   salt_buf3[1] = 0;
351   salt_buf3[2] = 0;
352   salt_buf3[3] = 0;
353
354   /**
355    * digest
356    */
357
358   const u32 search[4] =
359   {
360     digests_buf[digests_offset].digest_buf[DGST_R0],
361     digests_buf[digests_offset].digest_buf[DGST_R1],
362     digests_buf[digests_offset].digest_buf[DGST_R2],
363     digests_buf[digests_offset].digest_buf[DGST_R3]
364   };
365
366   /**
367    * loop
368    */
369
370   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
371   {
372     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
373
374     const u32x pw_len = pw_l_len + pw_r_len;
375
376     /**
377      * concat password candidate
378      */
379
380     u32x wordl0[4] = { 0 };
381     u32x wordl1[4] = { 0 };
382     u32x wordl2[4] = { 0 };
383     u32x wordl3[4] = { 0 };
384
385     wordl0[0] = pw_buf0[0];
386     wordl0[1] = pw_buf0[1];
387     wordl0[2] = pw_buf0[2];
388     wordl0[3] = pw_buf0[3];
389     wordl1[0] = pw_buf1[0];
390     wordl1[1] = pw_buf1[1];
391     wordl1[2] = pw_buf1[2];
392     wordl1[3] = pw_buf1[3];
393
394     u32x wordr0[4] = { 0 };
395     u32x wordr1[4] = { 0 };
396     u32x wordr2[4] = { 0 };
397     u32x wordr3[4] = { 0 };
398
399     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
400     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
401     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
402     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
403     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
404     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
405     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
406     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
407
408     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
409     {
410       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
411     }
412     else
413     {
414       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
415     }
416
417     u32x w0[4];
418     u32x w1[4];
419     u32x w2[4];
420     u32x w3[4];
421
422     w0[0] = wordl0[0] | wordr0[0];
423     w0[1] = wordl0[1] | wordr0[1];
424     w0[2] = wordl0[2] | wordr0[2];
425     w0[3] = wordl0[3] | wordr0[3];
426     w1[0] = wordl1[0] | wordr1[0];
427     w1[1] = wordl1[1] | wordr1[1];
428     w1[2] = wordl1[2] | wordr1[2];
429     w1[3] = wordl1[3] | wordr1[3];
430     w2[0] = wordl2[0] | wordr2[0];
431     w2[1] = wordl2[1] | wordr2[1];
432     w2[2] = wordl2[2] | wordr2[2];
433     w2[3] = wordl2[3] | wordr2[3];
434     w3[0] = wordl3[0] | wordr3[0];
435     w3[1] = wordl3[1] | wordr3[1];
436     w3[2] = wordl3[2] | wordr3[2];
437     w3[3] = wordl3[3] | wordr3[3];
438
439     /**
440      * append salt
441      */
442
443     u32x s0[4];
444     u32x s1[4];
445     u32x s2[4];
446     u32x s3[4];
447
448     s0[0] = salt_buf0[0];
449     s0[1] = salt_buf0[1];
450     s0[2] = salt_buf0[2];
451     s0[3] = salt_buf0[3];
452     s1[0] = salt_buf1[0];
453     s1[1] = salt_buf1[1];
454     s1[2] = salt_buf1[2];
455     s1[3] = salt_buf1[3];
456     s2[0] = salt_buf2[0];
457     s2[1] = salt_buf2[1];
458     s2[2] = salt_buf2[2];
459     s2[3] = salt_buf2[3];
460     s3[0] = salt_buf3[0];
461     s3[1] = salt_buf3[1];
462     s3[2] = salt_buf3[2];
463     s3[3] = salt_buf3[3];
464
465     switch_buffer_by_offset_le_VV (s0, s1, s2, s3, pw_len);
466
467     w0[0] |= s0[0];
468     w0[1] |= s0[1];
469     w0[2] |= s0[2];
470     w0[3] |= s0[3];
471     w1[0] |= s1[0];
472     w1[1] |= s1[1];
473     w1[2] |= s1[2];
474     w1[3] |= s1[3];
475     w2[0] |= s2[0];
476     w2[1] |= s2[1];
477     w2[2] |= s2[2];
478     w2[3] |= s2[3];
479     w3[0] |= s3[0];
480     w3[1] |= s3[1];
481     w3[2] |= s3[2];
482     w3[3] |= s3[3];
483
484     /**
485      * md5
486      */
487
488     w1[0] = 0x80;
489     w1[1] = 0;
490     w1[2] = 0;
491     w1[3] = 0;
492     w2[0] = 0;
493     w2[1] = 0;
494     w2[2] = 0;
495     w2[3] = 0;
496     w3[0] = 0;
497     w3[1] = 0;
498     w3[2] = 16 * 8;
499     w3[3] = 0;
500
501     u32x a = MD5M_A;
502     u32x b = MD5M_B;
503     u32x c = MD5M_C;
504     u32x d = MD5M_D;
505
506     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
507     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
508     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
509     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
510     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
511     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
512     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
513     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
514     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
515     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
516     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
517     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
518     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
519     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
520     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
521     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
522
523     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
524     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
525     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
526     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
527     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
528     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
529     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
530     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
531     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
532     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
533     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
534     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
535     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
536     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
537     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
538     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
539
540     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
541     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
542     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
543     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
544     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
545     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
546     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
547     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
548     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
549     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
550     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
551     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
552     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
553     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
554     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
555     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
556
557     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
558     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
559     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
560     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
561     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
562     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
563     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
564     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
565     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
566     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
567     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
568     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
569     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
570
571     if (MATCHES_NONE_VS ((a & 0x00ffffff), search[0])) continue;
572
573     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
574     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
575     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
576
577     a &= 0x00ffffff;
578     d &= 0x00ffffff;
579     c &= 0x00ffffff;
580     b &= 0x00ffffff;
581
582     COMPARE_S_SIMD (a, d, c, b);
583   }
584 }
585
586 __kernel void m02410_s08 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
587 {
588 }
589
590 __kernel void m02410_s16 (__global pw_t *pws, __global kernel_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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
591 {
592 }