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