Merge pull request #241 from philsmd/master
[hashcat.git] / OpenCL / m09900_a1.cl
1 /**
2  * Author......: Jens Steube <jens.steube@gmail.com>
3  * License.....: MIT
4  */
5
6 #define _MD5_
7
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
10
11 #define DGST_R0 0
12 #define DGST_R1 3
13 #define DGST_R2 2
14 #define DGST_R3 1
15
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
22
23 __kernel void m09900_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
24 {
25   /**
26    * modifier
27    */
28
29   const u32 lid = get_local_id (0);
30
31   /**
32    * base
33    */
34
35   const u32 gid = get_global_id (0);
36
37   if (gid >= gid_max) return;
38
39   u32 wordl0[4];
40
41   wordl0[0] = pws[gid].i[ 0];
42   wordl0[1] = pws[gid].i[ 1];
43   wordl0[2] = pws[gid].i[ 2];
44   wordl0[3] = pws[gid].i[ 3];
45
46   u32 wordl1[4];
47
48   wordl1[0] = pws[gid].i[ 4];
49   wordl1[1] = pws[gid].i[ 5];
50   wordl1[2] = pws[gid].i[ 6];
51   wordl1[3] = pws[gid].i[ 7];
52
53   u32 wordl2[4];
54
55   wordl2[0] = 0;
56   wordl2[1] = 0;
57   wordl2[2] = 0;
58   wordl2[3] = 0;
59
60   u32 wordl3[4];
61
62   wordl3[0] = 0;
63   wordl3[1] = 0;
64   wordl3[2] = 0;
65   wordl3[3] = 0;
66
67   const u32 pw_l_len = pws[gid].pw_len;
68
69   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
70   {
71     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
72   }
73
74   /**
75    * loop
76    */
77
78   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
79   {
80     const u32 pw_r_len = combs_buf[il_pos].pw_len;
81
82     const u32 pw_len = pw_l_len + pw_r_len;
83
84     u32 wordr0[4];
85
86     wordr0[0] = combs_buf[il_pos].i[0];
87     wordr0[1] = combs_buf[il_pos].i[1];
88     wordr0[2] = combs_buf[il_pos].i[2];
89     wordr0[3] = combs_buf[il_pos].i[3];
90
91     u32 wordr1[4];
92
93     wordr1[0] = combs_buf[il_pos].i[4];
94     wordr1[1] = combs_buf[il_pos].i[5];
95     wordr1[2] = combs_buf[il_pos].i[6];
96     wordr1[3] = combs_buf[il_pos].i[7];
97
98     u32 wordr2[4];
99
100     wordr2[0] = 0;
101     wordr2[1] = 0;
102     wordr2[2] = 0;
103     wordr2[3] = 0;
104
105     u32 wordr3[4];
106
107     wordr3[0] = 0;
108     wordr3[1] = 0;
109     wordr3[2] = 0;
110     wordr3[3] = 0;
111
112     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
113     {
114       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
115     }
116
117     u32 w0[4];
118
119     w0[0] = wordl0[0] | wordr0[0];
120     w0[1] = wordl0[1] | wordr0[1];
121     w0[2] = wordl0[2] | wordr0[2];
122     w0[3] = wordl0[3] | wordr0[3];
123
124     u32 w1[4];
125
126     w1[0] = wordl1[0] | wordr1[0];
127     w1[1] = wordl1[1] | wordr1[1];
128     w1[2] = wordl1[2] | wordr1[2];
129     w1[3] = wordl1[3] | wordr1[3];
130
131     u32 w2[4];
132
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
138     u32 w3[4];
139
140     w3[0] = wordl3[0] | wordr3[0];
141     w3[1] = wordl3[1] | wordr3[1];
142     w3[2] = wordl3[2] | wordr3[2];
143     w3[3] = wordl3[3] | wordr3[3];
144
145     u32 a = MD5M_A;
146     u32 b = MD5M_B;
147     u32 c = MD5M_C;
148     u32 d = MD5M_D;
149
150     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
151     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
152     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
153     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
154     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
155     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
156     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
157     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
158     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
159     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
160     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
161     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
162     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
163     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
164     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
165     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
166
167     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
168     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
169     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
170     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
171     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
172     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
173     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
174     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
175     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
176     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
177     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
178     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
179     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
180     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
181     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
182     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
183
184     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
185     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
186     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
187     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
188     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
189     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
190     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
191     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
192     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
193     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
194     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
195     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
196     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
197     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
198     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
199     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
200
201     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
202     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
203     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
204     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
205     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
206     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
207     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
208     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
209     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
210     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
211     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
212     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
213     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
214     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
215     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
216     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
217
218     a += MD5M_A;
219     b += MD5M_B;
220     c += MD5M_C;
221     d += MD5M_D;
222
223     u32 r_a = a;
224     u32 r_b = b;
225     u32 r_c = c;
226     u32 r_d = d;
227
228     u32 t0[4];
229     u32 t1[4];
230     u32 t2[4];
231     u32 t3[4];
232
233     t0[0] = 0;
234     t0[1] = 0;
235     t0[2] = 0;
236     t0[3] = 0;
237     t1[0] = 0;
238     t1[1] = 0;
239     t1[2] = 0;
240     t1[3] = 0;
241     t2[0] = 0;
242     t2[1] = 0x80;
243     t2[2] = 0;
244     t2[3] = 0;
245     t3[0] = 0;
246     t3[1] = 0;
247     t3[2] = 100 * 8;
248     t3[3] = 0;
249
250     MD5_STEP (MD5_Fo, a, b, c, d, t0[0], MD5C00, MD5S00);
251     MD5_STEP (MD5_Fo, d, a, b, c, t0[1], MD5C01, MD5S01);
252     MD5_STEP (MD5_Fo, c, d, a, b, t0[2], MD5C02, MD5S02);
253     MD5_STEP (MD5_Fo, b, c, d, a, t0[3], MD5C03, MD5S03);
254     MD5_STEP (MD5_Fo, a, b, c, d, t1[0], MD5C04, MD5S00);
255     MD5_STEP (MD5_Fo, d, a, b, c, t1[1], MD5C05, MD5S01);
256     MD5_STEP (MD5_Fo, c, d, a, b, t1[2], MD5C06, MD5S02);
257     MD5_STEP (MD5_Fo, b, c, d, a, t1[3], MD5C07, MD5S03);
258     MD5_STEP (MD5_Fo, a, b, c, d, t2[0], MD5C08, MD5S00);
259     MD5_STEP (MD5_Fo, d, a, b, c, t2[1], MD5C09, MD5S01);
260     MD5_STEP (MD5_Fo, c, d, a, b, t2[2], MD5C0a, MD5S02);
261     MD5_STEP (MD5_Fo, b, c, d, a, t2[3], MD5C0b, MD5S03);
262     MD5_STEP (MD5_Fo, a, b, c, d, t3[0], MD5C0c, MD5S00);
263     MD5_STEP (MD5_Fo, d, a, b, c, t3[1], MD5C0d, MD5S01);
264     MD5_STEP (MD5_Fo, c, d, a, b, t3[2], MD5C0e, MD5S02);
265     MD5_STEP (MD5_Fo, b, c, d, a, t3[3], MD5C0f, MD5S03);
266
267     MD5_STEP (MD5_Go, a, b, c, d, t0[1], MD5C10, MD5S10);
268     MD5_STEP (MD5_Go, d, a, b, c, t1[2], MD5C11, MD5S11);
269     MD5_STEP (MD5_Go, c, d, a, b, t2[3], MD5C12, MD5S12);
270     MD5_STEP (MD5_Go, b, c, d, a, t0[0], MD5C13, MD5S13);
271     MD5_STEP (MD5_Go, a, b, c, d, t1[1], MD5C14, MD5S10);
272     MD5_STEP (MD5_Go, d, a, b, c, t2[2], MD5C15, MD5S11);
273     MD5_STEP (MD5_Go, c, d, a, b, t3[3], MD5C16, MD5S12);
274     MD5_STEP (MD5_Go, b, c, d, a, t1[0], MD5C17, MD5S13);
275     MD5_STEP (MD5_Go, a, b, c, d, t2[1], MD5C18, MD5S10);
276     MD5_STEP (MD5_Go, d, a, b, c, t3[2], MD5C19, MD5S11);
277     MD5_STEP (MD5_Go, c, d, a, b, t0[3], MD5C1a, MD5S12);
278     MD5_STEP (MD5_Go, b, c, d, a, t2[0], MD5C1b, MD5S13);
279     MD5_STEP (MD5_Go, a, b, c, d, t3[1], MD5C1c, MD5S10);
280     MD5_STEP (MD5_Go, d, a, b, c, t0[2], MD5C1d, MD5S11);
281     MD5_STEP (MD5_Go, c, d, a, b, t1[3], MD5C1e, MD5S12);
282     MD5_STEP (MD5_Go, b, c, d, a, t3[0], MD5C1f, MD5S13);
283
284     MD5_STEP (MD5_H , a, b, c, d, t1[1], MD5C20, MD5S20);
285     MD5_STEP (MD5_H , d, a, b, c, t2[0], MD5C21, MD5S21);
286     MD5_STEP (MD5_H , c, d, a, b, t2[3], MD5C22, MD5S22);
287     MD5_STEP (MD5_H , b, c, d, a, t3[2], MD5C23, MD5S23);
288     MD5_STEP (MD5_H , a, b, c, d, t0[1], MD5C24, MD5S20);
289     MD5_STEP (MD5_H , d, a, b, c, t1[0], MD5C25, MD5S21);
290     MD5_STEP (MD5_H , c, d, a, b, t1[3], MD5C26, MD5S22);
291     MD5_STEP (MD5_H , b, c, d, a, t2[2], MD5C27, MD5S23);
292     MD5_STEP (MD5_H , a, b, c, d, t3[1], MD5C28, MD5S20);
293     MD5_STEP (MD5_H , d, a, b, c, t0[0], MD5C29, MD5S21);
294     MD5_STEP (MD5_H , c, d, a, b, t0[3], MD5C2a, MD5S22);
295     MD5_STEP (MD5_H , b, c, d, a, t1[2], MD5C2b, MD5S23);
296     MD5_STEP (MD5_H , a, b, c, d, t2[1], MD5C2c, MD5S20);
297     MD5_STEP (MD5_H , d, a, b, c, t3[0], MD5C2d, MD5S21);
298     MD5_STEP (MD5_H , c, d, a, b, t3[3], MD5C2e, MD5S22);
299     MD5_STEP (MD5_H , b, c, d, a, t0[2], MD5C2f, MD5S23);
300
301     MD5_STEP (MD5_I , a, b, c, d, t0[0], MD5C30, MD5S30);
302     MD5_STEP (MD5_I , d, a, b, c, t1[3], MD5C31, MD5S31);
303     MD5_STEP (MD5_I , c, d, a, b, t3[2], MD5C32, MD5S32);
304     MD5_STEP (MD5_I , b, c, d, a, t1[1], MD5C33, MD5S33);
305     MD5_STEP (MD5_I , a, b, c, d, t3[0], MD5C34, MD5S30);
306     MD5_STEP (MD5_I , d, a, b, c, t0[3], MD5C35, MD5S31);
307     MD5_STEP (MD5_I , c, d, a, b, t2[2], MD5C36, MD5S32);
308     MD5_STEP (MD5_I , b, c, d, a, t0[1], MD5C37, MD5S33);
309     MD5_STEP (MD5_I , a, b, c, d, t2[0], MD5C38, MD5S30);
310     MD5_STEP (MD5_I , d, a, b, c, t3[3], MD5C39, MD5S31);
311     MD5_STEP (MD5_I , c, d, a, b, t1[2], MD5C3a, MD5S32);
312     MD5_STEP (MD5_I , b, c, d, a, t3[1], MD5C3b, MD5S33);
313     MD5_STEP (MD5_I , a, b, c, d, t1[0], MD5C3c, MD5S30);
314     MD5_STEP (MD5_I , d, a, b, c, t2[3], MD5C3d, MD5S31);
315     MD5_STEP (MD5_I , c, d, a, b, t0[2], MD5C3e, MD5S32);
316     MD5_STEP (MD5_I , b, c, d, a, t2[1], MD5C3f, MD5S33);
317
318     a += r_a;
319     b += r_b;
320     c += r_c;
321     d += r_d;
322
323     const u32 r0 = a;
324     const u32 r1 = d;
325     const u32 r2 = c;
326     const u32 r3 = b;
327
328     #include COMPARE_M
329   }
330 }
331
332 __kernel void m09900_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)
333 {
334 }
335
336 __kernel void m09900_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)
337 {
338 }
339
340 __kernel void m09900_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)
341 {
342   /**
343    * modifier
344    */
345
346   const u32 lid = get_local_id (0);
347
348   /**
349    * base
350    */
351
352   const u32 gid = get_global_id (0);
353
354   if (gid >= gid_max) return;
355
356   u32 wordl0[4];
357
358   wordl0[0] = pws[gid].i[ 0];
359   wordl0[1] = pws[gid].i[ 1];
360   wordl0[2] = pws[gid].i[ 2];
361   wordl0[3] = pws[gid].i[ 3];
362
363   u32 wordl1[4];
364
365   wordl1[0] = pws[gid].i[ 4];
366   wordl1[1] = pws[gid].i[ 5];
367   wordl1[2] = pws[gid].i[ 6];
368   wordl1[3] = pws[gid].i[ 7];
369
370   u32 wordl2[4];
371
372   wordl2[0] = 0;
373   wordl2[1] = 0;
374   wordl2[2] = 0;
375   wordl2[3] = 0;
376
377   u32 wordl3[4];
378
379   wordl3[0] = 0;
380   wordl3[1] = 0;
381   wordl3[2] = 0;
382   wordl3[3] = 0;
383
384   const u32 pw_l_len = pws[gid].pw_len;
385
386   if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
387   {
388     switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
389   }
390
391   /**
392    * digest
393    */
394
395   const u32 search[4] =
396   {
397     digests_buf[digests_offset].digest_buf[DGST_R0],
398     digests_buf[digests_offset].digest_buf[DGST_R1],
399     digests_buf[digests_offset].digest_buf[DGST_R2],
400     digests_buf[digests_offset].digest_buf[DGST_R3]
401   };
402
403   /**
404    * loop
405    */
406
407   for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
408   {
409     const u32 pw_r_len = combs_buf[il_pos].pw_len;
410
411     const u32 pw_len = pw_l_len + pw_r_len;
412
413     u32 wordr0[4];
414
415     wordr0[0] = combs_buf[il_pos].i[0];
416     wordr0[1] = combs_buf[il_pos].i[1];
417     wordr0[2] = combs_buf[il_pos].i[2];
418     wordr0[3] = combs_buf[il_pos].i[3];
419
420     u32 wordr1[4];
421
422     wordr1[0] = combs_buf[il_pos].i[4];
423     wordr1[1] = combs_buf[il_pos].i[5];
424     wordr1[2] = combs_buf[il_pos].i[6];
425     wordr1[3] = combs_buf[il_pos].i[7];
426
427     u32 wordr2[4];
428
429     wordr2[0] = 0;
430     wordr2[1] = 0;
431     wordr2[2] = 0;
432     wordr2[3] = 0;
433
434     u32 wordr3[4];
435
436     wordr3[0] = 0;
437     wordr3[1] = 0;
438     wordr3[2] = 0;
439     wordr3[3] = 0;
440
441     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
442     {
443       switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
444     }
445
446     u32 w0[4];
447
448     w0[0] = wordl0[0] | wordr0[0];
449     w0[1] = wordl0[1] | wordr0[1];
450     w0[2] = wordl0[2] | wordr0[2];
451     w0[3] = wordl0[3] | wordr0[3];
452
453     u32 w1[4];
454
455     w1[0] = wordl1[0] | wordr1[0];
456     w1[1] = wordl1[1] | wordr1[1];
457     w1[2] = wordl1[2] | wordr1[2];
458     w1[3] = wordl1[3] | wordr1[3];
459
460     u32 w2[4];
461
462     w2[0] = wordl2[0] | wordr2[0];
463     w2[1] = wordl2[1] | wordr2[1];
464     w2[2] = wordl2[2] | wordr2[2];
465     w2[3] = wordl2[3] | wordr2[3];
466
467     u32 w3[4];
468
469     w3[0] = wordl3[0] | wordr3[0];
470     w3[1] = wordl3[1] | wordr3[1];
471     w3[2] = wordl3[2] | wordr3[2];
472     w3[3] = wordl3[3] | wordr3[3];
473
474     u32 a = MD5M_A;
475     u32 b = MD5M_B;
476     u32 c = MD5M_C;
477     u32 d = MD5M_D;
478
479     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
480     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
481     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
482     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
483     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
484     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
485     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
486     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
487     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
488     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
489     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
490     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
491     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
492     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
493     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
494     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
495
496     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
497     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
498     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
499     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
500     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
501     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
502     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
503     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
504     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
505     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
506     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
507     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
508     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
509     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
510     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
511     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
512
513     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
514     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
515     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
516     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
517     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
518     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
519     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
520     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
521     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
522     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
523     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
524     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
525     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
526     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
527     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
528     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
529
530     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
531     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
532     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
533     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
534     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
535     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
536     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
537     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
538     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
539     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
540     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
541     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
542     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
543     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
544     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
545     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
546
547     a += MD5M_A;
548     b += MD5M_B;
549     c += MD5M_C;
550     d += MD5M_D;
551
552     u32 r_a = a;
553     u32 r_b = b;
554     u32 r_c = c;
555     u32 r_d = d;
556
557     u32 t0[4];
558     u32 t1[4];
559     u32 t2[4];
560     u32 t3[4];
561
562     t0[0] = 0;
563     t0[1] = 0;
564     t0[2] = 0;
565     t0[3] = 0;
566     t1[0] = 0;
567     t1[1] = 0;
568     t1[2] = 0;
569     t1[3] = 0;
570     t2[0] = 0;
571     t2[1] = 0x80;
572     t2[2] = 0;
573     t2[3] = 0;
574     t3[0] = 0;
575     t3[1] = 0;
576     t3[2] = 100 * 8;
577     t3[3] = 0;
578
579     MD5_STEP (MD5_Fo, a, b, c, d, t0[0], MD5C00, MD5S00);
580     MD5_STEP (MD5_Fo, d, a, b, c, t0[1], MD5C01, MD5S01);
581     MD5_STEP (MD5_Fo, c, d, a, b, t0[2], MD5C02, MD5S02);
582     MD5_STEP (MD5_Fo, b, c, d, a, t0[3], MD5C03, MD5S03);
583     MD5_STEP (MD5_Fo, a, b, c, d, t1[0], MD5C04, MD5S00);
584     MD5_STEP (MD5_Fo, d, a, b, c, t1[1], MD5C05, MD5S01);
585     MD5_STEP (MD5_Fo, c, d, a, b, t1[2], MD5C06, MD5S02);
586     MD5_STEP (MD5_Fo, b, c, d, a, t1[3], MD5C07, MD5S03);
587     MD5_STEP (MD5_Fo, a, b, c, d, t2[0], MD5C08, MD5S00);
588     MD5_STEP (MD5_Fo, d, a, b, c, t2[1], MD5C09, MD5S01);
589     MD5_STEP (MD5_Fo, c, d, a, b, t2[2], MD5C0a, MD5S02);
590     MD5_STEP (MD5_Fo, b, c, d, a, t2[3], MD5C0b, MD5S03);
591     MD5_STEP (MD5_Fo, a, b, c, d, t3[0], MD5C0c, MD5S00);
592     MD5_STEP (MD5_Fo, d, a, b, c, t3[1], MD5C0d, MD5S01);
593     MD5_STEP (MD5_Fo, c, d, a, b, t3[2], MD5C0e, MD5S02);
594     MD5_STEP (MD5_Fo, b, c, d, a, t3[3], MD5C0f, MD5S03);
595
596     MD5_STEP (MD5_Go, a, b, c, d, t0[1], MD5C10, MD5S10);
597     MD5_STEP (MD5_Go, d, a, b, c, t1[2], MD5C11, MD5S11);
598     MD5_STEP (MD5_Go, c, d, a, b, t2[3], MD5C12, MD5S12);
599     MD5_STEP (MD5_Go, b, c, d, a, t0[0], MD5C13, MD5S13);
600     MD5_STEP (MD5_Go, a, b, c, d, t1[1], MD5C14, MD5S10);
601     MD5_STEP (MD5_Go, d, a, b, c, t2[2], MD5C15, MD5S11);
602     MD5_STEP (MD5_Go, c, d, a, b, t3[3], MD5C16, MD5S12);
603     MD5_STEP (MD5_Go, b, c, d, a, t1[0], MD5C17, MD5S13);
604     MD5_STEP (MD5_Go, a, b, c, d, t2[1], MD5C18, MD5S10);
605     MD5_STEP (MD5_Go, d, a, b, c, t3[2], MD5C19, MD5S11);
606     MD5_STEP (MD5_Go, c, d, a, b, t0[3], MD5C1a, MD5S12);
607     MD5_STEP (MD5_Go, b, c, d, a, t2[0], MD5C1b, MD5S13);
608     MD5_STEP (MD5_Go, a, b, c, d, t3[1], MD5C1c, MD5S10);
609     MD5_STEP (MD5_Go, d, a, b, c, t0[2], MD5C1d, MD5S11);
610     MD5_STEP (MD5_Go, c, d, a, b, t1[3], MD5C1e, MD5S12);
611     MD5_STEP (MD5_Go, b, c, d, a, t3[0], MD5C1f, MD5S13);
612
613     MD5_STEP (MD5_H , a, b, c, d, t1[1], MD5C20, MD5S20);
614     MD5_STEP (MD5_H , d, a, b, c, t2[0], MD5C21, MD5S21);
615     MD5_STEP (MD5_H , c, d, a, b, t2[3], MD5C22, MD5S22);
616     MD5_STEP (MD5_H , b, c, d, a, t3[2], MD5C23, MD5S23);
617     MD5_STEP (MD5_H , a, b, c, d, t0[1], MD5C24, MD5S20);
618     MD5_STEP (MD5_H , d, a, b, c, t1[0], MD5C25, MD5S21);
619     MD5_STEP (MD5_H , c, d, a, b, t1[3], MD5C26, MD5S22);
620     MD5_STEP (MD5_H , b, c, d, a, t2[2], MD5C27, MD5S23);
621     MD5_STEP (MD5_H , a, b, c, d, t3[1], MD5C28, MD5S20);
622     MD5_STEP (MD5_H , d, a, b, c, t0[0], MD5C29, MD5S21);
623     MD5_STEP (MD5_H , c, d, a, b, t0[3], MD5C2a, MD5S22);
624     MD5_STEP (MD5_H , b, c, d, a, t1[2], MD5C2b, MD5S23);
625     MD5_STEP (MD5_H , a, b, c, d, t2[1], MD5C2c, MD5S20);
626     MD5_STEP (MD5_H , d, a, b, c, t3[0], MD5C2d, MD5S21);
627     MD5_STEP (MD5_H , c, d, a, b, t3[3], MD5C2e, MD5S22);
628     MD5_STEP (MD5_H , b, c, d, a, t0[2], MD5C2f, MD5S23);
629
630     MD5_STEP (MD5_I , a, b, c, d, t0[0], MD5C30, MD5S30);
631     MD5_STEP (MD5_I , d, a, b, c, t1[3], MD5C31, MD5S31);
632     MD5_STEP (MD5_I , c, d, a, b, t3[2], MD5C32, MD5S32);
633     MD5_STEP (MD5_I , b, c, d, a, t1[1], MD5C33, MD5S33);
634     MD5_STEP (MD5_I , a, b, c, d, t3[0], MD5C34, MD5S30);
635     MD5_STEP (MD5_I , d, a, b, c, t0[3], MD5C35, MD5S31);
636     MD5_STEP (MD5_I , c, d, a, b, t2[2], MD5C36, MD5S32);
637     MD5_STEP (MD5_I , b, c, d, a, t0[1], MD5C37, MD5S33);
638     MD5_STEP (MD5_I , a, b, c, d, t2[0], MD5C38, MD5S30);
639     MD5_STEP (MD5_I , d, a, b, c, t3[3], MD5C39, MD5S31);
640     MD5_STEP (MD5_I , c, d, a, b, t1[2], MD5C3a, MD5S32);
641     MD5_STEP (MD5_I , b, c, d, a, t3[1], MD5C3b, MD5S33);
642     MD5_STEP (MD5_I , a, b, c, d, t1[0], MD5C3c, MD5S30);
643
644     if (allx ((a + r_a) != search[0])) continue;
645
646     MD5_STEP (MD5_I , d, a, b, c, t2[3], MD5C3d, MD5S31);
647     MD5_STEP (MD5_I , c, d, a, b, t0[2], MD5C3e, MD5S32);
648     MD5_STEP (MD5_I , b, c, d, a, t2[1], MD5C3f, MD5S33);
649
650     a += r_a;
651     b += r_b;
652     c += r_c;
653     d += r_d;
654
655     const u32 r0 = a;
656     const u32 r1 = d;
657     const u32 r2 = c;
658     const u32 r3 = b;
659
660     #include COMPARE_S
661   }
662 }
663
664 __kernel void m09900_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)
665 {
666 }
667
668 __kernel void m09900_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)
669 {
670 }