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