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