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