0e63e5552620c2e1f0995360a63bef866f1c8b31
[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 #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 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 pw_buf0[4];
40   u32 pw_buf1[4];
41
42   pw_buf0[0] = pws[gid].i[0];
43   pw_buf0[1] = pws[gid].i[1];
44   pw_buf0[2] = pws[gid].i[2];
45   pw_buf0[3] = pws[gid].i[3];
46   pw_buf1[0] = pws[gid].i[4];
47   pw_buf1[1] = pws[gid].i[5];
48   pw_buf1[2] = pws[gid].i[6];
49   pw_buf1[3] = pws[gid].i[7];
50
51   const u32 pw_l_len = pws[gid].pw_len;
52
53   /**
54    * loop
55    */
56
57   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
58   {
59     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
60
61     const u32x pw_len = pw_l_len + pw_r_len;
62
63     /**
64      * concat password candidate
65      */
66
67     u32x wordl0[4] = { 0 };
68     u32x wordl1[4] = { 0 };
69     u32x wordl2[4] = { 0 };
70     u32x wordl3[4] = { 0 };
71
72     wordl0[0] = pw_buf0[0];
73     wordl0[1] = pw_buf0[1];
74     wordl0[2] = pw_buf0[2];
75     wordl0[3] = pw_buf0[3];
76     wordl1[0] = pw_buf1[0];
77     wordl1[1] = pw_buf1[1];
78     wordl1[2] = pw_buf1[2];
79     wordl1[3] = pw_buf1[3];
80
81     u32x wordr0[4] = { 0 };
82     u32x wordr1[4] = { 0 };
83     u32x wordr2[4] = { 0 };
84     u32x wordr3[4] = { 0 };
85
86     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
87     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
88     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
89     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
90     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
91     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
92     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
93     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
94
95     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
96     {
97       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
98     }
99     else
100     {
101       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
102     }
103
104     u32x w0[4];
105     u32x w1[4];
106     u32x w2[4];
107     u32x w3[4];
108
109     w0[0] = wordl0[0] | wordr0[0];
110     w0[1] = wordl0[1] | wordr0[1];
111     w0[2] = wordl0[2] | wordr0[2];
112     w0[3] = wordl0[3] | wordr0[3];
113     w1[0] = wordl1[0] | wordr1[0];
114     w1[1] = wordl1[1] | wordr1[1];
115     w1[2] = wordl1[2] | wordr1[2];
116     w1[3] = wordl1[3] | wordr1[3];
117     w2[0] = wordl2[0] | wordr2[0];
118     w2[1] = wordl2[1] | wordr2[1];
119     w2[2] = wordl2[2] | wordr2[2];
120     w2[3] = wordl2[3] | wordr2[3];
121     w3[0] = wordl3[0] | wordr3[0];
122     w3[1] = wordl3[1] | wordr3[1];
123     w3[2] = wordl3[2] | wordr3[2];
124     w3[3] = wordl3[3] | wordr3[3];
125
126     /**
127      * md5
128      */
129
130     u32x a = MD5M_A;
131     u32x b = MD5M_B;
132     u32x c = MD5M_C;
133     u32x d = MD5M_D;
134
135     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
136     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
137     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
138     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
139     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
140     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
141     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
142     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
143     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
144     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
145     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
146     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
147     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
148     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
149     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
150     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
151
152     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
153     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
154     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
155     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
156     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
157     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
158     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
159     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
160     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
161     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
162     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
163     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
164     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
165     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
166     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
167     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
168
169     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
170     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
171     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
172     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
173     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
174     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
175     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
176     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
177     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
178     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
179     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
180     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
181     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
182     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
183     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
184     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
185
186     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
187     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
188     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
189     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
190     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
191     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
192     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
193     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
194     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
195     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
196     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
197     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
198     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
199     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
200     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
201     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
202
203     a += MD5M_A;
204     b += MD5M_B;
205     c += MD5M_C;
206     d += MD5M_D;
207
208     u32x r_a = a;
209     u32x r_b = b;
210     u32x r_c = c;
211     u32x r_d = d;
212
213     w0[0] = 0;
214     w0[1] = 0;
215     w0[2] = 0;
216     w0[3] = 0;
217     w1[0] = 0;
218     w1[1] = 0;
219     w1[2] = 0;
220     w1[3] = 0;
221     w2[0] = 0;
222     w2[1] = 0x80;
223     w2[2] = 0;
224     w2[3] = 0;
225     w3[0] = 0;
226     w3[1] = 0;
227     w3[2] = 100 * 8;
228     w3[3] = 0;
229
230     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
231     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
232     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
233     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
234     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
235     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
236     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
237     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
238     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
239     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
240     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
241     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
242     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
243     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
244     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
245     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
246
247     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
248     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
249     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
250     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
251     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
252     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
253     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
254     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
255     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
256     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
257     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
258     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
259     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
260     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
261     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
262     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
263
264     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
265     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
266     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
267     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
268     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
269     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
270     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
271     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
272     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
273     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
274     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
275     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
276     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
277     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
278     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
279     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
280
281     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
282     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
283     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
284     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
285     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
286     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
287     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
288     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
289     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
290     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
291     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
292     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
293     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
294     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
295     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
296     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
297
298     a += r_a;
299     b += r_b;
300     c += r_c;
301     d += r_d;
302
303     COMPARE_M_SIMD (a, d, c, b);
304   }
305 }
306
307 __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)
308 {
309 }
310
311 __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)
312 {
313 }
314
315 __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)
316 {
317   /**
318    * modifier
319    */
320
321   const u32 lid = get_local_id (0);
322
323   /**
324    * base
325    */
326
327   const u32 gid = get_global_id (0);
328
329   if (gid >= gid_max) return;
330
331   u32 pw_buf0[4];
332   u32 pw_buf1[4];
333
334   pw_buf0[0] = pws[gid].i[0];
335   pw_buf0[1] = pws[gid].i[1];
336   pw_buf0[2] = pws[gid].i[2];
337   pw_buf0[3] = pws[gid].i[3];
338   pw_buf1[0] = pws[gid].i[4];
339   pw_buf1[1] = pws[gid].i[5];
340   pw_buf1[2] = pws[gid].i[6];
341   pw_buf1[3] = pws[gid].i[7];
342
343   const u32 pw_l_len = pws[gid].pw_len;
344
345   /**
346    * digest
347    */
348
349   const u32 search[4] =
350   {
351     digests_buf[digests_offset].digest_buf[DGST_R0],
352     digests_buf[digests_offset].digest_buf[DGST_R1],
353     digests_buf[digests_offset].digest_buf[DGST_R2],
354     digests_buf[digests_offset].digest_buf[DGST_R3]
355   };
356
357   /**
358    * loop
359    */
360
361   for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
362   {
363     const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
364
365     const u32x pw_len = pw_l_len + pw_r_len;
366
367     /**
368      * concat password candidate
369      */
370
371     u32x wordl0[4] = { 0 };
372     u32x wordl1[4] = { 0 };
373     u32x wordl2[4] = { 0 };
374     u32x wordl3[4] = { 0 };
375
376     wordl0[0] = pw_buf0[0];
377     wordl0[1] = pw_buf0[1];
378     wordl0[2] = pw_buf0[2];
379     wordl0[3] = pw_buf0[3];
380     wordl1[0] = pw_buf1[0];
381     wordl1[1] = pw_buf1[1];
382     wordl1[2] = pw_buf1[2];
383     wordl1[3] = pw_buf1[3];
384
385     u32x wordr0[4] = { 0 };
386     u32x wordr1[4] = { 0 };
387     u32x wordr2[4] = { 0 };
388     u32x wordr3[4] = { 0 };
389
390     wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
391     wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
392     wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
393     wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
394     wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
395     wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
396     wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
397     wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
398
399     if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
400     {
401       switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
402     }
403     else
404     {
405       switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
406     }
407
408     u32x w0[4];
409     u32x w1[4];
410     u32x w2[4];
411     u32x w3[4];
412
413     w0[0] = wordl0[0] | wordr0[0];
414     w0[1] = wordl0[1] | wordr0[1];
415     w0[2] = wordl0[2] | wordr0[2];
416     w0[3] = wordl0[3] | wordr0[3];
417     w1[0] = wordl1[0] | wordr1[0];
418     w1[1] = wordl1[1] | wordr1[1];
419     w1[2] = wordl1[2] | wordr1[2];
420     w1[3] = wordl1[3] | wordr1[3];
421     w2[0] = wordl2[0] | wordr2[0];
422     w2[1] = wordl2[1] | wordr2[1];
423     w2[2] = wordl2[2] | wordr2[2];
424     w2[3] = wordl2[3] | wordr2[3];
425     w3[0] = wordl3[0] | wordr3[0];
426     w3[1] = wordl3[1] | wordr3[1];
427     w3[2] = wordl3[2] | wordr3[2];
428     w3[3] = wordl3[3] | wordr3[3];
429
430     /**
431      * md5
432      */
433
434     u32x a = MD5M_A;
435     u32x b = MD5M_B;
436     u32x c = MD5M_C;
437     u32x d = MD5M_D;
438
439     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
440     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
441     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
442     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
443     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
444     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
445     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
446     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
447     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
448     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
449     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
450     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
451     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
452     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
453     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
454     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
455
456     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
457     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
458     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
459     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
460     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
461     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
462     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
463     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
464     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
465     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
466     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
467     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
468     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
469     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
470     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
471     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
472
473     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
474     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
475     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
476     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
477     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
478     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
479     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
480     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
481     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
482     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
483     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
484     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
485     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
486     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
487     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
488     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
489
490     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
491     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
492     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
493     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
494     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
495     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
496     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
497     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
498     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
499     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
500     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
501     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
502     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
503     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
504     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
505     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
506
507     a += MD5M_A;
508     b += MD5M_B;
509     c += MD5M_C;
510     d += MD5M_D;
511
512     u32x r_a = a;
513     u32x r_b = b;
514     u32x r_c = c;
515     u32x r_d = d;
516
517     w0[0] = 0;
518     w0[1] = 0;
519     w0[2] = 0;
520     w0[3] = 0;
521     w1[0] = 0;
522     w1[1] = 0;
523     w1[2] = 0;
524     w1[3] = 0;
525     w2[0] = 0;
526     w2[1] = 0x80;
527     w2[2] = 0;
528     w2[3] = 0;
529     w3[0] = 0;
530     w3[1] = 0;
531     w3[2] = 100 * 8;
532     w3[3] = 0;
533
534     MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
535     MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
536     MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
537     MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
538     MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
539     MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
540     MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
541     MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
542     MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
543     MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
544     MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
545     MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
546     MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
547     MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
548     MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
549     MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
550
551     MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
552     MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
553     MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
554     MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
555     MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
556     MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
557     MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
558     MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
559     MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
560     MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
561     MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
562     MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
563     MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
564     MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
565     MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
566     MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
567
568     MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
569     MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
570     MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
571     MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
572     MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
573     MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
574     MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
575     MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
576     MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
577     MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
578     MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
579     MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
580     MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
581     MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
582     MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
583     MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
584
585     MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
586     MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
587     MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
588     MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
589     MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
590     MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
591     MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
592     MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
593     MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
594     MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
595     MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
596     MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
597     MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
598
599     if (MATCHES_NONE_VS ((a + r_a), search[0])) continue;
600
601     MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
602     MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
603     MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
604
605     a += r_a;
606     b += r_b;
607     c += r_c;
608     d += r_d;
609
610     COMPARE_S_SIMD (a, d, c, b);
611   }
612 }
613
614 __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)
615 {
616 }
617
618 __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)
619 {
620 }