Fixed two major problems
[hashcat.git] / OpenCL / m01100_a1.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD4_
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 m01100_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 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     append_0x80_2x4 (wordl0, wordl1, pw_l_len);
72
73     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
74   }
75
76   /**
77    * salt
78    */
79
80   u32 salt_buf0[4];
81
82   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
83   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
84   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
85   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
86
87   u32 salt_buf1[4];
88
89   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
90   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
91   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
92   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
93
94   u32 salt_buf2[4];
95
96   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
97   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
98   salt_buf2[2] = 0;
99   salt_buf2[3] = 0;
100
101   const u32 salt_len = salt_bufs[salt_pos].salt_len;
102
103   /**
104    * loop
105    */
106
107   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
108   {
109     const u32 pw_r_len = combs_buf[il_pos].pw_len;
110
111     const u32 pw_len = pw_l_len + pw_r_len;
112
113     u32 wordr0[4];
114
115     wordr0[0] = combs_buf[il_pos].i[0];
116     wordr0[1] = combs_buf[il_pos].i[1];
117     wordr0[2] = combs_buf[il_pos].i[2];
118     wordr0[3] = combs_buf[il_pos].i[3];
119
120     u32 wordr1[4];
121
122     wordr1[0] = combs_buf[il_pos].i[4];
123     wordr1[1] = combs_buf[il_pos].i[5];
124     wordr1[2] = combs_buf[il_pos].i[6];
125     wordr1[3] = combs_buf[il_pos].i[7];
126
127     u32 wordr2[4];
128
129     wordr2[0] = 0;
130     wordr2[1] = 0;
131     wordr2[2] = 0;
132     wordr2[3] = 0;
133
134     u32 wordr3[4];
135
136     wordr3[0] = 0;
137     wordr3[1] = 0;
138     wordr3[2] = 0;
139     wordr3[3] = 0;
140
141     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
142     {
143       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
144     }
145
146     u32 w0[4];
147
148     w0[0] = wordl0[0] | wordr0[0];
149     w0[1] = wordl0[1] | wordr0[1];
150     w0[2] = wordl0[2] | wordr0[2];
151     w0[3] = wordl0[3] | wordr0[3];
152
153     u32 w1[4];
154
155     w1[0] = wordl1[0] | wordr1[0];
156     w1[1] = wordl1[1] | wordr1[1];
157     w1[2] = wordl1[2] | wordr1[2];
158     w1[3] = wordl1[3] | wordr1[3];
159
160     u32 w2[4];
161
162     w2[0] = 0;
163     w2[1] = 0;
164     w2[2] = 0;
165     w2[3] = 0;
166
167     u32 w3[4];
168
169     w3[0] = 0;
170     w3[1] = 0;
171     w3[2] = 0;
172     w3[3] = 0;
173
174     u32 w0_t[4];
175     u32 w1_t[4];
176     u32 w2_t[4];
177     u32 w3_t[4];
178
179     make_unicode (w0, w0_t, w1_t);
180     make_unicode (w1, w2_t, w3_t);
181
182     w3_t[2] = pw_len * 8 * 2;
183
184     u32 a = MD4M_A;
185     u32 b = MD4M_B;
186     u32 c = MD4M_C;
187     u32 d = MD4M_D;
188
189     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
190     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
191     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
192     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
193     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
194     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
195     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
196     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
197     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
198     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
199     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
200     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
201     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
202     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
203     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
204     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
205
206     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
207     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
208     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
209     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
210     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
211     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
212     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
213     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
214     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
215     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
216     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
217     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
218     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
219     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
220     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
221     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
222
223     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
224     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
225     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
226     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
227     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
228     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
229     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
230     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
231     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
232     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
233     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
234     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
235     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
236     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
237     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
238     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
239
240     a += MD4M_A;
241     b += MD4M_B;
242     c += MD4M_C;
243     d += MD4M_D;
244
245     w0_t[0] = a;
246     w0_t[1] = b;
247     w0_t[2] = c;
248     w0_t[3] = d;
249     w1_t[0] = salt_buf0[0];
250     w1_t[1] = salt_buf0[1];
251     w1_t[2] = salt_buf0[2];
252     w1_t[3] = salt_buf0[3];
253     w2_t[0] = salt_buf1[0];
254     w2_t[1] = salt_buf1[1];
255     w2_t[2] = salt_buf1[2];
256     w2_t[3] = salt_buf1[3];
257     w3_t[0] = salt_buf2[0];
258     w3_t[1] = salt_buf2[1];
259     w3_t[2] = (16 + salt_len) * 8;
260     w3_t[3] = 0;
261
262     a = MD4M_A;
263     b = MD4M_B;
264     c = MD4M_C;
265     d = MD4M_D;
266
267     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
268     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
269     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
270     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
271     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
272     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
273     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
274     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
275     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
276     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
277     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
278     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
279     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
280     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
281     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
282     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
283
284     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
285     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
286     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
287     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
288     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
289     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
290     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
291     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
292     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
293     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
294     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
295     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
296     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
297     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
298     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
299     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
300
301     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
302     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
303     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
304     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
305     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
306     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
307     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
308     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
309     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
310     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
311     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
312     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
313     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
314     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
315     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
316     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
317
318     const u32 r0 = a;
319     const u32 r1 = d;
320     const u32 r2 = c;
321     const u32 r3 = b;
322
323     #include COMPARE_M
324   }
325 }
326
327 __kernel void m01100_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)
328 {
329 }
330
331 __kernel void m01100_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)
332 {
333 }
334
335 __kernel void m01100_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)
336 {
337   /**
338    * modifier
339    */
340
341   const u32 lid = get_local_id (0);
342
343   /**
344    * base
345    */
346
347   const u32 gid = get_global_id (0);
348
349   if (gid >= gid_max) return;
350
351   u32 wordl0[4];
352
353   wordl0[0] = pws[gid].i[ 0];
354   wordl0[1] = pws[gid].i[ 1];
355   wordl0[2] = pws[gid].i[ 2];
356   wordl0[3] = pws[gid].i[ 3];
357
358   u32 wordl1[4];
359
360   wordl1[0] = pws[gid].i[ 4];
361   wordl1[1] = pws[gid].i[ 5];
362   wordl1[2] = pws[gid].i[ 6];
363   wordl1[3] = pws[gid].i[ 7];
364
365   u32 wordl2[4];
366
367   wordl2[0] = 0;
368   wordl2[1] = 0;
369   wordl2[2] = 0;
370   wordl2[3] = 0;
371
372   u32 wordl3[4];
373
374   wordl3[0] = 0;
375   wordl3[1] = 0;
376   wordl3[2] = 0;
377   wordl3[3] = 0;
378
379   const u32 pw_l_len = pws[gid].pw_len;
380
381   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
382   {
383     append_0x80_2x4 (wordl0, wordl1, pw_l_len);
384
385     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
386   }
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    * salt
402    */
403
404   u32 salt_buf0[4];
405
406   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
407   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
408   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
409   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
410
411   u32 salt_buf1[4];
412
413   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
414   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
415   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
416   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
417
418   u32 salt_buf2[4];
419
420   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
421   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
422   salt_buf2[2] = 0;
423   salt_buf2[3] = 0;
424
425   const u32 salt_len = salt_bufs[salt_pos].salt_len;
426
427   /**
428    * loop
429    */
430
431   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
432   {
433     const u32 pw_r_len = combs_buf[il_pos].pw_len;
434
435     const u32 pw_len = pw_l_len + pw_r_len;
436
437     u32 wordr0[4];
438
439     wordr0[0] = combs_buf[il_pos].i[0];
440     wordr0[1] = combs_buf[il_pos].i[1];
441     wordr0[2] = combs_buf[il_pos].i[2];
442     wordr0[3] = combs_buf[il_pos].i[3];
443
444     u32 wordr1[4];
445
446     wordr1[0] = combs_buf[il_pos].i[4];
447     wordr1[1] = combs_buf[il_pos].i[5];
448     wordr1[2] = combs_buf[il_pos].i[6];
449     wordr1[3] = combs_buf[il_pos].i[7];
450
451     u32 wordr2[4];
452
453     wordr2[0] = 0;
454     wordr2[1] = 0;
455     wordr2[2] = 0;
456     wordr2[3] = 0;
457
458     u32 wordr3[4];
459
460     wordr3[0] = 0;
461     wordr3[1] = 0;
462     wordr3[2] = 0;
463     wordr3[3] = 0;
464
465     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
466     {
467       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
468     }
469
470     u32 w0[4];
471
472     w0[0] = wordl0[0] | wordr0[0];
473     w0[1] = wordl0[1] | wordr0[1];
474     w0[2] = wordl0[2] | wordr0[2];
475     w0[3] = wordl0[3] | wordr0[3];
476
477     u32 w1[4];
478
479     w1[0] = wordl1[0] | wordr1[0];
480     w1[1] = wordl1[1] | wordr1[1];
481     w1[2] = wordl1[2] | wordr1[2];
482     w1[3] = wordl1[3] | wordr1[3];
483
484     u32 w2[4];
485
486     w2[0] = 0;
487     w2[1] = 0;
488     w2[2] = 0;
489     w2[3] = 0;
490
491     u32 w3[4];
492
493     w3[0] = 0;
494     w3[1] = 0;
495     w3[2] = 0;
496     w3[3] = 0;
497
498     u32 w0_t[4];
499     u32 w1_t[4];
500     u32 w2_t[4];
501     u32 w3_t[4];
502
503     make_unicode (w0, w0_t, w1_t);
504     make_unicode (w1, w2_t, w3_t);
505
506     w3_t[2] = pw_len * 8 * 2;
507
508     u32 a = MD4M_A;
509     u32 b = MD4M_B;
510     u32 c = MD4M_C;
511     u32 d = MD4M_D;
512
513     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
514     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
515     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
516     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
517     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
518     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
519     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
520     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
521     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
522     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
523     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
524     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
525     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
526     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
527     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
528     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
529
530     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
531     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
532     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
533     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
534     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
535     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
536     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
537     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
538     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
539     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
540     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
541     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
542     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
543     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
544     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
545     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
546
547     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
548     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
549     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
550     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
551     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
552     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
553     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
554     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
555     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
556     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
557     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
558     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
559     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
560     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
561     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
562     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
563
564     a += MD4M_A;
565     b += MD4M_B;
566     c += MD4M_C;
567     d += MD4M_D;
568
569     w0_t[0] = a;
570     w0_t[1] = b;
571     w0_t[2] = c;
572     w0_t[3] = d;
573     w1_t[0] = salt_buf0[0];
574     w1_t[1] = salt_buf0[1];
575     w1_t[2] = salt_buf0[2];
576     w1_t[3] = salt_buf0[3];
577     w2_t[0] = salt_buf1[0];
578     w2_t[1] = salt_buf1[1];
579     w2_t[2] = salt_buf1[2];
580     w2_t[3] = salt_buf1[3];
581     w3_t[0] = salt_buf2[0];
582     w3_t[1] = salt_buf2[1];
583     w3_t[2] = (16 + salt_len) * 8;
584     w3_t[3] = 0;
585
586     a = MD4M_A;
587     b = MD4M_B;
588     c = MD4M_C;
589     d = MD4M_D;
590
591     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
592     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
593     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
594     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
595     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
596     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
597     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
598     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
599     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
600     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
601     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
602     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
603     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
604     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
605     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
606     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
607
608     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
609     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
610     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
611     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
612     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
613     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
614     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
615     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
616     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
617     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
618     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
619     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
620     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
621     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
622     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
623     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
624
625     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
626     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
627     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
628     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
629     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
630     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
631     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
632     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
633     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
634     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
635     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
636     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
637     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
638
639     bool q_cond = allx (search[0] != a);
640
641     if (q_cond) continue;
642
643     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
644     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
645     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
646
647     const u32 r0 = a;
648     const u32 r1 = d;
649     const u32 r2 = c;
650     const u32 r3 = b;
651
652     #include COMPARE_S
653   }
654 }
655
656 __kernel void m01100_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)
657 {
658 }
659
660 __kernel void m01100_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)
661 {
662 }