Merge pull request #241 from philsmd/master
[hashcat.git] / OpenCL / m03800_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 m03800_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 il_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 gid = get_global_id (0);
30   const u32 lid = get_local_id (0);
31   const u32 lsz = get_local_size (0);
32
33   /**
34    * base
35    */
36
37   u32 wordl0[4];
38
39   wordl0[0] = pws[gid].i[ 0];
40   wordl0[1] = pws[gid].i[ 1];
41   wordl0[2] = pws[gid].i[ 2];
42   wordl0[3] = pws[gid].i[ 3];
43
44   u32 wordl1[4];
45
46   wordl1[0] = pws[gid].i[ 4];
47   wordl1[1] = pws[gid].i[ 5];
48   wordl1[2] = pws[gid].i[ 6];
49   wordl1[3] = pws[gid].i[ 7];
50
51   u32 wordl2[4];
52
53   wordl2[0] = 0;
54   wordl2[1] = 0;
55   wordl2[2] = 0;
56   wordl2[3] = 0;
57
58   u32 wordl3[4];
59
60   wordl3[0] = 0;
61   wordl3[1] = 0;
62   wordl3[2] = 0;
63   wordl3[3] = 0;
64
65   const u32 pw_l_len = pws[gid].pw_len;
66
67   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
68   {
69     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
70   }
71
72   /**
73    * salt
74    */
75
76   u32 salt_buf0[4];
77
78   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
79   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
80   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
81   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
82
83   u32 salt_buf1[4];
84
85   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
86   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
87   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
88   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
89
90   u32 salt_buf2[4];
91
92   salt_buf2[0] = 0;
93   salt_buf2[1] = 0;
94   salt_buf2[2] = 0;
95   salt_buf2[3] = 0;
96
97   u32 salt_buf3[4];
98
99   salt_buf3[0] = 0;
100   salt_buf3[1] = 0;
101   salt_buf3[2] = 0;
102   salt_buf3[3] = 0;
103
104   const u32 salt_len = salt_bufs[salt_pos].salt_len;
105
106   /**
107    * loop
108    */
109
110   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
111   {
112     const u32 pw_r_len = combs_buf[il_pos].pw_len;
113
114     const u32 pw_len = pw_l_len + pw_r_len;
115
116     u32 wordr0[4];
117
118     wordr0[0] = combs_buf[il_pos].i[0];
119     wordr0[1] = combs_buf[il_pos].i[1];
120     wordr0[2] = combs_buf[il_pos].i[2];
121     wordr0[3] = combs_buf[il_pos].i[3];
122
123     u32 wordr1[4];
124
125     wordr1[0] = combs_buf[il_pos].i[4];
126     wordr1[1] = combs_buf[il_pos].i[5];
127     wordr1[2] = combs_buf[il_pos].i[6];
128     wordr1[3] = combs_buf[il_pos].i[7];
129
130     u32 wordr2[4];
131
132     wordr2[0] = 0;
133     wordr2[1] = 0;
134     wordr2[2] = 0;
135     wordr2[3] = 0;
136
137     u32 wordr3[4];
138
139     wordr3[0] = 0;
140     wordr3[1] = 0;
141     wordr3[2] = 0;
142     wordr3[3] = 0;
143
144     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
145     {
146       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
147     }
148
149     u32 w0[4];
150
151     w0[0] = wordl0[0] | wordr0[0];
152     w0[1] = wordl0[1] | wordr0[1];
153     w0[2] = wordl0[2] | wordr0[2];
154     w0[3] = wordl0[3] | wordr0[3];
155
156     u32 w1[4];
157
158     w1[0] = wordl1[0] | wordr1[0];
159     w1[1] = wordl1[1] | wordr1[1];
160     w1[2] = wordl1[2] | wordr1[2];
161     w1[3] = wordl1[3] | wordr1[3];
162
163     u32 w2[4];
164
165     w2[0] = wordl2[0] | wordr2[0];
166     w2[1] = wordl2[1] | wordr2[1];
167     w2[2] = wordl2[2] | wordr2[2];
168     w2[3] = wordl2[3] | wordr2[3];
169
170     u32 w3[4];
171
172     w3[0] = wordl3[0] | wordr3[0];
173     w3[1] = wordl3[1] | wordr3[1];
174     w3[2] = 0;
175     w3[3] = 0;
176
177     /**
178      * prepend salt
179      */
180
181     u32 w0_t[4];
182
183     w0_t[0] = w0[0];
184     w0_t[1] = w0[1];
185     w0_t[2] = w0[2];
186     w0_t[3] = w0[3];
187
188     u32 w1_t[4];
189
190     w1_t[0] = w1[0];
191     w1_t[1] = w1[1];
192     w1_t[2] = w1[2];
193     w1_t[3] = w1[3];
194
195     u32 w2_t[4];
196
197     w2_t[0] = w2[0];
198     w2_t[1] = w2[1];
199     w2_t[2] = w2[2];
200     w2_t[3] = w2[3];
201
202     u32 w3_t[4];
203
204     w3_t[0] = w3[0];
205     w3_t[1] = w3[1];
206     w3_t[2] = w3[2];
207     w3_t[3] = w3[3];
208
209     switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
210
211     w0_t[0] |= salt_buf0[0];
212     w0_t[1] |= salt_buf0[1];
213     w0_t[2] |= salt_buf0[2];
214     w0_t[3] |= salt_buf0[3];
215     w1_t[0] |= salt_buf1[0];
216     w1_t[1] |= salt_buf1[1];
217     w1_t[2] |= salt_buf1[2];
218     w1_t[3] |= salt_buf1[3];
219     w2_t[0] |= salt_buf2[0];
220     w2_t[1] |= salt_buf2[1];
221     w2_t[2] |= salt_buf2[2];
222     w2_t[3] |= salt_buf2[3];
223     w3_t[0] |= salt_buf3[0];
224     w3_t[1] |= salt_buf3[1];
225     w3_t[2] |= salt_buf3[2];
226     w3_t[3] |= salt_buf3[3];
227
228     /**
229      * append salt
230      */
231
232     u32 s0[4];
233
234     s0[0] = salt_buf0[0];
235     s0[1] = salt_buf0[1];
236     s0[2] = salt_buf0[2];
237     s0[3] = salt_buf0[3];
238
239     u32 s1[4];
240
241     s1[0] = salt_buf1[0];
242     s1[1] = salt_buf1[1];
243     s1[2] = salt_buf1[2];
244     s1[3] = salt_buf1[3];
245
246     u32 s2[4];
247
248     s2[0] = 0;
249     s2[1] = 0;
250     s2[2] = 0;
251     s2[3] = 0;
252
253     u32 s3[4];
254
255     s3[0] = 0;
256     s3[1] = 0;
257     s3[2] = 0;
258     s3[3] = 0;
259
260     switch_buffer_by_offset_le (s0, s1, s2, s3, salt_len + pw_len);
261
262     w0_t[0] |= s0[0];
263     w0_t[1] |= s0[1];
264     w0_t[2] |= s0[2];
265     w0_t[3] |= s0[3];
266     w1_t[0] |= s1[0];
267     w1_t[1] |= s1[1];
268     w1_t[2] |= s1[2];
269     w1_t[3] |= s1[3];
270     w2_t[0] |= s2[0];
271     w2_t[1] |= s2[1];
272     w2_t[2] |= s2[2];
273     w2_t[3] |= s2[3];
274     w3_t[0] |= s3[0];
275     w3_t[1] |= s3[1];
276     w3_t[2] |= s3[2];
277     w3_t[3] |= s3[3];
278
279     const u32 pw_salt_len = salt_len + pw_len + salt_len;
280
281     append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
282
283     w3_t[2] = pw_salt_len * 8;
284
285     /**
286      * md5
287      */
288
289     u32 a = MD5M_A;
290     u32 b = MD5M_B;
291     u32 c = MD5M_C;
292     u32 d = MD5M_D;
293
294     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
295     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
296     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
297     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
298     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
299     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
300     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
301     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
302     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
303     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
304     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
305     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
306     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
307     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
308     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
309     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
310
311     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
312     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
313     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
314     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
315     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
316     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
317     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
318     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
319     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
320     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
321     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
322     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
323     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
324     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
325     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
326     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
327
328     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
329     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
330     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
331     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
332     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
333     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
334     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
335     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
336     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
337     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
338     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
339     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
340     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
341     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
342     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
343     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
344
345     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
346     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
347     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
348     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
349     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
350     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
351     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
352     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
353     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
354     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
355     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
356     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
357     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
358
359     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
360     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
361     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
362
363     const u32 r0 = a;
364     const u32 r1 = d;
365     const u32 r2 = c;
366     const u32 r3 = b;
367
368     #include COMPARE_M
369   }
370 }
371
372 __kernel void m03800_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
373 {
374 }
375
376 __kernel void m03800_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
377 {
378 }
379
380 __kernel void m03800_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
381 {
382   /**
383    * modifier
384    */
385
386   const u32 gid = get_global_id (0);
387   const u32 lid = get_local_id (0);
388   const u32 lsz = get_local_size (0);
389
390   /**
391    * base
392    */
393
394   u32 wordl0[4];
395
396   wordl0[0] = pws[gid].i[ 0];
397   wordl0[1] = pws[gid].i[ 1];
398   wordl0[2] = pws[gid].i[ 2];
399   wordl0[3] = pws[gid].i[ 3];
400
401   u32 wordl1[4];
402
403   wordl1[0] = pws[gid].i[ 4];
404   wordl1[1] = pws[gid].i[ 5];
405   wordl1[2] = pws[gid].i[ 6];
406   wordl1[3] = pws[gid].i[ 7];
407
408   u32 wordl2[4];
409
410   wordl2[0] = 0;
411   wordl2[1] = 0;
412   wordl2[2] = 0;
413   wordl2[3] = 0;
414
415   u32 wordl3[4];
416
417   wordl3[0] = 0;
418   wordl3[1] = 0;
419   wordl3[2] = 0;
420   wordl3[3] = 0;
421
422   const u32 pw_l_len = pws[gid].pw_len;
423
424   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
425   {
426     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
427   }
428
429   /**
430    * salt
431    */
432
433   u32 salt_buf0[4];
434
435   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
436   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
437   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
438   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
439
440   u32 salt_buf1[4];
441
442   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
443   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
444   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
445   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
446
447   u32 salt_buf2[4];
448
449   salt_buf2[0] = 0;
450   salt_buf2[1] = 0;
451   salt_buf2[2] = 0;
452   salt_buf2[3] = 0;
453
454   u32 salt_buf3[4];
455
456   salt_buf3[0] = 0;
457   salt_buf3[1] = 0;
458   salt_buf3[2] = 0;
459   salt_buf3[3] = 0;
460
461   const u32 salt_len = salt_bufs[salt_pos].salt_len;
462
463   /**
464    * digest
465    */
466
467   const u32 search[4] =
468   {
469     digests_buf[digests_offset].digest_buf[DGST_R0],
470     digests_buf[digests_offset].digest_buf[DGST_R1],
471     digests_buf[digests_offset].digest_buf[DGST_R2],
472     digests_buf[digests_offset].digest_buf[DGST_R3]
473   };
474
475   /**
476    * loop
477    */
478
479   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
480   {
481     const u32 pw_r_len = combs_buf[il_pos].pw_len;
482
483     const u32 pw_len = pw_l_len + pw_r_len;
484
485     u32 wordr0[4];
486
487     wordr0[0] = combs_buf[il_pos].i[0];
488     wordr0[1] = combs_buf[il_pos].i[1];
489     wordr0[2] = combs_buf[il_pos].i[2];
490     wordr0[3] = combs_buf[il_pos].i[3];
491
492     u32 wordr1[4];
493
494     wordr1[0] = combs_buf[il_pos].i[4];
495     wordr1[1] = combs_buf[il_pos].i[5];
496     wordr1[2] = combs_buf[il_pos].i[6];
497     wordr1[3] = combs_buf[il_pos].i[7];
498
499     u32 wordr2[4];
500
501     wordr2[0] = 0;
502     wordr2[1] = 0;
503     wordr2[2] = 0;
504     wordr2[3] = 0;
505
506     u32 wordr3[4];
507
508     wordr3[0] = 0;
509     wordr3[1] = 0;
510     wordr3[2] = 0;
511     wordr3[3] = 0;
512
513     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
514     {
515       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
516     }
517
518     u32 w0[4];
519
520     w0[0] = wordl0[0] | wordr0[0];
521     w0[1] = wordl0[1] | wordr0[1];
522     w0[2] = wordl0[2] | wordr0[2];
523     w0[3] = wordl0[3] | wordr0[3];
524
525     u32 w1[4];
526
527     w1[0] = wordl1[0] | wordr1[0];
528     w1[1] = wordl1[1] | wordr1[1];
529     w1[2] = wordl1[2] | wordr1[2];
530     w1[3] = wordl1[3] | wordr1[3];
531
532     u32 w2[4];
533
534     w2[0] = wordl2[0] | wordr2[0];
535     w2[1] = wordl2[1] | wordr2[1];
536     w2[2] = wordl2[2] | wordr2[2];
537     w2[3] = wordl2[3] | wordr2[3];
538
539     u32 w3[4];
540
541     w3[0] = wordl3[0] | wordr3[0];
542     w3[1] = wordl3[1] | wordr3[1];
543     w3[2] = 0;
544     w3[3] = 0;
545
546     /**
547      * prepend salt
548      */
549
550     u32 w0_t[4];
551
552     w0_t[0] = w0[0];
553     w0_t[1] = w0[1];
554     w0_t[2] = w0[2];
555     w0_t[3] = w0[3];
556
557     u32 w1_t[4];
558
559     w1_t[0] = w1[0];
560     w1_t[1] = w1[1];
561     w1_t[2] = w1[2];
562     w1_t[3] = w1[3];
563
564     u32 w2_t[4];
565
566     w2_t[0] = w2[0];
567     w2_t[1] = w2[1];
568     w2_t[2] = w2[2];
569     w2_t[3] = w2[3];
570
571     u32 w3_t[4];
572
573     w3_t[0] = w3[0];
574     w3_t[1] = w3[1];
575     w3_t[2] = w3[2];
576     w3_t[3] = w3[3];
577
578     switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
579
580     w0_t[0] |= salt_buf0[0];
581     w0_t[1] |= salt_buf0[1];
582     w0_t[2] |= salt_buf0[2];
583     w0_t[3] |= salt_buf0[3];
584     w1_t[0] |= salt_buf1[0];
585     w1_t[1] |= salt_buf1[1];
586     w1_t[2] |= salt_buf1[2];
587     w1_t[3] |= salt_buf1[3];
588     w2_t[0] |= salt_buf2[0];
589     w2_t[1] |= salt_buf2[1];
590     w2_t[2] |= salt_buf2[2];
591     w2_t[3] |= salt_buf2[3];
592     w3_t[0] |= salt_buf3[0];
593     w3_t[1] |= salt_buf3[1];
594     w3_t[2] |= salt_buf3[2];
595     w3_t[3] |= salt_buf3[3];
596
597     /**
598      * append salt
599      */
600
601     u32 s0[4];
602
603     s0[0] = salt_buf0[0];
604     s0[1] = salt_buf0[1];
605     s0[2] = salt_buf0[2];
606     s0[3] = salt_buf0[3];
607
608     u32 s1[4];
609
610     s1[0] = salt_buf1[0];
611     s1[1] = salt_buf1[1];
612     s1[2] = salt_buf1[2];
613     s1[3] = salt_buf1[3];
614
615     u32 s2[4];
616
617     s2[0] = 0;
618     s2[1] = 0;
619     s2[2] = 0;
620     s2[3] = 0;
621
622     u32 s3[4];
623
624     s3[0] = 0;
625     s3[1] = 0;
626     s3[2] = 0;
627     s3[3] = 0;
628
629     switch_buffer_by_offset_le (s0, s1, s2, s3, salt_len + pw_len);
630
631     w0_t[0] |= s0[0];
632     w0_t[1] |= s0[1];
633     w0_t[2] |= s0[2];
634     w0_t[3] |= s0[3];
635     w1_t[0] |= s1[0];
636     w1_t[1] |= s1[1];
637     w1_t[2] |= s1[2];
638     w1_t[3] |= s1[3];
639     w2_t[0] |= s2[0];
640     w2_t[1] |= s2[1];
641     w2_t[2] |= s2[2];
642     w2_t[3] |= s2[3];
643     w3_t[0] |= s3[0];
644     w3_t[1] |= s3[1];
645     w3_t[2] |= s3[2];
646     w3_t[3] |= s3[3];
647
648     const u32 pw_salt_len = salt_len + pw_len + salt_len;
649
650     append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
651
652     w3_t[2] = pw_salt_len * 8;
653
654     /**
655      * md5
656      */
657
658     u32 a = MD5M_A;
659     u32 b = MD5M_B;
660     u32 c = MD5M_C;
661     u32 d = MD5M_D;
662
663     MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
664     MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
665     MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
666     MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
667     MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
668     MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
669     MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
670     MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
671     MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
672     MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
673     MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
674     MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
675     MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
676     MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
677     MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
678     MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
679
680     MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
681     MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
682     MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
683     MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
684     MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
685     MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
686     MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
687     MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
688     MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
689     MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
690     MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
691     MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
692     MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
693     MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
694     MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
695     MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
696
697     MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
698     MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
699     MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
700     MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
701     MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
702     MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
703     MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
704     MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
705     MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
706     MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
707     MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
708     MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
709     MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
710     MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
711     MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
712     MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
713
714     MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
715     MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
716     MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
717     MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
718     MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
719     MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
720     MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
721     MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
722     MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
723     MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
724     MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
725     MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
726     MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
727     MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
728     MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
729     MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
730
731     const u32 r0 = a;
732     const u32 r1 = d;
733     const u32 r2 = c;
734     const u32 r3 = b;
735
736     #include COMPARE_S
737   }
738 }
739
740 __kernel void m03800_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
741 {
742 }
743
744 __kernel void m03800_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
745 {
746 }