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