Initial commit
[hashcat.git] / amd / m01100_a1.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
32 #ifdef  VECT_SIZE1
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
35 #endif
36
37 #ifdef  VECT_SIZE2
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
40 #endif
41
42 #ifdef  VECT_SIZE4
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
45 #endif
46
47 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
48 {
49   /**
50    * modifier
51    */
52
53   const u32 lid = get_local_id (0);
54
55   /**
56    * base
57    */
58
59   const u32 gid = get_global_id (0);
60
61   if (gid >= gid_max) return;
62
63   u32x wordl0[4];
64
65   wordl0[0] = pws[gid].i[ 0];
66   wordl0[1] = pws[gid].i[ 1];
67   wordl0[2] = pws[gid].i[ 2];
68   wordl0[3] = pws[gid].i[ 3];
69
70   u32x wordl1[4];
71
72   wordl1[0] = pws[gid].i[ 4];
73   wordl1[1] = pws[gid].i[ 5];
74   wordl1[2] = pws[gid].i[ 6];
75   wordl1[3] = pws[gid].i[ 7];
76
77   u32x wordl2[4];
78
79   wordl2[0] = 0;
80   wordl2[1] = 0;
81   wordl2[2] = 0;
82   wordl2[3] = 0;
83
84   u32x wordl3[4];
85
86   wordl3[0] = 0;
87   wordl3[1] = 0;
88   wordl3[2] = 0;
89   wordl3[3] = 0;
90
91   const u32 pw_l_len = pws[gid].pw_len;
92
93   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
94   {
95     append_0x80_2 (wordl0, wordl1, pw_l_len);
96
97     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
98   }
99
100   /**
101    * salt
102    */
103
104   u32 salt_buf0[4];
105
106   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
107   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
108   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
109   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
110
111   u32 salt_buf1[4];
112
113   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
114   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
115   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
116   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
117
118   u32 salt_buf2[4];
119
120   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
121   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
122   salt_buf2[2] = 0;
123   salt_buf2[3] = 0;
124
125   const u32 salt_len = salt_bufs[salt_pos].salt_len;
126
127   /**
128    * loop
129    */
130
131   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
132   {
133     const u32 pw_r_len = combs_buf[il_pos].pw_len;
134
135     const u32 pw_len = pw_l_len + pw_r_len;
136
137     u32 wordr0[4];
138
139     wordr0[0] = combs_buf[il_pos].i[0];
140     wordr0[1] = combs_buf[il_pos].i[1];
141     wordr0[2] = combs_buf[il_pos].i[2];
142     wordr0[3] = combs_buf[il_pos].i[3];
143
144     u32 wordr1[4];
145
146     wordr1[0] = combs_buf[il_pos].i[4];
147     wordr1[1] = combs_buf[il_pos].i[5];
148     wordr1[2] = combs_buf[il_pos].i[6];
149     wordr1[3] = combs_buf[il_pos].i[7];
150
151     u32 wordr2[4];
152
153     wordr2[0] = 0;
154     wordr2[1] = 0;
155     wordr2[2] = 0;
156     wordr2[3] = 0;
157
158     u32 wordr3[4];
159
160     wordr3[0] = 0;
161     wordr3[1] = 0;
162     wordr3[2] = 0;
163     wordr3[3] = 0;
164
165     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
166     {
167       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
168     }
169
170     u32x w0[4];
171
172     w0[0] = wordl0[0] | wordr0[0];
173     w0[1] = wordl0[1] | wordr0[1];
174     w0[2] = wordl0[2] | wordr0[2];
175     w0[3] = wordl0[3] | wordr0[3];
176
177     u32x w1[4];
178
179     w1[0] = wordl1[0] | wordr1[0];
180     w1[1] = wordl1[1] | wordr1[1];
181     w1[2] = wordl1[2] | wordr1[2];
182     w1[3] = wordl1[3] | wordr1[3];
183
184     u32x w2[4];
185
186     w2[0] = 0;
187     w2[1] = 0;
188     w2[2] = 0;
189     w2[3] = 0;
190
191     u32x w3[4];
192
193     w3[0] = 0;
194     w3[1] = 0;
195     w3[2] = 0;
196     w3[3] = 0;
197
198     u32x w0_t[4];
199     u32x w1_t[4];
200     u32x w2_t[4];
201     u32x w3_t[4];
202
203     make_unicode (w0, w0_t, w1_t);
204     make_unicode (w1, w2_t, w3_t);
205
206     w3_t[2] = pw_len * 8 * 2;
207
208     u32x a = MD4M_A;
209     u32x b = MD4M_B;
210     u32x c = MD4M_C;
211     u32x d = MD4M_D;
212
213     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
214     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
215     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
216     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
217     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
218     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
219     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
220     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
221     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
222     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
223     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
224     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
225     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
226     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
227     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
228     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
229
230     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
231     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
232     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
233     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
234     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
235     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
236     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
237     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
238     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
239     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
240     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
241     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
242     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
243     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
244     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
245     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
246
247     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
248     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
249     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
250     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
251     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
252     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
253     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
254     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
255     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
256     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
257     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
258     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
259     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
260     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
261     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
262     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
263
264     a += MD4M_A;
265     b += MD4M_B;
266     c += MD4M_C;
267     d += MD4M_D;
268
269     w0_t[0] = a;
270     w0_t[1] = b;
271     w0_t[2] = c;
272     w0_t[3] = d;
273     w1_t[0] = salt_buf0[0];
274     w1_t[1] = salt_buf0[1];
275     w1_t[2] = salt_buf0[2];
276     w1_t[3] = salt_buf0[3];
277     w2_t[0] = salt_buf1[0];
278     w2_t[1] = salt_buf1[1];
279     w2_t[2] = salt_buf1[2];
280     w2_t[3] = salt_buf1[3];
281     w3_t[0] = salt_buf2[0];
282     w3_t[1] = salt_buf2[1];
283     w3_t[2] = (16 + salt_len) * 8;
284     w3_t[3] = 0;
285
286     a = MD4M_A;
287     b = MD4M_B;
288     c = MD4M_C;
289     d = MD4M_D;
290
291     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
292     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
293     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
294     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
295     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
296     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
297     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
298     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
299     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
300     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
301     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
302     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
303     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
304     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
305     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
306     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
307
308     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
309     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
310     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
311     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
312     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
313     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
314     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
315     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
316     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
317     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
318     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
319     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
320     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
321     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
322     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
323     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
324
325     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
326     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
327     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
328     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
329     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
330     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
331     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
332     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
333     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
334     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
335     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
336     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
337     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
338     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
339     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
340     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
341
342     const u32x r0 = a;
343     const u32x r1 = d;
344     const u32x r2 = c;
345     const u32x r3 = b;
346
347     #include VECT_COMPARE_M
348   }
349 }
350
351 __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)
352 {
353 }
354
355 __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)
356 {
357 }
358
359 __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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
360 {
361   /**
362    * modifier
363    */
364
365   const u32 lid = get_local_id (0);
366
367   /**
368    * base
369    */
370
371   const u32 gid = get_global_id (0);
372
373   if (gid >= gid_max) return;
374
375   u32x wordl0[4];
376
377   wordl0[0] = pws[gid].i[ 0];
378   wordl0[1] = pws[gid].i[ 1];
379   wordl0[2] = pws[gid].i[ 2];
380   wordl0[3] = pws[gid].i[ 3];
381
382   u32x wordl1[4];
383
384   wordl1[0] = pws[gid].i[ 4];
385   wordl1[1] = pws[gid].i[ 5];
386   wordl1[2] = pws[gid].i[ 6];
387   wordl1[3] = pws[gid].i[ 7];
388
389   u32x wordl2[4];
390
391   wordl2[0] = 0;
392   wordl2[1] = 0;
393   wordl2[2] = 0;
394   wordl2[3] = 0;
395
396   u32x wordl3[4];
397
398   wordl3[0] = 0;
399   wordl3[1] = 0;
400   wordl3[2] = 0;
401   wordl3[3] = 0;
402
403   const u32 pw_l_len = pws[gid].pw_len;
404
405   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
406   {
407     append_0x80_2 (wordl0, wordl1, pw_l_len);
408
409     switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
410   }
411
412   /**
413    * digest
414    */
415
416   const u32 search[4] =
417   {
418     digests_buf[digests_offset].digest_buf[DGST_R0],
419     digests_buf[digests_offset].digest_buf[DGST_R1],
420     digests_buf[digests_offset].digest_buf[DGST_R2],
421     digests_buf[digests_offset].digest_buf[DGST_R3]
422   };
423
424   /**
425    * salt
426    */
427
428   u32 salt_buf0[4];
429
430   salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
431   salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
432   salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
433   salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
434
435   u32 salt_buf1[4];
436
437   salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
438   salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
439   salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
440   salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
441
442   u32 salt_buf2[4];
443
444   salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
445   salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
446   salt_buf2[2] = 0;
447   salt_buf2[3] = 0;
448
449   const u32 salt_len = salt_bufs[salt_pos].salt_len;
450
451   /**
452    * loop
453    */
454
455   for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
456   {
457     const u32 pw_r_len = combs_buf[il_pos].pw_len;
458
459     const u32 pw_len = pw_l_len + pw_r_len;
460
461     u32 wordr0[4];
462
463     wordr0[0] = combs_buf[il_pos].i[0];
464     wordr0[1] = combs_buf[il_pos].i[1];
465     wordr0[2] = combs_buf[il_pos].i[2];
466     wordr0[3] = combs_buf[il_pos].i[3];
467
468     u32 wordr1[4];
469
470     wordr1[0] = combs_buf[il_pos].i[4];
471     wordr1[1] = combs_buf[il_pos].i[5];
472     wordr1[2] = combs_buf[il_pos].i[6];
473     wordr1[3] = combs_buf[il_pos].i[7];
474
475     u32 wordr2[4];
476
477     wordr2[0] = 0;
478     wordr2[1] = 0;
479     wordr2[2] = 0;
480     wordr2[3] = 0;
481
482     u32 wordr3[4];
483
484     wordr3[0] = 0;
485     wordr3[1] = 0;
486     wordr3[2] = 0;
487     wordr3[3] = 0;
488
489     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
490     {
491       switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
492     }
493
494     u32x w0[4];
495
496     w0[0] = wordl0[0] | wordr0[0];
497     w0[1] = wordl0[1] | wordr0[1];
498     w0[2] = wordl0[2] | wordr0[2];
499     w0[3] = wordl0[3] | wordr0[3];
500
501     u32x w1[4];
502
503     w1[0] = wordl1[0] | wordr1[0];
504     w1[1] = wordl1[1] | wordr1[1];
505     w1[2] = wordl1[2] | wordr1[2];
506     w1[3] = wordl1[3] | wordr1[3];
507
508     u32x w2[4];
509
510     w2[0] = 0;
511     w2[1] = 0;
512     w2[2] = 0;
513     w2[3] = 0;
514
515     u32x w3[4];
516
517     w3[0] = 0;
518     w3[1] = 0;
519     w3[2] = 0;
520     w3[3] = 0;
521
522     u32x w0_t[4];
523     u32x w1_t[4];
524     u32x w2_t[4];
525     u32x w3_t[4];
526
527     make_unicode (w0, w0_t, w1_t);
528     make_unicode (w1, w2_t, w3_t);
529
530     w3_t[2] = pw_len * 8 * 2;
531
532     u32x a = MD4M_A;
533     u32x b = MD4M_B;
534     u32x c = MD4M_C;
535     u32x d = MD4M_D;
536
537     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
538     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
539     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
540     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
541     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
542     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
543     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
544     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
545     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
546     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
547     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
548     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
549     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
550     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
551     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
552     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
553
554     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
555     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
556     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
557     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
558     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
559     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
560     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
561     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
562     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
563     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
564     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
565     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
566     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
567     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
568     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
569     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
570
571     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
572     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
573     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
574     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
575     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
576     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
577     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
578     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
579     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
580     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
581     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
582     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
583     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
584     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
585     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
586     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
587
588     a += MD4M_A;
589     b += MD4M_B;
590     c += MD4M_C;
591     d += MD4M_D;
592
593     w0_t[0] = a;
594     w0_t[1] = b;
595     w0_t[2] = c;
596     w0_t[3] = d;
597     w1_t[0] = salt_buf0[0];
598     w1_t[1] = salt_buf0[1];
599     w1_t[2] = salt_buf0[2];
600     w1_t[3] = salt_buf0[3];
601     w2_t[0] = salt_buf1[0];
602     w2_t[1] = salt_buf1[1];
603     w2_t[2] = salt_buf1[2];
604     w2_t[3] = salt_buf1[3];
605     w3_t[0] = salt_buf2[0];
606     w3_t[1] = salt_buf2[1];
607     w3_t[2] = (16 + salt_len) * 8;
608     w3_t[3] = 0;
609
610     a = MD4M_A;
611     b = MD4M_B;
612     c = MD4M_C;
613     d = MD4M_D;
614
615     MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
616     MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
617     MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
618     MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
619     MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
620     MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
621     MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
622     MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
623     MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
624     MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
625     MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
626     MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
627     MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
628     MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
629     MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
630     MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
631
632     MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
633     MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
634     MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
635     MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
636     MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
637     MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
638     MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
639     MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
640     MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
641     MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
642     MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
643     MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
644     MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
645     MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
646     MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
647     MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
648
649     MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
650     MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
651     MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
652     MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
653     MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
654     MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
655     MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
656     MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
657     MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
658     MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
659     MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
660     MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
661     MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
662
663     bool q_cond = allx (search[0] != a);
664
665     if (q_cond) continue;
666
667     MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
668     MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
669     MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
670
671     const u32x r0 = a;
672     const u32x r1 = d;
673     const u32x r2 = c;
674     const u32x r3 = b;
675
676     #include VECT_COMPARE_S
677   }
678 }
679
680 __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)
681 {
682 }
683
684 __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)
685 {
686 }