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