2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "inc_vendor.cl"
11 #include "inc_hash_constants.h"
12 #include "inc_hash_functions.cl"
13 #include "inc_types.cl"
14 #include "inc_common.cl"
15 #include "inc_simd.cl"
17 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
23 const u32 lid = get_local_id (0);
29 const u32 gid = get_global_id (0);
31 if (gid >= gid_max) return;
36 pw_buf0[0] = pws[gid].i[0];
37 pw_buf0[1] = pws[gid].i[1];
38 pw_buf0[2] = pws[gid].i[2];
39 pw_buf0[3] = pws[gid].i[3];
40 pw_buf1[0] = pws[gid].i[4];
41 pw_buf1[1] = pws[gid].i[5];
42 pw_buf1[2] = pws[gid].i[6];
43 pw_buf1[3] = pws[gid].i[7];
45 const u32 pw_l_len = pws[gid].pw_len;
56 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
57 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
58 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
59 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
60 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
61 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
62 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
63 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
64 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
65 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
66 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
67 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
68 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
69 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
70 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
71 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
73 const u32 salt_len = salt_bufs[salt_pos].salt_len;
79 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
81 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
83 const u32x pw_len = pw_l_len + pw_r_len;
86 * concat password candidate
89 u32x wordl0[4] = { 0 };
90 u32x wordl1[4] = { 0 };
91 u32x wordl2[4] = { 0 };
92 u32x wordl3[4] = { 0 };
94 wordl0[0] = pw_buf0[0];
95 wordl0[1] = pw_buf0[1];
96 wordl0[2] = pw_buf0[2];
97 wordl0[3] = pw_buf0[3];
98 wordl1[0] = pw_buf1[0];
99 wordl1[1] = pw_buf1[1];
100 wordl1[2] = pw_buf1[2];
101 wordl1[3] = pw_buf1[3];
103 u32x wordr0[4] = { 0 };
104 u32x wordr1[4] = { 0 };
105 u32x wordr2[4] = { 0 };
106 u32x wordr3[4] = { 0 };
108 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
109 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
110 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
111 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
112 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
113 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
114 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
115 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
117 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
119 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
123 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
131 w0[0] = wordl0[0] | wordr0[0];
132 w0[1] = wordl0[1] | wordr0[1];
133 w0[2] = wordl0[2] | wordr0[2];
134 w0[3] = wordl0[3] | wordr0[3];
135 w1[0] = wordl1[0] | wordr1[0];
136 w1[1] = wordl1[1] | wordr1[1];
137 w1[2] = wordl1[2] | wordr1[2];
138 w1[3] = wordl1[3] | wordr1[3];
139 w2[0] = wordl2[0] | wordr2[0];
140 w2[1] = wordl2[1] | wordr2[1];
141 w2[2] = wordl2[2] | wordr2[2];
142 w2[3] = wordl2[3] | wordr2[3];
143 w3[0] = wordl3[0] | wordr3[0];
144 w3[1] = wordl3[1] | wordr3[1];
145 w3[2] = wordl3[2] | wordr3[2];
146 w3[3] = wordl3[3] | wordr3[3];
148 const u32x pw_salt_len = salt_len + pw_len;
154 // first step fixed 56 bytes of salt
155 // after 56 byte salt, we have beginning of the password
162 w0_t[0] = salt_buf0[0];
163 w0_t[1] = salt_buf0[1];
164 w0_t[2] = salt_buf0[2];
165 w0_t[3] = salt_buf0[3];
166 w1_t[0] = salt_buf1[0];
167 w1_t[1] = salt_buf1[1];
168 w1_t[2] = salt_buf1[2];
169 w1_t[3] = salt_buf1[3];
170 w2_t[0] = salt_buf2[0];
171 w2_t[1] = salt_buf2[1];
172 w2_t[2] = salt_buf2[2];
173 w2_t[3] = salt_buf2[3];
174 w3_t[0] = salt_buf3[0];
175 w3_t[1] = salt_buf3[1];
188 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
189 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
190 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
191 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
192 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
193 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
194 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
195 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
196 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
197 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
198 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
199 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
200 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
201 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
202 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
203 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
205 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
206 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
207 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
208 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
209 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
210 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
211 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
212 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
213 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
214 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
215 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
216 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
217 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
218 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
219 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
220 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
222 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
223 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
224 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
225 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
226 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
227 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
228 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
229 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
230 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
231 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
232 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
233 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
234 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
235 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
236 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
237 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
239 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
240 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
241 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
242 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
243 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
244 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
245 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
246 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
247 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
248 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
249 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
250 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
251 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
252 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
253 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
254 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
282 w3_t[2] = pw_salt_len * 8;
285 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
286 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
287 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
288 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
289 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
290 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
291 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
292 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
293 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
294 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
295 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
296 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
297 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
298 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
299 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
300 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
302 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
303 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
304 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
305 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
306 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
307 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
308 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
309 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
310 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
311 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
312 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
313 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
314 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
315 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
316 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
317 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
319 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
320 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
321 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
322 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
323 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
324 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
325 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
326 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
327 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
328 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
329 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
330 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
331 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
332 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
333 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
334 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
336 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
337 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
338 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
339 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
340 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
341 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
342 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
343 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
344 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
345 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
346 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
347 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
348 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
349 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
350 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
351 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
358 COMPARE_M_SIMD (a, d, c, b);
362 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
366 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
370 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
376 const u32 lid = get_local_id (0);
382 const u32 gid = get_global_id (0);
384 if (gid >= gid_max) return;
389 pw_buf0[0] = pws[gid].i[0];
390 pw_buf0[1] = pws[gid].i[1];
391 pw_buf0[2] = pws[gid].i[2];
392 pw_buf0[3] = pws[gid].i[3];
393 pw_buf1[0] = pws[gid].i[4];
394 pw_buf1[1] = pws[gid].i[5];
395 pw_buf1[2] = pws[gid].i[6];
396 pw_buf1[3] = pws[gid].i[7];
398 const u32 pw_l_len = pws[gid].pw_len;
409 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
410 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
411 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
412 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
413 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
414 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
415 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
416 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
417 salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8];
418 salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9];
419 salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10];
420 salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11];
421 salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12];
422 salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13];
423 salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14];
424 salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15];
426 const u32 salt_len = salt_bufs[salt_pos].salt_len;
432 const u32 search[4] =
434 digests_buf[digests_offset].digest_buf[DGST_R0],
435 digests_buf[digests_offset].digest_buf[DGST_R1],
436 digests_buf[digests_offset].digest_buf[DGST_R2],
437 digests_buf[digests_offset].digest_buf[DGST_R3]
444 for (u32 il_pos = 0; il_pos < il_cnt; il_pos += VECT_SIZE)
446 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
448 const u32x pw_len = pw_l_len + pw_r_len;
451 * concat password candidate
454 u32x wordl0[4] = { 0 };
455 u32x wordl1[4] = { 0 };
456 u32x wordl2[4] = { 0 };
457 u32x wordl3[4] = { 0 };
459 wordl0[0] = pw_buf0[0];
460 wordl0[1] = pw_buf0[1];
461 wordl0[2] = pw_buf0[2];
462 wordl0[3] = pw_buf0[3];
463 wordl1[0] = pw_buf1[0];
464 wordl1[1] = pw_buf1[1];
465 wordl1[2] = pw_buf1[2];
466 wordl1[3] = pw_buf1[3];
468 u32x wordr0[4] = { 0 };
469 u32x wordr1[4] = { 0 };
470 u32x wordr2[4] = { 0 };
471 u32x wordr3[4] = { 0 };
473 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
474 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
475 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
476 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
477 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
478 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
479 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
480 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
482 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
484 switch_buffer_by_offset_le_VV (wordr0, wordr1, wordr2, wordr3, pw_l_len);
488 switch_buffer_by_offset_le_VV (wordl0, wordl1, wordl2, wordl3, pw_r_len);
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 w1[0] = wordl1[0] | wordr1[0];
501 w1[1] = wordl1[1] | wordr1[1];
502 w1[2] = wordl1[2] | wordr1[2];
503 w1[3] = wordl1[3] | wordr1[3];
504 w2[0] = wordl2[0] | wordr2[0];
505 w2[1] = wordl2[1] | wordr2[1];
506 w2[2] = wordl2[2] | wordr2[2];
507 w2[3] = wordl2[3] | wordr2[3];
508 w3[0] = wordl3[0] | wordr3[0];
509 w3[1] = wordl3[1] | wordr3[1];
510 w3[2] = wordl3[2] | wordr3[2];
511 w3[3] = wordl3[3] | wordr3[3];
513 const u32x pw_salt_len = salt_len + pw_len;
519 // first step fixed 56 bytes of salt
520 // after 56 byte salt, we have beginning of the password
527 w0_t[0] = salt_buf0[0];
528 w0_t[1] = salt_buf0[1];
529 w0_t[2] = salt_buf0[2];
530 w0_t[3] = salt_buf0[3];
531 w1_t[0] = salt_buf1[0];
532 w1_t[1] = salt_buf1[1];
533 w1_t[2] = salt_buf1[2];
534 w1_t[3] = salt_buf1[3];
535 w2_t[0] = salt_buf2[0];
536 w2_t[1] = salt_buf2[1];
537 w2_t[2] = salt_buf2[2];
538 w2_t[3] = salt_buf2[3];
539 w3_t[0] = salt_buf3[0];
540 w3_t[1] = salt_buf3[1];
553 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
554 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
555 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
556 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
557 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
558 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
559 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
560 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
561 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
562 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
563 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
564 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
565 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
566 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
567 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
568 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
570 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
571 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
572 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
573 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
574 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
575 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
576 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
577 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
578 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
579 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
580 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
581 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
582 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
583 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
584 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
585 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
587 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
588 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
589 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
590 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
591 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
592 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
593 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
594 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
595 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
596 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
597 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
598 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
599 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
600 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
601 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
602 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
604 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
605 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
606 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
607 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
608 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
609 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
610 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
611 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
612 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
613 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
614 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
615 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
616 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
617 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
618 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
619 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
647 w3_t[2] = pw_salt_len * 8;
650 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
651 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
652 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
653 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
654 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
655 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
656 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
657 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
658 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
659 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
660 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
661 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
662 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
663 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
664 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
665 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
667 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
668 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
669 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
670 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
671 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
672 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
673 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
674 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
675 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
676 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
677 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
678 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
679 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
680 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
681 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
682 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
684 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
685 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
686 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
687 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
688 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
689 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
690 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
691 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
692 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
693 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
694 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
695 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
696 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
697 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
698 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
699 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
701 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
702 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
703 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
704 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
705 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
706 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
707 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
708 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
709 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
710 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
711 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
712 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
713 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
714 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
715 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
716 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
723 COMPARE_S_SIMD (a, d, c, b);
727 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)
731 __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_scryptV0_buf, __global u32 *d_scryptV1_buf, __global u32 *d_scryptV2_buf, __global u32 *d_scryptV3_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)