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