2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "OpenCL/simd.c"
23 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
29 const u32 lid = get_local_id (0);
35 const u32 gid = get_global_id (0);
37 if (gid >= gid_max) return;
42 pws0[0] = pws[gid].i[0];
43 pws0[1] = pws[gid].i[1];
44 pws0[2] = pws[gid].i[2];
45 pws0[3] = pws[gid].i[3];
46 pws1[0] = pws[gid].i[4];
47 pws1[1] = pws[gid].i[5];
48 pws1[2] = pws[gid].i[6];
49 pws1[3] = pws[gid].i[7];
51 const u32 pw_l_len = pws[gid].pw_len;
59 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
60 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
61 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
62 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
66 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
67 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
68 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
69 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
73 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
74 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
75 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
76 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
80 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
81 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
83 const u32 salt_len = salt_bufs[salt_pos].salt_len;
89 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
91 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
93 const u32x pw_len = pw_l_len + pw_r_len;
95 u32x wordr0[4] = { 0 };
96 u32x wordr1[4] = { 0 };
97 u32x wordr2[4] = { 0 };
98 u32x wordr3[4] = { 0 };
100 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
101 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
102 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
103 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
104 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
105 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
106 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
107 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
109 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
111 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
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 w1[0] = wordl1[0] | wordr1[0];
124 w1[1] = wordl1[1] | wordr1[1];
125 w1[2] = wordl1[2] | wordr1[2];
126 w1[3] = wordl1[3] | wordr1[3];
127 w2[0] = wordl2[0] | wordr2[0];
128 w2[1] = wordl2[1] | wordr2[1];
129 w2[2] = wordl2[2] | wordr2[2];
130 w2[3] = wordl2[3] | wordr2[3];
131 w3[0] = wordl3[0] | wordr3[0];
132 w3[1] = wordl3[1] | wordr3[1];
133 w3[2] = wordl3[2] | wordr3[2];
134 w3[3] = wordl3[3] | wordr3[3];
136 append_0x80_4x4 (w0, w1, w2, w3, pw_len);
138 const u32x pw_salt_len = pw_len + salt_len;
144 // first step fixed 56 bytes of salt
151 w0_t[0] = salt_buf0[0];
152 w0_t[1] = salt_buf0[1];
153 w0_t[2] = salt_buf0[2];
154 w0_t[3] = salt_buf0[3];
155 w1_t[0] = salt_buf1[0];
156 w1_t[1] = salt_buf1[1];
157 w1_t[2] = salt_buf1[2];
158 w1_t[3] = salt_buf1[3];
159 w2_t[0] = salt_buf2[0];
160 w2_t[1] = salt_buf2[1];
161 w2_t[2] = salt_buf2[2];
162 w2_t[3] = salt_buf2[3];
163 w3_t[0] = salt_buf3[0];
164 w3_t[1] = salt_buf3[1];
166 // after 56 byte salt, we have beginning of the password
182 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
183 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
184 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
185 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
186 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
187 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
188 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
189 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
190 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
191 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
192 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
193 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
194 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
195 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
196 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
197 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
199 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
200 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
201 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
202 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
203 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
204 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
205 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
206 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
207 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
208 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
209 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
210 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
211 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
212 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
213 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
214 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
216 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
217 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
218 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
219 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
220 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
221 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
222 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
223 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
224 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
225 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
226 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
227 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
228 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
229 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
230 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
231 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
233 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
234 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
235 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
236 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
237 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
238 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
239 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
240 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
241 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
242 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
243 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
244 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
245 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
246 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
247 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
248 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
276 w3_t[2] = pw_salt_len * 8;
279 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
280 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
281 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
282 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
283 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
284 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
285 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
286 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
287 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
288 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
289 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
290 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
291 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
292 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
293 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
294 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
296 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
297 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
298 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
299 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
300 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
301 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
302 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
303 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
304 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
305 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
306 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
307 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
308 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
309 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
310 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
311 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
313 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
314 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
315 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
316 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
317 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
318 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
319 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
320 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
321 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
322 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
323 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
324 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
325 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
326 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
327 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
328 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
330 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
331 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
332 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
333 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
334 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
335 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
336 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
337 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
338 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
339 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
340 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
341 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
342 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
343 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
344 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
345 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
351 COMPARE_M_SIMD (a, d, c, b);
355 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
359 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
363 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
369 const u32 lid = get_local_id (0);
375 const u32 gid = get_global_id (0);
377 if (gid >= gid_max) return;
382 pws0[0] = pws[gid].i[0];
383 pws0[1] = pws[gid].i[1];
384 pws0[2] = pws[gid].i[2];
385 pws0[3] = pws[gid].i[3];
386 pws1[0] = pws[gid].i[4];
387 pws1[1] = pws[gid].i[5];
388 pws1[2] = pws[gid].i[6];
389 pws1[3] = pws[gid].i[7];
391 const u32 pw_l_len = pws[gid].pw_len;
399 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
400 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
401 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
402 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
406 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
407 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
408 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
409 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
413 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
414 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
415 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
416 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
420 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
421 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
423 const u32 salt_len = salt_bufs[salt_pos].salt_len;
429 const u32 search[4] =
431 digests_buf[digests_offset].digest_buf[DGST_R0],
432 digests_buf[digests_offset].digest_buf[DGST_R1],
433 digests_buf[digests_offset].digest_buf[DGST_R2],
434 digests_buf[digests_offset].digest_buf[DGST_R3]
441 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
443 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
445 const u32x pw_len = pw_l_len + pw_r_len;
447 u32x wordr0[4] = { 0 };
448 u32x wordr1[4] = { 0 };
449 u32x wordr2[4] = { 0 };
450 u32x wordr3[4] = { 0 };
452 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
453 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
454 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
455 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
456 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
457 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
458 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
459 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
461 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
463 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
471 w0[0] = wordl0[0] | wordr0[0];
472 w0[1] = wordl0[1] | wordr0[1];
473 w0[2] = wordl0[2] | wordr0[2];
474 w0[3] = wordl0[3] | wordr0[3];
475 w1[0] = wordl1[0] | wordr1[0];
476 w1[1] = wordl1[1] | wordr1[1];
477 w1[2] = wordl1[2] | wordr1[2];
478 w1[3] = wordl1[3] | wordr1[3];
479 w2[0] = wordl2[0] | wordr2[0];
480 w2[1] = wordl2[1] | wordr2[1];
481 w2[2] = wordl2[2] | wordr2[2];
482 w2[3] = wordl2[3] | wordr2[3];
483 w3[0] = wordl3[0] | wordr3[0];
484 w3[1] = wordl3[1] | wordr3[1];
485 w3[2] = wordl3[2] | wordr3[2];
486 w3[3] = wordl3[3] | wordr3[3];
488 append_0x80_4x4 (w0, w1, w2, w3, pw_len);
490 const u32x pw_salt_len = pw_len + salt_len;
496 // first step fixed 56 bytes of salt
503 w0_t[0] = salt_buf0[0];
504 w0_t[1] = salt_buf0[1];
505 w0_t[2] = salt_buf0[2];
506 w0_t[3] = salt_buf0[3];
507 w1_t[0] = salt_buf1[0];
508 w1_t[1] = salt_buf1[1];
509 w1_t[2] = salt_buf1[2];
510 w1_t[3] = salt_buf1[3];
511 w2_t[0] = salt_buf2[0];
512 w2_t[1] = salt_buf2[1];
513 w2_t[2] = salt_buf2[2];
514 w2_t[3] = salt_buf2[3];
515 w3_t[0] = salt_buf3[0];
516 w3_t[1] = salt_buf3[1];
518 // after 56 byte salt, we have beginning of the password
534 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
535 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
536 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
537 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
538 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
539 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
540 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
541 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
542 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
543 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
544 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
545 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
546 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
547 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
548 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
549 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
551 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
552 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
553 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
554 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
555 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
556 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
557 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
558 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
559 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
560 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
561 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
562 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
563 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
564 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
565 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
566 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
568 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
569 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
570 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
571 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
572 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
573 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
574 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
575 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
576 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
577 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
578 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
579 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
580 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
581 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
582 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
583 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
585 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
586 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
587 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
588 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
589 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
590 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
591 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
592 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
593 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
594 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
595 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
596 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
597 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
598 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
599 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
600 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
628 w3_t[2] = pw_salt_len * 8;
631 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
632 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
633 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
634 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
635 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
636 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
637 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
638 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
639 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
640 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
641 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
642 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
643 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
644 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
645 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
646 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
648 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
649 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
650 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
651 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
652 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
653 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
654 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
655 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
656 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
657 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
658 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
659 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
660 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
661 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
662 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
663 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
665 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
666 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
667 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
668 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
669 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
670 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
671 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
672 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
673 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
674 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
675 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
676 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
677 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
678 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
679 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
680 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
682 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
683 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
684 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
685 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
686 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
687 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
688 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
689 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
690 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
691 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
692 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
693 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
694 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
695 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
696 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
697 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
703 COMPARE_S_SIMD (a, d, c, b);
707 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
711 __kernel void m11000_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)