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