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