Zero pws_buf before reuse
[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 #define NEW_SIMD_CODE
9
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
12
13 #define DGST_R0 0
14 #define DGST_R1 3
15 #define DGST_R2 2
16 #define DGST_R3 1
17
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "OpenCL/simd.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 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 pws0[4] = { 0 };
40   u32 pws1[4] = { 0 };
41
42   pws0[0] = pws[gid].i[0];
43   pws0[1] = pws[gid].i[1];
44   pws0[2] = pws[gid].i[2];
45   pws0[3] = pws[gid].i[3];
46   pws1[0] = pws[gid].i[4];
47   pws1[1] = pws[gid].i[5];
48   pws1[2] = pws[gid].i[6];
49   pws1[3] = pws[gid].i[7];
50
51   const u32 pw_l_len = pws[gid].pw_len;
52
53   /**
54    * salt
55    */
56
57   u32 salt_buf0[4];
58
59   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
60   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
61   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
62   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
63
64   u32 salt_buf1[4];
65
66   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
67   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
68   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
69   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
70
71   u32 salt_buf2[4];
72
73   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
74   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
75   salt_buf2[2] = 0;
76   salt_buf2[3] = 0;
77
78   const u32 salt_len = salt_bufs[salt_pos].salt_len;
79
80   /**
81    * loop
82    */
83
84   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
85   {
86     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
87
88     const u32x pw_len = pw_l_len + pw_r_len;
89
90     u32x wordr0[4] = { 0 };
91     u32x wordr1[4] = { 0 };
92     u32x wordr2[4] = { 0 };
93     u32x wordr3[4] = { 0 };
94
95     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
96     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
97     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
98     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
99     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
100     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
101     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
102     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
103
104     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
105     {
106       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
107     }
108
109     u32x w0[4];
110
111     w0[0] = wordl0[0] | wordr0[0];
112     w0[1] = wordl0[1] | wordr0[1];
113     w0[2] = wordl0[2] | wordr0[2];
114     w0[3] = wordl0[3] | wordr0[3];
115
116     u32x w1[4];
117
118     w1[0] = wordl1[0] | wordr1[0];
119     w1[1] = wordl1[1] | wordr1[1];
120     w1[2] = wordl1[2] | wordr1[2];
121     w1[3] = wordl1[3] | wordr1[3];
122
123     u32x w2[4];
124
125     w2[0] = 0;
126     w2[1] = 0;
127     w2[2] = 0;
128     w2[3] = 0;
129
130     u32x w3[4];
131
132     w3[0] = 0;
133     w3[1] = 0;
134     w3[2] = 0;
135     w3[3] = 0;
136
137     u32x w0_t[4];
138     u32x w1_t[4];
139     u32x w2_t[4];
140     u32x w3_t[4];
141
142     make_unicode (w0, w0_t, w1_t);
143     make_unicode (w1, w2_t, w3_t);
144
145     w3_t[2] = pw_len * 8 * 2;
146
147     u32x a = MD4M_A;
148     u32x b = MD4M_B;
149     u32x c = MD4M_C;
150     u32x d = MD4M_D;
151
152     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
153     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
154     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
155     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
156     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
157     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
158     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
159     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
160     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
161     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
162     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
163     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
164     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
165     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
166     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
167     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
168
169     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
170     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
171     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
172     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
173     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
174     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
175     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
176     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
177     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
178     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
179     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
180     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
181     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
182     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
183     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
184     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
185
186     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
187     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
188     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
189     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
190     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
191     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
192     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
193     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
194     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
195     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
196     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
197     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
198     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
199     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
200     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
201     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
202
203     a += MD4M_A;
204     b += MD4M_B;
205     c += MD4M_C;
206     d += MD4M_D;
207
208     w0_t[0] = a;
209     w0_t[1] = b;
210     w0_t[2] = c;
211     w0_t[3] = d;
212     w1_t[0] = salt_buf0[0];
213     w1_t[1] = salt_buf0[1];
214     w1_t[2] = salt_buf0[2];
215     w1_t[3] = salt_buf0[3];
216     w2_t[0] = salt_buf1[0];
217     w2_t[1] = salt_buf1[1];
218     w2_t[2] = salt_buf1[2];
219     w2_t[3] = salt_buf1[3];
220     w3_t[0] = salt_buf2[0];
221     w3_t[1] = salt_buf2[1];
222     w3_t[2] = (16 + salt_len) * 8;
223     w3_t[3] = 0;
224
225     a = MD4M_A;
226     b = MD4M_B;
227     c = MD4M_C;
228     d = MD4M_D;
229
230     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
231     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
232     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
233     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
234     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
235     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
236     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
237     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
238     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
239     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
240     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
241     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
242     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
243     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
244     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
245     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
246
247     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
248     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
249     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
250     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
251     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
252     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
253     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
254     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
255     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
256     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
257     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
258     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
259     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
260     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
261     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
262     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
263
264     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
265     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
266     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
267     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
268     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
269     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
270     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
271     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
272     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
273     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
274     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
275     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
276     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
277     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
278     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
279     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
280     COMPARE_M_SIMD (a, d, c, b);
281   }
282 }
283
284 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
285 {
286 }
287
288 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
289 {
290 }
291
292 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
293 {
294   /**
295    * modifier
296    */
297
298   const u32 lid = get_local_id (0);
299
300   /**
301    * base
302    */
303
304   const u32 gid = get_global_id (0);
305
306   if (gid >= gid_max) return;
307
308   u32 pws0[4] = { 0 };
309   u32 pws1[4] = { 0 };
310
311   pws0[0] = pws[gid].i[0];
312   pws0[1] = pws[gid].i[1];
313   pws0[2] = pws[gid].i[2];
314   pws0[3] = pws[gid].i[3];
315   pws1[0] = pws[gid].i[4];
316   pws1[1] = pws[gid].i[5];
317   pws1[2] = pws[gid].i[6];
318   pws1[3] = pws[gid].i[7];
319
320   const u32 pw_l_len = pws[gid].pw_len;
321
322   /**
323    * digest
324    */
325
326   const u32 search[4] =
327   {
328     digests_buf[digests_offset].digest_buf[DGST_R0],
329     digests_buf[digests_offset].digest_buf[DGST_R1],
330     digests_buf[digests_offset].digest_buf[DGST_R2],
331     digests_buf[digests_offset].digest_buf[DGST_R3]
332   };
333
334   /**
335    * salt
336    */
337
338   u32 salt_buf0[4];
339
340   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
341   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
342   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
343   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
344
345   u32 salt_buf1[4];
346
347   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
348   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
349   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
350   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
351
352   u32 salt_buf2[4];
353
354   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
355   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
356   salt_buf2[2] = 0;
357   salt_buf2[3] = 0;
358
359   const u32 salt_len = salt_bufs[salt_pos].salt_len;
360
361   /**
362    * loop
363    */
364
365   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
366   {
367     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
368
369     const u32x pw_len = pw_l_len + pw_r_len;
370
371     u32x wordr0[4] = { 0 };
372     u32x wordr1[4] = { 0 };
373     u32x wordr2[4] = { 0 };
374     u32x wordr3[4] = { 0 };
375
376     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
377     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
378     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
379     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
380     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
381     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
382     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
383     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
384
385     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
386     {
387       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
388     }
389
390     u32x w0[4];
391
392     w0[0] = wordl0[0] | wordr0[0];
393     w0[1] = wordl0[1] | wordr0[1];
394     w0[2] = wordl0[2] | wordr0[2];
395     w0[3] = wordl0[3] | wordr0[3];
396
397     u32x w1[4];
398
399     w1[0] = wordl1[0] | wordr1[0];
400     w1[1] = wordl1[1] | wordr1[1];
401     w1[2] = wordl1[2] | wordr1[2];
402     w1[3] = wordl1[3] | wordr1[3];
403
404     u32x w2[4];
405
406     w2[0] = 0;
407     w2[1] = 0;
408     w2[2] = 0;
409     w2[3] = 0;
410
411     u32x w3[4];
412
413     w3[0] = 0;
414     w3[1] = 0;
415     w3[2] = 0;
416     w3[3] = 0;
417
418     u32x w0_t[4];
419     u32x w1_t[4];
420     u32x w2_t[4];
421     u32x w3_t[4];
422
423     make_unicode (w0, w0_t, w1_t);
424     make_unicode (w1, w2_t, w3_t);
425
426     w3_t[2] = pw_len * 8 * 2;
427
428     u32x a = MD4M_A;
429     u32x b = MD4M_B;
430     u32x c = MD4M_C;
431     u32x d = MD4M_D;
432
433     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
434     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
435     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
436     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
437     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
438     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
439     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
440     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
441     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
442     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
443     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
444     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
445     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
446     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
447     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
448     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
449
450     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
451     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
452     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
453     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
454     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
455     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
456     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
457     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
458     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
459     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
460     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
461     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
462     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
463     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
464     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
465     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
466
467     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
468     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
469     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
470     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
471     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
472     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
473     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
474     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
475     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
476     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
477     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
478     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
479     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
480     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
481     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
482     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
483
484     a += MD4M_A;
485     b += MD4M_B;
486     c += MD4M_C;
487     d += MD4M_D;
488
489     w0_t[0] = a;
490     w0_t[1] = b;
491     w0_t[2] = c;
492     w0_t[3] = d;
493     w1_t[0] = salt_buf0[0];
494     w1_t[1] = salt_buf0[1];
495     w1_t[2] = salt_buf0[2];
496     w1_t[3] = salt_buf0[3];
497     w2_t[0] = salt_buf1[0];
498     w2_t[1] = salt_buf1[1];
499     w2_t[2] = salt_buf1[2];
500     w2_t[3] = salt_buf1[3];
501     w3_t[0] = salt_buf2[0];
502     w3_t[1] = salt_buf2[1];
503     w3_t[2] = (16 + salt_len) * 8;
504     w3_t[3] = 0;
505
506     a = MD4M_A;
507     b = MD4M_B;
508     c = MD4M_C;
509     d = MD4M_D;
510
511     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
512     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
513     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
514     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
515     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
516     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
517     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
518     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
519     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
520     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
521     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
522     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
523     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
524     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
525     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
526     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
527
528     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
529     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
530     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
531     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
532     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
533     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
534     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
535     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
536     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
537     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
538     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
539     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
540     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
541     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
542     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
543     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
544
545     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
546     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
547     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
548     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
549     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
550     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
551     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
552     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
553     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
554     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
555     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
556     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
557     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
558
559     if (MATCHES_NONE_VS (a, search[0])) continue;
560
561     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
562     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
563     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
564     COMPARE_S_SIMD (a, d, c, b);
565   }
566 }
567
568 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
569 {
570 }
571
572 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
573 {
574 }